« first day (1528 days earlier)      last day (3637 days later) » 
00:00 - 17:0017:00 - 00:00

fge
fge
17:06
There's a regex question for you to answer!
2
Q: Splitting a String works in Java, doesn't work on Android

iZBasitSo I have this logic which splits a String by 4 characters each. Something like this 0108011305080508000000 gives 0108 0113 0508 0508 0000 00 The logic I used is String [] splitErrorCode = inputString.split("(?<=\\G....)"); It works great in Java, but when I run it in Android I get the wron...

I proposed an alternative solution but the OP wants to know why \G doesn't work on Android...
I'm afraid it's not a quick one. But I'll answer! :)
go go uni
17:23
hi
if(m.group(1)  && m.group(1) != null)  { System.out.println(m.group(1)); }
i want to do liie the above.
but it shows an error.
i want to check for the group existance and also it wouldn't be a null value.
i think both are same.
am i correct?
@AvinashRaj syntax error
fge
fge
@AvinashRaj Matcher#group(int) does not return a boolean for starters
i just answer a question/ stackoverflow.com/a/27692968/3297613
the first string would return 3 matches.
I shouldn't answer things
>_<
no
and the second string would return 4 matches.
for the 1st line
fge
fge
17:27
@AvinashRaj if your matcher matches, all groups will exist
i get null for the non-existance 4th group.
fge
fge
Now, some may, or may not, have a value
current output is
thumb.top
==
group.top + 20
null
group.intrinsicHeight
==
preamble.bottom
!medium
see there is a null value.
i'm trying to remove that null value.
I think it's so simple.
that's all.
@fge no for the 1st line, there isn't a 4th group.
BRS
BRS
Hi everyone. Am I allowed to request a review of a piece of code here. I read the FAQ. But I am not sure whether one can ask or not
17:31
@BRS codereview.stackexchange
BRS
BRS
@ZouZou ): Unfortunately I got no response but 2 upvotes for my question on codereview. Thank you.
fge
fge
@BRS codereview is not as high traffic as SO is but it is the place for this kind of questions nevertheless
@BRS if you visit the chat on CR there might be someone who can have a look at your question. It's a smaller community but they are nice people
BRS
BRS
Yeah. I got the point. As I am relatively new to SE I asked. Thank you one and all.
fge
fge
Heh, throwing-lambdas really rocks after all
It's so useful to be able to use throwing method references
17:40
0
A: Splitting a String works in Java, doesn't work on Android

Unihedro\G in Java was added in Java 6 to mimic the Perl construct: http://perldoc.perl.org/perlfaq6.html#What-good-is-%5CG-in-a-regular-expression: You use the \G anchor to start the next match on the same string where the last match left off. Support for this was very poor. This cons...

BRS
BRS
Is there a chat room for Code Review?
@BRS Head for The 2nd Monitor, it's on Code Review
completed the test I think
oops borked
fge
fge
@Unihedro maybe the test is good but the code is broken
@BRS 2nd monitor

 The 2nd Monitor

General discussion about codereview.stackexchange.com - Welcom...
BRS
BRS
Thanks
17:43
@Gemtastic it's not spoonfeeding week yet, wait two more weeks :P
wait fixed it
@Unihedro Sorry, I couldn't help it. D;
lol kidding :D
It passes!
But am I doing it right?
fge
fge
@Unihedro errwait, MyException is what here?
@fge the exception down there
fge
fge
Ah, sorry, haven't seen
removes the cruft from his eyes
Uh, no, that's not what should happen
Sh*t
I knew it, the code is broken
17:51
:O
Phew - fortunately, tested
fge
fge
The exception thrown should have been IllegalStateException
final RuntimeException exception = new IllegalStateException(oops);
Hmm...
Maybe compiler broke it?
fge
fge
Nah, .isExactlyInstanceOf() doesn't lie
I wonder what happens here
(or does it lie?)
MyException sounds like an EMO Java band
I changed isExactlyInstanceOf to IllegalStateException.class, and now it passes as well.
fge
fge
17:54
Uh
So, .isExactlyInstanceOf() is broken?
Uhwell, running by hand, I'll see what's what
Wait, is intellij even running this test? I right click on com.github.fge.lambdas and "Run 'tests'..."
isExactlyInstanceOf(void.class) passes as well
wait
I knew it
I didn't add @Test
<- laugh at this stupid developer
ok I fixed it, the code is correct and the test is corrected
But wait, e.getSuppressed() is []
fge
fge
Yes
The code is broken
fge
fge
Argh
with log for you
hmm
fge
fge
18:00
It's in getHandle()
fge
fge
I think I see what is happening
Yup, that's what I thought
IllegalStateException is thrown by getHandle()
And it is caught by the Error | RuntimeException
Therefore it is rethrown as is
Oh!!!
fge
fge
I need to define a new exception here
I'm going to sleep now, good luck!
18:10
Sleep tight Uni
fge
fge
OK, found!
Fixed, now I'll write the tests
http://www.commitstrip.com/en/2014/12/29/when-i-fix-a-bug-for-a-coder-whos-on-vacation/?utm_source=rss&utm_medium=rss&utm_campaign=when-i-fix-a-bug-for-a-coder-whos-on-vacation
CommitStrip - Blog relating the daily life of web agencies developers
When I fix a bug for a coder who’s on vacation
CommitStrip
1419876906
 
