« first day (444 days earlier)      last day (3574 days later) » 

4:00 PM
...someone's gonna mention CR on there, huh? :P
 
aw, closed just before I could post CR as an answer
 
I was gonna mention a comment anyway.
 
@Jamal "On Code Review.SE" should have been added before it was closed.
@Mat'sMug Be faster mug!
 
Where can I learn to refactor code? - Code Review.SE is a great place to learn. — syb0rg 5 secs ago
@Jamal Beat you ;)
 
@syb0rg beat me too!
 
4:02 PM
 
His username also reminds me of the former tag. Those were the days...
 
Had to lol for a bit on this one
Having the same answer does not imply duplicates. What's 100/2? Well its 50. How many states are there in the US? Also 50. Are these questions duplicates because they share the same answer? Absolutely notwnnmaw 21 hours ago
 
@skiwi doh
 
lol
 
How on earth is a -33 answer accepted there...
 
4:04 PM
@skiwi WHERE?
 
@skiwi It's quite ironic that that question itself has three close votes for being duplicate.
 
@Nobody my answer is a lot simpler though :p
 
-35
 
@syb0rg oh, I see, you are doing all sorts of behind the scenes stuff to keep me at bay!
 
@Malachi This one:
-35
A: Can a question be a duplicate if it's totally different?

Anthony GristSince I've been discussing this a bit in comments on Cerbrus' answer I figure I'd post my own competing answer, since I have the opposite opinion on whether they should be closed. In the general case, based on my interpretation of this statement Now, notice that this is subtly different from...

 
4:05 PM
@Malachi Yep ;)
One more close vote on that one ^^^
 
@ckuhn203 complemented your answer here:
0
A: Read table row with multiple options

Mat's MugAs @ckuhn203 hinted at the end of his answer, the empty catch block smells. The problem is that you're catching an exception that should be avoidable: reading an empty cell isn't something that should be exceptional in Excel after all. I think if ReadCell returned a struct that represented a ce...

 
> marked as duplicate by Caleb, Lance Roberts, Martijn Pieters, syb0rg, skiwi just now
 
@syb0rg something like this should do it, but now that i think about it, i think some browsers treat document.body as the thing that scrolls and others treat document.documentElement as that thing
addEventListener('scroll', function(){
  var s = document.body.scrollTop /
          document.body.offsetHeight - document.body.clientHeight;
  var r1 = 40+106*s, r2=160-320*s;
  document.getElementById('a1').setAttribute('transform', "rotate("+r1+")");
  document.getElementById('a2').setAttribute('transform', "rotate("+r2+")");
});
but I'd still just do something like (document.body.scrollTop || document.documentElement.scrollTop)
unless you are already using jQuery and don't care if your code looks like PHP's bastard child, in that case go for it
 
@skiwi Although the other one was earlier it looks like the one that has been marked as duplicate should actually be the one that is marked as the "non duplicate" canonical question
 
@DaggNabbit lol
Your code stops the electron early when scrolling back up though.
 
4:09 PM
@Nobody I don't know if that's within the rules though
But I get what you are saying there
 
Aren't duplicates removed after some time?
 
@syb0rg hmm, what browser are you using? WFM in chrome.
 
@skiwi that should be on the Philosophy site
 
Or both should be duplicated to a proper CW without a negatively accepted answer
 
@DaggNabbit Chrome for Mac. WFM?
@Malachi Can you toss this guy an upvote? stackoverflow.com/a/24883898/1937270
2
 
4:11 PM
@syb0rg worked for me
 
Odd
 
@Caleb I refuse to have my questions closed as duplicates of questions with typos in the titles. Hang on, I'll edit. — Mr Lister 1 hour ago
 
@syb0rg oh wait I see it... it's just that the initial position where he put it isn't where it starts out by by calculation
 
@syb0rg that stuff is over my head a little bit, looks like it answered your question though!
 
I think he is getting the entire height of the window including the title bar and I'm just getting the content area, but could be wrong
 
4:12 PM
@Malachi It's a bit over mine too ;)
@DaggNabbit So adjust var s?
 
