skysight-inc/HackerNews huggingface dataset:
I suspect your parent poster is being facetious (if we fix k, then just keep a buffer of the k largest elements we've seen so far. For any new element we see, check if it's larger than the smallest element in the buffer and if so remove the smallest and insert the new one. This takes O(k) time, so the algorithm overall takes O(kn), which, since k is constant, is O(n)).

In fact, this can be done in O(n) time even if k isn't constant: use the selection algorithm to find the k'th largest element (in O(n) time) and then go through the list again and output every number that's k or larger.
In other words, you're OK with the state forbidding forms of political speech it finds undesirable. Nice. Banning "freedom to say certain stuff about the religion Islam" is censorship, pure and simple.

Read "Brave New World" and see if any of the things depicted there ring a bell.
I just love learning about new data structures, and interesting ways to use them.
Other users should simply stop answering to the bad guys.
It works like hellbanning but it's more acceptable.
I have seen this working in some of my forums.
Trouble is "legitimate" users have a bad habit of keeping the conversation alive, so they are responsible too.
Ignore the bad guys and they leave, answer to them and accept the consequences.
Acer Mini Liquid incoming New Colors and upgrade to Android 2.3
Acer has announced the relaunch of its Mini Liquid Android line, introducing four new colors - cherry, lagoon, pearl and steel - and upgrade to Android 2.3.
Here's the problem, as I see it: who is your manager? Because a manager is normally paid a lot of money to help you be productive. It's a hard job, the kind people get degrees in and work for decades at before they can do it well.

If you're trying to work for yourself, then your manager is you. You're giving yourself a very difficult job, a job that you're trying to do at the same time as your creative work (and, if I'm not wrong, all of that while still working 9-5, so 3 jobs total). You may not even realise it, but you are a manager at the moment. Not knowing that doesn't stop you from being a manager, it just makes you a bad manager. An absentee boss.

Here is some evidence from your own words that tells me you're crying out for good management:

"As soon as I understand the basics of X, I lose interest. After I had managed to open a very simple lock, I stopped practicing." <-- This is classic lack of perspective - a manager needs to keep focus on the big picture, to give direction and focus to the work being done. Without that, you end up just doing whatever's in front of you, whether or not it's useful.

"Actually, (graded) university projects are the only projects I've finished in my life. Why do I need grades to motivate me?" <-- Because grades can be very motivating. A good manager understands that people aren't robots. You need to have your work structured in a way that makes you want to do it. At university you get tasks divided into small packages, each properly structured with a clearly defined goal and scope, steps to achieve the goal, and a metric for measuring your success at the end. Can you say the same for the work you set yourself?

"It's typical for me to open 40-something tabs of news stories, just to skim through them, without reading a single one in detail" <-- Have you considered that you do this because you're interacting with a very simple manager-bot? "Hey, HN", you say, "give me something to do". Well, HN will give you stuff to do, with a (small) reward for a clearly defined action.

Here's my suggestion for you: Be a manager. Set aside an amount of time each day to work as your manager. Ask yourself about your goals, figure out what you need to excel at those goals, and make sure that you get what you need. Is your work structured the right way? Is what you're doing now working? If you can't figure out what to do next as a manager, go learn. Read a book or online article about management to get ideas. But, mostly, just make sure you actually do it.

Your trade, if you want to be a self-motivated creator of worthwhile things, is both creation and management. You have tools and skills and time invested in the former. Invest in the latter too.
It is bittersweet, it's a big win and lose for Canadian tech, but imo a net win. Canadian investors and other Canadian tech companies should see this as a sign that Canada is serious about building great world class technology. Without exits like this, outsiders will continue to assume that "there is no tech scene in Canada", which is untrue.

If this buyout motivates more local engineers to start companies, I think it is a good thing.
Yeah, they had to steal it, and I t was easy - but that was considerably outweighed by the mental consequences of having no social interactions for a year.
high level: you keep track of the K largest elements (call this array A). Every time you read an element (call it x), you compare it to the smallest element in A. if x is bigger than the smallest element of A, then remove the smallest element from A and add x to the list (and sort).

There are N elements in the sequence, and you can arrange for the sorting to be a single-step bubble sort, so that the total cost is O(K) operations per element --> O(NK) overall. Noting that K is constant, it's O(N).

Note that this really assumes K is constant. If K is depends on N, then the array A will expand
Best of the week - 5 giugno 2011
Another week is passed so it's time to propose my listing of the best security resources of the week.

Hope you enjoy it.

@tofinosecurity "Son of #Stuxnet" - Coming Soon to a #SCADA or PLC System Near You? - http://bit.ly/jFzbI3
Thanks for the reference. That is, indeed, the story!
Create an Easy Bloody Wallpaper in Photoshop
Plenty of people get treated decently, it's not like everyone in Homeland Security are evil jack-booted thugs. I suppose most of them are pretty good people doing their jobs with the rules they have to enforce.

