So 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...
\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...
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
@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
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
@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.
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 ;)
@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?
"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
@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
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.
@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.
@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.
I really love that: final ThrowingUnaryOperator<Path> operator = Path::toRealPath; Files.list(foo).map(operator.orReturnSelf()).forEach(System.out::println);
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?
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.