@syb0rg actually adjust the SVG itself to have the dot start out at wherever it ends up when you scroll back up
I'm assuming that's what he did in the first place
 
here is a good answer
2
A: Can a question be a duplicate if it's totally different?

Bruno So then, can two questions that are totally different, but just happen to have the same answer, be duplicates? Should the latest one be closed? No. Questions are generally asked by describing the symptoms (or signs) of a problem. Answers, especially good ones, tend to describe the causes of ...

 
now I'm curious what $(window).height() is in jQuery... is it the outer height or the inner height?
 
0
Q: Multi-user server connection handling

LighthatI'm writing a program and I have a server that needs to be able to handle multiple client connections at once doing many different things. I'm using the Qt library, so I handle new connections like this: In the server constructor: Server::Server(QObject* parent): QObject(parent) { connect(&s...

 
@CaptainObvious ?
Wth is that
 
4:17 PM
(removed)
 
@Phrancis it's KDE's widgets and stuff
 
@Phrancis: A multiplatform GUI library
 
> Qt is a cross-platform application and UI framework for developers using C++ or QML, a CSS & JavaScript like-language. (Also use the [c++] tag for C++ code.)
 
Ah I see
Hmm, a friend of mine told me his uncle is an IT manager at a very large healthcare insurance provider, and that they are badly in need of SQL programmers... Time to update the old resume :)
2
 
@Phrancis ya man!
 
4:23 PM
@Mat'sMug I saw. It was a good answer.
Have you put any thought into this one? I'm not happy with my results.
8
Q: How can I make this userform timer faster?

NealI have a userform that displays a goal time for workers to shoot for when completing a task. It also has a stopwatch on it that is controlled by a start, stop, and reset button on the userform. If the stopwatch time reaches the goal time and goes over, then there is a box called "extra time" that...

@Phrancis TS
 
Done
 
@Mat'sMug @ckuhn203 my finger slipped on that C#question
 
@ckuhn203 not yet :/
@Phrancis :)
 
I know it needs an OOP approach and I think I have an idea of how to do that, but I can't figure out how to deal with his performance issue. The best I can think is to slow the execution down to once per second during the loop.
 
not catching/swallowing an exception for every single row he's reading should speed it up a little ;)
but Excel interop is inherently slow
I don't think Primary Interop Assemblies were given that name arbitrarily. PIA sounds accurate.
 
4:29 PM
lol
 
@Mat'sMug There's a T missing.
 
that's a cultural thing ;)
 
> implemented with COM
That's all I needed to know
 
user image
3
 
Nice!
 
4:43 PM
62 upvotes away from Silver badge.
2
 
:D
 
That's less than 1 upvote per answer: codereview.stackexchange.com/users/36366/nhgrif?tab=answers (not all of these are ObjC, but 79 of them are)
back to work.
 
@syb0rg He deserves it, and your question too!
But "write-me-teh-codez" questions are still allowed on SO right? As long as you write a proper question, etc. instead of a direct "GIMME CODE".
 
Maybe you did not want to start a holy war ..... but, on SE, the only indent style that renders consistently and plays nicely with the in-the-ask-a-question-text-area is spaces-only. There are some tools out there to help you if you currently have tab-indents and want to switch to spaces for Code Reviewrolfl ♦ 14 secs ago
 
4:52 PM
Wow, how much indentation is there in that code
 
Wow we are slammed today -_-
 
There is a fourth main camp actually : I don't how to indent so I'm doing what I want, how I want and with no consistency. This group is the darker one! — Marc-Andre 45 secs ago
 
@rolfl Fixed it there
Heh, how does this work:
@Override
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
    int size = size();
    if (a.length < size)
        return Arrays.copyOf(this.a, size,
                             (Class<? extends T[]>) a.getClass());
    System.arraycopy(this.a, 0, a, 0, size);
    if (a.length > size)
        a[size] = null;
    return a;
}
What is the point of nulling out a[size], but not the elements following that?
(And it looks horrible btw)
 
5:09 PM
@rolfl Well I now have a dir with all my libs and I'm using the classpath (all done by maven). So I guess my combat with Maven is over and there is no winner!
 
