Jun 22

Installing Django and MySQL on Mac OS X Lion

In the past 6 months I’ve had to setup Django and MySQL 4 times on our various Mac hardware at work. ¬†I figured since I’ve seen to have it down pat now I should document it somewhere ūüôā

Python should already be installed.

sudo easy_install pip

download MySQL dmg from mysql.com. ¬†This is the version I’m using.

Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive 5.5.25 111.9M
(mysql-5.5.25-osx10.6-x86_64.dmg) MD5: 081d3345daaae6f5f36a9f245855798b

sudo easy_install django

nano ~/.profile
paste this in:
export PATH=/usr/local/mysql/bin:$PATH
export DYLD_LIBRARY_PATH=”$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/”

Download and install https://github.com/kennethreitz/osx-gcc-installer

sudo easy_install MySQL-python

You are ready to go ūüôā

 

Jun 13

Raspberry Pi and MAME Part 2

THIS IS AN OLD POST!  Please go to the latest update here!

Hello everyone from raspberrypi.org!  Thanks for visiting, more updated tutorials and binaries are available by clicking the menu item Raspberry Pi Gaming!

UPDATE: New Raspbian Binaries Available (new binaries above)

So I’ve spent even more time playing around with my MAME compile and my Raspberry Pi. ¬†I have a new set of downloads, once is a set of binaries so you don’t even need to do a make install.

  1. Unzip MAME directory.
  2. chmod 777 /dev/fb0
  3. Put your roms into mame/share/advance/roms/
  4. run mame/bin/advmame
    1. The first time it’s run it will generate a set of folders and files into ~/.advance
  5. edit your ~/.advance/advmame.rc to include the proper display configuration
    1. For HDMI try:
      1. device_video_clock 5 ‚Äď 50 / 15.62 / 50 ; 5 ‚Äď 50 / 15.73 / 60
    2. For NTSC TVs try:
      1. device_video_clock 5 – 50 / 15.73 / 60
  6. run mame/bin/advmame <gamename>
    1. cd into mame/bin/ then ./advmame gamename
  7. ENJOY!!!

Download AdvanceMAME Raspberry Pi Binaries

As an aside, I overclocked my Pi to 900Mhz, and Street Fighter 2 is slow, but playable ūüėÄ

edit: fixed an error in the path.  Also added a different way to run advmame (the way I run it).  Just cd into the bin directory then ./advmame gamename.

 

Jun 06

raspberryPI and MAME

UPDATE: Edited to fix some issues.

SECOND UPDATE: New Post with new binaries!

 

So for the past few days I’ve been struggling to get MAME running on the raspberryPi. ¬†It was compiling, it would install, but I would always get a video_fault error. ¬†It ended up being that I had to modify the .rc config to have the correct display settings. ¬†I’m using a TV with the RCA plug so YMMV.

Edit: I’m also logged in as root. ¬†I know this is bad but I haven’t been able to get it working without being root. ¬†There is no password set for root, so you have to make one before you login as root or “su” to root.

sudo passwd root

http://advancemame.sourceforge.net/doc-install.html#4.5  РThis link will help you find the correct display settings.

http://sheasilverman.com/rpi/advancemame-0.106.1.zip РThis is the compiled AdvanceMame for raspberryPi.  Extract it to a folder, then type:

make install

You can then run mame by typing advmame at the command prompt. ¬†The first time it runs it makes a config file, then quits. ¬†You should find the folders and configs in ~/.advance/¬†/root/.advance/. ROMs go in ~/.advance/roms¬†/root/.advance/roms/ . ¬† The config file ends in “.rc” ¬†Edit that file to include your display information.

For HDMI try:

device_video_clock 5 – 50 / 15.62 / 50 ; 5 – 50 / 15.73 / 60

For NTSC TVs try:

device_video_clock 5 - 50 / 15.73 / 60

I don’t know how long I can keep the compiled source on my host as I have limited bandwidth, but for now, it will be here. ¬†I’ll try and find a mirror as well.

 

Jun 03

Raspberry Pi!

So, I recently got my Raspberry Pi and have been having a lot of fun with it.

Programming in Python on it, running Quake 3 Arena, trying to compile different apps with various states of success.  Using Google Chromium on it.

The experience has been amazing.  This $35 machine has allowed me to play games, browse the modern internet, program, all using hardware I have laying around.

The Raspberry Pi outputs to both HDMI and RCA, so I’ve been using an old studio monitor at work as a display and it runs great. ¬†At home I connect it via HDMI and it looks beautiful.

I am in the middle of uploading an iso/image file of my SD card so if anyone wants to try out these features without having to go through the setup, they can.

I plan on also updating with some tips and tricks.

I want to thank the blog http://myraspberrypiexperience.blogspot.co.uk/ РThey have provided some wonderful guides so far.

One of my goals is to get the LOVE2D framework compiled. ¬†At the moment, it won’t work because of the non existant OpenGL drivers, but nLove is available, and was made for ARM based platforms. ¬†I am having difficulty getting it compiled, but I’m going to keep trying.

