brett's blog

OSCON 2007 Keynote from Steve Yegge

Steve Yegge of the Google presents his keynote: How to Ignore Marketing and Become Irrelevant in Two Easy Steps. From O'Reilly Media's Open Source Convention, July 26, 2007.

How to install an Action Script and make it a finder plugin

Installing an Action:

  1. Open the Library folder in your home directory. If you see an Automator folder, open it. If not, just create one. Make sure it’s spelled exactly, including the uppercase A.
  2. Drag the action file to the Automator folder.
  3. You can now open Automator and you’ll find the action listed under the appropriate application. If Automator was already open, quit and re-open it.

Making a Finder Plug-In:

  1. Open Automator if it’s not open already. If you don’t have an empty workflow already, choose New from the File menu.
  2. For these instructions I’ll use my Make Names Web-Friendly action as an example, but you can do this with any workflow you can think of. Make sure the action is installed, and choose Finder from the Library list on the left side.
  3. In the second list, choose Make Names Web-Friendly from the list of actions. If you select an action you can read some more information about it at the bottom.
  4. Drag the action into the workflow area on the right.
  5. You’ll see a warning that the action will change your files. In the case of Make Names Web-Friendly, it will modify your file names, and it cannot be undone (unless you change them all back manually). If you click the Add button, it will make a duplicate of your files before changing them.
  6. Select whatever settings you’d like to use. If you’d like to be able to change these settings every time you run the action, click the arrow next to the word Options. Check the box “Show Action When Run”.
  7. If you like you can add other actions to your workflow now. This is optional. Perhaps you use Transmit, for example, and you’d like to upload the files to your server by adding the appropriate action.
  8. When you’re done, choose “Save As Plug-In” from the File menu.
  9. Enter “Make Names Web-Friendly” or whatever else you like for the name. Select Finder from the “Plug-in for” menu, and click Save.
  10. Now you can select some files in the Finder, hold down the control key on your keyboard and click for a popup menu of options. Move your mouse to the Automator option, and you’ll get a popup list of the plug-ins you’ve created. Choose “Make Names Web-Friendly” (or the name you entered in the last step) and the action will run!

Deleting or Editing a Finder Plug-In:

Getting started with AppleScript Studio

I've been kind of wanting to play around with writing a desktop app for the mac. I am not looking to dive head first into a new development environment so when I heard that Tyler Loch of iSquint and VisualHub fame used AppleScript Studio to write his applications, I decided that this would be a good place to start.

Cocoa Dev Central has a few articles on how to get started with AppleScript Studio including a nice beginner's tutorial that builds a remote control for iTunes. 

Now I just need to decide on something interesting (atleast to me) to build. 

Apple iLife Tutorials

[img_assist|nid=104|title=|desc=|link=none|align=left|width=200|height=150]Apple has a new site up called iLife 06 Multimedia Tutorials. They have tutorials for all iLife apps, the tutorials range from things for the average user and some for the more advanced.

http://www.apple.com/ilife/tutorials/

How to make Hanbrake pretty

Great tutorial on how to replace the default icon and change the default screen to a more condensed layout from PhillRyu.com

Performance Tuning MySQL Server

Mysql provides a configuration file located in /etc/my.cnf. From here you can set all of the memory, table, and connection limits as well as a host of other options. Before we get started I suggest you get aquainted with the my.cnf file as well as the tuning parameters within it.

Here is the my.cnf I use:

[mysqld]
back_log = 75
skip-innodb
max_connections = 500
key_buffer = 384M
myisam_sort_buffer_size = 64M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 1800
thread_cache_size = 384
wait_timeout = 7200
connect_timeout = 10
tmp_table_size = 64M
max_heap_table_size = 64M
max_allowed_packet = 64M
max_connect_errors = 1000
read_rnd_buffer_size = 524288
bulk_insert_buffer_size = 8M
query_cache_limit = 4M
query_cache_size =128M
query_cache_type = 1
query_prealloc_size = 65536
query_alloc_block_size = 131072
default-storage-engine = MyISAM

[mysqld_safe]
nice = -5
open_files_limit = 8192

