« first day (462 days earlier)      last day (3537 days later) » 
00:00 - 22:0022:00 - 00:00

12:00 AM
does it return a NaN value?
 
No, it returns 0.
 
:(
 
wait no...
Maybe this is just Xcode 6, but now it gives me a warning saying division by 0 is undefined
NSLog(@"%ld", NSIntegerMax/0); prints 4303368208
 
Now that I know you all have votes: codereview.stackexchange.com/q/59546/27623
;)
 
Speaking of definitely needing upvotes:
8
Q: SQLConnect - A library for connecting Objective-C/Swift applications to Microsoft SQL Server

nhgrifThe complete SQLConnect library can be found here. The file from which the following method belongs can be found here. At some point I may or may not open questions for reviewing other aspects of this library, but I intend to keep the questions relatively small. This is the largest method in t...

 
12:07 AM
@nhgrif I'm pretty sure almost every question and answer on this site from you has an upvote from me haha
I actually want to see if I can find one that doesn't...
Oh, I found one!
Unfortunately, I don't want to get the serial upvote system after you: I'll stick that answer in my back pocket for later.
 
12:19 AM
meh, I actually don't think there's much in a second answer
 
@nhgrif Are you not a fan of Yoda conditionals?
 
No.
The only time I ever do that is in SQL
 
yoda conditionals lead to anger, anger leads to hate, and hate leads to the dark side
5
 
@nhgrif What is Boolean? I thought it was the ObjC true/false type.
Or, is there some NSBoolean I don't know about...
 
IF (1 = (SELECT COUNT(*) FROM SomeBigQuery INNER JOIN MorePartsOfBigQuery ON ThisBigQueryMakesYodaConditionalBetter LEFT OUTER JOIN WowQueriesHaveLotsOfBits ON SomeCondition = 1 WHERE YodaConditionIsFineHere = 1 AND WowQueriesHaveLotsOfBitsAgain = 1 GROUP BY SomeGroupByValue)) BEGIN
I don't know what Boolean is exactly.
NSNumber *someBool = [NSNumber numberWithBool:YES];
if ([someBool boolValue]) // stuff
 
12:24 AM
26
A: Is there any difference between BOOL and Boolean in Objective-C?

jshierBoolean is an old Carbon keyword (historic Mac type), defined as an unsigned char. BOOL is an Objective-C type defined as signed char. bool is a defined version of the _Bool standard C type. It's defined as an int. Use BOOL.

 
hmm, I would have probably done IF EXISTS instead of IF 1 = count
nm exactly one
my attention is slightly divided :)
 
Yeah.
That's why I did 1 and not 0
Because IF NOT EXISTS
I almost never have to do that though.
Actually, I take that back.
I do that sort of regularly.
But the query is a lot simpler than that hyperbole
 
I don't think I've ever had to do that - what do you use it for?
 
@nhgrif So does that mean there isn't another one coming?
 
9
A: Testing for a float NaN results in a stack overflow

Hans Passant works OK in the constructor of theclass for a custom control This is the only real hint towards the underlying problem. Code that runs on a thread can manipulate two stacks inside the processor. One is the normal one that everybody knows about and gave this web site its name. There is how...

Hans' answers are incredible
I try to read all his answers (I have an RSS feed on them)
Still never ceazes to amaze me
How do you go from "float.IsNaN doesn't work in a constructor" to "yeah, somebody messed with your processor's FPU control word."
 
12:31 AM
I read his answer and go: "Yeah, I know some of those words."
 
reminds me of an oldnewthing blog post
 
12:45 AM
0
Q: CRTP object counter to track accidental singleton instantiation

glampertI have used CRTP to implement an object counter for singleton classes. This way I can keep track of accidental attempts to instantiate more than one object. It is a header only class: SingleInstanceType.hpp: // ====================================================================================...

 
@syb0rg Correct. I was going to explain to you what a normal init method should look like... but there's no possible way I can think of right now to make this method fit the form of a normal init method.
@DanLyons I'm developing an app which does lots of ERP things. Part of what this does is provide the functionality for scanning barcodes. The actual barcode scanned could be anything, but if I assume it's a particular field in the database, I need to differentiate between when the scanned barcode matches exactly, and when it doesn't.
0
Q: CRTP object counter to track accidental singleton instantiation

