Is it possible to use Long FK in activejdbc? - activejdbc

I found the following code in org.javalite.activejdbc.Model.parent method:
List<Map> results = new DB(getMetaModelLocal().getDbName()).findAll(query, Integer.parseInt(fkValue));
Does it mean that we can't use Long FK in Active JDBC? We will have NumberFormatException if it's more than Integer.MAX_VALUE = 2147483647.

No, this is an omission on our part. We filed an issue: https://github.com/javalite/activejdbc/issues/375 to fix it. Usually things like that are fixed within day/two. Thanks for reporting!
UPDATE TO THE ANSWER:
You are looking at old code. This commit: https://github.com/javalite/activejdbc/commit/d183cb3ac8c567504d4d5a47986fe549dd1aebca fixed this issue on May 31, 2014.

Related

Object name contains more than the maximum prefixes allowed

I have seen a lot of questions about this but I couldn't find the correct answer for me which works.
The object which triggers the problem is like
test123.de.company.com.Database.dbo.Table
Test123.de.company.com
is the database Server.
Object name contains more than the maximum prefixes allowed
I have tried to write it like this [test123.de.company.com].Database.dbo.Table just like [test123.de.company.com].[Database].[dbo].[Table]
Can you tell me what's wrong with this?
Please try this:
["test123.de.company.com"].[Database].[dbo].[Table]
OP also encountered a new problem after implementing this solution above. OP said:
Thank you! This worked for me. To be more precise, the join is for a
view and if I save/close and then later get back to the design option
the quote marks are removed and there is [test123.de.company.com] left
over and the error returns. Is there a way to keep them fixed?
Otherwise if I change anything I always have to add the quote marks
again and again
Then with the help of DaleK that problem also was solved. DaleK:
Don't use the design option, script it as alter instead

Neo4j CYPHER node_auto_index for range lookup

I'd like to know if there's any way how to use auto indexing for range lookup. If I query something like
START age=node:node_auto_index(age<20 and age>10)
RETURN age;
it returns
Exception in thread "main" string literal or parameter expected.
I also tried something like
START age=node:node_auto_index(age = range(10,20))
RETURN age;
but it looks like it needs just age = "15" or something like that.
Any ideas what to do please?
The Lucene documentation states that the range syntax is as follows:
age:[10 TO 20]
The resulting query (but haven't tested this):
START age=node:node_auto_index("age:[10 TO 20]")
RETURN age;
The following read might also be interesting for you: Range queries in Neo4j using Lucene query syntax
EDIT: not sure if it will work for you; check out this github issue.
Why not to use where clause, something like below?
START node=node:node_auto_index(name='PersonName')
where node.age > 20 and node.age <20
RETURN node.age;
Following a workshop with Stefan Armbruster from Neo4J Technologies the same topic came up.
The most basic solution we came up with was to make sure that all the values stored for the numeric property has the same length. Thus, one will need to pad the age property values as follows, 011, 099, 103... And the values are stored as strings not numeric values.
Doing this everything should work from the index.

Cocoa Interface Builder - Number Formatter Bug?

I am trying to put in a range using a Number Formatter component added to a text file. The problem occurs when I input a consistent sequence of number '9'. The field will keep on adding to what is in there ( i .e. 99999999999) up to a 10th number, and then the field will be changed to a random 6 digit number?
Is that a bug with the Number Formatter? Any workarounds?
Also, can I create my own number formatter? That would be the best if a bug does exist I think.
Thanks!
I have tried the same thing on another version of Xcode and it seems to works fine.. Maybe a problem with that version's number formatter..
Thanks for your help.

Objective-C, Expression result unused, from some old code?

I've getting the following warning Expression result unused
I've inherited the code from my predecessor and I've no idea how to fix this?
Obviously syntax has changed, any ideas ?
static float lowValue;
static float highValue;
- (void) calculateHighLow{
highValue; //here
lowValue; // and here
Simply delete those two lines, they have no purpose.
Obviously those two lines don't do anything so you can just remove them.
If they aren't being used anywhere you can just delete the lines, or you can simply just decide to deal with the warning (though not a good idea). You can also comment out the code, in case you figure out that might need them someday.

Nhibernate C# - Return only objects where string property is not null or empty

I'm writing a query using ICriteria that should return only the objects where property "Message" has value (i.e. is not null or empty). Below is the format I'm using.
ICriteria.Add(Restrictions.Not(Restrictions.Eq("Message", " "));
ICriteria.Add(Restrictions.Not(Restrictions.Eq("Message", String.Empty));
Can somebody help me with this? Thank you!
You might want something like:
ICriteria a = session.CreateCriteria(typeof(A));
a.add(Restrictions.Not(Restrictions.Eq("Message", " "));
a.add(Restrictions.Not(Restrictions.Eq("Message", string.Empty));
Although, your first one isn't really checking null, it's checking a single space.
I've not tried this, but it thnk the following should work:
ICriteria crit = session.CreateCriteria(typeof(theType))
.Add(Restrictions.IsNotNull("Message"))
.Add(Restrictions.IsNotEmpty("Message"));
Finally, I discovered the combination I was looking for!
lvCriteria.Add(Restrictions.Not(Expression.Eq("Msg", string.Empty)));
This combination of Restrictions and Expression works as expected; narrowing out all empty strings. I do not know why I could not achieve these results earlier even with:
lvCriteria.Add(Restrictions.Not(Restrictions.Eq("Msg", string.Empty)));
Thank you to all who tried.
What you really need is:
ICriteria crit = session.CreateCriteria(typeof(theType))
.Add(Restrictions.Not(Restrictions.Eq("Msg", string.Empty)))
.Add(Restrictions.IsNotNull("Msg"))
This is working fine for me and profiler shows correct SQL i.e. something like:
msg<>'' and msg is not null.
First answer did not work for me as Restrictions.IsNotEmpty/Empty applies only to collections (in NH 2.0.1 at least).