« first day (912 days earlier)      last day (1356 days later) » 
00:00 - 18:0018:00 - 00:00

6:07 PM
Q: Writing embedded list to CSV in python

Peter TirrellI have a method in a python app to write a list of records to a CSV file. Each record is a "football player", which is really just a dictionary. But one of the dictionary items contains a list of weekly scores. I want to write out to CSV a record for each player, and then flatten the list of s...

@Hosch250 yeah I figured it was time to get rid of the interrupt
I'm kinda proud, in my last 7 answers, 6 of them are the accepted ones! :D
oh yes
very much yes
6:16 PM
That’s brutal
@CommitStrip lol, another typo in there
"I put an SQL query in [...]" should be "I put a SQL query in [...]"
@EthanBierlein It's been proven some time ago by @EBrown that his is correct
I don't remember though, it's something about the acronym's phonetics
I guess it's because it's pronounced "EssQL" (or something like that)
it should be "an" if the word after it starts with a pronounciation of a vowel, no matter how it is actually spelled.
6:33 PM
I've always pronounced it "sequel"
In my world there's "S-Q-L" and "MySequel"
that's a little odd - I would expect consistency between the two
S-Q-L and "My S-Q-L" or "sequel" and "MySequel"
@DanLyons I've also heard some people pronounce it that way
I can work with either as long as there is consistency :)
@DanLyons Well, maybe I'm a little odd :P
6:38 PM
Q: Highest floor of a building from which to drop an egg without breaking it

Gregg LeventhalYou have two eggs, with the lowest number of drops, find the maximum floor of a 100-floor building from which you can drop the egg without it breaking. - I created a function which takes an argument of the floor, and then calculates the answer (since creating the physics engine to actually simul...

@TopinFrassi way to go!
The only people I ever hear say SQL like "S-Q-L" are people that don't know what it is... otherwise it's always been "sequel" (in my experience)
@Phrancis I use both versions.
6:58 PM
If you have a fix that you think is correct, push it to code review. :) — Mitch 38 secs ago
@Dehli if this is the case then you can use the ajaxCompleted because also for cross domain requests, the ajaxOptions.url will be set only the jqXHR.responseText will be empty. I would guess - but there I would need to do some code review of jQuery - that the first call to the jQuery( document ).ajaxComplete will always be for the script itself. — t.niese 26 secs ago
@Phrancis I know what it is and I always say S-Q-L.
^ Same here
But I've heard it pronounced "C-Q-L" alot too.
@TopinFrassi wat
@TopinFrassi From French people I would assume?
@Phrancis yup!
French from France, to be more precise
Those crazy french people
7:09 PM
Your question is a good fit for CodeReview SEjanos 35 secs ago
It's probably a mash-up of French "sequelle" and "SQL" I think :)
Everybody here in Belgium I've come in touch with says 'S-Q-L' as well.
long overflow
java.lang.ArithmeticException: long overflow
	at java.lang.Math.multiplyExact(Math.java:892)
	at java.time.Instant.plus(Instant.java:860)
	at java.time.Instant.plus(Instant.java:207)
	at com.skiwi.olog.PlayerSpec.save valid player with single alias(PlayerSpec.groovy:32)
Instant.now().plus(Long.MAX_VALUE, ChronoUnit.DAYS)
Bad idea?
MAX_VALUE plus positive number?
Yes, quite
They blocked adding ChronoUnit.YEARS :|
@skiwi WTF!?
Q: Lock implementation using atomics

gstackoverflowRecently I have visited interview. I was asked to write own lock implementation using atomics. Not necessary reentrant. I didn't answer the question but at home I have wrote following code: public class MyLock { AtomicBoolean locked = new AtomicBoolean(false); ThreadLocal<Boolean> th...

rather moot, since the sun will explode before Long.MAX_VALUE seconds from now, let alone days or years :)
@DanLyons So if it works, you're safe.
50000 days should also do the trick
7:19 PM
@skiwi what is it that you want to accomplish really, and why?
@SimonForsberg I'm storing the aliases of a certain player, and in the beginning it doens't have a begin and end date, so I'm saying its begin is at 0 since Epoch, and the end is somewhere very far away
@skiwi Have you ever heard of NULL !?
Q: New caching and deferred evaluation strategy