[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M

Let’s just look at the important bits.

max_connections = 500 – I use a tool (see below) to check how many current connections I have, and under very heavy load (2000 simultaneous users) I rarely hit 400 concurrent connections to the database. This is because most connections only last for a few milliseconds.

key_buffer = 384M - When tuning a MySQL server, key_buffer_size is very important. This number works well for me and with the mysqlreport script I rarely use 50% of the available memory.

DirectAdmin Tip: Moving a domain from 1 user to another

There is no official domain transfer tool between users at this time, so here's how you have to do it:

1) Go to Reseller Panel -> Manage User Backups and make a backup of the user who owns the domain you want to transfer.

2) Login as that user, go to User Panel -> Domain Administration -> Change domain name, and change the name of that domain to something different (ie: from domain.com to domain2.com). This is done so that you can restore the domain on the other account without DA complaining that it already exists.

3) Go back into the Reseller Panel, and create the a new user. Set the domain to the actual name of the domain you want transferred. If the user already exists, then just create the domain through the User Panel -> Domain Administration menu.

4) Take the backup from step 1, and rename is from olduser.tar.gz to newuser.tar.gz, where newuser is the name you are transferring TO and olduser is the name you are transferring FROM.

5) From Reseller Panel -> Manage User Backups, select newuser.tar.gz and restore it into the newuser account. This should set all the data from the domain into the new user.

6) Once you've verified that everything is correct and as it should be, log back into the olduser account and delete domain2.com.

Converting Macintosh icons to PNG

I like eye candy, especially in icon form. That's why I was excited to see that The Icon Factory released some Matrix icons to celebrate the release of the Matrix Revolutions DVD. Unfortunately, the only available icon formats were standard Windows icons (.ico) and Mac OS X-specific formats. Neither of these were useful to me, so I set out to convert these icons to a more portable format — PNG.

I chose to use the standard Macintosh Icons available from the Icon Factory. They turned out to be the easiest format for me to convert and still retain the alpha transparency.

You will need to download and install a few programs in order for this conversion to work. For those of you morally opposed to using close-source software, shame on you for even considering using Macintosh icons on your Linux desktop. Begone with you! (Just kidding, we still love you.)

First, you need to get a trial version of StuffIt for Linux. This is the closed-source software I mentioned above. As far as I know, this is the only package that will extract the Macintosh .bin files under linux. I'd love to be proven wrong, though.

Next, download yourself a copy of icns2png. This handy little tool is the key to success.

I've written a small shell script that will do all of the manual work that goes into successfully converting the Macintosh icons to PNG. You can skip ahead and download the final product or keep reading to see the process in action.

Extracting the .bin/.hqx

The first step in the process is to extract the data to disk so we can work with it. Unstuffing the data is actually a two-step process. The first time we unstuff the file, it deflates into a .data and .info file. I'm not sure what specifically is contained in the .info file, but we can disregard it. The second step will actually extract the icon data to a temporary directory.

Cross Domain Ajax using Prototype and Ajax Extended

This is a quick guide to building cross domain Ajax applications using Prototype.js and Ajax Extended. First thing you will need to do is download the two needed libraries.
Prototype.js
http://prototype.conio.net/
Ajax Extended
http://ajaxextended.com/

First thing we need to do is modify prototype.js to use the Ajax Extended XMLHTTP object rather than Javascript’s native one.

Prototype.js

getTransport: function() {
return Try.these(
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
function() {return new ActiveXObject('Microsoft.XMLHTTP')},
function() {return new XMLHttpRequest()}
) || false;
},

Needs to be changed to:

getTransport: function() {
return xmlhttp = new XMLHTTP();
},

You can now use cross domain Ajax using prototype.js while keeping all the functionality of prototype.js. Make sure you upload the Ajax Extended files and that you configue the Javascript file to point to your PHP file.

My Essential Apps for my new MacBook Pro

Here is a quick and dirty list of applications that I installed after receiving my MacBook Pro from Amazon.


In no particular order:

Gimpshop - Once it is released as a Universal Binary.

iTerm - iTerm is a full featured terminal emulation program written for OS X using Cocoa.

Cyberduck - OpenSource FTP/SSH application.

Unison - Commercial Usenet reader.

FlickrExport - Flickr extension for iPhoto.

Desktop Manager - virtual desktops for OS X.

QuickSilver - Launcher.

Adium - Instant Messaging Client.

Firefox - Duh.

VLC - Awesome video player.

Senuti - Get music off your ipod.

Handbrake - Rip DVD's to Divx.

Abiword - Wordprocessor.

Tomato Torrent

Seashore - Image editor based on Gimp.

 

 

Syndicate content