HNHacker News
TopNewBestAskShowJobs

dzorz

174 karma · joined August 24, 2007

submissionscomments
dzorz··on [dead]
I've heard from some pretty reliable sources that a small black hole WAS created, but gravity pulled it towards the Earth core. It simply got away and now they are trying to ignore the incident. Who knows how long it will take it to eat Earth inside out?
dzorz··on Move over T9, here comes Swype
Actually, I'm a foreigner and I find typing using T9 much faster, especially because there are not as many ambiguous words (when using numeric pad) as in English.
dzorz··on Shoestring Budget? Starting to feel growth issues on your back-end? Embrace unix and C
My 1990's Amiga 1200 had 14 MHz and 2-8 MB ram, so you're off by 20-30 years :-)
dzorz··on 3D browser Plugin - Blender web plugin. What value would such and app add to the internet?
Are you sure that Python is faster than JavaScript? I'm not saying it isn't, but in a light of recent optimized JavaScript engines who knows?
dzorz··on Scons - an autotools replacement and chrome's build tool
Is there a recent comparison of cmake, scons and (boost) jam? I personally use cmake and it does its job well, but it has some flaws that aren't being fixed for some time...
dzorz··on Ask YC: Intact Medieval Towns?
+1. This would be the best time to visit Dubrovnik because there won't be as many tourists as in summer.
dzorz··on Ruby on V8
The benchmark is really crappy. If the language uses O(n+m) concatenation for strings of length n and m, then the total runtime would be O(n^2). That would happen if strings are immutable and no "stringbuilder" is being used. If that special case was optimized or if the strings are mutable, total runtime is O(n).

Here is the corrected C version:

    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    int main (int argc, char const *argv[])
    {
      char *str = malloc(sizeof(char) * 238890);
      char buf[5];
      int i, n = 0, len;

      for (i = 0; i < 50000; ++i) {
        len = sprintf(buf, "%d", i);
        strcat(str + n, buf);
        n += len;
      }
      return 0;
    }
It runs 100 times faster than the original program.

Edit: If you think I "cheated" by doing some calculations that I shouldn't do, here is a C++ version that runs just as fast as the improved C version:

    #include <string>
    #include <cstdio>

    int main()
    {
        std::string str;
        char buf[6];

        for (int i = 0; i < 50000; ++i)
        {
            sprintf(buf, "%d", i);
            str += buf;
        }
    }
dzorz··on Test your Color IQ
OK, I'm not making this up. 7. On a Macbook Pro. Also having problems with greens. I think this is because our displays don't have true 24bit color; they use dithering.
dzorz··on Why Every Linux Application Known To Man Will Be SaaS Soon
Affero GPL to the rescue: http://www.affero.org/oagpl.html
dzorz··on How many of lines of code for infix-to-prefix?
It doesn't work correctly. Example:

    print parse_expr("1+2/3/4-5*6")
Result:

    (+ 1 (/ 2 (/ 3 (- 4 (* 5 6)))))
dzorz··on How many of lines of code for infix-to-prefix?
Solution in python that parses infix expression from string and returns a list of tokens in prefix form.

    def parse(s):
        for operator in ["+-", "*/"]:
            depth = 0
            for p in xrange(len(s) - 1, -1, -1):
                if s[p] == ')': depth += 1
                if s[p] == '(': depth -= 1
                if not depth and s[p] in operator:
                    return [s[p]] + parse(s[:p]) + parse(s[p+1:])
        s = s.strip()
        if s[0] == '(':
            return parse(s[1:-1])
        return [s]
    print parse("1+3* 4/haha-5*(2+3.14  ) * (4+5)")
Edit: grammer
dzorz··on On Day Care, Google Makes a Rare Fumble
Someone mentioned 2-7 kids per "overseer". Where I went to kindergarden, ratio was 20-30:1. Even later in elementary/high school, the ratio was 25-35 kids per teacher.
dzorz··on Tell YC: Answers from John McCarthy
Mac users who actually want to be able to read the text: press ctrl+alt+command+8.
dzorz··on Google Now Fills Out Forms & Crawls Results
What happens when google starts editing wiki pages and filing new bug reports/tickets?
dzorz··on Smjörið er brætt og hveitið smátt og smátt hrært út í það, þangað til það er gengið upp í smjörið.
Could you offer a better solution? What would your solution offer that octets do not? Random character access? No, because not a single unicode encoding offers easy random character access (because they are made of possibly several codepoints, which, in some encodings, are made of more than one basic "chars"). Gylph, word and sentence segmentation? I guess not.
dzorz··on Smjörið er brætt og hveitið smátt og smátt hrært út í það, þangað til það er gengið upp í smjörið.
И цан’т белиеве ит!
dzorz··on Take the Arc Challenge
Here is my contrived example:

