« first day (445 days earlier)      last day (3565 days later) » 

8:00 PM
@Vogel612 Done.
@Malachi how many gold badges do you have?
;-)
 
@SimonAndréForsberg I'm trying to figure out his implementation. The dealer automatically plays sort of, but how does the user play?
 
@rolfl What!? Wow. I really need to work on my editing apparently...
 
@rolfl I was talking about the Copy Editor badge...lol I think I have like 3 gold
 
@skiwi That's outside the scope of the review.
 
@SimonAndréForsberg It would be inside the scope of a reimplementation.
 
8:01 PM
you have 4 that I don't have
 
algorithmicaly
that a word?
 
I have reversal and copy editor
 
@Pimgd Google "algorithmicaly", it'll suggest to fix it if it's not a word :p
 
it adds 1 l
 
Alternatively set on spellcheck in browser, also helps
 
8:04 PM
algorithmically
 
I think it's a word yea
 
CXrap, againb
 
oh well
I'm gonna nail that question so hard
cause it's actually really simple
 
"that question"? :p
 
0
A: Blackjack Strategy

PimgdTwo words. Lookup tables. Here's one I randomly found on the internet: All you gotta do is make a 2D array, populate it with the right values (enum?), and alter your play(Card upCard) method to use the lookup table. That solves your complexity issue, your implicit data storage (you're tryin...

 
8:05 PM
@Malachi you have the only reversal though
 
booosh
 
@DaggNabbit I had to beg for it though. and I don't think the user will come back, which I hope they do and see that I actually gave them legit review of their code.
 
@Malachi i was actually wondering how you pulled that off
 
22
A: Can this stored procedure be cleaned up or made even more efficient?

MalachiYou have a lot of if statements in your SQL. This screams at me that you are doing something in your SQL that should be done in the application, and that this SQL should be separated into two distinct stored procedures. The benefits of doing this: Faster stored procedures Use a coding langua...

I had to actually give it a real (code included) review to get the last couple of votes though.
 
I'm surprised it didn't get closed as example code
 
8:10 PM
 
@DaggNabbit you can tell it is a real query.
 
(Sort by newest, not by relevance)
 
@rolfl whoa that's a lot of pimping
3
 
:)
@rolfl that was a neat trick you did there
 
Now I'm hyped because I managed to review code by just ignoring all the code as a wrong approach
 
8:12 PM
practice
 
what do I do with this hype
 
review another
 
@Pimgd Use it sparingly ;)
 
0
Q: Convert international datestring to ISO-format

RolfBlyThe function below takes a datestring in the form d-mmm-yyyy and converts it to ISO date format (yyyy-mm-dd). Delimiters may be hyphen, space or /, and Dutch or English month abbreviations may be used. Now, I know there is dateutil, but it returns unknown string format if you try to parse som...

 
What do I do if I hit rep cap for the day
 
8:13 PM
you get a mortarboard badge
do it 50 times, you get epic.
do it 150 times, you get legendary
 
Only 45 more rep, I can do that
 
do it 2000 times, you become Jon Skeet
 
Nope, by the time you're there, he's done it 4000 times
 
That guy mortarboards without logging in
that's just sad
somehow
 
@Pimgd - I am a fan of the Stack Exchange Data Explorer ... it's currently down for scheduled maintenance, but, there are some neat skeet statistics
 
8:15 PM
The other users with 500k+ rep don't matter, do they
 
also, if you repmax, you will find yourself on this query: data.stackexchange.com/codereview/query/164174/…
 
@rolfl it's down for maintenance because they have to upgrade it with all the queries you and @Phrancis (and @Mat'sMug) are hitting it with....
4
 
@Malachi TS!
 
@skiwi RSA :)
 
@Malachi The're swapping out 4 300GB SSD drives with 4 1TB SSD Drives
 
8:17 PM
@rolfl I am jealous!
 
Don't let the unicorn near it!!
 
Naah, the unicorn is OK near the SSD's it's the UPS the unicorn can't touch
 
