RSS
 

JavaScript: 2011 Technology of the Year

01 Feb

JavaScript had a great year in 2011. Here are some of the best moments for JavaScript last year, in no particular order:

-Adobe killed Flash on mobile devices and will start the transition of their web technologies to HTML5/CSS/JavaScript here.

-Microsoft killed Silverlight as their cross platform runtime environment to focus on HTML5/CSS/JavaScript here.

-Microsoft announced that “metro style” apps for Windows 8 will be built in JavaScript/CSS/HTML. More about it here.

-Adobe acquired Nitobi (Creator of PhoneGap), and donated PhoneGap to Apache Foundation. This move could make  PhoneGap a standard for mobile development here.

-Rails 3.1 adopted CoffeeScript causing great controversy and the most colorful Github page ever here.

-There was always a cool new JavaScript project on the first page of Hacker News. Here’s some of the best I remember:

J-OS – JavaScript operating system

JS Linux – Boot a Linux kernel right in the browser.

Broadway.js – H264 decoder in JavaScript.

pdf.js – PDF reader in JavaScript.

JavaScript IDE- Create web apps in JavaScript right from your browser.

There you have it and jQuery was everywhere. I write this as a Ruby/Unix guy, who thinks JavaScript had an extra-ordinarily great year. I may have missed other important moments. Feel free to add more in the comments.

It’s equally important to give credit to the players that helped make JavaScript the Technology of the Year. I will list them below:

  •  The Open Source community:  For all the awesome  wizardry.
  • Google: For moving the open web forward, supporting the FOSS community and releasing great open source technologies like Google Chrome and V8.
  • The Webkit Open Source project and Apple.
  •  Steve Jobs for excluding Flash on iDevices and selling HTML5 as the future of the open web.


Let’s have a toast for JavaScript.
 

Hey programmer, what is it that you do?

01 Dec

Sometimes, I simply can’t put a price on what I do.

Two years ago, I was kidnapped by monkeys, who appeared to be in a trance. They took me to the top of the Swayambhunath Buddhist complex, in Kathmandu. I was told that this was the Monkey Temple. As a monk translated the wishes of the holy monkeys, I discovered that I was required to rewrite the OS of their ancient computer, which had failed to reboot, back in 1839. Since then, they had searched the world for a programmer competent to handle the situation. They were about to give up, as they stumbled onto me, and realized that I was the reincarnation of ChiChu Gomptar, the lead programmer for the CS monkey gang, which had served their monkey king, the creator of this computer. I was flummoxed by its design, as it was made of smooth stones, uniform beads, colored sand, and wooden levers inlaid with gold. I told them that I couldn’t remember anything from my past life. They gave me something to smoke, saying that it would connect me, through the eternal ether, to my previous memories.

It did, and after 25 days of extreme programming, of which I recall no details, I had completed the monumental task. I stood up, and ceremoniously dropped the special IPL bead onto the machine, which then awoke from its 170-year slumber with a mighty roar. The holy monkeys were pleased. They handed over a small golden box, with mysterious carvings. It seemed empty, and I was told not to open it unless my circumstances had become truly dire. I thanked them, both for the box, and for the tremendous experience. Unfortunately, I was not able to sell them continued maintenance for their new OS, but that was mostly due to their language not having the word “maintenance”. Anyway, I have those memories, and this box to use when things go really bad, plus the always-present hope of future adventure.

This was a comment on hacker news. Original source: http://news.ycombinator.com/item?id=3146786

 

How to do a barrell roll

06 Nov

We have all seen Google’s barrel roll trick. The coolest thing about it is that, its done with simple CSS. To see the same effect, place your mouse over this blog post.

Source code for the Barrel roll:

.barrel_roll {
-moz-animation-name: roll; 
	-moz-animation-duration: 4s; 
	-moz-animation-iteration-count: 1; 
	-o-animation-name: roll; 
	-o-animation-duration: 4s; 
	-o-animation-iteration-count: 1; 
	-webkit-animation-name: roll; 
	-webkit-animation-duration: 4s; 
	-webkit-animation-iteration-count: 1; 
}
 
