LED Sequencing using Arduino Uno
I’ve recently taken an interest in Hobby Electronics after reading a lot about Arduino. Being a software guy, I’ve always had difficulty getting my head around practical electronics. But after searching a bit around, I came across these two lecture series on Youtube:
Jeremy Blum’s Arduino tutorials
Prof. T S Natarajan’s Basic Electronics tutorials
And bit-by-bit I’m able to make sense of electronics.
Anyways, the best part of Arduino is that is very programmer friendly. Easier to program all this stuff than to do it using hardware components. Here’s a video of LED Sequencing using Arduino Uno. It consists of 12 LEDs connected to 1K/220 Ohm resistors to pins 1-12 on the Arduino. Setting up the breadboard and connections is very straightforward.
You can download the Arduino source code from here: View/Download code for LED Sequencing
WordPress app for Android
Stuck at the airport and just trying to kill time with the free wifi, thought I’d give the wordpress app a try on my LG Optimistic net. It’s pretty decent so far and setup was just too easy. 4.5 stars on Android market. Let’s see if this will help me blog more frequently
Smart Rotator – Enable android screen auto-rotate only for certain apps
Thank goodness there’s an app for this. One of the most handy features ever. I hate the auto-rotate when it does it for the home screen and for aldiko, but I would really like it to be there when using Astrid or Messaging since the landscape keyboard is much more convenient to use on my 3.2 inch screen.
Smart Rotator. Just download it from the market. Dead easy to use. Long press the app in the list and select to turn the feature on or off.
Laptop screen brightness controls missing – Acer 5742G, Windows 7 – Teamviewer culprit
Recently the brightness controls disappeared from my Windows 7 installation and I had absolutely no idea why. I reinstalled nvidia and intel drivers (I have optimus) and it still didn’t work. Finally, after searching around, I found this post which said that the problem appeared to be because of TeamViewer. I uninstalled it and voila! The fn+Right and Fn+Left keys are working again. Thank goodness, it was getting a bit too painful.
Kindle 3 – Just can’t stop reading!
I did a lot of research on ebook readers. Checked out the Nook, various Android tablets, iPad and the Kindle. However, the only one which agreed with my budget was the Kindle. And when they recently launched the Kindle 3G with special offers for $139, there was no stopping me. I immediately bought two of them – one for my girlfriend and one for my mom. And now, as I’m nearing the climax of Dracula (Free and Public domain), I just can’t help thinking how good it is. Like reading a book with glossy pages. Of course, there is a slight reflection, sort of like a matte finish on a laptop’s LCD screen. But it is an absolute dream to read. And the 6″ screen is just perfect to hold in one hand. It is, however, a little heavier than I expected, but still very much readable while holding it with one hand and lying down.
Word of advice though – if you’re not in the United States and are thinking of ordering the kindle directly through International delivery, DON’T! Here’s why:
- For one thing, the special offers version is available for sale only in the US. You will have to pay the full $189 to get the 3G version
- Shipping costs and custom duty are way too expensive. Possibly about a third of the price of the device!
- They don’t ship the AC adapter, just the USB cable. Only way to charge it would be through your PC or laptop. WTF?!
So, if possible, try to find some acquaintance of yours who’s currently in the US or will be travelling soon. Amazon accepts international credit cards without any hassles and get it delivered to their work/hotel address. It’s not so big or heavy to cause any untoward inconvenience to someone while packing their luggage so shouldn’t be a problem.
One more thing – it is possible that at the time of writing this post, Amazon may be considering launching a new version of the Kindle (perhaps a tablet?). But I had already placed the order for 2 of the sexy devices before I came across the article. And I don’t regret it! For one thing, the price is a bargain. And for another, I wanted a book reader and I got exactly that – a book reader. And it does the job well. Very well!
C25K – D2W1
I’ve decided to create a new post for each day I jog. 2 days ago, I once again started on the C25K program. Today was Day2 of Week1. Nothing much to note. I figured this would be one way to keep my motivation up for the entire 8 weeks and more.
JQuery: Flicker problem on Firefox with fadeOut and fadeIn
It has been a bloody nuisance getting the fadeIn and fadeOut to work properly on Firefox. I’ve been trying to get the content on the page to fade out, load new content and fade it in when the user clicks the navigation menu. But everytime I do that, there’s a flicker on the page that simply bugs the hell out of me.
After googling for half a day, I finally found out the reason. And it is not very straightforward, especially for someone getting into web design after a 6 year hiatus. Here’s what the problem is – Firefox gives you a vertical scrollbar on the side as long as you have content that extends beyond the vertical visual boundaries of your screen. But it doesn’t keep it there all the time. If the content can fit on your screen, it disappears. This causes the scroll bar to disappear when it’s not needed thereby making your layout move to the right because of the extra space.
Now apparently, there is some way to get the scroll bar to persist, but I couldn’t get it to work without having a double vertical scroll bar on the side. A number of options are available on this page, mainly in the comments, but none of them did the trick for me (I’m using Firefox 4).
So, back to googling and this time I came across this issue on the jquery website which says that fadeOut sets the display property to none and this causes an issue with the layout. More searching finally led to this mail chain in which one of the users suggests not to use fadeOut and fadeIn but rather just use animate() and that will solve the issue with the display:none. And it actually did. The annoying flicker is gone. Effectively, instead of using
$obj.fadeOut(‘slow’, function(){
$obj.fadeIn(‘slow’);
});
use:
$obj.animate({opacity:0}, ‘slow’, function(){
$obj.animate({opacity:1},’slow’);
});
and no more flickers!
Update: If you’d like to see a working POC, you can download the source here. It should work fine even with Javascript disabled.
Load in and Animate content with JQuery
I found out how to load and animate content using this excellent tutorial from tutsplus.com. But I wanted to take it one step further and also show the currently active link highlighted in the menu bar which took a bit of effort.
The full working sample can be downloaded from here.
Here’s the final version of the javascript:
$(document).ready(function(){
var hash = window.location.hash.substr(1);
var href = $(‘#nav li a’).each(function(){
var href = $(this).attr(‘href’);
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+’.html #content’;
$(‘#content’).load(toLoad)
}
});$(“.nav li a”).click(function(e){
var toLoad = $(this).attr(‘href’)+’ #content’;
var clickedMenuItem = $(this);//Store whatever you clicked over here
var currentMenuItem = $(this);//This is where you’ll store whatever is currently selected (in the next step)
$(“.nav li a”).each(function(){
if($(this).hasClass(“active”)){
currentMenuItem = $(this);//If it is active then set that to the currentMenuItem
return false;//Break out of the each() loop (http://gavinroy.com/jquery-tip-how-to-break-out-of-each)
}
return true;//Just to get rid of the warning “Function doesn’t always return a value”
});
e.preventDefault();
//Change animations to slideUp and slideDown to get the sliding animation
$(“#content”).fadeOut(‘slow’,function(){
$(“#content”).load(toLoad, function(){
$(“#content”).fadeIn(‘slow’);
});
});window.location.hash = $(this).attr(‘href’).substr(0,$(this).attr(‘href’).length-5);
currentMenuItem.removeClass(“active”);//First remove and then add in case the same link is clicked
clickedMenuItem.addClass(“active”);});
});
Hard to find svn commands
Some tips for SVN that I’d like to note here rather than google for every single time. Will keep adding them as I get more of them.
Revert all recursively:
svn revert -R <targetdir>
Remove .svn directories in all folder / Clean up entire project from svn
svn export /path/to/old/working/copy /path/to/plain/code
How to set properties for files and directories
svn ps svn:ignore <file pattern> <target directory>
Ex: svn ps svn:ignore ‘database.php’ ‘./config’
Prototype(PC) Trainer
Prototype is an amazing game. The graphics, gameplay everything is almost perfect. Seamless movements and absolutely no lag time. But the game is also incredibly difficult. One particular level had me cringing after I had to play the dam level 3 times and still not make it. Surprisingly, I didn’t find any cheats for infinite health. Thankfully however, I found this trainer to get infinite health and infinite ammo. I swear, people who can finish this game without using the trainer deserve a medal!
Prototype Trainer: http://www.cheatbook.de/trainer/prototype.htm (defunct)
Update: The above link isn’t working anymore. You can get the trainer at the following links:
http://www.mofunzone.com/game_trainers/prototype.shtml
http://www.cheathappens.com/show_download.asp?id=25763
PS: Anyone remember the 2nd chariot race in Prince of Persia: The Two Thrones? I had to use a trainer from that point onwards in that game as well!