« first day (436 days earlier)      last day (2693 days later) » 

12:00 AM
Playing catchup here, but I read a really funny quote somewhere the other day.
You weren't here before so you don't know i'm 15 so i don't have a office job ^^ @Phrancis
Something like "Could you imagine how much worse Windows would be if they'd used Agile development?"
Ah, gotcha. Start coding young, good thinking. When I was 15 I was doing HTML/CSS (and not very well) I wish I had focused on a useful language like Java or C# or SQL
I wish CodeReview.SE existed when I was 15!
Haha, i did actually make my dads company website about a year ago ^^
When i tried html and css
My first coding job ;)
12:02 AM
I gave up on HTML/CSS when I found out there was such a thing as Wordpress.org :)
Yeah this is really helpful :D
Haha, i gave it up when i tried C++ cause i found it much more fun
but i got confused and now iv'e bought a Java book and is learning that instead
Anything is more fun than HTML... except maybe PHP... $this->sucks;
@Jamal I haven't received any review yet on my Formattable Fraction, and now I'd have a much-much-better version to post. Should I overwrite the current unanswered post or post a new question?
@Mat'sMug how about answer your own question??
Haha, never tried PHP
12:05 AM
@Phrancis I think I'm going to do that.
@Mat'sMug Since you learned the solo in hail to the king, do you like metal?
@Mat'sMug Yeah, what Phrancis said.
I was once so stubborn about not learning PHP that I learned Ruby so I could modify my HTML files in mass.
@Phrancis Haha good ^^
12:05 AM
I was an idiot.
@Svante yeah! Pretty much all kinds, too. Except I'm not too fond of screamers, but I like a lot of what In Flames did.
I guess PHP is OK if you do it right. Most programmers don't. Just search the PHP tag on CR & SO and you'll see what I'm talking about.
@Mat'sMug Haha i was going to as about screamers and growlers ^^ Personally i love screamers ^^
This is what you mean with screaming right? youtube.com/watch?v=vu3xGr-lNVI
In Flames is kickass. So is Children of Bodom
12:07 AM
(The song in the youtube link)
Ahhh man. When I was 15 I was listening to The Kinks.
lol. Nirvana here
Ah, I'm about to give up and take this MySQL error I'm having to SO... the shame lol...
@Phrancis iAgree
Hehe, i don't even know about the kinks ^^
Did anyone listen to the song i sent? :p
12:09 AM
♪ lolo-lolo-lo-la ♪
When I was 15 I was listening to Bad Religion a lot... I still am... one of the few punk bands from back then that is still alive and thriving. Saw them live in Nashville TN about a year ago.
(I'm 30 now)
I know about bad religion! :D I like True North
I'm going to see The Offspring with Metallica in a few weeks!
True North is good, but their best IMO is The Empire Strikes First I'll listen to the whole album never skipping a song
12:11 AM
If anyone is listening to the song i sent, dont mind the lyrics, i'm not derpressed or anytihng ^^
Never listened to that album
hey we've !
Best song on the album (also the last one)
^^ IMO
Listening right now
Yeah, i like this kind of music too :3
To me the punchline is "What good is something if you can't have it until you die?"
that's about the heaviest I can stand (and it's pretty good too, I find)
12:13 AM
hehe, i like slipknot too @Mat'sMug
Did you try listen to the song i sent?
yeah.. somewhat reminiscent of Linkin Park
Alright, time for a smoke and then music refactoring
@Phrancis yeah, time to STM!
STM? :p
@Phrancis You're gonna leave the chat?
YES got an answer!!
A: Formattable Fraction

mjolkaImmutable structs Yay! ✓✓✓ Format provider It seems odd to see a format provider in a constructor, and stranger still to store a format provider for every fraction instance. Think of the memory overhead -- imagine a use case where I perform calculations on millions of fractions, but only want ...