So guys, there's a sushi restaurant I occasionally go to for my lunch break. I was talking to the waitress and I told her I was a software engineer. She told me she taught herself Ruby and Javascript. Would have been marriage material if she said assembly, c, and c++.
6
 
> Mixed: indentation levels use tabs, but alignment is done with spaces. This is the style I personally use.
How is that exactly working out?
 
@jliv902 get her onto CR!
 
@jliv902 Lower your standards my man.
 
@jliv902 Well, she can program at least! (And TS there)
 
5:13 PM
yay, 18.4K!
 
0
Q: Calculating the number of prime numbers to solve the puzzle

TorrtugaHow can the following program execution time improved? I have used dynamic programming in both "recursive" as well as "prime" function, but I'm not getting the efficient execution time. There is a wall of size 4xN in the victim's house where. The victim also has an infinite supply of brick...

2
Q: Use a Java Array like a List

2g7hgfdr8324I'm saving string values in an array one at a time so I cannot initialize the array with the values all at once. After I'm done with the array I need to pass it to another class that is expected a String array. Normally I would use a List but the end result is expecting an Array so I stuck with ...

 
Looks like those may be candidates for the next languages I learn.
 
@jliv902 dude if she was cute and know how to do Ruby and JavaScript this was a no-brainer! My girlfriend play Mario Kart 8 and she did play Wow with me, I'm one of the luckiest guy !
@jliv902 She could teach you ;)
 
@Marc-Andre That's what I was thinking. =)
 
cue Van Halen's Hot For Teacher
 
5:16 PM
@jliv902 That's the spirit!
 
@jliv902 Yeah, but she didn't mention PHP. ;-) Still, you could always help her learn those languages!
 
It's exactly what I'm afraid for once I find a girl... That she may not grasp the idea of programming at all!
I know I can't expect every girl I'll meet to find bugs in Java 8, my standards are not that high.
 
@Jamal She said that she lost interest in programming. She's studying film-something. I forget.
 
@DanLyons TS
 
@Mat'sMug done (but you didn't ping me )
 
5:18 PM
My girl's into hardware @skiwi. Can't write a lick of code, but then again, I can't install a new motherboard or set up a network.
 
a girl lost interest in programming? shocker
 
@ckuhn203 That's nice as well
 
@ckuhn203 but do you fight over whether it's a hardware or software problem? :P
 
@DanLyons LOL. Sometimes.
 
it's always the hardware.
 
5:19 PM
But really if I couldn't explain any kind of abstract level of programming (like how the workday was), then It'd be very hard
 
Unless Microsoft wrote it. Then it's the software.
 
lol
 
When Microsoft writes software, it causes my laptop in Hibernate modus to wake up and install updates at 3am in the night.
115 rep on CR... I might throw an actual attempt on hitting +200 later tonight.
 
If I can find some time to write another couple of reviews I might hit 3k soon. =)
 
> If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the list is set to null. (This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.)
 
5:32 PM
Calling the editors to the rescue:
4
A: Initiating class objects and arrays

Elias Van OotegemI've often found myself in this situation (having an instance of an object, and needing an array). A couple of examples of where one might encounter this situation: DataModels that need to be mapped to a db table (for use in queries with prepared statements) Objects that represent data that is ...

There is some messed up code somewhere in the middle
@rolfl Actually, no, I hadn't, and I should've. I don't get a practical implementation though.
 
When Microsoft writes software, they surely add a limitation of max 260 chars for paths in some places, but not all.
 
@kleinfreund Yeah, that bugs me to no end! It's the %PATH% variable
 
@CaptainObvious answered, partially. Small answers to the rescuuue
 
This counts for %PATH% as well as for real paths.
 
260 characters is all you'll ever need?
:)
 
5:34 PM
Not for Node.js/npm
 
With Unicode builds, you get like 32k characters.
 
My %path% is 210 long, btw.
 
@kleinfreund they do, and it's not 260 .....
 
What do you mean?
 
0
Q: Perfect game loop

user46525I've been working on development for an android game, and this is the game loop I have so far: private static final int MAX_UPDATES_PER_DRAW = 10; private long timeAccumulator = 0; private long lastTime = System.nanoTime(); @Override public void onDrawFrame(GL10 unused) { // Use this st...

 
5:35 PM
@kleinfreund funny you mention that
5
A: Is there a way for DIR(path) in VBA to handle strings longer than 260?

