skysight-inc/HackerNews huggingface dataset:
As a video game programmer, I use the Singleton pattern quite often. For example, "TextureMgr", "MaterialMgr", "ModelMgr", "GrSubsys" (for Graphics Subsystem), etc..

The most beautiful Singleton code I've seen in C++ is:

class GrSubsys
{
public:
GrSubsys();
~GrSubsys();
};
extern GrSubsys* gGrSubsys;

... then the constructor and destructor are written such that you can startup/shutdown the singleton as follows:

//-------------------------------------------------------
void
App_Startup()
{
// initialize graphics subsystem.
new GrSubsys;
}

//-------------------------------------------------------
void
App_Shutdown()
{
// shutdown the graphics subsystem.
delete gGrSubsys;
}

//-------------------------------------------------------
int
main()
{
// startup the engine.
AppStartup();

// enter the per-frame application loop.
while ( AppFrame() )
{
}

// shutdown the engine.
AppShutdown();

return 0;
}

Shrug. A friend introduced it to me, and I liked it a lot. The same concept can be easily applied to C, too.
This has been posted before. It was interesting enough the first time, but the topic always seems to generate a high ratio of noise to signal.
For those of us that don't know anything about it, can someone explain the significance of this achievement?
Does time really slow down in danger?
How Apple devices saved me thousands on my new car
I'd like some slightly less anecdotal evidence before I conclude that all SSDs are doomed to an early death; we could be seeing some confirmation bias here. Maybe Jeff and his friends just had a run of bad luck.
Designing New and Different Technologies
Advantages of “server” CPUs over “consumer” CPUs
On top of that, in 10 years time you could have turned that $10K investment into $20K if you were able to average about 7% interest.

Could ;-) What "safeish" third party investment vehicle would average a yield of 7% per year after taxes over 10 years? (Putting aside the bubbly stock market of the 90s and the property market of the 00s.)

Writing a book full-time seems to follow the same pattern. I'm not seeing how the investment ever pays itself off.

In many cases, the exposure and experience pay their own dividends. More practically, though, it's not always possible or desirable for us to work every hour we can grab, so "cramming in a book" that we want to write on the side can get more out of our time that we might not otherwise profit from.
By the way the t-shirts are really cool and incredibly geeky. I have the whole set. I particularly love the "SSHerif" model, I have 3.
So using yacc and lex to do C compilation is a newish idea. Using yacc makes the hard part harder and the easy part easier (dgc).

What is missing from the discussion in a generally good article here is that it isn't so much a "hack to the lexer" but you put information in the symbol table (scope, type) and push out to yacc a symbol with token type attached (variable, typename, etc).

As another commenter here says, C compilers weren't originally done with yacc or other parser generator, they were recursive descent.
I think there needs to be some way to store scripts on the server. I like the CouchDB method of a storing a view as a special document. Could use a Hash to store the code along with metadata (version, last modified, etc).

That said, if Redis can EVAL a script stored as a String or a Hash->Key, the client can deal with registering and versioning scripts.

Awesome work btw - been looking forward to scripting in Redis for a long time
If you (where “you” can be an individual or a team) know how to count cards and are disciplined about following the technique, and you patronize a casino that doesn’t catch you, there is a slow leak of money from the casino’s pocket into yours. The whole business model of casinos depends on the slow leak going in the other direction.
Meanwhile, the event happened too late to feature on today's print media in the UK.

http://www.frontpagestoday.co.uk/2011/05/02/archive.cfm
how much unit testing do you do?
Cheap and easy Android to Propeller bridge
State Farm app uses iPhone sensors to grade your driving habits
Surprising, though, that they use "enhanced durability" to upsell the hard disk and not "increased performance".
Netcraft May 2011 Web Server Survey
http://marc.info/?l=openbsd-cvs&m=129543726419518&w=...
http://marc.info/?l=openbsd-cvs&m=129537785019792&w=...
s/CNN/BBC/ or whatever. I bet more people still have access to broadcast news than they do to Twitter.
AT&T's broadband data caps start today
I'm surprised there's little under 4000 users. Always thought it was much more.
Someone else pointed out that other flash devices just become unwritable when they "fail" due to writes, rather than suddenly becoming bricks. I'm skeptical that this is the same thing.
Have a look at the bottom of the article, antirez suggests that a EVALSHA command might be implemented that would allow specification of a script by a SHA1 hash.

