Posts Tagged ‘geek’

0
Thanks!
Rumblings from the Secret LabsRumblings from the Secret Labs

Figuring out WordPress Roles

August 4th, 2009
With all the different permissions available, I'm surprised edit_comments isn't on the list.

A couple of regulars have wished out loud that they could edit their own comments. “No problem,” thought I, “I will create accounts so they can log in. Once the system knows who they are, I’m sure it will allow them to edit their own stuff.

Not so fast. Apparently the ability to edit one’s own comments is tied to the ability to create new posts as well. I’m writing this post as Jerry II, a new user on this blog with the exalted role of ‘Contributor’. It’s possible to mix and match exactly which capabilities a user has (with the help of a WordPress plugin), but the same capability, edit_post, is ties to editing one’s own comments and to writing new post content.

It’s not a total disaster; I can’t publish the episode I’m writing. It will go into a pile to await the approval of the administrator, so no unauthorized content will reach your tender retinas. It’s just extra complexity for other users who don’t want it.

Oh, well, they’re smart people. I’m sure they can overcome this.

0
Thanks!
Rumblings from the Secret LabsRumblings from the Secret Labs

Quest for the Perfect Moon Widget

July 7th, 2009

If you want the job done right, find the right geek.

You may have noticed that as of this moment there are three different moon phase widgets over on the sidebar. None of them are perfect, alas (although the Japanese one is perfectly inscrutable). I looked around at other WordPress widgets and did not find one that gave out all the information I was interested in (especially for the eclipse) and was aesthetically pleasing. I thought I might spend a few hours and make my own.

The design was very simple. I would write a little Flash thingie that read XML data from a server and draw the moon with great precision and also look nice doing it. In addition I could put numerical readouts for more interesting (to me) numbers. Piece of cake.

I started my quest looking for a server with current moon info. The US Naval Observatory has all sorts of lunar data available, presumably calculated with far greater precision that I will ever need. The only problem is, they didn’t have data for right now. They had almanac generators and whatnot, but nothing that I could ping and get back a message that said, “at this moment, the moon is…” I couldn’t find anything at NASA, either. I broadened my search and found that nobody seems to be providing this service. “fine, then,” I thought. “I’ll make my own moon server. I’m sure there are plenty of places I can find algorithms for calculating this stuff.”

Only, that didn’t turn out to be so simple, either. The motion of the moon is incredibly complex. There exists a thing called ELP 2000-85 which is the latest attempt to make the math match what the moon actually does. What the thing does is loop through a set of calculations a bazillion times, each time with tweaked coefficients that make smaller and smaller corrections to the calculation. Compiling the tables of coefficients must have been a real pain in the butt. Refining the tables is still ongoing. The accuracy of your calculation comes down to how many times you loop through the coefficients before you decide that the computer power is better used for something else.

Nobody in their right mind would actually use all the tweaks in the ELP 2000 for anything as simple as a moon phase widget, or, for that matter, a moon landing. Along came a guy named Jean Meeus, who published a book full of handy formulas for calculating where things are going to be. He includes simplifications of the ELP 2000 (only looping through 64 iterations), and while they’re not as precise, they’re pretty damn good. I don’t have that book, either.

Time wasted so far: 3 hours. Completion of widget: 0%

But now my search began to bear fruit. I didn’t have Meeus’ formulas, but other people did, and had written software. I found some open-source code that implemented some of his stuff. Yay! I implemented the code, moving it from c to PHP so I could run it on my server. After a few routine hitches the code was up and running and telling me just where the moon was, relative to the Earth, accurate to a couple of arcseconds.

Time wasted so far: 6 hours. Completion of widget: 5%

Unfortunately, it didn’t tell me anything else. This particular code did not provide any information that required data about the sun — like, say, the phase of the moon. Harrumph. Back to the Internet I went. Fairly quickly I found some different code, this time in JavaScript, that also cited Meeus. It was much, much, simpler, ignoring many of the more difficult-to-calculate corrections, but I figured that the first code sample had already done most of that. It was simply a matter of adding the new code to what I already had. Naturally, despite having the same source reference, all the variable names were completely different.

After a great deal of forensics (that’s a big word for ‘wasted time’) I established which quantities I had accurate versions of and which I still needed to calculate. I got everything set up and ran some tests. The results were not good.

Time wasted so far: 12 hours. Completion of widget: 3%

I had expected some problems like this – perhaps in one body of code an angle was expressed in degrees and the other expected radians. Things like that. I started working through things. Only after another day of head-scratching did I test the code I’d based the second half of my project on. It was wrong. So there I was with Frankenstein’s monster of code sewn together from different sources, and one of the sources was broken before I even started. Sigh. Back to the drawing board.

Time wasted so far: 20 hours. Completion of widget: 2%

I should mention along in here somewhere that there are people who sell moon software for quite a bit of money. My little server could potentially put a dent in their sales by bringing accurate calculations to anyone who asks, but its not really the calculations they are selling, but the application around it. I’m not too worried for them.

Back to the Web and by now I was getting better searches because I knew the key terms to look for. I found two more code examples, both of which take precision to the most extreme available. One is a complete implementation of the ELP 2000-82b. This honey consists of 36 files with tables with hundreds of rows of numbers, and a sample program in Fortran that shows how to use them. For ridiculously accurate calculations, I couldn’t do much better. But… It only calculates the position of the moon, just like the first code I implemented. I’d still need to work out the phases and whatnot.

