HOWTO: Use IdentD with OSX Yosemite

If you’re an Internet Relay Chat (IRC) user like me, you’re probably familiar with or at least have heard of an identd service. IdentD is simply a service that, when accessed on port 113 of a computer, returns a simple string that identifies you as a user. If you were to watch the traffic you’d see something like this

1234,6578 : USERID : UNIX : itsmemario

Most OSX IRC clients don’t support this feature, and very few (if any) IRC servers require it any more. For those who needed this in the past, there was Identd for Mac. Which created a simple and functional icon in MacOS:

9939331-2

However in OSX Yosemite IdentD for Mac stopped working. The original author, Gallerand Sebastien, stepped up and made a new version. I’ve translated (as best as I could) his article and made a copy of his code here. So far it works great.

For those using the old IdentD

If you had previously installed identd, remove the old version:

# Clean Up !!!
sudo killall identd
sudo rm -R /Library/StartupItems/IdentD
sudo rm -R /Library/PreferencePanes/IdentD.prefPane
sudo rm -R /usr/local/identd

Now you’re ready to set up the new IdentD as a service.

Download, extract and set up IdentD

1- Download the file identd

2- Extract it to the desktop and you get a folder named identd.

Now the fun part.. installing stuff!

3- These commands will copy identd to the proper location and start it up

# Prepare
sudo mkdir -p /usr/local/identd
sudo chown root:wheel /usr/local/identd

# Install
cd ~/Desktop/identd/
sudo cp ./identd /usr/local/identd/
sudo cp ./identd.conf /usr/local/identd/
sudo cp ./org.macmax.identd.plist /Library/LaunchDaemons/
sudo chown root:wheel /usr/local/identd/identd
sudo chmod 755 /usr/local/identd/identd
sudo chown root:wheel /usr/local/identd/identd.conf
sudo chmod 644 /usr/local/identd/identd.conf
sudo chown root:wheel /Library/LaunchDaemons/org.macmax.identd.plist
sudo chmod 644 /Library/LaunchDaemons/org.macmax.identd.plist

# Load & Start
sudo launchctl load /Library/LaunchDaemons/org.macmax.identd.plist
# identd will start on boot up now.

4- Now test to see if identd is running

# Try :
ps aux | grep identd | grep root

# should report a process belonging to root
# root 1393   0.0  0.0   861896   7012   ??  Ss   Sat07PM   0:01.79 /usr/local/identd/identd

5- Now let’s send a test ident call to the service

# type this at your terminal prompt :
telnet localhost 113

Which should return something like this:

Trying ::1...
Connected to localhost.
Escape character is '^]'.
_

You can enter something like this:

# Type the following and press Enter :
1234,5678

If all went well you’ll be greeted with this response, and you’re good to go!

1234,5678 : USERID : UNIX : JohnDoe

Connection closed by foreign host.

Customizing the User name

Let’s say you want a name other than JohnDoe.. NO problem.. the following lines would take care of that nicely

# Change name to YourNameHere
sudo sh -c "echo 1:YourNameHere > /usr/local/identd/identd.conf"
sudo launchctl stop org.macmax.identd

And you’re done!

Download the file identd.zip

Link to original code and article at macmax.org (in French)

Scripts to select the default Java version on MacOS

Thanks to superuser.com I found a neat trick to make it easy to list your installed Java versions and switch between them. Just add these to your .bashrc file:


#
#
#
alias java_ls='/usr/libexec/java_home -V 2>&1 | grep -E "\d.\d.\d[,_]" | cut -d , -f 1 | colrm 1 4 | grep -v Home'

function java_use() {
    export JAVA_HOME=$(/usr/libexec/java_home -v $1)
    export PATH=$JAVA_HOME/bin:$PATH
    java -version
}

The java_ls command reduces the output of java_home -V to just return the version numbers and java_use is just a shortcut for the exports and path updates you’d normally use.

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.