Seems like a good idea to get the rest of it sorted before deciding on that bit though.
Twitter is the kind of company I wouldn't bet against... You have a lot of power when you get free advertisement 24x7.
I think CoffeeScript is easier for certain values of "easier". My position is that there are important senses in which easier can mean harder. You know, like how worse can be better.

I literally meant a lisp. I'm a big fan of mostly-functional programming, but a functional tendency is just one of the features that hang together—along with the absence of syntax and lexical scoping and macros and maybe something I've forgotten—that make lisp what it is.

My natural style is polemical. My thoughts tend to the nuanced. That's often a bad combination.
Osama shouldn't have used his real address in his PSN account.
From the article:

"The long term storage of significant amounts of antihydrogen should soon settle the question of whether antimatter falls up or down."

One reason they would like to know if antimatter is repelled by gravity is that it could explain why the Universe is expanding at an accelerating rate.[1]

[1]: http://www.physorg.com/news/2011-04-antimatter-gravity-unive...
Ask HN: Is there a socially responsible domain registrar?
Ever since godaddy decided to cast off their clients in droves by hunting and murdering elephants (to say nothing for their other exploitative advertising), I've decided to avoid them whenever possible.

I'm looking for a well designed, developer-friendly, slicehost-like, socially conscious service that would offer domain name registration.

Where to socially-aware people shop for domain names?

Edit: When I say "slicehost-like", I mean it in terms of their by-developers-for-developers culture, and not the specific services offered.
It is milliseconds according to the Racket documentation.

http://docs.racket-lang.org/reference/time.html?q=time#(def....)
I quite like that the Lua API is a single function, because it means it completely forward compatible already - the Lua API won't have to have new methods added to it when Redis gets new commands.
Poll: Have you had a SSD fail?
Related to Atwood's post about SSD failures (http://news.ycombinator.org/item?id=2505700), thought it would be interesting to gage HN users on their experiences. Please only participate if you actually have/had a SSD for at least 3 months. If 'Yes' leave a comment about drive details and time till failure.
The Top Five Online Games for 2011
Since the Internet is overwhelmingly approaching everybody now and broadband is spreading speedily as well, online games have become today’s charm now. Whether it be big multiplayer games or solo games, there is a lot to amuse you in the online world.
I agree with all of these points, and I completely agree that it's not unique to the software industry. Much to our surprise, we're human after all.
I get my domains from Dreamhost personally (and host with Mediatemple); they've both been exemplary.