The other code I found is based on earlier math, but really concentrates on what an observer would see from a given point on the Earth. It includes corrections for the optical effects of the atmosphere and for the friggin’ speed of light. It’s got a lot of stuff I don’t need (other planets, for instance), but it has everything I’d be looking for. The thing is, the code is horrible. It’s in c, and the writer apparently never heard of parameters or returning values. Or structs, or anything else that might help organize the information. It is impossible to read a function and know what it does or where all the numbers it uses come from. It would be a big task to translate the pieces I need, mainly because it’s very difficult to tell which pieces I need. Still, it’s an option.

Time wasted so far: 24 hours. Completion of widget: 3%

And that’s where I stand. You know, maybe I’ll wait until I’m on a boat full of moon geeks. I bet one of them even knows a Web site that gives current moon data.

0
Thanks!
Bars of the World TourBars of the World Tour

What’s with all the moon stuff?

June 28th, 2009
Right now, the moon is my clock.

I have added a couple of widgets over in the sidebar that show the phase of the moon. Why? Because when the moon gets back to new, I’ll be somewhere in the ocean around Iwo Jima, staring straight up and burning my eyeballs as the moon passes between them and the sun. Total Eclipse of the Sun, baby, and I’ll be there!

I added two different moon phase thingies because one was more aesthetically pleasing, while the other held more cultural interest. If you hold the mouse over the Japanese characters, you will be given important information about how to carry out your day. If you can figure out what it means.

I’ll be writing more about this adventure as I gear up for the cruise. A boat full of astronomy geeks! Woo hoo!

0
Thanks!
Rumblings from the Secret LabsRumblings from the Secret Labs

Rant of a Geek

March 14th, 2009
It's about units, and getting things straight.

So I destroyed the forum at Jer’s Software Hut. By pure blind luck—the purest and blindest variety of this luck: Extra Virgin Pure Blind Luck, I made a backup two minutes before destroying the forums. I have yet to restore the forums from the backup for reasons I’m not sure of, but the data is there, and I know I will be able to pull it off eventually.

So I have this file that should restore the database to its previous condition. Groovy. Only problem is, it doesn’t work. I’ll figure it out. But that’s not my beef here. My beef is about units. The maximum size for an uploaded restore file is 102 kKiB.

How big again?

There’s been a movement afoot to try to separate the binary “thousand” from the decimal thousand. Thus a thousand meters is a kilometer (km), and a 1026 bytes is no longer a kilobyte (kB), but a kibibyte (KiB). I’m down with that. It’s a distinction I already made in my head, and now it’s codified.

But then there’s 102 kKiB. No. No, no, no. You’re at three decimal point precision here, there’s really not any reason whatsoever to be mixing your numbering systems. (I’m cc’ing this message to the people at myPhPAdmin.) Why not just say 99 MiB? Every mainstream operating system reports file size in MiB (though they call it MB), so suddenly there’s no deciphering involved.

Maybe it’s just the residual physics geek in me, but units, properly used, make things simpler. I got out of a second semester of class by unit-analyzing my way through a test. I had no idea what the question was asking, but I knew what I had and I knew what units the answer had to be in, and most of the time that and a little calculus is enough.

But that has nothing to do with my current rant. My rant is this: 102 kKiB is really effing retarded.

I feel better now.

Edited to add: Apparently, the “MB” numbers on hard drives are the absolutely retarded 1000 x 1024 Bytes, or 1000 KiB, or 1 kKiB. Even though it’s stupid, I will swallow and not be annoyed when the unit is used in direct reference to a hard drive, for truth in advertising. In the case of a file upload, there is still no excuse.

0
Thanks!
Rumblings from the Secret LabsRumblings from the Secret Labs

A Day of Design

March 10th, 2009
My first attempts to make the new banner aesthetically pleasing.

I had other things I needed to do today, and the new blog sucked up WAY too much of my time. I’m working on making the new banner actually look cool, rather than merely function. It’s going… OK, I guess. I’ve already spent a long time trying to figure out colors, when I think the core problem is that the fonts just plain don’t work well together. The guest poem system is mostly done, but I don’t have it displaying the author pictures yet. There’s a bit of a problem there; For most of the poems there’s plenty of room for a picture, but there are a few poems that need a lot of space. I’ll work something out.

I also worked on the comment popup window over there. It’s not great, but it’s a heck of a lot better than it was.

Overall, what do you think? Still to come: sound effects (and a mute button), and a way to play “All for me grog!” I might sneak in a couple of other surprises, too.

0
Thanks!
Rumblings from the Secret LabsRumblings from the Secret Labs

Geekery: Transferring this blog from iBlog 2 to WordPress

March 9th, 2009
This episode is mostly for people searching for help doing the same thing I did. It probably won't be very interesting for regular readers.

Note: For those looking to move from iBlog 2 to wordpress, this article and some follow-up can be found at the iBlog survivors’ forum. The complete script is available there for download. You really don’t have to understand all this stuff.

I started using iBlog several years ago, when it was new and I was new to blogging. It had one advantage over other blogging packages: it came free with my .mac account back in the day and it worked on .mac servers, which are, to put it kindly, inflexible.