retailcoderShortly put (to answer the answer as titled): No. VBA's Dir function simply does not work with paths beyond 260 characters. Long version: http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maximum_path_length (then Ctrl+F and search for "260") Maximum Path Length Limitation In...

 
My %PATH% is also filled with mostly garbage and duplicate entries for some weird reason.
 
24
A: Why does the 260 character path length limit exist in Windows?

valliQuoting this article http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maxpath Maximum Path Length Limitation In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. A local pa...

 
node packages installed via npm nest its dependencies, so there are no version conflicts. That easily extends the limitation.
 
the intended limit was 256, plus some directory and quoting requirements
 
This is like the year 2k bug.
 
5:37 PM
@rolfl: yes, it's <drive letter>:\<256 characters><NUL>, according to the MSDN page
 
@kleinfreund totally
:)
 
Still it is quite a big problem.
 
They should've changed this when going to the Windows Vista architecture (NT 6), stuff was so messed up anyway in those days.
 
@kleinfreund Unless you are microsoft
 
I'm sure they need to work around this from time to time as well.
 
5:39 PM
then you make it someone else's problem, and then charge them money for support contracts.
 
I end up defining another path variable and including that in the original path varaible
 
@skiwi - it is not just the %PATH% variable, it is also things like:
H:\my\unix\machine\with\a\really\long\path\does\not\work\in\windows\......\file.‌​txt
 
Most hours are awsted by trivial problems... See this guy:
1
A: Java ClassLoader keeps creating more threads

user1870954Mark W's suggestion lead me down a rabbit hole of using jmap and other process analysis programs to find out what exactly was going on. There's a ton of useful utilities out there. With the combination of VisualVM and Eclipse Memory Analyzer (MAT) I was able to figure out that I wasn't closing th...

@rolfl Oh... ouch
That's shorrible.
 
C:\Users\Philipp\AppData\Roaming\npm\node_modules\gulp\node_modules...
 
And then it just crashes?
 
5:42 PM
I think it just truncates.
 
You could use %AppData% instead of C:\Users\Philipp\AppData\Roaming
 
so file-not-found
 
Is there a command to run to find the longest path + filename on your OS?
 
@rolfl It's a huge deal when versioning your stuff and moving between Windows + any other OS (basically)
 
I know, which is why I tend not to.
 
5:43 PM
@Dan That's just a workaround just like moving the things to C:\npm.
 
True, but until another version of Windows comes out with a larger limit, that's what we have to work with :/
 
I can't setup build tools with this issue, because the plugins I want to use extend the limitation anyway.
Plus I don't really see them changing this. When I have the money, I probably move to Mac.
 
Btw, if anyone is found to draw diagrams/flowcharts often: You should check out gliffy
If anyone else knows a diagramming tool I'd also be eager to hear
 
@DanLyons That is not likely to happen....
8
A: Window 256 characters path name limitation

GillesAccording to Microsoft: The traditional Windows API limits path names to 260 characters, even for applications developed for the latest version. Applications using the Unicode-aware API can use a form of path that allows up to 32767 characters. The file name has to be prefixed with \\?\, and mu...

@kleinfreund Move to linux - you don't need to wait for the money
6
 
I surely won't move to Linux.
Don't get me wrong. I don't fear getting my hands dirty with command line magic, but Linux? Nope.
 
5:49 PM
Your loss....
 
I actually feel a little sorry for Microsoft. Many of the really awful things in Windows are there only to be backwards compatible with APIs developed 20+ years ago
 
@DanLyons - IBM bought the company I worked for. At the time, I thought I was being swallowed up by an antiquated behemoth of red-tape and structure. Sure, there is some of that, but, they are also adaptable, and move with the times. IBM always finds a way to make progress despite backward compatibility.
Microsoft is younger, has good role-models, and has fewer excuses.
Have you heard that IBM built a damn CPU with 31-bit CPU's address-busses to allow for compatibility, and progress?
now their mainframes, those old, legacy things, can run 8, 16, 24, 31, 32, and 64 bit applications.
 