12:20 AM
Have you been waiting long? :3 @Mat'sMug
@Svante Nah I'm gonna stay and tab occasionally
@Phrancis Okey :D
@Svante where are you located?
Sweden @Phrancis
Ah nice
I think that's where Simon is if I'm not mistaken
12:28 AM
@Phrancis Yeah, he is from sweden :)
I heard Sweden is a good place to live
@Svante question was posted 19 hours ago. The average CR question gets an answer in 8-12 hours (actually that was in October 2013, it probably has improved quite a lot since)
@Phrancis Yeah it's pretty good :) Cold in the winters and pretty warm in the summers
@Mat'sMug Oh, then you have waited for quite some time ^^
I'm in USA, southern Indiana to be specific
Winters are mild but summers are hot, humid and muggy.
yeah.. but good reviews take time. You shouldn't be expecting quick answers on this site; I think I can spend between 30 minutes and 2 hours on a single answer.
of course it depends..
12:33 AM
@Phrancis Is it snowing in the winters?
Occasionally. People here freak out when you get any snow. Being from Quebec, Canada, getting two inches of snow is trivial.
Here they close roads and schools for that much snow.
@Mat'sMug how much snow did you guys get this year? Some 200 inches total??
haha ^^ In sweden we are more used to snow ^^
^^ I kinda like snow actually, wish we got more of it
@Phrancis we get less and less year after year.
I like driving snowboard :)
So i like snow too ^^
12:40 AM
I realize English is not your first language @Svante (it's not mine either) but usually we say riding snowboard :)
haha sorry ^^
I actually knew that but I'm to tired to think xD
2:41 AM
Going to sleep soon
Time for broke person dinner, spaghetti and italian sausage
20:42 here :)
Haha, that's actually sounds pretty delicious ;)
Go to bed young padwan. Heck, I'm sending my kids to bed shortly.
How old are your kids? around 15 like me? ^^ @ckuhn203
12:44 AM
The oldest. Yeah.
okey, where are you located? :3
Eastern US.
And the clock there is almost 21:00 PM?
Yeah. Shortly.
Sorry. Dad instincts were kicking in.
What are you saying sorry for? :p
12:52 AM
Idk. None of my business.
Oh, haha np ;)
Since I'm not going to do something special tommorow i can sleep alot anyways ^^
Well I'm going to sleep now! Goodnight everyone!
good night!
Night @Svante !
Gotta get off for a bit, BBL
1:30 AM
My game is coming along quite well. I may have it done early tomorrow, although it'll be simple (I will expand on it after everything else is critiqued).
Q: Capitalize all words in sentence string in Ruby

user2801122I have created the following code: def LetterCapitalize(str) str = str.split(" ").each {|word| word.capitalize!} str = str.join(" ") return str end This takes in a basic string and capitalizes the first letter of all of the words. It looks kind of awkward to reassign things to "str" twic...

1:51 AM
Q: General way to add persistence to a class in Python

kuzzoorooThe idea here is to write a function that gives you back a persistent version of a class that you supply. So you if you run PersistentList = make_persistent(list, "PersistentList", ['append', 'extend', 'insert', 'pop', 'remove', 'reverse', 'sort']) You will get back a class that behaves like a...

2:09 AM
Q: How to import mysql connector

Hutan RimbaAs you are aware, I am a complete noob on this. I am trying to use this reusable class to connect to mysql Python Connection with MySQL But whenever i try to run the python I am getting Traceback (most recent call last): File "src/connect.py", line 1, in <module> from Mysql import Mysql...

2:47 AM
Hi @all anyone still awake?
@Phrancis yep
Hey there @Yuushi
Q: Calculating delta in SpriteKit using Swift

