HNHacker News
TopNewBestAskShowJobs

agazso

418 karma · joined June 11, 2009

submissionscomments
agazso··on Blocking I/O: it's not just for pansies
If you start a thread for each request in Java, you can easily run out of memory when serving large number of connections. This is because Java uses kernel threads, and the stack of threads are allocated from heap when created, usually around the size of 1MB.

This means that you will need around 10GB of memory when serving 10000 request, while an event based app can serve the same amount of requests with minimal memory.

You also have to take into account that thread creation and context switching is really an expensive operation (contrary what the OP is saying), so the thread-per-request app is adequate only for serving small number of requests but for large numbers you will need to use the event-based approach.

You might get along with a threadpool based approach, but take into account that if your protocol is not stateless, then you will need shared state which means you have to use concurrent data structures, which might complicate code.

agazso··on Official reasons why Adobe doesn't open-source Flash
Here is a thread from the Red5 mailinglist: http://osflash.org/pipermail/red5_osflash.org/2009-August/03...

The main issue is that the spec says (5.4, page 10) that in C2 and S2 messages you send random bytes. If you do that only VP6 streaming will work but H.264 won't. You have to do a HMAC like digest on the "random bytes" and send it back so that H.264 works.

Of course all of this was reverse-engineered before the spec was released, but later with the release of Player version 10.0.32.18 it stopped working. So it had to be reverse-engineered again.

About that time I stopped working on a Flash Media Server (fortunately), so I just heard from my ex-colleagues that Adobe changed the handshake again with a new Player version.

EDIT: changed the link to a better one.

agazso··on Official reasons why Adobe doesn't open-source Flash
While it's true that since then Adobe published the RTMP specification, but they left out the description of the handshake procedure, without it cannot be called full and open.

What's more they are constantly changing the handshake procedure in every point release. I wouldn't call that open either.

agazso··on HTML5 Canvas based fast painting app
Both mugtug and your project are awesome, grats!
agazso··on Faster PHP fo shizzle
I was afraid that the usefulness of HipHop would be as limited as is regarding that it's not an easy feat to create a PHP-to-C++ compiler that handles C library dependencies (which PHP has a lot!) well.

BTW It was the second time in a week that there was a product that created incredible buzz in HN community without anyone able to trying out the product (the other was iPad of course) and I was amazed at the amount of well-informed opinion based on such little information.

PS. This blog is a good reading if you are interested in Facebook architecture, scaling and design issues in general.

agazso··on Facebook makes HipHop for PHP open source
Where is the link to download it or just the documentation? On the announcement page there is only a Wiki link (besides wikipedia entries and other php-to-other-lang compilers) to a Github page that redirects to the github.com.
agazso··on Why Vector Clocks are Easy
Suppose you have a cluster of database servers in different datacenters, and somehow the connection between the datacenters go down. If you want to ensure high availability and allow your users to reach and modify the data while there is no connection, then you have to mark each modifications somehow so that later when the connection is up and the servers synchronize they are automatically able to merge most of the changes and find out conflicting cases.

That problem is solved by vector clocks and the most prominent application of them is Amazon's Dynamo system. See also eventual consistency for more information.

agazso··on Make Lisp 15x faster than Python or 4x faster than Java
I like the Lisp approach to optimize the program by adding hints to the runtime about types and the ability to tune the optimizer's aggressiveness from the code. It really makes possible to write the correct algorithms first, then later add appropriate optimizations simply by changing the optimized and unoptimized functions.

That said I think these kinds of benchmarks (and article titles) are misleading, because one who has deep knowledge in one language does not necessarily write good code in other languages. Even the article notes that "they are all just literal line-by-line translations of each other".

agazso··on Conway's Game Of Life in one line of APL
It reminded me the old saying that "every C program can be written in one line". Think about it, it's true.

For me it was similar to obfuscated C code, when one line of code packed with funny symbolic names produces a program that shows a bouncing ball or something unexpected like that.

agazso··on Ask HN: Have you given up your dream for your dream job?
If it is your dream job why don't you accept the offer? If you don't like it, you can still start your own business after a year or later (I don't know how old you are).

If you like it, you can also start you own business, maybe a bit later, but with enough experience and an established partnership behind your back, if the two is not competing with each other.

agazso··on Sideroller demo. Have fun.
The cursor works too, but you can't reach Space easily that way. Probably it advises to use A and D for control so that you can use your left hand for keyboard and right hand for mouse.

On a second thought Up should work as space, and cursor keys would be fully usable.

agazso··on Walter Bright on C's Biggest Mistake
Macros can easily be abused, but the point of the preprocessor today is platform-dependent code generation. In higher level languages you can select with an if which branch gets executed, but at the end the platform-dependent code of that language runtime is written in C with ugly ifdef's.
agazso··on Walter Bright on C's Biggest Mistake
A better simple rule: always use sizeof on typename. That always works therefore you can use typedef arrays too.
agazso··on Walter Bright on C's Biggest Mistake
Here is an example that caused me a few bugs.

  // define a new type called md5_t
  typedef char md5_t[33];
  md5_t g_md5;
  // here sizeof(g_md5) == sizeof(md5_t)
  
  void f(md5_t md5)
  {
    // here sizeof(md5) == sizeof(char*)
  }
The type information definitely lost inside functions.
agazso··on Making Prodigy's "Smack My Bitch Up" in Ableton by Jim Pavloff
Thanks, now that you are saying I remember what a CD looked like :) Seriously, it was so long I had a CD in my hand I didnt't think about that.
agazso··on Making Prodigy's "Smack My Bitch Up" in Ableton by Jim Pavloff
I am curious how he found the original songs whose samples are mixed into the song. I guess in an interview the authors told about it, but hard to believe that he recognized those pieces by ear.
agazso··on The world’s hardest (for native English speakers) languages
I am hungarian and I met several people in Hungary coming from all over the world, who somehow fell in love with the country or the language and did learn the language quite well.

