HNHacker News
TopNewBestAskShowJobs

asher

126 karma · joined October 24, 2009

submissionscomments
asher··on Perl is 25 years old today
I agree with you about the feeling of fragility, especially with defaultdicts.

As for regexes - while they are somewhat clumsy in python, they don't have to be defined distantly:

  m = re.match(r'(\d{4})', buf)
  if m:
    print "year: %s" % m.group(1)
The only thing that really bothers me about the above is the need to separate the assignment of m from the test.

Re comprehensions: seems to me they are just Python's version of Perl's map and grep.

grep:

  @good = grep { $_->{width} > 9 } @crates;
  good = [c for c in crates if c['width'] > 9]
map:

  @squares = map { $_ * $_ } @nums;
  squares = [i*i for i in nums]
Which is better? I think Ruby's way is the best, and Perl/Python are a wash here.

Now, on the autovivification note, I wonder if we can make a Python class that has the desired behaviors. Like:

  c = PerlishStruct()
  c['foo'][17]['bar'] = 'baz'
You don't really think it's junk, do you? Perl, Python and Ruby are extremely similar; I'd say Perl's more ergonomic, but messier; Python's cleaner, but sometimes awkward, and Ruby pretty much has the best of both worlds.
asher··on Why Did I Choose Perl When Building Crowdtilt?
Which modules are missing on Pypi?
asher··on The Hacker Way
Interesting, because I was also thinking of Disney. They had enormous conflicts in Florida with the experienced hotel executives they brought in to run the new hotels.

Ultimately those hotel men were pushed out by the Disney managers, who all shared the same corporate DNA: fanatical attention to guest experience combined with unawareness of money.

One store generated $100k/year in revenue, and cost $1M/year to run. That was perfect from Disney's viewpoint.

Eisner put an end to this, of course.

asher··on Retailers Are Losing the Software Talent Wars
> Where is the Wordpress for retail? http://www.shopify.com/
asher··on Why do C++ folks make things so complicated?
Well IIRC it was a tempting way to replace for-loops with direct list operations ala Python, Ruby etc. But the amount of syntactic noise and cognitive load seemed too much for the added leverage.

Our code had sufficient complexity that I didn't want one more oddity (as many would see it) to explain.

But for a small team, or a team that's all on the same page, maybe it's good.

Sorry to say there's no dramatic story of code explosion here!

asher··on Why do C++ folks make things so complicated?
I think he meant C++ library. Lots of the libraries you mentioned are C libraries.
asher··on Why do C++ folks make things so complicated?
Well, off the top of my head - and I may be missing some of the awesomeness of boost:

shared_ptr - Yes, even non-boosters like this.

regex - pcre

string - stl string

bind - if this is what I think it is, please don't use it. Future maintainers of your code will be grateful.

Having said that, C++ is a large world, and choosing to use these Boost components is perfectly valid.

asher··on Why do C++ folks make things so complicated?
I agree. Also, the pure-C interface is easier to wrap from scripting languages.
asher··on Suicide
Martin Seligman, who has been mentioned above, also has a book "Authentic Happiness" which you might find interesting. As he points out, and you have experienced, inborn predisposition is the biggest factor in happiness.

However there are other big factors which you can partially control. You've probably already discovered some of them.

I think you would like the book because Seligman recognizes the fundamental difficulty of the problem. As you may have guessed, Seligman himself is predisposed to unhappiness.

asher··on Writing a C library, part 1: best practices for writing C libraries
Exactly. Also, if the library uses a hash function, let the caller override that.
asher··on This blogger.com profile is squatting YC founder's names
When launching Truemors, Guy Kawasaki registered 55 domains to "surround" truemors.com.

This represented 9% of his total budget.

