HNHacker News
TopNewBestAskShowJobs

irahul

3,322 karma · joined February 9, 2010

rahul AT thoughtnirvana DOT com
submissionscomments
irahul··on Time to hand over the reins before Capistrano costs me my youth?
> I'm also of the opinion that compiling assets in production as a part of your deployment process is insane, there's so much magic in the Rails asset pipeline that it's not uncommon to turn up bugs where tables don't exist, and the rails app can't initialize, or some javascript runtime environment isn't found which can leave your deployment in a broken state.

This is one of the pain points for me. Even when everything is setup, the asset compilation churns the disks and takes way too much cpu. I would rather do that on my local machine than disrupt the production server. I do a simple workaround for that:

    namespace :deploy do
      namespace :assets do
        desc 'Run the precompile task locally and rsync to shared'
        task :precompile, :roles => :web, :except => { :no_release => true } do
          run_locally "rake assets:precompile"
          run_locally 'rsync -e "ssh -i production.pem" --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{user}@#{host}:#{shared_path}'
          run_locally "rake assets:clean"
        end
      end
    end
irahul··on Time to hand over the reins before Capistrano costs me my youth?
You are entitled to your opinion, but as other commenter pointed out, rvm was created for production.

> hey exist to allow developers on Macbooks to sync their version of Ruby with whatever is packaged in the Linux distro or BSD variant that runs in production.

Or to allow developers who run ubuntu to develop multiple projects which need conflicting versions of the Gem and interpreters seamlessly. Also, I sometimes deploy multiple projects on same production box where the 2 might need different interpreters, and they almost always need separate gemsets. I can manage the interpreters and LOAD_PATH manually, but then I will end up creating an unholy mess which will somewhat resemble rvm.

I am curious. What are your reasons for "rvm doesn't belong in production"?

irahul··on Why Your Startup Can’t Find Developers
I am not advocating letting someone use(exploit?) you for his own profit. But I like free markets and I am saying if the employers aren't doing anything shady and just offering low salary, someone who finds the salary good enough can take it.
irahul··on Why Your Startup Can’t Find Developers
I would be actually ok with that provided that they offered to pay for the overtime. I think they told you the rates they are willing to pay, and left the number of hours up to you. This kind of arrangement works for me. There isn't anything shady going in the background(paying for 20 hours, expecting 60 hours). I have an option to take it or leave it, but they aren't trying to offer a "t&c applied" deal.
irahul··on Why Your Startup Can’t Find Developers
Yeah. Hourly rates helps keep things in perspective. But hourly rates also worsens the douchiness where people start feeling that the number of hours it takes is disproportionate to the amount of work being done.

But in that case, I try to first politely explain them that estimates do go wrong, especially in the cases where I am doing things I haven't done before. I recently setup a xmpp based web chat for the first time. I communicated beforehand that I am not familiar with xmpp web clients and whether I would be able to just use a xmpp web client or I will have to code something from scratch using strophe.js or convere.js, or if it can be done at all. The task is basically "it will be done when it will be done" but I will be able to at least tell you if it can be done at all in a week.

Reasonable explanations mostly work with people who start getting restless when things take longer than expected, mainly because I too vet my clients. But the thing with hourly billing is, if the stakeholders are being unreasonable, I ask them to go eat shit and cut my losses(if any) and I don't have to deal with unreasonable expectations that comes with a fixed price bucket.

irahul··on Why Your Startup Can’t Find Developers
Out of curiosity(and I am being amused and enraged at the same time at the world changing "idea" guy and 80 hours/week) what did the comment you replied to said?
irahul··on Why Your Startup Can’t Find Developers
The main issue with these douchebags is they want to pay for 20 hours and have the employee work 80 hours. I would be a lot more enraged if I got the impression that anyone worth his salt would actually consider working for him. 80 hours building wordpress plugin while being paid for 20 or lesser for a startup headed by an idea guy who declares who won't hire anybody who tracks his hours and is unwilling to work overtime? That will happen the day a monkey comes out of your ass you piece of shit. I am still concerned that it's employers' market and some poor soul will end up getting exploited. Man, sometimes assholes make me hate free markets and I wish for regulations.

And then the guy talks about "premium" salaries. Yeah. Right. Even assuming 50 USD/hour(which is pretty reasonable), 50 * 80 per week comes up to 16000/month comes up to about 192000/year. Unless you have that kind of cash, don't go on shitting garbage about 80 hours/week.

irahul··on Why Go? Use Racket
The author has a follow-up post http://cxwangyi.wordpress.com/2012/07/29/chinese-whispers-in...

