dafny assert violated using sequence - recursion

Here is the dafny code, the second assertion never pass, anyone can help me out? enter link description here

Dafny seems to have an easier time if you just use s[1..] instead of the equivalent s[1..|s|]. The updated version is at http://rise4fun.com/Dafny/1AQN.

Related

Gremlin optional as empty

Could you please help me to understand whether there is any option where we can skip the optional in the gremlin,
the scenario is, we are traversing through a graph and has an optional statement
depending on a query parameter in the request, I will be having a traverse path for optional, if not, there is no path for the optional
for example,
if query_parameter:
path=has('labeltest').inE().outV()
g.V('test').optional(path)
as optional path is for the query_parameter available condition, this is failing and returning no result if query parameter not available. We don't prefer to repeat the code on the g.v() by an if and else condition. Any thoughts to tell the optional to not do anything or dummy options to return the previous path. Appreciate your thoughts as I am new to this, thank you in advance
Regards
Hari
In the case where you want nothing to happen you could just set your path variable to be identity(). The effect would be as follows:
gremlin> g.V('3').optional(identity())
==>v[3]
Specifically, in Python you can do this:
>>> p=__.identity()
>>> g.V('3').optional(p).next()
v[3]
If you are doing this from python using the Gremlin Language Variant (GLV) then you can only add the optional portion of the query when needed. GLV's are lazily evaluated so you can conditionally construct them in code. They will only be executed when you add a terminal step (e.g. toList()). This means that you can build your traversal like this:
t=g.V('test')
if query_parameter:
t=t.has('labeltest').inE().outV()
res=t.toList()
With this code, the optional path portion of the traversal will only be executed when query_parameter is True, else it will just return the test vertex.

Plone Conditional - If Content Type is Versionable

Is there a simple way to check if a content-type, or a specific object, has Versioning enabled/disabled in Plone (4.3.2)?
For context, I am making some unique conditionals around portal_actions. So instead of checking path('object/##iterate_control').checkout_allowed(), I need to first see if versioning is even enabled. Otherwise, the action in question does not display for items that have versioning disabled, because obviously it isn't checkout_allowed.
I didn't have any luck with good ole Google, and couldn't find this question anywhere here, so I hope it's not a dupe. Thanks!
I was able to get this working by creating a new script, importing getToolByName, and checking current content type against portal_repository.getVersionableContentTypes(). Then just included that script in the conditional.
I was looking for something like this that already existed, so if anyone knows of one let me know. Otherwise, I've got my own now. Thanks again!
The first thing that checkout_allowed does is check if the object in question supports versioning at all:
if not interfaces.IIterateAware.providedBy(context):
return False
(the interface being plone.app.iterate.interfaces.IIterateAware:
class IIterateAware( Interface ):
"""An object that can be used for check-in/check-out operations.
"""
The semantics Interface.providedBy(instance) are a bit unfortunate for usage in conditions or TAL scripts, because you'd need to import the interface, but there's a reversal helper:
context.portal_interface.objectImplements(context,
'plone.app.iterate.interfaces.IIterateAware')

linked in IN.API.Raw

/people-search:(people:(id,first-name,last-name,date-of-birth,summary,industry,group-memberships,job-bookmarks,interests,associations,public-profile-url,picture-url,headline))?keyword=retail&count=500
the above search gets me all my connections when it is just suppost to get the ones in retail.
?keyword=cytdcytxyrtr4dftubiugiuguukjkjp
this does the same...
I am glad that I get 'a' result but why aren't params working?
I think it's "keywords" plural. Does that fix things?

Lotus Notes #formula language: Order of Actions wrong?

I have defined an action with the following two commands:
#Prompt([...]; "1");
#Command([ToolsRunMacro];"(AGENT)");
#Prompt([...]; "2");
#If(#GetProfileField("PrivateProfile";"LENGTH";#UserName))>0;#PostedCommand([Compose];"FORM");"");
#Prompt([...]; "3");
But with the #Prompt commands I found out, that first of all each of the #Promptmessages (1-3) are displayed and after that the AGENT runs. But as the AGENT manipulates the LENGTHfield, the #IF statement compares an 'obsolete' value.
Maybe each statement is executed at once? If yes: how can I prevent the agent from this behavior?
I would appreciate any help!
The [ToolsRunMacro] command will always run after all #Functions have executed first. There is no way to change this.
You can get a list of what commands will execute straight away vs after other functions that execute at the end, in the infocenter documentation.
http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_COMMAND.html
Also something to be aware on your code is that Profile documents are cached. So you might not in all cases see any changes made to the document straight away.

What is wrong with my recurrence data string?

I'm trying to create recurrence rule to export my timetable to Google Calendar, but I'm doing something wrong.
The string is the following:
'DTSTART;TZID=Europe/London:20100822T080000\r\nRRULE:FREQ=WEEKLY;COUNT=5;BYDAY=Mo,Tu,We,Th,Fr;UNTIL=20100827T164500Z\r\nDTEND;TZID=Europe/London:20100822T180000\r\n'
It is working fine if you will take off the part with UNTIL (this part which I hard coded for test: ;UNTIL=20100827T164500Z) but with UNTIL there it's not working(and I need that UNTIL to be there).
I was looking to the document RFC2445 and I don't find what can be wrong with until.
Thanks for any help!
COUNT and UNTIL are mutually exclusive. See Recurrence Rule definition.

Resources