Mar 27, 2008
New Ruby Dev Site at Sun
Create a Clean Zip on OS X Leopard 10.5
Have you ever created a zip archive on your Mac and sent it to folks on another OS? Have they complained about about all the metadata directories included in the zip? An extra .DS_Store and __MACOSX directory, in every directory, seems to always cause a few complaints. What is a Mac fan boy/girl supposed to do?
Well last week I did a little searching around for a solution. I found several Applescript solutions that seemed a bit over complicated to me and require much more effort than I am willing to provide. :) There must be a simpler solution to the problem, and I think I have found it.
You can use the built in zip command to get a clean archive. I haven't thoroughly tested this, but so far it seems to work. To produce a clean metadata free archive use the following command:
zip -rX archive_name.zip dir_to_zip -x *.DS_Store*A brief explanation is in order.
- The -r switch recurses the target directory and gets all subdirectories.
- The -X switch removes "extra file attributes" according to the man page. It seems to remove the "__MACOSX" files as well.
- The -x switch allows you to provide a space separated list of file or directory patterns to exclude. So for example, if you needed to remove subversion directories you could add *.svn* to the end of the example.
I've tested the zips created with this method on XP and on Ubuntu 7.10 and both seem to be metadata free. Please drop me a comment if you can further elaborate or have a better version of this command. The best solution must be found for the sake of Mac users everywhere! :)
Mar 17, 2008
Doomsday (Dumbsday?)
Well I went and saw the apocalyptic action film Doomsday over the weekend and learned some very interesting things. Before I go into the detail a quick overview is in order for those of you who have not seen the film.
The year is 2038. Thirty years prior, a killer virus breaks out in Scotland. The virus involves lots of bleeding and throwing up, and its deadly. So, the authorities decide to quarantine the entire country of Scotland. They erect a wall, mine the ocean, setup a no fly zone, no one gets out. Back to the present(future), it looks like the virus has returned in London this time. However, the authorities have noticed that there are a few survivors in Scotland. So they decide to send in the hottest babe they can find (played by Rhona Mitra, and she is hot) to unravel the mystery of the survivors and bring back a cure.
Here is what I learned about humanity after an apocalyptic event:
- The most likely people to survive a killer virus are hair stylists and tattoo artists. Cause in the post apocalypse, everyone has a punk hairdo, lots of tattoos, and look like extras from the Road Warrior.
- You can survive for 30 years as cannibals. I guess man jerky must keep better than beef jerky.
- Even though ancient castles were designed to hold 20 to 30 people of an average size of 5' 6", if you try hard, you can get at least 200 or 300 people in one, and still have room for a Gladiatorial Arena! Humans can accomplish anything if they put their mind to it.
- Livestock will be free to multiply like crazy. Since no farmers survive, everyone forgets how to grow crops and raise animals. See 1 and 2 above.
Here is what I learned about the future:
- We will soon lose the ability to make night vision goggles. Cause they send the heroine into an area without electricity in the middle of the night, without any.
- We will also soon forget how to make bullet proof glass. Cause the armored personnel carrier in the film has its windows broken out with simple pipes and arrows.
- Unmanned drones will also become a thing of the past. The only intel available in 2038 is from satellite photos.
- Cell phone networks will not change at all, cause if you find a phone made in 2008, 30 years in the future, it still works. Plus cell towers still work even when there is no electricity, I didn't know that!
- You won't be able to make a GPS tracking device smaller then the size of a small flashlight.
I won't say the movie is bad, you just have to have a high suspension of disbelief level. The story is very similar to Escape from New York, with Road Warrior stylizations thrown in. My advice, wait for the DVD.
Mar 13, 2008
Dell Linux Laptop???
About 3 weeks ago, I saw that Dell had their 15.4" Linux laptop on sale for about $450. Wanted to try a major brand Ubuntu based Laptop, so I ordered one.
Well I still don't have the machine and I got a call from Dell telling me that the machine is backordered another week.
No wonder Michael Dell had to come back. What a mess. My previous experiences with Dell have been very positive. Generally you would order something and get it within a week. This time they projected a 2 week turn around, and now I'm looking at more like 4 weeks. Not a good way to do business.
Still looking forward to the machine. My previous Dell's had great keyboards and were very durable. It will be nice to have one again, without Windows on it!
Weather RSS Update
Well after using Weatherbug for about 1 week, I have had a change of heart. When you go to their Web page for a full forecast, they create pop under ads in your browser. Naughty, naughty. I simply don't use sites that do pop overs or pop unders. So Weatherbug is on my banned list.
I did find an alternative. Yahoo has a weather RSS feed service described at: http://developer.yahoo.com/rss/ You just use the provided URL and a parameter for the Zip code and you are all set.
Mar 11, 2008
J2EE Startup Class
Mar 7, 2008
Weather RSS
Mar 4, 2008
uninitialized constant RedCloth (NameError)
OK, here is another bone headed mistake I made that I will post about in hopes of helping other poor souls who run across the problem. This morning I decided to play around a bit with the RedCloth library that comes with Ruby 1.8 on Mac OS X 10.5 Leopard. So I wrote a simple program in Ruby and tried to run it. Every time I did I got:
uninitialized constant RedCloth (NameError)
And here is my program if you are interested:
#!/usr/bin/ruby
require 'rubygems'
require 'RedCloth'
doc = RedCloth.new "h2. test header
just some text
another para"
puts doc.to_html
Pretty simple. (RedCloth, by the way, is a processor for Textile. Kind of a simple yet powerful way to mark up text like you would in a wiki.) Well I know the RedCloth Gem is in my path and is installed. I know my code should work, but it doesn't. What is the problem?
Turns out I unfortunately named my test file "redcloth.rb". Turns out the Gem file is named "RedCloth.rb" and is in the path and can be executed from the command line. If you don't know, OS X is case insensitive like Windows XP, so those names are equivalent. Thusly, Ruby faithfully tried to load my local script file, which doesn't define any of the needed objects. Therefore, the error. Naming the file "rctest.rb" fixes the problem.
So I hope this little note helps someone else out in the future. So if you get a: "uninitialized constant XXXXXX (NameError)", make sure your file name isn't the same as a the Gem file.