Each thread reads from the channel to its left and writes the processed input into the channel to its right.

Except that the programs he posted are flowing the other way(start with rightmost, read final value from leftmost). The implementation of the author's wording needs a slight change.

Go implementation:

    package main

    import "fmt"

    func setup_channels(left chan int, num int) chan int {
        for i := 0; i < num; i++ {
            right := make(chan int)
            go func(left, right chan int) { right <- 1 + <-left }(left, right)
            left = right
        }
        return left
    }

    func main() {
        leftmost := make(chan int)
        rightmost := setup_channels(leftmost, 100000)
        leftmost <- 1
        fmt.Println(<-rightmost)
    }



Racket implementation:

    #lang racket

    (define (setup-channels left idx num)
    (if (>= idx num)
        left
        (let [(right (make-channel))]
        (thread (λ ()
                    (channel-put right (+ 1 (channel-get left)))))
        (setup-channels right (add1 idx) num))))

    (let* [(leftmost (make-channel))
        (rightmost (setup-channels leftmost 0 100000))]
    (channel-put leftmost 1)
    (channel-get rightmost))
I also don't understand why is he writing to the leftmost channel in a separate thread. I don't think that's needed.
irahul··on Abandoning PHP for Python
I am not very familiar with PHP dependency management. If you are using Python, you should use virtualenv. Apart from providing you a repeatable development environment, it also enables you to use 2 versions of the same library in 2 different projects.

I deploy within virtualenv mainly because I use the same machine to host multiple services. I sometimes use requirements.txt.freeze(pip freeze -l requirements.txt > requirements.txt.freeze) for production deployments, but in the end, I find specifying versions in requirements.txt itself more convenient.

If you are building async services in python, have a look at gevent and learn the basics of event loops. gevent abstracts the event loops(there isn't an explicit loop) but there are cases where you are better off rolling your own select/epoll loop. Also, the article paints too rosy a picture - "I've built backends that do authentication, query a few million rows in Solr and return JSON in a couple of milliseconds thanks to Python" If you structure your applications properly, and your application is IO bound, you can get good performance out of Python. But it goes without saying that Python isn't a performance powerhorse. You might need to replace CPU intensive services with some other language or write a c extension or write cython ...

irahul··on Houston Yelp reviews include the word "racist" 4 times more often than average
Oh for fuck's sake...
irahul··on To my daughter's high school programming teacher
To each his own. I find web development(dynamic or just html/css) doesn't have the instant gratification something like VB has(it doesn't have to be VB). The main purpose of teaching programming to high-schoolers is to con them into learning it themselves. VB, despite its warts, was one of the most popular programming languages of its time. Excel and VB owe its popularity to the simple fact that they aren't hostile(or at least not as hostile as others) to newcomers.
irahul··on To my daughter's high school programming teacher
> I'm sure they're teaching VB simply because that's what they have experience with, probably making them the most experienced programmer on staff at the school.

VB is a fine language to get children interested in programming. Personally, I know many people who weren't able to grasp programming via C but were pretty excited about VB's gui designer and easy database connectivity. Most of the introduction to VB didn't teach them much programming, but at least it got them interested.

> High school bullies are typically quite good at restricting their bullying to times when they're unlikely to be spotted by an authority figure.

The author is being unfair when she is holding the teacher solely accountable for bullying.

> It takes a lot of effort to maintain an authentic connection. Parents have trouble connecting authentically with their children--imagine doing it with scores of students per semester. And when it comes to bullying, most teenagers downplay to avoid being though of as a snitch. Some are self-conscious to be bailed out even when they haven't "snitched".

There is also the fact that being teacher's pet generally invites more bullying. If they can't harass you, they will begin isolating you. And of course, the general mentality isn't in favor of snitches even when the snitches are hapless victims. Children don't have a strong sense of right and wrong and peer pressure muddies it more.

> For many of the author's suggestions, the teacher may be doing these things (recruiting, cross-promoting, etc.), to the extent that they have time. But these are outside the job of teaching. These are things the author could be doing at the school too, but presumably she's too busy. I'm sure the teacher can relate.

I haven't taught at professional level, but I do like teaching. And I like to teach people who are interested in learning. If I were a teacher, I won't really do much recruiting and promotion. If the job requires me to do it, I probably won't take it.

irahul··on To my daughter's high school programming teacher
> The real issue of the article (and complaining about Visual Basic detracts from it) is a teacher who sets up an environment that tolerates harassment and bullying.

You are being unfair. Children while growing up can be cruel. Bullying and harassment isn't a new phenomenon. May be the teacher could have done more, but "who sets up an environment that tolerates harassment" is a bit far fetched.

