Better HN
topnewbestaskshowjobs
Log inSign up

andy_boot

289 karma · joined Sep 4, 2010 (16y ago) · 148 submissions

Submissions

comment 8y ago · link · parent

True. Well observed. How would you resolve this?

comment 8y ago · link · parent

Despite being the author I think you are correct. It should be table: 'cat' not 'cats'

comment 8y ago · link · parent

1) Yes. I'll re-word that part. 2) I debated with myself on that. On one hand it is clearly better to ORDER BY. On the other hand I'm trying to teach people the window functions and I don't want them typing in more SQL than they have to.

comment 8y ago · link · parent

you are correct. I'll fix that.

comment 8y ago · link · parent

That query looks fine to me, I'll tweak the code.

Yep I need to fix up Q10 a bit.

comment 8y ago · link · parent

good idea. I'll fix that.

comment 8y ago · link · parent

Author here - I'm scrolling thru the logs and it is interesting to see that on the first question lots of people try to write "select name, total_weight" despite there only being a weight column which you have to use an aggregate on to get the total weight.

I guess I need to rethink my design a little.

comment 8y ago · link · parent

Good find. Thank you.

comment 8y ago · link · parent

Author here. - As others have said this SQL Engine makes me write the SQL out the long way. For some reason the shorter version (which I wrote first) is rejected by my postgres client.

40.

Advanced SQL window function quiz(windowfunctions.com ↗)

163 points · by andy_boot · 8y ago · 79 comments

comment 9y ago · link · parent

True But I would like to show you an interesting counterexample which requires changing the rules slightly. If we toss a coin and keep tossing until one of the below sequences turn up then which sequence is more likely?

HHHHHH THHHHH

Answer: THHHHH. Only 1/(2^6) of the time it will be HHHHHH. The only way to get HHHHHH will be if the first 6 flips are heads. If you don't flip a head you must have got a tail which means THHHHH will always appear before HHHHHH.

comment 9y ago · link · parent

>But lets say they go bankrupt in 1 year, couldn't they just switch to "profit mode"?

Well that they might have to try and do now. But usually it is hard to move to 'profit mode' - you upset your customers when you start to charge double. The idea is that before you do that you have either killed of the competition or your competition 'moat' is so big that everyone wants to keep using you because of $reason and so you can charge what you like.

>If there is no "profit mode" ... then why are people investing in the first place?

Nobody is ever sure if any startup will get to 'profit mode' you simply look at their market / numbers etc and if you decide to invest then you hope the startup can figure it out. This is the investing gamble.

comment 9y ago · link · parent

While crude, I do think raverbashing has a point here. If a 10 person startup already requires their devs to use 3 different reporting tools that startup has a problem. If you can't streamline at a small size like this you won't stay nimble and you won't make it.

comment 9y ago · link · parent

and the reference will tell them to get stuffed. Leaking salary details of employees to a competitor will get you fired.

comment 9y ago · link · parent

It is true that milk is a good source of vitamin D and calcium. It helps prevent things like Rickets which was why it was mandatory in schools when I was young.

It is also one of the few non-sugary examples of a kids drink so I'm quite keen on it.

I liked it when I was young.

comment 10y ago · link · parent

The EU is a large multi country bureaucracy - they need time to consider things like this and I expect they have bigger problems to worry about.

Basically don't expect an organisation that large to jump up the same day a solo developer gets banned even if it was unfair.

comment 10y ago · link · parent

I don't think it will happen that way. It's as easy to live in a regular van as a self driving van. Sure some people do it but not many.

I imagine that far less people will own cars and instead there will be a fleet of self driving taxis.

But I'm not sure, interesting times - like you said.

comment 10y ago · link · parent

I don't understand the downvotes here.

I work in a London startup where about 90% or our engineers are not British. They tell me that they are already seeing adverts saying 'move to berlin/dublin' on their facebook feed. There is a real danger that as well as not being able to recruit people, the people that are already here will simply leave.

comment 10y ago · link · parent

It is definitely going to be a problem. And people are already pushing see: Truck Drives Around London Urging Move To Berlin: http://www.lbc.co.uk/truck-drives-around-london-urging-move-...

comment 10y ago · link · parent

I actually think that's a better way to do it than what we usually have to go through.

I believe the Israel uses this technique as well.

comment 10y ago · link · parent

I like this idea but I know that I have accidentally entered my password or my password with a typo in it on the terminal on at least one occasion.

The only way round this that I can see is to grep out the password - but then my password (or a substring of it) is now in plaintext in my .zshrc/.bashrc

I can't think of a solution to this. Does anyone have anything?

comment 10y ago · link · parent

>Oh come on. Did the regulation in the financial system protect "the customer"

Yes it did. Nobody lost money in their savings or current accounts in commercial banks (Except Iceland)

What happened in the stock market was different but the core of the FSA/FCA is about protecting customer's money which they did. (See how they were able to ensure none of Northern Rock's customers lost money in the UK).

comment 10y ago · link · parent

I was surprised by that statement too, I don't think it is true in London.

comment 10y ago · link · parent

I met him once back then I didn't know who he was. Weirdly I was reading the book: http://www.codersatwork.com/ at the time - ofcourse I got a shock when I realised he was the next chapter!

Anyway he was a nice guy.

comment 10y ago · link · parent

Got to disagree here. Even if your task takes only 30 minutes, by the time you add getting client's requirements and browsing for jobs each task will take 1 hour. You should not be working for $5 / hour.

comment 10y ago · link · parent

Similar story here.

Raised in the Midlands, studied in the Midlands, work in London. Why do I work in London? Because that's where all the jobs are.

My thoughts went something like this: Where are the high paying jobs? Finance -> Go to london.

A few years later: Where are the interesting startups? London.

comment 11y ago · link · parent

I'm fairly sure if you just park your car in front of the truck on a remote highway the drive safety systems will kick in and stop the truck. Then you jump out and crowbar/bolt-cutter the container.

Of-course it will probably detect you doing that and call for help complete with its GPS position.

I also expect some enterprising think-outside-the-box robbers will temporarily come up with some creative way round this. (Will phone jammers stop the truck calling for help?)

It'll be interesting when it happens.

comment 11y ago · link · parent

Sounds like Asmiov's "The Strips"

comment 11y ago · link · parent

If they are making a loss this implies they are not paying dividends. Therefore how can PE ratio be positive ?

comment 11y ago · link · parent

I recall a story of a company that was analysing student loans, finding people most likely to pay the loan off and buying that debt.

So yes I expect there are already student credit default swaps somewhere.

12345