However... the system does not work nearly as well as it should, and is based on creaky, broken rules.
> you give up your ability to fit in with your own people

This is both true and not true. I have spent something like a quarter of my total life (in 2-3 month chunks mostly) living in Mexico, and while I don’t feel like the “average” American, exactly, I always feel like I can really relax once I’m back in the US. Even though I feel mostly at home in Mexico, I always need to keep a bit on guard, gestures and inflections (not to mention cultural references) pass over my head, I have to stop and think about what I’m doing. In the US (and especially in Southern CA), I am just fluent in day-to-day life.

Anyway, it sounds like you have some personal experience with feeling separated from your home country/culture. Care to share?
Flights to Lagos from Heathrow
Cheap flights to Lagos from Heathrow: get low cost cheapest flights from LHR to LOS via all points. Here last minute cheap airline ticket deals to Lagos flights are available with all points. We have Heathrow to Lagos direct and return special flights deals search online flights by dearflight.co.uk also Compare LOS flights from LHR by call us now 0203 189 0988.
Look it up; I'm not exaggerating just to make some kind of political point, those are the facts.

http://travel.state.gov/visa/immigrants/types/types_2991.htm...

And beyond looking it up, we started going through the procedure several years ago, but ended up deciding to stay in Italy for the time being, so it's something I know first hand.

Here in Italy, the land of bureaucracy, it required one and only one office visit with my wife to get my "permesso di soggiorno" once we were married.

Getting one of those without being married is a huge hassle, and exposes one to the full brunt of Italian bureaucracy, but the US should be "better than that".
National Geographic ran a special on Singapore a year or so ago and one thing they described was a proliferation of thinly disguised "massage parlors" in malls. In a police state that Singapore is it basically means that these outlets are approved by the government, so the whole pornography issue is really quite multifaceted.

The same special described the general idea behind the chewing gum and jaywalking laws -- it is to whip citizens into the proper shape and to force them to behave decently. An extreme variation of the broken window theory if you will. And to top it off, there might be a government, but there is the father of the nation who, the man who developed the very idea of Singapore. He is in his 70s (?) and it is not clear how things will develop with his passing.

Any Singaporeans here care to comment on NG's take on Singapore? Curious to know how off it is.
If the option to get a paid internship exists I'd do that. I've always had problems with the idea of big companies offering unpaid internships, however depending on the industry/competition, I get why they exist.

But to echo baggins, employers have rarely cared about my freelance work.
It's hard to visit with an open mind when you would risk several years in prison for doing what you would at home. Capital punishment is required for being in the company with someone possessing a small amount of weed. "Obscene material" gives you prison up to three months, 21 years if you make it avaliable to someone under 21. If you watch the movie Milk with someone under 21 years old, you risk 21 years in prison. All members of Jehovas Witnesses were imprisioned in 2004. Richard Dawkins would probably have been sentenced for long imprisonment without a trial.
IOS 5 predictions
If you don't mind sharing your email I can send you a solution sketch. I don't want to post one online since homework problems tend to get reused from year to year.
Yeah right. Tell that to all the members of Jehova's Witnesses, who were imprisoned in 2004 for having the wrong religion.
Hellbanning? Wow. Talk about paternalism, judgment-elitism and power-madness.

Hellbanning really has to be a method of last resort for users with who repeatedly come back with problems for the community and with at least 2 admins agreeing on the ban. Not as a "i don't agree with this guy, byee".

I was once hellbanned from reddit for 2 months before i noticed it, i had never posted any really offensive posts and nothing even close to trolling, i had many top posts in discussions on the programming subredit and then suddenly the account went dark. After i noticed the ban i asked an admin about it and they did not even have a record of why it was banned, he took a look at my posts and concluded there had to be some mistake. WTF?! "Some mistake" During the ban i had spent tons of time replying to posts in thought that it would be of help or interest to someone, all just going down into some black hole.

The positive i got out of that experience was that posting on internet forums isn't worth my time and i stoped posting on almost all internet forums i had previously been active in (And yet still i am here writing this shit ^_^ )

If i made something wrong i want to know about it, not everyone is an active troll and i find it hard to believe the trolling problem is so big you have to throw away hellbans left and right without even thinking. There are many stories similar to mine, especially on reddit.
Well, you should check out the meetup scene, lots of them almost on weekly basis. Love to bump into you in one of those meetups.
Keep Computers Out of Classrooms (1997)
How the hell can u work like that for a number of hours at a time? The weight of the laptop on your legs, not to mention the heat from the fan must make it bearable for only a short time. A desk/table for minimum requirement surely.
Australians have no constitutional right to free speech, and some forms of speech are expressly criminalised via the sedition and various vilification acts.

