Archive

Archive for May, 2010

Formatting code blocks in a WordPress blog

May 12th, 2010 No comments

I haven’t found a way I really love to present code in a fixed width WP layout, but the one I use is workable. It produces code that looks like this:

It uses a <code> inside a <pre> with a scrolling option to:

  • preserve indentation
  • use a special font in a quote box to differentiate from other text
  • provide a scroll bar, as code invariably goes past the fixed width

Here is the code (ironically described inside itself):

<pre style="overflow-x: scroll; padding: 10px;"><code>[Your code here]</code></pre>
Categories: WordPress Tags: , ,

Applescript to change genres in iTunes

May 12th, 2010 No comments

There is this awesome programming language in which the entire system (down to the graphics libraries, window system, and compiler) is available to you to reinvent, opening the possibility of truly open computing.

Obviously, I’m talking about Smalltalk. But if you are too afraid to give MS and Apple the bird for not learning (or wanting to learn?) the computing lessons of the 1970′s, there is another option which lets you bend almost any Mac application to your will, breaking it from the chains of presumptuous software giants who think you should work the way they design instead of vice versa.

I’m speaking, of course, of Ruby, lol. If you’re doing any serious Applescript development, ditch Applescript altogether, and check out the rb-appscript library.  It allows you to do anything you can do in Applescript, in a non-ambiguous way, with the power of a full programming language behind you – trust me, it’s the heaven where Applescript will go when it finally dies.

However, if you’re doing something simple and common, especially in a very scriptable application like iTunes, sometimes it’s easier to just crank up AppleScript Editor and hack out a one-liner.

Thus this very simple script to change the genres of iTunes tracks, which I used to fix things like some tracks in the “rock” genre and others in the “Rock” genre.

tell application "iTunes"
  set tracks_to_fix to file tracks of playlist "Music" of source "Library" whose genre ends with "ock"
  set genre of tracks_to_fix to "Rock"
end tell

Fixing URLs after moving a WordPress blog

May 10th, 2010 3 comments

When I moved my WordPress blog, all my image links were broken :(  Fortunately, with a simple google search (mysql replace substring), and 5 minutes of work in phpMyAdmin, everything was right as rain.

I ran the command (adapted from a comment here) on two fields in the wp_posts table - wp_content and guid:

UPDATE wp_posts
SET [insert_field_name_here] =(
REPLACE ([insert_field_name_here],
'[insert_old_URL_here]',
'[insert_new_URL_here]'));

One browser refresh later, I was returned to multimedia heaven :)

Categories: WordPress Tags:

windows 7 product key

windows 7 product key

windows 7 key generator

windows 7 key generator

free winrar download

free winrar download

winzip activation code

winzip activation code

free winrar

free winrar

winzip free download

winzip free download

winrar free download

winrar free download

winrar download free

winrar download free

winzip free download full version

winzip free download full version

windows 7 activation crack

windows7 activation crack

windows 7 crack

windows 7 crack

free winzip

free winzip
\n