4 hours later…
fge
fge
21:51
Hmmm, so, someone seems to think that I abuse default methods
Well, I can't say I disagree
22:20
Well eff you too image
fge
fge
22:30
Aah, javadoc
Meh, I could do with some help :p
Is that an offer?
Adz
Adz
hello
fge
fge
@Gemtastic could be ;) And you could learn a thing or two about stream usage as well
Adz
Adz
anyone read effective java here? I'm thinking of buying it
fge
fge
22:31
And git
@fge I love stream <3
fge
fge
@Adz I have, still do, and will -- my advice: buy it :p
I even made a song about stream
Adz
Adz
ok great i've read good things about it
fge
fge
@Gemtastic I am of course talking about Java 8 Streams :p
@Adz most of them are probably right on the money; in any case, you can't lose by having this book in your bookshelf
That's my opinion, mind
22:34
hi
Adz
Adz
do you reckon it's too high of a step from reading a beginners book tho?
I've read head first java but it feels too gimmicky with the images
i dno
I'll quote you the song:
"Well I ain't want no cluster.
No spaghetti code.
I want it faster when it loads!

You gotta, stream it baby.
You better, stream it baby.
It's java 8 and no more hate
so stream it, stream it alright."
i am searching for a database for a server I am writing. it should support sql and java objects, ist there something like that?
fge
fge
@Adz no, not really; you do don't need to be a Java expert to appreciate the advices in it
Adz
Adz
ok great
fge
fge
22:36
@th3falc0n why Java objects?
@th3falc0n try JooQ
And use PostgreSQL
@Gemtastic so, is that a yes or a no? :p
@fge If I can help you, I'd love to
fge
fge
Sure you can; do you know your git?
@fge: it should support java object, so I can store HashMaps ^^
No >_>
But I have an account on github?
Adz
Adz
lol Xd
fge
fge
22:39
@th3falc0n storing maps as is is a design smell already
@fge
@fge: thanks for your compliment :)
fge
fge
@Gemtastic well, I can teach you about what you need to know about git, of course
fge
fge
@th3falc0n err, that was not a compliment, not sure if you are ironic or not here
@fge: it was ironic, how can u tell that my design is bad, just because I need to store maps?
and who needs a good design for a 3 day minigame project at all?
fge
fge
22:41
@th3falc0n because it is a clear witness of an object model which lacks specifications
What is more, SQL and OOP objects are fundamentally antagonistic to one another
@th3falc0n that's the line you'll hate yourself for, and all your colleagues too, when you're working with real stuff but can't do it right because you never actually did have proper code structure
Also, all your projects will be useless in your portfolio
:P
fge
fge
@th3falc0n my advice, really, is play with JooQ
And DO NOT use MySQL -- please
Each time you use MySQL, God kills a kitten
You don't want that
JooQ will make you understand that in ORM, the R matters more than the O
As it should be
I already feel like don't listening to your advice, cause 2 people started assuming I don't know what I am doing, when I just asked for a solution to a clearly defined problem
fge
fge
@Gemtastic OK, do you know how to clone, fetch and rebase?
@th3falc0n excuse me but "storing maps" is clearly a sign of a NOT clearly defined problem
@fge I know nothing >_>
fge
fge
22:46
Feel free to ignore my advice, of course
And bite yourself silly later on
@fge perhaps you should guide him towards the answer for how you extract the objects and put them into the db in a better manner?
On the other hand, I kinda get if you don't wanna offer more advice now :P
I don't want to ignore your advice. I will listen to it.
@th3falc0n Pro tip: if you think an advice is bad, ignore it. Making a remark on it will make demotivated to help you.
It's not meant to sound snazzy or anything, just a friendly tip
"storing maps as is is a design smell already" is not an friendly advice. It just means "Oh, seems like I can do your project better"
@th3falc0n Well, how else do you want us to comment on that your design is flawed?
I could build a house made out of horse shit, but it'd probably be better if I used wood or bricks.
I sure would have appreciated the mention of it if I only knew there was horseshit to build with.
And I just had a major deja vu
fge
fge
22:54
@th3falc0n storing a map means you are aiming for a "more flexible than thou" design, whereas most of the time you'll only have to store three, four known fields; in this case a basic POJO can do this much better and it is typesafe to boot
So I will now tell you what I do: In my minigame a session will result in a HashMap filled with everything that hapenned in the game (key = timestamp, value = action). If I want to rewatch a game later the simplest thing is to save and recall that map.
fge
fge
And what is the action?
and integer and a byte array
*an
fge
fge
Hmm, a byte array? And what's in it?
Does it have a bound size?
@Gemtastic uh, well, this means you need to start from point 0 with git then :p
@fge: different things. chat, every game move
and so on
22:57
@fge Yep. It's precisely why I haven't gotten to it yet. I haven't had the time looking it up since I have sourcetree and bitbucket
fge
fge
@th3falc0n and how have you structured this in Java so far? The way I see it you'd need at least three tables
How, in code, do you intend to recognize the type of the event?
I will have a action registry which registers an Action class for each ID, and then casts the action to this specific class and handles it.
fge
fge
I have an alternative proposal
Create a GameEvent interface with a replay() method
When you read from the database, make the instantiation automatic behind the scenes
the server application that reads the database does not replay the game. it will just pass the replay to a client which requests it
fge
fge
Who said anything about the server here? The server will only feed you with the data
23:07
it is a network game
fge
fge
It is up to the client to instantiate the POJOs
Not the server
i am not talking about the database server
which btw shouldn't exist, cause the gameserver should use a file based database without an external application in the best case.
fge
fge
Send three queries to the server: one asking for all events sorted by date in a time period; one asking for all chat events matching the id set which you obtained, one asking for all game moves matching the id set which you obtained
That's a win-win situation since all three are very fast, you use the database to its fullest here
And it is a 3NF model to boot
No redundancy at all
Uhwait, weren't you the one who asked about an SQL engine earlier on?
well... when we treat the hashmap as an byte array which is a game, it is much easier for a game client to just ask the game server for that byte array.
I asked for an in Java database which supports the language SQL for queries ;)
fge
fge
No, it only looks easier
Storing POJOs directly is almost never the thing to do
There are dedicated storage engines which perform filtering in a much more efficient way than Java would ever be able to do; use them
And RDBMSes are such storage engines
23:11
Ah, I enjoy to read this.
fge
fge
What will you do when you have three years worth of backlog? Send the three years-long map to a client which only cares about the last three days?
sips on my tea and keeps reading
a game will only last a maximum of 16 turns... which is about an hour for slow games...
and I don't think that any of the 20 people I am writing this for will use the game to just chat for 3 years straight
fge
fge
Ohwell, if you are still stuck with your map, just go for it; but I tell you one last time, in my opinion you are doing it wrong
I know that I am doing it "wrong". But in my case any overengineering is just useless.
fge
fge
23:14
This is not a question of overengineering, it's a question of good design practices
@th3falc0n Why?
fge
fge
Such design practices apply whatever the size of the project, and even toy projects benefit from that
I mean, I started throwing-lambdas on a whim
And now it's not just a toy project anymore, in fact
because we just want to play a board game which doesn't exist as an computer game yet
fge
fge
@th3falc0n that is all the more of a reason to design it well; this way, people who want to play it with your code will appreciate the quality of the project (should you choose to share it with the world)
it is the same question like, if you are going to sort 1000 coins. will you just start sorting them by hand or will you go and design a sorter to do it in 1 second?
fge
fge
23:17
Amazon wouldn't use my JSON Schema library if I had designed it with a shovel and clay
what is the worse solution you think?
Adz
Adz
hey guys, when you serialise objects, are they deserialised in the order you serialise them?
fge
fge
@Adz serialized using what?
Adz
Adz
objectoutputstream
fge
fge
Aiie, Serializable
Well, I guess so
Adz
Adz
23:19
sorry, british spelling eyy
fge
fge
Yeah, I see that ;)
"Serialization is, unquestionably, the worst language feature ever added to any language that made it out of the nursery [...] And it's the gift that keeps on giving" (Brian Goetz, speaking about Serializable)
@Adz I guess the answer is yes; if it weren't, Serializable would be even more useless than what it currently is
(if fge would know that I am currently using ObjectOutputStream to send HashMaps over the network xD)
Adz
Adz
lol!
fge
fge
Ohwell, back to coding
23:23
I still don't understand why I shouldn't to it in fast and dirty projects ^^
*do
@th3falc0n because you'll only learn to do it fast and dirty.
fge
fge
Because the day you stumble upon a not-so-fast-and-dirty project you'll be stuck
You can do it fast and dirty when you no longer need to ask for help ;P
fge
fge
That's why
What's more, it's very self satisfying to achieve a good design
You gain confidence and can do things even better, start to experiment more etc
@Gemtastic: remember that I didn't ask for help, I asked for a library. And I don't mainly do Java. I mainly do C++ so you can't judge me for not knowing every possible java library
23:27
@th3falc0n We're not blaming you for anything, we're just informing you of that what you're doing is bad
or "bad code design"
I still don't understand why that matters to you!?
because good code don't stink :P
We like to raise good Java developers
Yeah... but it is really annoying if you are told stuff that you know but ignore in your current project. It doesn't help at all
If that project would need to be used and contributed to by other people, I would probably listen to you for hours telling me new things... But in this case...
@th3falc0n It does. It brings up a chance for you to re-evaluate your priorities and empirically this was not the case for people like you. I am not surprised.
Morning already Uni?
23:34
"people like you" ?
what are you trying to tell me?
Gotta head out, I have a workshop @Gem
@Unihedro ah I see
You run on so little sleep
fge
fge
@Gemtastic he's gonna pay for it, one day
@th3falc0n: The straightforward fact: You run on unbelievable dependencies (MySQL), have an XY Problem, and are with a stance that the better code for the task doesn't matter.
@fge You're talking to someone brain-damaged by lack of sleep ;P
23:38
@fge Yep..
@Unih
... fucking habit to press enter in a auto selection thingy
What?
@Unihedro: What do you mean with mysql as an dependency?
and where is searching a database library a XY problem?
and yes, in this point i am looking for simplicity, not good design
@th3falc0n My habit is to tab :')
@th3 It's an XY Problem because you're expecting the database to delegate the serialization of any arbitrary Java object. This means you have a mess of your objects and they cannot pass raw state.
fge
fge
23:43
@Gemtastic not that I am one to talk, mind you
I should sleep more
Anyway, nearly done with the javadoc
Do as he says, not as he does
fge
fge
throwing-lambdas 0.3.0 is near the corner
@Unihedro: ok, we replace Object with a BLOB...
23:44
@fge I kinda miss the days when I didn't sleep. I go so much stuff done :/
fge
fge
I really love that: final ThrowingUnaryOperator<Path> operator = Path::toRealPath; Files.list(foo).map(operator.orReturnSelf()).forEach(System.out::println);
Or operator.fallbackTo(Path::toAbsolutePath)
Yay
@th3falc0n Ok then try for PostgreSQL, MongoDB if the demand is small, or any other NoSQL iff you have a larger demand for DB support
@fge I love how that nethod is named.
fge
fge
Which one?
@fge: fallbackTo
I will try to reformulate my whole question into a brand new one...
fge
fge
23:48
Well, I'm not 100% satisfied with it, but...
Is there a Java library to manage a file-based relational database which doesn't need a dedicated server and is able to store BLOBs?
fge
fge
Anyway, I have enough javadoc for the time being --> release
@th3falc0n yes there is
h2, for instance
But for your use case, blobs are useless
... Yeah.
fge
fge
(not that you'd listen to me, anyway)
Anyways good luck! And well done on the release, this project is fantastic, just like most of your other ones
23:50
OK... one last time I will repeat my methaphor: If I have to sort 1000 coins each year, should I just sort them by hand or build a machine to do it?
(metaphor*)
fge
fge
@th3falc0n the assumption that you will only have to do this once a year is misplaced at best
And in a year you'd have the time to think about several designs and build the machine to boot
yeah it is. i will only do this project for the next to days and will never touch this again
your designation to force me into "doing the right stuff" is really pathetic...
but thank you for pointing me to H2... i think it will help
Keyword: you
@Unihedro: what is your problem again?
23:56
@th3falc0n We're not forcing you to do anything, we just don't wanna help you when you do something we think is bad.
fge
fge
@th3falc0n well, then good day to you, I won't bother anymore
Reminds me of that other dude harrassing Uni yesterday demanding that Uni became his private tutor, regardless if Uni even knew anything about the subject
wow you don't help me because you can't accept the fact that I am doing something in another way than you... that is exactly what some dictators thought about some groups of people they didn't like... very pathetic really...
the typical arrogance of every programmer in this world
@th3falc0n This is public domain, I say (publish) whatever I want. Are you questioning my stance of doing everything in a correct (maintainable and useful) way when you're in a chat room for programmers?
When you're the one asking for help you don't get to set the demands
2
Why do we have to help you other than out of the kindness of our hearts?
23:59
^ Pin-worthy but the star transcript is full. :(
fge
fge
Speaking of broken code.... @Unihedro I have fixed ThrowablesFactory
you aren't forced to help me
I never told that
And doing what we've done is by far more helpful to people than just saying "no" with no motivation when someone wants to write smelly code. We don't know if that person even knows there's another way.
Oh really? Kk, forking thru SSH, on phone right noe
but your way to help me probably will make me never come back
00:00 - 17:0017:00 - 00:00

« first day (1528 days earlier)      last day (3637 days later) »