Kyle DecotI am attempting to learn swift by refactoring one of my old games and I need to rewrite my update method which calculates a delta time. This code works but is ugly. How would I go about properly rewriting this? import SpriteKit class GameScene: SKScene { var lastUpdateTimeInterval: CFTimeIn...

almost lunch time here
2:57 AM
@Yuushi where are you located?
3:11 AM
@Phrancis Australia
Nice! I listen to a few podcasts made in Australia, took me a while getting used to the accent lol :)
3:40 AM
Q: Program to find the element in an array

user3816173import java.util.Scanner; public class ArrayElementFind { public static void main(String[] args) { // TODO Auto-generated method stub String[] arr= { "A","B","C","D"}; Scanner in=new Scanner(System.in); System.out.println("Enter the char to search"); String a=in.nextLine(...

4:06 AM
yeah, our accents can be quite strong at times
I actually prefer it over British accent, Australian English feels like it has some spirit! British English sounds so formal.
damn stuffy Poms :P
4:30 AM
Q: A fraction of the code

Mat's MugFollowing up on this post, and including some major changes suggested, here's the revised code. Changes include: No longer keeping an IFormatProvider at instance level. Removed IFormatProvider constructor parameters. Introduced ToString(IFormatProvider) overload. Changed decimal to float, to l...

and TTGTB - 'night @all!
Bye @Mat'sMug
4:44 AM
morning @all
4:58 AM
Hi @chillworld
sleep well @Phrancis
Q: Simple Operations Calculator

LegatoI'm practicing Swing effects. Everything works but for some reason I get a ton of error messages in the command prompt when the fields are empty, despite my attempt to add some exception handling (this has made me realize I need to practice that a lot more). /* Author: Luigi Vincent Practici...

Q: confusing control flow

ThufirCurrently, the following code runs and produces the expected and desired output. However, I'm sure that there's much wrong with it. This project queries the (flat) database, instantiates each row as an object, adds those objects to a queue, and makes the queue available to clients. Clients may...

5:17 AM
@skiwi, thanks for the review. did the refactorring and after it => bad import was pointed out.
Shouldn't Phrancis be waking up? It was almost 6am his time when he signed off.
@CaptainObvious I should've closed this one sooner. Two quick answers, both addressing the reported errors.
@Jamal should i remove my answer for the simple operations calculator, or leave it up?
@h.j.k. You may just remove, otherwise if the OP fixes the errors, a new follow-up question may be necessary to avoid invalidating the answers.
5:32 AM
@Jamal ok got it, removing now
And I'll do something about the other answer.
It looks like the OP has made that correction in the code. I'll keep it closed in case there's still something broken.
6:01 AM
@chillworld Nice :)
and monking
6:34 AM
monking @skiwi
7:25 AM
I had this weird issue that my data got inserted twice in the db
Couldn't figure it out friday, decided to leave it for today
Just tested it and it works perfectly fine
Programming is a lot like magic, really
7:47 AM
ugh... i have a question for programmers.se but i think i'm gonna post it on SO
can't decide
is there a rule about crossposting to two different SE sites?
I don't think it's explicitly forbidden but it's frowned upon
8:03 AM
Q: Simple parsing for string formatting (version 2)

Chris_FThis is my second attempt (version 1) at writing a string formatting utility which uses parsing. This time I more explicitly designed it as a finite state machine. I have very little experience with writing FSMs. As before, I'm not 100% sure that this code does not contain any critical flaws. In ...

@JeroenVannevel yeah, found an ancient meta post addressing it. I just threw it on SO for now, may move it over later if it doesn't get any good answers
Hey would one call the process of making strings look nicer?
I have a map with values, and I've got UnaryOperator<String>
Such a rule could be that all strings need to be in upper case:
Formatting, perhaps?
Doesn't sound professional
8:17 AM
I might keep formatting
is it a function?
private final Map<OrganizationField, Predicate<String>> validationMapping = new HashMap<>();
private final Map<OrganizationField, UnaryOperator<String>> formatterMapping = new HashMap<>();
format is pretty generic
hmm yeah prettifyerMapping would be pretty awkward
Q: Little script to change the mapping of an existing ElasticSearch index while reindexing it

Julien PalardI tried to implement the idea given in the elasticsearch doc about reindexation albeit I think they must code it inside ElasticSearch and expose it as an API. #!/usr/bin/env python from __future__ import division from argparse import ArgumentParser, FileType import json import requests from tim...

formatterMapping seems perfect for that actually
8:23 AM
This is example implementation:
private OrganizationBuilder putSingleField(final SingleOrganizationField singleOrganizationField, final String fieldValue, final String fieldName) {
    Objects.requireNonNull(singleOrganizationField, "singleOrganizationField");
    Objects.requireNonNull(fieldName, "fieldName");
    Objects.requireNonNull(fieldValue, "fieldValue:" + fieldName);
    if (!validationMapping.getOrDefault(singleOrganizationField, f -> true).test(fieldValue)) {
        throw new IllegalArgumentException("Field " + fieldName + " cannot be validated: " + fieldValue);
Q: How to make those data in Linux to be the value in XML file?

user49187I have a problem as of how I will make those data I have parse from Linux to be the value in my XML file. Can anyone help me? Thanks!

it seems a little weird to format stuff before storing it instead of storing it raw and formatting it before displaying it
I don't know, I want it to be stored consistently
After this it might go to the database or be printed
Finally found a reason to use an instance initialization block
private final EnumMap<MultiOrganizationField, List<String>> multiFieldMap = new EnumMap<>(MultiOrganizationField.class);
            .forEach(mof -> multiFieldMap.put(mof, new ArrayList<>()));
ugh, why can't we put bounties on stuff whenever we want
now my question is just going to languish for 2 days
Do you feel it's ont going to be answered quickly?
8:35 AM
i doubt it
it fell off the front page already
it's on SO so it got buried quick
Ah yes that happens
it's really more of a Programmers question but idk
wanted to try SO, get more eyes on it
Damn, I love Java 8
private final static Map<OrganizationField, Predicate<String>> DEFAULT_VALIDATION_MAPPING = new HashMap<>();
static {
    DEFAULT_VALIDATION_MAPPING.put(VAT_NUMBER, VatNumberValidator::validate);

private final static Map<OrganizationField, UnaryOperator<String>> DEFAULT_FORMATTER_MAPPING = new HashMap<>();
static {
Still wondering if I should simply not store it, or throw an exception if validation fails
is this for a user data entry thing?
It's data that comes from an invoice, gets OCR'd and then enters the program
not sure if it falls under "user data entry"
I could possibly also specify in the builder what behaviour I want
8:47 AM
hmm, so it could be running without anyone watching it
throwing an exception doesn't seem necessary, could just log something and not store it
However there's also a web service that returns the data
For that I do want the validation enabled to throw an exception if nonsense is returned
Q: How to avoid StackOverflowError caused by the number of recursion calls in Java?

user3371223I want to solve this problem: https://www.hackerrank.com/challenges/find-median ,i.e. find the median element in unsorted array. To do this I perform quickselect algorithm. My program works correctly on my computer. However when I submitted in the system it gave me StackOverflowError. I think thi...

@CaptainObvious OT: Broken code.
9:02 AM
the only thing I really like to use exceptions for are library code, for when the user screwed up
(user == programmer)
for most other things it seems like there's usually a way to avoid them
btw, monking ;)
Here they perhaps more serve as a way to kill the program immediately with fire once it has been detected that the server is sending invalid data
monking :)
tempted to post the gif..
do it
9:11 AM
@Phrancis Nope, @syb0rg killed of my motivation by copy posting a solution
Monking @all
got a checkmark for that answer ;)
wait who is that guy anyway
thought it was McBain for some reason
no clue.. But he's got a "German Flammenwerfer"
exactly ;)
9:23 AM
Monking @SimonAndréForsberg
Moning @SimonAndréForsberg
Almost 2k :)
A: The FizzBuzz challenge in Java 8 written in a short, readable and interesting way