(From Kawasaki's 2008 book Reality Check).

asher··on Tenenbaum Appeal Heard: Is It OK to Make Someone Pay $675K for 30 Songs?
Perhaps it can be justified on the basis of property rights. If you own a penny, you have the right to place it on your table heads up or tails up, barring extreme circumstances. In that sense, the penny can be in two states.

If you own a six-sided die, you obviously have the right to place it in any of its six natural states.

If you own a hard disk, it has 2^N states, where N is the capacity in bits. You have the right to place the disk in any of those states.

According to this line of thought, any regulation which deprives the property owner of the right to place his property in one of its natural states is an infringement of property rights.

asher··on Tenenbaum Appeal Heard: Is It OK to Make Someone Pay $675K for 30 Songs?
Great post. However, with regard to Apple choosing certain dimensions for a tablet, it is probably patentable. The claim would cover a device with length, width and height within certain numerical ranges. Of course, the invention must be novel and non-obvious. If the ranges are specified too narrowly, the competitor can just make the device bigger or smaller. But if the range is specified too widely, it may include a prior art device, which would invalidate the claim.

Here's an interesting link on numerical ranges in nanotech patents:

http://www.elkfife.com/view_article.php?id=9

(Warning: EU != US)

asher··on Chomsky on Intellectual Property
It might be easier to write CAD software without an OS. At least, writing directly to a framebuffer is simpler than using X11 or OpenGL or Win32. Unless I'm missing something, a modern CAD system has to plot each entity twice; once to the display system and once to an internal grid. The internal grid is used for entity selection, possibly culling and other things.

The older AutoCADs (on DOS) apparently plotted the internal grid (hi-res), then resampled it to generate the screen display.

Thus, minor panning and zooming could be accomodated without "regenerating" -- replotting the hi-res grid.

Anyway, a CAD system doesn't really use the facilities of an OS; something like a web server, however, seems to benefit from an OS.

asher··on A Web Developer Goes Native (with Android)
Can't you treat SQLite as a key-value store? Create a table with two columns: key and value. Blobs can be pretty big.

Seems to me that a relational DB can easily impersonate a hash, but not vice versa.

asher··on Instructable: How I discovered Instructables' email database had been stolen
I used to create separate email addresses like the author. Then I realized it's a waste of time. Some will get used for spam - but what's the use of knowing the address came from site X? Either the site operator sold the addresses, the site got hacked, or they were otherwise compromised.

Either way you need a good spam filtering setup.

Incidentally, I don't see why the author thinks a PDF exploit was used. There are quite a few other exploits.

asher··on Ask HN: Who are your favourite essayists?
G.K. Chesterton

A century old, but often still relevant.

For instance: The Modern Martyr

http://www.online-literature.com/chesterton/all-things-consi...

asher··on I don't like Python. Does that make me a bad person?
Given a = [1, 2, 3, 4, 5]:

    Ruby:    a.map{|i| i+1}.reject{|i| i%3 == 0}.map{|i| i*i}
    Python:  [i*i for i in filter(lambda i: i%3 != 0, [i+1 for i in a])]
Please ignore the fact that the whole operation can be simplified mathematically - nontrivial map-grep-map operations do occur.

I find the Ruby version clearer because it proceeds from left to right like a shell pipeline.

asher··on I don't like Python. Does that make me a bad person?
All the popular scripting languages "do" the same things. But I prefer Ruby to Python (while still liking Python) because it feels more programmer-friendly.

    Ruby: a = %w( apple pear orange )
    Python: a = [ "apple", "pear", "orange" ]

    Ruby: a=%q/O'Malley says "Hello"/
    Python: a = "O'Malley says \"Hello\""
Python lets you use "'" or '"' as the delimiter, which solves 80% of these cases - but why not generalize the concept, as Perl and Ruby did?

In Ruby, the last expression in a function is the return value; in Python you must use the return keyword, even though there's no ambiguity.

asher··on The Myth of the Underachieving Genius
It would be wise to approach this topic with some detachment, as if debating whether red or black ants have longer lifespans.

There is a risk of feeling one's self-image threatened by this thesis (and its opposite). That perception of threat often ends rational thought.

I think we all suspect that any correlation, positive or negative, between GPA and programmer "value" is merely aggregating several trends which may oppose each other.

Thus, there may be a current of brilliant, rebellious tinkerers who never get good grades but write good code; there may be a current of lazy underachievers who get bad grades and write bad code.

And people change with time. Someone who gets bad grades at 19 but writes great code at 29 may have changed into a "good grades" type.

I'm not sure we'd even agree on what a good programmer is. The truly bad is obvious, but one man's elegant virtuosity is another's unfixable nightmare.

asher··on That Old College Lie
Many of my professors clearly thought it sucked.

But the really good and memorable ones took the job seriously and seemed to have a lot of fun.

Since I was in an engineering curriculum, I didn't notice many unmotivated students. Anyone like that washed out pretty early.

I don't think teaching inherently sucks. I think universities have let people into the profession who lack either the skills or the motivation, since teaching is seen as secondary to research.

asher··on 80legs sets its web crawler free
Hpricot for Ruby is great.

For instance, parsing a Google search results page:

        (doc/"a.l").each do |link|
            label = link.inner_text
            href = link.attributes['href']
            ...
asher··on Ask HN: Common Lisp vs Clojure for web apps?
Good points, KD. Clearly, you've been there. Is there a good writeup somewhere of the deviations from "nice" web design that are needed?
asher··on How Dubai's burst bubble has left behind the last days of Rome

  and blest are those
  Whose blood and judgement are so well co-medled,
  That they are not a pipe for Fortune's finger
  To sound what stop she please
--Shakespeare

Prices rise and fall; durable institutions endure. It's easy for some liberal arts student to write a gloomy article poetically comparing a tall building to a needle bursting the bubble.

It's harder to really understand the economic and strategic drivers behind Dubai. I certainly don't.

My hunch is that Dubai is a durable institution. Specific players, like Dubai World, may perish or be mauled. But the buildings they left behind will probably endure, with tenancy rates and rents rising and falling as Fortune plays various tunes.

asher··on How To Identify A Lame Programming Job
I think this list is more valuable to employers than to candidates. Employers should be sensitive to the many hot buttons candidates have. Most of them are proxies for appreciation and trust. Treat every touchpoint as a chance to show your employees appreciation and trust.

For candidates, however, I'd advise focusing more on the big picture. Monitors are not a strategic issue. At one company I simply brought in my own 21" CRT rather than argue it. At another, I bought my own RAM and disk to upgrade my workstation.

A candidate who is focused on these minor concerns might come across as selfish, myopic and high maintenance.

Again, as an employer I would absolutely cater to these concerns. But as a candidate I would try to forget them.

asher··on "Stop building lame business applications"
I agree. When I worked on Cisco's printing system, CEPS, we sometimes heard from users who wanted to lock down a particular printer so that "outsiders" couldn't use it.

We never implemented that feature. CEPS provided usage logs, and if a user felt that someone was hogging or abusing a printer, he could simply talk to the abuser.

That's much more likely to have a successful outcome for the company than putting up a technological barbed wire fence across someone's path.

asher··on The hidden meaning of the hidden Starbucks logo
I agree. The author has an interesting theory, but he needs to dig up some real facts to support it.

As you point out, his solidest fact undermines his theory.

I wonder if there is a "brand backlash"? And if it's temporary, and linked to the recession? I think that within an individual's life, the power of brands goes down over time. Maybe as the author and his friends get older, they are feeling less compulsion from brands?

asher··on Starbucks (and Sameness)
I haven't seen any real data. I think that Starbucks has the data, and knows to a tenth of a percent how many people would prefer an independent shop, all other factors being equal.

It also seems that the appeal of the independent shop varies by location. Certain demographics will value authenticity, local ownership and funkiness.

We should beware the temptation to generalize from our own preferences, or from those of our friends.

From personal observation, when a Starbucks is near an indie shop, they are usually doing about the same volume of transactions. It may be 65/35 or 35/65, but I haven't seen 90/10.

Has anyone?

asher··on The dark side of Dubai
Thank you, Lionhearted, for gently bringing some maturity and perspective to this thread. Dubai is an amazing and special place, not to be dismissed lightly and put into some prefab category.

A friend is working there now. He loves Dubai because it rewards hard work. He finds the pace faster than in the US. More buildings going up, more vision, more investment, and less red tape.

I hope that whatever economic problems Dubai has will soon be resolved. And I trust that over time Dubai will solve some of the problems which annoyed this author.

asher··on Accessing GMail through Python
The best answer might be Lamson, by Zed Shaw:

http://lamsonproject.org/

An extensible SMTP server in Python.

You might still have to write some email-specific plugins, but they would probably be reusable. For instance, a CSV-receiver plugin that inserts rows into MySQL.

← PreviousPage 2 of 3Next →