So it can definitely be done (as with any other language), although you need strong motivation and a bit love of the language. But I think there are not many people in the world who has the motivation for learning an obscure language that is only spoken in one Eastern European country.

agazso··on [dead]
I also didn't quite get the point of the article, but I clicked on it because I expected to learn some insight about something related to the number of minutes in a day.

Like, what I learned in engineering, that there are 86,400 seconds a day and you can use 100,000 instead for estimation. E.g. when you have around 10 requests per second in a web service, each taking 1KB, then the traffic the web service generates a day is 1GB (== 10 * 100,000 * 1,000).

agazso··on Nobody told me it’s impossible, so I did it
If I recall correctly, RENUMBER only renumbered lines, but not the GOTO and GOSUB labels, so it was pretty useless after all :)

The best thing you could do was to stick to the practice of labeling by multiples of ten, and if you needed to hack something, you could still do it in one or two lines.

But basically programming in BASIC was hacking :)

agazso··on Pivot (from Microsoft)
I even had Silverlight installed (version 2.0), but I needed to upgrade to 3.0, by downloading Silverlight.exe, going through a traditional installer, restarting the browser only to find out that it's only a boring marketing video with talking heads.

I expected that I could at least try out some demo online.

agazso··on Microsoft Still Chasing the Competition With IE9
It is wishful thinking regarding that Microsoft has currently four (IE 6, 7, 8 and the compatibility mode) slightly different implementations, and this number will only increase with their development.

The real problem is that web standards of the past (made by W3C) were overly complicated and not practical, so the browser developers had to make engineering trade-offs to implement a subset of them. So in practical sense there is no such thing as standard compliance, and this is not something Microsoft can go with.

agazso··on DadHacker on why C is staying
The C runtime (and language and compiler) was a very accurate abstraction of the underlying hardware, and later the hardware makers made their hardware to be compatible with the ecosystem.

That is why low-level parts of systems continue to be written in C. Only recently, with the advent of multi-core processors, we started discovering the deficiencies of the almost 40 year old language. The biggest is the missing memory model issue, which makes it impossible to write correct and portable multi-threaded code, which is inevitable at system level.

agazso··on O'Reilly: "We're heading into a war for control of the web."
Xmpp is federated like email: you have a unique identifier like your email address, belonging to the same domain as your xmpp provider. It is callled JabberID or jid and it (almost) looks like an email address and in case of gtalk, it is your gmail address.

So the answer is yes, xmpp (or wave as an extension of it) technically can be used for IM federation, because that's one of the goal of it. But I think the big social networks like to keep their users inside their walled gardens, and rather not let them communicate with users of other networks. Let's hope this will change.

agazso··on Don Dodge: fired from Microsoft, hired by Google
I think it is a feature of the upcoming 4.0 version.

See this site: http://www.chromeextensions.org/appearance-functioning/adblo...

agazso··on Ask HN: Scriptable command line browser?
If all you want is server side automation, then you can try Xvfb, which is a virtual X server capable of running X applications.

On a related subject I used Watin (.net) for browser automation and learned, that it was modeled after Watir, which is the same in ruby. See http://watir.com.

agazso··on Hello World in Go -- A Memcached Server
Exactly my thoughts too. That would be an ideal server side programming tool. E.g. imagine a webserver written in Go with long polls, and the applications on it in GoScript. Or an XMPP (Wave) server. Or a distributed Map/Reduce engine.
agazso··on Are Google employees being discouraged from using Python for new projects?
You answered your own question. On Google's scale the cost of maintaining the extra machines justifies writing the application in an effective language.

E.g. when you have an app written in C and it's 10x more effective than a Python implementation (which is quite realistic assumption) then you will need only 100 servers instead of 1000.

agazso··on What every developer should know about time
And retire before 2038 if you still define time_t as a 32 bit signed integer.
agazso··on Dustin Curtis's new web app
Love the glowing aura around text boxes. Beautiful design.
agazso··on Kernel Summit 2009: How Google uses Linux
While the kernel certainly able to handle hundreds of thousands of threads, the main limit is memory, because by default (in libc) there is around 2M of memory allocated to the stack of each thread.

With the pthread library you can create threads with a stack size smaller than this, but this limits some aspects (think of recursion, local objects etc.) of your program.

My experiences show that it is possible to be happy with 64K stack size in an event driven program if you are careful, so you can run ~500,000 threads on 64G memory if you want to. Nevertheless you'd better design your program more clever and use only a handful of threads and put them in blocking state only when you must :)

← PreviousPage 4 of 6Next →