Archive for the ‘Techie’ Category

Buddypress Extended Profile Image Field Plugin

March 12, 2014 7 comments

I had detailed a while back in this post the steps to adding an image field type to your BuddyPress Extended Profiles component. A lot of people (as is evident from the comments) got some good use out of that. However, PHP and Javascript are not everyone’s cup of tea so there were many challenges in getting the raw code to work.

I finally got some time to package the code into a plugin which you can download at the WordPress Plugins repository. Give it a spin and let me know how it fairs in your particular setup. The plugin should be ok on WordPress 3.2.1 to 3.8.1 running BuddyPress 1.5 to 1.9.2

Thanks very much for all the feedback I got in the comments on the behaviour of the code.



Plugin en el español ( por Andrew de WebHostingHub. Gracias Andrew!

How to ROM Dronix onto Huawei Ideos U8150

October 5, 2011 340 comments

The ROM is the soul of your Ideos. It controls how the phone performs and also what hardware features are accessible. You can install a great many apps to transform your Ideos into any one of a wide range of tools, but if a feature required by an app isn’t supported by the ROM, then it wont work. For example, a good number of Ideos phones support multitouch at the hardware level. However, the standard vanilla Android ROM that runs the Ideos does not support multitouch. As a result, pinch-to-zoom that is supported by apps such as Opera Mini and Google Maps does not work.

If you want to transform the ‘personality’ of your phone, then you have to change the ROM. This is known as ROMing. There are people that ROM their new phones as standard procedure not only to access functionality that doesn’t come standard, but also to feel that they have free reign over their phones. I stayed away from such radical customization owing to the risk of bricking a perfectly working phone. Besides, it wouldn’t have served any purpose beyond feeding my curiosity. However, over time my Ideos became sluggish, and boring. I’d go for days without tinkering with it to discover a new app, or new ways to customize it. And I was getting really pissed off at the sluggishness. So one day this here guy passed by my blog and mentioned Dronix. I hadn’t heard of it before and I liked the name right off the bat. I was hooked, and I went searching.

Dronix isn’t really that unique in the sense that most of its features can be found on other ROMs. But it does have that name… and it promises a significant speed boost. Among the features that it boasts, Dronix won me over on:

  • Multitouch support
  • Speed boost of up to 748MHz – My Ideos was previously running at 600MHz
  • SSH support – allowing me to access the files on the phone over wifi, therefore avoiding the whole USB connectivity drama.
  • Responsive user forum – very useful when you get stuck on something
  • Extremely good reviews – especially from people who have tried out a number of ROMs

Read on »

Huawei IDEOS U8150 – The Little Android That’s Bigger On The Inside

April 17, 2011 70 comments

“Yes, it’s bigger on the inside”, to quote the words of Doctor Who whenever he’s addressing a first time visitor to the Tardis. Anyone regarding the Ideos from the outside tends to dismiss it. Despite being a nice looking phone, it has characteristics that immediately put you on your guard when phone shopping. For starters, Huawei is not exactly a leading name in the smartphone market. Next up is the size. It’s small, very small. So you can be excused for being skeptical about its utility as a smartphone. Finally comes the price tag. USD 100 (KES 8,500). In Kenya it’s even cheaper when you factor in the bundled talk time and data package. Did I mention it’s unlocked? So in your mind there must be a catch. Someone somewhere is going to be having a good laugh at your expense if you buy this phone.

Here’s the thing. I’ve been having an Ideos for some time now and, well, I’m still the one laughing. There’s so much you can do with this little smartphone, you literally forget the size. All courtesy of the Android 2.2 operating system running inside it. And the best part is I haven’t had to invest in a larger SD card like I had originally planned. The 1GB card is sufficient for plenty of apps and data. What apps you ask? I love customizing any device I own, so I got down to shaping the Ideos to my preferences from the moment I unboxed it. Here’s some of what I’ve done with it:

Read on »

Categories: Android, Gadgets, Techie Tags: , , ,

Production Code Deployment with Mercurial Version Control

May 26, 2010 2 comments

I recently switched to Mercurial source control and it’s proving to be a lot more fun to work with than Subversion. However there is one SVN feature that I have been missing dearly: The ability to export deployment code. SVN has an export command that I would use to generate a copy of project source files free from all the source control utility folders.

Up until recently, I had not figured out how to do this in Mercurial. I had to manually remove the .hg folder in order to move project files to production. That was until I came across this gem. Mercurial has an Archive command. It essentially does the same thing as the SVN Export command. In order to archive in TortoiseHg (Windows):

Export Prodcution Code

Export Prodcution Code

  1. Right-click the source code project folder and select Hg Repository Explorer.
  2. In the Repository Explorer, right-click on the default (tip) revision point and select Archive.
  3. On the Archive dialog:
  • Select the Archive revision you want to export
  • Supply the destination path
  • Pick Directory of files as the Archive type.
  • Click Archive.

You now have a copy of your source files that does not contain source control infrastructure.

Add a Custom Page Template to WordPress Thesis Theme

May 16, 2010 146 comments

Thesis is a popular premium WordPress theme. Unlike many themes that are implemented to plug directly into the WordPress-defined template structure, Thesis is a force unto itself. It’s a framework that completely redefines the approach to WordPress customization. It achieves this by supplying a rich set of hooks into the various stages of the page generation process and then creates one location where all customization code goes. One file – custom_functions.php – holds all the custom code and is safe from overwriting during theme upgrades.

The Thesis framework is sufficient for a wide range of customization needs. However, as with all popular software, users’ needs eventually go beyond the default capabilities of the software. Thesis has in-built support for creating 2-column and 3-column sites. The layouts are configured via the Design Options menu and apply site-wide. You can override the layout of particular pages (eg home page) by intercepting the page generation process in custom_functions.php. The problem with this approach is that you have to know the designation (home), name or id of the page before-hand as you customize the site. If these details change after the site has been launched, then the customization code is going to break.

Page Template List

Page Template List

What if you want to alter the layout of an arbitrary number of pages that are going to be created in the future? All you know at customization time is what the layout shall be, but not which particular pages shall use it. This obviously calls for a solution that does not involve updating the customization code every time a page requires the custom layout. Even better, it calls for a facility that can be triggered while the page is being created by the user. A facility such as the WordPress  page Template selection drop-down. If you could create a custom template and have it selectable on the Template drop-down, then the user would simply pick it during page creation (or editing) and have it used for page rendering.

Thesis (version 1.6) does not support plugging in of custom template files, but it is flexible enough to pick them up if you know where to tweak. Here’s how you go about doing exactly that:

1)       Problem description