irahul··on Postgresql 9.3 Released
When you are comparing to other offerings, postgres's auth is complex than them. But other than that, what about postgres is complex?
irahul··on Postgresql 9.3 Released
> A big reason why mysql took off is the same reason that PHP took off -- it is very quick and easy to take the first steps.

I think most people struggle with setting up postgres auth. Personally, I find postgres' auth well designed.

irahul··on GCP - cp with a progress bar
> And therein lies the sickness that is affects HN sometimes.

Sickness? Really? Did you come up looking for a question for which you already had an answer, and finding none, just put words in my mouth, and responded to an argument I didn't make.

What part of "just for fun" is fine with me was difficult to comprehend?

irahul··on GCP - cp with a progress bar
Make what you will of it. I am more likely to phrase it as "Why? rsync works just fine" than ""I wanted the same thing and I chose to solve it with rsync with the following alias / script". FWIW, as far as being educational goes, your phrasing says the same thing with padding.

Also, "how" matters only when I have "why" answered. If it isn't mentioned on the project page, or I skim too fast to grasp it, "why" would be the first thing on my mind.

irahul··on GCP - cp with a progress bar
The "why" generally comes into play when you project it as a solution to an unsolved problem(or at least a problem which can't be easily solved). If you leave it as "because it's fun", I am fine with it. If you present it as "now you can have progress bars with cp", I will ask "why? I can already do that with rsync". That's not because I want to put down your work; that's just thinking out loud.
irahul··on I don't know Regex
Yes. If you are going for equivalent, this would be it:

  pat = re.compile(r'^ [a-z] [a-z0-9]* @ [a-z]+ \. [a-z]+ $', re.I | re.X)
I took a few liberties in crafting the reduction.
irahul··on I don't know Regex
Nice work. Personally I will still use the raw regex rather than the method calls to build the regular expression. As another commenter pointed out, the example regex is complex than it should be. It can be reduced to:

    pat = re.compile(r'^ \w+ @ [A-Za-z]\w*  \. \w+ $', re.X)
    if pat.match('r@acnt.me'):
        print "woot"
I won't bother explaining this regex(too simple). However, if it were something complex, I would put inline comments:

    pat = re.compile(r'''^ \w+  # rahul
                    @
                    [A-Za-z]\w*  # thoughtnirvana
                    \.
                    \w+ # com
                    $''',
                    re.X)
Notes about the example regex:

  var regEx = {(?:^)[A-Za-z]([A-Za-z]+|(?:\d+))(@{1,1})[A-Za-z]+(.{1,1})[A-Za-z]+(?:$)}
(?:^), (?:$) - This is the same as simply using ^. It isn't captured by default so there isn't a need to mark it non-capturing.

([A-Za-z]+|(?:\d+)) - What's going on here? You have a capturing group and within that capturing group, you have the or part marked as non capturing. What's the intent?

(@{1,1}) - @{1,1} is the same as @. Also, why are you capturing it? I think you are using parens for making the regex readable. You should use the IgnorePatternWhitespace instead http://msdn.microsoft.com/en-us/library/yd1hzczs.aspx

irahul··on Startup - Bill Watterson, a cartoonist's advice
> Bill Watterson got successful by doing X != If I do X I will be successful. > Even if you follow the advice in the same letter and spirit as he did.

You will notice that I didn't mention success once, nor did I talk about if I do what Bill Watterson did, I will be good. You are intentionally or unintentionally misreading the article and my comment.

The article or my comment isn't about "follow your dreams and you will be successful"(that will be incredibly stupid advice). The point is I don't have to care what you or anyone else thinks of what constitutes success. My monthly income is above average for an engineer in Bangalore. That is partly due to my hourly rates and partly because I put in long hours. If I had a kid, I won't put in long hours. Period. Will it affect the amount of money I make? Of course. Am I under the illusion that doing that will somehow make me more successful? Fuck no.

> Though I agree you increase your chances of being successful that way.

If only...

irahul··on Startup - Bill Watterson, a cartoonist's advice
> So you can't really sit the whole day under a tree play lego with your kid.

I don't know where you are getting the idea that the cartoonist(the artist) or Bill Watterson(the cartoonist has used a quote from Bill Watterson's speech) advocates doing nothing.

If you go by just the cartoon, the first panel shows him working. He doesn't find drawing the jeep for the advertisement fulfilling, and he isn't interested in having beers with his co-workers. Overall, his job isn't for him so he quits. Later, his old company comes with an offer which he considers but rejects because that will mean not being with his kid and going back to drawing jeeps for advertisements.