Two things have happened in the intervening years: first, all the blogging platforms have gotten much better, including the ability to work on the blog while offline. The second is that iBlog made an abortive step forward to iBlog 2, which was a major improvement, but then the whole company stalled before that release was really finished (although by then I was fully committed to it). I will miss iBlog 2, but not as much as I will enjoy getting my stuff onto a faster, more versatile platform.

After a rather exhaustive search of blogging and CMS systems, I settled on WordPress. While it’s not perfect, it is a straightforward MySQL-Apache-php application that is easy to fiddle with, and some of the customizations I was looking for were much easier with WordPress than with others.

WordPress has a whole bunch of tools and instructions for importing your stuff from other blog systems. None of those did me much good at all, however, as iBlog was too obscure for anyone to worry about. After searching the Internet I found some helpful information, but it all applied to iBlog 1 – most people never made the move to the ill-fated upgrade. I was pretty much on my own.

WordPress can import data in a variety of formats, but it was up to me to get the data out of iBlog in a format WrodPress could understand. The most versatile format was one created by the folks at WordPress, which could include information specific to WordPress. Cool! Decision made, I was on my way.

Except… the folks at WordPress have never bothered to document the structure of their files. Apparently It’s something they’ve been meaning to get around to eventually (though the people writing translation software for the other major blogging software have long since muddled through it). I did what everyone else has had to do to export data: copy one of WordPress’s files and fiddle with it until it works. Not only is this a pain in the patoot, there might be tags that don’t appear in my examples that could nonetheless be useful to me. Oh, well.

I needed my import file to include definitions of categories, and then each of the blog entries, with correct category associations. My example file had a lot of fields that seemed redundant for my purposes, but without documentation I wasn’t going to waste time trying to figure out which tags were required and which weren’t.

Here is a very small (one episode) export file. We’ll go into the details of things like nicename later:

<rss>
<channel>
    <title>Muddled Ramblings and Half-Baked Ideas</title>
    <link>http://jerssoftwarehut.com/muddled</link>
    <description>blog!</description>
    <pubDate>Thu, 28 Jun 2007 21:32:21 +0000</pubDate>
    <generator>Jers Very Clever Script</generator>
    <language>en</language>
    <wp:wxr_version>1.0</wp:wxr_version>
    <wp:base_site_url>http://jerssoftwarehut.com/muddled</wp:base_site_url>
    <wp:base_blog_url>http://jerssoftwarehut.com/muddled</wp:base_blog_url>
 
<wp:category>
    <wp:category_nicename>bars-of-the-world-tour</wp:category_nicename>
    <wp:category_parent></wp:category_parent>
    <wp:posts_private>0</wp:posts_private>
    <wp:links_private>0</wp:links_private>
    <wp:cat_name><![CDATA[Bars of the World Tour]]></wp:cat_name>
    <wp:category_description><![CDATA[blah blah blah]]></wp:category_description>
</wp:category>
 
<item>
    <title>Delayed by Weather</title>
    <link></link>
    <pubDate>2007-03-27 18:23:57</pubDate>
    <dc:creator><![CDATA[Jerry]]></dc:creator>
    <category><![CDATA[Bars of the World Tour]]></category>
    <category domain="category" nicename="bars-of-the-world-tour"><![CDATA[Bars of the World Tour]]></category>
    <content:encoded><![CDATA[<p>The Weather Channel is calling the roads around here "a big mess", so I'm going to take time out from driving and catch up on some writing. Unfortunately, TWC is also calling for dangerous surf and "rough bar conditions". I'd better leave the laptop in my room.</p>]]></content:encoded>
    <excerpt:encoded><![CDATA[&amp;nbsp;]]></excerpt:encoded>
    <wp:post_id>1065</wp:post_id>
    <wp:post_date>2007-03-27 18:23:57</wp:post_date>
    <wp:post_date_gmt>2007-03-27 18:23:57</wp:post_date_gmt>
    <wp:comment_status>open</wp:comment_status>
    <wp:ping_status>open</wp:ping_status>
    <wp:post_name>Delayed by Weather</wp:post_name>
    <wp:status>publish</wp:status>
    <wp:post_parent>0</wp:post_parent>
    <wp:post_type>post</wp:post_type>
</item>
 
</channel>
</rss>

But how to create the file? The data for iBlog 2 is distributed over (literally) thousands of files. Writing a program to track down all the information and make sense of it would be a major chore. That’s where AppleScript came in. iBlog’s programmer took the time to provide access to the iBlog data through the Apple Scripting system. I was able to let iBlog read all of its silly scattered files and make sense of them, then provide the data to me in a coherent fashion. So far, so good. All I needed to do was loop through all the episodes, pull out the data I needed, and shovel it into a text file that WordPress could read.

