Archive for the ‘Development’ Category

FreeTDS 0.91 for Ubuntu Lucid

Saturday, March 3rd, 2012 by pdf

It seems no one has previously backported a recent version of FreeTDS for Ubuntu Lucid, which is problematic.  I’ve created a PPA to host a version I built for a project a few weeks ago.  You can find it here: https://launchpad.net/~pdffs/+archive/freetds-lucid-backports

To install, simply:

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:pdffs/freetds-lucid-backports
sudo apt-get update
sudo apt-get install freetds-*

Australian devs can now sell Android Market apps

Friday, October 1st, 2010 by pdf

Just announced: the list of countries able to publish paid applications to the Android Market has been greatly expanded.  Australia is now on the list, which is great, and hopefully we’ll now see an increase in the number of quality apps hitting the Market.

International Android Development

Monday, September 20th, 2010 by pdf

Please see UPDATE

I’ve been an quite vocal advocate of Android as an alternative to Apple’s walled-garden of mobile applications, until I discovered today that anyone who lives outside a very short list of countries is still unable to publish paid applications.

In a time when 3rd-party applications are clearly one of the most compelling drivers for popularity in the mobile operating system market, it seems absolutely astounding that Google would exclude the majority of the world’s developers from contributing to the Android application market in a commercial capacity.

Clearly this stems from deficiencies in Google Checkout’s ability to cater for international merchants, but there appears to have been no forward movement on that front for at least a year now, and no meaningful response from Google as to what, if anything, is being done.  There are numerous long-running Google Groups threads requesting such, and local online media has even run the story.

With Google Checkout clearly being the culprit for hampering quality application growth, and alienating developers worldwide, and with an obvious lack of commitment from Google to rectify the problem on that front, surely it’s time for them to admit that they’ve failed to resolve it, and to consider the extremely simple option of allowing Paypal for international developers (much as that would stick in their craw)?  Surely it’s the lesser of two evils to vastly improve the available application pool, and appease the world’s developers, by allowing payment via a competitor, since there is no revenue coming from these regions in any case, and apparently no effort being imparted to alter this?

Discovering this information made it suddenly obvious why there are so few quality region-specific applications in my area (Australia), and this in turn clearly proves the point that this stifling of commercial creativity is bad for the platform end-to-end.  Developers suffer, since they can’t make a living, and end-users suffer since the Android market lacks the content available in other application markets.

This has of course also completely killed a number of projects I had prototyped.  This is how not to do an application store.

Create a new git branch on a remote repository (and other helpers)

Wednesday, August 4th, 2010 by pdf

git-rbranch

Managing remote git branches is a pain in the rump – I can never remember the sequence (and have no desire to).   So, I created the following small script to handle it automagically.

#!/bin/sh
# git-rbranch

if [ $# -ne 1 ]; then
         echo 1>&2 Usage: $0 branch_name
         exit 127
fi

branch_name=$1

check_return() {
	if [ $1 -ne 0 ] ; then
		exit $1
	fi
}

if [ -n "$(git branch |egrep "^[[:space:]*]*${branch_name}\$")" ] ; then
	echo "Local branch already exists, cannot continue"
	exit 1
fi

if [ -n "$(git branch -r |egrep "^[[:space:]*]*${branch_name}\$")" ] ; then
	echo "Remote branch already exists, checking out"
	git checkout --track -b ${branch_name} origin/${branch_name}
	check_return $?
	git pull
	check_return $?
	exit 0
fi

git push origin origin:refs/heads/${branch_name}
check_return $?
git fetch origin
check_return $?

git checkout --track -b ${branch_name} origin/${branch_name}
check_return $?
git pull
check_return $?

Simply place it on your path somewhere as git-rbranch (ie – /usr/local/bin/git-rbranch) and call with:

git rbranch <branch_name>

This will create the new remote branch, check it out and pull the changes, the only caveat is that the branch can’t exist locally.

git-info

I also find Duane Johnson’s git-info script useful for quickly grabbing the vital stats for a repo:

#!/bin/bash

# author: Duane Johnson
# email: duane.johnson AT gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496

pushd . >/dev/null

# Find base of git directory
while [ ! -d .git ] && [ ! `pwd` = "/" ]; do cd ..; done

# Show various information about this git directory
if [ -d .git ]; then
  echo "== Remote URL: `git remote -v`"

  echo "== Remote Branches: "
  git branch -r
  echo

  echo "== Local Branches:"
  git branch
  echo

  echo "== Configuration (.git/config)"
  cat .git/config
  echo

  echo "== Most Recent Commit"
  PAGER=/usr/bin/less git log --max-count=1
  echo

#  echo "Type 'git log' for more commits, or 'git show' for full commit details."
else
  echo "Not a git repository."
fi

popd >/dev/null

Place it on your path as git-info and call with:

git info

git-keep

Finally, a quicky to ensure empty directories make it into git by placing blank .keep files in them.  This will not be to everyone’s taste, but it works when you need it.

#!/bin/sh
dir=$1
if [ -z "$dir" ] ; then
	dir=.
fi

for dir in `find $dir -type d -empty |grep -v '\.git' |grep -v '\.svn' |grep -v '.hg' ` ; do
	touch "${dir}"/.keep
	git add "${dir}"/.keep
done

Place on the path as git-keep and call with:

git keep <dir>

Where <dir> is the top-level directory you want to store dirs from. If omitted, will use the current dir.

Download

You can download the files here:

git-rbranch

git-info

git-keep

Fluid jqGrid

Tuesday, May 4th, 2010 by pdf

The jqGrid plugin for jQuery is an excellent method for displaying and editing tabular data, but has a shortcoming – by default it’s size is fixed.  This presents some problems for sites with fluid layouts, or dynamic display elements.  There are posts elsewhere describing how to make it respond to window resize events, however a recent project had dynamic content that adjusted the size of various page elements.  To make jqGrid respond to resizes of it’s parent element, an alternative approach is required.

This method requires installation of the jQuery resize event plugin, which provides resize events for all elements, rather than just window.  Follow the instructions at Ben’s site to install the plugin before continuing.  Once the plugin is installed, add the follow functions to your page:

function jqgrid_fluid_resize(grid, gridParent) {
  grid.setGridWidth(gridParent.width());
}

function jqgrid_fluid_trigger(grid) {
  jQuery.resize.delay = 100;
  gridId = jQuery(grid).attr('id');
  gridParent = jQuery('#gbox_' + gridId).parent();
  gridParent.bind('resize', function() {
    jqgrid_fluid_resize(jQuery(grid), gridParent);
  });
};

Then attach jqgrid_fluid_trigger to the loadComplete hook in jqGrid, and your grid will automagically resize when the containing element does.

I should probably extend the jqGrid object with these functions rather than just sticking them in the global space, and I’ll get to that, but I wanted to dump the info here before I forget.  You can grab the code here.

I don’t write JavaScript, so if you want to tell me how this would be better, leave it in the comments.