Do you know Bill Watterson's story? These aren't empty words. He pretty much followed this to the letter and spirit. He started at some news agency drawing cartoons(or was it ads). He didn't find it fulfilling and quit. He started Calvin & Hobbes. He could have become a millionaire had he merchandised it, but he fought against merchandising because he believed it will dilute the art. Now whether he did the right thing or not doesn't matter. Calvin & Hobbes is his; he can do whatever he wishes with it. On a slightly related topic, all this "Calvin pissing on cross" and "Calving kneeling against the cross" make me angrier than it should. For fuck's sake, I don't give a shit whether you are a militant atheist or a religious nutjob. Come up with your own ideas rather than stealing from someone who clearly doesn't wish his creation to be merchandised.

As the cartoon states, the whole point is creating a life that reflects your values and satisfies your soul. If your 9 to 5 does that, superb. If not, everyone owes it to himself to pursue something that does.

irahul··on Play Framework Security Advisory
> I assume if your app needed load balancing, there is justification to shard it across different DBs too.

Having 2 or more web/app servers sharing a db is a very common setup. Db sharding is more of an exception than a norm.

Even then, db sharding doesn't affect sessions unless your sharding parameter is if the request is on web server 1, then load from shard 1(which doesn't make any sense). The code which decides which shard to query is common on all web servers and it will hit the required shard regardless.

irahul··on Play Framework Security Advisory
Session id in a secured cookie and then loading the session from db/memcache/ram/custom-backend is standard practice and is something that is provided by most frameworks. What exactly did you gain by using a non-signed cookie other than opening yourself to replay attacks? If you felt like directly setting a cookie instead of just `session['user_id'] = some-user-id`, why did you forgo signed cookies?
irahul··on Play Framework Security Advisory
I am assuming by "keep the session server side", you mean keep it in the RAM. If you want to keep the session in the ram, store it in memcache or redis.

Also, the more complex an app becomes, it's generally desirable to have less state, not more(as in sticky sessions).

irahul··on Play Framework Security Advisory
> I believe the whole purpose of putting session data into cookies is to prevent the other issues that arise when storing session data on the server's database. The main issue is that when you're load balancing, each request could be load balanced to a different server,

When you are load balancing, request 1 goes to web/app server 1, the app server reads the session id from the cookie and read the session from the db..the next request goes to web server 2, web server 2 reads the session id from the cookie, loads the session from the db...

Each request being load balanced to a different web/app server doesn't affect the session. You are going to read the session id from the signed cookie, and then load the session from the db which is being shared between all of your web/app servers.

irahul··on Hugo: A Fast And Flexible Static Site Generator Built In GoLang
> I strongly recommend against using external dependencies (e.g. bitbucket.org/howeyc/fsnotify) for something important. It's fine for development, but if "howeyc" decides he's sick of bitbucket and deletes his account, you're now screwed.

How? When you `go get` a package, it physically becomes part of your repository. If "howeyc" deletes his account, it doesn't affect the copy checked out under my repository. Unless you go out of your way to exclude the `go get` packages from getting checked in, you are safe.

irahul··on Ancient languages: Perl (2004)
> Although you don't have to use them, at all. Also if you insist on implementing your own object oriented design the slow hard way by hand using references instead of "use Moose;" like a normal person, its hard and slow just the way you asked for it, instead of being made impossible.

If you are a perl programmer, you have to know and use references(pass hash, pass array with other params, nested data structures...). "you don't have to use them" is true in the sense that you don't have to use anything - you don't have to use lists, hashes, OOP, what have you. The same goes for OOP. Moose is an option for new code, not for code which has been written with blessed references.

I don't have anything against references; I do have something against using references and de-references for nested data structures and passing data structures to functions. Yes, I do understand references, but I will take the way Python and Ruby make do without references over Perl's references any day.

irahul··on Ubuntu forums breached - all passwords compromised
Umm...no.

    In [17]: '38b2cf16f7be6a1b33097084bed6a4b0' == hashlib.md5('lsdjfldsjlfds' + 'asdfasdf').hexdigest()
    Out[17]: False
irahul··on Ubuntu forums breached - all passwords compromised
The purpose of the salt is to invalidate rainbow tables. With salt, the only way to reverse is to compute all combinations. With advances in GPU, it has become easier for some hash functions, but it easnt' easy to reverse by any measure.

What are these sites which will crack the passwords in no time? Try reversing this:

38b2cf16f7be6a1b33097084bed6a4b0:lsdjfldsjlfds

← PreviousPage 3 of 34Next →