HNHacker News
TopNewBestAskShowJobs

banthar

153 karma · joined October 27, 2011

submissionscomments
banthar··on Alternatives to Regular Expressions
I'm not sure if you mean that pro or against regular expressions. That is a good example for #5. Regular expressions are great to quickly patch together something that kinda works, but:

1. Those hosts are still broken. The next person will have to jump the same hoops to support them.

2. You parser is very permissive. It will encourage people to create even more broken implementations.

3. The specification of this protocol is now worthless. There is no way to safely add new functionality. Any new element or attribute can break those regexes. Everyone has to take every implementation into account.

4. You are probably missing some corner cases like CDATA elements or quoted characters.

From your point of view, it probably makes sense to support even broken sites. But, you are helping to create next HTML - where every implementation works differently and you have to test everything on every browser.

banthar··on Alternatives to Regular Expressions
That is fine for throwaway scripts. But such "perl duct tape" is not 100% accurate and will break for no reason. There is no place for such solutions in reliable and maintainable software.
banthar··on Alternatives to Regular Expressions
I do not know if it's correlation or causation, but almost all code using regular expressions I encounter is horribly broken.

1. Regular expressions are often used instead of existing parsers. XML, CSV, file paths, URIs etc. all already have fast, well tested and correct parsers.

2. Often the thing worked on should not be a string in the first place. For example comma separated string is used instead of a list and regular expression emulate list operations.

3. Some things could be processed much easier with different tool - for example recursive descent parser. Yet the developer still tries to parse arithmetic expressions with a hammer.

4. They are often developed via trial and error. They are either first thing which worked for a simple case or are 10 line monsters riddled with exceptions from exceptions.

5. They are often part of hacks and workarounds. For example User-Agent is matched to work around bugs in browsers.

3. They give very limited feedback to user. There is either a match or no match. There is no way to tell what and where is broken.

There are valid use cases for regular expressions. It's even possible to write correct code with them. It's just a rare sight.

banthar··on TrueCraft, An Open Source Implementation of Minecraft 1.7.3
I've made this some years ago: https://github.com/banthar/mine3d

It's just the basics - only renders terrain and some static blocks. But it's also based on 1.7.3 protocol.

I've just checked and it kinda works with TrueCraft server: http://i.imgur.com/Brf2NXg.png

banthar··on T-Mobile Poland Officially Accepts Bitcoin Top-Ups
According to this: http://firma.t-mobile.pl/pl/dla-mediow/informacje-prasowe/-/...

T-Mobile is a patron of startup accelerator in which InPay (the payment provider) took part.

banthar··on Predicting the next Math.random() in Java
This more probable than you think. Java code is likely to use Collections.shuffle(). That method uses internal Random which is used only for shuffling. Shuffling is unlikely to be used for other purposes than shuffling cards. There isn't that many ways to shuffle them either.
banthar··on Show HN: open source Sudoku random board generator for iPhone / OS X
So, it only generates fully solved boards? That's a pity. Picking the initial numbers is the tricky part. I don't think there are many opensource libraries for that.
banthar··on Show HN: open source Sudoku random board generator for iPhone / OS X
This looks way too simple to generate good quality sudoku puzzles. Does it, for example, check if the puzzle has only one solution?
banthar··on WebGL: 80,000 particles
Have you downloaded all the files? requestAnimationFrame is defined in http://minimal.be/lab/fluGL/RequestAnimationFrame.js
banthar··on Maryland bans employers from asking for employee social media passwords
> What if your employer wants you to steal from your family?

Stealing should be illegal in any case. It has nothing to do with labor laws.

> What if your employer wants to have sex with you?

Again. If you don't like prostitution, ban prostitution. It has nothing to do with labor laws.

> You either believe labor laws should exist or you don't.

> If you do, I don't think the answer need to be anything more than "common sense".

Those two sentences are classic logical fallacies. I can support just some labor laws and "common sense" is not an answer to anything.

banthar··on Maryland bans employers from asking for employee social media passwords
Earning money usually means doing lots of hard and unpleasant things. Giving your facebook login information is hardly the worst thing employer can ask you to do. Why is it so special? How do you determine what should and what shouldn't be allowed?
banthar··on SQL Injection through HTTP Headers
I've tried to write a program (https://gist.github.com/392445) which would be affected by this. It seems it should be `'); DROP TABLE servertypes; --` to actually drop any tables. All I was able to get now is syntax error.
banthar··on Weird Funny Java
The string is split in half. It only takes a couple of seconds to brute-force each part.
← PreviousPage 2 of 2