(But then again, who isn't when you compare them to GoDaddy?)
"The ALPHA team now plans to cool a small lump of antihydrogen ..."

How do you cool something at this scale? And how about when it can't collide with any normal matter?
The first paragraphs at Wikipedia may help to understand the significance http://en.wikipedia.org/wiki/Antimatter
> Really I think uneducated people are social equivalent of infected PC's on a network; they make things bad for everyone. More education, not less is crucial if we are going to make any progress as a society.

But the question is, do we get an education from colleges that we wouldn't be able to get without them?
Created a poll: http://news.ycombinator.org/item?id=2506138

(probably still won't be very useful, but at least it will be another data point)
This comment is completely unhelpful.
What, Saudi Arabia?
These are known for being environmentally friendly, but also have some socially aware things listed on their site:

https://www.pairnic.com/index.html

http://www.canvasdreams.com/
Half of the world has SMS access and can therefore use Twitter.
This seems like a really good reason, especially with Redis's focus on code quality and developer fun. That scripting.c is only 382 lines long is very cool :)
Casinos tend keep a very tight lid on those numbers, but they do know basic economics, so you can safely assume that it's at least as much as they spend on measures like this.
Ooh, it's the strawman!

Oh... you meant in the OP?
Initial Adventure Game Studio Engine Source Code release
Jeff's anecdotal failure rates are scary, but don't line up with expectations - e.g. my Intel SSD has a 3yr manufacturer's warranty which would suggest failure rates more in line with these numbers.
I agree that Collateral Murder was definitely spun into propaganda, but I think it's important to mention that they also released the unedited version. The Collateral Murder edited version is a clear case of spin and an agenda, but it is mitigated by the fact that they also gave the complete version.

As for their strategy of slowly releasing the leaks, that's more gray to me. I can understand the rationale that it is so all of the leaks get the attention they deserve, but I also wonder how biased their decisions on what to release first are.

That said, I think they've done far more for revealing the truth than they have for spinning or concealing it.
I love how the prospect of a new text editor gets us excited. Can't wait to try this out later!
MIT Blackjack King Semyon Dukach Takes SMTP Public in Latest Exploits
Theoretically it should just be an unwritable drive since flash tends to only fail on erase. If the firmware is badly programmed or something other than the flash fails who knows what could happen though.
It should change, and surprisingly it's possible: http://news.ycombinator.com/item?id=2484677
I just want to say that this is a fantastic app and fits a longing I didn't even know I had. While a lot of comments below note nitpicks, I want to just commend the author for a fantastic product. I hope it advances and is for sale soon!
Would this work like a stored procedure in e.g. MySQL, though with the disadvantage that it will not actually be stored within Redis and the advantage that it uses a more powerful language, Lua?
Privacy Lost: The Amazing Benefits of the Completely Examined Life
First Steps Sorting out Python
Also, in case it was unclear to any still reading, Democracy is for suckers.
I am nothing short of _astounded_ that we don't know if anti-matter "falls up".
|In fact, as time goes on and the Homeland Security apparatus is not dismantled, this will factor in negatively for him.

Yeah right, the Patriot Act extension passed with little protest and republicans will never allow us to cut back on militarization. I would love what you're saying to be true, but people are just not that smart.
First-ever demo of a 3-D invisibility cloak for visible light
A better question might be, "Would this pattern impact our ability to write unit tests?" I believe the answer is "No."

Let's say the module Foo depends on the Graphics subsystem. That is, Foo.cpp has the code:

#include "GrSubsys.h"

//-------------------------------------------------------
Foo::Foo( const string& name )
{
// fetch a handle to our model (loading it if necessary).
_model = gGrSubsys->GetModel( "models/" + name );
}

//-------------------------------------------------------
bool
Foo::IsValid()
{
return ( _model != NULL );
}

In order to write a unit test that takes into account the aforementioned Singleton pattern, you might write:

//-------------------------------------------------------
void
Test_EngineComponents()
{
// prepare for science.
AppStartup();

//==========================
// Test #1 - Foo
//==========================
{
// load a Foo entity.
Foo* sunTzu = new Foo( "test/warlord" );

// verify the entity loaded successfully.
assert( sunTzu->IsValid() );

// shutdown.
delete sunTzu;
}

// conclude our science.
AppShutdown();
}

and AppStartup() is the function which initializes the subsystem singletons (and those will initialize their manager singletons).

It's about discipline. Any fool can butcher with any tool.
I3: an improved tiling window manager
Win $1500 for coding the most efficient matrix multiplication in .NET
Book: Lion's Commentary on the Sixth Ed Unix
How cell phones may damage tissue
The full Unix V source is here as tar:

http://unixarchive.tliquest.net/PDP-11/Distributions/researc...

In 500 K gzipped tar you have at least the whole unix, the whole stdlib and the whole C compiler. For the book that explains the sources see:

Book: Lion's Commentary on the Sixth Ed Unix

http://news.ycombinator.com/item?id=2506176
Did you mean to imply that another comment is completely unhelpful, or was it your intention to invoke the Epimenides paradox by writing a comment that claims itself to be unhelpful?

https://secure.wikimedia.org/wikipedia/en/wiki/Epimenides_pa...
Thanks for this.

It was a thought provoking blog. When I submitted to HN, I expected it would end up like most of my submissions and simply add a point of karma to someone who had already posted the same thing ages ago.

However, it appears that the blog author re-arranged how she recorded her blog entries, giving this one a different address.

Interesting that the conversation this time feels quite a bit different than the last time.
USC engineers build synthetic synapse with carbon nanotubes
It's been quite hard to find information about the re-analysis. It looks like there was a press-release in May last year where the pingers were identified after a re-analysis of the Emeraude towed-array sonar tapes:

http://www.businessweek.com/news/2010-05-06/air-france-crash...

http://www.nytimes.com/2010/05/07/world/europe/07crash.html?...

Sadly, there are no references to source material, and a quick search through the BEA at http://www.bea.aero/ (the French aviation accident investigation agency) didn't provide immediate satisfaction, alas.
I would have loved this the first/second year of my CS degree...

Nice work
The content sounds great, Batman is my favourite super-hero and 12 is my lucky number so I HAD to order the print version.
Not to mention no units on the timings, and no explanation as to why the heck you'd want to calculate 2^100000. (Or is that just a convenient way to construct a very long list?) Glad I wasn't the only one puzzled by it.

Edited to add: Ah, based on other comments, it's constructing a list of 2^100000 of the same symbol, and then later on, 2^100000 - 1 of that symbol and 1 of another symbol. Which I guess is interesting, but doesn't seem wildly impressive?
Four orders of magnitude implies the previous best was 0.1 seconds.
Herding Swarms of Microrobots
The menubar is at the top of the screen because it's easier to click them. Fitt's Law[1] says that the larger something is, the easier it is to target. When something is against the edge of the screen, you can't move the mouse past it, so it has infinite width or height (or both; corners are nifty). By placing the menu at the top of the screen, you go from a clickable area with a height of about 20px to a clickable area with infinite height.

1. http://en.wikipedia.org/wiki/Fitts_law
One of the points that the article is attempting to communicate is that different people need different approaches. You yourself said that most of the HN audience know not to take things personally, which implies you understand that this is not the case for other people. Cutting down on courteousness may be acceptable in HN, but it won't work for most other people.

Indeed, I completely agree with you.

And this is what the article attempted to explain - just because you know what you are talking about and other don't, it doesn't mean others will willingly buy into what you're saying. It doesn't mean you have "disarmed and conquered".

In rhetoric there are three fundamental persuasion vectors. Logos - reason and logic; Pathos - emotion and subconsciousness and Ethos - appearance, charisma and social background. Pathos and Ethos are the most powerful ones - and thus every advertisement and every (successful) piece of propaganda is short on logic and reason and extremely long on emotion and appeal to authority. That is why geeks are lousy marketers and communicators. Because they are trying to convince people that their offering is rational and logical decision - but people don't care much about what makes sense.

So to respond to you - what you're saying is less important than the conviction with which it is conveyed. When have you heard or seen Steve Jobs act vulnerable and self-deprecating? That would be the single biggest mistake he could do. People are social animals and we are good at spotting insecurities - thus one does not point out his weaknesses out of his own accord. Should others notice them - you confirm them (Yes its there...) but you never expand on that.

My suggestion of talking and doing only what you are confident about is actually a trick about how to make oneself appear a figure of wisdom and authority far beyond one's true abilities. A person with great Ethos know very well when to speak and when to shut ones trap.
You are actually benefiting a lot more than you realize. I assume that you are more an intellectual than a thug. If the laws didnt protect you physically you might be physically controlled by thugs. In addition you may be in the top % economically and invest in stocks. You are benefiting disproportionately from the SEC and strong legal system which has less economic benefit for working class folks.
The post is down, so I can’t comment on that, but getting rid of singletons was the single most effective thing I did to improve my software design. I also summed up my objections to the singleton pattern in a blog post:

http://zmotula.tumblr.com/post/1390385240

There’s also a blog post called Singletons Are Pathological Liars by Miško Hevery, which is very well thought-out and contains links to other related topic:

http://misko.hevery.com/2008/08/17/singletons-are-pathologic...

Hope that helps somebody, reading Hevery’s articles was a huge eye-opener for me.
Previously it was "38 antiatoms for just 172 milliseconds".
The major problem with the much cheaper taxing of capital gains remains the growing inequality: Of every you dollar you earn through your own labor, you get less (until you pass the max threshold). And this while your capacity of personal labor is clearly somehow limited. On the other hand, people earning one million dollars from capital gains are taxed equally with people who earn one billion.
Experience and Result
Trading Stocks the Week after 9/11
That's what I was thinking as well. The question is, can redis (or lua, I guess) eval a script stored as a string? I imagine you would issue a redis EVAL where the script would be the Lua "eval(mykey)", is that possible?

Basically, 1) does Lua have an "eval" statement and 2) can Redis' EVAL read keys (I assume it can, since that's pretty much what the post says)?
Live long. Stay healthy. Join the immortals
No: I've had my Intel X-25M for over 2 years and its holding up great.
California Prison Academy: Better than a Harvard Degree
Big newspapers keep obits pre-written for people they know they're going to have to write an obit for. It's not difficult, since when someone famous dies you can write about their accomplishments, legacy, and whatnot while they're still alive, and keep a blank spot in the lede about how they died. And it's nice, because you can write a much better article when you have a lot of time.

