Ruby 1.9, TextMate and Segmentation fault errors

While tinkering with Ruby 1.9 in TextMate I found that Ruby was segfaulting on the TextMate Ruby Bundle output screen.

/Users/codethought/Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/catch_exception.rb:16: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

Turns out you can fix the error yourself… as I found at rubyflow.com

http://www.rubyflow.com/items/6795-solution-to-ruby-1-9-3-segfaulting-when-using-textmate-ruby-b

To quote here:

Edit the catch_exception.rb file in your Ruby bundle in TextMate. To get into it on my machine I had to do:

mate Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/catch_exception.rb

Then, comment out the require “cgi” line. And then remove all references to CGI::escapeHTML.

But a simpler way is to go is to download the change that someone else made from github and install it yourself.

https://gist.github.com/1354592

And put the new version catch_exception.rb in the following directory yourself:

Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/

And your problem will be resolved.

ADT and the ‘Debug Certificate Expired’ Error

Ran into this just this morning. I started up my Eclipse for Android environment and had all my projects greeting me with the error; “Debug certificate expired on 10/1/2011″. It’s an easy enough fix.

Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.

The Eclipse plugin should then generate a new certificate when you next try to build a debug package. You may need to clean and then build to generate the certificate.

Problem solved.

I’m writing this with tears on my eyes !!!

Does that title sound familiar? My wife and I got an email this morning from my father that read as follows:

Subject: I’m writing this with tears on my eyes !!!

Hello,

I’m sorry for this odd request and I’m writing this with tears on my eyes due to the situation of things right now, I’m stuck in London United Kingdom with my family,we came down here for vacation and we got Mugged at gunpoint, worse of it is cash cell phone and credit cards were stolen , it’s such a crazy and terrifying experience for us, we need help sort out our hotel bill and flying back home, the authorities are not being 100% helping us, but we thanks God we still have our passports, Our return flight leave today,But we still have problem in sorting out the hotel bills.Please help us i promise to refund it back.

Now I’m freaked out.

David.

There were two problems with this email:

  1. My father doesn’t write like he barely understands english. In fact he’s one of the most eloquent writers I have ever known and is a native speaker of the Queen’s English.
  2. My father lives 12 miles away and has no travel plans

Turns out this is happening to a surprising number of people. It’s a growingly common scam. It’s also happened to a friend of mine. Apparently there is a keystroke-logging trojan that’s in the wild. Virus scanners like F-Prot, and current Mal-ware scanners are not detecting it and it’s causing a lot of havoc:

  1. http://articles.cnn.com/2010-03-28/opinion/greene.email.scam_1_e-mail-first-byline-subject-line
  2. http://community.ca.com/blogs/securityadvisor/archive/2010/04/15/beware-of-scam-emails-i-m-writing-this-with-tears-in-my-eyes.aspx
  3. Google Support

If you see an email like this from any of your friends… CALL THEM before you decide to try to send money to them. Also, if you get an email like this from your friends, tell them to UNPLUG THEIR COMPUTER from the internet.. erase it completely and RE-install windows.

You could also tell them that perhaps they should consider buying a Mac… Because in 4 years of owning and using them I have yet to have them compromised by trash like this.

Open Terminal Here in Snow Leopard using Automator

A subject that has been visited plenty of times is having an “Open Terminal Here” ability from the Finder. For developers, it’s a easy way to look at files or folders and then jump quickly to a shell for the folder and execute shell commands (like mv or cp). Or to execute a build using make or ant.

I decided to make a version of that would work off the “Services” context menu. If you control-click a file and select Services | Open Terminal Here you’ll be taken to the folder containing that file. A control-click on a folder will take you to the folder you selected.

To use it, just unzip this file and put it in your ~/Library/Services folder.

Open Terminal Here.zip

The code itself is pretty straightforward:

(* 
   Workflow - Open Terminal Here 
   By David Orriss Jr - November 2010
   Another "Open Terminal Here" option.  This time as a service workflow in Automator

   For Snow Leopard
*)
on run {input, parameters}
	
	set the_path to (the POSIX path of input)
	
	set AppleScript's text item delimiters to "/"
	
	
	if the_path does not end with "/" then
		set parentPath to (items 1 thru -2 of text items of the_path) as string
		set the_path to parentPath
	end if
	
	set cmd to "cd " & quoted form of the_path & " && echo $'\ec'"
	
	tell application "System Events" to set terminalIsRunning to exists application process "Terminal"
	
	tell application "Terminal"
		activate
		if terminalIsRunning is true then
			do script with command cmd
		else
			do script with command cmd in window 1
		end if
	end tell
