Blog » Building an Indoor Helicopter
02 Apr 2012
For a while I have been thinking about getting an indoor helicopter and modding it with an on board computer, camera, wifi to make it fly autonomously and do interesting things with it.
However, getting a prebuilt copter has its limitations. Such as
- Helicopter not designed to handle the kind of payload you want
- It being very hard to make modifications
- In case of the helicopter being damaged it might be really expensive or impossible to repair
Thats why I want to create my own helicopter. I will admit it is not easy task, in fact even though I have a decent understanding of airplanes, many aspects of helicopters still bewilder me.
I came across an detailed account of how someone built a helicopter himself which is very inspiring, its the only such homebrew project I could find. To be honest I might have dropped the idea completely if I didn’t find this. Here’s a picture: 
Labs
Hence, I am on a quest to understand more about how they work and play with some of these. I should really get access to a hack space for this project. I like these two in Toronto:
Things I would need
- Airframe - This would be custom built but its a good idea to use parts from another helicopter that is popular
- On board computer - Im thinking a Raspberry pi might be a good idea, other possibilities are Gumstix and Ardunio
- Gyro & Accelerometer - I found a low-cost MEMS unit
- Camera - IP camera might be too big for this, I dont like analog cameras, so need to do more research here.
- Communication - I’d rather use wifi then using analog transmission. Ubiquiti Bullet is an interesting device that I have used before.
- Ground Control Station - I already created a software for this at AUS, I can modify it according to my needs.
- Books on the topic - Need to head to a good library (i.e. UofT)
Timeframe
This would probably take at least 2-3 years of spare time if not more, I’m already involved in a lot of stuff, but keep finding myself researching on miniature helicopters every now and then.
Blog » Brainwave Reading
02 Apr 2012
Ever since I watched a TED Talk, I forget which one, I have become fascinated by the possibilities of controlling things with thought and finding more about yourself.
I really want to get my hands on one the the brain reading headsets and maybe create an custom interface for my computer. It would be really cool to do even the simplest things like switching between windows. Think about terminal go to go to the last used terminal while programming, similarly switching to the code editor and webbrowser in itself would be really cool.
Here are two hardware products I came across that are available to consumers:
Mindwave looks less scary and is also a third the cost but Emotiv probably has better sensor.
Blog » Blogging like a boss
04 Mar 2012
I have been using wordpress to host my website for more than 5 years, its a great platform. I like it because it comes with lots of nice themes, a good number of plugins, is open source and I can freely edit and modify how my site looks.
However, I just switched to Jekyll which is a static site generator. It doesn’t come with a huge array of features like Wordpress but quite the opposite, its simple.
Its easier to use my own theme written from scratch, I don’t have to use a database, its easier to write posts using a text editor. With my new little website in place, I feel like I am going to write more often. :)
Blog » Rails upload files to AWS
01 Mar 2012
There is a very easy way to upload files to AWS S3, however you can easily get lost with different gems and options available. My favorite way is using paperclip with aws-sdk. Here are some quick steps to get you started, look at the gems homepages for more information.
Gemfile
gem 'aws-sdk'
gem 'paperclip'
Then run bundler
config/initializers/aws.rb
AWS.config({
:access_key_id => 'REPLACE_WITH_ACCESS_KEY_ID',
:secret_access_key => 'REPLACE_WITH_SECRET_ACCESS_KEY',
})
Example of what your model might look like:
class User < ActiveRecord::Base
has_attached_file :photo,
:storage => :s3,
:bucket => 'mybucket',
:s3_credentials => {
:access_key_id => ENV['S3_KEY'],
:secret_access_key => ENV['S3_SECRET']
}
end
Migration:
class AddPhotoColumnsToUser < ActiveRecord::Migration
def change
change_table :users do |t|
t.has_attached_file :photo
end
end
end
Note: has_attached_file does not seem to work with create_table
This is how to put it in your form
<%= form.file_field :avatar %>
You also need a create action in your controller. Assuming you used a scaffold, it should work just fine. Enjoy!
Blog » X number of fixed width divs side by side in a fluid layout
18 Feb 2012
In recent months, I have been experimenting a lot with fluid width layouts. As we now have devices with a range of screen sizes, to create a good user experience across all different resolutions, I think fluid layouts are the way to move forward.
One of the things, I got stuck with was displaying a number of fixed width divs on a fluid layout such that each row has the maximum number of divs it can take. In my initial version, everything floated to the left, but i finally figured out how to center the divs.
Style:
#container {
text-align: center;
}
.box {
width: 300px;
height: 300px;
margin: 10px;
background-color: #ccc;
vertical-align: top;
display: inline-block;
*display: inline; /* IE6 */
zoom: 1
}
HTML:
<div id="container">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
This is especially useful as lists are becoming more visual, for example each blog post having a picture associated with it.
Blog » Too Much Noise
22 Jan 2012
Over the last couple of months, I have realized that I have not been as productive as I would like to be. It's not that I am spending less time at work, but it feels like there is too much distraction these days. I used to be able to do things more efficiently when I spent a couple of hours doing just one thing and having a deadline for it. Now it seems that when I am working on something, new things come up, I leave some things unfinished to come back to later on and ultimately there are a gazillion windows open on my computer at some point my computer starts lagging and I decide to close everything. To be more productive, I have come up with some solutions.
Cut down email time - I get tons of emails from lots of places and had made it a point to read them all, but now I cut down email time to just one hour in the morning, try to read as much of it as I can and get rid of the rest.
Do one thing at a time - Completely focus on just one thing at a time, put a deadline for yourself and try to meet it.
Divide tasks into subtasks - Its motivating to have things finished. If you just have a broader task listed on your todo list, it might be there for a couple of days, it feels nice to just put subtasks and see what you have completed at the end of the day.
Blog » Tech Celebrities
07 Nov 2011
I have been seeing a lot of posts about how everyone cared so much about Steve Jobs death and not Dennis Ritchie's. Thats the sad reality of life, people appreciate business people more then engineers/hackers. Steve Jobs, Bill Gates and Mark Zukerburg are world renowned figure because people use products created by their companies first hand on a day to day basis.
Everyone uses so much code and ideas that were initiated by Dennis Ritchie, Linus Torvalds, Richard Stallman but are unaware of it. I dont even know the name of the guy who created Apache on which majority of the web runs. Even though these guys gave away whatever they created for free for everyone to use. I forgot the name of the engineer who invented the vacuum cleaner but I know the person who first started selling them was called Hoover.
Even in tech community, David H. Hansson is a legend in some circles but I bet 90 percent of software developers have never heard of him, without him the web would not have been so 2.0ish, we might not have had Twitter, scribd, 43Things, luminosity, github, etc.
Lesson: If you want to be well known, do something that everyday people use. Or if you dont care about fame(or money) that gives you the freedom to do whatever you think is worth doing.
Blog » Amazing Programming Font
21 Oct 2011
Believe it or not, one of the reasons why I hated coding on my previous university's Windows machines was because windows' monospace fonts suck compared to what Linux has. I had windows ports of Gedit and Geany on my network folder but Windows fonts were just painful to look at.
After spending some time with Mac, I am setting up my programming environment on Linux box but I didnt like any of the monospace fonts installed by default. Searching on the internet, I eventually found a font I liked and it turns out its Mac's monospace font called Monaco. Luckily, there is a way to get in running on Linux.
Its these little things that makes Mac so amazing.
Blog » Higher level programming for embedded systems
01 Oct 2011
I don't have too much experience in this area, but I was thinking, it would be cool to have something more higher level for programming embedded systems. It would be cool if you could write Ruby code to program a robot. There are GUIs out there that allow kids to program robots but its not really as interesting as coding.
During my senior design project at AUS, we were using Simulink Realtime Toolkit to program our unmanned aircraft. And I must admit Simulink is really cool particularly for programming control systems, but it has its limitations. It was really painful to create and improve our communication stack. It would have been much easier to do in C, now the thing is you can embed C code in Simulink and we did, but you are forced to do something every time step like the rest of the Simulink blocks, it would be nice to be more procedural.
Something I also learnt during this project was that hardware programming is actually done on a much lower level than making computer applications. Take communication stacks for example, the packets are typically fixed length, with a byte for indicating packet type. Which is efficient but a TCP protocol, HTTP for example which uses a string to identify the packet is easier to work with for programmers. Now efficiency makes sense with expensive processors and low computational resources. But I think now is the right time for a Rails like revolution in Embedded systems.
With Ruby on Rails, webs applications can be created faster, they might not be as efficient as writing an application in Ruby from scratch. Webservers are not that expensive these days but web developers are. So it makes a lot of sense to use Rails. Also Rails makes web development more fun by using a Dont Repeat Yourself philosophy, programmers spend less time doing repetitive tasks and concentrate on the building part more. Ruby is platform independent, it would be great to see open source robotics code that can be run across platforms. Not to forget that Ruby itself is opensource and free, if you have to pay a lot of money to get a licence for proprietary software, its just going to slow things down.
I believe that the new generation is going to do great things. Some schools teach some robotics, many teach programming. The cost of computation is going down. We shouldn't care too much about efficiency and just let people be creative without worrying to much about the details. We need a platform with automatic memory allocation and garbage collection, with opensource libraries which have an easy and consistent way to install, something like rubygems or python eggs. We need to follow convention over configuration. It would be nice if we have a PID controller class, a communication protocol class, debugging/controlling over an ssh terminal, easy way to interface with different kinds of hardware such as wifi, bluetooth, ethernet, servos, sensors, camera, etc.
Obviously it could not run on all hardware, but we need several different platforms to support this kind of system. I think an opensource Unix-based OS can be a good start to create something like this. We need to make configuration and installation of these systems as simple as possible. Also we need to have educational videos similar to railscasts.com on how various things can be done with it.
Blog » Why I prefer Picasa over iPhoto
21 Sep 2011
I copied over my photos from my external hard drive on to my mac book. Apparently Macs are supposed to be good with all sort of multimedia things, iPhoto does look pretty good but it turns out it copies all photos to the iPhoto Library file. I just want it to leave my photos where they are. If I want to access my photos on a non-Mac machine it would be easy to do so.
Blog » Linux vs. Mac
17 Sep 2011
So around two months back I got a mac book pro. Macs are really popular among the Rails community, so they must somehow be better and more productive then linux. While in the beginning it seemed really nice, soon I started realizing its limitations. Here are the goods and bads I found.
Hardware
It is really not fair to compare Linux software against Mac hardware but its worth mentioning that Macs have amazing hardware and built quality. Other hardware seems very plasticy when compare to using a Mac.
Trackpad
Macbook have an amazing trackpad which gives it its great usability. It is essential to learn to use the gestures provided by trackpad, without it, window management can be extremely difficult. It takes a little practise to get familiar with what you can do with the trackpad.
Looks
While Linux is highly customizable, using my netbook for a while made me realize that I often spend some time to make the look and feel something that I would enjoy. On the other hand, Mac gives you nice defaults, not many options can be changed but you don’t need to change many options because Mac OS looks great by default.
File manager
Finder is an inferior file manager, at least for programmers. Anything in the Linux world, Nautilus, Dolphin and even Thunar work better. Its hard to show/hide hidden files, there is no merge option when copying over and replacing directories. Shortcuts are a bit difficult, I’d rather press enter to open a folder rather than Mac+O. There is also nothing like search this folder.
Code Editor
To be honest, Textmate is not as cool as it might look. While you always see it being used in screencasts and you feel like it would be magical, in my opinion gedit with gmate plugin is better. Although one thing I liked was that you can create your own syntax highlighting theme using the options in the editor itself. I am now using Vim, turns out the default Vim is not that great. Don’t know much in this area but it lacks +ruby mode (needed for command-T plugin) and pastetoggle command is missing too, I wonder why.
Package management
Linux has amazing package management. Even though I find packages in Macs way better than Windows, you have to resort to compiling a lot of stuff yourself. Even after using Macports, things are not as good as a standard Linux distribution. Its a headache to get mysql running.
Fullscreen
This is a draw. The new fullscreen modes in Mac are amazing, but you have different shortcut keys for different programs. In Linux the functionality is similar but a universal shortcut key F11 is used.
iOS Applications
Well the only choice you have got when you want to make an iOS application is to use a Mac.
While my primary development computer is now a Mac, I am not ditching Linux.
Blog » Apache error log
17 Sep 2011
I keep forgetting where the apache error log is. The file is called error.log. So simple solution.
when the location is found
tail -f /var/log/apache2/error.log
Blog » Locales on Linux servers
21 Aug 2011
Ever since I got a VPS, I've encountered lots of locale problems.
I get problems like:
setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
and
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = "en_US.UTF-8",
LC_MESSAGES = "POSIX",
LC_CTYPE = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
And every time I have reinstalled my Debian or Ubuntu distribution, I have solved it up in a different manner.
Anyhow, the latest one has so far seemed the best
apt-get install language-pack-en
My /etc/default/locales looks like this:
root@ibslab:~# cat /etc/default/locale
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LC_MESSAGES=POSIX
Blog » Git repository on a SSH Server
13 Aug 2011
While git is pretty useful for an individual developer on the local machine itself. Having your git repository in a central location allows you not only to work in teams but work on your project from different computers.
The most straight-forward way I found to have a git 'server' is to put the repository on a ssh server. You can use a web host to host your repositories. Setting it up is easier than one would think.
On the server create a folder and initialize an empty repository.
On your development machine, you add a remote origin.
git remote add origin username@hostname.com:/directory/project.git
git push origin master
Thats it.
Blog » Does multitasking actually increase your output?
10 Aug 2011
The subconscious me likes to believe that the more things I handle at the same time, the more I would accomplish. However I have noticed the complete opposite. These days time seems to run really fast without me accomplishing much in a day.
Yesterday, I felt that my mac wasnt enough for my work and brought out my HP laptop, working on my two computers side by side with a single keyboard and mouse using synergy.
Although I have more screen space, I still didnt see much improvement in my work. I have many screens open related to a number of different things I am working on. It seems a waste to close windows related to a particular task and open them up again some hours later when you can hide them on another virtual workspace. With this philosophy in mind, I found that I kept switching between different tasks throughout the day and was not able to focus on any one of them enough and finish it off.
Going to bed at night, I thought over what I had accomplished in the day, although I had worked on many things, I hadn't made significant progress in any. Working on one task at a time seems to be the best way for me to work. Even at university, I found it effective to concentrate on one thing at a time.
Blog » Window management in Mac
04 Aug 2011
I recently got a Macbook Pro. It is really cool but its hard to keep track of your windows. There is this awesome program called Shift it which makes your life a lot easier. Best of all its open source unlike most of the Mac applications that you have to pay for.
Blog » Wordpress Visual Editor and Syntax Highlighting
03 Aug 2011
Somehow the visual editor was not working on my wordpress installtion. I checked the server log and it turned out that the file permissions were not set up correctly. Just needed to give do chmod -R +r . in the wp-includes/js directory to get it working again.
Also the previous syntax highlighter I had installed sucked. I tried out a couple and so far I only like CodeColorer I also really like the syntax highlighter on this website but I dont know if that is available on wordpress.
Blog » Simple Layout CSS Template
02 Aug 2011
HTML
<html>
<body>
<div id="container">
<div id=header>
<a href='/'><h1>Title</h1></a></div>
<div id=content>
<div id=col1></div>
<div id=col2></div>
</div>
<div id="footer"></div>
</div>
</body>
</html>
CSS
#container {
paddding: 150px;
background-color:white;
-moz-border-radius: 2px;
border-radius: 2px;
margin: 0 auto;
width: 1200px;
}
#header{
width: 80%;
padding: 50px;
}
#content{
padding-left: 50px;
padding-right: 50px;
padding-top: 5px;
padding-bottom: 5px;
}
#footer {
clear: both;
font-size: .8em; background-color: #FFFF33;
}
#col1 {
padding: 40px;
margin: 40px;
margin-top: 0px;
margin-left: 0px;
background-color: #eeeeee;
width: 40%;
-moz-border-radius: 15px;
border-radius: 15px;
float: left;
}
#col2 {
padding: 40px;
margin:; 40px;
background-color: #eeeeee;
width: 40%;
-moz-border-radius: 15px;
border-radius: 15px;
float:right;
}
Blog » Ubuntu, Gnome 3 and a switch from Ubuntu to Fedora and back
31 Jul 2011
I am not a big fan of how the Ubuntu desktop looks, now don't get me wrong there was a time when Ubuntu looked way prettier then the default Fedora install but I don't like how everything is orange and if orange is your favorite color all is good but otherwise its very difficult to make everything non-orange.
I know many people dont care about how your desktop environment looks like but for the 'programmer' type who often spend a major part of their day in front of their screens, it does matter a bit. Yes, there are plenty of themes available that look good, particularly Ortha and Divergence, but the default gnome3 installation looks better and cleaner. While I love the fact that Ortha and Divergence can be installed from a ppa, the themes aren't free from imperfections. Something I don't understand is why wouldn't Ubuntu put these themes in there official repositories and why wouldn't they offer an alternative Gnome3 desktop.
I tried installing Gnome3 using the gnome-team ppa, while it works perfectly on my netbook and my brother's netbook, it just wouldn't work properly on my laptop. It just gets stuck. This made me research into alternative linux distributions. I used to be a Fedora person before Ubuntu became extremely popular. The Gnome website lists Fedora and OpenSUSE as the two operating systems where you can get to experience Gnome3, so thats why I replaced my Ubuntu install with Fedora.
While Fedora is good at several things, soon I realized you have to waste your time with several things. The first thing I did was try to install Ruby on Rails. It turns out that ruby1.9 is not there in the repositories. Ubuntu has way more packages available and even more through ppas. Even Chromium wasn't present in the repository. Thats why I had to manually compile Ruby. While Fedora forces you to learn more about Linux by having to compile some of the programs yourself. For a person who is short on time Ubuntu provides ease of use. Also, i'm sorry but apt-get is way better than yum. My computer would also not wake up from sleep and eventually after a couple of hard boots even Gnome3 stopped working correctly.
Therefore I had to install Ubuntu again. I can't wait for Ubuntu to officially support Gnome3. I know it looks very close to Unity but not only Gnome3 looks better but makes things a lot simpler.
Blog » Page Design for Rails Applications
24 Jul 2011
Compass is an opensource CSS framework which uses SASS to create variables, mixins, etc in CSS.
Blueprint is another CSS framework which creates a grid on webpages which can be used to easily create the layout of a web page.
It is easy to integrate them with Ruby on Rails by installing the compass gem.
Blog » Useful Linux commands website
11 Apr 2011
I am working on a new website which lists useful Linux commands. Basically a one-day spin off to keep me up to date with web programming. But I think that the website has potential.
At the moment, I am thinking of a easy (think zeroconf) sort of voting system for the website. I might end up using OpenID.
Blog » Phrase book website
11 Apr 2011
Last year I created this phrasebook website. I basically wanted to create multiple choice tests engine and use those phrases as a demo but did not get a lot of time over the last year since I decided to graduate in a year rather than a year and a half.
Blog » Make a big file quickly on Linux
26 Nov 2010
Sometimes you need a huge dummy file for some reason: maybe you want to test network performance, or maybe you want to fool a file sharing application, or there is some other weird reason.
On OSX and BSD, I have read there exists a program called mkfile. But I did not find it on Ubuntu so a bit of looking around I came across truncate.
Just use the command
truncate -s 1000MB filename.out
This will create a file called filename.out with a size of 1000MB. The space is not actually allocated on the hard disk but the file entry exists in the file table. See man truncate for more information.