Auto-linking Text URLs to HTML
An implementation for converting a plaintext URL to a link, brought up in the post The Problem With URLs. This is useful for a custom comment or feedback system, but we’ll forget gopher:// links (sorry.)
You can use the search form below to go through the content and find a specific post or page:
An implementation for converting a plaintext URL to a link, brought up in the post The Problem With URLs. This is useful for a custom comment or feedback system, but we’ll forget gopher:// links (sorry.)
After implementing an events calendar in Java/JSP (which itself was an almost-knockoff of ExtCalendar, with extended invitation and viewer permission functionality built into the CMS), I started thinking there must be a better way to represent repeated events. Luckily, in that case, every event wasa single instance, but for a multifunction calendar, recurrence (that being an event repeating multiple times, possibly to infinity, even) is a necessity.
We fear change. I wanted a more presentable look so I grabbed the Color Paper theme (colour!) from Smashing Magazine, on the scene in a dream. I was just lucky to come across it as I’ve been reading a lot of design blogs lately for some unknown reason. Maybe to mourn how I can’t afford an Adobe suite used to perfect mad skills required for such artwork? The fixed height of the featured post is a bit annoying (more under the cut, ha.)
During some downtime here, I’ve been passively thinking up projects to occupy my time. Yesterday, I wondered whether there was a web app to properly track films I’ve watched, books I’ve read, etc. Specifically, I want to make a WordPress plugin for storing the history of each film I’ve watched ala the flog link at the top of this page, which is now a flat page I manually update. So I would like a web app where I can just enter a date and movie name where the system would handle retrieving the movie poster, Amazon link, and IMDB link with any meta info that is configured to display.

