Mostly about my amusement

Category: Software (page 15 of 22)

Okay I think I got ATPP working

I think I’ve gotten the machine translation working to a point of good stability. Meaning my MySQL config is not killing the box with requests, caching seems to be working fine.

Right now I have 65 translated pages in my database. When I encounter one that is munged (meaning the database timed out) I manually delete that page in the ATPP cache and only that page. So fare so good.

I combined ATPP with WP-CACHE and all seems right in the world.

Upgraded the laptop to Gutsy Gibbon

Cool Ubuntu logo from www.linuxextremist.comLast night ran the command ‘sudo update-manager -c’ and after a few prompts left the laptop running the distribution upgrade to Ubuntu 7.10 Gutsy Gibbon. This morning I rebooted it at the prompt and poof I’m upgraded.

I usually don’t think that Linux has a real chance on the desktop; it’s just not the consumers choice. But seamless upgrades and making it so easy to use keeps me wondering. No way a Microsoft upgrade is this easy.

Fun with WordPress tags

Going from UTW to WordPress 2.3’s built in tag system was mostly painless. But there are somethings I miss about UTW. Two of those things are being able to display “Tags: None” and having my tags show up in my RSS feeds. Here is how I was able to put both back into my blog.

Adding “Tags: None” to my theme

I’m not a PHP programmer. I had thought I could just do $my_tags=the_tags(); and put in an if..then loop to check if it’s empty. That did not work; referencing the_tags() would cause the output to go to the $content and get displayed.

PHP has a function called ob_start(). From the manual page:

This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.

That’s good! Looking around some more I saw that using ob_get_clean() can put that buffer into my variable. That’s what I wanted so I could just capture and test the output. Here is the code I put into my theme template.

<?php if (function_exists(‘the_tags’)) {
ob_start();
the_tags();
$my_tags = ob_get_clean();
if ( $my_tags != “” ) {
echo $my_tags;
} else {
echo “Tags: None”;
}
} ?>

This lets me check the output from the tags and if it is empty then I can display “Tags: None” when I want.

Update: There is an easier way without using ob_start(), using get_the_tags().

<?php if (function_exists(‘the_tags’)) {
$my_tags = get_the_tags();
if ( $my_tags != “” ) {
the_tags();
} else {
echo “Tags: None”;
}
} ?>

I thought about this because a) it’s easier, and b) I think that wp-cache might do this and then my theme might cause issues.

Adding tags to my feeds

Making feed include tags was a simple matter as well. I had read on Angsuman’s blog about a plugin that lets you append copyright notices to your feeds. I downloaded it and took a look at the plugin. Simplest code in the world, I just modified Angsuman’s plugin. Here is what it looks like.

<?php
/*
Plugin Name: Add Tags to Feeds
Plugin URI:
Description: This adds WP 2.3 tags to your feeds.
Author: Jan Dembowski
Author URI:
Version: 1.0
*/

function addTagsToFeed($content) {
global $my_tags;
ob_start();
the_tags();
$my_tags = ob_get_clean();
if(is_feed()) {
return $content.”<p class=”tags”>”.$my_tags.”</p>”;
} else {
return $content;
}
}
add_filter(‘the_content’, ‘addTagsToFeed’);
?>

Nothing to it. My feed validates and now the tags are in the feeds too. Seeing how existing code uses add_filter is probably the best way to learn by example.

Ubuntu on a USB stick with XPS 720

Fixing the MBR on Vista 64 bit or how to remove GRUB from Vista. Keep this link handy, it saved me a lot of time.

Well running Ubuntu 7.10 beta did not work as well as I planned.

The 2 GB USB memory stick I had laying around was too small. This caused the installer to just stop and die around 70% or so. I printed out the coupons of the day and took them with me to BestBuy. I purchased a PNY 8 GB OPTIMA Pro Attache USB stick. It’s as no-frills as you can get and does not come with any software.

This time the installer ran, copied all the files, etc. It also installed GRUB into the MBR of my first hard drive.

Remember I thought that Vista would not play well with other operating systems? Oh, yeah that. My system could not boot off of the hard disk anymore.

This is how you can uninstall GRUB from a Vista partition:

I went to http://www.cpuguard.net/nedlasting/mbrfix.htm and read the whole page. I then downloaded and extracted MBRFIX.ZIP onto another USB stick. This stick was FAT32 formated and I put the contents into the directory called SAVED.

I booted off of my Vista 64 install DVD, ran the command prompt located the directory on that USB stick and ran

MbrFix64.exe /drive 0 fixmbr /vista

And all was right in the world. XP comes with FIXMBR but I could not find Microsoft’s equivalent for Vista 64.

