« first day (1560 days earlier)      last day (3367 days later) » 

2:16 PM
@fge I would like to know how could I write a rule considering multiple values for a key?
sequence(
firstOf(ignoreCase("sno"), ignoreCase("sname")),
var.set(match().toLowerCase()),
!collectedValues.containsKey(var.get())
);
 
fge
@JavaTechnical but this value would set the same property?
 
yes
for example..
 
fge
Then use trie()
 
sno101
no101
num101
number101
all point to sno property only
you mean like this..
 
fge
No, since a trie() only takes strings
Darn, you make things difficult, you know
Uppercase, lowercase, several keys...
 
2:19 PM
I would like to give the flexibility to user and understand him.
number, no, sno all mean the same thing
 
fge
Don't give THAT much flexibility
If it is you who defines the protocol, YOU define the boundaries
 
see, like google understands things.
 
fge
The stricter the boundaries are, the faster parsing will be, that's pretty much obvious, right?
 
yes
but just look at the way google understands search query!
 
fge
Yeah, but Google is Google
 
2:20 PM
pretty much like that
 
fge
They have the means to do it
 
in the sense?
means means?
 
fge
They can dedicate hundreds of thousands of man-hours to make their search engine understand nearly everything on Earth
 
fge
You are not hundreds of thousands of man-hours
You are you
Don't go overboard, you'll only get hurt
 
2:22 PM
Hi people! Can I ask a android related question here please?
 
but I would like to know, at least how to do it?
 
fge
Well, this is not a search engine you are developing, right?
 
@fge Yet their search engine still sucks.
 
fge
Then limit your possible inputs
 
2:25 PM
ok
I have some optional fields there too.
i mean optional properties
 
fge
What is more, if you give too much flexibility, you'll have to document all the stuff eventually; would you rather have a 10 page document or a 200 page document?
Which do you think the end user will prefer?
Which would you rather write?
 
too much in the sense, not too much, but just a quite better flexbility.
I mean i am not going to look up the dictionary to search synonyms for "student number"
but no,sno,num that's it.
 
fge
OK, is your project on github?
 
fge
If it were it'd be easier for me to help ;)
 
2:28 PM
unfortunately, i don't have. :(
could you tell me how to include optional fields?
 
fge
Creating a github account is very easy
Sure, there's a rule called optional() ;)
 
how does it work with this snippet?
sequence(
firstOf(ignoreCase("sno"), ignoreCase("sname")),
var.set(match().toLowerCase()),
!collectedValues.containsKey(var.get())
);
if sname is optional.
for example
 
fge
You are still using obsolete code, there
Put your project on github, I tell you
 
ok
@fge do you want me to create a gist?
 
fge
2:32 PM
No, create the project and put all your code in it
A gist will not be enough
Aaah, damnit, I have SOOO much work to do on grappa
 
to check if anywhere within it has the character sequence "10"? - I don ´t use regex in this case
 
@Goldbones Hey welcome back!
 
Sorry. Lunch time
 
For example, you can iterate through the string yourself:
inner [(String foo) -> boolean] {
    boolean meh = false;
    for (final char each : foo.toCharArray())
      if (meh && '0' == each) return true;
      else if ('1' == each) meh = true;
      else meh = false;
}
 
fge
@Goldbones use .indexOf()
 
2:39 PM
And even simpler, you can check if .indexOf() is not -1, or even use .contains() method, which computes in linear time with potential self-optimizations.
Though, by using regex, you do this:
1. Compile a Pattern object. This means you're allocating memory for a new object if a desired Pattern cannot be loaded from previously (Java caches objects to reuse thru a binary implementation if not destroyed into phantom). As always, 'new' is kinda the most expensive language feature in Java, as Java makes everything lighter thru JIT.
2. By using .matcher() to create a new matcher object, you once again create a new object, but with the exception that this object stores references to your string and allocates a few integer variables, so much resources are allocated just so you can perfo
- Left pointer is now 0, and head-first recursion loops through to look for "1". This is not self-optimizable.
- Right pointer finally gets the task and points at the "1". Now the left pointer points at N + 1. This is not self-optimizable either.
- Left and right pointer matches to assert a match. The match is done and a subpattern string object is allocated for .group() reference, which means you create a new substring for no reason - you won't really use it
And all that goes to asserting that "10" is present. And there's my short insight on why regex isn't the right way to go.
This is a problem with regex implementation in Java, in a few languages that supports this natively, it's actually better (and hence there are never parser implementations in these), but meh.
 
So, for you, what situation (s) you advice to choose regex?
 
in RegEx - Regular Expressions, Nov 17 '14 at 13:46, by Unihedron
to parse or to use regex... that is the question
Always use parsers, unless you're doing a quick task that possibly won't be repeated; Or even more specifically, only use it when you need it, for example when providing regex features.
 
Ok, thanks for this explanation
So for this String: 12-03-1999 12:12:21,12-03-2000 12:13:21 to check if this dates are correct what´s the best approach?
Create two strings separate by ,?
and then run simple data formater to check if are dates?
 
fge
@Goldbones yes, and then use a datetime parser to parse
 
@Goldbones .split(","), then take the result and assert it is length of two, then run simpledateformat thru both to assert no exception.
 
2:52 PM
Exactly, thanks ;)
 
Adz
hello
 
fge
With Java 8 you can use .splitAsStream() from a Pattern
Which is quite nice
 
Adz
since we're on the topic of dates is it bad that I only know how to use joda time in regards to time in java 1.7 or below?
 
fge
@Adz no, not bad at all; but then you might want to replace joda time with threetenbp
 
Adz
oooooooh
that looks good
 
fge
3:09 PM
@Adz the fact that I recommend this library is not "innocent"
Do you know what "threeten" means in "threetenbp"?
 