After almost six months with a Sony Ericsson K850i, offered through Rogers Wireless in Canada, I thought it was about time to make some comments on its use since my critique should be worth its weight in gold. Isn’t that the only commodity that will keep its value through the oncoming recession?
Let’s go straight for shortcomings. To load ringtunes on the device, you must run the DRM Packager on your MP3s to wrap encryption for recognizing sound clips in the file system. I use the 24 CTU office ring because I’m a dork that pretends the last two seasons don’t exist. This is only exercised at home since I get twitchy when imbeciles molest the general public’s ears via ringtones. Instead I use vibrate, but I’m a dude that doesn’t rock out to tight-ass hipster jeans so I only actually feel the vibrate about half of the time. This is an issue since I don’t have caller ID or voicemail on my service because every Canadian telecom rips off its customers. I will have to pay more than $10 just to get these simple features that are included with almost every European and American provider. Rogers, suckle my sweaty choda.
For pocket room, the device isn’t a flip and a bit on the bulky side since it’s also a higher-end camera. I could even say that it’s thicker than Sarah Palin – HEYO! You also should be sure to lock the screen before sliding it into a pocket because the limited touch screen has a habit of going into video mode to enter battery-drain city. Since it’s a 3G phone, that’s already an issue and I have to charge it about every second day, even with minimal usage. The earpiece has a very precise point to listen from and it’s pretty terrible in a little bit of wind or on a bus/train. Even though I’ve never once dropped it, the battery has a habit of coming loose when pushed into my pocket or placed on a table. The buttons are small for text messaging.
The chief selling point of the device is the upper-end resolution of its camera. It’s 5 megapixel but the zoom has zero purpose since everything turns into a pixelated mess. The flash only syncs properly with the phone about half the time so night-time is a wash for your Facebook galleries of damn-I-think-we’re-still-drunk-so-let’s-immortalize-it. From my Flickr account (go search for it), you can see the panoramas it captures aren’t too shabby for a cameraphone. Woah, a compliment!
I haven’t tried video calling or Bluetooth since they’re only for greasy weasels.
In summary, even expensive mobile phones are rubbish. Serenity now.
If you ever use the deprecated PHP PEAR DB API for using prepared SQL statements that are portable across different database management systems (stop using the mysql_*() functions), I have a fun bug for you! It kept reporting the simple message “DB Error: mismatch”, which generally means the number of parameters you’re passing into the prepared query don’t match the number of markers you’ve made where parameters should be placed (i.e., the question marks).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | /** * Retrieve list of categories that aren't under a given category, * at least one level deep. * * @param int $categoryId * @return array of BusinessCategory objects */ public static function getNotUnderCategory($categoryId) { $query = "SELECT `businessCategory`.`id`" .", `businessCategory`.`parentId`" .", `businessCategory`.`name`" .", `businessCategory`.`description`" .", COUNT(`Category`.`categoryId`) AS `numBusinesses` " ."FROM `businessCategory` " ."LEFT JOIN `businessCategory` `ChildCategory` " ."ON `ChildCategory`.`parentId` = `businessCategory`.`id` " ."LEFT JOIN `businessCategoryEntry` `Category` " ."ON `Category`.`categoryId` = `businessCategory`.`id` " ."OR `Category`.`categoryId` = `ChildCategory`.`id` " ."WHERE `businessCategory`.`id` != ? " ."AND `businessCategory`.`parentId` != ? " ."GROUP BY `businessCategory`.`id` " ."ORDER BY `businessCategory`.`name`"; $db = ElcDatabase::getDb(); $results = $db->query($query, array($categoryId, $categoryId)); if(PEAR::isError($results)) throw new Exception($results->getMessage()); $businessCategories = array(); while($results->fetchInto($row, DB_FETCHMODE_ASSOC)) { $businessCategory = new BusinessCategory($row); array_push($businessCategories, $businessCategory); } $results->free(); return $businessCategories; } |
As you can see, there are two question marks and two parameters passed. After almost an hour of fucking about, I figured out that my dear “DB Error: mismatch” was referring to PEAR not accepting != as a boolean operator even though this is valid in MySQL’s syntax. So no, I had to switch it to <>. Way to go on those error messages. I guess this is why it’s been superseded by the more type-heavy MDB2. Doesn’t make up the fact that PHP is a terrible language to work with. I probably should actually get into frameworks at some point. This would require effort.
Please note, my final code is much cleaner; I just had to merge a few methods together to make this presentable in a post. Stop looking at me !!
When Jeff Atwood of the blog Coding Horror (which doesn’t have the same content as The Daily WTF, despite its name) doesn’t use the word “ecosystem” to describe the software world every fifth damn post, sometimes he brings up an interesting topic such as how to handle password input. I’ve personally experienced the frustration of users not knowing what the fuck they are typing when it comes to an asterisk-echoed password field. The past few versions of Windows have offered a bubble popup to warn caps lock is enabled, but some additional checks should to be put into account. Not to mention that it take five minutes just to get across the instructions to do a Start » Run » [type password here] just to ensure the keyboard is working correctly.
So I was kind of wondering whether Vista’s “display characters” functionality of a login dialog could translate to the web. Chiefly, can it be cross-browser compatible and what are the security concerns? The simple implementation I came up with was:
<label for="password">Password:</label>
<input id="password" name="password" type="password" maxlength="100" />
<input type="checkbox" name="showPassword" id="showPassword"
onchange="swapShowPassword(this.form)" />
<label for="checkbox">Display characters</label>function swapShowPassword(form) { if(form === null || form === undefined) { return false; } else { if(form.showPassword.checked && form.password.type == "password") { form.password.setAttribute("type", "text"); } else if(!form.showPassword.checked && form.password.type == "text") { form.password.setAttribute("type", "password"); } } }
Surprise, Internet Explorer doesn’t allow you to dynamically change the type of an input box. So let’s try again.
function swapShowPassword(form) { if(form === null || form === undefined) { return false; } else { var parentNode = form.password.parentNode , nextSibling = form.password.nextSibling; if(form.showPassword.checked && form.password.type == "password") { var newPassword = document.createElement("input"); newPassword.setAttribute("type", "text"); newPassword.setAttribute("id", "password"); newPassword.setAttribute("name", "password"); newPassword.setAttribute("maxlength", form.password.maxlength); newPassword.setAttribute("value", form.password.value); parentNode.removeChild(form.password); parentNode.insertBefore(newPassword, nextSibling); newPassword.focus(); // force IE to refresh page } else if(!form.showPassword.checked && form.password.type == "text") { var newPassword = document.createElement("input"); newPassword.setAttribute("type", "password"); newPassword.setAttribute("id", "password"); newPassword.setAttribute("name", "password"); newPassword.setAttribute("maxlength", form.password.maxlength); newPassword.setAttribute("value", form.password.value); parentNode.removeChild(form.password); parentNode.insertBefore(newPassword, nextSibling); newPassword.focus(); // force IE to refresh page } } }
In Internet Explorer, you have to focus on an element other than the checkbox or its label in order for the input change event to be refreshed on the screen. So I just put that instruction in there to work around another stupid fucking piece of Internet Explorer functionality.
We can hope people have converted to LCD screens so we can be a little less paranoid of Neil Stephenson-inspired Van Eck phreaking to steal passwords shown on screen. A real concern is the form history usually saved by web browsers for all regular text fields. In Firefox, the password would show after the username is typed, although changing the field back to type=”password” on the form’s onsubmit event could possibly prevent this. Users can go through the Firefox menus Tools » Options » Security » Show Passwords to prevent their passwords from ever being shown, but that’s so advanced that it defeats the purpose of showing characters to dumbbell users. You ensure show password is always off by default on the page load, but the strongest worry is a user leaving their computer unattended with the form open. Someone can just walk along and click a checkbox to reveal their oh-so secure password of “iamgod”, which also happens to be the same as their banking login. I think these reasons alone indicate that the “display character” functionality just doesn’t work with the web.
Although I wished to have it on my iPod Touch when typing in WiFi or e-mail account passwords on that tiny fucking keyboard.
Ever come across a form prompting for your e-mail address only to find out it won’t accept your perfectly legitimate handle, like romeo+juliet@shakespeare.ca? Theoretically you can also send mail to a user at an IP address instead of a domain name… so why are these false positives being thrown? Maybe it’s because the pattern to recognize a proper address is a complete retarded regular expression. When you factor in the escape characters of a programming language, who would want to re-implement this? Not to mention, there will soon no longer be a Latin alphabet stranglehold on e-mail addresses.
At this point, the most simple method is to check for a single @ sign with characters before and after. Perform the check in the web browser and also on server-side just in case JavaScript is disabled. In Javascript, the function will just look like this:
function validateForm(form) { if(!/^[^@]+@[^@]+$/.test(form.email.value.replace(/^\s+|\s+$/g, ''))) { alert("No, just no."); form.email.focus(); return false; } else { return true; } }
<form ... onsubmit="return validateForm(this)"> ... <input name="email" type="text" /> ... </form>
So why verify? You may break XHTML compliancy on <a href=”mailto:… tags? Prevent sending messages to multiple recipients by throwing a comma or semicolon in the input text field? Why are you even collecting the e-mail address in the first place? What will you use it for? Registration? I think I validate just as a matter of principal (also known as OCD) to ensure every bit in my database has integrity. It’s to the point where you really should just verify the address by attempting to fire off a message containing a clickable link to verify a hash saved to the database. Let your mailing API throw an exception if the address is invalid. Of course, when spam filters just kill the email, what’s the point?
This is where we have a web development existential crisis.

In an endeavor to fill my empty soul with joy in the form of capitalist fulfillment, I embraced my consumer whore nature and purchased an 8gb Apple iPod Touch. The “I” stands for inflated sense of ego.
In early 2007, my CD/MP3 player broken and I never really got around to purchasing another device. A friend threw me a replacement in the form of a JSK Digital MP-407 USB thumb drive MP3 player (oddly, the manufacturer doesn’t have a web site), which had a measly 256mb capacity. I generally only listened when mobile on transit and I also stuck to the same artist for a week at a time, so it really wasn’t an issue only have two or three albums with me at any time.
The manufacturing defects of the thumb drive started to become exposed via random player reboots and the inability to lock the next track button leading to my pocket suddenly deciding on song changes. I decided it was time for a quality player, but resolved to not making it an impulse buy. My next plan of action? Impulse buying an expensive mobile music player. Of course, as a fashion accessory, it kind of is a thief-happy device due to the white earbuds. I didn’t even let those rubbish pieces of audio equipment leave their packaging. Instead, I’ve been using my dumpy (but adequate) Sennheiser PMX-60 pair which don’t attract much attention, although they supposedly leak a lot of sound due the open design… but nobody on public transit has complained yet. I dare you! I FUCKING DARE YOU! I tend to keep my iPod in concealed as to avert the questioning eyes of the young and the beautiful. That I must above all things love myself.
I’ll get right into the Negative Nancy.
It bugs me that controlling music volume or making a track change both require looking at the screen. So you can’t just throw a hand in your pocket to make a quick adjustment. No Adobe Flash negates the “full web experience” that Apple claims. It may be a strategy to avoid streaming video that isn’t YouTube or a method to reduce memory usage, but Flash is now a necessary component of the web. It isn’t just used for frivolous splash pages anymore. There is also no scrobbling through Last.FM to keep a record of all the music you listen to. There are workarounds and I imagine there will be a supported standalone app once the iPhone SDK third-party additions are allowed to be copied over through iTunes in June.
Now on to why the thing sells well. Apple sure knows how to throw a nice graphical layer or some simple, useful features. The user interface is pretty and responsive with its PowerPoint-style page transitions from menu to menu. My attempt at drunk Facebooking while sitting in the crowd at a Guelph Storm hockey game was luckily thwarted by the small touch keyboard, hazy vision, and my Man-Sized fingers. The next morning moved nicely into a session of hungover bed-chillaxing while checking the message history in a competition to see if I could delete possible items before recipients read their contents. It was as I remembered – nothing sent since I was too drunk to log in. Stay in school.
Some of the iPhone/iPod Touch-specific webapps are very nice, such as the aforementioned Facebook version, mostly since it doesn’t waste whitespace on advertisements (which I block anyway, on PC) and doesn’t require zooming on any screen. The zoom in/out finger strokes can get tiring when browsing the web, but once more sites create webapps, it can make the mobile Internet experience much more seamless.
I’ve yet to really use the features of the Touch other than music and email, mostly since I don’t want a jailbreak attempt to create a $350 brick. In all actuality, with my lifestyle, the WiFi features are simply a gimmick since I’m so often near or at a PC anyway. I probably soon will be buying a mobile phone, but the iPhone was never in my frame of thought since Rogers are fucking assholes about allowing their wireless service prices to even approach anywhere near the somewhat reasonable prices of US provider. This covers both their equipment costs and data plan options. Of course, the reviews of the iPhone for its phone functions haven’t been too praising, other than the visual voicemail feature. I’ll probably instead find an unlocked Sony Ericsson and be that annoying jackass double-fisting expensive technology while crying out for Nature as the disillusioned man-child he really is.
I was tasked with writing a Java app with client-side authentication, with the ability to save the login information. So I needed to encode the password when saving the configuration to disk and also before sending login credentials through HTTPS. You think getting that information is a simple one line method call to a Java API? Hells no.
I obviously started via Google search, trying one of the first MD5 implementation results using Java’s MessageDigest class. This code is just wrong. I came across a couple strings that weren’t encoded to the same hexadecimal as MySQL’s md5() function. A couple entries down in Google’s search return was a more concise chunk of MD5 code. However, there was still an issue since its returned string wasn’t a 32 character length string that could be used to compare against a MySQL md5() password column. Here’s a proper method, with left zero padding:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | public static String getPasswordEncrypted(String password) { try { MessageDigest algorithm = MessageDigest.getInstance("MD5"); algorithm.reset(); algorithm.update(password.getBytes(), 0, password.length()); BigInteger encryptedBytes = new BigInteger(1, algorithm.digest()); // 16 -> hexidecimal notation String encryptedPassword = encryptedBytes.toString(16); // padding left zeroes for 32 length string if(encryptedPassword.length() < 32) for(int i = encryptedPassword.length(); i < 32; i++) encryptedPassword = "0" + encryptedPassword; return encryptedPassword; } catch(NoSuchAlgorithmException e) { return ""; // eh? } } |
Given the task to develop a small C# app to generate a pre-styled PowerPoint file based on a multitude of input fields, I though the task would be simple enough. I was proven wrong and now return to the comforts of PHP and Java. Then I cringe for this devolution.
My misadventures started when I decided I should start off by searching for the PowerPoint API to ensure all the interfaces I wished were accessible without paying for additional tools or resources. First tip, don’t fucking searching for a combination of C# or PowerPoint through Google or MSDN. You will not find a single useful result. Some would say the search results are only as good as the keywords chosen by the user, but the organization of Microsoft’s knowledge base is so terribly convoluted that it renders the search function useless. How does Microsoft expect to compete with Google using its Live Search when it doesn’t even work well with their own fucking content? MSDN is a clusterfuck of broken links and spiritual dead-ends. Never try to browse their article tree structure. Never try to use the search. Never try.
I was able to gather that I needed to add the Microsoft PowerPoint 11.0 Object Library Primary Interop Assemblies (PIA) reference to my project in Visual Studio, but for the life of me, I couldn’t find a class/method reference for PowerPoint 2003 Interop. A workaround is to perform some Visual Studio trial and error by creating objects of the class Microsoft.Office.Interop.PowerPoint.Presentation and then using the dot operator to allow Visual Studio to give you hints of what methods and properties are available for use. A workmate of mine actually used this whole process to develop an app to extract screen captures and searchable text from each slide and then inserting them into a database, when requested via a web service.
Since I didn’t want to waste all my time developing like that, I decided to perform a more thorough search for the PowerPoint documentation. Lo and behold, I found my beloved under Microsoft Office PowerPoint 2003 VBA Language Reference. Yes, when I think of developing in C#, I immediately think to search for Visual Basic for Applications. MSDN couldn’t even have a single search titled Microsoft Office PowerPoint 2003 C# Language Reference that links to the VB version? You can browse to the language reference using the MSDN path:
MSDN Library » Office Development » Microsoft Office 2003 » Office 2003 » VBA Language Reference » Microsoft PowerPoint Visual Basic Reference
So I download the PowerPoint documentation file to find a ghetto WinZip extractor that installs to “C:\Program Files\Microsoft Office\Office11\1033″. I had to manually open this directory to get access to the Window’s help file it to find its full of JScript errors. However, we have the neutered web reference also available. My favourite part of this resource is visiting the What’s New? subsections to find them mostly empty with the message, “Visit the Office Developer Center on the Microsoft Developer Network Web site for the latest information about programming with Office PowerPoint 2003, including product news, technical articles, downloads, and samples.” Wait, isn’t that the site I’m currently fucking on? I tried to search MSDN for technical articles to find the differences between PowerPoint 2000 and 2003 to get a HTTP 500 error after 5 minutes of waiting.
Have I mentioned that PowerPoint code written for Office 2000 does not work with the 2003 libraries? It seems the Office team decided they didn’t like their original implementation, changing the core interface to make the COM/Interop connections to the PowerPoint Object Library references inconsistent. So say some the your clients have files created in Office 2000 that they want to upload a PowerPoint file to get a the screenshots taken to make them searchable on the web. Then another client has Office 2003 because they’re all fancy schmancy. You need two separate applications written.
In conclusion, help, get me out of here.
Watching documentary Helvetica and short clip Trajan is the Movie Font both bring to light the intents of designers when they attempt to communicate simple pieces of information, while I blankly pass over it all. I think I will now forever be haunted by these typefaces at my every turn. I just browsed to the web site for music artist Bitcrush (who have a new album Epilogue in Waves, coming out in January!), glaringly seeing the obvious usage of Helvetica in the act’s logo. It’s the same aesthetic used in Cadoo’s prior project, Gridlock, and even seems to be the central theme of their record label. Knowing the music has a lush layering of pads and acoustic sounds, with modern glitch cuts, they decided on a thick typeface that expresses it as bold and passionate while firm and solid, so we don’t doubt its statements. It all reminds me to pick up Thinking with Type: A Critical Guide for Designers, Writers, Editors, and Student, especially since I work in web development; mostly back-end, but I’m always reliant on graphic designers to finish the product whereas a higher level of workplace autonomy would be more optimal.
While Helvetica is usually used to promote overlords as comforting friends for consumption, at least some of them have a sense of humour like Amazon and BMW.
… and The Rolling Stone somehow manage to publish a decent article summarizing “How America Lost the War on Drugs”. Maybe the DEA needs to hear David Cross’ comparison to a War on Jealousy?
Yesterday I awoke to find my PC wasn’t really responding to any input. Any attempt to bring up the Windows XP task manager took 5 minutes, so I attempted to close all applications but it reset after being non-responsive for a couple minutes. On reboot, I get the lovely message:
A Disk Read Error Occured. Press CTRL+ALT+DEL to restart
I turned the machine off to let it cool and later opened up the case to clean out any dust and check the SATA cables to ensure they were secured to the hard drive. I just built this computer in February so I was kind of ticked the Seagate 500gb drive was failing after only nine months. On the next boot, XP went through CHKDSK, fixed a few minor errors, and the operating system opened as normal. Immediately, I backed up my documents, bookmarks, and the most important to an external hard drive (also Seagate…):
xcopy e:\music\* f:\ /D /E /F /R /Y
Then today, I find mouse/keyboard input is being delayed randomly and audio is crackling on hard drive activity. So this now seems to be point this to be a Asus P5B motherboard problem, since it has on-board audio. So I moved the USB cables to plugs further from the audio jacks and removed the SATA controller drivers under Control Panel » System » Hardware » Device Manager » IDE ATA/ATAPI controllers and then re-added them by rebooting. For now, the issue seems to be fixed, but I fully expect my system to fail before the year ends. Happy holidays, arsehole!
One common web user interface pattern that grinds my gears is search input box clearing. Examples can be found while browsing Major League Baseball players or using the top-right search functionality of Shacknews. The box displays a message welcoming you to search and when you click it, the box clears so you can enter your terms. The problem is most major sites implement this incorrectly. What happens when you type in one term and want to concatenate some more terms through copy and paste? When I refocus the box, my previous search term should not be cleared! Do it proper, a’ight?
<?php $defaultSearchTerm = 'Enter search term...'; ?> <input type="text" name="searchTerm" value="<?php echo $defaultSearchTerm ?>" onfocus="if(this.value == '<?php echo $defaultSearchTerm ?>') this.value = ''" /> ...
The joy of web development is cross-platform compliance, although at this point I give IE6 the middle finger. IE7 should be fairly simple to make a functional site for, no? During my endeavors of developing a cookbook content managed site (not gay), I came across a curious JavaScript error. A recipe has a list of ingredients, where there is a dropdown select box for defining the names. Some simple DOM-use allows me to dynamically add these dropdowns to the form as to not set a finite limit of ingredients allowed per recipe. Behold:
var ingredientList = document.getElementById('ingredient0'); var ingredientTable = document.getElementById('ingredients'); var row = document.createElement('tr'); var i; for(i = 0; document.getElementById('ingredient' + i) !== null; i++); ... var cellIngredient = document.createElement('td'); var ingredient = document.createElement('select'); ingredient.setAttribute('id', 'ingredient' + i); ingredient.setAttribute('name', 'ingredients'); ingredient.setAttribute('onchange', 'chooseIngredient(this, ' + i + ')'); ingredient.innerHTML = ingredientList.innerHTML; // IE7 says, 'fuck you' cellIngredient.appendChild(ingredient); row.appendChild(cellIngredient); ... ingredientTable.lastChild.appendChild(row);
Does this work in Firefox 2? Flawlessly. IE7? Empty select box. BUG: Internet Explorer Fails to Set the innerHTML Property of the Select Object. Notice the date: May 12, 2003. This bug has existed since Internet Explorer 5. Fix:
var cellIngredient = document.createElement('td'); cellIngredient.innerHTML = '<select id="ingredient' + i + '" name="ingredients" onchange="chooseIngredient(this, ' + i + ')">' + ingredientList.innerHTML + '</select>'; // var ingredient = document.createElement('select'); // ingredient.setAttribute('id', 'ingredient' + i); // ingredient.setAttribute('name', 'ingredients'); // ingredient.setAttribute('onchange', 'chooseIngredient(this, ' + i + ')'); // ingredient.innerHTML = ingredientList.innerHTML; // cellIngredient.appendChild(ingredient);
In summary, I am adding to the evidence of everything you already know.
Click the below image to follow along with this exercise in comedy (Lightbox 2 is hotness, yeah?)
By the way, this guy is competition to my employer. Well, according to geography, anyway.
Lately, I ran into two mentally challenged issues when it came using JavaScript in IE6.
<script type="text/javascript" src="editEvent.js"/>
<script type="text/javascript" src="editEvent.js"></script>
Microsoft’s Windows Live Messenger has become a necessary evil for online communication over the past few years, although Europe and the US seem to be holding on to AIM/ICQ as long as they can. The problem in MSN (Live is a stupid branding scheme; your Xbox gaming is no way related to my PC IM or web searching) is that it pushes advertisements on all users. The app also manages to bypass the Windows HOSTS file (c:\windows\system32\drivers\etc\hosts) so you can’t redirect requests to their ad server to localhost in order to disable the ads. On the screen it also throws many buttons and options that power users will never touch.
Now as an alternative, these powers users tend to pursue third party applications compatible with the protocol, such as Trillian, Pidgin (formerly Gaim), and Miranda IM, which allow more customization. But let’s face it, they’re all ugly and bloated to some extent. Luckily, there’s A-Patch, which modifies Microsoft’s executable to scrap away the excess user interface fat. Pretty much anything shown on the screen can be hidden. I now have my contact list and messaging window stripped down to only 4 or 5 widgets; basically the bare essentials. No web cam, voice chat, advertisements, Windows Live search, Microsoft My Spaces (a little late in the social networking game, huh?), or any of the fluff that makes computing any more cumbersome than it already is. You can also install a Winamp plug-in for updating the song currently playing to your MSN personal message, similar to Windows Media Player’s functionality. Personally, I don’t use that feature because I think Last.FM is bad enough for advertising the shite music I consume.
I have moved servers so maybe my blog’s uptime will at least reach 50%. Yesterday, when confronted with the task of migrating from Despayre, I thought the steps would be simple enough. I installed WordPress 2.1.2 on Alcopop and also upgraded Despayre to the same version. A new feature of the blogging software is an import/export feature, using XML as the intermediate format. This would be a useful feature, if it actually worked. Exporting was fine, a 1.8 megabyte file was downloaded. When I attempted to import to Alcopop, I received a memory allocation error message. After a few Google searches, the solution I tried was to add “php_value memory_limit 20M” to ~/public_html/.htaccess. The next upload attempt went further, to a point where I instead got a blank page! Folder ~/public_html/wp-content/uploads shows my uploaded XML file with the proper file size, however the WordPress import module refused to parse it. So I said fuck that noise, let’s try a direct SQL migration. I created a ~/mysql/ directory and tried:
mysqldump –user=afterglow -password=etc –tab=~/mysql/ –opt afterglow
This resulted in an error about locked tables. I messaged arioch to either reboot Apache or ensure I had full permissions to unlock tables. Today, I tried again, with error message: “mysqldump: Got error: 1045: Access denied for user ‘afterglow’@'localhost’ (using password: YES) when executing ‘SELECT INTO OUTFILE’”. I tried different directories. Same error. I tried another backup method outlined in the MySQL 5.0 docs:
mysqlhotcopy afterglow ~/mysql/
Error message: “Cannot open dir ‘/var/lib/mysql/afterglow’: Permission denied at /usr/bin/mysqlhotcopy line 295″. Ok. So maybe a direct copying of the database files was necessary. On both Despayre and Alcopop, I tried:
find / -name “*.myd” 2>dev/null
Also searching for *.myd and *.frm only resulted in showing the base permission and configuration tables used by MySQL. Finally I found a solution:
mysqldump –user=afterglow –password=etc –opt afterglow > wp.sql
So I transferred that file to Alcopop, ran:
mysql –user=afterglow –password=etc –database=afterglow < wp.sql
That successfully went through… or didn’t. http://afterglow.alcopop.org was now blank, and visiting http://afterglow.alcopop.org/wp-admin instead redirected to http://afterglow.despayre.org/wp-admin. WP-Admin->Options->WordPress address (URL) and Blog address (URL) must be set to the domain, so in MySQL I edited the wp_options table where option_value = ‘http://afterglow.despayre.org’, setting it to this domain.
With the front page blank, I went into WP-Admin->Presentation but it didn’t show any themes, even though ~/public_html/wp-content/themes/ had a directory containing a theme. I uploaded the Almost Spring theme, then both themes finally displayed in the admin screen. Now everything was fully migrated.
I decided to just go with one admin login rather than the additional user I used to post on Despayre, so I attempted to delete the extra user and assign all the posts and comments to the admin. Error time! “You have specified these users for deletion: ID #2: Afterglow The current user will not be deleted. There are no valid users selected for deletion”. So the hundreds of posts made by that user must also not be valid. I’ve just said fuck it and I’m going with the two logins.
All that work for a bunch of banal posts, including this one. Rock on. I will be posting my top albums of 2006 list sometime within the next month. So that’s something to look forward to, I guess?
GlitchInTheMatrix.java
1 2 3 4 5 6 7 8 9 10 | import java.util.GregorianCalendar; public class GlitchInTheMatrix { public static void main(String[] args) { GregorianCalendar date = new GregorianCalendar(2007, GregorianCalendar.DECEMBER, 31); System.out.println("" + date.get(GregorianCalendar.WEEK_OF_YEAR)); } } |
The output? 1. Yes, it’s the first week of the year in December. Can I call the bug, “Titorus Pullo”?
So I wrote a wrapper class on top.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import java.util.GregorianCalendar; public class NonRetardedJavaCalendar extends GregorianCalendar { public NonRetardedJavaCalendar(int year, int month, int day) { super(year, month, day); } public int getWeek() { int week = get(Calendar.WEEK_OF_YEAR); if(getMonth() == DECEMBER && week == 1) week = 53; return week; } } |
© Copyright Derek MacDonald. All rights reserved.
Designed by FTL Wordpress Themes brought to you by Smashing Magazine