@-moz-keyframes roll { 
	100% { 
		-moz-transform: rotate(360deg);
	}
} 
@-o-keyframes roll { 
	100% { 
		-o-transform: rotate(360deg); 
	} 
} 
@-webkit-keyframes roll {
	100% { 
		-webkit-transform: rotate(360deg); 
	} 
}

Only works in modern browsers like Chrome, Firefox, Opera and Safari. I hope IE will catch up.
Source: http://www.metaltoad.com/blog/how-does-google-do-barrel-roll

 
 

When in doubt, do a barrel roll

04 Nov

So business guy is looking for a programmer to build his app. Here’s how the interview went.

Programmer: “I built a nosql database that uses javascript for queries. It even supports map/reduce. I also wrote a h264 decoder in javascript. I can build your twitter/google+/facebook social app.”

Business guy: “hmm I don’t think so. I’m looking for a rockstar ninja Rails and .net programmer.”

Programmer: “Ok watch this.”

Programmer opens his web browser, goes to google and types do a barrel roll.

Business guy: “Wow that is awesome!”

Programmer: “Hit refresh”

Business guy: “Wow dude, you’re HIRED!”

(Note: “do a barrel roll” works only on Chrome, Safari, Opera and Firefox. Try it when your pitch is failing. Good luck.)

 
 

CouchDB Security in Ruby

30 Oct

To get some background on couchDB security read here.

All the code samples below, require the Restclient rubygem. You can install it with the command:

gem install rest-client

And Require it in your code with:

require 'rest_client'

Let’s say your couchDB is in Admin Party mode. To end the admin party and add an admin user:

RestClient.put 'http://127.0.0.1:5984/_config/admins/james', '"ssstepin"',{:content_type => :json}

james is the name of the new admin, and his password is ssstepin. The password needs to be enclosed in double quote,to denote a string in the couchDB configuration.

To authenticate the admin user:

response = RestClient.post 'http://127.0.0.1:5984/_session', 'name=james&password=ssstepin',{:content_type => 'application/x-www-form-urlencoded'}
puts response.cookies
# => {"AuthSession"=>"b2tlOjRFQUJCNzE0OkXtpl9cxR_zbIxvlvW2J60txIwT", "Version"=>"1", "Path"=>"%2F"}

This returns the authentication token for making future requests, on behalf of the authenticated user.

To add a new admin user:

RestClient.put 'http://127.0.0.1:5984/_config/admins/david', '"wuzz234"',{:cookies => {"AuthSession" => "b2tlOjRFQUJCNzE0OkXtpl9cxR_zbIxvlvW2J60txIwT"}}

We added a new admin david with password wuzz234, we made the request on behalf of james (see the AuthSession token, we are using the same token generated for james).

To delete the new admin user:

RestClient.delete 'http://127.0.0.1:5984/_config/admins/david',{:cookies => {"AuthSession" => "b2tlOjRFQUJCNzE0OkXtpl9cxR_zbIxvlvW2J60txIwT"}}

We deleted the admin david, we made the request on behalf of james (see the AuthSession token). If you delete all admins CouchDB will switch back to Admin Party.

To create a non-admin user:

salt = "somerandomstring123"
password = "seenow109"
password_sha = Digest::SHA1.hexdigest(password + salt)
 
user_hash = { :type => "user",
                   :name => "nancy",
                   :password_sha => password_sha,
                   :salt => salt,
                   :roles => []
                  }
 
 
 str = Yajl::Encoder.encode(user_hash)
 
RestClient.put "http://127.0.0.1:5984/_users/org.couchdb.user:nancy", str, {:content_type => :json, :accept => :json}

We created the non-admin user nancy with password seenow109. The above code implements in ruby code the security features explained here. Note that non-admins are authenticated with the same API call as admins.

To create a new database with the authenticated admin user:

RestClient.put 'http://127.0.0.1:5984/contacts', {:content_type => :json},{:cookies => {"AuthSession" => "b2tlOjRFQUJCNzE0OkXtpl9cxR_zbIxvlvW2J60txIwT"}}

We created a new database called contacts. This request was made by the user james, notice the AuthSession token in the request.

To add a security object to the contacts database:

security_hash = { :admins => {"names" => ["nancy"], "roles" => ["admin"]},
                   :readers => {"names" => ["nancy"],"roles"  => ["admin"]}
                  }
security = Yajl::Encoder.encode(security_hash)
 
response = RestClient.put 'http://127.0.0.1:5984/contacts/_security',security,{:cookies => {"AuthSession" => "b2tlOjRFQUJCNzE0OkXtpl9cxR_zbIxvlvW2J60txIwT"}}

The above example uses the yajl-ruby gem to encode the ruby hash to JSON.

To add a new document to the contacts database with the authenticated user session

data = { :name => 'sunny',
         :email => 'sunny@winter.com'
         }
 
 str = Yajl::Encoder.encode(data)
 
 RestClient.put "http://127.0.0.1:5984/contacts/sunny", str, {:cookies => {"AuthSession" => "b2tlOjRFQUJCNzE0OkXtpl9cxR_zbIxvlvW2J60txIwT"}}

We added a document with _id sunny to the contacts database. The above example also uses the yajl-ruby gem for json encoding.

I hope this was helpful. If you find any errors or have suggestions please let me know in the comments.

 
 

Best Video Game Trailer Ever: Dead Island

22 Oct

One problem I’ve always had with video games, is that they can’t connect with you emotionally, the way movies do. This game Dead Island maybe able to change that. Watch it’s trailer below;

It’s amazing how they told this very emotional story in 3 minutes. I’m not a gamer but I might try this game, even if it’s just to get back at those zombies for that little girl.

I hope the game lives up to expectations.

 
 

RIP Steve Jobs

06 Oct


I am going to miss Steve Jobs. He was like a modern day Walt Disney. Just a true innovator. Steve, you will be missed by this hacker and a billion others. Thank you for sharing your dreams with the world. Things will never be the same again.
Rest in peace great one.

 
No Comments

Posted in Business

 

It’s just some code you can’t use

06 Jun

Whats the point of Hackathons? You sit down and code for 24 hours. Eat junk food all night, drink lots of soda and red bull. Then end up writing a lot of bad code.

At hackathons, your M.O. is to write code that appears to work, it doesn’t matter how it works. Once you get a feature appear to be working, you move on to code other features. The problem with this type of code is that it doesn’t scale. It makes you feel like you have a working product, but you really don’t. It works fine when you have 10 users but it starts to fall apart when you get to 1000+ users and becomes huge mess when you get to 10000+ users. I think this is a pointless way to build software. You write a lot of code in 24 hours but you end up with a lot of code you can’t use later. You also learn a ton of bad coding habits.

The best thing to do at a hackathon if you must go, is to socialize with people while you work on your long term side project. Its a great place to meet new people and share ideas with them.


At the Techcrunch Disrupt hackathon.

 

Most Creative People in History Starring Conan O’Brien

25 May


(l to r) Madonna, Conan O’Brien, Steve Jobs, Moses, Teddy Roosevelt, Albert Einstein, Frida Kahlo, Socrates, Ben Franklin.
Source: www.fastcompany.com

 
 

Coder Girl – An ode to female programmers

05 May

…feels like my first hello world
what it is to run with a coder girl
and it ain’t hard to like how she writes
with her pretty interface, plus her source is tight
wanna get in where I fit in like a plug-in
this is the true meaning of computer lovin’…

Pass this on to your coder girl. Check out more videos here: www.youtube.com/dalechase
This song hits the spot. I still remember my first ‘hello world’ written in QBASIC. It felt amazing. So I know exactly what he means in the song.

 
 
 
Premium Wordpress Plugin