in other words, MS should go back and do their homework
 
IBM has some pretty awful stuff in their MQ APIs :)
 
^^^ that
@DanLyons Yes, they do.... ;-)
 
5:53 PM
It made me sad to find out that the action of querying for enqueue/dequeue stats on a queue resets the counters :/
 
Hmmm. that's odd.
Hiesenbug?
 
Nah, it's intentional. The doc states that the values are intended to be the counts since the last check.
Of course, that means that only one user/application/thread can ever check if you want accurate counts.
 
IBM has its problems (I know), but they do provide a good example of how a big company can still be responsive.
Not just responsive, but also pioneering.
 
> The file name has to be prefixed with \\?\
wtf
 
@rolfl It's nice to see someone who like the company he's working for ! :D
@skiwi you're using git with windows right ?
 
6:16 PM
@skiwi longest path on your os: find / | awk '{print length($0), $0}' | sort -n | tail
 
@Marc-Andre Yes
@janos Probably takes a few years to execute?
 
@matheussilvapb hi!
 
@skiwi 48s on mine :)
longest path: 341
 
hey guys
1
Q: Multi-user server connection handling

LighthatI'm writing a program and I have a server that needs to be able to handle multiple client connections at once doing many different things. I'm using the Qt library, so I handle new connections like this: In the server constructor: Server::Server(QObject* parent): QObject(parent) { connect(&s...

 
6:24 PM
Does it also print the path itself?
 
i think this is off topic
 
@skiwi yes. you can run it on a subdir to test it / play with it
 
That command doesn't work on Windows... intended?
or is it a batch thing
 
on windows, in git bash, you can use find /c/ instead of find /
git bash has all the tools you need: find, awk, sort
 
It's running and running :P
Didn't get access to my recycle bin though!
And how on earth do you get 341?
 
6:26 PM
@skiwi Do you know play framework and activator ?
 
@Marc-Andre Unfortunately, nope
 
xcode stuff. this is my longest filename, apparently: /Applications/Xcode.app/Contents/Developer/Documentation/DocSets/com.apple.adc.d‌​ocumentation.AppleOSX10.9.CoreReference.docset/Contents/Resources/Tokens/Objectiv‌​e-C/intfm/QCPlugInContext/outputImageProviderFromBufferWithPixelFormat:pixelsWide‌​:pixelsHigh:baseAddress:bytesPerRow:releaseCallback:releaseContext:colorSpace:sho‌​uldColorMatch:.xml
 
I assume it also only searches the c drive with the /c/?
@janos wat
 
yes
 
@skiwi Well too bad I need to connect git with windows and activator, guess I'll google a bit!
 
6:28 PM
It's taking surely more than 48 seconds here
 
@skiwi you could run for multiple drives at once with find /c /d /e /f | awk ....
 
It's fine, I'll run the d after this
 
@matheussilvapb why do you think this is off-topic?
 
because hes asking if its the right way
 
@matheussilvapb he says this is how he is doing it and asks if it is the best for performance
that is what a majority of the questions on Code Review are about
I am working on some Code at work ping me.
 
6:32 PM
yeah maybe
 
Such questions would be off-topic on CodeReview, please read the Help Center about who we are and what we do. We are here to review working code, that is the goal of the site, hence we need working code. — skiwi 5 secs ago
@janos It's running for 10 minutes here I think :P
 
it helps that I have ssd
 
This is also on an SSD :)
220GB of 232GB used though
It's running on 100% usage :P
 
1
Q: Parse HTTP header using Python and tcpflow

Raghda HraizI wrote a program that reads a pcap file and parses the HTTP traffic in the pcap to generate a dictionary that contains HTTP headers for each request and response in this pcap. My code does the following: Uses tcpflow to reassemble the tcp segments Read the files generated by tcpflow and check...

0
Q: Codility Frog Jump python solutions

JayMethod 1: def solution(X, Y, D): if (X == Y): jumps = 0 elif Y-X % D == 0: jumps = (Y-X)/D else: jumps = ((Y-X)/D) + 1 return jumps Method 2: def solution(X, Y, D): d = Y-X jumps=d/D rem=d%D if rem != 0: jumps+=1 return jumps...

 
@matheussilvapb I'm awaiting an SO mod's response to this question.
 
6:36 PM
ok
 
@Jamal oh don't ping me then...... lol jk, I would like to know what you find out as well.
 
Oh wait, now another mod here has responded:
This question could be asked on Stack Overflow, but I don't think it's off-topic for Code Review. In such situations, I'd prefer to keep the question open. — 200_success ♦ 41 secs ago
 
Bears?
If you wish to create a different site, then you should look at Area 51 to create new proposals. However your question here might possibly be on topic on Programmers.E, but before you even dare to ask you would need to read their Help Center at least twice to ensure that it is not off-topic. — skiwi 14 secs ago
 
@Jamal I just saw that as well
 
@janos find: /c/Users/Frank/AppData/Local/Microsoft/Windows Store/Cache/0/0-Namespace-https∺∯∯next-services.apps.microsoft.com∯browse∯6.3.96‌​00-0∯776∯en-us∯c∯NL∯Namespace∯pc∯00000000-0000-0000-0000-000000000000∯00000000-00‌​00-0000-0000-000000000000-.dat: File or path name too long
@Marc-Andre That guy really doesn't seem to get it.
 
6:46 PM
@skiwi I don't know another method on Windows
 
It threw more off those exceptions though
They don't make it crash
 
@Marc-Andre 321 frogs dinosaurs on the wall...
 
9
Q: Random Coin Toss in Haskell

Kevin MeredithLearn You a Haskell gives an exercise to implement the following function: -- make a function that simulates tossing a function 3 times import System.Random tossCoin3 :: Int -> (Bool, Bool, Bool) tossCoin3 x = let (num1, gen1) = random (mkStdGen x) :: (Int, StdGen) (num2, gen2) =...

-- make a function that simulates tossing a function 3 times, someone read too much about functions?
 
@DaggNabbit ???
Doesn't it already?
 
what's the captain obvious user for?
 
6:50 PM
@skiwi I think so?
@Pimgd He notifies us of new questions.
 
And then suddenly coinToss3 = evalRand $ (,,) <$> random <*> random <*> random this looked like magic
@syb0rg I guess you are doing it correctly with that amount of upvotes :)
 
