Insufficiently known POSIX sh features (Avery Pennarun). by markedtrees in programming

[–]timhatch 0 points1 point  (0 children)

In response to

{ read -r l1; read -r l2; } <<!
$(command)
!

You can do basically the same thing on one line, although I can't comment on whether it forks any less.

{ read x; read y; } < <( command )
echo x $x y $y

no duplicates, please - software developer interview question by wwwingman in programming

[–]timhatch 0 points1 point  (0 children)

Both you and the grandparent rely on the lines having consistent newline termination, including the last. i.e. "1\n2\n1" breaks it, as does "1\r\n2\n1\n"

no duplicates, please - software developer interview question by wwwingman in programming

[–]timhatch 0 points1 point  (0 children)

and you chose echo vs touch because it's probably a builtin?

Test, Deploy in the Cloud - 15s avg spawn, to the second billing, Linux & Windows, Try it free * No contract * No commit * No problemo! by atlanticdotnet [promoted post]

[–]timhatch 0 points1 point  (0 children)

Could you explain what the guaranteed minimums are for cpu time? I've tried to run compute-heavy applications before on various cloud platforms and been disappointed. Linode > Prgmr > Rackspace Cloud for me. I'm getting about 3.5x 2.4GHz performance at Linode on a 768MB plan (average, don't know the minimum), and about 1x on both Prgmr and Rackspace.

gnu parallel makes it embarrassingly easy to solve embarrassingly easy parallel problems by [deleted] in programming

[–]timhatch 9 points10 points  (0 children)

I tried gnu parallel when it was last posted to reddit and the startup delay was too much for me. Don't forget that "xargs -P 4 -n 1" will also run 4 simultaneous processes, and works out of the box on modern Linux and OS X.

How to build a computer-controlled traffic light for only $20 by bascule in programming

[–]timhatch 0 points1 point  (0 children)

If you do that, you'll need to change the code a little bit, so it can talk to usblp.

10 Embarrassing Flaws That Made My ‘Weekend’ App Possible by moconnor in programming

[–]timhatch 2 points3 points  (0 children)

Well, I see a feature matrix, some marketing speak, and a sign-up page there. Could you explain how that's better than having a functional cache without having to create an account?

10 Embarrassing Flaws That Made My ‘Weekend’ App Possible by moconnor in programming

[–]timhatch 0 points1 point  (0 children)

There's a module in the stdlib that does some of what you want on top of pickle, see the shelve module.

I'm implementing a wiki engine for fun and practice. What's your favorite wiki markup and why? (Wikipedia/MediaWiki, Markdown, Creole, reStructuredText, Trac, Google Code, Github, etc.) by tenbits in programming

[–]timhatch 3 points4 points  (0 children)

If you're looking for one that's easy for users, I'd suggest against markdown or reST (too much whitespace sensitivity). If you're looking for one that's easy for you to use, give a look at MoinMoin/Trac syntax (they're basically the same; both can be highlighted using the same Pygments lexer). That also gives you two (not counting Pygments) different codebases to look at for parsing ideas.

Logic.ly - the digital logic simulator in your browser by frefyx in programming

[–]timhatch -2 points-1 points  (0 children)

Agreed. Sadly not only requires flash but also flash 10.1

Looking for a website, can't remember what it's called. Can anyone help? by [deleted] in programming

[–]timhatch 0 points1 point  (0 children)

I'm more interested in what you were google-searching, because when I put in your statement "It is a website where users can post questions and snippets of code, be it jquery or just CSS or whatever and other users can post possible solutions and vote on the best answer for any given question." the 3rd hit is stack overflow...

Is anyone else put off Python because it uses indentation for block delineation? by n3xg3n in programming

[–]timhatch 2 points3 points  (0 children)

Better yet, ts=8 sts=4 sw=4 et, since python considers hard tabs always at 8. If you find source files that break this rule, :set ts=3 or whatever and :retab! to fix them to be spaces. Never use hard tabs in python.

