Site menu:

Categories

Archives

Site search

Recent Comments

Archive for 'tech'

Wordpress tag cloud formatting

I’ve written a simple plugin that removes the html line breaks (br) between tags when the command wp_tag_cloud() is called from within a post. This is useful for people running a hack like runPHP to be able to execute commands since this behavior doesn’t manifest itself if you run the command from within a template.

Read more »

Unix Shortcuts

Copy files with tar: tar cf - * | ( cd /target; tar xfp -)

Backup and a restore a mySql database: mysqldump -u username -ppassword database_name > FILE.sql mysql -u username -ppassword database_name < FILE.sql

Figure out which process is “grabbing” a drive you want to unmount (from Donncha): # umount /media/disk/
umount: /media/disk: device is busy
# fuser -m /dev/sdc1
/dev/sdc1: 538
# ps auxw|grep 538
donncha 538 0.4 2.7 219212 56792 ? SLl Feb11 11:25 rhythmbox

Sometimes when pasting code in vi, it over-indents. Vim.org has the answer for this:

All you need to do is “set paste”, then paste your stuff, and then “set nopaste” again.

Run Synergy Automatically during login on a Mac

Synergy is a great program that let’s you share one keyboard and mouse across multiple computers. I’m using it to connect a mac to a PC.

I wanted the synergy server to be running on my mac automatically every time I login. This feature is a button-click in the gui version on the PC but there are some more involved instructions on the official site for accomplishing this on a mac but it required using a login hook (which I didn’t want to do). After some experimentation, here’s an alternative that uses a shell script, and an automator script to get the job done.

Read more »

Click to play movie in keynote

I’ve been very happy with my transition from Powerpoint to Keynote…particularly when dealing with lots of movies in a presentation. One feature I was suprised to find missing in keynote is a “click to play” option on an imbedded movie. For some reason, keynote doesn’t have that option built-in. I found a decent workaround:

Read more »

vi gem

I’ve been using “vi” (a popular unix text editor) for about 15 years. Today I learned something important. Vi has bookmarks that can be used for doing stuff with blocks of text easily.

Read more »

Markdown Extra Improvement

I’ve been using Markdown Extra for formatting posts and pages for a new site I’m working on. Since I want the back-end editing to be as simple as possible, I wanted to remove the “two spaces at the end of the line” requirement when the user simply wants to insert a line break.

The change was very simple. In markdown.php I just changed line 757 from this:

$text = preg_replace('/ {2,}\n/', "

To this:

$text = preg_replace('/\n/', "

The original Markdown author intended the “two space” behavior so that you could be more explicit with your line breaks and make the most clean “human readable” markdown text. This is particularly nice when you want to break up some text over multiple lines for formatting like:

* This is a multi-line bullet point and I want it to be together

With my change, that has a line break after “bullet”. I expected this hack to break lots of things but so far, I haven’t noticed any negative side effects. I’d be interested to hear if anyone tries it and notices any problems.

2 Picasa2 Tips

Tip 1:

Hover over any thumbnail and hit Ctrl-Alt. It will instantly fill the screen with the high resolution image.

Tip 2:

Hit Ctrl-L and your web browser will pop up connected to a web version of Picasa2. You’ll get some funny looking URL like this:

http://localhost:1606/2325d8afb4426bbca5ba8cf7afbb20db/

You can easily browse the images and do searches through your entire Picasa library. It’s very quick and actually lets you browse your library organized by whatever labels, folders on disk, exported pictures and other stuff you already have setup in Picasa.

Another nice thing is that when browsing the actual images, they show up with all of the rotations and corrections that Picasa has applied. Additionally, the last variable that is in the image URL looks like this:

...image21085.jpg?size=800

If you want a smaller size, just change the 800 to your preferred width and a new image will be generated on the fly. You can use this feature to quickly create web images from photos by simply dragging the generated image out of the web browser onto my desktop and it’s saved in it’s new convenient size.

For security reasons (I assume), it doesn’t look like this mini web server built into Picasa is accessable from any computer other than the local computer. Also, the port number seems to be random since it changes each time you re-launch Picasa.
Looks like it would be a minor thing for the Picasa team to allow for sharing of photos across a local network if they’d just allow the webserver to talk to the network. Naturally, this would require some security work first but it would be very handy.

History in all it’s 640×480 glory…

Google has announced today on their official blog that they are starting a pilot program to digitize the National Archives’ video content. They posted a few example links including the first Apollo Moon landing.

I was impressed to see that the quality of the footage was better than most of the other videos I have seen in Google Video. Unfortunately, due to the copy protection, I can’t just load the video up in a normal player and get it’s dimensions but it looks like it’s about a 640×480 image.

What would be really impressive is if Google is actually digitizing the film footage at 2k or higher and then generating lores proxies for streaming over today’s web. That would be some real preservation of history. Of course, for video material like the moon landings, 640×480 can preserve the entire detail in the original footage if it’s not compressed aggressively.

In terms of preserving history, it’s interesting to note the kind of things that aren’t digitized and preserved yet. I recently did some work with IMAX on The Polar Express and was talking with Hugh Murray who just completed “Magnificent Desolation” over lunch about his recent project. For the backgrounds on the film, they actually borrowed from NASA the original photographs shot with large format Hasselblad cameras on the moon. The astronauts took a series of large format pictures to create 360 degree panoramas in 50 meter increments to create an organized survey of the landing area. After being digitized on a very high quality scanner, these photos worked perfectly for Hugh since he could use the parallax between the various survey sites to recontruct a 3d version of the moon for the film and re-project the photographs onto the 3d model to provide an accurate texture.

After Hugh was done with the photos, he returned them to NASA and offered to give them a copy of the digitized scans in case they were needed in the future. Apparently, NASA wasn’t really interested since they didn’t have a good way to file that kind of thing for future reference.

Maybe NASA should think about sending their photos to Google…as long as Google promises to archive them at greater than 640×480 resolution.

Clean up URL’s with .htaccess

Many websites work with either “www.mysite.com” or “mysite.com”. Google doesn’t like that since it looks like two sites–sometimes they might penalize you for it.

From their guidelines page:

Don’t create multiple pages, subdomains, or domains with substantially duplicate content.

Here’s an excerpt from my .htaccess file that rewrites the URLs without the “www.” to include it:

# rewrite 185vfx.com to www.185vfx.com RewriteCond %{HTTP_HOST} !^www..* RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} ^([^.]).(com|co.uk) RewriteRule ^.$ http://www.%1.%2%{REQUEST_URI} [R=permanent,L]

I grabbed this code from a discussion board somewhere a while ago but I don’t have the link handy to give credit where credit is due.

Convert a 3d point to 2d Screen Space in Maya

Very often you want to find the 2d coordinates on the screen for a given 3d point. Here’s a little mel script that knows the projection math and takes care of generating the data in a “raw channel text file” format. From here, it’s easy to generate just about any ascii file format that a compositing program might be expecting. Read more »