0
Q: Update Map in Haskell

Kevin MeredithI wrote a function that inserts or updates a Map key value depending on whether the key is already in the map. If it is, then the value gets added to the already existing map's value. import Data.Map as Map updateMap :: (Ord k, Num v) => k -> v -> Map k v -> Map k v updateMap k v map = if membe...

 
Incoming question!
 
Oh noez,
 
8:25 PM
@SimonAndréForsberg Not HASKELL?
 
@Phrancis Do you have time for a question about SQL?
 
@skiwi fire away
 
I'm in a situation where every record needs to be identified... normally easy, with a primary unique key/id
 
@Jamal Not sure. Feels a bit like I actually did write HASKELL. I had absolutely no idea what I was doing for quite a while.
 
The hard part comes when the key can consist of one or more unique ids
Any clue how I make say (12355) a primary key, but also (46848, 684868), and (46468, 4686486, 44566, 138789)
 
8:27 PM
@rolfl Don't forget also about the race to legendary query! (I'm at 36 days now!)
 
Yeah, I'm at 72 or something, almost half way.
At one point I figured I could conceivably get legendary before yearling.
I can still technically do it.
 
@Phrancis Or should I maybe not make it a primary key, and generate my own primary key?
 
@skiwi would all these numbers be on the same record/row?
 
Say if the data associated with it is (3, 5, 7), then I would also need to be able to find that row when I give (3, 5) as 'input'
@Phrancis Yep
 
GUIDs everywhere, no more thinking required
 
8:28 PM
Maybe I'm overthinking it
 
Do you mean a composite key, with some nullable columns?
 
As long as I make an index on it, then the performance should still be good?
 
I think you are. I (personally) prefer to let SQL generate the PK on insert. Now you could index all those
 
depends on the database.
 
right up until the year 3000 when humans have vastly expanded into the galaxy and GUID duplicates are appearing on a daily basis and all our computer systems are exploding
 
8:30 PM
1
Q: Calculating Luhn-algorithm checksum digit

Simon André ForsbergToday I decided to learn some basic Haskell, and for starters I made a program for calculating the checksum of a Swedish personal identification number. It uses the Luhn-algorithm, aka. IBM MOD-10. Explanation of this code can be found on Swedish Wikipedia and English Wikipedia Here's a descrip...

 
@Pimgd - I am sure I heard someone say that GUID's are future proof.
 
@CaptainObvious Thank you!
 
@rolfl Yeah, me too, but quantum computers, man
and 1000 years! And many many many more humans!
 
Out of here!
 
Something has to break someday
 
8:31 PM
The problem is that those numbers (like (3, 5, 7)) are a given, I cannot alter them
 
... okay
concatenate them
use that as ID
nastiest thing ever
 
That would hurt performance badly
 
^^ that
lol
 
And then I cannot search on them via a subset
 
"Say if the data associated with it is (3, 5, 7), then I would also need to be able to find that row when I give (3, 5) as 'input'"
 
8:33 PM
@skiwi my recommendation, assuming these values are all in their own columns, is to just use OR statements in your WHERE clauses
 
sounds like you need to build queries
not toy with IDs
 
