iPhoto vs. iMediaViewPro

This isn’t really a full review or comparison, just a few quick notes. I downloaded the demo version of iMediaView Pro, and ran it. I let it import all of my iPhoto library, and was fairly disappointed it didn’t automatically albumize them according to my iPhoto albums. I must say I don’t like the interface nearly as much as iPhoto’s. iPhoto is pretty much a great program, except it’s dog slow whenever you try to do anything. But it’s simple to use, and really has all of the cataloguing features I need right now. I just use a Smart Playlist to list every photo that doesn’t have an album, and create a new album each time I import photos, and add them all to that. Now that iPhoto has folders, I can have a level of hierarchical organisation. And iPhoto has built-in capabilities to view photos by date of creation. If only it wasn’t so. damn. slow.

iTMS.au

iTunes Music Store Australia is here. Since you need to sign up to even get access to the free music, I had to enter my Credit Card Number. It didn’t work. Three times. Apparently you need to actually have money in there for it to work.

Preloading Images

Apparently, it’s possible to use JavaScript to preload images. checked = new Image(); checked.src = "/images/true.gif"; unchecked = new Image(); unchecked.src = "/images/false.gif"; This is better than doing the CSS trick display:none;, as this doesn’t always preload in every browser.

Restarting on Install

Click Restart to finish installing the software.

Why the hell do installers still insist on me restarting my computer after I install some software. I want to shut down, as it’s 11:30 at night, and I don’t want to have to wait for it to start up. Yet, when I installed the latest update to Missing Sync, it tried to force me to restart. Doesn’t it realise that at shut down is like a restart with a rest in between? Fuck crappy installer software… I’m going to bed. Thank god for Force Quit. • Oh, and while I’m ranting: Fuck Opera for thinking that having a custom menu appear when you double-click on some text is a good idea. Nothing ever did that before. How is a user supposed to know that? How am I supposed to be able to override this so I can have my own action happening on a double-click? It makes little sense for me to limit a user to my auto-select on a single-click, as they may not want all of my code at once. However, the only way for me (other than to implement a link or button that can be clicked on) to allow for auto-select is by double-click. Which doesn’t work on Opera. I hope they go out of business. Just for this. Bastards. Which reminds me of the old “Bastards Incorporated.” sketches on the Comedy Company. Ahh, funny 1980s Aussie Sketch Comedy. “Guddayandhowareyoutoday?” • Oh, and OmniWeb doesn’t play like the other browsers, it won’t run all of my nice toolbox scripts. Yet. Oh, yes it does - I just hadn’t logged in. Fuck being tired.

Connections Template

I’ve put the current contents of my template files up on this page. You’ll always be able to find the latest version of my templates there.

Changing Selection

I’ve got an interesting little challenge. I need to be able to programmatically change the document selection, as in the text that is selected, not a select box or anything like that, using JavaScript. Basically, I want to repeat the effect that appears on the Google Adsense site, where selecting in a textarea selects the contents of that text area. But I want to do it with just a random element. It’s easy with a TextArea, but I want my element to maintain it’s lovely formatting. I’m not actually sure I can do it. With IE, I can set it up to copy the text to the clipboard, but not select it.

More PostSecret Goodness.

This one tickled my fancy, so to speak. (no) Underwear in Church See more on PostSecret. For Jason: No Panties

Interesting WordPress Smarty Functions

Here are some interesting Smarty equivalents of WordPress functions I hadn’t come across before:

  • {get_lastpostdate} or {get_lastpostmodified} - returns a timestamp, such as 2005-10-16 07:10:51 that contains the last post date. {get_lastcommentmodified} is identical, but for the last comment.
  • {human_time_diff from=n to=n} - similar to a script I wrote about, and implemented. Limited in that it only does days, not any larger unit. Advantage: done by the server, doesn’t ‘flash’ changing text via JavaScript, neater than my Smarty version.
  • {get_day_link} - much neater than the version I was using! Generates the URI as described. Also {get_page_link}, {get_year_link}, {get_month_link} and {get_feed_link}.
  • {globalvar var=varname value=value} - makes a value a global PHP variable. Very interesting…

Profiling AppleScript code

This looks promising. Shark is a tool that can be used to profile code. I haven’t done any serious profiling since some python script I was working on years ago on BeOS. Daniel Jalkut has a nice post, Shark Bites Script up on his blog, on how to use Shark to profile AppleScript code. Since I’ve been doing a bit of AppleScripting lately, and I have some code that is in serious need of optimisation, this might be worth a second look.

Random Post Link

Another Blogsome user wanted a Random Post to be displayed on the home page. I haven’t quite figured out how to get the actual post displayed, but a link to a random post should be pretty easy. Luckily, WP-MU uses post ids. If we can get the latest post id, then we should be able to get a random number between 1 and this. We can then check to see if the post exists (it may have been deleted: WP does not reuse post ids), and if it doesn’t, get another random number, and keep doing this until we find a post id that is still valid. It’s then a simple step to create the permalink. The first problem arises when we try to get the latest post. We could use {the_author_posts}, but this will give us the number of posts, which means if the user has deleted n posts, the last n posts will not be in the selection of random posts. This is not necessarily such a bad thing, as it will mean that older posts are likely to be used. The next problem of {the_author_posts} is that it must be used within The Loop. If we are planning to put the link before we have been through ‘The Loop’, then we should be alright. The third issue of {the_author_posts} is that with a multi-author blog, the random number will be much lower than the total number of posts, meaning even older posts are only likely to be selected from. Another option would be to say “Okay, I want a random post lower in id (ie, older than) every other post on the page.” This makes things much easier, but is limited to the same problem of not being able to be placed before the loop, as we’ll set a variable to the post id on each post as we come to it, and since most blogs are ordered in descending order, the last post visited will (or should) have the lowest id. The problem here is that a category view may have a very low post count, and it’s oldest visible post may be a very early post. The third option would be to say “I want a post that is older than the newest post on the page.” Again, the limit as to where this must appear is present. However, an additional problem is that we may get a link to a post that’s already visible. This third one to me seems to be the best compromise. So how do we get this post id? We’ll need to modify our post.html file under Blogsome. {capture name=max_id}{the_ID}{/capture} {if $smarty.capture.max_id > $max_id}{assign var=max_id value=$smarty.capture.max_id}{/if} This code can go anywhere: I stuck it right at the bottom, out of the way. The next part should only be done once: {math} is quite processor intensive, so do it just where you want the object to appear: {math equation="rand(1,n)" assign=rand_post n=$max_id} Our final code is to grab the permalink and title for this post. However, I cannot yet find a way to get the title, so we are stuck not knowing the post title: Random Post I’ve tried using {get_post} and {get_postdata}, but since the latter returns an Array, it’s not much use. Returned Arrays are no good - the value needs to be assigned to a variable for us to be able to access it. It’s probably possible to alter the query, or rerun a new query, but I’m getting to tired to do this right now.