Dilantha Redux

Code and other stuff

2012 Sri Lankan Holidays

I’m still in festive mood. After all the partying around the Christmas break and just after new year’s eve you will want to know when you can party next.

Well I’ve spent 10 mins and created a Calendar feed of the main public and bank holidays for 2012. Hopefully you can add this to your computers and phones and not have to check that source PDF again.

You are welcome.

Mac and Android File Sharing With AndSMB

An Android on the Mac are not a pretty combination. I tried the Kies app for a Galaxy tab with no luck at all. It won’t mount even after the driver install.

I wanted to get some files out of the tab. I tried ES File Explorer with a bit if luck where single files copied over fine.

With ES there is no progress bar so you don’t know what is really happening until it fails ten minutes down the line.

After trying Astro file manager with the samba add-on still I couldn’t connect to my Mac.

At last I tried AndSMB where there is a progress bar and it tells you if the copy failed. You have enter the samba server manually but it seems to work.

Samba Filesharing seems to be another popular one but you need to have rooted device for that to work.

Moving to Octopress

Well that was (kind of) easy. I was interested in Octopress for a while, but didn’t have time to mess with it till now. It took a couple of hours to setup. Mostly since I had to download GCC for Mac which was about 200MB.

Xcode 4.x something which doesn’t have GCC anymore.

I didn’t have RVM on this computer so I tried rbenv instead after @dhh mentioned it a few months ago.

Ritigala Compost

So I see these Ritigala compost bags at a local shop. I’m sure the Ritigala stuff is pretty top class but we live in a pretty open area where people have land space to make their own compost.

Transporting compost all the way from Ritigala is not the most environmentally thing to do.

Get MySQL Workbench Working on Ubuntu 11.10

MySQL Workbench doesn’t work out of the box in the latest Ubuntu. These steps will get it working until Oracle gets around to updating the official package ;)

1
2
3
sudo add-apt-repository ppa:olivier-berten/misc
sudo apt-get update
sudo apt-get install mysql-workbench-gpl

Source

Aptana PHP Formatting Tip

I like the Aptana PHP formatter. Its the only one that works well for me. I used to my one liner tags messed up a lot like this.

1
2
<?php echo $content
?>

What I noticed was that the ones with the semi-colons in place didn’t break to a new line.

1
<?php echo $content;?>

Now the auto-formatter (Keyboard shortcut to Command + Shift + F on the Mac) keeps things in the same line.

Commit Tips

If you are still using CVS and Subversion or moved on to something distributed its a good idea to keep in mind how to commit. Your commit message should describe just the step you did.

Commits and commit messages are pretty important. I’ve had single user repos for years and I still put decent messages and commit sensibly in case I need to go back and figure out something.

Here are a few tips that hopefully will help to do better commits.

  • A commit shouldn’t be a number of unrelated things.
  • Each commit should be a single step that you are doing to achieve something.
  • No blank commit messages, blank means you did nothing. :)
  • In a traditional VCS like CVS or Subversion always do an update and merge any changes before you commit.
  • In a DVCS like Git or Mercurial commit what you did, then pull, update, merge, commit, and push. (This might change depending on the tool you use.)

If you keep your commits per step you will find you can pick and move, release, make patches or do pull requests easier.

Hire Me

I know I should have blogged more. But then I was busy working. Now that I’m out of work do you think anyone following this blog would notice and hire me?

Here is my work profile.

Twig Library for CodeIgniter 2.x

I’m trying to catch up with this social open source movement. I forked an existing CodeIgniter Twig integration library and added some changes to work with CodeIgniter 2.x.

Also I found a way map any CodeIgniter function to Twig like so.

1
2
3
4
5
<?php
$this->load->library('twig'); // load the Twig library
$this->load->helper('url'); // load the CodeIgniter URL helper
// map the base_url() function as a Twig function 
$this->twig->add_function('base_url');

Then in your Twig view call the base_url() function like this

1
\

Head over to Github for more details.

In case you have no idea what I’m talking about. CodeIgniter is an excellent PHP framework and Twig is a Django style templating engine with inheritance for PHP.

Getting Started With HTML5

I did a small intro to HTML5 at the last Refresh Colombo meet-up last week. Here is the main presentation I used from html5rocks.com.

Here is a better list of resources as well. I specially like Dive Into HTML5 by Mark Pilgrim.

I met @geekaholic and @SeeJay of Sinhalen FOSS at Refresh Colombo but had to head back soon after.

Thanks @nazly for the invite will try to hang around longer next time. :)

Update: Mark Pilgrim’s websites went away. I’ve changed the above link to a working mirror. Also you can get a PDF of the book from this site.