glampertI have used CRTP to implement an object counter for singleton classes. This way I can keep track of accidental attempts to instantiate more than one object. It is a header only class: SingleInstanceType.hpp: // ====================================================================================...

So, I guess singletons in C++ are a lot different... and you have to know when your class is a singleton and call a non-constructor method to get the reference to the singleton?
 
 
1 hour later…
2:21 AM
that looks like a complicated way of going about it
 
3:03 AM
0
Q: my own shuffling function

CroCoI would like to hear your suggestions about my shuffling function in C++. I thought why not to take advantage of using rand() to build shuffling function. This is my code. #include <iostream> #include <vector> #include <ctime> bool find(const std::vector<int>& vec, int index) { for (int i...

 
 
1 hour later…
4:04 AM
0
Q: Reasonable way to implement “safe” math operations using _Generic?

acarlowOriginally posted on StackOverflow, it was recommended I ask here: I've been thinking about a way to make it easier to safely use math operations with C's basic datatypes (e.g. using the CERT C coding standard). So far, I've come up with something like this: #include <stdlib.h> #include <stdio.h>

 
4:48 AM
0
Q: Flow Task Scheduler

Danial EugenScenario: I wanted a task scheduler/doer that enables my application to schedule some tasks to be executed in a specified time but in the same order they were scheduled in or depending on their priority so i looked up over the internet and didn't found something the truly fit my needs so i decid...

 
5:02 AM
0
Q: Implementated bowling game for job, but I disagreed with the feedback, welcome thoughts

user50772I was given a simple coding exercise as part of a job interview process. Needless to say I received a negative review. This is the the [question] : https://gist.github.com/codingricky/2913943 I would welcome your thoughts on my code and the agree/disagree with the feedback given. Pros - Has te...

 
5:27 AM
-1
Q: WCF Chat complete project having issue with server

PaulWillI have been trying to get this project going for the past 4 days but for some reason it doesnt give any errors but it wont run the chat server. can anyone please check and let me know what I am doing wrong, I would really appreciate it. project source code

 
 
2 hours later…
7:57 AM
1
Q: is this python code production ready

user3530862Purpose of making this code is to copy paste and run it. ( and it should run ) Open to all feedback. Shoot. #!/usr/bin/python # -*- coding: utf-8 -*- # # Author: Nishith # Version: 1.0 # # Description: # A quicktime (part 2 ) generator from ready image sequence. User is # prom...

 
8:17 AM
@nhgrif that tag is to prevent long posts on how rolling your own is bad and you should use the library and here's how to google if you think something exists in the library but you're not sure... as well as listing the pros and cons between the built-in and their implementation.
Without the tag, all questions in that category become "use this built-in function"
other answers would be nice, but missing the point
 
0
Q: Optimizing implementation of Dijkstra

Akshay KhuranaI am using a priority_queue ( STL ) to implement the Dijkstra's algo.(C++) while(!Q.empty()) { u = Q.top().first; Q.pop(); int size=G[u].size(); for(int i=0; i<size; i++)//tle { v = G[u][i].first; w = G[u][i].second; //cout<<u<<" "<<v<<" "<<w<<endl; ...

 
8:56 AM
0
Q: Kindly check this Infix to Postfix Converter Program

Simon GoYes, this is my homework, kindly help me with checking? I would appreciate it a lot The instructions below: " Implement an infix expression to postfix expression converter. You are to implement the infix to postfix algorithm presented in the lecture. You are to use only the stack that was provi...

 
9:27 AM
Monking
 
9:38 AM
0
Q: CSS code sholuld be as complete as photoshop or other design tools

Al KushI am just thinking that doing design with CSS should be as simple as doing it with photoshop, ilustrator or coreldraw. What I am going to say is that we should be able to create something for examples such as vectors or bevels of shadow towards png image automatically with css only. I am just a n...

 
10:18 AM
0
Q: Best way of mapping in C#

mitomedI have a WCF service that itself uses another third party WCF service. It's basically a proxy. So I'm getting a request to my own one and I have just to "forward" it to the third party one. I would like then to map from my flattened request (that's the way it's been decided to be coded) to the s...

 
10:33 AM
0
Q: Implementation of quicksort with dual pivot