After I booted up Vista a few times, I went back to the Ubuntu install CD. I mounted the 8 GB USB memory stick (it mounted it on /media/disk from /dev/sdc1) and ran

grub-install –recheck –root-directory=/media/disk –no-floppy /dev/sdc

On my system this put the root as (hd2,0) which just plain won’t work. While I was still on the live system I ran from a terminal window

sudo vi /media/disk/boot/grub/menu.lst

and located the entries I needed. All (hd2,0) had to be switched to (hd0,0) because in my BIOS when I select “Boot from USB device” that USB device gets treated like the first hard disk. I also removed the Vista section just because it makes sense.

I’m running that installation right now and doing a software update. On the 8 GB stick I have 4.4 GB free. Once I have it up to date the fun can really begin. Wonder if Compiz will like my setup?

Installing Ubuntu on a Dell XPS 720

Update 6/3/2009: Follow the instructions here at PenDriveLinux.com for Ubuntu 9.04, it works with the Dell XPS 720 very well. The only odd thing is that I have to re-enable the NVidia drivers between reboots. When you do enable it, don’t reboot. Just log out and let the auto login go and you can use the full Compiz effects.

Ubuntu 7.10 beta being installed

I run Vista 64 bit on my XPS 700 720. Looking at how it boots up, I am not sure that Microsoft will work with another operating system. And I do use this computer for work-ish *cough* games *cough* reasons.

I’ve just downloaded the 64 bit iso image for Ubuntu 7.10 beta and burnt it to CD. I’m installing the software but not on my hard drives, I’m installing it onto a 2 GB USB memory stick I have lying around.

This should let me install what I want to play with without me having to take the plunge exactly on this computer. I just have to remember to hit F12 when I boot up so the BIOS presents me with a boot menu.

As the install image booted up it played with my monitor settings and set it for 1680×1050. That’s not bad; last time it insisted on 1024×768. The sound card was not installed for the live session but that’s probably fine for now.

It’s installing right now as I enter this; I’m using Firefox in the live session. It’s going slow and I’m tailing /var/log/messages in another window to see if the drive suddenly dies.

Once I have it working off the USB drive entirely then I’ll mess with the drivers to see if I can get sound and Compiz working at 1920×1200 with full acceleration.

Well, no iPhone for me in the future

I had considered getting an iPhone in the past but the EDGE only cell network irked me so I figured I’d get one when a) they support 3G cell phone networks, and b) when the iPhone becomes 16 GB.

Now even if that happens, unless Apple shows they are changing, I won’t buy one. The latest 1.1.1 firmware upgrade is end user hostile. Having the phone re-locking itself is one thing. Punishing the user with a phone that can’t activate on the network is way over the top. Apparently installing third party apps will get you a dead phone too.

I don’t get it. On my BlackBerry Pearl I can use custom ring tones (MP3s) without having to pay more cash, I can install third party software, and the Pearl is lots cheaper than the iPhone. It’s as if Apple wants smart consumers to stay away from the iPhone. My main gripe with this is the attitude. If this was intentional then this is strictly a punitive move on Apple’s part and is completely unnecessary unless they want to send a message.

Gizmodo has a good up-to-date section on the iPhone here, it’s worth checking out. Unless 1.1.2 comes out with a “whoops, 1.1.1 was a brown bag release, sorry” then why get an iPhone?

Java on Vista 64 bit does not work

What you should see when Java runs

Another update: While Java is still working for me, other people have resolved their problem below.  Read the comments for a solution.

Update: I still get hits to this post.  Java works on my Vista 64 installation for both Internet Explorer 7 and Firefox 3.

– – – – – – –

I can’t get Java to run from a web browser in Vista 64 bit version.

I had to take an unplanned day off Friday. The day before I had gotten my remote access key fob so I figured I’d try using the browser based remote access into work.

I was in for a surprise. Like many solutions, work’s remote access relies on Java running in a browser. I had not yet needed Java in the months that I installed Vista 64 bit so I had to install it.

On Firefox (a 32 bit app) it kept dying when I tried to install it. On Internet Explorer 7 (also a 32 bit app) it looked like it was working but the browser would hang when I tried to reload it. Once I thought I had it installed but Internet Explorer 7 kept hanging and Firefox would just close whenever I hit a page with Java in it.

Looking this up using Google was kind of helpful but it just confirmed that I could probably get the 64 bit version running independently for stand alone apps like Azureus but being able to run it in a browser was not going to happen.

I’m going to re-install the 64 bit Java run time and try the web site in 64 bit Internet Explorer 7 (yes, they have a seperate executable and shortcut for the 64 bit browser) but I don’t think this will work due to changes in Internet Explorer.

This morning I used Synaptic and installed the sun-java packages for version 5. Remote access worked fine in Ubuntu. How ironic is that when Citrix Metaframe runs on Ubuntu but not on a Microsoft operating system?