HS_TriIt says "print", so I'll use sysout. Both solutions are IMHO also relatively short and readable. class IntConsumerFB implements IntConsumer { @Override public void accept(int value) { if (value % 3 == 0) { System.out.print("Fuzz"); } if (value % 5 == ...

My question might need protection.
@skiwi It will be auto protected if enough low rep answers are deleted.
Although if you think it really warrants it, flagging is the best course of action.
9:37 AM
Q: I am getting approximately 6 errors in this BinaryTree implementation and I'd like help fixing them

Adam StaplesI am getting approximately 6 errors in this BinaryTree implementation and I'd like help fixing them. Also I'd like any other advise for implementing Binary Trees. Also, while I have this code up, would you all consider this an implementation of a binary tree USING the recursive approach? Code: ...

@CaptainObvious Horribly off-topic
@skiwi I just put a protection on it. Two non-review answers in such a short time is enough for me to agree that it does need protection.
Besides, it's not too often that I get to use that feature :)
@SimonAndréForsberg That's the most important reason... right?
I've got some interesting new classes here :)
Up for review soonish whenever I have time, still at work atm
How do you protect questions by the way? Is a single user enough with a certain amount of rep?
@SimonAndréForsberg Thanks
SQL gurus, which one is preferred:
There are quite many Java questions recently, but those have to wait until later. I'm AFK for a while!
Nevermind, should've googled first
joins it is
@JeroenVannevel Always prefer joints.
10:09 AM
Soooo this isn't ugly, right?
return (T) (object) new File
	Id = assetInfo.Id,