[IMPORTANT NOTE: I've tried to go back and reconstruct the scripts as they were at the appropriate stage in development, but the snippets are untested.]

[ALSO IMPORTANT: you don't really have to understand the code. If you are in this boat, I will help you. You should understand the challenges, but I'm here for you.]

on run

set exportFile to 0

try

set exportFile to open for access “Users:JerryTi:Documents:scripts:” & niceName & “.xml” with write permission

set eof of exportFile to 0

tell application “iBlog” to set cats to the categories of the first blog

repeat with cat in cats

tell application “iBlog” to set catname to (the name of cat) as text

set niceName to the first word of catname

write rssHead to exportFile as «class utf8» – xml/rss header stuff that’s always the same

set catDescription to “blah blah blah”

write out the category info

tell application “iBlog” to set nextText to “<wp:category>” & newLine & tab & “<wp:category_nicename>” & niceName & “</wp:category_nicename>” & newLine & tab & “<wp:category_parent></wp:category_parent>” & newLine & tab & “<wp:posts_private>0</wp:posts_private>” & newLine & tab & “<wp:links_private>0</wp:links_private>” & newLine & tab & “<wp:cat_name><![CDATA[" & catname & "]]></wp:cat_name>” & newLine & tab & “<wp:category_description><![CDATA[" & catDescription & "]]></wp:category_description>” & newLine & “</wp:category>” & newLine & newLine

write nextTex
t
to exportFile as «class utf8» – have to coerce the text from 16-bit unicode

tell application “iBlog” to set ents to the entries of cat

repeat with ent in ents

get the stuff in iBlog’s world, work with it here

tell application “iBlog”

set titl to (the title of ent)

set desc to (the summary of ent)

set bod to (the body of ent)

set postDate to the post date of ent

end tell

set nextText to (((“<item>” & newLine & tab & “<title>” & titl & “</title>” & newLine & tab & “<link></link>” & newLine & tab & “<pubDate>” & postDate) & “</pubDate>” & newLine & tab & “<dc:creator><![CDATA[Jerry]]></dc:creator>” & newLine & tab & “<category><![CDATA[" & the name of cat & "]]></category>” & newLine & tab & “<category domain=”category” nicename=”" & niceName & “”><![CDATA[" & the name of cat & "]]></category>” & newLine & tab & “<content:encoded><![CDATA[" & bod & "]]></content:encoded>” & newLine & tab & “<excerpt:encoded><![CDATA[" & desc & "]]></excerpt:encoded>” & newLine & tab & “<wp:post_id></wp:post_id>” & newLine & tab & “<wp:post_date>” & postDate) & “</wp:post_date>” & newLine & tab & “<wp:post_date_gmt>” & postDate) & “</wp:post_date_gmt>” & newLine & tab & “<wp:comment_status>open</wp:comment_status>” & newLine & tab & “<wp:ping_status>open</wp:ping_status>” & newLine & tab & “<wp:post_name>” & titl & “</wp:post_name>” & newLine & tab & “<wp:status>publish</wp:status>” & newLine & tab & “<wp:post_parent>0</wp:post_parent>” & newLine & tab & “<wp:post_type>post</wp:post_type>” & newLine & “</item>” & newLine & newLine

write nextText to exportFile as «class utf8»

end repeat

end repeat

write rssTail to exportFile as «class utf8» – xml/rss file closing stuff

on error errStr number errorNumber

if exportFile is not equal to 0 then

close access exportFile

set exportFile to 0

end if

error errStr number errorNumber

end try

if exportFile is not equal to 0 then

close access exportFile

set exportFile to 0

end if

end run

So far things are pretty simple. The script loops through the categories, and in each category it pulls out all the episodes. Only it kept stalling. It turns out that sometimes iBlog took so long to respond that the script gave up waiting. I added

with timeout of 600 seconds

at the start to make the script wait a full ten minutes for iBlog to respond. Yes, iBlog certainly is no jackrabbit of a program.

Now the program ran! The only problem is, the resulting file doesn’t work. Hm. The first thing the importer reports is that it can’t read the dates the way AppleScript formats them. So, I added a function to reformat all the dates to match the example. Then it was importing categories, but not items. Why not?

Um… actually I don’t remember the answer to that one. Let’s just say that it took a lot of fiddling and testing to get it right. Eventually, hurrah! There in my WordPress installation were episodes from iBlog.

And they looked like crap. The thing is, that iBlog included unnecessary HTML tags around the blog title, excerpt, and body. It’s going to be a lot easier to clean them up now, while we’re mucking with each bit of text anyway, so back to AppleScript’s lousy string functions we go to clean up iBlog’s mess.  Now, after we get all the data from iBlog, we call a series of functions to clean it all up:

set titl to stripParagraphTags(titl)

set desc to stripParagraphTags(desc)

set postDate to formatDate(postDate)

set bod to fixBlogBodyText(bod, postDate)


The actual functions are available in the attached final script.

Things are looking better, but still not very good. Much of this is due to some junk iBlog did when converting my older episodes into iBlog 2 format. One thing it did was to insert hard line breaks in the text of the blog body. No idea why. Maybe they were there all along and I had no way to see them. WordPress helpfully assumes that if you have a line break in the data it imports, you want a line break when it shows on the screen. So, every line break is replaced by a <br /> tag when imported into WordPress. This will not do. Additionally, iBlog replaced paragraph breaks </p><p> with a pair of break tags: <br /><br />. Once again, the reason for this is a mystery. The latter issue is less important, but we may as well address it while the hood is up.

Back we go into the fixBlogBodyText function, to repair more silly iBlog formatting. The resulting function looks like this:

on fixBlogBodyText(s, postDate)

this assumes that if an episode is supposed to start with a div, it will have a style or class

if (the offset of “<div>” in s) is equal to 1 then

set s to text 6 thru (the (length of s) – 6) of s

in some cases there was an extra line feed at the end of the text as well

if the last character of s is “<” then

set s to text 1 thru (the (length of s) – 1) of s

end if

set s to “<p>” & s & “</p>”

end if

clean up iBlog junk (lots of this stuff is the result of upgrading to iBlog 2 – the conversion was not clean

replace all line breaks with spaces

set s to replaceAll(s, “

“, ” “)

replace all double-break tags with paragraph tags

set s to replaceAll(s, “<br /><br />”, “</p>” & newLine & “<p>”)

replace all old-fashioned double-break tags with paragraph tags

set s to replaceAll(s, “<br><br>”, “</p>” & newLine & “<p>”)

get rid of some pointless span class info


set s to replaceAll(s, ” class=”Apple-style-span”", “”)

return s

end fixBlogBodyText

note: replaceAll is a utility function I wrote that does pretty much what it says. You will find it in the attached source file. newLine is a variable I defined because left to it’s own devices AppleScript uses the obsolete Mac OS 9 line endings. What’s up with that?

At this point the text is importing mostly nicely. But wait! I was running my tests just working with one category to save time. When I looked at Allison in Anime on WordPress, some really weird things started happening. It turns out that when importing the data, you need line breaks every now and then, otherwise the importer will insert them. That would be nice to put in the documentation somewhere! In one of my episodes, the newline was inserted right in the middle of a <div> tag, which led to all kinds of trouble. So, to the above script I added a line that inserts a line break between </p><p> tags. As long as any one paragraph isn’t too long, I’ll be all right.

set s to replaceAll(s, “</p><p>”, “</p>” & newLine & “<p>”)

And with that, we’ve done it! We’ve written a script that will export all the data from iBlog 2 and format it in a way that WordPress can accept. Time to run it on the whole blog, go take a little break, and come back and see how things went…

Dang. Didn’t work. There’s a maximum file size for import, and my blog is too damn big. Not a huge problem, just a bit of modification to make each category a separate file. Now, at last, the data is imported, the text looks nice, and we’re ready to make the move to our new home.

Except…

The images don’t show up, and links between episodes are broken. Also, it would be nice if people could still read the old Haloscan comments. I guess we’re not done yet.

Image links were the easiest to repair. In iBlog 2 the source code always looks for the image at path /http://muddledramblings.com/wp-content/uploads/iblog/. We just have to find those links and replace them with new info. I used Automator to find all the image files in the iBlog data folders, then I copied them all up to a directory on the WordPress server, and pointed all the links there. Worked like a charm! (Icerabbit goes into more detail on that process here. I used different tools, but the process is the same.)

Links between episodes turned out to be a lot trickier. It came down to this: How do I know what the URL of the episode is going to be when I load it into WordPress? I had to either know what the episode’s id was going to be, or I had to know what its nicename was going to be.

Nicename is a modified title that can be used in URL’s – no spaces and whatnot. “Rumblings from the Secret Labs” becomes “rumblings-from-the-secret-labs”. If I set up wordpress to use the nicename to link to an episode rather than the ID number, it would have some advantages, but I can get long-winded (have you noticed?) and that applies to my episode titles as well. The URL’s for my episodes could get really long. Therefore, I’d rather use the episode’s ID for its permalink. (If you try the icerabbit link above, you will see the nicename version of a link.)

Happily, the import file format allows me to specify the id of episodes I upload. (I don’t know what it does if there’s already an episode with that ID.) After some fiddling I managed to specify reliably what ID to give each episode. Now in my script I make a big table with the iBlog paths to each episode and the ID I will assign it. Before the main loop I have another that builds the table:

first loop

set postID to firstPostID

set idTableRef to a reference to episodeIDTable

tell application “iBlog” to set cats to the categories of the first blog

repeat with cat in cats

set cat to item 1 of cats

tell application “iBlog” to set catFolderName to the folder name of cat

display dialog catFolderName

copy {catFolderName, -1} to the end of idTableRef

tell application “iBlog” to set ents to the entries of cat

repeat with ent in ents

tell application “iBlog” to set episodeFolderName to the folder name of ent

set episodePath to catFolderName & “/” & episodeFolderName

copy {episodePath, postID} to the end of idTableRef

set postID to postID + 1

end repeat

end repeat


Now it’s possible to look up the id of any episode, and build the new link. The lookup code is in the attached script, and also handles the special cases of linking to a category page and to the main page. For category pages, I just hand-built a table of the category ID’s I needed based on previous import tests.

Finally, there is the task of preserving the links to the old comment system. Happily, those Haloscan comments are also connected based on the file path of the episode. (Though it looks like really old comments are not accessible, anyway, which is a bummer.)

In the main loop, after the body text has been cleaned up, tack the link to Haloscan on the end, complete with hooks to allow CSS formatting:

set bod to bod & newLine & newLine & “<div class=”jsOldCommentBlock”><span>Legacy Comment System:</span> <a href=”javascript:HaloScan(‘” & entFolder & “‘);”><script type=”text/javascript”>postCount(‘” & entFolder & “‘); </script></a></div>”

Not mentioned above are functions for logging errors and a few other utililties that are in the main script file. They should be pretty obvious. The script includes code that is specific to issues I encountered, but it should be a good start for anyone who wants to export iBlog 2 data for import into another system. It SHOULD be safe to execute on your iBlog data; it doesn’t change anything on the iBlog side of things. I don’t know if there’s anyone else in the world even using iBlog 2 anymore, but if you would like help with this script, let me know.

0
Thanks!
Rumblings from the Secret LabsRumblings from the Secret Labs

Is the Hut running?

March 9th, 2009
 

Hey, can someone test these links for me?

From where I’m sitting right now, I can’t access Jer’s Software Hut or the blog construction site. I can reach everything else on the Web, so I’m wondering if my server is down or if my IP address has been blocked by my host’s security robots (again). I went to sleep with an open connection to my WordPress database and that might have triggered something. Can anyone out there load those pages and let me know? Thanks!

0
Thanks!
Rumblings from the Secret LabsRumblings from the Secret Labs

New Blog Design Progressing Sideways

March 7th, 2009
For all the progress I'm making, you'd expect something better over there.

Ambitions are skyrocketing here at the Hut as the new blog starts to take shape. Too bad you can’t see most of it. But I’d like to ask two things:

1) When you wander over there, can you tell me what you see? I’ve got some of the same CSS that kills Internet Explorer over here at work over there as well, but I think I have things constrained so that the poor software can handle it.

2) Do you see a really dumb animated header? If not, what do you see?

Behind the scenes, that dumb header is grabbing haiku from a database using XML. The perfect storm of tech and art. Best of all, some of those haiku were written in a spreadsheet.

Which, now that I think of it, leads me to another way someone can help. All the old poems in the rotation are image files. Now I need them as text. Anyone want to transcribe them? It would be a big help! Just need a nice table (or spreadsheet!) with poem, author, comment, and link, if applicable. Surely someone out there is looking for a way to contribute to the arts.

So there we have it. My head is in such a technical realm right now that I can’t even watch cartoons. I amused myself tonight with wine and the ActionScript 3.0 documentation, with brief forays into php and WordPress APIs, thinking all the while about how to tackle a page count memory leak in Jer’s Novel Writer. Yeah, I know how to party on a Saturday night.

0
Thanks!
Rumblings from the Secret LabsRumblings from the Secret Labs

Getting the Hut Back Up and Rolling

March 6th, 2009
That's right kids, after a long haitus there's a new release of Jer's Novel Writer afoot!

Um… actually two releases. The first didn’t last long.

It’s been a while since I’ve really knuckled down and worked on Jer’s Novel Writer, but after wrestling with the script to extract data from iBlog to export to WordPress, my brain has been sliding into technomode, and it was nice to work in a programming environment that was less frustrating than AppleScript. I had a version of Jer’s Novel Writer that I’d done some work on a while back, but it took a while to get myself back up to speed on just what was going on in the code.

I missed something on my first try. Happily a loyal user caught it almost right away, and one day later version 1.1.8 is out there, helping people write. Whew! Slowly things are returning to the balance I’d managed to keep for the last few years. The last few months have been… less balanced. (Obviously I’m operating in the geek hemisphere right now. No metaphors for you today!)

Meanwhile, a few days ago I got this!

Jer's%20Novel%20Writer_award.png

0
Thanks!
Rumblings from the Secret LabsRumblings from the Secret Labs

AppleScript Sucks

March 1st, 2009
Have I mentioned this lately? Let me remind you.

Here’s the thing: the idea behind AppleScript is actually very cool. That I can write a (theoretically) simple program that harnesses the power of several applications on my computer is the Next Frontier in Computing (Apple is not the only company doing this stuff). Now Apple even has a program called Automator to handle some of these tasks without you ever having to write any code. That’s a good thing, because AppleScript the language really, really blows. So much for the next frontier. It’s like the covered wagon is being pulled by an armadillo.

The temptation of AppleScript is that I need to take information from iBlog and convert it to a format that WordPress can use. AppleScript makes it really simple to ask iBlog for its data, already set up and accessible. Cool. Then we get to the part where we have to make AppleScript do useful things to the data. Uh oh. Welcome to the worst programming language ever created.

Sometimes with familiarity one learns that although a different language might do things a different way, it has its own strengths. Perl, for instance, is a text monster, but makes sacrifices to be one (so I’m told). AppleScript occupies a unique position in the programming world as I know it by doing everything badly. I challenged myself tonight to come up with one good thing to say about it. When I try I can even think of good things to say about Microsoft and the Yankees. Not AppleScript. It’s like Apple is intentionally hiding powerful capabilities I know are there, built into the operating system. Not only that, it hides simple abilities that I can use in any other comparable scripting environment. AppleScript doesn’t want me to get my work done.

On top of that my task this time is made harder by iBlog’s grinding horrible slowness. Is nothing at all happening because I made a mistake, or is iBlog just off smelling the roses right now? What I want to do is exactly what AppleScript and iBlog’s script support were designed for, and I’ve already written some text functions that every other comparable environment has built-in, yet in the end I’ve been wasting my time. Now it’s time to bring in the big guns. Doing this the hard way turns out to be simpler than doing it the easy way. Go figure.

I will be doing a series of propellerhead articles documenting the migration from iBlog to WordPress. The articles might be interesting to someone if I wasn’t the only one on the planet still using iBlog.

0
Thanks!
Idle Chit-ChatIdle Chit-Chat

Moving the Blog!

February 28th, 2009
Yep, Muddled Ramblings and Half-Baked ideas will be relocating some time this spring, and whether you're a regular or a first-timer, you can help!

Yesterday I was hacking at some code, fixing a problem with the way the site looks on the Opera browser. I use iBlog right now, a platform with some cool features and some pretty obvious warts. It was designed to work on servers where the blogger had no control over the server at all (say, Apple’s .mac servers), and therefore the way it did some things was… unusual. Without going into too much detail, iBlog does some things that have unpredictable results on some browsers, including the latest Opera. In addition, the company that made it stopped working on it some time ago and even the discussion forums are gone now.

I fixed the most obvious problem, but there were others, and once again I was faced with the choice of spending my time cobbling together the old system or shifting to a more robust platform. Sooner or later I’m going to have to move, so I decided not to spend any more time tweaking this one.

I’ve been looking into various blogging and content management packages, without finding one that matched the features of iBlog. A couple came close, however, and that’s going to have to do. I will be moving to WordPress sometime this spring. I should be able to make it do what I want, as long as I don’t mind getting my hands dirty. Looks like I’ll be learning a bit of php.

Here’s where you come in: I’ve got a test blog up and running, and out of the box it looks… boring. Slick and professional and all that, but not really me. I Browsed through the bazillion other options people have already created and, well, they’re not very good either – either stodgy or designed by illiterates for illiterates. “Oh, you want to read the text? Dang, I never considered that…”

I takes only a glance around here for you to to see that my design skills are no better; but now I’m going to be doing a ground-up redesign of the site, even if I want to keep it looking the same. I have some thoughts about some fairly ambitious things I’d like to try, but before I get carried away I’d like to know what you guys think of the way things look right now. What do you like? What don’t you like? Layout? Colors? Content? Too much in the sidebar? Not enough whatnot?

One idea I just had: a page with links to all my stories, with a way for people to rate them. The favorites would rise to the top. Yeah, I suspect that feature’s not coming soon. But maybe your crazy idea will work! Leave a comment! Go nuts!

0
Thanks!
Idle Chit-ChatIdle Chit-Chat

It’s Not Too Early to Start Begging, Is It?

October 10th, 2008
Wasting time is taking longer than it should.

You know what I’d like for Christmas? I like a version of Adobe Flash that is actually designed to run on my computer. My old, old version of Flash (old enough to be made by a different company) works – mostly – but is slow and crash-prone. Anyone got a used version of Flash that runs in Intel-based macs they’re not using anymore?

Note that this would be a highly impractical gift, allowing me to waste time with greater efficiency than ever before. Flash is also very expensive and there’s no way I can justify paying for a new version based on what I do with it. But if someone out there bought Flash thinking they were going to take over the Web and then discovered what a pain in the butt Flash can be, think of me.

On a related note, I am making slow progress on the next animation, a much more ambitious follow-on to the ducks animation. I’m sure I’d be done by now if I had the right software…

0
Thanks!
Idle Chit-ChatIdle Chit-Chat

An Unplanned Morning Walk

September 14th, 2008
Autumn has arrived; there's a chill in the air. This episode isn't really about that.

I woke up this morning feeling refreshed. The sky was brightening outside, and no clouds were visible through the window cut into the sloping ceiling directly over my head. I got up, woke up my computer, and went to fix tea. The electric kettle quickly heated the water for my first (but certainly not last) cup, and once it was fixed I returned to my desk.

My computer was turned off. Not just sleeping, but completely turned off. Curious.

It wouldn’t start again, either. I tried a light switch, then a different light on a different circuit. Nothing. My apartment was without electricity. Consulting my phone I saw it was 8 am when the electricity had stopped, and out on the street the crews were hard at work rewiring the neighborhood. This was probably a planned outage and I hadn’t got the memo. (On previous occasions I had.)

Well, then, no electricity. No computers. Normally I’d be ok with this. I’d probably just go back to bed. But That Girl had specifically mentioned that she was going to try to stay up until I woke up, so that we could chat. I’d hate to let That Girl down. Obviously, then, if the Internet wasn’t going to come to Jerry, then Jerry could go to the Internet. After all, there is a friendly little café nearby that has WiFi. There aren’t many of them out in this neighborhood of Prague, so I feel fortunate to have one so close. Plus, they often have good tea there.

I was about halfway there when it occurred to me that today was Sunday. If the café bothers to open at all today it will be this afternoon. As I walked (trying not to interfere with the construction crews who were, in open violation of the ethical standards of state-employed construction workers the world over, hard at work), I tried to come up with a Plan B. There was none that didn’t involve public transportation and overpriced access. I stopped outside Little Café Near Home and used my phone to see if their wireless was up. At least I could email That Girl to tell her what was happening. There was the network! Hooray!

I have complained about my phone, but it is perfect for things like this. I laboriously typed out a message, then hit send. “Use cafemania wireless network?” the phone asked me. “Yes,” I answered. “Enter password,” my phone said. I typed the password, working around my phone’s bloody-minded insistence that the first letter be capitalized. Password entered, I hit “send.”

“There’s no network here named cafemania,” my phone told me.

Where did the network go? There was no one inside to turn it off. Maybe LCNH’s power was cut off just then. I laughed, shook my head, scanned for neighboring networks that were unprotected, found none, and decided to go home. I took a slightly different route home, around the worst of the construction, and met a dog who used to be a regular at Little Café Near Home, but hasn’t been coming in lately. The sun was shining, the birds were singing (probably saying “see you next spring”), and the air was chill and crisp. Bracing, even.

I got home, put some water on the gas stove, then with a click and a pop the electricity came back on, and here I am telling you about my morning.

0
Thanks!
Idle Chit-ChatIdle Chit-Chat

MySpace Heroes

September 6th, 2008
It's this game I'm playing.

I’ve been spending too much of my life over at MySpace recently. I signed up a few months ago so I could send a message to Zombina and the Skeletones, but that was all I did. Recently I was hanging with That Girl and her sister, and TGS paused to check how things were going in an online game called Heroes. It turns out that an important part of the game is getting other folks to join your bunch, so a few days later I joined in — just to help her out, of course.

I spent too much of my life getting to know the game, then another too much of my life playing the game. It also turns out that there are several other games on MySpace — or should I say several iterations of the game with different graphics. Mobsters seems to be the most popular, but there are also space, pirate, and vampire iterations with only minor differences. In all of the games it is beneficial to build up a whole boatload of friends (up to 500). Somewhere word got out that I would accept invitations to be anybody’s buddy in any game. I am a game friend slut, and now I appear to be very popular on MySpace. I have started down the slippery slope from slut to whore; I have now posted my name in a couple of places where people go to find friends for these games. [Since I wrote that a couple of days ago, my transition is complete. I now actively approach people who say they are interested.]

So what are these games that are eating my brain? In truth, they’re really not that great. Activities fall into three categories: invest in real estate to build wealth, gather members in your group, and buy stuff so your guys can beat up other guys and take some of their money.

There’s really no goal to the games, except get more money to buy more stuff to get more power so you can beat up more people. (Even the beating up happens off-camera.) Why am I still playing? I don’t know. But when I wake up in the morning the first thing I do is check to see if anyone else attacked me while I slept and stole some of my money. I calculate how long it will take at my current income level to be able to afford a particular piece of property. I have, as mentioned above, gradually become more active in adding other people into my bunch. Once they are added they are little more than a number – no further interaction is required (although some players do try to build a group cohesion).

Once things are under control in Heroes, I make the rounds of all the other clones, making sure I keep my promises to join other people’s bunches. I don’t actually do anything in those other games except occasionally reinvest real estate income.

So far that’s not a big slice out of my life, but then, then I have to check back periodically to see how things are going. Every time I review my real estate investments and strategy going forward, even though that strategy only hits important events every couple of days (and I have calculated when that time will be). Every time I go over all the gear I have for my bunch to use in battle, even though my needs in that area don’t change very often either. Every time I wind up poking around for someone to attack who might cough up a lot of money, then I decide not to bother. Every time I check for messages to see if someone in my group is asking for help kicking someone’s butt for whatever reason.

None of that takes a lot of time, and in fact my total time on the game is probably not that bad. The problem is that I do it often, and any momentum I might have had on other tasks is irretrievably lost, so I can play what amounts to an accounting game. I’ve got to get this game out of my head.

On a related note I plan to put a strategy guide to the various games up on my MySpace page, once I run some spreadsheet simulations of different stgrategies. And of course if you want to join my bunch, guild, mob, crew, family, or band (depending on the game) you are welcome to add me as a friend – http://myspace.com/?writerjer – and invite me in. I’ll join anything.

Edited to add: I now have an investment spreadsheet that people can download at Jer’s Software Hut, designed to answer the qustion whether it’s better to by one of a property or a batch of ten, depending on your circumstances.

0
Thanks!
Idle Chit-ChatIdle Chit-Chat

The Science of Banana Numeration

June 4th, 2008
Perhaps my geekiest episode ever, but I think this way, sometimes.

Yesterday, as I was regarding a bunch of bananas in the kitchen, I mentally dashed off this code snippet:

#typedef enum {

Banana_Green = 0,

Banana_Yellow,

Banana_Spotted,

Banana_Brown

} BananaRipeness;

#typedef enum {

Take_Banana = 0,

Hold_Out_For_Banana_Bread

} BananaAction;

- (BananaAction) takeBanana:(BananaBunch *)bunch

{

if ( (0 == [bunch count]%3) && [bunch ripeness] > Banana_Yellow ) {

return Hold_Out_For_Banana_Bread;

}

else {

return Take_Banana;

}

}

People who live in houses where banana bread is made will, of course, understand at a glance that when the bananas are getting on in ripeness and there is a multiple of three bananas remaining, one does not take a banana, but rather one holds out for banana bread, lest they face the ire of their fellow residents. Some debate is possible whether the ripeness threshold should be past yellow, as in my code here, or whether one should start holding out earlier, even though the bananas still have a few days left.

It is very good to be in a house where banana count is important.

Code notes: this is written in (more or less) Objective-C, and assumes there is already defined a collection called BananaBunch. I generally avoid multiple exit points in a function, but this one is simple enough that I decided it was OK. I haven’t bothered checking the code for errors, it’s just not that sort of exercise.