Problems with machine translation

The machine translation I am using is giving me problems.  More accurately Google thinks my server is a compromised machine with spyware and BabelFish changed something so my pages are not being translated.

I’m not complaining because both service are free and reminds me of why some people really dislike machine translation.

For now I’ll turn off the plugin.  the translated URL’s (http://blog.dembowski.net/de/ for example) takes the user to the original article, so this is not really a big deal.

Getting ready for WordPress 2.3

In a few days the new version of WordPress comes out and with the exception of tags, for me the upgrade to 2.3 is pretty straight forward.

I have to plan to stop using UTW and switch to the built in tag system. I also want to make sure that I can fall back to 2.2.3 if the “bad thing” happens.

I like to mix tags with Share This on the same line, seperated by a “|”. On my blog I currently have the following lines in my theme:

  1. <div class=”utwtags”>
  2. <?php if (function_exists(‘akst_share_link’)) : ?> <?php akst_share_link(); ?><?php endif; ?>
  3. <?php if (function_exists(‘akst_share_link’) and function_exists(‘UTW_ShowTagsForCurrentPost’)) : ?> <?php _e(‘ | ‘); ?> <?php endif; ?>
  4. <?php if (function_exists(‘UTW_ShowTagsForCurrentPost’)) : ?><?php _e(‘Tags: ‘); ?><?php UTW_ShowTagsForCurrentPost(“commalist”) ?><?php endif; ?>
  5. </div><p />

I am the king of Ugly Code(tm). Someday I will re-write the theme to make it readable and organized. I repeat the same code in 4 different files.

In WordPress 2.3 the_tags() function is available. I want to be able to roll back to UTW and 2.2.3 so I add some if..thens to check for the_tags(). I will have UTW disabled with 2.3 and the inserted code is in bold below on lines 3 and 5.

  1. <div class=”utwtags”>
  2. <?php if (function_exists(‘akst_share_link’)) : ?> <?php akst_share_link(); ?><?php endif; ?>
  3. <?php if (function_exists(‘akst_share_link’) and (function_exists(‘UTW_ShowTagsForCurrentPost’) or function_exists(‘the_tags’))) : ?> <?php _e(‘ | ‘); ?> <?php endif; ?>
  4. <?php if (function_exists(‘UTW_ShowTagsForCurrentPost’)) : ?><?php _e(‘Tags: ‘); ?><?php UTW_ShowTagsForCurrentPost(“commalist”) ?><?php endif; ?>
  5. <?php if (function_exists(‘the_tags’)) : ?><?php the_tags(); ?><?php endif; ?>
  6. </div><p />

For my archive template I have a tag cloud using this code.

  1. <?php if (function_exists(‘UTW_ShowWeightedTagSet’)) { ?>
  2. <p>Tags:</p>
  3. <div class=”utwtag-cloud”>
  4. <?php UTW_ShowWeightedTagSetAlphabetical(“coloredsizedtagcloudwithcount”,””,0); ?></p>
  5. </div>
  6. <?php } ?>

The </p> at the end of line 4 is because the UTW function leaves out the closing </p> and messes up validation (I have no idea why). This code is fine and can stay. I just insert code underneath just like it as so

  1. <?php if (function_exists(‘wp_tag_cloud’)) { ?>
  2. <p>Tags:</p>
  3. <div class=”tag-cloud”>
  4. <?php wp_tag_cloud(‘number=300’); ?>
  5. </div>
  6. <?php } ?>

The default number of tags is 45. That shows the 45 most used tags; I just put 300 (way more than I use) to keep it on par with the existing tag cloud and display all the tags I have.

The UTW importer in 2.3 is pretty good but it adds a hyphen where a space should be. So “Far Cry” becomes “Far-Cry”. This is in the tag label and originally I was going to play with the dump of my database, modify tags by hand and hope for the best. WordPress 2.3 has no built in tag management system.

Rather than start that brain surgery I lucked out. Poplarware provides the Advanced Tag Entry plugin which lets you modify and manage your WordPress tags from the write post page on your blog. My only minor complaint is that the plugin does not also live under the Manage section. Using this plugin let me edit and fix the space issue on my tags. Going forward I’ll use this plugin to select the tags I want to re-use.

Christine (the UTW author) put together a good plugin for using Yahoo’s API to obtain tag suggestions. It’s called Tag Suggest Thing and it uses Yahoo to get suggested tags for your post. You can click on the tags one at a time or add all. Very useful.

With the exception of one plugin (which I don’t really use) all my plugins work with 2.3-RC1. This is all tested on my backup blog and with these changes and getting two new plugins, I should be ready for 2.3 without any hitch.