The hypothetical site we shall be working with is a travel blog. The site has various sections, but the one that is of interest here is one called Places. It has pages describing various travel destinations. These pages have advertising that shows in the left column. Every other type of page on the site does not have this left column and therefore no ads showing. How do we get the ads to show on the Places pages, but not on any other page?

Read on »

Categories: programming, Techie Tags: , ,

Mercurial Source Code Version Control – Getting Started

March 31, 2010 1 comment

I’m switching source code control systems from Subversion to Mercurial. I had no idea Mercurial existed until I read this post by Joel Spolsky. He didn’t do a very good job of saying exactly what Mercurial does, but he said enough for me to go googling. I had already worked with a distributed version control system in the shape and form of git. Coming from a Windows background, I found git to be extremely unfriendly. There are a number of visual interfaces to git eg. git gui, but I realized that the most flexible way to use git was from the command line. I don’t like command lines. It wasn’t long before I went on the prowl for a more palatable source code management tool. I got hooked onto Subversion due to the incredibly handy Windows Explorer integration courtesy of TortoiseSVN. I could do my source control activities right where the files were displaying and to date I haven’t had to open the command line once.

Enter Mercurial. I like the whole idea behind distributed version control. The biggest selling point, however, is the fact that merging project branches doesn’t cause premature graying of your hair. I have avoided branching Subversion projects, but at the cost of having to run experiments on the main (only) source code branch. Now with all this talk of branching and merging, it’s kind of funny that the first hurdle you encounter has to do with getting started. It seems to have been assumed by many that you’ll already have a repository by the time you install Mercurial. But then how was that first repository created?


Step 1: Initialize the repository

create repository

Create Repository

Install TortoiseHg for Windows Explorer integration. It’s best to get the repository going when you already have a folder with files in it. This is the project that you want to keep track of. I shall use my project folder C:\projects\GameOfLife for illustration.