But it can lead to some interesting firedrills when someone dies unexpectedly:

http://voices.washingtonpost.com/postmortem/2009/06/michael_...

And sometimes the obituaries are pre-written many years in advance. Which leads to incidents like NYT's obit for Elizabeth Taylor, whose author died several years ago:

http://www.nytimes.com/2011/03/24/movies/elizabeth-taylor-ob...
There's an essay called "College Uneducation" by Jorge Bocobo, which tackles about current social problems involving learning. He specified each problems and called it Book-worship, Misguided Zeal, Professional Philistinism, etc. If you want to learn more about the current social problems of learning, try reading his views.
Unless I have missed something about unit testing somewhere I am pretty sure that fails the "unit" part of unit testing. Unless that "#include GrSubsys.h" is actually importing a mock graphics subsystem.
I dropped a few courses (I'm a guy) in my GCSE's and later an A-level once I came to the realization that there was no value in taking more than the necessary number of courses. Why get 7 A's and B's plus 3 C's and D's when you can simply get 7 A's and B's? More free time, fewer exams, less homework, no downsides...pure win all around.
Sorry to go down that road, but the reason people rag on PHP's associative arrays, is that its the only array that PHP has.

A hashmap with mixed keys is hardly the most practical choice for an all purpose primitive data structure.

Python already has proper arrays where you might have some chance of fast sequential access. The ordered dict or whatever is just another tool in the box.

Basically, PHP makes you do shit like this: http://www.php.net/manual/en/function.is-array.php#102652
Unified APIs or API Standards, The Race is On
The general assumption with SSD is you have both a SSD and a traditional HDD. As long as you only have program and temp files on a SSD it's loss can have fairly minimal impact. Especially, if you schedule a full disk backup of your SSD weekly. Worst, case you lose a few OS/browser patches ship back the SSD for a replacement drive and move on.

PS: If you want to get fancy you can set up a bootable partition on your HDD and then backup the SSD to that partition.
A blog life (infographic) MUST SEE
>>"The long term storage of significant amounts of antihydrogen should soon settle the question of whether antimatter falls up or down."

Would this mean that if I am "holding onto" a chunk of antimatter heaver than myself I will fall up into space?
For what it's worth, last night -- before and after the presidential address -- on the bottom of a bunch of TV channels (ESPN for one) the reports were that the operation was carried out last week, not yesterday afternoon. You may have been wrong, but you certainly aren't crazy. :)
I'm probably going to be downvoted for this but... Increasing the speed at which our news is delivered is not even necessarily a good thing. Please wake me when someone invents something that makes it more accurate and unbiased.
Resistance from embedded programmers, I gather. Don't forget that C crosses a huge number of platforms.

That said, BSD sys/tree.h (self-balancing trees) and sys/queue.h (linked lists of all kinds) give you a lot of functionality and can easily be made part of your project (be warned, though: glibc has a very incomplete implementation, so make sure to use the BSD version.)
How clever. The intent was more than apparent.
Yes, due to firmware bugs.
Buy viagra only on a valid prescription for male impotence treatment