SELECT ... FROM myTable WHERE colA = 3 OR colB = 5 OR colC = `7
 
@Phrancis Can I not do something like WHERE (3, 5) IN (3, 5, 7)? But then the (3, 5, 7) would need to be a subquery
@Phrancis But it's a variable amount :)
 
How about WHERE myColumn IN (3,5,7) ?
or WHERE myColumn BETWEEN 3 AND 7 if you need a range instead of specific value
 
It's the other way around
The outer set is undefined, the smaller subset is defined
 
8:36 PM
so until what time do you have before the rep cap resets?
 
^^ midnight UTC
 
Best if I come back on this when have a concept ready perhaps?
 
that'd be 1 and a half hours? two and a half hours?
 
@skiwi that or a sample dataset
 
Maybe I can slap together a sample dataset tomorrow, not sure though
 
8:38 PM
@Pimgd it's 4:37pm here, midnight UTC is at 8pm (my time), so roughly 3h25m
 
ohh, 3 hours
I can do this
 
must be 7pm my time then....
remember @Pimgd that accepts and Bounties don't count against your rep limit
 
oh right, that's true. I forgot about that...
 
This question perplexes me... Could the OP not, instead of looping over records in a SQL table, just establish a connection between their SQL server and BigQuery's servers, and just INSERT INTO ... SELECT across the connection?
 
go for the bounties!!!
 
8:41 PM
I didn't have any accepts today
That's sad
 
@Phrancis It sounds like he is doing something very complicated
 
1078 more rep until I hit 10k!!!
 
I'm inclined to think that yep
 
19 more rep until I break 1k for this month!
 
8:43 PM
Anything that you do in a loop with SQL is bound to be slow, that's why you don't do loops in SQL unless you absolutely have to
 
0
Q: Case of the Hidden Memory Leak

MikeiLLSomewhere in the code below seems to be a memory leak. A couple of users were exceeding 512Mb and I'm not sure how. Adapted the following SO code to try and test memory usage of each function on the (OpenCart extension) page: public function mem_test($func_name){ declare(ticks=1); $han...

 
It would be trivial for SQL to select a whole data set much larger than even 1000 lines and just push it across to another SQL server
 
@Pimgd 3 hours and 15 minutes
 
@Phrancis RDBMS's normally go row by row, which is what most coding languages use loops for in the first place
 
@Malachi right, but it doesn't execute the whole query row by row, it executes against the whole set at once unless you tell it otherwise
 
8:47 PM
I have a click me button on my activity but I don't know how to move it anywhere on the layout or how to attach an event to it yet
 
Should I prefer the Executors.scheduleAtFixedRate over a Timer with a TimerTask?
 
@Phrancis cursors? those are bad too right?
if I could remember how to toast.....
 
@Malachi cursors and loops in SQL are basically the same thing, execute the query row-by-row instead of on the whole set
 
@skiwi, it is giving me a "No CPU/ABI systeme image available for this target" when I try to create a virtual device, what does this mean?
 
0
Q: Simple script to shorten urls in files

janosInspired by a recent question to shorten URLs in a file, I came up with this Python script to improve over the Bash implementation: #!/usr/bin/env python import sys import os import re import urllib2 import json re_url_pattern = re.compile(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:...

 
8:51 PM
@Malachi In what context is that? What are you exactly trying to do
 
run my Hello world app
 
On what are you running it?
Virtual? Regular one? Intel one? Physical tablet? Phone?
 
trying to create a virtual device to run the app on
 
A regular virtual device?
 
sorry. probably confused you a little there. I hit run and it took me to the AVD manager
I clicked create
put all the info in for a 7" tablet
and the ok button is greyed out
 
8:54 PM
TTQW - later @all!
 
later @Mat'sMug
 
@skiwi YES YES YES YES!
 
(and thanks @Santa, reached 200 today :))
 
What happened after the ok button greyed out?
 
it was greyed from the get go, I am trying another path to AVD creation
 
8:55 PM
I'd recommend to first pick a default one
@SimonAndréForsberg You don't like this?
public void startElapsedTimeUpdates() {
    Timer timer = new Timer(true);
    timer.scheduleAtFixedRate(timerTask(() -> elapsedTimeProperty.set(elapsedTimeProperty.get() + 1)), 1000, 1000);
}

private TimerTask timerTask(final Runnable runnable) {
    return new TimerTask() {
        @Override
        public void run() {
            runnable.run();
        }
    };
}
 
@skiwi It's called a composite key. There's a lot of debate over what's best. I recommend some research, then you can decide on what's best.
@skiwi That would help.
 
I'll never be able to start my standup comedian career if people delete their silly questions within moments
 
Sorry for the double ping. I'm playing catch up.
 
0
Q: Writing python with classes instead of functions

User1996I'm new to programming, and the first language I'm trying to learn is python. To try out the concepts and tools I've been learning, I decided to write a blackjack game. I wrote it entirely with functions, so it hasn't helped me at all with the concept I really lack understanding in: classes. ...

 
@ckuhn203 No problem :P Can't hear them anyway!
 
8:59 PM
it won't let me pick anything other than a target of Android L (Preview) - API Level L which tells me that there are no CPU/ABI system images to load
 
And you'll have a lot of catching up to do then
@Malachi Did you install... anything? I'm afraid no
Because Android L is the new 5.0 preview
 
it gives me Devices that I can clone, what do you mean install ... anything?
what more should I need to install?
 
You need to install the base API you want to work with
 
If you're going to use emulators, keep a book nearby
 
I'll check for myself now though
 
9:00 PM
They're slow as hell
 
@JeroenVannevel Not if you're running an Intel one with correct drivers ;) for Android
The code executes directly on the hardware then
 
going to see if my phone is still an option for debugging...... LMAO
 
It won't run your android 4.0 code anyway :p
 
3
Q: Checking if a Java Timer is cancelled

Simon André ForsbergWhy is there no isCancelled method for a java.util.Timer object? I would like to schedule a task if the Timer has not been cancelled, and run it directly (on the same thread) if it has been cancelled. Is the only option to catch the IllegalStateException that might occur if the Timer already ha...

 
I bought myself an Android phone for debugging
 
9:03 PM
Does this mean that the Timer class is more or less deprecated? — Simon André Forsberg Dec 14 '12 at 14:20
 
My previous one I got from my mom and had API 10 on it. 10.
Took me 5 minutes to boot up skype
 
@JeroenVannevel That's... err... crap
 
back to work......
 
@JeroenVannevel That's the API my phone runs on. I know the feeling.
 
@Malachi ^^ up there
Oh... you can see my tabs now
It's just a fraction of them though.
 
9:05 PM
it doesn't give me a CPU to use.....
 
@JeroenVannevel The trick is that my PC is not pretending to be an ARM device via software emulating, but that it pretends to be an Intel Atom via hardware emulating.
 
doh
 
@Malachi Did you download anything in the Android SDK manager?
 
@skiwi A timer only runs on one thread, if an uncaught exception occurs on that thread your Timer will stop working.
 
@skiwi Lots of technical mumbojumbo. Buying a phone is a lot easier
 
9:06 PM
it even tells you UTC time if you click on your achievements for today at the top bar
 
Ah, I found it here
Under say Android 4.0.3 (API 15), you've got to install ARM EABI v7a System Image and Intel x86 Atom System Image, where the latter is hardware emulated on an Intel @Malachi
 
Here goes, not really a code review but hopefully this helps him a bit:
0
A: Insert an SQL Server Table rows into a Bigquery table in one bloc

PhrancisWrong Approach I think what you are trying to do makes sense, however I think that your row-by-row approach is what is making this so slow. Anything you do row-by-row with SQL (e.g., a cursor or loop) will be slow because you are executing the whole section of query anew for each row. All SQL is...

 
@skiwi oh gosh, I remember having to do this.......
 
That'sin the Android SDK Manager.
@SimonAndréForsberg What about the other one? the executor service, it also uses one thread max, but creates a new thread every time?
 
yeah I found it....
downloading right now.....
 
9:09 PM
@skiwi It re-uses threads. It uses thread-pooling. Always prefer ExecutorServices, I say.
 
And as we all know, when Simon says something, you gotta do it.
 
do I need any of these?
 
@SimonAndréForsberg Allright, I'll switch it out then
 
or just API 20?
 
9:10 PM
@Malachi You want API 14 imo
 
There's an API 20 already?
 
If you want others to be able to use your apps
And you'll need to install the system images of that version then
and also build tools and whatnotmore
 
weird I had to close Android Studio just to install that stuff
 
It's in beta ;p
 
I am going to install all the way down to API 8 I think when I get on my personal computer, so I can code for phone
 
9:12 PM
@SimonAndréForsberg TS ^^
 
@Malachi What minimum API do you want to develop for? If you want to support API 10 phones for example, install both API 10 and the latest API. If you do things correctly, there's a way to support multiple APIs with the same code.
 
@Malachi Remember though that the whole framework to build your apps on top of differs between those two versions
Basically 2.x and 4.x
Not sure about 3.x (2.x for tablets), but I consider that one obsolete.
 
3.x was never used much. 4.x was quickly released.
 
@SimonAndréForsberg I knew it, the scheduleAtFixedRate offers an option to specify the TimeUnit, and I was missing that at Timer cq TimerTask
TTGTB now though
 
Bye @skiwi
 
9:15 PM
I am going to target 4.x devices I think
 
Tomorrow up early and I can do lots of things!
 
but I would like to make it so that they can work on older phones, you know for people that can't afford new phones, but can buy tons of apps
 
screw old APIs, people will barely be able to run it anyway
 
later @skiwi thanks for the help
 
No mercy for the consumers
 
9:16 PM
lol
there are going to be tons of people on welfare buying my apps @JeroenVannevel
 
@Malachi Sounds like a good option. Only approx 20% of devices use an older API than that these days
 
something like 87% use 4.03 or better is what android studio told me
 
0
A: How to simplify this up-downvote code?

Catalinhmm why it's not working? what i'm doing wrong? http://jsfiddle.net/ukrs7/14/

 
I think we should get Jeff a couple more badges on his Q&A
19
A: Calculating entropy of a string

Jeff AtwoodI also came up with this, based on Shannon entropy. In information theory, entropy is a measure of the uncertainty associated with a random variable. In this context, the term usually refers to the Shannon entropy, which quantifies the expected value of the information contained in a message,...

 
9:20 PM
What are you supposed to do with that?
 
@Malachi Why?
 
@SimonAndréForsberg I think it would be funny! and fun to watch
@Pimgd flag as not an answer
@Pimgd it's already deleted
 
"poof, it's gone"
Noooo... it's approaching bedtime but I'm not at 200 yet
 
@Pimgd That's when you start to ask Santa for help!
 
using my newly posted answer!
Santa pls check this
1
A: Reverse values of alternate nodes of the tree

PimgdI had to do a double take here: final int left = 2 * i + 1; final int right = 2 * i + 2; It only made sense after looking at the diagram. Still, you're doing a calculation twice... why not do it like this? final int left = 2 * i + 1; final int right = left + 1; That said, you might wanna pu...

 
9:26 PM
Santa checked some other things.
 
Santa is a cool guy.
wooo, it capped
yaaay
 
@Pimgd Way to go!
 
f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
it's not showing the badge =O
 
I think badges take a bit to register
 
ah, I didn't know
You've earned the "Mortarboard" badge (Earned at least 200 reputation (the daily maximum) in a single day).
I can go sleep happily now...
 
9:31 PM
0
Q: Is the following code SOLID?

NickWI found the following code, which is used to write and parse CSV files, on the web. However, it seems it cannot handle the cases such as "|" delimited CSV file. Also does it violate any SOLID principle? /// <summary> /// Determines how empty lines are interpreted when reading CSV files. /// The...

 
@Pimgd Congratulations :)
 
9:44 PM
Ugh, I shudder whenever I see the words DECLARE .. CURSOR
 
I want a traversable stack data structure in reverse order of insertion.
 
@Morwenn That's a stack
 
@JeroenVannevel C++ standard stack isn't traversable.
 
@Morwenn What do you consider traversable? Just keep popping that shit
 
9:53 PM
@JeroenVannevel I mean traversable without destroying the traversed levels.
 
@Morwenn Create a LinkedList and revert it
Or have your own implementation and add the new nodes to the head instead of the tail
 
@JeroenVannevel I was going to create a small wrapper in order to have a decent interface :)
std::vector with rbegin/rend should work.
 
Or create a wrapper that holds a Queue, poll elements from the queue and push them onto a stack
now you can traverse your data by putting the elements from the queue onto the stack
you'll basically be in the middle of the two
you can go either direction!
That's actually not a silly solution
You don't have much extra space overhead
 
I think I'll try the std::vector one first. It's easy to implement.
 
If you'd love me, you'd try the QueueStack (c)
 
10:00 PM
There's the joker solution: tell to the standard's guys that std::stack should be traversable in the reverse order of insertion, wait for it to be accepted, then standardized, then implemented in the major compilers.
 
TTQW - Beer time!
 
Yay, bounty!
+250 today
 
Cha-Ching!
 
I read several times that a stack data structure is not meant for (non-destructive) iteration. Why is that?
Okay. Seems that I killed everybody.
See you later! :)
 
10:24 PM
0
Q: Processes and Handling (Piping) - Can this be made more efficient

ZerowalkerBasically what i am doing is i got 3 processes which i loop through. The first process is encoding Video, it's actually 2 processes but they are connected so i don't need to worry about how it handles the other one. The second and third are connected by me however. One reads and the other write...

 
10:38 PM
0
Q: Speed up projection of a bipartitie network for a big file using NetworkX and Pandas

CurtisI have a pretty big file (3 million lines) with each line being a person-to-event relationship. Ultimate, I want to project this bipartite network onto a single-mode, weighted, network, and write it to a CSV file. I'm using NetworkX, and I've tested my code on smaller sample datasets, and it work...

 
Back :D
(with a beer)
I'm still LMAO about this
> XML is like violence - if it doesn't solve your problem, you aren't using enough of it. - 4h ago by Dan Lyons
 
0
Q: How is my CMS design? Any security, design, or other issues?

HelpNeederI am trying to learn PHP in depth by creating this personal CMS. I try to utilize OOP concepts and do best I can... The way I am trying to design this CMS is to keep including 'modules' within a page to minimize code. I am using extensively POST and GET variables to decide which module will be r...

 
11:00 PM
@Mat'sMug have I ever mentioned I hate the National Bank of Canada? I still carry my student loan through them and every time I have to make a payment it's a PITA.
 
0
Q: Replacing an F# loop over a mutable variable by an immutable approach

devoured elysiumConsider: let mutable m' = m while m' % i = 0L do m' <- m' / i I've refactored it into: let m' = let rec exhaust m = if m % i = 0L then exhaust (m/i) else m exhaust m but it's pretty obvious to me th...

 
11:27 PM
Well that was not nearly as painful as I imagined it would be
 
Ummm what now @CaptainObvious?
 
mutable variables in F# are evil :o
+1 just for trying to get rid of it
 
Any ideas on why a -1?
-1
A: JavaScript function that returns all possible combinations of letters in a word

jt0dd <codez> Thanks for sharing this code </codez> Thank you for requesting this review. As I worked on a better solution, I forced myself to accidentally understand a great use for JS Iterators & Generators, which I've been reading about. I spent probably 6 hours today fiddlin...

 
11:50 PM
@jt0dd I +1 to counter balance that -1. It looks like you spent a lot of time on this and are getting real performance results
Kudos on going to Math.SE too that's going well above & beyond
 
@Phrancis yep, and there's a Tl;Dr in case anyone wants to skip through
 
STOP EDITING lol, it pings me every time ;)
 
No idea, +1
 
^^ TS
 
@Phrancis I didn't downvote, but one guess is that it's a bit noisy in places. Or that may just be me.
 
11:54 PM
@Mat'sMug Seems like I'd better watch out...
 
Yeah it could be cleaned up a bit
@sim hehe I'm on vacation now, ..but now way I'm catching up 1K in 2 days!
ugh. Converted the cribs to toddler beds today. "It's bedtime!" is all I've said for 30 minutes now... and counting..
 
Can someone who knows a bit about C# have a look at this and tell me which of Oracle and SQL Server is the "source" and "destination" server/database?
 

« first day (445 days earlier)      last day (3565 days later) »