You really need the downcast and then upcast?
Yeah, otherwise compiler complains
internal static async Task<T> Get<T>(string id)
That's the method definition
I need to return T but that can only happen from a object
Ahh yes, that's fun
I can't say it looks nice, but may be neccessary
yeah, I haven't found a solution yet
so I'll accept this for now since it works
lunch time!
@JeroenVannevel couldn't you have <T extends File> and then just return new File{ /*...*/};
10:23 AM
Q: Split the File which contain single line

murali krishnaI have a single line file.I want to read file line by line based on delimiter *;Is it possible through Buffered Reader.I try through scanner like below.... enter code here public static void main(String[] args) throws IOException { File file = new File("C:\\Users\\temp1.txt")...

@CaptainObvious horrendously off topic. with gruesome grammar..
Q: Review queue and already flagged question

HeslacherI just spottet this question I am getting approximately 6 errors in this BinaryTree implementation and I'd like help fixing them and flagged it off topic, as it contained non working code. Some time later i checked the review queue and this same question popped up. I thought about what to do. C...

10:38 AM
Interesting question. Probably there's a dupe already, but oh well..
@Vogel612 I could (although that's java and not C#) but the method should be able to translate different types as well
@JeroenVannevel whoops, ! Well that kinda kills the fun then.... how about a marker interface then? (can't believe I really suggest this )
sth like: <T : ITranslatable>
nvm that's dumb... You'd need to create some ITranslatable implementation for every type then....
I think my double conversion is more readable then
Anyone seeing something inherently wrong with this one?
Or is it just a revenge downvote?
@MadaraUchiha looks like it. I don't like your rant on static stuff though.. They have their reason for existance...
no clue how it is with , but in Java, they have some well defined use-cases...
maybe someone else didn't like that either,.,.
10:51 AM
@Vogel612 Same as global and goto, the reason they exist do not apply to PHP.
Globals and Singletons exist in Java because it saves memory
I've got my eventbus filled with static events
In PHP, you have a process per request, and no state between request. No shared memory, hence global's only pro vanishes.
Goto exists in C because... I honestly don't know, it's bad there too.
There is no single good use-case for globals or statics in PHP.
And yes, that was a challenge ^

« first day (436 days earlier)      last day (2693 days later) »