end run

How To: Apple Boot Camp 64-bit for Windows 7 on “unsupported” Macs

Do you own a Macbook Air or other modern Apple and want to install and use Windows 7 ala Boot Camp? If so, you may have encountered the dreaded “Boot Camp x64 is unsupported on this computer model” error dialog when trying to run the provided Snow Leopard Bood Camp setup.exe. Techulous has documented the workaround:

http://www.techulous.com/hardware/how-to-apple-boot-camp-64-bit-for-windows-7-on-unsupported-macs.html

Finding the Android Dev Phone 1 ROM Images

For some reason the ROM Images for the Android Dev Phone 1 have the links missing from the main ADP-1 download site. When you go to http://developer.htc.com/adp.html You’re greeted with a table of ROM images and file names but the links have been removed:

FirefoxScreenSnapz010.jpg

(You can click on the image to see the full-size version of the table.)

After some digging around I found that someone on the Android Developer List has found that the files are still on the website, only the links to them have been removed from the ADP-1 page. Creating the URL links are simple enough. You just start them with http://member.america.htc.com/download/RomCode/ADP and send with the file you want (i.e. ota-radio-2_22_19_26I.zip) The challenge here is that you cannot access those files directly, you have to be re-directed from http://developer.htc.com. If you’re a Linux or Mac user, this is solved with a simple shell script and the wget command. Modify the script for the ROM images that you want to download and you’re in business.

#!/bin/sh
IDIOTS1="http://developer.htc.com"
IDIOTS2="http://member.america.htc.com/download/RomCode/ADP"
wget "--referer=$IDIOTS1" "$IDIOTS2/ota-radio-2_22_19_26I.zip"
wget "--referer=$IDIOTS1" "$IDIOTS2/signed-dream_devphone_userdebug-img-14721.zip"
wget "--referer=$IDIOTS1" "$IDIOTS2/signed-dream_devphone_userdebug-ota-14721.zip"

If you’re a Windows user, you can accomplish the same thing if you have Cygwin installed: http://www.cygwin.com/


The script source for fetching the ROMs came from this discussion at The Android Developer mailing list. Thanks to Noah Tilton.

Installing Java 1.5 back into Snow Leopard

EDIT: This no longer works as of 10.6.5 without some additional tweaks. I have to update the post accordingly.

In an amazing moment of WTF I discovered this morning that after installing Mac OS X 10.6 (aka Snow Leopard) that the only version of Java running on it was 1.6. Now as an end-user, people probably won’t care. And I can kind of understand why Apple did it, given that Sun has done and End of Service Life for J2SE 5.0 (also known as Java 1.5). However a bunch of us still use earlier Java versions in active development projects. This was incredibly short-sighted of Apple. I’d guess that the 1.5 version probably exists on Snow Leopard Server Edition, but I’m not interested in paying for the server license when I don’t run OS X servers. However, it’s possible to bring back Java 1.5 onto your Snow Leopard installation. There are a few other pages that explain how to do this but I’ll re-iterate the steps I used here because it uses the most recent J2SE 5.0 release:

Preparation:

First, get Java for Mac OS X 10.5 Update 5 from Apple.

Next get Pacifist from CharlesSoft. This is a great utility. It’s saved my butt a few times. Especially when I needed to get something from an Apple installation package without having to re-run the installer. This qualifies as one of those times. If you don’t already have a registered copy, get one. It’s worth US $20.

How to install.

1. Use Finder to go to System > Library > Frameworks > JavaVM.framework > Versions and delete the two aliases (symlinks) "1.5" and "1.5.0". If you skip this step you will lose your Java 1.6 installation that comes with Snow Leopard. That would be bad. So don’t skip this step!

2. In finder, open JavaForMacOSX10.5Update5.pkg that’s inside JavaForMacOSX10.5Update5.dmg with Pacifist. Drill down to Contents > System > Library > Frameworks > JavaVM.framework > Versions.

3. In Pacifist, select 1.5 and 1.5.0, right-click, and chose Install to Default Location.

