Thursday, September 26, 2013

Load iOS 6.1 SDK into XCode5



  1. Find the SDK file, like iPhoneOS6.1.sdk, in your or your friend's older Xcode directory.
  2. Sym link the old SDK to the new XCode5 app directory:
  3. ln -s /Applications/Xcode4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk

Thursday, August 15, 2013

RabbitMQ Installing rabbitmqadmin


rabbitmq-plugins enable rabbitmq_management

Restart rabbitmq server:
rabbitmqctl stop
./rabbitmqctl-server

Download rabbitmq_management from:
http://[server]/cli/

Friday, August 2, 2013

Django filter on multiple object IDs

https://docs.djangoproject.com/en/1.5/topics/db/queries/

# Get blogs entries with id 1, 4 and 7
>>> Blog.objects.filter(pk__in=[1,4,7])

# Get all blog entries with id > 14
>>> Blog.objects.filter(pk__gt=14)

Monday, July 22, 2013

Print attributes of python object

from pprint import pprint
pprint (vars(your_object))

Monday, July 8, 2013

Re-install xcodebuild

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Wednesday, June 26, 2013

misc notes Django Python South migration

#sudo python manage.py migrate [application name]
#sudo python manage.py migrate guidebook
#sudo python manage.py migrate appsub


#sudo python ./manage.py schemamigration appsub --auto

#sudo python manage.py migrate --list
#sudo python manage.py migrate appsubmit
#sudo python manage.py migrate --list

Monday, June 24, 2013

ant build problems

Buildfile: /Users/deanliu/Desktop/gb_build/src/android/build.xml
  [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be found.

BUILD FAILED
Desktop/gb_build/src/android/build.xml:88: The following error occurred while executing this line:
Desktop/gb_build/src/android/build.xml:51: Problem: failed to create task or type for
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any / declarations have taken place.


Solution:

http://www.coderanch.com/t/506388/tools/failed-create-task-type-undefined

Install ant-contrib:

#sudo port install ant-contrib

Tuesday, April 9, 2013

emuclient --config PS3_Battlefield3_McKack.xml --port /dev/ttyUSB0 --type joystick --refresh 4

Sunday, April 7, 2013

Simulate Mouse Clicks on Python



The evdev package provides bindings to parts of the input handling subsystem in Linux. It also happens to include a pythonic interface to uinput.
Example of sending a relative motion event and a left mouse click with evdev:
from evdev import UInput, ecodes as e

capabilities = {
    e.EV_REL : (e.REL_X, e.REL_Y), 
    e.EV_KEY : (e.BTN_LEFT, e.BTN_RIGHT),
}

with UInput(capabilities) as ui:
    ui.write(e.EV_REL, e.REL_X, 10)
    ui.write(e.EV_REL, e.REL_Y, 10)
    ui.write(e.EV_KEY, e.BTN_LEFT, 1)
    ui.syn()

Raspberry Pi linux-headers 3.1.9+


Note by Dean:  I have made some changes from the original post to match my 3.1.9+ environment
by shig » Sun Sep 23, 2012 6:31 am
So, as the standard debian kernel packaging system isn't used (the kernel and module are all in the raspberrypi-bootloader package), and the headers aren't distributed, you will need to download the source tree from the github at https://github.com/raspberrypi/linux/. You won't have to recompile it however.

Here a quick guide. I'm assuming that you already have build-essential/compiler/everything else you need in place anyhow, and just need the kernel specific headers and symbols.

Download the kernel source and unpack it with:
CODE: SELECT ALL
sudo bash
cd /usr/src
git clone --depth 1 git://github.com/raspberrypi/linux.git

Then we'll grab the config from the raspberry pi's running kernel, and get the source tree to prepare itself for module builds:
CODE: SELECT ALL
cd linux
zcat /proc/config.gz > .config
make oldconfig
make modules_prepare

What you will also need to build modules that will actually go into the new kernel is Modules.symvers. Luckily, someone has nicely put it in the raspberrypi/firmware github along with the pre-compiled kernel and firmware binaries, so we can just download the latest one from there:
CODE: SELECT ALL
wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers

Then just make symlinks available in /lib/modules/[kernelversion]/ for the stuff you're compiling. Might as well put a symlink in for /usr/src/linux etc as well
CODE: SELECT ALL
KSRC=`pwd`
pushd /lib/modules/`uname -r`
ln -s ${KSRC} source
ln -s ${KSRC} build
popd

pushd /usr/src
ln -s ${KSRC} linux-`uname -r`
ln -s ${KSRC} linux
popd

Apart from the time downloading, the rest should take about 10 minutes or so hopefully, depending on how fast the storage you've got available is. This will also take up about 630MB of space under /usr/src until you clean it up

Hope this helps

Friday, January 18, 2013

Logs of OSX downloads

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'


http://www.macgasm.net/2013/01/18/good-morning-your-mac-keeps-a-log-of-all-your-downloads/

Friday, December 21, 2012

Undo last commit and re-commit


http://stackoverflow.com/questions/927358/git-undo-last-commit
$ git reset --soft HEAD^      (1)
$ git commit -c ORIG_HEAD     (2)

Wednesday, December 5, 2012

Kill all xcode related processes

ps axww | grep -i xcode | cut -d " " -f1 | while read i; do kill -9 $i; done;

Saturday, November 17, 2012

Symbolicate crash files



#!/bin/sh
if [ $# -ne 2 ]
then
echo "Usage: Copy 'app_name'.app and 'app_name'.app.dSYM into `dirname $0` and run"
  echo "`basename $0` app_name crash_file.crash"
  exit 1
fi
CRASH=$2
APP=$1
DEVELOPER_DIR=`xcode-select --print-path`
export DEVELOPER_DIR
SYMBOLICATE_PATH=${DEVELOPER_DIR}/Platforms/iPhoneOS.platform/Developer/Library//PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash
set -e
CRASH_UUID=`grep --after-context=2 "Binary Images:" "${CRASH}" | grep "${APP}" | grep -o "<.*>" | sed -E "s/<(.*)>/\1/"`
echo "Found crash UUID: \"${CRASH_UUID}\""
APP_UUID=`dwarfdump --uuid ${APP}.app/${APP} | cut -d ' ' -f 2`
echo "Found app UUID: \"${APP_UUID}\""
DYSYM_UUID=`dwarfdump --uuid ${APP}.app.dSYM | cut -d ' ' -f 2`
echo "Found dsym UUID: \"${DYSYM_UUID}\""
echo "-----------------------------------"
echo "UUID's must match ${CRASH_UUID} ${APP_UUID} ${DYSYM_UUID}"
echo "-----------------------------------"
mdfind "com_apple_xcode_dsym_uuids = *"
"${SYMBOLICATE_PATH}" "${CRASH}"

Monday, October 29, 2012

Photoshop preferences location

Where is photoshop preferences located on OSX / Mac?

/Users/[user]/Library/Preferences/Adobe\ Photoshop\ CS3\ Settings/Adobe\ Photoshop\ CS3\ Prefs.psp

Thursday, October 4, 2012

Hide back button UINavigationItem


self.navigationItem.leftBarButtonItem = nil;
self.navigationItem.hidesBackButton = YES;