How would you, in your favorite language, implement a program that displays GDP information for every country for years from 1970-2007 using a nice graph. Countries should be selectable using a fancy popup menu that displays country name and country shape...

Using Mathematica 6:

    MenuView[Row[{Rasterize[
       Show[CountryData[#, "Shape"], ImageSize -> {40, 40}], 
       Background -> None], #}] -> 
        Dynamic[DateListPlot[CountryData[#, {{"GDP"}, {1970, 2005}}]]] & /@
       CountryData[], ImageSize -> Automatic]
dzorz··on Ruby vs PHP performance
C++ version is a disaster. It is literally two orders of magnitude slower than it should be.
dzorz··on OLPC a huge hit in Peru
I really don't think that is the reason. Where I grew up 99% schools had two shifts, and sometimes even three shifts. Boys and girls were not separated, although my country is one of those where >80% peple are christian.

Our school day was up to six hours long (7 school hours (45 min each) + 5 min breaks in between). We received generally the same quality education as many other Central/Eastern European countries. Btw., the reason schools introduce extra shifts is to be able to accomodate more pupils in same classrooms.

Merry Christmas!

dzorz··on The Google Way: Give Engineers Room
In most of the cases I've heard of it's more like 20% out of 120%. Some managers like it to be very formal, so you have to dedicate a whole day in the week to your 20% work, which is (almost) impossible to do if you are working on a product that has to meet a deadline.
dzorz··on Omnisio - YC applicant - looking for feedback
You should take a look at http://videolectures.net which is a website dedicated to scientific content. More specifically, they go to different conferences (mostly machine learning related), bring their own camera crew, and later synchronize videos with ppt presentations. They don't have a business model because they are funded (and "owned") by some Slovenian government/university/research institution.

dzorz··on Ask YC: What was your first computer?
Me too :-)
dzorz··on Before you read the YC email or answer PG call, read this.
Little (useless) trivia: if we assume that a startup has 10% chance of succeeding (regardless of one's experience/whatever), then there is a 52% chance that your 7th (or maybe earlier) startup will succeed.
dzorz··on Ten things I love && hate about C
Because C is (mostly) portable, and assembler is not? Lately it became difficult to match C even using hand written assembly. Intel's C compiler will generate auto-vectorized auto-parallelized code (not as good as carefully written assembly, but much better than assembly a novice would write).
dzorz··on Ten things I love && hate about C
And if you don't need string constant, but just a string, then you can use the following (I'm not sure about portability though):

    #include <stdio.h>

    #define VERSION_INT 3209

    #if VERSION_INT < 100
    #error VERSION_INT less than 100
    #elif VERSION_INT < 1000
    #define VERSION_STR (char[]){VERSION_INT/100+'0','.',(VERSION_INT%100)/10+'0',(VERSION_INT%10)+'0',0
    #elif VERSION_INT < 10000
    #define VERSION_STR (char[]){VERSION_INT/1000+'0',(VERSION_INT%1000)/100+'0','.',(VERSION_INT%100)/1
    #endif

    int main(void)
    {
        printf("%d\n", VERSION_INT);
        printf("%s\n", VERSION_STR);
        return 0;
    }
Output:

    3209
    32.09

dzorz··on Ten things I love && hate about C
> And, closer to something I've needed more than once, how do you give your program an int and string version number with only one thing to modify?

This is not very elegant, and you have to split your version number to major and minor part, but it does the job. Oh, yes, minor version must be between 0 and 99 (inclusive).

    #define VERSION_MAJOR 2
    #define VERSION_MINOR 9

    #define VERSION_INT (VERSION_MAJOR * 100 + VERSION_MINOR)
    #define STRINGIFY2(x) #x
    #define STRINGIFY(x) STRINGIFY2(x)
    #if VERSION_MINOR<10
    #define VERSION_STR STRINGIFY(VERSION_MAJOR) ".0" STRINGIFY(VERSION_MINOR)
    #else
    #define VERSION_STR STRINGIFY(VERSION_MAJOR) "." STRINGIFY(VERSION_MINOR)
    #endif

dzorz··on 3998-byte executable reduced to 45 bytes
It still doesn't beat plain old com files in DOS/Windows. Take a look at site http://www.256b.com. There are a bunch of 256 bytes programs that do (visually) amazing stuff. My favourite is called lattice: http://www.256b.com/download/256

← PreviousPage 3 of 3