February 28, 2012

How to change the created/modified date of files on a Mac

You can use the touch tool to modify the created (and/or modified) date of a file on a Mac. Simply open Terminal and run touch -mt {date} {filename} (changes both created and modified dates), or touch -t {date} {filename} (changes just the created date). The date must be formatted as: YYYYMMDDhhmm.

Date Format Key:
YYYY – The year (the first two digits/century can be omitted).
MM – The month of the year, from 1 to 12.
DD – The day of the month, from 1 to 31.
hh – The hour of the day, from 0 to 23.
mm – The minute of the hour, from 0 to 59.

February 26, 2012

How to take screenshots of your Android app for the Android Market

If you’re developing Android apps to list in the Android Market, you’ll be needing to take some screenshots of it.

You should already have the Android SDK installed, so these instructions make that assumption. You also need your Android phone plugged in via USB with USB Debugging enabled.

Open Terminal, and change to your Android SDK folder, open the “tools” folder, here you should see a tool named “ddms” (this stands for Davlik Debug Monitor). Run this tool from the Terminal and the Debug Monitor app will open up.

When the app has opened, go to the Device menu and select Screen Capture.

You can now take and save screenshots of whatever is running on your Android device.

August 29, 2008

Project Management and the Developer

I found this excellent article on project management from the developer’s point of view:
(Originally written by Brandon Ching)

Today’s post is on something a bit different but still very much relevant in the web development world: project management. Now, I’m not all that old and I haven’t been a web developer for all that long (about 6 years in total, 3 actually getting paid ;-) but I have had the opportunity of working for a medium-sized media company with a development team of about 25 developers, a small 5-6 person development company (3 developers), and as an independent contractor.

Read the rest of this entry »

May 7, 2008

Finding objects close to a location with MySQL

For a project I’m currently working on, I needed to be able to find people that a within a certain distance from a particular point.

I have a large database of people that each have a Longitude and Latitude of their location. One of the searches in the app I am building needs to find people that are close to the location of the Job. So if the Job is in Kumeu (NZ), I want to see the people that are close (lets say 25km).

This is made easy with the Haversine formula. Google has a good article that gives a MySQL query that will produce a list of rows from the database where the locations are within a certain number of kilometres/miles.

The MySQL query looks like this:

SELECT *,
(6371 *
acos(cos(radians(174.556107)) * cos(radians(latitude))
* cos(radians(longitude) - radians(-36.775700))
+ sin(radians(174.556107)) * sin(radians(latitude))))
AS distance
FROM Locations
HAVING distance < 25
ORDER BY distance

The location in the example above (-36.775700, 174.556107) is of Kumeu (NZ). The table currently has 4,500 records and the query takes about 0.0063 seconds (actually it is usually 0.0001 seconds).

Note that the above query calculates kilometres. If you are wanting miles, change the figure of 6371 to 3959.

The HAVING distance < 25 means that we are only getting the records who are within 25km of the original location.