ErikEInstead of checking whether a local variable is null, then locking when it is, then computing the value, and then on every call still checking if the variable is null and returning the cached value, what do you think of the following pattern (where the value is stored instead as a delegate that r...

@SimonForsberg Yes, but I think it only complicates things more
7:22 PM
And setting the end date to somewhere very far away doesn't? I honestly thing using NULL is the correct solution here.
It doesn't complicate intersection checks for the ranges
it's your code, do what you want with it. But I would not do it that way and would point it out if I would do a real review.
Well, maybe you'll get the chance for that ;)
I tend to agree with Simon, I would also expect null if there is not a real date available
Though I'm kind of hesistant to put Domain, Service and Controller classes under review, because they are not that interesting
7:26 PM
It's easy enough to null-check and such, and less clunky than using placeholder (false) data
that ^^
Though getting it to work first is more important
Nothing is more permanent than a temporary fix that works.
When asking about performance, and how to improve the optimization of your code, you probably want to use code review rather than Stack Overflow. — Spencer Wieczorek 15 secs ago
@DanLyons But it works :D
7:34 PM
@SpencerWieczorek no, this code has a bug. Don't suggest moving to the CodeReview site unless you're familiar with their posting rules; that community has been getting more and more irritated with inappropriate questions being moved there. — Pointy 36 secs ago
@jayant No code review needed here. I just need to understand if there is a library function similar to getline() that reads a complete line into a limited buffer by truncating the tail part. — user1969104 52 secs ago
possible answer invalidation by 200_success on question by daveomcd: codereview.stackexchange.com/posts/109533/revisions
"I am trying to find a better solution". That's for codereview. — Weather Vane 28 secs ago
8:05 PM
Q: UNO for ncurses (C program)

Earth2I've been teaching myself C for the last few months. As a learning exercise, I set out to write an ncurses implementation of the classic card game Uno, mostly because it was was one of the simpler card games I could think of. Since my emphasis in writing this was primarily learning concepts and...

I like my new setup...
I spent a little over an hour to move my desk and completely turn the setup around..
Also, sidebar: I'm at exactly 4500 rep on CR.
Damnit, who ruined it?
8:32 PM
Whew, finally narrowed down ongoing payroll issue... appears to be user error -_-
So Visual Studio is crashing again.
Seems like VS does that a lot...
It does it a lot to me.
@Phrancis Corrupted data?
@EBrown Same here
I'm voting to close this question as off-topic because SO is no code review site. — Olaf 9 secs ago
8:39 PM
@TopinFrassi Not exactly. Agency is using a regular "weekend" earnings code for holidays, instead of one of the Holiday-specific codes we provide to them. Then they come complaining that their payroll doesn't look right, because a holiday on a Monday matches both a regular hours code and their "holiday" (weekend) code and that screws up their payroll
possible answer invalidation by Jamal on question by ChrFin: codereview.stackexchange.com/posts/31040/revisions
@Phrancis Hmm I kinda understand the problem :p Stupid users.. ahah
We have a hierarchy where we can set which categories of codes get priority over others. But regular and weekend both fall under the Shift category, which normally has lower priority than a Holiday category.
To be fair, it's a very complicated system, it took me about 3 hours of digging to find this. So I wouldn't expect run-of-the-mill users to understand this distinction very easily...
how about distinguishing "holiday" from "weekend" then?
Oh ffs Visual Studio wtf is wrong.
8:48 PM
@Mat'sMug monker-late-fter-noon
my VS is tamed, it behaves nicely. if it burps I threaten it to install Eclipse, then it says sorry and starts working again.
Q: Maximum palindromic substring by memoization

rookieI've written some code to solve the maximum palindromic substring problem. def memoize(f): """ Function decorator used to cache results """ d = dict() def inner(*args): if args not in d: d[args] = f(*args) return d[args] return inner def max_palindrom...

@Mat'sMug "weekend" already has its own distinction, i.e., what day of the week it's on. But since they set some of those days to also be holidays which may fall outside of weekend times (like on a Monday holiday) then it matches both regular weekday shift and weekend shift, which are both just regular shifts
All I ask from you, Visual Studio, is that you publish my freaking code.
8:49 PM
Admittedly, all this being done in SQL is clunky at best
@Phrancis I meant that for the user. the user needs to be able to tell "weekend" from "holiday" for it to work
doesn't take a degree IIRC, but I could be wrong...
@EBrown publish? Y U NO DEPLOY?
@Mat'sMug I like my Web Publish dialogue.
just build the darn thing and deploy to web server... no? (I truly have no idea how to do this)
8:53 PM
I'm not sure how that works with Code-First migrations.
Oh great.
More good news from my Visual Studio.
@EBrown Argh, EF migrations
@EBrown for some values of "good"?
@Mat'sMug /s/good/bad/
@TopinFrassi The ping from that just scared the carp out of me.
I don't even know what the carp is going on here.
Why is this not working?
Delete, y u no cascade?!
Oh wow.
Go figure.
I forgot to store the last byte.
8:57 PM
Q: How should you add elements to a multi dimensional array? (In C)

RinslepI'm working on a table football cup program (in C), where I have 16 people facing off to get to the final. I'm having trouble putting elements into the different elements of the array (which has sort of stopped my progress until I figure it out). I've searched on the internet (not extensively) ab...

@EBrown #EveryByteMatters
@skiwi Yes it does.
I'll be this thing works this time.
@skiwi Did you tell it to cascade? ;p
Wait, wtf is this.
Why won't it assign this byte-array?
@Phrancis I think so
9:02 PM
It works!
> One small step for man, one giant leap for my software.
Sweet, it's broke again! And, I am not sure why!
@EBrown Probably because it didn't work in the first place. :D
@TopinFrassi It worked in Debug mode.
oh yea... that thing...
it's kinda pissing me off about C#, that there's two build modes..
then again 2 is little compared to things like C++--
Oh wow, this is a bigger issue than I thought.
@EBrown Have you tried running it without the "Release" compiler optimizations?
9:09 PM
@TopinFrassi That's not the issue.
The issue is that I effed up.
Is it appropriate to test two methods in a unit test?
Cascade still doesn't work... I 'm just going to pretend that I never wanted this anyway
Q: Create an automated bill for lunch at the restaurant - Questionning

georgestruct elemMenu { string elem; double prix; }; I would like my program to display as a table all menu items. My program should use a table menu with elements of a type structure elemMenu which contains two components: elem of type string (string header file) and prix of type double. ...

Q: JW Player + Brightcove Integration

LandoThe following code gets video renditions from Brightcove using the media API. It then generates an ordered source list for the JW Player and selects the default rendition based on a pre-set bitrate. JS function buildSourcesFromBrighcoveID(brightcoveID, onComplete) { var sources = []; va...

@skiwi Are you talking about a database? If so, there's gotta be a reason that cascade isn't working
Hot damn, works as expected now! :)
Time for a CR question.
@Phrancis The problem is in the Grails layer, I'm pretty sure of
9:17 PM
Sounds like it... never had problems with cascade normally, besides perhaps locks on the records in foreign tables or such
I was happy that I finally found a relevant link when googling, I found this... github.com/grails/grails-core/issues/9050
I love reading RFC's.
Q: How groovy* is my code?

J AtkinI recently watched a video course on groovy and started working on some of the Project euler problems to flex my groovy* muscle. (This is problem #8) def number = """ 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501...

Q: Return array of objects with matching keys

Maciej Ketusdue to an excercise I've written a function that given array of objects and key (2nd argument) returns new array of objects that contain all properties from key. (example input at the bottom of snippet) How'd I do? function where(collection, source) { var arr = []; var keys = Obj...

@EBrown Some are a good read. Others are almost unbearable.
@Mast I, personally, find them very informative most of the time.
9:26 PM
Question coming in.
@Phrancis while adding a link is a good step in the right direction, projecteuler has been known to be down before...
Woah, I almost cast a CV on my own question.
@SimonForsberg Edited
How would you call a method which you pass a (playerId, playerName) into and then update the player name if it has been changed?
9:29 PM
> update the player name if it has been changed
@Phrancis OP was already working on it AFAIK ^^
@JeroenVannevel Player ID doesn't change, name does.
@skiwi In which language? In Python: update_player_name? In C#: updatePlayerName
@holroy Groovy
void playerNameLastSeen(Player player, String name, Instant instant) came up with that now
@Mast I get that, but why does the updating happen after name changing?
Doesn't make sense
playerNameLastSeen doesn't tell me what it does and doesn't express an action
9:30 PM
@JeroenVannevel Different databases and all, synchronization.
Q: Converting IP Addresses to minimal binary formats

EBrownOnce more, I come to you for assistance! I have written a significant bit of code that converts IP Addresses from strings to minimal byte-arrays. (So that you can store them in a binary format instead of as a wasteful string.) It currently works with IPv4 and IPv6 addresses, saving both to a 16-...

Focus, @skiwi
@skiwi Don't know Groovy, but it seems like updatePlayerName would be a better name...
GetMostRecentlyUsedPlayername? UpdatePlayerName?
It doesn't necessarily update, only if it has changed
9:32 PM
update what where?
What changed where?
@skiwi Like Phrancis suggestion, or add it to the function comments... Or maybe name it optionallyUpdatePlayerName, and let the function comment described why it is only optional...
@skiwi Name a method by what it does, not by when it is called
updatePlayerNameInDatabaseIfItHasChangedInGame :)
9:39 PM
Q: Floor and Ceiling to specified int

christo8989This relates to Round to specified int but I'm separating these methods out since they're technically different. Is there a method that already performs a custom floor and ceiling to a specified integer? // If the interval is 5, 9 --> 5. public static int FloorTo(this int value, int interval) {...

@Phrancis Put that in a question on CR and you'll get massive upvotes for desperately needing a review.
@skiwi It doesn't have to necessarily update. Calling it possiblyUpdatePlayerName is an unnecessarily long name. updatePlayerNameIfChanged could work but is still bad IMO. updatePlayerName is just fine. It says what it does, just not when it does it, but it doesn't have to be explicit about that.
just split it in two.. if(some condition that checks the name changed) { updateName(); }
possiblyUpdatePlayerName sounds like Haskell function, with a couple of Maybe statements
@Mast With a name like that, documentation would become almost superfluous!
9:43 PM
@SimonForsberg Hmm, right, that makes sense
@JeroenVannevel I'm trying to put that behind a method call, because it will be often used
Naming one action isn't hard enough so you'll group two methods together and try to give THAT a good name?
^ Java developer, everyone
You should probably ask this on codereview.stackexchange.com. — Script47 27 secs ago
HAI 1.2
it took waaaaaayyy too long to write this.
9:57 PM
I am a LOLCODE guru, and I understood that. Not bad....
good aftermorningeveningnight
on a more serious note, there's still 2 half-open questions of mine...
@EthanBierlein Hey there
none of them involve lolcode though, so there's that
A: RAII style API wrapper for PyMongo

SuperBiasedManGreat that you provided a docstring! You made one minor formatting mistake though, there should be a blank line between your brief single line summary and the rest of the docstring. It's recommended in the style guide partially for readability and partially for script parsers. class MongoDB(obje...

10:01 PM
hmm. possible feature-request for RoboSanta...
what about expanding the eligible answers to answers that have 0 votes on them?
instead of 0 score?
Q: Suggestions on how to make the code simpler

natlufI was just wondering if someone could help me make this code simpler? I'm displaying multiple queries and if statements, also in the if statement it increments notice_category_id by 1 each time a category is created but when I code the update/delete/edit (or if truncated) sections won't rowCount(...

$notice_category_id = $query1->rowCount();
if($notice_category_id <= $notice_category_id) {
10:16 PM
$i = 1; if ($i <= $i) { i++; }
something can't be less than itself
how else are you going to write $notice_category_id = 1+$query1->rowcount() ? that's obviously too terse
some new user!!! Where are the bear traps cookies, did you guys eat them all again??
hmm... that didn't go too well.
Welcome to the 2nd monitor @JulianFondren
I can't decide yet if I think that question is on-topic or not... I don't think the user really understands how their code works
10:18 PM
@Phrancis that doesn't make it off-topic I'd say
Guess not... doesn't make for a very good question though
someone already told him that his question would be better off over here
which is probably true, actually
$addNoticeError         = array();
$addNoticeErrorMessage      = "";
$addNoticeSuccessMessage    = "";
Curious way of naming variables...
10:20 PM
oh yes, PHP with Systems Hungarian and a dose of crappy proceduralism
@Vogel612 don't forget MySQL... at least they used PDO
Okay just to make it ... official-ish.
My two questions with currently unaccepted answers are up for a 100 rep bounty for the first one giving a satisfactory answer: question 1, question 2
Q: Create a GUI in Java 8 on Eclipse

D. HartThis code attempts to create a GUI that has the user input a number and the result is the number in words. I cant seem to figure out how to create it within a GUI. I'm using Java 8 and Eclipse. The only error it's throwing me is in my last 10 lines. enter code here import java.awt.*; import jav...

only one bounty for both questions though
@CaptainObvious hammertime!
also... awt.
10:33 PM
Today is the greatest day ever.
@Vogel612 has been requested, I tried to explain on the front page of the repo, why it's too hard to do: github.com/janosgyerik/robosanta
ahh... then..
unfortunately, yes
> Don't post Naruto answers to questions that were closed as off-topic by @Vogel
That probably means something else than how I read it.
yea kinda
that was FR'd by me in the anonymous trial phase
10:39 PM
So my Microsoft Edge just froze.
so you're using Microsoft Edge
@EBrown Anything new?
It opens by default.
It also freezes by default from what I've heard.
And of course on Windows 10 it's a pita to kill a process from the Taskbar.
10:40 PM
Does it freeze well?
You can change that. I set IceDragon to my default, with IE for when I need Flash (Flash is built in to IE).
Oh look, not responding.
+1 Microsoft
CTRL-Shift-ESC works fine.
As soon as I go to enter something in the address bar, it freezes.
10:41 PM
The only thing crashing on my 8.1 side is Explorer. I've been pondering how difficult it would be to make my Sleep button kill Explorer instead.
$query1 = $connection->prepare("SELECT MAX(notice_category_id) + 1 FROM notices")
$notice_category_id = $query1->execute();
That would work right?^^
Literally every time I click the address bar in Edge it crashes.
@Phrancis should, yes.
I do not like Edge.
interestingly you don't even have to prepare. There's nothing to be injected there
10:43 PM
Oh good, task manager opened after five minutes.
It's a little late to the party, but C for effort.
I think I'm switching to Opera.
What in the world do you have installed?
Chrome is what I usually use.
I think I need to rethink this DB structure.
I have a raw Windows 10 upgrade, no clean install, and it runs fast.
Or at least how I store IP's.
@EBrown Opera, out of all things. Why no Firefox?
10:49 PM
@Mast I find it ugly. I'll probably test Opera, FF and Chrome when I get home and see which I like best tonight.
I like Dragon, but it renders fuzzy. IceDragon is sweet, though.
@Hosch250 Related to IceWeasel?
Those are Comodo browsers based on Chrome and IceDragon. Comodo is famous for their firewall.
@Mast Never heard of it.
GNU IceCat, formerly known as GNU IceWeasel, is a free software rebranding of the Mozilla Firefox web browser distributed by the GNU Project. It is compatible with Linux, Windows, Android and OS X. The GNU Project attempts to keep IceCat in synchronization with upstream development of Firefox while removing all trademarked artwork. It also maintains a large list of free software plugins. In addition, it features a few security features not found in the mainline Firefox browser. == History == === Origins of the name === The Mozilla Corporation owns trademark to the Firefox name and denies the use...
10:51 PM
@Hosch250 To be fair, they alternate. Firefox had a build a while back where it was hogging memory like crazy as well.
But that has been a while IIRC.
Apparently they have a Chromodo browser based on Chromium, but I've never tried that one.
I read in a book the other day, and it mentioned someone who was worn out by talking to a great many "good and stupid" people as a prelude to him meeting his future wife.
I wonder if the double meaning was intentional.
How well does IceDragon perform with 10 windows, 20 tabs average?
IceDragon performs real nice.
I usually don't have 10 windows and 20 tabs, though.
I think my record is probably 40 tabs in at most 2 windows.
Well, I'm currently only at 8, but hey.
8 windows.
I'm at 1 window, 5 tabs. 2 youtube, 2 U, and this.
Besides the File Explorer, Word 2016, Groove Music (which is not playing), and SQL Server.
10:57 PM
Q: Sentence building DSL

jacwahCardshifter is an online trading card game, made by a gang of Code Review community members. Cards can have a bunch of different, and sometimes complex effects, and descriptions for these are automatically generated if no custom one is given. EIGHT IMMORTALS: Choose 1 at random: Summon 1 Li...

Opera is taking forever to install.
I think my PC needs another reboot.
11:01 PM
@EBrown Your PC needs an electromagnet after the torture you make it go through.
possible answer invalidation by Jamal on question by ErikE: codereview.stackexchange.com/posts/109554/revisions
@Duga WHAT??? @Jamal answer invalidation???
@Duga I kind of agree this time.
@Mast Well, he didn't really edit code...
No it's not. I just moved that section to the top.
11:09 PM
It was a large improvement in format etc.
Could've fooled me, reads like a completely different question.
what am I doing
why am I submitting stuff to a flat-earth forum
@Mast It just needs a reboot I think.
It usually does fine, but it's been on non-stop for weeks.
And I think one of the IDE drives is bad.
Which doesn't help it at all.
I need to just get another 1T SATA drive to pop in it and move everything off all the IDE ones.
Poor computer still has IDE?
Yeah, and I need some of the data on them.
I have 7 HDD's in this PC, plus one external.
Well, 1 SSD and 6 HDD's and 1 external HDD.
My C drive only has 15.2GB free of 237GB.
11:25 PM
possible answer invalidation by natluf on question by natluf: codereview.stackexchange.com/posts/109571/revisions
7 HDD's, there was a time I thought that was a lot.
Well they're all small, but they each serve a purpose.
This question appears to be off-topic because it is a code review request. This is better suited to the Code Review Stack Exchange site. Before posting there be sure to read their FAQ to ensure that your question meets their guidelines. — John Conde 52 secs ago
Well, 3 minutes.
Do backticks around table columns in MySQL mean anything important?
11:33 PM
@EBrown In my basement:
panabox:~# parted -l | grep 'Disk /dev/sd'
Disk /dev/sda: 1500GB
Disk /dev/sdb: 3001GB
Disk /dev/sdc: 3001GB
Disk /dev/sdd: 2000GB
Disk /dev/sde: 2000GB
Disk /dev/sdf: 4001GB
Disk /dev/sdg: 4001GB
Disk /dev/sdh: 120GB
Sheez, that would incinerate my storage problems.
@rolfl dang
that's a whole lot of storage space
is there a specific need to have that much?
Wellm, the matching drives are all in RAID1 configurations, which halves the available storage.
The 120GB is an SSD for the root filesystem.
The 3TB drives are my "Valuable" data including photos, e-mails, documents, etc.
That still leaves you with 9TB storage.
Ah, photos do tend to eat up memory.
11:37 PM
The 4TB drives are hourly snapshot backups of the 3TB drives.
the 2B drives are a bunch of downloads, and are basically "scratch" space.
the 1.5TB drive is my multimedia center.
When I do my monthly backups, I have another 4TB attached ;-)
That really sounds like an awesome setup
Mar 28 at 15:06, by rolfl
user image
And here I am with a measly 900GB of storage, and a dell laptop that always needs to be plugged in.
11:43 PM
Q: Cache for storing active/inactive objects

AcornI've written a templated Cache for storing both active and inactive objects. If an object were to be "removed", then it is simply moved to a queue of inactive objects. The vector of active objects will never be searched, only accessed. So I have no problem with there being holes in the vector. ...

Now that's doing it right. Nicely done.
Q: Simple BlackJack game using drJava

BenCreating a simple blackjack game that only uses loops(no arrays) that allows you to input how much money you want to bet, calculate the value of your hand and give option to hit or stay against dealer, and output whether or not you win. I am a first year programmer with about 6 weeks of experienc...

@CaptainObvious HAMMERTIME!
@EthanBierlein No. Completely superfluous the vast majority of the time. I think one IDE adds them by default is why we see them often.
You have similar things in other SQL versions too, but they are normally square brackets instead of back ticks.
00:00 - 18:0018:00 - 00:00

« first day (912 days earlier)      last day (1356 days later) »