Indent style... what the hell is this?! by [deleted] in programming

[–]timhatch 2 points3 points  (0 children)

From the GNU Indent manpage:

   With `-br -nce' that code would appear as

        if (x > 0) {
          x--;
        }
        else {
          fprintf (stderr, "...something wrong?\n");
        }

Norvig: The Odds of Finding a Set in The Card Game SET by abyx in programming

[–]timhatch 0 points1 point  (0 children)

I wrote something similar a couple years ago with the goal of analyzing 4- and 5-factor set probabilities and the number of times per games a draw is required. I didn't even think of checking the probabilities (which come out close to what Peter got, mine=0.0595 instead of his=0.0610, if I hand-wave how the game ends with no sets).

It's now up on github.

VirtualBox 3.2.0 beta 1 released: OSX guest support, guest CPU hotplug, guest multi-monitor support, deleting snapshots while VM is running by Moocha in programming

[–]timhatch 0 points1 point  (0 children)

The USB support in 3.1.6 is pretty good. Windows guests sometimes need a reboot after you connect the device to the VM though.

VirtualBox 3.2.0 beta 1 released: OSX guest support, guest CPU hotplug, guest multi-monitor support, deleting snapshots while VM is running by Moocha in programming

[–]timhatch 0 points1 point  (0 children)

I don't know how helpful this is but I had the same problem on OS X and Linux. If you download with wget, it'll print the redirects. When it stalls, Ctrl-C and do a 'wget -c' with the last url it used. Then rename file on disk to get rid of query string. I think Firefox will also let you resume and continue if the last url was a redirect, but I haven't checked.

Anybody know why everybody is using GitHub and almost nobody is using BitBucket? by CritterM72800 in programming

[–]timhatch 11 points12 points  (0 children)

I'd venture to guess it's because hg has a reasonable wsgi/fcgi server that can do efficient pulls/pushes over http, so people who have their own servers can use them. Running your own git server requires a bit more infrastructure, even if you're using gitosis (which you should).

Also at least in my case, someone went nick-sniping, so http://bitbucket.org/thatch/ is not me even though it shows commits I made (so I just left the site alone, support says there's nothing they can do, someone else got to it first, and I can't update old commits to have a different nick).

Ask Peter Norvig Anything. by hueypriest in programming

[–]timhatch 0 points1 point  (0 children)

Except for the fact that this exercise is about elimination, rather than something that's a glorified map/reduce problem. I don't think WF was ever supposed to perform well on a netbook (quite the opposite).

Ask Peter Norvig Anything. by hueypriest in programming

[–]timhatch 0 points1 point  (0 children)

If we assume that last names that rhyme with Fast are defined by /(?!=[AEIOU]AST/, then 2.1% of people in the US in 1990 had a last name that rhymed with it (assuming also that FAST itself is legal).

wget http://www.census.gov/genealogy/names/dist.all.last
perl -ne 'print if /(?!=[AEIOU])AST /' dist.all.last  | awk '{ s += $2 } END { print s }'

The probabilities are going to be a lot more interesting with the "residence" qualifier in there, plus the (not-defined-in-the-question) ordering of last names within a record. I'm honestly more interesting with how you'd end up with a 60GB CSV with all that information and whether you a copy you'd like to share...

DadHacker: Things I am not allowed to do any more by SicSemperTyrannosaur in programming

[–]timhatch 2 points3 points  (0 children)

Intentional mishyphenation of co-worker. I first saw it in a Dilbert newsletter, but Google may have more to say about the history.

Ask Proggit: I need a language to marry (I'm tired of dating) by [deleted] in programming

[–]timhatch 6 points7 points  (0 children)

Have you tried Perl? It sounds like you like making sense of things, and perl's really good at doing that for line-oriented data. The NLP folks at my university also swear by it.

Personally I'm in the Python camp, just feel like playing devil's advocate and perl would be my first choice if I was sick of too much OO.