First tip to remind myself:

sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc

This will enable ssh on the device at bootup.  If you just want to enable ssh once, then at the command prompt enter:

sudo /etc/init.d/ssh start

This assumes you are running the Debian Squeeze Raspberry Pi image.

Apr 03

Arduino and EL Escudo

Another fixit type post.  Every so often I repurpose my Arduino and EL Wire for a new project, and each time I always forget how to properly get the EL_Escudo library resetup.  I should probably just fork the code on GitHub with the fixes that have been posted, but who remembers to do that.

So, the EL Escudo is a cool shield for the Arduino. ¬†SparkFun sells it. ¬†I highly recommend them. ¬†There is a small bug in the library code that is fixed by bobmct’s post (http://www.sparkfun.com/products/9259#comment-4eaad859757b7fd35100ba5d):

“I realize this is a rehash of what others above have said, but I got mine to work by doing the following.

Getting the El Escudo to work
Two problems:
1. Must fix a mistake in the library code: Needed to make in EL_Escudo.cpp (thanks BMK):
void EL_EscudoClass::on(char channel)
{
pinMode(channel, OUTPUT);
digitalWrite(channel, HIGH);
}
void EL_EscudoClass::off(char channel)
{
pinMode(channel, OUTPUT);
digitalWrite(channel, LOW);
}
2. They also recommend GND and HVGND are tied together. Look at photo (thanks miku) http://dl.dropbox.com/u/3551240/el-escudo.JPG . With the code change made above I also tried to see if the El Scudo would work without this jumber (between GND and HVGND), and it did work and it did work without it. I was using the EL_Blink.pde example when testing this.
The above got things to work with a handheld 3V inverter (two AA battery powered) with the button pressed 3 times (a steady AC supply, no blinking) with the output of this inverter connected to the El Escudo shield√Ę‚ā¨‚ĄĘs √Ę‚ā¨ŇďEL Driver Inverter Ouput√Ę‚ā¨¬Ě JST jack.
The Arduino was powered from a 5VDC wall transformer (1A capacity) with the barrel jack plug connected either on the Arduino√Ę‚ā¨‚ĄĘs barrel jack connector or connected to the El Scudo√Ę‚ā¨‚ĄĘs √Ę‚ā¨ŇďEL Driver Raw Voltage√Ę‚ā¨¬Ě JST connector.
You will need to fabricate the strange El Wire plugs to JST plugs to make all the connections. In my experience above, the polarity was not a factor because the output from the inverter is AC and so is the input to the el wire.
Hope this helps.”

My only issue was with number 1.  Fixing that caused the main library to work again.

With the upgrade to Arduino 1.0, WConstants.h will throw an error since that isn’t being used anymore. ¬†You¬†should¬†be able to safely change all WConstants.h to Arduino.h

 

Mar 27

PhoneGap 1.5.0 and iOS 5.1

Hey All,

Just posting here so I remember some fixes I had to do with the new release of PhoneGap 1.5 (also known as Cordova).

When you initially run your new xCode product, you will get a ton of “semantic” issues. ¬†The fix is to go to Build Settings ->¬†Objective-C ¬†Automatic Reference Counting -> “NO”

I found this clarification from a comment posted by Alejandro Orduz at http://phonegap.com/2012/03/06/phonegap-1-5-released/ 

“ok, i manage to make it work, Cordova, under Xcode 4.3.1…. regarding the www stuff…

First of all, getting into this painful process(more of all because of my lack of knowledge of Xcode), i wen to the process to upgrade my iPhone to the latest iOS 5.1, then had to upgrade Xcode to 4.3.1 to support testing in this device, but also did an upgrade to the latest lion 10.7.3…. so it was a boring weekend of upgrading….

The first time you run a new phone gap project under Cordova, is not like old days, now when you run you get a scary 9 errors warnings about a Semantic Issue in some,¬†NSAutoreleasePool¬†well, for some of us, that is like speaking chinease… but it can be solved very easy… the new Xcode has some Automatic Reference Counting ON by default, so you just go to the project Build Settings, find Objective-C ¬†Automatic Reference Counting and change it to “NO”, after that everything goes to normal…. then it can build, add the www, you get the normal iPhone simulator error, and then, like before, had to drag and drop the www folder into the project root….

Changes like this are very scary for people like me, that found phonegap an amazing tool to build mobile apps with our web development knowledge…. :-{ ¬†”

Also! I finally got the camera example working. ¬†I was receiving a weird “wait_fences: failed to receive reply: 10004003” when I used the Camera example code verbatim. ¬†It would work, but I would only recieve a small blue box on my iPhone.

The issue is that the code on line 40:

smallImage.src = “data:image/jpeg;base64,” + imageData;

is wrong.  PhoneGap 1.5 / iOS 5 stores the taken photo in a temporary directory, so you dont get the base64 data anymore, you have the actual URI for the photo in imageData.  All you need to do is change line 40 to be:

smallImage.src =  imageData;

and it will work.

 

I hope this helps out some people. ¬†It’s working for me, YMMV.

-Shea