LifeType to WordPress

23 09 2010

I finally did it!  I killed off my blog almost a year ago because it was behind on security patches and I hated dealing with annoying FreeBSD php conflicts.  Today I finally solved those problems by just getting rid of the blogging platform I was using.  Unfortunately it wasn’t that easy.

First I setup this blog on wordpress.com.  Then I installed wordpress on my FreeBSD machine at home (portinstall wordpress).  Next I realized mysql was a mess and wasn’t even running, so pkg_delete’d the previous versions, pkg_add -r’ed new ones, and started it up without a problem.

Next I downloaded plog-importer from http://forums.lifetype.net/viewtopic.php?t=4337 and uploaded it to the machine that was now running wordpress locally along with the old lifetype installation (that I re-enabled in httpd.conf).  It turns out plog-importer was written for WordPress 2, and the plugin structure has since changed.  So I updated the bottom of the php code with;

function plog_importer_init() {
    load_plugin_textdomain( 'plog-importer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
add_action( 'init', 'plog_importer_init' );

Which caused the plugin to show up in the import section of wordpress properly.  After a few trials and errors, realizing that I shouldn’t use the same username in WordPress as I had in LifeType so it doesn’t overwrite user permissions on import, and a quick change of a column which apparently changed when pLog became LifeType;

mysql> alter table plog_articles change global_category_id category_id integer;

I went through the import scripts and it worked great, including dates and comments.  Pretty nice.

I am going to go through now and make sure Lori’s posts from her blogs made it over, talk to her about what she wants done with them, and then work on formatting this blog and removing the old one.

Let me know what you think!





why you should be able to code

4 09 2009

"Coding" is what people call programming these days, and it is used in just about every context of utilizing a structured language to automate something on a computer.  There are more syntax types and languages than I can even imagine out there, so knowing them all is basically impossible.  What is quite possible is at least understanding the basic logic to be able to write something with them.  The ability to learn at least one or two, and actually use it is an invaluable tool in life.  I use the ability to manipulate data in an automated fashion very regularly at work, and it has saved me thousands of hours of manual labor in return.

Why do I think everyone should know how?  Well, I’m going to tell you.

Lori and I sit down once a month to update all our various financial accounts from the past month.  This includes purchases, interest earned, principal paid, etc.. etc..  We use http://www.clearcheckbook.com and find it great for storing what we need.  BUT last night something horrible went wrong.  The total outstanding value on our American Express card differed by $225.81 from what was calculated in ClearCheckbook.  We went over it multiple times and couldn’t figure it out.  In my frustration last night, I downloaded excel (Amex) and comma separated (CC) files representing our purchases from the last two months.  I opened them in Numbers and pasted them side by side, then proceeded to actually drag the values next to each other.  Well, they all matched, we hadn’t missed a thing.

So tonight, I downloaded the entire 2.5 year history of the account from both places, exported them both to CSV and put them on the desktop on my mac.  I then wrote a perl script to compare the two.  I know.. many (well, those who know what it is?) of you would use diff, but it would have required sorting the files by dollar value, and would have removed some of the functionality around dates that I was looking for.

I could very clearly print out in chronological order, the entire history of both accounts and how they differed.  This is why you need to know how to program.

Of course, I still found no differences, and it turns out American Express fixed a math error on their side so that everything matches.  Meaning… if you didn’t know how to program it would have just all fixed itself and you wouldn’t have wasted all your time like I did.  Grumble..  but at least I got to practice perl for the first time in a while.

 

Anyways, for posterity…

 

#!/usr/bin/perl


use strict;

sub read_file
{
  my ($line, $date, $value);
  my (@values, @dates);

  (my $file) = @_;
  open(FILE, "< $file") || die "failed $!\n";
  my @data = <FILE>;
  close(FILE);

  my $i = 0;

  foreach $line (@data)
  {
    chomp($line);
    $line =~ s/"//g;

    ($date,$value) = split(/,/, $line);

    $values[$i] = $value;
    $dates[$i] = $date;

    $i++;
  }

  return(\@values, \@dates);
}

my ($j, $matched);

(my $amexvalues, my $amexdates) = read_file("amex.csv");
(my $ccvalues, my $ccdates) = read_file("clearcheckbook.csv");

my ($i) = 0;

while ($ccvalues->[$i])
{

  $j = 0;
  $matched = 0;

  while ($amexvalues->[$j])
  {
    if ($amexvalues->[$j] == ($ccvalues->[$i] * -1))
    {
      $amexvalues->[$j] = "MATCHED";
      $matched = 1;
    }

    $matched ? $j = scalar(@$amexvalues) + 1 : $j++;

  }

  if (!$matched)
  {
    print "CC $ccvalues->[$i] / $ccdates->[$i] not found in AMEX\n";
  }

  $i++;
}

$i = 0;

while ($amexvalues->[$i])
{
  if ($amexvalues->[$i] ne "MATCHED")
  {
    print "AMEX $amexvalues->[$i] / $amexdates->[$i] not found in CC\n";
  }
  $i++;
}





network music storage and macos annoyances

13 08 2009

For a long time I’ve kept my music on a network accessible drive in the house.  I started to do this because I had multiple computers I actively used and wanted to access it in a central location.  The FreeBSD machine served up NFS and SMB to the machines that needed it, and it worked fine.

Eventually I got a couple Squeezeboxes and needed it to stay on that server so I had place to run the server for playing music.  I even wrote a perl script that used MP3::Info to confirm various "minimum requirements" for quality in the music I stored, and even confirmed that the ID3 tags matched the filenames and directory structures.

More recently I decided that managing album art, ID3 tags, and synching the music quickly and reliably meant switching to iTunes.  BUT, I had no desire to switch away from the network share method.  This is because I still needed to host the music for the Squeezeboxes.  I have a 500GB drive hooked up to my iBook G4 that serves as my backup server (Time Machine / rsync depending on OS), so I just added a partition to that for the music and set it all up.

Things worked absolutely great.  Sure, I noticed some delay in big updates in the music or apps on my iPhone, but they were relatively minor in the scheme of things.  

I did have some problems with my laptop going to sleep though.  Sometimes my MacBook would wake up from sleep and forget the network share.  This meant a minor inconvenience of telling iTunes where to find its folders, and by navigating to the right location, remounting the drive.  It’s even pretty easy to create an alias to the mount point on your desktop and just double click on it to re-mount the share.  I wish MacOS would handle that better, but it was life..

That is.. except when I was actually running iTunes and I put my laptop to sleep.  iTunes would crash when it realized it had lost its data.  Not only would it crash, but it would spin out of control, eating massive amounts of CPU and make it a pain in the butt to even kill off.

I was finally able to solve the problem tonight.

First, I installed SleepWatcher from http://www.bernhard-baehr.de/  – this application allows for the execution of commands from the cli on sleep or wake up from sleep.

I installed both the daemon and the startup package and rebooted my machine (needed to do some software updates anyways).

Next, I copied some basic scripting from this (mostly) unrelated blog entry;
http://rajeev.name/blog/2008/09/01/automated-osx-backups-with-launchd-and-rsync/

and came up with;

#!/bin/bash

function doMounts {
  vol=$1;
  mnt_cnt=$(/sbin/mount | grep -ic "/Volumes/$vol")
  if [ $mnt_cnt -le 0 ]; then
    /usr/bin/osascript <<EOT
    tell application "Finder" to mount volume "afp://myiBookG4/$vol"
EOT
  fi
}

for (( i=0; $i < 12; i++ ))
do
  doMounts iTunes\ Library
  sleep 5
done

exit 0

Since it will sometimes take the OS a few seconds to realize it has lost the share, or even more to reinitialize all the hardware if it actually hibernated, I told it to look to see if the mount was there on a 5 second interval for a minute.

I’ve tested it a few times, and it re-mounts the network share with great reliability..  Hopefully this solves all the annoyances above.

Now.. Apple.. I shouldn’t have to do this.  Please fix it!





fun with fluid

10 05 2009

Mozilla just released the newest version of Prism (http://prism.mozilla.com/),so I figured I would play with it.  I use it at work to make a nicelittle Pandora app so I wondered what I could do with; GoogleReader, Google Apps for your Domain Mail (Gmail basically), andFacebook.  Eddie already had me hooked on a client based Twitter App,but I really like the web versions of most of what I use..

After installing Prism and starting to play, I immediately noticed that noneof my Firefox extensions were there.  Ack!  I’m pretty used to thefunctionality they provide (Better Gmail 2, Better GReader, and AdblockPlus specifically here), so I figured I would be able to find a way touse them.  Well, vague mentions of add-ons, and directions onjavascript that didn’t seem to work wasted about two hours of my dayand I gave up on Prism eventually.

Somewhere in the middle Itweeted that I would really like to see Firefox extensions for Prism,and Eddie responded that I should check out Fluid (http://fluidapp.com/).  It said it supported Greasemonkey scripts and Growl,so I figured I would take a look.  After all, the two "better"extensions I use are nothing more than compiled Greasemonkey scripts. I started with trying to recreate Google Reader since I only use twoscripts in that extension; the Minimalistic Skin and Show Feed Faviconssetting.  I quickly found the lifehacker article that described whichscripts were used to compile the extension at; http://lifehacker.com/software/exclusive-lifehacker-download/trick-out-google-reader-with-better-greader-262020.phpand found that it was very easy to add the scripts to Fluid. Unfortunately the minimalistic one didn’t work anywhere nearly as wellas it did in Firefox.  It wasn’t hiding the space used by the graphics/menu items, just the items themselves.

I spent a long time reading about Prism andFluid to find a good way to script them, only to realize that neitherof them truly supports Greasemonkey.  Of course, I can’t get Prism toload any script (placing webapp.js next to webapp.ini in the PackageContents got me nowhere).  After searching more, and about to give up,I finally got off my butt and just opened the javascript code for theMinimalistic script and found it full of GM_addStyle() calls.  I canonly assume that’s a greasemonkey specific function, so I went insearch of something non-greasemonkey to replace it with.  I quicklycame across http://userscripts.org/scripts/source/47908.user.jswhere his first code checks for GM_addStyle() then addStyle() andfinally gives up and enters it manually.  I copied his code, usedgoogle to figure out the javascript syntax for arrays and for() loops and was able tomake it all work.

The change simply ended up being;

-   GM_addStyle(".gbh { display:none !important; }");  //Hide dividing line
-   GM_addStyle("#entries .entry {padding-top: 2px}");
-   GM_addStyle(".card-common {margin: 0 2px}");
-   GM_addStyle(".entry .entry-source-title {font-size:110%;}");
-   GM_addStyle(".entry .entry-title {font-size:120%;}");
-   GM_addStyle(".card .card-content {padding: 2px 1px 2px 2px;}");
-   GM_addStyle("#current-entry .card .card-content {padding: 2px 1px 2px 2px;}");
-   GM_addStyle(".entry .entry-container {padding-bottom: 0;}");
-   GM_addStyle(".entry .entry-body {padding-top: 0;}");
-   GM_addStyle(".entry .entry-actions {padding: 2px;}");
+   var css = [ '.gbh { display:none !important; }',
+      '#entries .entry {padding-top: 2px}',
+      '.card-common {margin: 0 2px}',
+      '.entry .entry-source-title {font-size:110%;}',
+      '.entry .entry-title {font-size:120%;}',
+      '.card .card-content {padding: 2px 1px 2px 2px;}',
+      '#current-entry .card .card-content {padding: 2px 1px 2px 2px;}',
+      '.entry .entry-container {padding-bottom: 0;}',
+      '.entry .entry-body {padding-top: 0;}',
+      '.entry .entry-actions {padding: 2px;}' ];
+  
+   var heads = document.getElementsByTagName("head");
+   if (heads.length > 0) {
+      var node = document.createElement("style");
+      node.type = "text/css";
+      for (var i=0; i < css.length; i++)
+      {
+         node.appendChild(document.createTextNode(css[i]));
+      }
+      heads[0].appendChild(node);
+   }

So now I have a Google Reader application on my Mac.  The dock badgeeven updates with my unread article count, pretty cool.  UnfortunatelyI have become a bit too accustomed to AdBlock Plus, which makes mye-mail and Facebook look substantially better, so I think I’ll stickwith just Google Reader for now.  Feel free to lecture me on hurtingtheir business by never looking at their ads.. I can take it.

Here is a standard view of Google Reader in Firefox;

http://mikebdotorg.smugmug.com/photos/532664705_MYnrN-M.png

Here is the webapp from Fluid;

http://mikebdotorg.smugmug.com/photos/532664691_JpxUk-M.png

.. and the dock;

http://mikebdotorg.smugmug.com/photos/532664667_S5Knr-M.png

 

I’m happy with the results, but there is a ton of room for improvement with all of this..





avery's birthday party

14 04 2009

Pictures from Avery’s birthday party;

http://mikebdotorg.smugmug.com/gallery/7887217_opxwA/1/511381047_4ZSep





video and pictures

21 02 2009

First here is Kaelyn singing on video;

http://blip.tv/file/1747779

and then here are pictures from my Mom’s Birthday last year;

http://mikebdotorg.smugmug.com/photos/478021409_fo3VA-S.jpg





plane crash

14 02 2009

My employer has a major work center in Rochester, NY – about 70 miles East/North East of Buffalo.  I have traveled there twice in the last few months, and on my last visit I had the joy of flying in during icy/snowy conditions.  The best flights out of Phoenix to that area always end up being on Continental either through Newark or Cleveland.  Then there are commuter flights ran by regional carriers to take the last leg to/from Rochester.  I’ve taken various different small planes, from ones you can’t completely stand up in that only carry about 30 people, to prop planes on those legs of the flights.  The prop plane I’ve taken is a Bombardier Q400 operated by Colgan Air.  That’s the same plane and airline that crashed killing its crew and passengers the other day.  It was flying in the same part of the country and apparently lost control due to icy weather conditions.  Freaky.

Of course my ears perk up everytime i hear "737" or "MD-80" on a flight problem, but there are enormous amounts of those in use.  The Q400 and Colgan Air were both obscure names for me to hear about..

Naturally, nothing will compare to my co-worker who had a seat on United Airlines Flight 175 that ended of flying in to tower two of the World Trade Center.  Late the night before he changed his flight to a later one so he could stay for a meeting with Cisco.  He was asleep in his hotel room with his cell phone turned off when the plane crashed.  While he slept his wife was losing her mind because he had not told her that he was changing his flight.  I imagine he tells his wife when he changes flights these days.

A random note about the last time I flew out there; I came in to Newark on a Q400 and saw an amazing mid-morning view of the Manhattan skyline.  We even got to see a good view of the Statue of Liberty.  EWR seems like it could be a tourist attraction itself.  If only they could do something about how loud those propellers are.





kierstin happy birthday

6 02 2009

Kaelyn likes to say <person> happy birthday when referring to someone’s birthday.  So when we went to Kierstin from dance’s birthday party we got to hear it plenty.  After the short video I had taken with the point and shoot at dance (here for anyone who missed it).  Lori was nice enough to volunteer me to bring the camcorder and take some video of the party.  I edited in iMovie (’08 for those who care.. Eddie), and then posted the results on blip.tv.  While the 2.5mbit/s encoding of the 49 minute video came in at 976MB and blip.tv says they accept files up to 1GB, it puked the flash encoding.  I tried it again at 1.5mbit/s but that didn’t work either.  I have a feeling it is the time duration not the file size that it doesn’t like.  I ended up uploading the 2.5mbit/s version in two pieces.  Here they are;

Part 1 – http://blip.tv/file/1744731
Part 2 – http://blip.tv/file/1745712

This is the first upload I did that is 16:9 and it looks great.  I ended up encoding at 854×480 since it is still standard definition quality video.  





cooking and cleaning

25 01 2009

The morning of the great cup tower destruction Lori dressed Kaelyn up in some play clothes and we taped the results.  The phone part is pretty funny.

http://blip.tv/file/1700735/





17th most connected

24 01 2009

Forbes’ list is out again and Phoenix is the #17th most connected city.  Seattle takes the cake at #1.  Phoenix is most hurt ranking wise by wifi hotspots.

Direct link to Phoenix;

http://tr.im/cgl3

(from Engadget)








Follow

Get every new post delivered to your Inbox.