Monday, 8 December 2014

How to save your data on a non bootable Macbook Pro (via recovery mode and terminal)

I recently had to pull data off of one of my coworkers Macbook Pro when his laptop became un-bootable and he had no backup.  I was able to boot the computer to single user mode using command+s,  unfortunately things were corrupt and the volume didn't even have the fsck executable in /sbin/

second approach was to boot into the recovery volume since it has a clean set of tools there for diagnosing and repairing.

diskutility was pretty useless and spewed a bunch of errors for about 10 minutes which resulted in nothing.  The only useful thing it did was tell the system drive was /dev/disk0s2

I then opened the terminal  and issued the following command:
fsck_hfs -fy /dev/disk0s2

this promptly diagnosed the drive and determined it was corrupt.  now for the repair

I used the following command:
diskutil repairvolume /dev/disk0s2

this did a bunch processing in the terminal and eventually said everything was clean and fixed.  Do I believe it?  no,  so I'm going to recover what data I can while the volume is mounted.

I plugged in an external USB drive the computer and it was promptly mounted at /Volumes/USB

from the terminal i used the following types of commands to manually copy the important data to the USB volume:

cp -r /Users/someone/Folder /Volumes/USB/Folder

Thursday, 13 February 2014

Using Mysql from the Terminal in OSX with MAMP

If you're comfortable dealing with Mysql from a command line like linux users would be,  you'll find it a bit frustrating to realize that MAMP on OSX doesn't by default give you global access to the mysql binary when you launch terminal.    On a vanilla install the default location of the mysql executable lives here:


Now that we know where it lives lets set up a global way to access it by creating a symbolic link of it into /usr/local/bin

sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql

now you'll have access to mysql from any terminal location

You can do the same procedure for mysqldump as well.

Tuesday, 21 January 2014

building a cMangos server with bots in a nutshell.

I'm posting this so I remember how the hell to do this when i need to know again in 2 years.

The basic workflow is as follows:
clone cmangos, pull playerbot to merge projects, clone ScriptDev2, then build.

10 steps to get it setup  (git addresses may change)

1. git clone git:// mangos

2. cd mangos

3. git pull  (this merges playerbot into cmangos classic)

4. git clone git:// ~/mangos/src/bindings/ScriptDev2

5. create a ‘build’ and ‘run’ folder in mangos folder

6. cd into ‘build’

7. cmake .. -DCMAKE_INSTALL_PREFIX=~/mangos/run -DINCLUDE_BINDINGS_DIR=ScriptDev2

8. make

9. make install

10. Setup Databases according to current site instructions

Sunday, 5 January 2014

Finding out your external IP address on a linux machine that is command line only.

Recently i've been dabbling with VPN services on various computers in my house and I needed to verify if a particular machine was using the VPN IP or not (it's an Raspberry Pi running OpenElec)

first step was SSH'ing to the Pi and then to find out what my IP currently really is.

the easiest way is to use an external service via the command line browser or download tool. Since wget is available on most systems, we can use that.
To find your ip, use:

wget -qO- ; echo

Monday, 30 December 2013

Blender 3d: Rendering only a small portion of your scene

sometimes i have very large elaborate scenes to render but I need to tweak a particular texture on one small portion of a much larger render..    here's a quick way to only render a small portion of your entire scene at its full size (saves a ton of rendering time)

press Control + B when you are in the camera view and draw a square around the object you want to render.

to release the selected area just do a Control + B again outside of the render area of the main scene.

Friday, 15 November 2013

Deploying a development iOS app to a small number of internal devices

This doesn't happen often where I work,  but once in a blue moon,  we need to add a certain functionality to our iPhone app that we need to test internally on a few devices but some of the devices are located in another province thus,  we don't have physical access to some of these iOS devices.

how do we go about doing this?  I've used a 3rd party called Diawi in the past and it works great as long as you follow a few steps.  (there are alternative sites for doing this like etc)

what is the first thing you need to do?   You need to collect the UDID's of ALL the devices you wish to test or adhoc deploy to. The most reliable way to do this is via iTunes.   (i've tried UDID retrieval apps in the past however as of iOS7 all of these methods are broken and return bad information. If the UDID returned starts with a a bunch of ffffffffffff's in a row,  then you don't have a real UDID and it will only cause you headaches. )

what are the steps to retrieving the UDID's for a particular device?

Step 1. Launch iTunes.

Step 2. Plug in your iPhone or iPod or iPad

Step 3. Click on the device name in iTunes Menu

Step 4. Click on "Serial Number" in Summary Menu.

Step 5. Notice that the Serial Number will change to a long letter and number string called UDID.

Step 6. Right click on the UDID number and choose "Copy",  then paste that UDID number into notepad or an email so we can add it to our developer provision for testing.

Once you have collected the UDID's that you require for internal testing the next step is to add them to your adhoc or development provisioning profile (example .mobileprovision) on your apple developer profile.

Step 1. Log into the apple developer portal and navigate to "Certificates, Identifiers & Profiles".  Click on the Devices 'all' section on the left and it will show you the current list of developers associated to your provision profiles.   (Yes this means your development profile as well as your adHoc profiles.)
Click on the + sign at the top right to add new UDID(s)

Step 2. The next page will just ask you to enter a name and the UDID of the device you wish to add. Input the relavent information and then click "continue"

Step 3. Once you've added your additional UDIDs for deployment you then need to look for the 'provisioning profiles' section of the left side bar and click on either Development OR Distribution depending on what kind of app build you plan on using the newly added UDIDs against.   For testing internally we do AdHoc distribution builds of our App.   But you could technically use a Debug build with the Development profile.   Click on the profile you need on the right panel,  because just because you've added UDID's to your apple devices list DOES NOT mean they are currently active inside the provision profile.

Step 4. By clicking on the profile you can then see more information about the profile; but, more importantly you can edit the profile to "activate" your newly added UDID's.    click "edit".

Step 5.  On the edit provision page you can see that Ali and Andrea whom I just added as new UDID's are unchecked and thus not actually allowed to use our development build with this provision file.  If you were to send them the .mobileprovision file at this point their iphone's would simply display an error and refuse to install the provisioning file.   You need to check these names off in this screen and then hit "Generate" at the bottom of the page to generate a new development provisioning file.   Note* you will also have to do the same to the Distribution profile on the left panel if you require them to test against an AdHoc build which requires the use of a distribution profile and not a development one.

After you've generated a new provision,  can you simply download it and use it to build your AdHoc version and then submit it to Diawi for your testers to download and try out.