Right-click the folder and select TortoiseHg > Create Repository Here

This opens the TortoiseHg Init dialog where you click Create.

A notification comes up confirming that the repository has been created so click OK, then click Close (on the Init dialog). The folder C:\projects\GameOfLife now has a green checkmark on it indicating that it is under source control. Opening it reveals two new objects: a file .hgignore and a folder .hg.

Init Repository

Init Repository

Step 2:  Setting up the Ignore Filter

It’s common for software project folders to contain files that do not need to be tracked. These files include intermediate compiler output, debugger symbol files etc. You can tell Mercurial to ignore these files so they do not get picked as files requiring some attention. To do this, right-click on the project folder and select TortoiseHg > Edit Ignore Filter

Ignore Filter

Ignore Filter

The Ignore Filter dialog opens up showing a list of all the files in the project folder (including sub-folders). Click on a file that you do not wish to track and it shows up in the Glob text field.

Click on the Add button to the right of the text field in order to have that file added to the Filters list.

If you want to ignore all the files in a particular subfolder, click on one of the subfolder’s files (eg. GameOfLife/obj/Debug/GameOfLife.pdb) and then replace the file name with *.* (eg. GameOfLife/obj/Debug/*.*)

Click Add to include the new filter in the Filters list

Continue the process of adding filters to your heart’s content then close the Ignore Filter dialog.

Filter List

Filter List

Step 3: Adding the project files to the repository

Mercurial cannot start keeping track of files until you tell it to, so right-click on the project folder and select TortoiseHg > Add Files.

This brings up the hg add dialog with all the project files checked. Now since you had earlier indicated the files you want to ignore, the file list should just contain the files you want tracked.

Click on Add to get them queued for the commit.

Add Files to Hg

Add Files to Hg

Step 4: Commit changes

Right-click on the project folder and select Hg Commit. Mercurial now has the file states initialized and all changes from this point on can be tracked.

Life is a Chain of Accidents

February 22, 2010 4 comments

That’s the whole point isn’t it? If I had sat just a few cm to the right; or had been lying on the seat (as opposed to sitting upright) I’d have missed it all. I’d have missed the most critical bits of the whole event. The bits that made it real for me.

Isn’t the whole of existence defined in such terms? How many times did you get a break because you were accidentally at the right spot at the right moment? Not because you planned the events leading up to that moment. How many people met their life partner in the most unexpected of circumstances? Isn’t it all just a series of accidents that happen in such numbers as to create a bigger picture of order?

Think of conception itself. None of us determines exactly what sperm hooks up with the egg. Nor at what moment. Neither do we know the genetic makeup of the sperm. Sure we know the source and therefore the likely genetic info, but the actual specifics vary with each individual sperm. Our lives from conception to death are also pretty much shaped and defined in the same manner. A series of moments that accumulate over time. Moments that are impossible to plan. Moments which if they were to happen out of turn may result in completely different fortunes and perhaps a completely different individual.

Then why are we so preoccupied with order and predictability? Why do we want to know what next month’s earnings are going to be? Why are we so caught up in routine and monotony? Aren’t we fighting the very forces that define our existence? We exist out of randomness more than any amount of planning. Shouldn’t we then live by the same randomness?

Shouldn’t we welcome unpredictability? Aren’t we somehow at a disadvantage when we remove chance from the equation? I think we should embrace unpredictability in computers. Computers of the future are not going to be characterised by rigid and mechanical algorithms, but rather flexible and dynamic states of being. This way, they shall have a chance at true intelligence since intelligence is not the absence of unknowns, but the occurrence of unknowns in a favorable order at a favorable time.

This interaction of randomness is observed at a macro scale among of individuals of the most complex multi-cellular beings – the humans – and also observed at a micro scale between cells of the body and also among micro-organisms.

Even better, there is a lot of random interaction between inorganic elements of our world that shape the very world we live in. I think the way forward is to figure out how to harness unpredictability. It’s a really tough goal given that if you are after a certain outcome then the process through which you get the outcome can hardly be described as random – especially when that outcome must happen within a given timeframe. As crazy as it sounds, creating systems out of randomness and pseudo-unpredictability may be the way to step into the next technological plane.

Categories: Ideas, Techie