Better HN
topnewbestaskshowjobs
Log inSign up

jcsalterego

4,272 karma · joined Apr 27, 2009 (17y ago) · 373 submissions

Submissions

121.

Person Finder: Christchurch Earthquake, February 2011(christchurch-2011.person-finder.appspot.com ↗)

48 points · by jcsalterego · 15y ago · 12 comments

comment 15y ago · link · parent

Great overview, from top to bottom.

Just wondering, is it better performance-wise to explicitly check for key membership than to rely on exceptions?

Existing:

  for line in sys.stdin:
      name, marks = line.rstrip().split('\t')
      try:
          if agregatedmarks.get(name):
              agregatedmarks.get(name).append(marks)
          else:
              agregatedmarks[name] = [marks]
      except ValueError:
          pass
Or

  for line in sys.stdin:
      name, marks = line.rstrip().split('\t')
      if name in aggregatedmarks:
          aggregatedmarks.append(marks)
      else:
          aggregatedmarks[name] = [marks]
This is a common idiom I find myself using (append to an existing list or creating a new one in a larger dict).

comment 15y ago · link · parent

As in the Duran Duran song

comment 15y ago · link · parent

The Photoshop basics get me around for casual UI mocking -- layers, blending options, gradients, free transforms -- but I haven't mastered the shapes or pen tool in PS.

Illustrator is where I head for scalable vector stuff (duh). Despite having seen some crazy, crazy awesome wizardry with the Photoshop pen tool, in AI the pen tool is much more manageable and powerful IMHO, especially in conjunction with the all-powerful Pathfinder.

comment 15y ago · link · parent

"...and my database goes to meet the great truncate in the sky" -- I'm stealing that.

comment 15y ago · link · parent

Cheers for the clarification.

comment 15y ago · link · parent

I concede to your first point. Not sure where the second part is coming from.

comment 15y ago · link · parent

I'm seeing this everywhere else on my internets, but I will have to play the "OT for HN" card.

comment 15y ago · link · parent

Yeah, the example is more for hyperbolic illustration than anything else. My actual use case is that I've got a lot of IP addresses, different usernames and non-standard ports across various servers, so it's incredibly convenient to have my .ssh/config all set up.

With aliases (and zsh completion support for aliases), I can do "ann<tab>" which saves me even more time.

It won't be long before all I have to type is tab :)

comment 15y ago · link · parent

I use this all the time. It's amazing.

comment 15y ago · link · parent

That sounds about right.

Good tip about TRAMP, although I tend to exit out of my emacs sessions frequently. For my long running ssh tunnels, I just screen them.

comment 15y ago · link · parent

The only issue I had with ControlMaster, IIRC, was that when I killed the original connection, it would take everything else down with it.

There's a good chance I was just doing it wrong™ though.

comment 15y ago · link · parent

Cheers for pointing that out.

I haven't taken the time to figure out key agent -- for shame! -- although I would be interested in a write-up.

134.

Getting Comfortable With SSH(jcsalterego.github.com ↗)

100 points · by jcsalterego · 15y ago · 44 comments

comment 15y ago · link · parent

There's a lot to be said about the potential of the WebKit HTML/JS portion of AIR that's far less used than the Flash or Flex counterparts.

In my experience, the lack of a sane garbage collector burned me in the end. I believe the reasoning was that Flash apps were ephemeral, from page load to page load, and definitely not meant for a desktop application with a long life.

It was very hard to ever really free memory, and I remember writing a fairly straight-forward AIR app which would start at 70MB RSS, and balloon to 1GB the next morning.

comment 15y ago · link · parent

Clearly there is an ordering between commits -- parents and children -- but I don't see commits as having much temporal value.

Branches and commits can be merged and rebased left and right, and it only seems to follow that commits have an intrinsic state that's (not to be cliché) timeless. Patches and commits, regardless of when they're written, provide changes and accomplish X Y and Z -- it's only when one runs the code that time comes into play.

Semantics, I suppose, or I have had too much coffee this morning.

137.

Small talk sucks, or how to have a conversation with anyone(deeringdavis.wordpress.com ↗)

8 points · by jcsalterego · 15y ago · discuss

comment 15y ago · link · parent

Not saying it would take me less time but damn, it took the retired CIA code breaker "several weeks" to solve?

comment 15y ago · link · parent

And here I was expecting some sort of NFA simulation by a DFA :)

comment 15y ago · link · parent

1. Non-terminated comment

Use a sane editor with syntax highlighting.

2. Accidental assignment/Accidental Booleans

I always wrap my assignment-conditionals with double parentheses. It sucks when you miss these but I usually type out the right sequence of equal signs when I mean equality.

3. Unhygienic macros

Treat macros like a search-and-replace with a little more intelligence, but respect how literally the pre-processor might take you for. So, add parentheses.

4. Mismatched header files

I've not encountered this before, so I can't comment on it. Be careful with namespaces.

5. Phantom Returned Values

Luckily, gcc -Wall returns: warning: control reaches end of non-void function

6. Unpredictable struct construction

Can't comment on this one either, although I avoid literal assignments given in the example like the plague.

7. Indefinite order of evaluation

The example code just looks messy.

8. Easily changed block scope

Always use curly braces, that's what I say.

9. Permissive compilation

Not sure in the example why one would just remove the CALLIT macro and assume things to work. Of course, the comma in C means something. Not sure why one would put an assignment before a case in a switch either.

10. Unsafe returned values

This is certainly expected!

comment 15y ago · link · parent

Man, I had his "Good Quotations" page [1] bookmarked for the longest time, like seven years ago.

[1] http://www.cs.virginia.edu/~robins/quotes.html

comment 15y ago · link · parent

It's a poor man's CAPTCHA.

comment 15y ago · link · parent

This reminds me of Briefs: https://github.com/capttaco/Briefs

comment 15y ago · link · parent

Jokes!

comment 15y ago · link · parent

You should hit up http://cafebedouins.com and http://opencoffeeaustin.org.
1
456
13