The only form of speech that enjoys some protection is political speech. So whilst Australian's can freely talk crap about the government, Australia is far from a beacon of free speech.
Seems naive to think they bought OKCupid just for the revenue. The OKCupid guys were awesome at data mining, visualization, and viral marketing. Their ability to enhance the value of Match.com's existing client base is huge.
Doesn't this only work if the elements are unique? say you wanted the top three from [1,2,3,2,3,3,4,3,3,3,3,4,3], then the kth largest element would be 3, and we'd end up outputting [3,3,3,4,3,3,3,3,4,3], which is obviously not k elements.
I suspect there is a reasonable barrier to entry - in that the large number of engaged mailing list subscribers required has a big first mover advantage. Nobody is going to want to be signed up to dozens of different daily deal mailing lists, so with Groupon already having a ton of subscribers they get a much better pitch to the advertisers.

I think a possible competitive strategy is much more highly targeted mailings - instead of approaching advertisers saying "we have 170,000 subscribers in your city", go with "we have 15,000 females in the 30-45 year old age bracket who earn over $85k" or "we've got 22,000 working mothers of 3-7 year old children", or perhaps "we've got 8,000 people who dine out 3 or more times a week in your zipcode". (I have no idea if Groupon are collecting and/or using detailed demographic data about their subscribers...)
> In the last week I've mentioned Sony's situation to a number of lay people who've never owned a Sony gaming machine but have all heard about these security issues and insist they'll never trust Sony with personal information ever again.

No offense, but the tiny sampling size of the few people you talk to doesn't mean anything. The public happily gives more personal information to Facebook than Sony has on them.
I think the point of BNW was that there was no censorship, but rather the population just didn't care.
> Perfectionism is a nasty beast. Are you a perfectionist too?

Unfortunately, yes. And I'm definitely treating life as an optimization problem. However, most of the time I don't see the big picture. For example, I spend hours or days figuring out the "best" piece of hardware to buy (e.g., a new monitor), and then another day trying find the best offer. Usually I get frustrated the more options I find. Quite often, after many wasted hours, I end up buying nothing at all.

Other people would just "google" for "monitor test 2011", take #1 from the list, get it from their local dealer, and spend the rest of the day working on an interesting project or earning money (or both). What a happy life.

> I have found success when my hobbies and side projects intersect with each other. I finished a Flash animation when it was for a class project. I actually did learn a Haskell for Great Good when I made my senior research project "An Investigation of Lesser-Known Programming Languages." Then learning Haskell was not just a thing that might be cool but rather a school project that I had to finish.

Jup. The only programming projects I finished were school projects. That's when I have no problems getting incredibly productive, but a few minutes after the submission deadline, everything is back to normal and I waste my time sucking in random bits of information on the web.
There's no way to become a great programmer (builder/creator) if you only code (build/create) seriously a few times a year.

> If something like school motivates you, then use that to your advantage!

Yes, school is the only thing that really motivates me. But well, now I'm close to graduation, and I don't know yet what could replace it. That's scary.

> Do note that knowing a lot about a little does give you some unique advantages. If you ever do need to really learn something for a job or school project, it will be much easier than if you knew nothing about a subject. You are also more aware of what tools are available for various projects, and you can select the right tool for the right job.

That's true. I often notice that my tech knowledge is very exhaustive/broad compared to people who I consider experts in their particular field. They know one thing very well, I know a little about countless things.

However, I don't really know if that helps me as a programmer. Good programmers have to become experts in a at least a few technologies.
Maybe I should not force myself to become a programmer. Maybe I should pick a route where there is no need to become an expert. Suggestions?

> If you'd like to talk, send me an email. Info's in my profile if you are interested.

I definitely should do so. But somehow I'm already starting to lose all interest in fixing my problems. I'm already onto the next thing: Skimming through the Python twisted docs, just to see that I don't actually want to build anything. Sigh.
Why are you submitting this now? I feel like most people on HN have known about this since I/O or shortly after in May.
"we took one carry-on bag each, and went around the world"

Reading that just makes me smile. Well done.

So many people say they want to do exactly that. So few do it.

Of the people who don't do it, so many regret not having done it. Of the people who have, I've never met a single one who regretted it.

I hope your story serves as inspiration for somebody here to pack that little carry-on and book himself a one-way flight.
A nice overview, unfortunately he stopped before the real insight.

'there is a fundamental conflict here between a thread wanting to go "up" and other threads wanting to go "down"'

Can anybody explain that fundamental conflict?
"If your explanation for why they are losing money is that they're doing what needs to be done then that's fine, but you're forfeiting the 'defensible moat' argument. They're losing money because a bunch of established businesses could come in and take over if they don't."

It's not one argument or the other - that's a false dichotomy. It could be that, right now they're still vulnerable, but are doing what needs to be done to build their "defensible moat".

