« first day (780 days earlier)      last day (3239 days later) » 

12:00 AM
RELOAD!
There are 1395 unanswered questions (94.3627% answered)
 
@rolfl lol
 
0
Q: Arduino driver for 7 segment display with bit-shift register

Magister LudiThis code counts down from 30 to -999 on a 7-segment 4-digit display; it works but I don't know if it is a good way to do it or if it follows best practices. I want to start writing libraries for components that are not specifically made for Arduino. This is my first attempt. Please tell me if...

 
12:36 AM
As soon as I finish review tasks today, I'll have [Steward] badge finally.
 
@nhgrif on CR?
 
No.
On SO. It's one of the very few things left on the checklist of me having a perfect score if I ever ran for SO mod.
 
nice
 
I need Steward badge, the badge for 500 helpful flags (I'm at 462). I need 20k rep... and I have to manage to vote in the next moderator election.
 
thoughts?
1
A: Do we need TDD and UnitTesting?

Mat's Mugtdd is an indication of how OP's code was written - unit tests first. By itself alongside a language tag, it doesn't bring anything to the table IMO. unit-testing on the other hand, tells us that OP has unit tests, at least as part of the reviewable code - regardless of whether the code was writ...

 
12:40 AM
I will have Steward badge today. I will have helpful flags badge soon enough. I will have 20k hopefully by August at the latest.
 
haven't SO elections just occurred? (few months ago)
 
0
Q: Parsing huge data coming from a URL

davidI need to parse the data coming from the URL which looks like below - hasProcess=true version=1 DATACENTER=abc TotalNumberOfServers:4 primary:{0=1, 1=2, 2=1, 3=2, 4=1, 5=2, 6=1, 7=2, 8=1, 9=2, 10=1, 11=2, 12=1, 13=2} secondary:{0=0, 1=0, 2=0, 3=1, 4=0, 5=0, 6=0, 7=1, 8=0, 9=0, 10=0,...

 
@Mat'sMug Yes. I voted in one of the preliminary elections but missed the actual elections.
 
12:53 AM
This morning one of my coworkers edited a question one minute after I had edited it.
So I left a comment telling him good morning...
 
lol
 
Then when he got into work, he was like "Did you say good morning to me on SO?"
 
1:05 AM
0
Q: javascript increment setInteval counter while video is playing

user3204760I have the following code that detect if user is idle or not. On page load, a timer will run and if the user is idle for a certain of seconds the timer will pause and resume if the user is active. And I have also codes that detect if video is playing, if the video is playing timer should run and ...

 
@rolfl "barley having pain", eh...
SELECT "MONKING!"
 
another answer... what's wrong with me?
 
@Mat'sMug desperate times, desperate measures. not many c# questions lately
 
gotta be it :)
 
1:32 AM
Apparently Microsoft also gonna give away free windows 10 for Win 10 preview users.
So if you don't have a 7 or 8 to upgrade for free, just apply for a preview user
 
0
Q: Creating a new array from two passed in arrays

cody.codesThis is a simple piece of code which takes two arrays supplied as parameters, then appends them to a new array that contains the values from the supplied arrays. Any suggestions for improvement would be greatly appreciated. public static int[] append(int[] list1, int[] list2) { int[] appe...

 
@CaptainObvious Not a whole lot to say...
 
0
Q: How to organize my classes creation

alexpfxI'm working in a game as a hobbie. I'm using an Entity/Component/System architecture using Libgdx as Engine and Ashley as Entity Framework. I have a GamePlayScreen in which I initialize my system, creating Entities, Systems and Components. Below is a tiny code snippet of class constructor with ...

 
@CaptainObvious "How to organize my title's creation"
 
2:05 AM
1
Q: Resx Editor in WPF

Hosch250To aid in the localization of .resx files, I made a generic resx comparer that allows you to edit the values of the resx's. Also, this is my first proper adventure in WPF (I've just been using Windows-runtime before). This is my view interface: public interface IResxTranslationHelperWindow { ...

 
@Phrancis well look at that, 3 answers on a "not much to say" question!
 
Colour me surprised
 
@Phrancis there's always something to say ;-) — Mat's Mug 5 mins ago
 
@mjolka Your answer, to me at least, just seems to obfuscate
 
@Phrancis fair enough
 
2:08 AM
yet it's probably the most efficient way to go about it
knowing the framework helps I guess
 
Like I said, "to me"
 
@Phrancis i was a bit surprised about the (lack of) options for copying arrays. in c# i'd write it like this
public static T[] Append<T>(T[] first, T[] second)
{
    var result = new T[first.Length + second.Length];
    Array.Copy(first, result, first.Length);
    Array.Copy(second, 0, result, first.Length, second.Length);
    return result;
}
or just return first.Concat(second).ToArray();
 
^^ with Concat you'd make the args IEnumerable<T> and have an all-powerful generic ......... redundant method.
 
i don't like the asymmetry with Arrays.copyOf and System.arraycopy
@Mat'sMug yeah i hit a speedbump trying to make the java version generic
my test cases were of type int[] and java did not like that
 
Yay, a downvote!
 
2:13 AM
@Mat'sMug that's ... weird
 
This line is so weird to me Array.Copy(second, 0, result, first.Length, second.Length);
 
@downvoter: fine, I'll stick to C# — Mat's Mug 5 secs ago
 
lol
 
(not my downvote, btw)
Oh well, water under the bridge
 
@Phrancis yeah, it's: copy second.Length elements starting at index 0 from second into result, starting at index first.Length
 
2:15 AM
Surely, there's a less cryptic way to write that!
 
@downvoter: fine, I'll stick to C# and IEnumerable<T>.Concat()Mat's Mug 3 mins ago
 
Array.Copy(sourceArray: second,
           sourceIndex: 0,
           destinationArray: result,
           destinationIndex: first.Length,
           length: second.Length);
 
Hm, can my MacBook handle IntelliJ and Spotify... let's find out!
 
i wouldn't be against an overload that defaults sourceIndex to 0 and length to the length of the array
 
@mjolka - consider System.arraycopy instead of Arrays.copyof....
public static final int[] merge(int[]...arrays) {
    int len = Stream.of(arrays).mapToInt(a -> a.length).sum();
    int[] ret = new int[len];
    int pos = 0;
    for(int[] a : arrays) {
        System.arraycopy(a, 0, ret, pos, a.length);
        pos += a.length;
    }
    return ret;
}
@Mat'sMug and @Phrancis - a naieve loop-copy in Java would be a poor solution. Arrays.copyOf or System.arraycopy is the only right way to do it ;-)
 
2:20 AM
@rolfl Stream.of(arrays).mapToInt(a -> a.length).sum() <3
 
Do all Java programmers write cryptic code like that?
2
 
@rolfl ah, your downvote then
Still if anything is wrong with this answer, I'd like to know. — Mat's Mug 1 min ago
 
@Mat'sMug Well, the downvote was really for suggesting the intermediate array.length variable too ;-)
And... I wanted mjolka's to perculate to the top..... :(
 
I think you meant "percolate"
 
fair enough
 
2:22 AM
@Phrancis probably
 
@Phrancis and now i want a coffee
 
me too
 
I guess I am grumpy...
 
@rolfl hey no problem
 
I don't want you to not answer Java things though
In this case, though, the right tool is the native System.arraycopy, and the extended Arrays.copyOf .... that's all. mjolka has the right answer
the other answers are... OK.
 
2:23 AM
my comment was more to say that when you know the framework, you write more efficient code (assuming the DV was for not suggesting what @mjolka's answer did)
I'd throw a fit if I saw C# code doing that sort of looping
 
@Phrancis Are you guys planning on localizing Cardshifter?
 
What does localizing mean?
 
@Hosch250 It's done already, right?>
 
So it displays in different languages.
 
(removed comments)
 
2:25 AM
@rolfl Don't know, I don't follow CS.
 
@rolfl say i were to make append generic, how would i go about calling it with two int[]s?
 
@Hosch250 We need users first
 
@mjolka Generics with arrays do not work too well.. especially with arrays of primitives.
 
@mjolka you'd write it in C# and do list1.Concat(list2)
 
Oh, Java doesn't use resx anyway, does it?
 
2:26 AM
It does use a resources type internationalization, and it has a system for message management
 
@Hosch250 did you read the contents of a .resx file?
 
Because I was just pimping my new tool.
 
@Hosch250 Not sure what resx is, but at the current time, all the UI text is in the Java & Groovy code files
 
lol
resource xml
 
@Mat'sMug What about reading resx files?
 
2:27 AM
Ah. Yeah, we're not worried about that right now
Need to make the game feel like a game first
 
Do you mean _data = XElement.Load(DataPath);?
That reads it.
 
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema

    Version 2.0

    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
 
Nah, I don't read that - that is auto-generated.
 
We're slowly getting there
 
but Microsoft ResX Schema would have answered your question ;-)
 
2:29 AM
Yeah.
 
@Phrancis indeed, getting there!
 
hahahaha @maaartinus:
1
A: Parsing huge data coming from a URL

maaartinusI started to write a comment, but it became too long. Questions 200 ms is pretty close to eternity, how long is your input? Can you measure how long parseResponse alone takes? Could you post your data? Someone may try harder to optimize. Potential slowness causes I guess your String.split c...

More than a comment's worth....
 
> 200 ms is pretty close to eternity
 
> 200 ms is pretty close to eternity, how long is your input?
lol
 
@Hosch250 Says only a programmer
 
2:36 AM
Any PHP folk here?
 
hides...
 
Huh, the answer is right..... ideone.com/NOk8cU
$userAnswers = $clone = array();
^^^ creates two different arrays
 
Surprised?
 
Yeah... I am.... but then I have no idea why I should expect PHP to do the normal thing either
 
$userAnswers <- $clone <- array();
(pseudo-code)
 
2:52 AM
Meh, not really in the right frame of mind to try understand PHP ;-)
TTGTS (S == sleep)
 
'night!
hey @maaartinus!
I don't really mean the "flame-war" BTW
 
Hi Mat's Mug! It was the above rolfl's comment what brought me here. :D
 
OK, this corresponds with Iterable<T>, except that arrays are special in Java. Unfortunately, Java came first. — maaartinus 3 mins ago
 
<?php
$a = $b = $c = $d = array();
$a[] = 'a';
$b[] = 'b';
$c[] = 'foo';
$d[] = null;
print_r($a);
print_r($b);
print_r($c);
print_r($d);
 
Sure, no flame-war. You're not this guy (chat.stackexchange.com/…). But his sentence "That's only Brainfuck, not anything truly obfuscated and unreadable like Java" made me ROFL.
 
2:57 AM
lol
37 mins ago, by Phrancis
Do all Java programmers write cryptic code like that?
 
Array
(
    [0] => a
)
Array
(
    [0] => b
)
Array
(
    [0] => foo
)
Array
(
    [0] =>
)
 
what's up with the 4th one?
dang, 11PM, I need to get rubberducking!
 
It's null
 
LOL. I guess since Java 8 they do. I'm not that far.... fortunately, I'm ignorant.
 
@Phrancis talk about explicit. I guess PHP is PG-13?
 
3:00 AM
That would make debugging fun eh?
 
wouldn't it. #FML
 
Well, null is literally nothing, so printing literally nothing is technically accurate
 
@rolfl "@Mat'sMug and @Phrancis - a naieve loop-copy in Java would be a poor solution. Arrays.copyOf or System.arraycopy is the only right way to do it ;-)" - AFAIK that's actually not true. The JIT transfers both using SSE instructions.
 
Dishes time (or rather, past dishes time). BBL.
 
in VBA Rubberducking, 52 secs ago, by Mat's Mug
allright, coffee, smoke n' duck.
 
3:03 AM
@Mat'sMug Don't stack duck & drive
 
0
Q: Minimising the Triangle version 2

spyr03I asked this question and I have made enough changes I think it deserves a new question. The Problem: A triangle needs a good foundation. Every row in the triangle is derived from the sum of the two values below it. However, there can be no repeated values, if a value shows up more than once...

 
I think it's borderline since there is a specific question implied in the question, but I won't argue. I've reposted at: codereview.stackexchange.com/questions/94408/… There were some minor edits to fit Code Review better, and also it doesn't have the pattern-matching tag since that tag doesn't exist over there and I don't have enough rep to create it. — GrandOpener 19 secs ago
At Shepmaster's behest, I've reposted this question on Code Review at codereview.stackexchange.com/questions/94408/… . Please repost your answer there so I can give you credit for it. — GrandOpener 23 secs ago
 
0
Q: Recursively pop the last node from a singly linked list

GrandOpenerI am exploring different ways of implementing a linked list in Rust as a learning project. In one particular place, I've got some code that works properly, but it makes multiple calls to unwrap--I am under the impression this is generally regarded as unsafe/poor style. I'd like to make it bette...

 
@CaptainObvious oh hai!
> is there a less crazy way to write the pattern matching version?
 
3:19 AM
If the code works and you are trying to improve it, perhaps this would be a candidate for Code Review. If it does not work, please provide more information (please reference this and this). — r2evans 30 secs ago
 
4:02 AM
0
Q: Implementation of KNN in R

user3224114I have implemented the K-Nearest Neighbor algorithm with Euclidean distance in R. It works fine but takes tremendously huge time than the library function (get.knn). Below is the code. Please point out the possibility of improvement. knn<-function(list,k){ n=nrow(list) if (n<=k) stop("k can ...

 
 
1 hour later…
5:23 AM
0
Q: Python for Maya: move selection based on input for X, Y, and Z axises

Asaph KimMy first use of Classes with python. Very simple code which i feel maybe further simplified. Please break my code or give me input on where my code could have been better/efficient. The Code: import maya.cmds as mc from functools import partial class MoveSelTool(object): '''Tool for moving sel...

 
5:51 AM
Monking @all
 
monking @Heslacher
 
hey @mjolka
 
how's it going?
 
Pretty fine. Lots of work but still time to answer some questions here. How are you ?
 
i'm good, just writing some documentation. nothing too exciting
 
5:58 AM
;-)
 
sandcastle is giving me 900 warnings for missing documentation...
 
Then you know what to do ;-)
 
6:44 AM
I am trying to understand this as they worded it out differently than usual. Do you think you can give me a hand with this Mat? @mjolka
The 24 bits from the registers PRESS_OUT_H, PRESS_OUT_L and PRESS_OUT_XL provides the
value of the pressure(in 2’s complement format). The 18 MSBs correspond directly to a value in Pa. In
other words the output value has an LSB of 1/64 Pa.
 
@Mehrad i'm guessing this is what they mean:
PRESS_OUT_H     PRESS_OUT_L       PRESS_OUT_XL
  xxxx xxxx       xxxx xxxx         xx xx xxxx
  |<- Pressure (PA) 2's complement ->| |<- ->|
                                       Fractional part
 
@mjolka That's what I was going with as well. however, I get an atmospheric pressure of 25000 PA which can't be right unless I am squished to an atom :D
Thank you though. I might be simply reading a wrong value from this bloody thing
 
what are the bytes that are giving you 25000PA?
 
6:59 AM
0x63, 0x5E, 0x08 in the MSB to LSB order
Oh no... I was actaully missing a zero
it comes quite right. we have 101752 which is very close to atmospheric pressure close to sea level
fantastic
 
:)
 
I am relieved and happy that I haven't exploded from lack of pressure or turned to diamonds
really appreciate the brain storm though. it's 5 oclock and I am pushing the last bits of frustration out of my brain :D
 
haha yep i hear ya
i've got the girlfriend asking about what we need from the shops, a co-worker asking about mobile phone plans, and i'm trying to get this documentation done before friday
 
Lucky you man. Documentation if fun (Mind the Super Sarcasm)
+ you can ask her to get you Vegemite kit kat. It's amazing (mind the same thing)
 
that sounds like the most australian thing ever
 
7:10 AM
If you eat one strip, Ozy Ozy Ozy will squirt out of your ears :D
 
Yay, , I wasn't expecting that one :o
 
@Morwenn congrats!
home time, bye all
 
Cheers man. Gonna get out of here.
 
@Morwenn congrats
 
Thanks all :)
 
8:04 AM
0
Q: need help to recive data from TCPserver

AntemortI have a already finished code in python but i want to make the same approch in Qt where I have my GUI. the code in python looks like below from socket import * HOST = '' PORT = 8001 ADDR = (HOST, PORT) serversock = socket(AF_INET, SOCK_STREAM) serversock.bind(ADDR) serversock.listen(2) whil...

 
8:21 AM
0
Q: C# always returns the wrong

CarbdroxHello I have a problem. My code always return -1 but it should return the variable gt. I get the right number ( 0, 1 or 2) but i have no idea how to get this number out of the function.please help me. public string gametype(string strS,int type) { string strSourc...

 
@CaptainObvious VTC for broken code
 
9:08 AM
1
Q: Consolidating a raw csv of two ids to grouped set of ids in json

Adam LavinThe file I'm processing here is an outputted file from a Java library called duke. Its goal was go through all purchases made on a site and group them into a single customer. The output is a csv file in the format, you'll find an example of it below the code. I want to know if I've written thi...

 
9:41 AM
0
Q: Jar console application

Recoba20I was assigned a task to make a simple jar that can handle 2 console commands -> create key value, read key. I have 4 classes, where my main logic is implemented. Eg. "create bulgaria sofia", creates a record in a serialized file with a key - bulgaria and value - sofia. Any feedback about the cod...

-1
Q: Password Checker

batmani'm rather new to python and i've been assigned the task of having a password checker, but i'm unsure how this shall work, I'd appreciate any help thankyou. I use python 3.4

 
10:01 AM
SO isn't your personnal code checker. If you don't have a specific problem, then you're not in the right place. I'd suggest you try here : codereview.stackexchange.comDepado 34 secs ago
 
@CaptainObvious User doesn't understand SE.
 
@Depado "But i get index out of range at temp = sub[g][h] in the function submat" sounds like quite the specific problem to me. This code doesn't work and would accordingly be off-topic on codereview — Vogel612 26 secs ago
@Depado This would be off topic on cr bescause it is not working correctly. We on Code Review are needing working code. Code which is throwing exceptions or doesn't produce the expected result is off topic. — Heslacher 52 secs ago
 
0
Q: Python Knapsack problem using branch and bound algorithm

LiliannaI wrote a code in Python to solve Knapsack problem using branch and bound. I tested it with the case from Rosetta and it outputs correctly. But this is my first time to write this kind of code, I am feeling unconfident. Could you please review my code and give me some tips to improve it? Thank y...

 
10:20 AM
I've retracted my close vote (working code, belongs on Code Review). The code was so slow, it was functionally not working, I thought. — Will Ness 18 secs ago
 
#define is_same(T, U) _Generic((T*)NULL, U*: true, default: false)
 
@maaartinus (C.C. @Mat's and @Phrancis ) - you inspired me to put it in a benchmark ;-) :
    public static int[] appendOP(int[] list1, int[] list2) {
        int[] appendedList = new int[list1.length + list2.length];
        for(int i = 0; i < list1.length; i++) {
            appendedList[i] = list1[i];
        }
        for(int i = 0; i < list2.length; i++) {
            appendedList[i + list1.length] = list2[i];
        }
        return appendedList;
    }

    public static int[] appendMjolka(int[] first, int[] second) {
        int[] result = Arrays.copyOf(first, first.length + second.length);
This gives the results:
Task ArrayCopies -> OP: (Unit: MICROSECONDS)
  Count    :    100000      Average  :   17.6260
  Fastest  :   11.8420      Slowest  : 1733.2660
  95Pctile :   24.4730      99Pctile :   31.9730
  TimeBlock : 20.208 16.674 16.638 19.070 18.062 16.559 16.597 16.938 18.501 17.017
  Histogram : 94012  5763   133    47     3    37     3     2

Task ArrayCopies -> MJolka: (Unit: MICROSECONDS)
  Count    :    100000      Average  :   13.6460
  Fastest  :    7.5000      Slowest  : 2057.3400
  95Pctile :   19.7370      99Pctile :   28.0260
Which bottom-line means that it takes loops about 17microseconds to copy over 20,000 int entries, and Arrays.copyOf / System.arraycopy about 13 microseconds to do the same.
Fully optimized, jitted, etc, it takes 11.5 and 7.5 respectively.
Personally, I am surprised the loops are as close as they are.... the optimizer does a better job than I expected
 
10:36 AM
0
Q: Armstrong numbers in C

CaridorcI have very little experience with C, so I decided to code a simple numerical program. An Armstrong number with N digits is a number that is equal to the sum of its digits to the N-th power, in pseudo-code: sum { power(digit, N) for digit in number } == number My programme finds all the Armst...

 
@rolfl Which is exactly why premature optimization is so evil.
Optimizers are freaking smart.
 
A 50% optimization is hardly premature
so, 50% slower is still really slow, but I was expecting it to be about 500% slower.
 
I wasn't talking about this particular case.
 
Oh, I thought the link you gave back to the example I gave meant that you were.... I missed that.
People who make sweeping statements are irritating.
(I was not talking about this particular case though ^^^^)
 
Well, it was kind of a sweeping statement with your example as partial proof.
Something like that anyway, perhaps I'm missing the point myself.
 
10:45 AM
and my example is 100% proof of the opposite.
 
As you said, the difference is way less than expected.
Which is what often happens.
 
The difference between 7.5us and 11.5us is much more than nothing though.
 
For all those cases in which people expect at least triple the performance after optimization, they're often wrong.
Yes, but still way less than expected.
If this operation would be used very often, the gain could be worth it. But if it isn't the bottleneck, you probably won't notice the difference.
Though you expected you would.
Which kind of was my point.
I'm not very good at making points ^^
 
8 hours ago, by maaartinus
@rolfl "@Mat'sMug and @Phrancis - a naieve loop-copy in Java would be a poor solution. Arrays.copyOf or System.arraycopy is the only right way to do it ;-)" - AFAIK that's actually not true. The JIT transfers both using SSE instructions.
That's the point.... ^^^
 
Any Pokémon lovers out there?
 
10:52 AM
@rolfl So we're arguing about something we agree upon?
 
@Mast I got triple the performance after switching from a 2d array to just using two 1d arrays and alternating between the two. I did it for memory reasons, and didn't expect it at all
 
@Morwenn Been a while.
 
Well, me too. I haven't played anything more recent than the GBA games.
 
I think Ruby was the last one I touched, my N900 runs it ^^
 
9 mins ago, by Mast
@rolfl So we're arguing about something we agree upon?
^^^ no, but that's because you don't appear to be seeing the point I am making.
 
11:05 AM
I think I do, but we're both making different points.
 
Yes, that's true... your point is that we should all be using chisels and stone tablets to communicate, because using the internet is a premature optimization.... because you can chisel a tablet faster than I expected.
3
 
@rolfl Monking and wtf?
 
@rolfl Not exactly, but close enough.
 
I'm with @skiwi on this one...
 
Well, the thing is, me too.... like: Java has a specific function created for copying array contents using native methods because the loop is documented as being slower: System.arraycopy(...), but, apparently I should not use it because it is a premature optimization. ... like, WTF?
 
11:19 AM
I love the smell of napalm in the morning.
 
Then, when I "prove" it is faster than the loop, I should still use the loop because it is not as slow as I thought it was going to be.
 
@rolfl I'm more interested of why you would want to do a manual loop-copy that could introduce mistakes rather than a proven library method?
 
@skiwi - I'm getting in trouble here.... Mat's and Phrancis answered this Java question, and I downvoted Mat's... ;-) codereview.stackexchange.com/questions/94398/…
 
0
Q: Inserting into a table a list of months between two different dates

Richard GlassI am trying to insert a list of the months between two dates into a table but I am not 100% sure where to go from here. Here is my code below DECLARE @MonthList as varchar(50) SEt @MonthList = (SELECT DATENAME(MONTH, DATEADD(MONTH, x.number, 12/02/1990)) FROM master.dbo.spt_values x W...

 
Then, oddly enough, maaartinus came to the defence of the loop ;-)
 
11:24 AM
(Props to @Phrancis for his answer, from now he should be called the documan!)
@rolfl I don't see where he's defending the loop?
 
8 hours ago, by maaartinus
@rolfl "@Mat'sMug and @Phrancis - a naieve loop-copy in Java would be a poor solution. Arrays.copyOf or System.arraycopy is the only right way to do it ;-)" - AFAIK that's actually not true. The JIT transfers both using SSE instructions.
 
So... what's the issue now? ;)
 
I did a performance check to see, and, even though the system.arraycopy is much faster (50% faster), it is not as much faster as I thought it would be.
In other words, the loop was faster than I expected.....
and, as a consequence, I got accused of premature optimization by @Mast.... who claims ... I don't know what, exactly/
51 mins ago, by rolfl
Personally, I am surprised the loops are as close as they are.... the optimizer does a better job than I expected
45 mins ago, by Mast
@rolfl Which is exactly why premature optimization is so evil.
 
Meh, I don't car about the premature optimization thing here, you should always write your code as fast as possible
If that happens to be a library method and that method happens to optimize prematurely, then so be it?
 
Well, the thing is, premature optimization is only premature optimization if you don;'t know it will be faster....
if you know it will be faster, it's not premature, is it?
 
11:29 AM
If you recommended System.arraycopy purely because if the alleged speed difference, then yes, that could be premature optimization
@rolfl I think premature optimization is defined along the lines of your solution being more complex with as trade-off better performance
 
45 mins ago, by Mast
I wasn't talking about this particular case.
A circle appeared!
 
Though it's also true that premature optimization often is unnecessary as the other version would have been optimized by the JIT/compiler anyway
 
What's the deal about premature optimization? Here arraycopy conveys the intent and happens to be faster. Using a loop is just a premature pessimization. There's no premature optimization in this case.
Correctness & intent first, speed later.
Here, System.arraycopy happens to be faster while as correct and conveys the intent. There's no reason to use anything else.
 
that ^^^
 
@Morwenn /s/l/m/
@Morwenn Exactly.
 
11:31 AM
@skiwi Thanks :p
 
So, really, @Mast is a troll who deliberately interjected an argument that was not relevant to the situation at hand. I should not feed the trolls.
 
Feed them cyanide (and happiness).
 
@rolfl Trolling is all about intent. It wasn't my intent to let this go so out of hand.
 
@Mast Oh, I was not talking about this particular case.
 
Seriously guys .________.
 
11:35 AM
hehehe
 
huehuehue?
 
bwahahahaha
 
@rolfl Are you drunk?
Monkeys are not allowed alcohol, you know?
 
No, I just don't like it when people say I am wrong.... and then make light of it.
Apparently I am grumpy.
 
11:37 AM
Yeah.... that's a funny one, but there's a better one.... with babooons.... let me find it.
 
@rolfl I never said you were wrong. Although now I've re-read the conversation I think I understand why it was construed as such.
@rolfl Shaking the monkey?
 
@Morwenn 144p, what is this, 2000?
2
@rolfl lol
 
When did we stop starring lol? :o
 
Oh, the misunderstandings...
 
1
Q: Histogram of a RGB image using opencv C++

ffttyyI write a C++ code using opencv libraries. The program reads the image and plot histograms of Red Green and Blue compenents. I am very new in opencv so I need comments and advices. What do you think about my code? Is there any better way to do that? Is there an unnecessary part in my code? Is the...

0
Q: Iterate through property of an objec

GibboKI need to round numeric values for properties of a given object. The following code works fine, but I am concerning if there is a way to make it faster. I am targeting latest Chrome and Firefox. http://jsbin.com/bahedegoni/edit?html,output window.app = { start: function () { ...

 
12:00 PM
[ckuhn203/Katas] ckuhn203 created repository
 
Woot! 3K!
 
congratz ;)
 
12:14 PM
@nhgrif wow
 
Those are both on Stack Overflow, for what it's worth.
I have just 3 things left on my check list for perfect score if I ever decided to run for moderator.
 
12:54 PM
Sigh. The difference between getting it and not getting it...
i wasted my time on these answers and they didn't solve my problem so im trying not to waste other peoples time with them. — user2993422 1 min ago
Thinking that telling me what definitely doesn't work would be a waste of my time? You might not be getting it.
 
0
Q: Haskell - Finding word acronyms for telephone numbers

Joboman555Having read most of Learn You a Haskell as well as parts of Real World Haskell, I decided to embark on an easy project to see if I can apply the Haskell that I've learned. {-# LANGUAGE OverloadedStrings #-} import Data.Maybe import Text.Regex.TDFA import qualified Data.ByteString.Char8 as B ma...

 
[janosgyerik/parse-ips]‌​ janosgyerik created repository
 
@Duga @Simon What is this new magic?
 
it's old magic, really.
 
0
Q: Substring searching and storing---using KMP algorithm to search and binary search tree to store

AlexMy program use KMP algorithm to search for particular substring in a .txtfile and then store it in a binary search tree. I try to keep my post smaller for review. So, I make a little amendment and only post the core of them program(But it is complete and it can be compiled and run.) (Note that ...

 
1:12 PM
@SimonAndréForsberg Yea, but usually there aren't this many notifications about it.
 
I wrote my first Haskell answer. It makes me feel smart.
0
A: Haskell - Finding word acronyms for telephone numbers

Ethan BierleinI have one tip, since I'm still learning Haskell myself. Rather than using piece-wise function definitions like the below. myFunc arg = ... myFunc 1 = ... ... I'd recommend using a case ... of statement. Do note, indentation is important here, and all valid cases below the case declaration mus...

 
@nhgrif Your crap detector works fine. Now your 'ignore questions' device needs some tuning.
@EthanBierlein You might want to explain that further.
With proper explanation, I think it can be a very valuable answer.
 
@Mast I guess this is a repository-creating day.
 
1:39 PM
Haha, I tried to derive a power algorithm by extending the Russin peasant multiplication algorithm. I succeeded, and it was exactly the exponentiation by squaring algorithm xD
 
Would this not be better suited to Code Review? — S O 43 secs ago
@SO I'd fare that this might get closed as example code on Codereview. In it's current form... probably not — Vogel612 6 secs ago
 
0
Q: iTunes Playlist copier

CatharsisWhen you own an android phone/device and want your iTunes playlist to be copied over onto it what do you do? What if your playlist hits something in the region of 20+ gig? Well I am sure I could of paid for a tool to solve this problem for me and keep things in sync but I wanted to challenge myse...

 
@skiwi "Documan" would be a change " SQL man" ;)
 
@CaptainObvious That's 3 feature requests and one point efficiency.
Grey.
 
I think it's an OK question... He did put in a header that those requests are "Wish List" so he is probably not expecting people will write the code for him, but perhaps can suggest something about it.
 
This question could be suitable for Code Review, as long as (a) your code works as intended, (b) your code is real code, rather than example code, and (c) your code is included in the body of the question. If you wish for a peer review to improve all aspects of your code, please post it on Code Review and delete your question here on Stack Overflow. — Phrancis 36 secs ago
 
0
Q: Passing functions using higher order components in React

BenAfter reading https://medium.com/@dan_abramov/mixins-are-dead-long-live-higher-order-components-94a0d2f9e750, I'm on board, however he doesn't show an example of passing methods from the parent class. In my mixins right now I have a lot of helper functions that are used across the various compone...

0
Q: PHP code for Connect with Facebook API. thoughts/comments

James KirkbyI was given a tech test for a prospective job a small game that uses facebook api to connect a user then to guess the image. The feedback from the employer was good but they said they had to modify part of my code to get the api connection working even though the demo app works fine. This has cau...

 
This question could be suitable for Code Review, as long as (a) your code works as intended, (b) your code is real code, rather than example code, and (c) your code is included in the body of the question. If you wish for a peer review to improve all aspects of your code, please post it on Code Review and delete your question here on Stack Overflow. — Phrancis 1 min ago
Try codereview.stackexchange for existing working code rather than a specific problem. — Benjamin Gruenbaum 58 secs ago
This code doesn't appear to work correctly and would be off-topic on Code Review. "it has a horrible problem in not exiting on an early error. It continues on to future statements which shouldn't be happening"Phrancis 1 min ago
 
2:38 PM
I agree with vfilby. If used properly they can be of great help. I use Advanced Javascript Outlining just for regions. Some code bases can get quite large and having to scroll up past a large code block (say a kendo datasource with schema parsing and modeling) 15 times is quite annoying. With proper peer code reviews your point of hiding bad code is invalid. I am tired of "My syntax rules are better than yours" attitudes. everyone has their own coding style and as long as people follow proper standards formatting shouldn't be an issue as long as it is readable. — John Tolar 13 secs ago
 
in VBA Rubberducking, 1 hour ago, by Stack Exchange
posted on June 22, 2015

Master Suku and her three apprentices had spent several sweltering days crossing a weedy marshland, seeking a temple somewhere near its center. The thickness of the air had long since stifled any desire for conversation. For many hours the only sounds were the buzzing of microdrones and the group’s own squelching footsteps. Finally they arrived at a rickety structure on stilts, housing only

 
0
Q: Is there a better way to write this jquery for opening & closing active items?

karen hunterHi I'm trying to have the 3 buttons to each open its own list below whilst closing any current active lists open. Ive tried my best with the jquery, but it seems so bloated. Is there a way to streamline this jquery code? At the moment i have a very rough working example:- http://jsfiddle.net/vak...

 
@CaptainObvious CBL
 
Cheese Burger with Lettuce? code behind link
2
 
@Mat'sMug I liked the first option
 
2:47 PM
'morning @Marc-Andre!
 
Not hacked here, a sysadmin was logged in with the wrong account - sorry!
 
bonne St-Jean!
@StackExchange you know, without that tweet, no one would have noticed
 
I've no idea what is supposed to happen during Saint-Jean.
 
StackStatus tweeted something funny about candy crush, apparently.... but it was removed.
 
@Morwenn fireworks
and a party
 
2:49 PM
Eh, I'm totally ignorant when it comes to anything religious ._____.
 
This question is amazing.
36
Q: Swift compiler segmentation fault when building

aleclarsonAdding a (convenient) computed height property to UIView in my UIViewExtension.swift file is causing the Swift compiler to segfault... What could possibly be going wrong here? 0 swift 0x00000001061e5608 llvm::sys::PrintStackTrace(__sFILE*) + 40 1 swift 0x0...

None of the answers make any sense, but they're all right...
 
@Mat'sMug Hey I thought that's supposed to be tomorrow ;p
 
@Morwenn in Quebec it's patriotic, nothing religious about it.
@Phrancis tomorrow's the day off to recover ;-)
 
@Mat'sMug Thanks ! Bonne St-Jean to you too!
 
St-Jean = Fireworks, and drinking lots of beer in the sun ;)
 
2:51 PM
@Mat'sMug I just read about it. And that it was a pagan thing even before all of that :)
 
There rain announce for the night in Quebec City, so I think there will be much partying here!
 
@nhgrif That's both great and awful.
 
@rolfl lol
 
@rolfl Ah, explains why I couldn't find what it was referring to.
 

« first day (780 days earlier)      last day (3239 days later) »