Adz
no
 
fge
This is a reference to JSR 310
And JSR 310 is nothing other than the new datetime API in Java 8, which is heavily modeled on Joda Time
But different in some respects
three (3) ten (10)
And bp is for "backport"
So, use threetenbp and you will basically be ready for Java 8's API
really loves his BackgroundTaskRunner; it's soo easy to delegate to the background with it
 
Lolz
Are you praising your own creation? :-P
 
fge
Yeah, sorry :p
But seriously it's really nice
 
3:29 PM
there is an easiest way to see if a String like 12-03-1999 12:12:21 matches a list of dateFormats?
 
Don
help me to get retrieve an integer from a list and assigned to an integer variable
when i assigned to integer getting following error
java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Integer
 
fge
@ItachiUchiha you can grab it for your own projects if you like
No objections ;)
 
Adz
@Don post some code
 
why you dont cast? (BigInteger)blabla
 
=javadoc BigDecimal
 
3:40 PM
@Vogel612 java.math.BigDecimal: Immutable, arbitrary-precision signed decimal numbers. A BigDecimal consists of an arbitrary precision integer unscaled value and a 32-bit integer scale. If zero or positive, the scale is the number of digits to the right of the decimal point. If negative, the unscaled value of the number is multiplied by ten to the power of the negation of the scale. The ...
value of the number represented by the BigDecimal is therefore (unscaledValue × 10-scale). (1/19)
 
@Don Decimals usually aren't integers. You could go the way around and cast the BigDecimal to a BigInteger before putting it into an Integer, but you're losing loads of information by doing that
 
fge
=javadoc BigDecimal#intValueExact()
 
@fge int intValueExact(): Converts this BigDecimal to an int, checking for lost information. If this BigDecimal has a nonzero fractional part or is out of the possible range for an int result then an ArithmeticException is thrown.
 
fge
^^^^
 
dammit I overlooked that one
 
3:56 PM
Hi everybody,
any idea how can I get aidl classpth ?
 
fge
H-2; world handball championship, France against Spain; the current reigning olympic and European champion against the current reigning world champion
That is going to be some match
 
4:16 PM
what is meant by Error:JAVA_HOME incorrectly set?
 
you didn't set JAVA_HOME correctly...
 
I have JAVA_HOME=D:\Program Files\Java\jdk1.7.0_13\
 
it's exactly what it says on the tin
you need to enclose it in quotes
else it won't work for windows
 
I have set it in my computer environment variables (system)
 
because windows and spaces in foldernames, ya know
28 secs ago, by Vogel612
you need to enclose it in quotes
SET JAVA_HOME="%JAVA_HOME%"
EXPORT JAVA_HOME
 
4:17 PM
ok
Now, I am getting like this.
Error: Could not find or load main class Files\Java\jdk1.7.0_13"\lib\tools.jar;
 
ya that kinda borked...
 
fge
@JavaTechnical your quotes are misplaced somewhat
 
yes, I removed \ at last.
and it worked
 
what are you even doing?
 
what does the above error mean?
 
fge
4:21 PM
It means the automated windows runner for jar files mistook an option to the JVM for the jar to run
Which, in return, means that you didn't do it right to make it run with Windows
And as I'm not a Windows user, this is as far as I can help you
 
I am trying to run storm ui
Here is the storm cmd
and there is :ui there
 
fge
Haven't you been advised against using such stuff already? That is, unless you really have a need for them?
And that's not the worst of it
"Heavy duty" and "Windows" are antinomics
 
Windows sucks.
 
In this file..
there is nimbus.childopts: "-Xmx1024m"
Is it the cause of the problem?
......
set JAVA_HEAP_MAX=-Xmx1024m
This is the cause of the problem, i think.
How can i change this?
 
4:39 PM
@fge Well I will do it definitely, wherever I work on my next UI project
@fge You are good at exciting people :P
 
fge
0
A: Java NIO Zip Filesystem equivalent of setMethod() in java.util.zip.ZipEntry

fgeThis is not very well documented but there is a FileAttributeView by the name zip. Now, whether it may answer your needs or not... Here is the code from a zip of mine: public static void main(final String... args) throws IOException { final Path zip = Paths.get("/home/fge/t.zip"); f...

JSR 203 FTW :p
 
5:21 PM
hi
 
hi
 
Anyone know of any good diagram software? I need to diagram a figure of a person making different arm movements, eg arm abduction, lateral rotation etc
 
MS Paint?
 
I'm using Visio but the person is only a front view
possibly, but I don't know if that would look professional. That could be an option though.
 
 
1 hour later…
6:42 PM
Greetings all
 
Greetings Kylar
 
 
1 hour later…
fge
7:49 PM
France WON! France 26 - 22 Spain
 
@Unihedro You around?
(or anyone else who has knowledge of automatic bots searching Stack Overflow for crap)
 
 
1 hour later…
fge
8:55 PM
@SimonAndréForsberg question, is the library unit tested?
 
@fge what library?
 
fge
JChatExchange
 
@fge you'll have to ask @Unihedro about that, it's his library. I haven't started using it (yet).
And AFAIK, its development is pretty stale, they're working on the JavaBot repository instead
but I would be surprised if it is unit-tested.
 
fge
OK...
 
 
1 hour later…
fge
10:17 PM
0
Q: How do you mock a JavaFX toolkit initialization?

fge[preamble: apologies, there is a lot of code here, and some of it may not be relevant to this question while some code which is necessary to understand the problem may be missing; please comment, and I will edit the question accordingly.] Environment: Ubuntu 14.10 x86_64; Oracle JDK 1.8u25. Unit...

 

« first day (1560 days earlier)      last day (3367 days later) »