And in fact, this makes perfect sense. They're a very young business, they're spending a lot of money building their economic fortress. The fact that they aren't profitable is surprising, but for such a young company not too surprising.

"There is nothing wrong with taking some money off the table so the early investors/employees aren't operating under undue risk, but the scale of cash-out at Groupon is more than a bit fishy."

I agree, but I'm not sure I get this argument. Isn't this something that the investors decide? I mean, it's not like the founders were duping anyone. They went up to some VCs, asked them to buy a big portion of their shares, and the VCs agreed (after thoroughly looking at the numbers, I might add). The investors seemed fine with it and considered it a good investment nonetheless, so what does it prove? Nobody was duped here.

I think the only difference between what's happening now with Groupon and what usually happens with small startups is the scale of money involved. Groupon is similar to other young companies, but a lot more money happens to be involved.
Yup, I noticed that typo after the edit window expired!
I grew up and lived in Singapore all my life, and am glad to hear you moved over!

One thing to note though, you should remove your Identity Card No. from your blog post. They can be used illegally and is best kept private.

Have dropped you a mail, let's meet up sometime!
It's already been done, kind of, http://www.youtube.com/watch?v=bCWA7uevo_Q
Classic essay on negative and positive liberty: http://jmaggio.typepad.com/no_call_me_jay/files/two_concepts...

http://plato.stanford.edu/entries/liberty-positive-negative/
"Power without transparency inevitably leads to power that is abused" is true only for some value of "inevitably". You can have a benevolent dictator; you can't have three consecutive benevolent dictators. So long as we don't expect HN to outlive pg, we don't need to be all that concerned about serious abuse. The question is whether the cost of potential abuse is greater than the cost of trolls being able to create new accounts when they get banned.
It would also result in a lot of good content written by respected community members being hidden.
Like this?

http://blog.bumblebeelabs.com/social-software-sundays-2-the-...
This is a tough subject. You're right that if you walk around a city in SE Asia, you'll inevitably see lots of old, fat, bald men walking around with young pretty local girls, and there's no mistaking what's going on. Lots of these guys marry their bar girls and bring them home, so it's not uncommon to see a surly, tattoo'd guy walking around in Manchester with a Thai girl who's clearly way out of his league.

But what happens if you're a young traveler living in Chiang Mai, teaching English, and you meet a local girl who works as a bank teller. You fall in love, meet her parents, marry and eventually move back to your country with her. How do you signal to the world that yours is in fact a legitimate relationship?

The short answer is: you can't. There's a stigma, deserved or undeserved. It's something you learn to live with, because you know that nomatter how clearly you explain your position, you'll still end up fielding uncomfortable questions like the one asked by the parent.
Singapore seemed a little to squeaky-clean and expensive, so I did the same thing, but in Vietnam instead. Internet infrastructure here isn't great but other than that I haven't regretted it for a second. The U.S. and Europe just seem so boring now when I go back.
For these types of problems you usually assume that every element is unique. The fix is just making two passes through the array instead of one, so it's still O(n).

It's typically easy to reduce solving such a problem with duplicates allowed into a very similar one without duplicates. Just replace every element x by the ordered pair (x, the position in the array where x came from) and then use a modified comparison function that sorts according to the second element in the pair if two ordered pairs are equal in the first element.
If you actually used Rails...

I've used Rails. (Goodness, I used Ruby in 2000. Get off my lawn.)

Plenty of the Internet's programming culture is driven by fashion. I saw plenty of projects written in Java in the early 2000s because that's "what investors want[ed]". When some of those Java programmers woke up from their XML-as-configuration comas in 2005 and 2006, they brought that sense of mission with them to Rails, ignoring the almost 20 years of dynamic languages getting things done up to that point. (No XML situps? Monkeypatching instead of Spring? Naked objects instead of beans? Auto-generated accessors? Ruby and Rails invented none of that, but good for Rails for attracting an audience.)

Ruby's a decent language, but it still suffers the growing pains of adolescence. It'll catch up. (A language test suite is a nice start.)
Ask HN: Are there any hot startups hiring in Dublin?
I am considering moving to Dublin and start a new life there.

I am a mobile passionate and I love the startups' world but I don't know any startup based in Dublin.

I have already built and pushed many iPhone app on the AppStore and some of them got download more than 600k times. I love designing nice products and facing new challenges.

If some of you would have some recommendations on where to work or to start looking for a nice job in Dublin, I would really appreciate! Many thanks!
When you have lazy evaluation in your tools, finding K extremal elements in list will be one-liner:

getKSmallest k list = take k (sort list)

or even shorter in point-free notation:

getKSmallest k = take k . sort

http://en.wikipedia.org/wiki/Selection_algorithm#Language_su...
definitely helpful any thoughts on databases?