Autogenerated keys in Pilog - lisp

What's the best way to go about autogenerated keys for Pilog? i've
been digging around a bit and can't find anything related.
Hints and pointers would be most appreciated. Thank you.

You get the same behavior as auto increment in for instance MySQL with this
one: http://software-lab.de/doc/refG.html#genKey
I use it a lot in the VizReader code.
I'm not so sure I would've used it much though if I had know about the (id)
function from the start: http://software-lab.de/doc/refI.html#id
In my case it's all about displaying a nice id that is easy to relate for
humans and JavaScript in my non-traditional gui and as you can see both
approaches accomplish that but that latter is imo more elegant.
/Henrik Sarvell
(Copied verbatim form Henrik Sarvells' answer.)

Related

Murmur Hash simple flowchart?

I found MurmurHash recently as one of the fastest, and MurmurHash3 is the new version of MurmurHash.
I also found the complete explanation of MurmurHash in a Diagram by Ian Boyd.
This diagram really looks awesome but I understand only a bit of it since I'm still a newbie and have interest in Hashing.
It would be very helpful if someone could help me with a simple MurmurHash3 Flowchart.
Since I'm a newbie and still can't add any comment there, I also don't know how to contact Ian Boyd either, I'm trying to ask it here..
update
I made my own MurmurHash3 flowchart.
Will upload it later
I'm sorry for my noobness and bad in English. Thank you
I know I am reply late, but it may help any one else...
Murmur hashing is a non cryptographic hash function
which is used for hash based look-ups , it uses 3 basic operations as a whole Multiply, Rotate and XOR. It uses multiple constants which are just there to make it good hash function by passing 2 basic tests.
Avalanche Test
Chi-Squared Test
You can watch this video, which I made, for the detail explanation of Murmur Hashing.

Railstutorial #5 Section 3.4 Need of full_title helper. Help needed to understand the benefits

in Chapter 5 Section 3.4 of the rails-3-2.railstutorial it says
Of course, this is essentially a duplicate of the helper in Listing 4.2, but having two independent methods allows us to catch any typos in the base title. This is dubious design, though, and a better (slightly more advanced) approach, which tests the original full_title helper directly, appears in the exercises (Section 5.6).
I did as it said, but i do not understand the mentioned benefit
...having two independent methods allows us to catch any typos in the base title.
The "original" method in application_helper.rb and the test method in spec/support/utilities.rb act exactly the same. So from my point of view it´s a disvantage - there are two places to missspell.
I am new to ruby & rails and having a hard time cause the tutorial covers alot of new stuff, so please bear with me. I would be glad if someone could take some time to help me to understand.
Kind regards,
Stephen
RSpec is a tool for testing.
So it's kind of check list that it "should" be.
If there is a typo one of two methods, the RSpec test will fail, so that you can notice there is something wrong there.
I hope this helps.

Is there a port for KStem for .NET?

I'm about to launch into a Lucene.NET implementation and I am concerned about using the PorterStemFilter. Reading here, and reading source code, it appears to be far, far too aggressive for my needs.
I need something simpler that doesn't look for roots but just removes "er", "ed", "s", etc suffixes. From what I've read, KStem would do the trick.
I can't for the life of me find a .NET version of KStem. I can't even find source code for the Java version to handroll a port.
Could someone point me in the right direction?
Looks like it is easy enough to handcraft a reduced PorterStemmer by simply removing steps I don't want. Anyone have success with that?
You could use the HunspellStemmer, part of contrib. It can use freely available hunspell dictionaries to provide proper stemming.

Set Logic / Options in Scala^Z3

I can't figure out, how to set a logic and the according options in Scala^Z3.
Guess its really simple, but I just can't find it.. so I really would appreciate some help there ;)
Regards,
Florian
ps.: Scala 3.2 and Z3 4.0 work really fine together :)
In case you are still looking...
There are two ways to set options:
Pass the parameters when you construct your Z3Config instance, e.g. new Z3Config("MODEL" -> true).
Call .setParamValue on a Z3Config instance, e.g. myConf.setParamValue("MODEL", true).
Now to answer the particular question on how to set the logic, that is unfortunately not supported by Z3's API. You can take a look at Leo's answer to this similar question for C#.
Note that strictly speaking you don't really need that option when using the API, though: all theories can be used and Z3 will magically figure out what to do.

Creating Macro's in C#

Is there a way to create macros in c#
ex:
string checkString = "'bob' == 'bobthebuilder'" (this will be dynamic)
if (##checkString)
//.........
else
//.........
Thanks
No, C# doesn't have macros. You could capture your logic in a delegate and apply that delegate in multiple places, potentially... would that help?
If you could describe the problem you're trying to solve rather than the solution you think you'd like, we may be able to help more.
T4 seems to be gaining traction these days for .NET work. It's not quite what you asked for, but it may be extremely beneficial in some cases (or it may just be a hint down the wrong path).
In most cases, esp. with generics, I do not wish for 'templates' or 'macros' in C# (or Scala). In the example above, you could simply use:
bool sameStuff = "'bob' == 'bobthebuilder'";
...
if (sameStuff) {
...
}
More complex cases can generally be dealt with refactoring methods or using anonymous functions.
Additionally, attributes (while a completely different approach) round out the case for many "traditional" uses of templates.
As mentioned, no, but there are a number of other approaches:
Conditional compilation via #if
Templating via T4 or something else (we use a port of Ned Batchelder's (mentioned) Cog
Aspect-Oriented Programming via something like PostSharp
As Jon said, lots of ways; it'd be better to describe exactly what you want to do.
Short answer: No.
Long answer: You can write a wrapper around the C/C++ compiler's preprocessor.
Most of the syntax will be accepted with the notable exception of #region/#endregion. You can just prefix those with #pragma before processing, and remove the #pragma part afterwards.