Hacker Monthly
Total Page:16
File Type:pdf, Size:1020Kb
Issue 35 April 2013 The Absolute Beginner’s Guide to Arduino Engineers rebuilding the infrastructure that powers finance. careers.addepar.com package DDG::Goodie::Unidecode;# ABSTRACT: return an ASCII version of the search query use DDG::Goodie; use Text::Unidecode; zci is_cached => 1; zci answer_type => "convert to ascii"; triggers startend => "unidecode"; handle remainder => sub { my $u = unidecode $_; # unidecode output some- times contains trailing spaces $u =~ s/\s+$//; return $u; }; 1; package DDG::Goodie::Rot13; # ABSTRACT: Rotate chars by 13 letters use DDG::Goodie; triggers start => 'rot13'; handle remainder => sub { if ($_) { $_ =~ tr[a-zA-Z][n-za-mN-ZA-M]; return "ROT13: $_"; }; return }; zci is_cached => 1; 1; package DDG::Goodie::Base64; use DDG::Goodie; use MIME::Base64; use Encode; triggers startend => "base64"; zci answer_type => "base64_conversion"; zci is_cached => 1; handle remainder => sub { return unless $_ =~ /^(encode|decode|)\s*(.*)$/i; my $command = $1 || ''; my $str = $2 || ''; if ($str) { if ( $command && $command eq 'decode' ) { $str = decode_base64($str); $str = decode( "UTF-8", $str ); return "Base64 decoded: $str"; } else { $str = encode_base64( encode( "UTF-8", $str ) ); return "Base64 encoded: $str"; } } return; }; 1; package DDG::Goodie::Chars; # ABSTRACT: Give the number of charac- ters (length) of the query. use DDG::Goodie; triggers start => 'chars'; zci is_cached => 1; zci answer_type => "chars"; handle remainder => sub { return "Chars: " .length $_ if $_; return; }; 1; pack- age DDG::Goodie::ABC; use DDG::Goodie; triggers any => "or"; zci answer_type => "rand"; handle query_parts => sub { my @choices; my @collected_parts; while (my $part = shift) { if ( lc($part) eq 'or' ) { return unless @collected_parts; push @choices, join(' ', @collected_parts); my $length = @collected_parts; return if $length > 1; @collected_parts = (); } elsif ( $part ) { push @collected_parts, $part; } } push @choices, join(' ', @collected_parts) if @choices && @collected_parts; return if scalar(@choices) <= 1; my $choice = int(rand(@choices)); if (my @duck = grep { $_ eq 'duckduckgo' || $_ eq 'duck' || $_ eq 'ddg' } @choices) { return $duck[0]." (not random)", answer_type => 'egg'; } return $choices[$choice]." (random)"; return; }; 1; package DDG::Goodie::PublicDNS; use DDG::Goodie; use Now you can hack on DuckDuckGo DuckDuckHack Create instant answer plugins for DuckDuckGo duckduckhack.com 3 Curator Hacker MONTHLY is the print magazine version Lim Cheng Soon of Hacker News — news.ycombinator.com, a social news website wildly popular among programmers and startup Contributors founders. The submission guidelines state that content Martin Legeer can be “anything that gratifies one’s intellectual curios- Andrew Chalkley ity.” Every month, we select from the top voted articles Grant Mathews on Hacker News and print them in magazine format. Bryan Kennedy For more, visit hackermonthly.com Patrick Wyatt Pete Keen Craig Kerstiens Amber Feng Advertising Published by Alex Baldwin [email protected] Netizens Media John Biesnecker 46, Taylor Road, Rachel Kroll 11600 Penang, Contact Malaysia. Proofreaders [email protected] Emily Griffin Sigmarie Soto Ebook Conversion Ashish Kumar Jha Printer MagCloud Cover Photo: Beraldo Leal [flickr.com/photos/beraldoleal/6297076850] Hacker Monthly is published by Netizens Media and not affiliated with Y Combinator in any way. 4 Contents FEATURES 06 How I Created a Matrix Bullet Time-Style Rig By MARTIN LEGEER 12 The Absolute Beginner’s Guide to Arduino By ANDREW CHALKLEY PROGRAMMING SPECIAL 16 From AS3 to Haxe 36 Goldeneye 64’s Inspirational Startup Story By GRANT MATHEWS By ALEX BALDWIN 19 My First 5 Minutes On A Server 37 The Joys of Having a Forever Project By BRYAN KENNEDY By JOHN BIESNECKER 22 Whose Bug Is This Anyway? 38 Avoiding “The Stupid Hour” By PATRICK WYATT By Rachel KROLL 28 How I Run My Own DNS Servers By PETE KEEN 30 How I Work With Postgres By CRAIG KERSTIENS 34 Building Stripe’s API By AMBER FENG Arduino Photo: Pete Prodoehl [flickr.com/photos/raster/5933659066/] For links to Hacker News dicussions, visit hackermonthly.com/issue-35 5 FEATURES How I Created a Matrix Bullet Time-Style Rig By MARTIN LEGEER 6 FEATURES ACK IN MARCH, a client for laugh for a little while. Then I asked This was a bit funny because the whom I’ve done some light if he was serious. I saw from the only thing I know that makes con- Bconsulting work asked me look on his face that he really did trast (light-wise, not color-wise) is a if it was possible to capture a 360- want me to build the rig there, so shadow. But sure, let’s make history. degree image that can be rotated my next reaction was, “I have to Another request he made was afterwards. I said of course, but I think about it.” to make it as easy as possible for didn’t think that much about the Don’t get me wrong, I’m up for further retouches, since he planned consequences — it’s a project that any badness, but this was beyond to use the rig extensively. would wake me up at night for the crazy and bananas. I took a few days to think about next few months. The next day, we sat down in what direction I would go with Everything was fine until the a restaurant and started talking the project — things like lighting moment he showed me the room I about this a little more — what his the subject, the background, the was supposed to make the rig in — vision was, what look he wanted to fluency between the photos — the it was his villa. achieve, and so on. What I ended distance between the cameras, This type of project is generally up with was that he would like to subject, camera count — just about done in warehouse-sized spaces, have a shadowless photo on a white everything. I’ve seen quite a few and there are good reasons for that background with maybe some results from “bullet time” systems (lighting being one of them). Well, contrast in there, but definitely all around the world, so I knew this was a garage about 130-square- shadowless. what things and results I would like feet in area and a ceiling about 8 to avoid, especially with my white feet tall. My first reaction was to background. 7 I came up with some ideas, but the outside with big octas around. light would bounce around like just to be sure, I called my friend However, we moved on from this crazy (eliminating shadows). Daniel over (he’s pretty much at idea because there were so many We started putting together the the same technical level as I am) to issues we had to address (possible precise lighting setup. We wanted to have somebody to bounce ideas off. flares, the quality of the image due give the client the option of using From that moment on, the concept to the lighting, how to spread the other styles of lighting for non- just grew. light evenly from the close distance, shadowless photos, so we arranged The next day, I called the client tension of the diffusing textile, the 6 lights on the ceiling in a circular and accepted the challenge. I asked possibility of someone damaging formation. for an advance before putting the textile, etc.). For those of you wondering everything together, making phone I called another colleague and about the brand of the lights, I calls, etc. just to be sure there we came up with the idea of normally shoot with Profoto, but would be no trouble afterwards. I making a cylinder, which we could I chose to go with Elinchrom this got the advance the very same day paint from the inside and repaint time (to save some money). Elin- (to my surprise) and then we got if necessary in the future. The only chrom satisfies the requirements for started. problem we had to solve with professional use, since it has such a Since we had so little space to this new design was how to light consistent amount of light, consis- make the rig on (mainly due to the it from within. Since the request tent color temperature, etc. low ceiling), my initial idea was to was to have a subject on a white put up some kind of a diffusing tent background, we decided to build around the subject and light it from it completely in white so that the 8 FEATURES So that was step one. Step two the cameras, and there is currently once, it has a slight delay between was putting together a list of no software on the market (that I the cameras — like 1/5s between the gear we needed to buy. You am aware of) that can do the job (at each camera. wouldn’t believe how much trouble least at the time we did this proj- This was a big issue for us it was to simply find a seller who ect). Maybe there is, but I couldn’t since we needed to sync the flash was able to send us 50 cameras find it. between the 50 cameras as well (we and prime lenses to the middle There were potential programs can’t light it with other types of of Europe. It was unbelievable. If we could use, but they were written lights, lest we fry the person in the it were Canon 5D MKIIIs, Nikon for Linux. I also could have had cylinder). D800s, or something of that class, programmers around me write the Just like Leonardo DiCaprio in that would be understandable, but software, but that would have taken Inception, we had to go deeper. Canon 600Ds? Come on! weeks or months, which we didn’t Finally, we reached the best and We chose the cheaper Canon have. simplest solution. Since each DSLRs over other brands simply We eventually found a single camera can be fired via a cable due to budget constraints.