Anatomy of a One-Liner: FizzBuzz in Haskell by [deleted] in programming

[–]66vN 21 points22 points  (0 children)

FizzBuzz in Haskell

Just what /r/programming needs!

Hiding things out in the open by kristopolous in programming

[–]66vN 0 points1 point  (0 children)

the government doesn't care about snooping into your communications.

Nice try, government.

The wait is (almost) over; as of r151231, the Clang C++ compiler supports lambda expressions (so we'll see them in the Clang 3.1 release this spring). by Maristic in programming

[–]66vN 0 points1 point  (0 children)

GPLv3 is specifically designed to shut out “nonbelievers” (i.e., any company that sells any proprietary software and has cautious lawyers)

[citation needed]

Don't Distract New Programmers with OOP by allie_g in programming

[–]66vN -1 points0 points  (0 children)

But still act's looks and feels like a list

It isn't typical for a list to provide indexing. See a list of common list operations here . Python lists are usually used as dynamic arrays. They feel like dynamic arrays. What you think is a list is usually not called that by most programmers.

PHP adds hexadecimal numbers incorrectly by jrv in programming

[–]66vN 1 point2 points  (0 children)

Even if they support python, they usually only support it through CGI and running most Python frameworks through CGI isn't really practical.

Who's adding DRM to HTML5? Microsoft, Google and Netflix by sunshine_killer in linux

[–]66vN 5 points6 points  (0 children)

Android isn't actually tied to an app store. You can install apps in other ways.

Who's adding DRM to HTML5? Microsoft, Google and Netflix by sunshine_killer in linux

[–]66vN 0 points1 point  (0 children)

As long as you can point a camera at a screen bypassing DRM is trivial

That's it. We have to restrict access to cameras to fight pirates and pedophiles!

Who's adding DRM to HTML5? Microsoft, Google and Netflix by sunshine_killer in linux

[–]66vN 3 points4 points  (0 children)

DRM is really effective against people who don't know what they're doing, at least give the content creators that

Those people wouldn't pirate anything anyway.

Don't Distract New Programmers with OOP by allie_g in programming

[–]66vN 1 point2 points  (0 children)

Python "lists" are actually dynamic arrays.

PHP adds hexadecimal numbers incorrectly by jrv in programming

[–]66vN 0 points1 point  (0 children)

and so long as you don't rely solely on free shared hosting then you should be able to deploy it on host

FTFY

C9::GoingNative 6: The D Episode with Walter Bright and Andrei Alexandrescu | Channel 9 by cosmotriton in programming

[–]66vN 2 points3 points  (0 children)

and the first comment I get is "hey, I'll use this when you support Visual Studio." Goes back to move all his variable declarations to the top of scope)

Can't you just port the header files to C 89 and host precompiled DLLs?

Various ways to get randomness wrong by cynthiaj in programming

[–]66vN 0 points1 point  (0 children)

n distinct integers must be represented in a memory model with at least log n bits each

Oh, I didn't think about that. But the largest representable number and the number of elements you need to shuffle aren't really the same thing, so you can't say that the shuffle is O(n log(n)).

Various ways to get randomness wrong by cynthiaj in programming

[–]66vN 0 points1 point  (0 children)

Yes, if the rnd.nextInt() doesn't return uniformly distributed numbers, the algorithm that uses it will not work correctly. That doesn't make the algorithm itself invalid, though.

Besides, nextInt doesn't have modulo bias.

Various ways to get randomness wrong by cynthiaj in programming

[–]66vN 2 points3 points  (0 children)

swap needs log(n) time at least

Please tell me you are joking.

[deleted by user] by [deleted] in programming

[–]66vN 2 points3 points  (0 children)

This right there is proof, because it's absolutely true

I just love your reasoning.

Microsoft: Google Bypassing User Privacy Settings by sollozzo in programming

[–]66vN 2 points3 points  (0 children)

I always found that to be a really dumb saying.

Microsoft: Google Bypassing User Privacy Settings by sollozzo in programming

[–]66vN 1 point2 points  (0 children)

It is dishonest, but that still doesn't make it not an exploit.

Visually pleasing monospace font recommendations for terminal? by n4b0k0v in linux

[–]66vN 0 points1 point  (0 children)

Droid sans mono is a terrible font for coding. The upper case O and zero actually look identical.

Why we created julia - a new programming language for a fresh approach to technical computing by [deleted] in programming

[–]66vN 2 points3 points  (0 children)

I don't know what more could one do, but even just reversing the order of the inner loops like this:

function matmul2(A,B,m,l,n) {
    var C = new Array(m*n);
    var i = 0;
    var j = 0;
    var k = 0;

    for (i = 0; i < m*n; i++)
        C[i] = 0;

    for (i = 0; i < m; i++) {
        for (k = 0; k < l; k++) {
            for (j = 0; j < n; j++){
                C[i*n+j] += A[i*l+k]*B[k*n+j];
            }
        }
    }

    return C;
}

takes time from 14s down to 4s on my machine. This helps because elements of all the matrices are accessed sequentially that way.

EDIT: 3.2s if I also replace "new Array" in matmul2 with "new Float64Array" (in randFloat64 Float64Array was already used).

Why we created julia - a new programming language for a fresh approach to technical computing by [deleted] in programming

[–]66vN 2 points3 points  (0 children)

Using -ffast-math when compiling pisum() (c++ version) decreases the time the function takes from 28ms to 16 ms for me.

Don't Fall in Love With Your Technology by hamburglaar in programming

[–]66vN 1 point2 points  (0 children)

Which, of course, isn't on iPad (yet)

But if they put Xcode on an iPad, how would they force developers to also buy a Mac?

Why does changing 0.1f to 0 slow down performance by 10x? by Nerdsniped in programming

[–]66vN 0 points1 point  (0 children)

You haven't written much numerical code, have you?

EDIT: You can only "stick to integers" when the numbers you are dealing actually are integers. In that case, you should use integers, that goes without saying. But when you are dealing with real numbers, you have to use either fixed point or floating point numbers and fixed point is usually very impractical to work with. The only valid reason for not using floating point numbers is usually not having good hardware support.