If you have noticed, the last couple of myposts are around Dart, the new programming language which allows you to create web applications. It is because, last weekend, the Bangalore GTUG group organized a one day hackthon on Dart and I was part of the judging panel for the event
I started playing around with Dart for a couple of weeks now and so far, I kind of like the language, even though there are couple of bugs and some major features missing. That’s understandable since the language is still a technical preview.
The following are some of the notable hacks from the hackthon
Snake Game by Sundar (it’s not Sudar )
It’s the classic snake game implemented in HTML5 using Dart. You can checkout a hosted version and the source code is available at github.
This is a charting library which allows you to create both pie and bar charts using Dart. You can checkout the source code in github.
Mocking library for Dart
It is a simple mocking library which allows you to write mocks to test Dart code. I personally liked this project very much.
GTUG Tbilisi is planning to have a Dart hackthon like the one we had in Bangalore and tonight I am going to do a hangout session with them going over the Dart language and how we did our hackthon. You can check out the slides which I prepared for the event below. You can also checkout my other presentations and slides from my talks page.
On the whole, Dart is a good language which you can use to create complex web applications. But it’s not yet ready for prime time use yet.
If you have used my WordPress readme generator you would have noticed that I have a “Save As” button, which when pressed allows you to download the file which was just generated by the PHP code. (In most browsers this opens the save file as dialog box)
Recently one of the readers of my blog asked me how to do this in PHP and I was about to send him the code snippet. But then I thought of writing a blog article so that it will be useful for others as well.
So here we go.
The code is mostly self explanatory. The important part in the above code snippet is the “content Disposition” header.
Also since we are sending headers to the browser, we should not have started the output before this code executes. Otherwise we might get a “header already sent” error.
Long time back, I was working in a project which required us to make a particular position of text unselectable by the user on a webpage.
I found this code while browsing through archives and thought of posting it here so that I know where to find it, if I need it and also it would be useful for others who want to do the same thing.
BTW, one quick disclaimer. Even I hate it when people make a particular position of text unselectable in a browser. So use it if it is really needed and also remember it is not fool-proof.
Recently, I wanted to play around with some stuff which is available only in PHP 5.3.x (more about it later in a separate blog post) and so was looking for a way to install it on my Ubuntu server, where this blog is running.
After poking around a bit, I found that Karmic Ubuntu hasn’t upgraded to PHP 5.3.x yet and the only way to do is to compile from PHP source. Even though I am pretty comfortable doing it, I didn’t wanted to do it, because it is very difficult to upgrade at a later point in time.
I was continuing my research and then found that it is in fact possible to install PHP 5.3.x though apt-get or aptitude. I thought of documenting it here, so that it would be useful for others who want to do the same thing.
Adding dotdeb to the source list
First you should add dotdeb repository to your apt-get source list. Add the following two lines to your /etc/apt-get/sources.list file
sudo vim /etc./apt-get/sources.list
Adding dotdeb keys to keyring
Dotdeb packages are GPGsigned. Issue the following commands to add the keys to key-ring
Install PHP5 packages
Then issue the following command to retrieve the updated package list. I am using aptitude here; you can use apt-get as well.
sudo aptitude update
sudo aptitude upgrade
And then you can install PHP5 packages (and modules) using the normal install command.
sudo aptitude install php5 libapache2-mod-php5
Installing php5-dev package
The above method will install all php5-* packages, but php5-dev has some dependency issues with libtool packages. In order to solve that you have to manually install libtool v1.5.26. To do that use the following commands.
Now it’s time to enjoy the new features that are available in PHP5.3
Just wrote quick some code sample to show how to access YQL (Yahoo Query Language) queries from PHP.
You can use the following code sample to fetch results from YQL from any standard PHP file. You would require the curl extension to be installed. If you are behind a proxy, uncomment the 3 lines and replace it with proper proxy values
If you have the Yahoo social SDK installed and you want to access results from YQL, then you can use the following code sample. Replace the text consumer_key and consumer_secret with correct values.
Adobe has been trying hard to build an ecosystem around Flex, which is a collection of technologies for the development and deployment of cross-platform rich Internet applications based on the Adobe Flash platform.
In order to woo more developers to use Flex, they are giving away free copies of Adobe Flex Builder. In order to get these free copies you have be
A student or a faculty or employed in an educational institution
A developer who is unemployed due to layoff.
To get these free copies all you have to do is just fill out a form at this link (student, unemployed)
Additional free resources
Together with free copies they are also offering the following
One of the good (and also bad) things in being a web developer is that you have to constantly keep (un)learning. Every time I learn a new trick (like changing the default editor in Ubuntu or searching Google efficiently) or get struck due to some bug or wired behavior, I used to document it here, so that I can refer to it later and also for that fact that it might be helpful for others who are searching for the same problem in Google.
Insert OMFG or variant thereof, about twenty times, at two in the morning. I’ve been fighting with WP all day to get it to do what I want, and the WP docs have been useless — maybe it’s just that most folks don’t really get into really doing wacky things like nested loops and whatnot, I suppose. I was about to give up when behold, the power of google dropped your post on my screen and NOW IT WORKS. I feel like a keyboard mash is due, or buying you a virtual drink, or SOMETHING. May have to settle for quietly dancing around the house in glee, given that it is two in the morning when most non-geeky souls are quietly abed. But not me! Must celebrate your awesomeness for helping me finally getting it to work! Thank you!!!
It was really a very nice feeling to know that you can make someone from the other side of the globe dance at 2 in the morning.
This comment has given me the much needed motivation to document the day-to-day learning’s of being a web developer. So guys, from now on, if I spend more than 5 minutes on fixing something I will document it here. I also strongly urge you guys to do the same thing in your blogs and if you don’t have a blog then you are always welcomed as a guest writer here
Update: Well guys, it’s time to reveal that the following post was my entry to April fool’s day. This post has been a hit and atleast a handful of people believed it. So guys, happy April Fool’s day to everyone
Yes, you read it correctly. IE 8.1 (code named Eagle Eyes) is going to support Firefox extensions. Smashing Magazine has a screenshot to prove it. The first time I came to know about it, I got goosebumps. (Yes really)
If this is true (and I believe it is), then this is the final nail in Firefox’s coffin. The only reason why I continue to use Firefox is because of it’s extensions.
Firefox has become too bloated due to it’s monolithic architecture and had become a huge memory hog. I checked my task manager as I am writing this post and you get the proof. This is with just 5 tabs open.
The major advantage Firefox had over other browsers is it’s huge list of third-party addons. But it cannot rest on it for long. Unless Firefox solves the issue with memory leaks, and comes up with some cool innovation, they cannot retain their market share. Let’s see how Firefox overcomes this new threat from IE.
In addition to supporting Firefox Addons, IE 8.1 also has other cool features like Multiple Browser Rendering Engine Options, Server-side code decompiler, Website Skins etc.
On a related note, even Google’s chrome is going to support third-party extentions. Matt cutts has a tutorial which explains that steps that you need to follow to create extentions for Chrome.
I attended WebCamp today as planned. It was good and there were talks about web frameworks like Ruby on Rails, Groovy on Grails, Django, Flex etc. Unfortunately I was not able to give my talk about jQuery as planned due to some issues with the timings. I was pretty disappointed at first; since it took me considerable amount of time to prepare for the presentation and added to that I drove for more than two hours to attend the event. Anyway that’s life isn’t? You will never know what life has for you the next second. If everything goes as planned, then life would be as dull as a recorded circket match. It is uncertainty which gives life to life (wow! I can make a quote too ).
Anyways to be positive I learned a lot of new things about jQuery when I did my research to prepare for the presentation, even though I have been using it for the past couple of months. Hope you guys also find my slides about jQuery useful.
I have uploaded the slide to slideshare and you can download it from there. I have also collected lot of links about jQuery during my research and I will post them soon. Update: You can find these links here.
There were some great presentations and I particularly liked the talk on Django by KG (Oops! I forgot to find out whether he has a blog). I also learned lot of good things about Ruby on Rails. More reasons for me to get my hands dirty with Rubyon Rails.
Special thanks to Prabhu and other organizers for a wonderful event.