Better HN
topnewbestaskshowjobs
Log inSign up

jcsalterego

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

Submissions

comment 17y ago · link · parent

Go Team Python!

272.

MySQL Connector/Python(launchpad.net ↗)

22 points · by jcsalterego · 17y ago · 14 comments

comment 17y ago · link · parent

And none of their wifi drivers work.

274.

Elastic Python deployment networks(tetamap.wordpress.com ↗)

3 points · by jcsalterego · 17y ago · discuss

275.

Pykeyview(panela.blog-city.com ↗)

1 points · by jcsalterego · 17y ago · discuss

276.

MarcoPolo - Context-aware computing for Mac OS X(symonds.id.au ↗)

3 points · by jcsalterego · 17y ago · discuss

277.

The Google Apps SLAs are pathetic(masivp.com ↗)

5 points · by jcsalterego · 17y ago · discuss

comment 17y ago · link · parent

I'm curious to know why, on that page, there are three vertical AdSense banners.

comment 17y ago · link · parent

Speaking of Sinatra and Python, have you seen http://github.com/breily/juno?

280.

JavaScript and Hardware Integration(blog.kevinhoyt.org ↗)

2 points · by jcsalterego · 17y ago · discuss

281.

Multi-Line Lambdas in Python Using the With Statement(billmill.org ↗)

44 points · by jcsalterego · 17y ago · 11 comments

282.

Eulogy to _why(ejohn.org ↗)

318 points · by jcsalterego · 17y ago · 92 comments

comment 17y ago · link · parent

Why is this on HN's front page? :(

comment 17y ago · link · parent

Sorry, these tracks got nothin on "Weezer - The 8-bit Album."

http://www.ptesquad.com/more/pte018.html

285.

Designing for Social Traction (slide deck)(bokardo.com ↗)

19 points · by jcsalterego · 17y ago · 1 comment

286.

VMware to Acquire SpringSource(marketwire.com ↗)

3 points · by jcsalterego · 17y ago · discuss

287.

Critique of pseudocode explanations of the Closest Pair Algorithm(paddy3118.blogspot.com ↗)

1 points · by jcsalterego · 17y ago · discuss

288.

Freenode #awk AWK FAQ(hibernia.jakma.org ↗)

1 points · by jcsalterego · 17y ago · discuss

289.

Introduction to Parbash(cloud-dev.blogspot.com ↗)

6 points · by jcsalterego · 17y ago · 1 comment

290.

The most possible True Random Number Generator(pyevolve.sourceforge.net ↗)

5 points · by jcsalterego · 17y ago · 2 comments

291.

HTML 5 Reset Stylesheet(html5doctor.com ↗)

1 points · by jcsalterego · 17y ago · discuss

292.

Tweetster - Wireless Tweets Display(blog.makezine.com ↗)

2 points · by jcsalterego · 17y ago · discuss

293.

10 Tips for iPhone Users at DEFCON 17(wikee.iphwn.org ↗)

1 points · by jcsalterego · 17y ago · discuss

294.

A is for Ajax and C is for Comet(leahculver.com ↗)

13 points · by jcsalterego · 17y ago · 16 comments

295.

Adobe Flash Vulnerability Affects Flash Player and Other Adobe Products(us-cert.gov ↗)

1 points · by jcsalterego · 17y ago · discuss

296.

Averse to Change(bryan-murdock.blogspot.com ↗)

1 points · by jcsalterego · 17y ago · discuss

297.

EngineYard Hashing Contest Post-Mortem(blog.quadpoint.org ↗)

3 points · by jcsalterego · 17y ago · discuss

comment 17y ago · link · parent

Unfortunately, I have no empirical data or to support that hard-coding in a payload has an advantage over a dynamic allocation. As an aside, the Python dictionary (hash table for you rubyists/perlfaces) works this way, as it over-resizes to allow growth, unless you specify its maximum size (__slots__ I think?)

My hope and understanding are that the compiler's static analysis skills will best align the given data, whereas something like malloc() would try to allocate on the heap as best it can with the open possibility of other data needing to be on the heap as well.

The point I was driving at, and what I tried to do, was to hard-code in as many known variables as possible such that the compiler could do its thing and try to be as efficient as it could with the given data. This includes the word list, the list of lengths, the target hash -- none of which has to be done by hand, but rather a higher-level script called before compilation.

Good times.

299.

Approximating Pi number using Genetic Programming(pyevolve.sourceforge.net ↗)

6 points · by jcsalterego · 17y ago · discuss

comment 17y ago · link · parent

Looking at the C code, here are a few suggestions:

- __builtin_popcount() and __builtin_popcountll() are great gcc builtins which perform bit population counts, useful for hamming distances (after the XOR operation, of course). [1]

- avoid scanf(), which is costly. My approach was to generate a header file with the char * words[] array, and also a int words_len[] with, you guessed it, the pre-computed lengths. Then go for the memcpy() route and you're in a much better position.

- speaking of memcpy, gcc provides one that should be optimal in most cases, but for really short words, it might be easiest to write your own. I came across a good article on it [2] but this is what I ended up using:

  void
  c_memcpy (char * dst, char * src, size_t len)
  {
    __builtin_prefetch(dst, 1, 3);
    while (len--) {
      *dst++ = *src++;
    }  
  }
[1] http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Other-Builtins.h...

[2] http://www.embedded.com/columns/technicalinsights/19205567

1
910111213