JohnI am just trying to implement the algorithm in Java... But seems that I have few issues that I cannot find them. Given this input: [4,5,2,19,0,5,2,4,8], the result is: [2, 5, 4, 8, 4, 5, 4, 4, 19] public static void quicksort(int[] array, int low, int high) { if (high <= low) retur...

 
 
2 hours later…
12:07 PM
so I'm reviewing the source code in the book and it just hurts
declaring an array, casting object to array, storing it in a variable, then testing if the variable is not null
... for checking if a regular expression matches a piece of text
Hint: there is a built-in test method, which returns a boolean
      protected function recourse( str : String , count : uint = 0 ) : Boolean
      {
         var tmpAr : Array;
         var expressionString : String = (count < profanityAr.length - 1) ? '\\b' + profanityAr[count] + '\\b' : profanityAr[count]

         var regExp : RegExp = new RegExp( expressionString , 'gix' )
         tmpAr = (regExp.exec( str ));
         if (tmpAr != null)
         {
            return true
         }
         else
         {
            if (count < profanityAr.length - 1)
find tze mistakes
I expected better from code in books =/
 
what language is that?
 
ActionScript 3
 
tmpAr, wtf?
 
Wow, that looks a bit like Swift.
 
tempArray is hard to type huh?
 
12:13 PM
temporaryArray...?
 
- tmpAr is not needed, because the data from it is never read
- regExp.exec is unneeded, the only thing that matters is whether you have any hits, so use regExp.test instead
- regExp.test returns a boolean, assigning it to a separate value is unneeded
- else with only a single if in its body - use else if instead, saves you a level of indentation AND two lines
- why is it recursive? Rewrite as iterative instead
oh and of course it's missing semi colons
 
Why is PetSmart sending me a back to school email...
 
you don't NEED them... it's just bad form not to have them
 
I don't go to school and my pets definitely don't go to school...
2
 
lol
 
12:15 PM
"Help your cat get back in the school routine" and the email is trying to sell you cat toys.
As if my cats give a shit whether or not I'm home.
 
my cats have the magical ability to stare at a wall with their eyes open for hours
and not the "from a distance" kind
< 30 cm (1 ft)
 
Occasionally, I have cat toys delivered to my house. It's a weird ordeal ordering cat toys. You pay for the packing material such as books, or whatever, and they just give you the box for free.
 
So uh
 
But if I were to be going back to school, I'd actually be home a lot more often than I am now, in which case, I could sell my extra cat toys off to other people.
 
Does this happen often, that programming books are written by writers and not by programmers?
 
12:19 PM
I don't think so, but there are editors.
But usually editors don't touch the code snippets.
 
... ahhh...
 
With that said though, I'd be willing to be that more people writing programming books are programming educators moreso than working professional programmers.
 
oh crap this was example #1 I still have 5 more to go in this chapter
 
My mom has a Masters degree in Civil Engineering. Civil Engineers are the people who do roads and bridges and such. My dad only has a high school degree but he has worked in bridge construction since he was 18 basically. So my mom has just about all the formal education and theory on the topic possible. My dad meanwhile has basically all of the real world practical application of the topic possible. My mom generally learns more new things from my dad than the other way.
My dad might not quite understand all the theory and math behind all of it, but he knows how to do it as well as anyone else.
And my mom is very intelligent.
 
"Consider these sections of an ActionScript 3.0 web site: Portfolio, News, About You, Home, and Contact."
 
12:24 PM
But consider you were trying to get a book about practical bridge construction. It'd probably be more useful if my dad wrote it. But people like my dad don't have time for writing books, and usually not an interest in writing books either. So more likely, you're getting a book which was written by my mom. Which would be great if you're interested in the math and theories and bigger picture comments.
 
TT_TT people, please don't build websites in flash
 
@and31415 It's of no great surprise to me that the Windows design principles can be basically summed up as 'assume the user is an idiot'. It makes it an incredibly frustrating system to use if you're not an idiot. — Miles Rout yesterday
 
nooo
This code is broken
 
Who ever came up with the "Reticulating Splines" idea when they were working on SC2k is a genius and quite the trendsetter.
 
12:28 PM
what does that mean
 
I'm afraid this user is not getting the point of CR
 
Reticulating Splines?
In the 90s when the phrase was inventroduced, it meant nothing, along with all the other silly phrases the SC2k loading screen showed you.
But in SC2k, it was really subtle. The phrases the loading screen showed you sounded technical enough, but they were all relatively meaningless.
I think in "The Sims" it became more obvious that the phrases were intended to be funny, but "Reticulating Splines" remained in the phrases.
Since then, it's appeared in every Sims and SimCity game as well as games outside of Maxis. It was always a joke.
 
that guy
that guy just edits stuff all day
I think he likes reading?
 
Then, a couple years ago, while working on the new SimCity game, Ocean Quigly, who worked on several of the Sims games as well as SC3k and SC4, tried inventing an actual technical definition out of "reticulating splines"
> SimCity 2000 was the first Sim game to feature the semi-nonsensical phrase "Reticulating Splines", which means to make a network of splines. Will Wright has stated in an interview that the game does not actually reticulate splines when generating terrain, and he just inserted the phrase because it "sounded cool".[citation needed] The phrase has since been featured in SimCopter, SimCity 4, The Sims, The Sims 2, Spore, The Sims 3, The Sims Social and SimCity Social...
> It is also used in the web-based game Glitch, the popular video game Minecraft (as a title screen splash text), the music service Turntable.fm, the free online education sites khanacademy.org and grovo.com, the operating system Ubuntu, the photo-sharing sites Flickr and SnapJoy, the Humble Indie Bundle Android app, when generating certain reports in SEOmoz, when preparing the game collection analysis in Raptr, and the free-to-play game HAWKEN.
 
12:46 PM
So, maybe I don't understand the sorts of dice being discussed, but...
2
Q: Probabilities using 3d10 as 1d1000

FrankI'm trying to use anydice to figure out the probabilities of the various values of 1d1000 rolled on 3d10. I want to know stuff like "what's the chance of rolling 900 or higher? How about 950 or higher?" I'm not sure how to script anydice to give me this information if it's actually possible. ...

This question is claiming that 1d1000 has the same odds as 3d10 for any given number.
I'm not sure how that's possible.
 
Aren't the odds for 1 always different or even 0 on one of them?
 
1d1000 = a one-thousand sided die
3d100 = three one-hundred sided die
The numbers have to either go 0-999 or 1-1000
Or, 0-9, or 1-10
Wait, you multiply the numbers you rolled on the 10 sided dice?
but 10*10*9 = 990
so you can't roll anything between 990 and 1000 on 3d10
 
I think they even use it differently
to me it sounded like you roll 3 dice range [1, 10]
then you calculate result as (d1 * 10^2) + (d2 * 10^1) + (d3 * 10^0)
 
Yeah, that'd make sense.
But then you either can't roll 0 in the hundreds place, or you can't roll 10
 
I think it has to be 0-9 then
 
12:51 PM
Then you can't roll 1000
Wait
Here's the formula
((1d10 - 1) * 10^2) + ((1d10 - 1) * 10^1) + (1d10 * 10^0)
So the first two are 0-9
The last one is 1-10
Because if you roll 9 (900) + 9 (90) + 10, that's 1000
 
that sounds overly complicated... but I agree
 
Or if you roll 1 (0) + 1 (0) + 1 (1), that's one.
I am curious as to the mathematical theory on whether or not the distribution truly is identical.
 
nhgrif
 
Yes?
 
roll 3 digits
then +1
or
 
12:58 PM
The die are label 1-10
 
random.nextInt(1000)
+1
 
I think they might count 10 as zero for the first two die
 
yeah
that's what I mean
 
But not on the last die
 
err then they are stupid
 
12:59 PM
They use three different colored die
 
kk
 
And actually, there are probably die label 0-9
 
if you can get 1099
then something went wrong
 
You can't...
Three die, three different colors. Before they're rolled, each one is known what die it counts as
You have a hundreds die, a tens die, and a ones die
And these posts talk about "percentile die", so they probably are labeled 0-9
 
...
 
1:00 PM
These would be used for the predetermined hundreds and tens rolls.
 
using 1x 1-10 die and 2x 0-9 die to get 1-1000:
 
Yes.
 
hundreds = 0-9
tens = 0-9
 
Right
 
ones = 1-10
 
1:01 PM
Right.
 
if ones = 10, ones = 0, +1 to tens.
 
Yes.
 
if tens = 10, tens = 0, +1 to hundreds.
that's how you get 1-1000.
 
scroll up to where I said "Here's the formula"
 
so you can't roll anything between 990 and 1000 on 3d10
is false
 
1:02 PM
Yes you can.
Err, right
 
well you just said that
 
I figured that out.
 
@nhgrif here
 
I rubber ducked it before your explanation.
 
cool
 
1:03 PM
@skiwi right above this message I figured out
 
I'll now go back to hate-reviewing this book for bad code
 
5
A: Is it the same using 1d100 and using 2d10 (one percentile)?

user3303373Rolling 2 d10s is the same as 1d100 for one simple fact: They are rolling the digits independently as opposed to rolling 3d6 or 1d18 in which the results are added together and the lower cap for each set can be different (3 or 1 respectively). When you roll 2 d10s for the purpose of replacing ...

 
@nhgrif okay
 
Sorry to ping you, I was trying to point Pimgd to a message and I couldn't @ myself
 
no problem
 
1:11 PM
This is the best answer regarding this issue:
2
A: Is it the same using 1d100 and using 2d10 (one percentile)?

corsiKaNote: the following only applies when dice rolls are treated as unique. In most cases, we don't treat dice like we do below. Normally, 1d6 + 1d8 would usually have a range of 2..14, not 2..48 because in MOST cases we SUM dice instead of counting each individual combination as unique. Below, I us...

 
1:24 PM
ugh
adobe's docs are loading terribly slow
wtf
 
Ugh really, in JavaFX a Tab is not a Node
 
compiler errors in code samples, nice
 
@Pimgd That really angers me so much when reading a book
 
1:40 PM
not just 1
I'm getting multiple compiler errors
seems like the author doesn't know how casts work
nice
as SomeMovieClip
...
code != English, people
 
are you sure you are using exactly the same version?
 
Yes
 
then it doesn't look good for him
 
ah I see, it's semi-pseudo code!
 
can't you ask him to pay you per fixed bug/abnormality?
 
1:44 PM
Why?
it looks like it'll be 15-20 euro's/hour right now
after taxes.
that's good pay.
 
that's good already yep
give me such job in Java!
 
if you wanna maintain code that uses 3 space-tabs
no semi colons
hmm lets see
all intermediate results are stored in variables initialized at the start of a function
and half the time it doesn't work
... that's a scary job
hmm
This is actually quite bad, I should have some more mails with the editor
I wanna know what my priorities are
just fix the errors, or improve the code too
 
2:05 PM
if they want me to fix the downloadable code I want extra pay
cause if you pay me per page and then give me code that's not on pages then fixing that doesn't earn me anything (whilst it should)
 
2:47 PM
Alright, whipped up an entire interactive report page in APEX in 45 minutes
I am now a professional DB-dude
 
3:01 PM
Hello!
 
hey
 
3:14 PM
-1
Q: What Framework/System/Tehnology to use for showcasing products but not sell them

NagriI have to build a website where I can give an admin panel to the admin from where he can add Products, Categories, Images for products, Descriptions etc. Just Imagine a Magento website to display all the products he can supply but not sell them online. With Brands, Categories and all that specifi...

 
Quiet in here...
 
yup
 
hi
 
modified 1h ago by Jamal♦
EVERYTHING
 
3:29 PM
Surprised this didn't get more votes: codereview.stackexchange.com/q/59546/27623
 
I'm not gonna edit again for a while. :-) Not with this loss of activity anyway.
Oh! Forgot about that.
 
Especially nhgrif's answer, it was really good.
 
so few people in the code review objective-c community
 
@bazola I'm working on it. ;)
 
My answer somehow didn't get much attention. But I assume it's all correct.
 
3:32 PM
@syb0rg well I appreciate it :) since its pretty much you me and nhgrif
 
We need to recruit more people from SO somehow...
Pull them over to the light side
 
well
 
Our objective...
*puts on sunglasses*
...is to get more Objective-C reviewers
5
 
you could answer questions on SO (waaait waait not done yet)
and then end your answer with a link to Code Review.
 
Why not start it with a link as well? :-)
 
3:37 PM
but that would mean it shoulda been migrated
 
barely any of my questions on SO get any up votes, very stingy over there
 
My last one somehow pulled off two.
 
niiiice
beta build of game freezes when you hit cancel on the submit bug report button
 
If was, of course, similar to the others, but it did mention a tiny detail not mentioned by others.
 
@Pimgd You're forced to submit them
 
3:41 PM
My last SO question "went off": and got 14 votes
 
@skiwi did that many times already during the alpha... I've got my name at the top of the alpha testers list because I'd frequently find 10+ bugs after a new update
 
My Bejeweled game didn't get very many votes (my fault for making it confusing at the beginning), but it did get me some view badges.
 
 
2 hours later…
5:39 PM
Incoming question that feels off-topic.
 
Thanks, Santa!
@Morwenn Indeed
 
We got our second question today :D
 
:D
 
0
Q: Pseudo code for looping n+1 times

alvasI have python code that loops n+1 times with parameter x, as such x = [1,2,3,4] # n = 4 for i in range(len(x) +1): # do something How would the standard pseudo code for the loop like? Is it like this: for i = 0 ... length(x) + 1 do // do something

 
6:16 PM
0
A: Reasonable way to implement "safe" math operations using _Generic?

syb0rgVery impressive! A few notes: I really like how you are using C11 stuff. #define safe_add(x, y) _Generic((x + y), \ unsigned int: safe_add_uint, \ unsigned long: safe_add_ulong \ )(x, y, __FI...

@Jamal You might like to see my error handling style in that answer ^^^
 
Out of votes. :-(
 
xD
@syb0rg You totally crushed my answer. Well done.
Do any of you play the deckbuilding game Ascension?
 
6:34 PM
0
Q: what can I do better in this code?

Leonardo GasperinGood to have as improve? I hope so. But it improves? the code makes it lighter, improving performance such things. I would and tips because I am still studying. I'll post below 3 codes vectors. #include <stdio.h> #include <stdlib.h> //create an vector of 10 positions and print only prime numbe...

 
^^ Google translation?
 
Yep, and I've removed much of the noise. I also see two main()s...
 
Three actually. Those are three different programs.
 
Oh, duh...
 
7:09 PM
@syb0rg that suggested edit you rejected.... and I approved (and I probably messed up)....
@Jamal - you too...
When I look at the suggested edit, it looks like it removes spaces from the line too:
 
You're getting tired :p
 
See the - was removed at the beginning of the line....
hmmm... my snapshot tool is not great....
 
Haha XD
 
It looked like the suggested edit was removing spaces.....
so I approved.
thinking it was a copy/paste type edit.
 
The edits that add/remove lines are always tricky.
 
7:13 PM
Question.... is that a bug in the review-queue display-of-diff?
 
I don't know whether this is a bug or whether they have no idea how to represent it when lines are added/removed.
 
Well, I rolled back my approved edit....
someone scored 2, but that's OK.
 
Haha, we could really change those tags from time to time.
 
7:55 PM
=)
 
8:24 PM
0
Q: How to find top forum contributors

anvandarnamnI have a list of internet forums using various platforms. How do I search for and find the most active posters on these forums? I realize that there may not be a universal solution to finding top contributors on any forum. If there is some general approach, great! Otherwise, I will also be happy...

 
8:54 PM
What was that @CaptainObvious?
 
Crap
It makes me wonder if there's a way to prevent closed questions from being posted here (if that's even necessary).
 
Idk, but this is a really well thought out answer.
2
A: Infix to Postfix Converter Program

lealandI like this opportunity for a code review because I hopefully can share some good programming techniques that I didn't have a chance to learn until I actually got out of school and into the industry. I can edit to explain anything further. Your variable infixExpression can be defined as final: ...

 
And I'll vote on it after the reload.
 
It's quiet in here.
 
I'm mostly chatting in the Tavern now. I guess no one feels like reviewing code on a Saturday, which is okay.
 
9:09 PM
I'm actually working on a new question. Something for @Mat'sMug to tear to shreds.
 
9:20 PM
@syb0rg: The OP corrected the last part of your C11 answer about the extra parenthesis. Do you still want it rolled back, or is it minor enough to warrant removal from your answer? I don't want to set the wrong example if we go for the latter, though.
 
00:00 - 22:0022:00 - 00:00

« first day (462 days earlier)      last day (3537 days later) »