Results tagged “Movable Type” from Kazza the Blank One

I discovered a while back that if I mark various comments as spam directly from the notifications I get and do a whole lot at once, I can end up in a situation where temporary files lock each other out, and if I'm not careful I could lose individual blog pages or even whole month archives unless I carefully republish.  

Tonight I lost my blog's index page completely when my brother was commenting on an entry at the same time I was publishing another entry.  I have such a low-volume site (and humans rarely comment) that it's not usually a problem, but if I was getting a lot of comments I'd be pretty worried about MT just eating my content ..

Movable Type Nonsense

| | Comments (0)
While trying to publish my previous entry (Synthy), I was getting horrible permission denied errors.
Grrr just got another one and will have to redo this post :(
It wasn't the usual /tmp full problem this time.  Looks like you can't use i f r a m e code in MT posts... hrmm...  
hell you can't even *say* it... most disturbing!!  And very frustrating given that I've just had to redo this post *again* :(

The other bit of nonsense I was looking at while trying to figure this out, is that since August 4, I've been getting several core dumps a day in my MT cgi directory.  I looked through the logs at these times and sure enough, comment spammers were hitting my blog at the time :(  Might have to upgrade a dot point or something...

193.53.87.83 - - [04/Aug/2008:12:13:02 +1000] "POST /MT-4.01-en/mt-comments.cgi HTTP/1.0" 500 - "http://kazza.id.au/2004/09/fq-topic-posession.html" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060612 Minefield/3.0a1"

193.37.152.242 - - [04/Aug/2008:21:21:19 +1000] "POST /MT-4.01-en/mt-comments.cgi HTTP/1.0" 500 - "http://kazza.id.au/MT-4.01-en/mt-comments.cgi" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
193.37.152.242 - - [04/Aug/2008:21:21:25 +1000] "POST /MT-4.01-en/mt-comments.cgi HTTP/1.0" 200 2247 "http://kazza.id.au/MT-4.01-en/mt-comments.cgi" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"

193.37.152.242 - - [04/Aug/2008:22:33:50 +1000] "POST /MT-4.01-en/mt-comments.cgi HTTP/1.0" 500 - "http://kazza.id.au/MT-4.01-en/mt-comments.cgi" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"

Google let me down

| | Comments (0)
I've been trying for far too long this afternoon to figure out how to add target="_blank" to my insert link html.  In Movable Type 2, I'm pretty sure I did this in mt-cgi/tmpl/cms/edit_entry.tmpl

In a newer version, it was suggested to edit mt-static/mt.js  .. but I edited this file and it didn't work. 

So have been getting very frustrated because would rather not type in target"_blank" every time I insert a link :(

Dave you seem to have it working.. how'd you do it?
So as mentioned previously, it was my fifth Blogiversary this week.  I decided last year that I wanted to update the style, and the version of Movable Type at the same time.  And move it to a Webcity cPanel box. Unfortunately the weeks leading up to Christmas I was busy with getting ready for Christmas, and then we went to Queensland.  So I basically had one weekend to work on it, which was a lot less than I'd hoped for!

So anyway.  Here's some of my comments and traumas.

Install Wizard
The setup wizard was incredibly easy to setup and use - and it just worked!  Soooo much easier that MT2, which required a tonne of hacking.  I've not decided if I'll keep the default path where I just happened to dump the files, or see about changing it.  My last blog didn't use MySQL - I used Movable Type's version 2.661 database, which I liked using as I could easily backup the database myself by just grabbing the files.  I've still to write something to backup my MySQL database regularly. 

File Permissions
In 2004 I hacked my old blog to change the file permissions that MT uses by default.  For this version I followed these instructions to hack mt-config.cgi to include:
DBUmask 0022
HTMLUmask 0022
UploadUmask 0022
DirUmask 0022
This means that the files aren't written as being world writable - not good on a shared hosting site!

Style
The next step was to pick some sort of style for the site.  I decided that I wanted Black Mountain Tower in the masthead somewhere, to indicate my new life.  But I didn't have any good panorama type shots of it.  So dragged Stu down to the lake last weekend after church to take some panorama photos.  I used one of the "Cityscape" MT styles - the Sydney one actually! and then hacked that to bits.  Well chunks really, not little bits ;)  Found some actual bugs in the style sheet where Tiffany had misspelt tags so they weren't actually being used - tragic really for a professional. 

Widgets
I don't know if these were included in version 3, as I skipped straight from 2 to 4.  But they're pretty nifty.  It took me a while to actually figure out the Movable Type interface to find them - hidden away in the footer templates!! - under your 2 or 3 column layouts includes.  This site gives more info on changing the templates to use the drag and drop widget management bizzo - which I did and I can now drag and drop my widgets.  But by doing that you do lose some of the MTif statements for whether things like the archive descriptions are displayed on the archive pages.  I could hack all my widgets, or just have an index style and a non-index style column layout.  Still thinking about that one.

Gravatar
Getting Gravatar working again involved simply downloading the plugin and not so simply hacking the style sheet for it to display ok (I'm not very good at style sheets!)

RSS Feed
MT4 has a full feed RSS feed by default now - I just use the rss.xml file.  So anyone using my old rss url should use this one now.

Google Analytics
Inserted this into my footer template.  Strangely visits have gone up heaps since the changeover.  So either the old code wasn't being loaded properly, or visits are now working differently because of the broken image searches (see below for more on that).  I'm thinking more likely the latter.

Captchas
Now included with Movable Type, but really really ugly.  Will look at finding a friendlier one.

Importing my old blog
Strangely I left this til the last minute after doing my styles - after all you don't want to be rebuilding a site of my size too often - it takes a good five minutes each time!
I didn't do any research into this before I went ahead with it, assuming that I'd be able to figure it out.  In the end the process was actually fairly simple, but it did take a few goes to get the formatting of the file right.  The way I did it was to go to my old installation of MT on the other server, and do the export.  Save that export to a text file (mine was about 3mb in size).  Then import into the new blog.  In the end used the unix format of the output file, and when importing using "Convert line breaks" and UTF-8 encoding.  (Used this page for hints on this which worked)

Broken Images
Of course once everything was imported, all the links to my images were wrong.  You see I'd decided not to use the old paths for my images.  Although this means less hits from Google image searches, it'd also screw up anyone that's been direct linking my images for the past five years.  Such people deserve to die.  So I attempted the search and replace feature.  But for some reason this worked really badly.  So I think I've fixed up my images, but I can't really be sure, and some of my pages might still be missing images.

Broken Links
This one was going to take some work.  Because in addition to the several hundred of my entries that refer to earlier entries, all external links were going to be broken.  I decided to use the .htaccess method of redirecting people. 
The biggest problem is that MT2 uses files in the format archives/002190.html while MT4 uses entry titles in the file name, and puts them in monthly directories.  So I needed to convert the old links to the new format.  In my old blog I downloaded Dirify Plus, then created another index template with the following in it:
<MTEntries lastn="2500">
RedirectMatch /mt-archives/<MTEntryID pad="1">.html /<MTEntryDate format="%Y/%m">/<MTEntryTitle trim_to="40" dirifyplus="pld">.html </MTEntries>
This generated a massive page of text that could be used directly in a .htaccess file.  This worked well, except for the few hundred broken links where I'd had duplicate entries, and the couple of hundred pages that were more than 30 characters, which appears to be the limit MT4 uses.  I tried setting my dirify to 30 characters, but that didn't seem to work, so I just hacked an excel file to rebuild the links for me.  The duplicate entry titles are still a problem (the first one is whatever-1, then whatever-2 etc).  I'm thinking I might have to hack the .htaccess file manually for those. 

Pages
MT4 lets you create static pages that aren't part of the blog, which is a useful feature.  I created a 404 error page, and put that in the .htaccess file, so people that come from broken image searches will see that. 

Search Feature
The new search tool is a bit retarded in that it returns the entire page of a blog entry.  If you put in something like "the" you'd probably end up returning the entire blog in one page.  Will have to read up on how to change that.

Photo Uploading
My first attempts at uploading photos were a bit frustrating.  It doesn't have the old feature to "show html" when uploading files, and wants to create a new entry every time.  I barely spent any time looking at this though, as it wasn't a priority for going live.  I might have a look at Better File Uploader, or do some more reading to find out if I've just missed something.

Comment Notifications
Haven't been able to get these to work, even though the test email when I was setting everything up worked.  So I know sendmail will work with the blog, but I just can't figure out how to get it to email me whenever a comment is posted.  Very annoying!

Todo
Still have a big todo list.  Things like:
  • fix comment notification emails
  • decide on sidebar widgets, and put Host1/CIA buttons back
  • bring over my subblogs - Stoopid Quizzes, and the 10030 Star Destroyer page and my USA 2004 page
  • create a new favicon.ico
  • fix up imood background colour
  • change my Gravatars to fit in with new style
  • get a nicer captcha
  • setup backups of the database
  • figure out how to upload multiple images - can do this, but the html is butt ugly
  • create a "Wishlist" widget - something I wanted as a plugin but noone seems to have ever written
  • fix list of blogs style
  • hack the link creator to put target="_blank" in
  • fix up my Weather Pixie page
  • fix search returns
  • see if there's a simpler create entry form that'll work from the Blackberry
  • hack the image insertion code so it puts br clear=left tags in - edited lib/MT/Asset.pm and put the br clear=left stuff in this line - return qq{<form mt:asset-id="$id" class="mt-enclosure mt-enclosure-$type">$html</form> <br clear="left">};  (discussion about this was found here). 
    July 2008: Hacked this further to completely remove the class bit from the form tag.  Also hacked lib/MT/Asset/Image.pm to hash out the wrap_style line for left aligned images and just set $wrap_style to blank, so as to not have any extra nonsense around the images that cause them to render badly in Google news reader
  • put category and tags of entries in index template
So yeah, all in all it actually went really well.  And I managed to go live on schedule.  And to the little group of people that are still around reading this after five years, thanks for coming to read my drivel all these years :)
Kazza's "Boring Life Of a Geek" aka BLOG

IT geek, originally from Sydney, moved to Canberra in 2007. Married to "the sweetie", aka Stu. Prolific photographer, Lego junkie and tropical fish keeper.

Kazza the Blank One home