Sunday, June 9, 2013

JIT compiling


Why doesn't Python use curly braces(for blocks of code)?

If you've used Python at all you know that it uses indentation to denote blocks instead of curly braces. Theres a couple reasons for this but it boils down to the Don't Repeat Yourself(DRY) principal.

How is using braces repeating yourself?

Well you've probably worked in a language that relies on braces for scope since most of the most common languages do this (Java,C,C++, Javascript, PHP,etc.). When working with one of these languages have you ever had to refactor legacy code that wasn't indented properly? Although the code has braces, we can't easily figure out what is going on. Where does one method end and the other one begin? The first thing you probably did was use the auto-indent feature in your trusty IDE so you could at least get a high level idea of the format of the code.

So it ends up that those curly braces didn't help you much. And they shouldn't because they really aren't for you. They are for the compiler. You see blocks of code in terms of indentation. The compiler interprets blocks of code based on braces. There's no reason to have both.

Monday, May 27, 2013

Scala Highlights








Sunday, May 26, 2013

Piping to diff

diff file1.txt file2.txt


./program  | diff file1.txt -

This will diff the output of program with file1.txt


The solution is redirection:

much nicer than creating intermediate files

Friday, May 24, 2013

Design Pattern: Facade


 public class PeanutButter implements Spreadable{  
 public class Jelly implements Spreadable{  
 public class Bread{  
 public class Knife {...}  
 public class Jar{ ...}  

So a client could make a sandwich like so:
 public static void main(String[] args) {  
     Bread slice1 = new Bread();  
     Bread slice2 = new Bread();  
     PeanutButter pb = new PeanutButter();  
     Jelly jelly = new Jelly();  

 public class PBJSandwich(){  
   public void make();  
 public static void main(String[] args) {  
    PBJSandwich sandwich = new PBJSandwich();  

Thursday, May 23, 2013

HTTP Preflighting



Access-Control-Request-Method: POST
Access-Control-Request-Headers: X-PINGOTHER


Access-Control-Allow-Headers: X-PINGOTHER
Access-Control-Max-Age: 1728000

More detailed information can be found here:

Friday, May 3, 2013

What is Data Science?


First topic, what is Data Science?





Friday, April 26, 2013

Courage is not the absence of fear

Julian Assange from WikiLeaks and Google CEO Eric Schmidt got together to talk about various topics of technology and information. A great listen

The audio and transcript are here:

A couple brilliant nuggets from Julian:

"I mean, people often say, you are tremendously courageous in doing what you are doing, and I say, no no you misunderstand what courage is. Courage is not the absence of fear. Only fools have no fear. Rather courage is the intellectual mastery of fear by understanding the true risks and opportunities of the situation. And in keeping these things in balance. And not simply having prejudice about what the risks are. But actually testing them. There are all sorts of myths that go around about what can be done and what cannot be done. It is important to test. You don't test by jumping off a bridge. You test by jumping off a footstool, and then jumping off something a bit higher and a bit higher."

"and because we all only live once, we all suffer the continuous risk of not having lived our life well. Every year. Every year that is not used is 100% wasted, it's not a risk of that, it is a dead bet."