Showing posts with label osx. Show all posts
Showing posts with label osx. Show all posts

January 27, 2012

Getting pyglet setup in OS X 10.7.2


  1. Create a virtual env and activate it
  2. hg clone https://code.google.com/p/pyglet/
  3. pushd pyglet; python setup.py install
  4. popd
  5. easy_install  pyobjc==2.3 # the ==2.3 is required as of 2012-01-27, or pyobjc-core will not install
  6. python -c "import pyglet" # this step should not fail 


Cheers,
Steve

February 25, 2011

Endianess, Thy art Sneaky

I took delivery of my Linksys WUSB600N V2 today and was very excited to get my G4 Mac Mini online. The many online sources suggests all I need to do is change a few values in an Info.plist. However as it turns out, that wasn't enough. In order for me to get it working, I had to change the values, but also write the new values in hexadecimal format. This is because even though 0x0079 translates to 121, that is only true for a little endian system. Likewise, 0x1737 also only translates to 5943 under a small endian system. Since OS X running on PPC is a big endian system, unless you write out the exact byte values using hexadecimal notation it isn't going to work.

So, for the record: Linksys WUSB600N V2 runs just fine on OS X 10.5.8 running on G4. It does 5GHz and successfully authenticates with my airport express, which the Monoprice USB 2.0 Wireless N it replaced didn't.

Cheers,
Steve

February 21, 2011

Broken OS X Installers and How to Fix Them

The installers Ralink provides for some of their chipsets, like the RT2770 does something retarded: they attempt to unload a kext in a pre-install script, and when it fails the script fails and the entire install fails.

This means on a new machine, or one that never had the kext installed, you can't install their driver.

Fail.

It used to be that pkg installers were just directories, and fixing something like this is easy: find the offending line and comment it out. But OS X 10.5 onwards introduced flat pkgs. These don't give up their secrets so easily.

An article on cnet tipped me off to pkgutil, a program that is installed by default. It lets you expand a flat pkg into a directory, and more importantly, allows to repackage it as a flat pkg after you have excised the cause of your troubles. This last step is important because a flat pkg when unpacked has a different directory structure to a "normal" pkg and thus can not simply be open'd.

Here is what I did to fix Ralink's installer:

  1. pkgutil --expand installer.pkg ~/Desktop/installer-expanded.pkg
  2. cd ~/Desktop/installer-expanded.pkg/installroot.pkg/Scripts/
  3. vim preinstall #alternatively, for ppl unfamilar with vim:
    1. open .
    2. right click on preinstall, open in TextEdit.app
  4. comment out the offending line which is trying to remove the kext
  5. save and exit your editor
  6. cd ~/Desktop
  7. pkgutil --flatten installer-expanded.pkg installer.pkg
  8. open ./installer.pkg

Cheers,
Steve

December 31, 2009

Order Matters With XCode's Build Phrases

I use a custom script to insert the current git commit into GeoNote, so when I get bug reports I have a better idea of which version the user is running. The script is as below:

import os
from Foundation import NSMutableDictionary

version = os.popen4("/sw/bin/git rev-parse --short HEAD")[1].read()
info = os.environ['INFOPLIST_FILE']
print info
plist = NSMutableDictionary.dictionaryWithContentsOfFile_(info)
print plist
plist['revision'] = version[:-1]
plist.writeToFile_atomically_(info, 1)

This was added as a Run Script Build Phrase. The problem I noticed was that the commit short hash inserted into Info.plist was always one commit behind. After some head scratching, I realised this was because by default the new build phrase is inserted last, and the order matters! It isn't actually possible to reorder build phrases by drag and dropping the children nodes around. You have to do a head-insert by dragging a child to the parent, which inserts it at the top.


Voila, problem solved.

Cheers,
Steve

April 29, 2009

Stripping trailing whitespace from XCode




Firstly, my usual approach of s/\s+$//g doesn't work since it eats up the newline too. s/\s+$/\n/g doesn't work either because the Replace: field in the find dialogue doesn't escape the \n.



Final solution is as shown: s/[ \t]+$//g




Cheers,

Steve

September 20, 2008

A relatively pain free Linux/OS X VNC setup

Ever since I got my 2nd monitor, I been using VNC to work on my laptop. Leopard's inbuilt VNC server isn't really VNC compliant, and has many issues when used with a normal VNC client. I have found Vine server to be an excellent replacement. The client side is a little interesting. RealVNC didn't work too well for me, in that often the screen would stop responding, or it would not receive key events. The best setup I have found is to use tightvnc with the following Vine server settings:


  • Devices


    • Keyboard Layout: US

    • Keyboard Events: User Session Events




The client and server will happily share the clipboard if you enable it. Settings are accessed via F8 in the client, and via Preferences in the server. The client is smart enough to synchronise clipboards only when it loses focus - which would be you switching away to say, paste a url into firefox. All in all it is a fairly painless experience.


Cheers,

Steve

December 13, 2007

Computing Oddities

Two strange and weird things happened to me recently. One is my /dev/null disappearing from leopard!




A large number of programs, both Cocoa and *nix relies on /dev/null being present. As you can see I could not gain root privileges, and thus could not recreate /dev/null (character device, 3,2). I had to in the end reboot and /dev/null was recreated.

Second strange thing is when I created a self-signed certificate for use with apache2 (for anonshare). I created it with openssl specifying 36500 for -days. The result is an certificate with expiration date in the past!





I am not aware of any X.509 specification regarding the number of days a certificate can be valid for, so I wonder - is this a bug in openssl?





Cheers,

Steve

August 26, 2007

Writing CVs in Lyx under OS X with Fink TeX

Raison d'ĂȘtre


There is preciously little information on the WWW on how to write a CV using Lyx under OS X with a tex installation supplied by Fink. There is a outdated tutorial which failed to work, and thats about it. This document should hopefully shed some light on the matter, and will show you how to install the moderncv latex class and get LyX to recognise it so you can make a nice CV for yourself.



moderncv class


The moderncv class is availiable at CTAN.



Installation


Tex looks for classes etc in its path, which can be discovered using:kpsepath texYou will get a pretty long list of paths where tex looks for classes. Note in particular /$HOME/Library/texmf/tex///: this is a sensible place to put your own custom files in my opinion, to avoid polluting the entire local install (and to keep fink happy by not having files in places it doesn't expect). The // means all directories below
/$HOME/Library/texmf/tex/ will be searched too. So unpack the zip, or place the individual files under /$HOME/Library/texmf/tex/moderncv/. Once you are done, run texhash in /$HOME/Library/texmf/.

LyX reconfiguration


The last step is to ask Lyx to reconfigure itself so it will update its own list of avaliable classes: LyX->Reconfigure, then restart LyX as recommended. That should be it :-)



Usage


Have a look in the examples/ directory in the moderncv zip file to see how to use it.

Specifically, you need to insert some latex before \begin{document}, in Document->Settings->Latex Preamble, or it won't work. You need at a minimum \familyname{} and \firstname{}. For more read the examples. Further more, you also need to insert ERT of \maketitle to have a nice title. That should be it! :-)

Installing other classes


These same steps should apply to installing other classes you find on CTAN





Cheers,

Steve