@skiwi Well, I showed effort and that I had at least an inkling of knowledge in the area.
 
Yeah, I think it's fine to use if you are stuck, which I also tend to do sometimes
 
Anyone use or another form of NoSQL DB? I'm trying to figure out what kind of application/situation one would be better off using NoSQL instead of RDBMS
 
@syb0rg it has its initial position hardcoded in the svg, and that gets replaced with a calculated position as soon as the script gets triggered. So the hardcoded position has to match whatever first position gets calculated.
 
6:55 PM
@DaggNabbit Ahhh, got it
 
0
Q: Project Euler problem 31 - tail Rrecursive algorithm

firephilIn Scala, a recursive algorithm for project eEuler problem 31 is the following: object Problem_31 extends App { def combinations(list: List[Int], n: Int = 200): Int = list match { // match a non empty list case head :: tail => if (head > n) 0 ...

 
any Python programmers in here right now? wanna check my answer quick?
0
A: Parse HTTP header using Python and tcpflow

Malachiyou need to watch your indentation level. I am pretty sure that Python will not like your indentation here import os from os import listdir from os.path import isfile, join from StringIO import StringIO import mimetools def getFields(headers): fields={} i=1 for header in headers: ...

 
Beuller!!
 
@skiwi: Thanks for that correction on my edit. This damn mouse of mine should probably be replaced soon.
 
check my website: gus.netii.net url shortener
 
6:57 PM
@Malachi I would have just closed the question as broken code.
 
@Jamal No problem, though e and E are not on your mouse :p
More wondering; is it actually a proper question?
 
@200_success so I am right about all the scope issues?
 
@skiwi I mean that when I tried highlighting the letter to be replaced, it immediately dropped it before I had a chance to make the replacement.
 
@Jamal That can be rather... annoying, agreed
 

« first day (444 days earlier)      last day (3574 days later) »