You can probably do the same thing with the 1.4 installation if you need it. I didn’t try.. but it would probably work.

Update 12-4-2009:After installing the latest Java update for OS X 10.6 I was greeted with the following change to my Java Frameworks directory. FinderScreenSnapz003.jpg

Apparently the updater saw fit to move my Java installation for 1.5 aside during the update and recreate it’s own aliases/symlinks. If this happens to you follow step one, and rename the 1.5.0 1 folder back to the original name.


Thanks to the following articles from which I borrowed and stole heavily…

- chxo internets
- oneswarm.org
- daveyshafik.com

Subversion and Snow Leopard

Along with so many others, I upgraded to Snow Leopard. Overall the upgrade went without a hitch. However, I noticed that my Subversion repository was no longer available from Subclipse or via the Web Browser. Not good.

So I did some digging around and upon finding this article from Patrick Rice http://patrick-rice.net/daybook/2009/09/20/subversion-snow-leopard-etc/ I was up and working again in a few minutes.

Apparently with the Snow Leopard upgrade, the Apache mod_dav_svn configuration was removed from /etc/apache2/other/svn.conf. Patrick references the following article. It’s extremely educational and informative: How To: Manage Your Own Subversion Repository In Leopard. The details still apply in Snow Leopard, as well.

Following these articles I just created a new /etc/apache2/other/svn.conf.

LoadModule dav_svn_module /usr/libexec/apache2/mod_dav_svn.so

<Location /svn>
    DAV svn

    SVNParentPath /Users/Shared/svn

    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile /etc/apache2/svn-auth-file
    Require valid-user
</Location>

Restart the Apache server (via Sharing in the System Preferences application). And you should have your repository back.

Bloo – the Facebook app for Android. Now on the Android Market

If you use and Android device like the T-Mobile G1 and you haven’t heard of Bloo yet, you will. This is probably the slickest application for Facebook on *any* platform. Excellent photo album and photo upload support, a slick user interface a small memory footprint, and it’s obviously clean, tight code judging from how fast it is. Configuring it does need a few simple steps that are all documented on his website. Use Facebook? Got the T-Mobile G1? Get this app. It’s a steal at the $1.49US price tag.

Useful Links for Getting Started with Bloo:

Manually Update your T-Mobile G1 to OS 1.5 (Cupcake)

T-Mobile was supposed to release Android OS 1.5 (originally code-named ‘Cupcake’) was supposed to be released the week of May 18th. However T-Mobile decided to delay the release.

Enter the Android community… Someone has found the downloadable version of Cupcake, signed and ready to install on the T-Mobile G1! And with a few simple steps, you can install it before the T-Mobile OTA (over-the-air) push.

Now, without any further ado – the following warning:

WARNING: T-Mobile does not support manual installations and will not assume responsibility for any device problems or failures that occur from following these instructions.

*NOTICE: This can be a risky procedure, and if you make a mistake and brick your phone: T-Mobile, the T-Mobile Forums, authors of this post (i.e. ME), or other subsequent discussions, nor any party, company, corporate entity, individual, or estate; living or dead, associated or otherwise connected with the above shall not be held liable for any damage you do to your device, others devices, your person, other people/living things, or property belonging to you any other entity in the known universe should you attempt to root your phone. You take full responsibility and liability for any action you choose to take to attempt to gain root access to your phone. Do this at your own risk.

  1. Go download the Android 1.5 ‘Cupcake’ release here.
  2. Rename the downloaded file from signed-kila-ota-148830.de6a94ca.zip to update.zip and place it at the root i.e the very top directory of your Micro SD card. (If you added the file to your microSD card by connecting the handset to your computer via USB [rather than using a dedicated microSD card reader], make sure to unmount it and disconnect the USB cable now.
  3. Turn off your G1 Make sure it is completely powered off. Now again turn it on by holding the Home+End keys until you see T-Mobile G1 logo.
  4. From the icon screen, open the keyboard and hit Alt+L.
  5. Press Alt+S to begin the update. Remember, the update needs to be in the root of the Micro SD card and needs to be named update.zip.
  6. Once it finishes, follow the onscreen instructions and press Home+Back to finish.
  7. G1 Phone will reboot a few times to flash different parts of the firmware.

If all went well, you should now be running Android Release 1.5 on your T-Mobile G1…!

And, yes.. I installed it using the above steps.. and it’s working great..!