Archive for the ‘Programming’ Category

The Robots.txt Builder - a new tool

So Dave was at the Robots.txt Summit at SES New York 2007 and it reminded him of a time when a client of his had got himself deindexed by accidentally denying all robots when trying to stop them getting at his RSS Feed! When he got back he got me to do a tool to prevent this stuff from happening in the future, so without further ado DaveN is proud to announce:

The Robots.txt Builder Tool

All comments, suggestions and bug reports (especially bug reports) are more than welcome. I’d be lying if I said we’d extensively tested this but we’ve given it a fair old runaround in IE and FF and we think it’s pretty solid.

It’s aimed at the lower-end of the userbase. We figured that most people who want to do more advanced or fine-grained robots.txt tuning will probably be able to figure out how to do it themselves, we’re really aiming for the “Mom ‘n’ Pop” market with this one. Let’s hope we don’t have any more incidents like the opening anecdote!

Features:

  • Block search engines by type (more types welcome!)
  • Supports allowing robots by the standards-defined “Disallow: ” directive
  • Warning when you block your entire site
  • Site structure import. This lets you import your site structure from Yahoo Site Explorer.
  • Easy-to-use point ‘n’ click interface (I hope)
  • More JavaScript than you can shake a stick at

Yahoo! Logo Big love out to Yahoo! for their excellent Site Explorer and TreeView YUI widget. You rock, guys.

Enjoy!

PS. Anyone who’s interested, check out the number of CSS and JS includes in the <head>. Oh my god!

Ubuntu Fiesty Fawn released

Everyone at DaveN Industries would like to congratulate the Ubuntu team on the successful launch of their new Fiesty Fawn release. The Ubuntu download can be found in the usual place.

Ubuntu Linux has always been a shining light amongst Linux distributions. One of our developers uses it full-time on his desktop and we have many linux servers running Ubuntu. Well.. our main servers run Debian but when we want more cutting-edge software we use Ubuntu. Adding software is so easy as well - just run a single command and everything is handled for you - and you thought installing software on Windows was easy. Soon it will get easier as well with Linspire’s CNR technology (Click ‘n’ Run).

We think Ubuntu is so great at Linux web hosting, we’re planning on releasing a dedicated server control panel for Ubuntu root-access servers. We really think Linux hosting is the future but we know that running your own linux machines is a big pain.

We want to fix that.

(Without becoming cPanel)

Stay tuned!

This post written in Vim. Proudly.

Why JavaScript is my favourite language

I tell everyone, JavaScript is my all-time favourite programming language and they look at me as if I have some terminal illness.

“No!” I tell them, honestly! Well, not really. ECMAScript is my favourite language, which is the reference language syntax for JavaScript (Mozilla) and JScript (Microshit).

You see, the big problem with JS that web developers run in to is not that JavaScript sucks, but the implementation sucks. As a language, ECMAScript is bloody awesome. Specifically, Microsoft’s implementation is fucking awful but Mozilla is not without it’s problems. Macrodobe’s is very good (Flash) and there are a couple of others that are alright.

So why do I like JavaScript so much? you ask - well, look at this snippet. I’m building a table from a dataset (in one statement!):

[javascript]table = Builder.node(”table”, {”class”:”kd_information”}, [
Builder.node(”caption”, “Text information”),
Builder.node(”tbody”, [
Builder.node(”tr”, [
Builder.node(”th”, “Title:”),
Builder.node(”td”, data.title)
]),
Builder.node(”tr”, [
Builder.node(”th”, “There was lots more boring stuff here that I have snipped:”),
Builder.node(”td”, data.tagdata.headings)
]),
Builder.node(”tr”, [
Builder.node(”th”, “Linked external domains:”),
Builder.node(”td”, [
Builder.node(”ul”, function() {
l = []
data.extdomains.each(function(domain) {
if (domain)
l.push(Builder.node(”li”, [
Builder.node(”a”, {”href”:”http://”+domain+”/”}, domain)
]))
})
return l
}()) // Look at that little beauty
])
])
])
])[/javascript]

You’re looking at lines 15-24. I needed to make a ul/li list from a list in memory. But oh no, I’m in a statement, what do I do! Finish up, find the UL node then iterate my list appending LIs to it? FUCK THAT! Define an inline function that returns the list and immediately call it :-D Bloody awesome.

Update:

Here’s another little example for you. Lines 10-15:

[javascript]new Ajax.Request(”/clickability.py/get_prmap”, {
method:”post”,
postBody:”uniqid=”+escape(GWTBL.uniqid),
onSuccess: function(t) {
data = eval(’('+t.responseText+’)')
data.each(function(info) {
width = 400
lw = Math.round(width * info.fraction)
rw = width - lw
tbody.appendChild(Builder.node(”tr”, [
Builder.node(”td”, function(pr) {
if (pr == null) return “Not checked”
if (pr == -1) return “Not available”
return “PR “+pr
}(info.pagerank)), // Catch that funky syntax, wide-boi
Builder.node(”td”, “Some more boring stuff”)
]))
})
}
})[/javascript]

-Rob

How to migrate Firefox from XP to Vista

So Dave (for better or worse) decided to try out the shiny new Vista discs we received the other day on his computer at work. As a Microsoft ActionPack subscriber we get all the cool new gear periodically in the post. Dave re-installs his computer quite frequently, so we’re well trained in the art of migration, however Vista threw us a curveball or two. One of the was transferring Firefox.

Usually you just copy the Profiles directory from ~/Application Data/Mozilla/Firefox, but that didn’t seem to cut it with Vista. We managed to work around it though, so here’s what we did:

Disclaimer: This isn’t what’s recommended by Mozilla, it’s just what worked for us. YMMV.

  • Install Firefox on Vista, launch it once, then close it. Make sure Firefox on XP is closed also
  • XP: Back up C:\Documents and Settings\<username>\Application Data\Mozilla\Firefox\Profiles. It should contain only one folder, which has a garbage name.
  • Vista Navigate to C:\Users\<username>\AppData\Local\Mozilla\Firefox\Profiles and then enter the only folder in there, which should have a name similar to the one inside Profiles that you backed up earlier.
  • Go into the weird folder inside your backup, hit ctrl+A (select all), then ctrl+C (copy)
  • Go inside the weird folder on Vista and paste (ctrl+V) all the stuff over the top. As you can see we are just migrating the contents of the weird folders from the backup to the new installation.
  • On Vista, go up 4 levels until you get to C:\Users\<username>\AppData. Now go in to the “Roaming” folder, then Mozilla, Firefox, Profiles to get to C:\Users\<username>\AppData\Roaming\Mozilla\Firefox\Profiles.
  • Perform the same operation to copy the contents of the weird folder in your backup into the weird folder on Vista

Now all you have to do is start Firefox and pray.

I’m not sure if this method isn’t overkill - I suspect you can skip copying stuff in to the Local\Mozilla\Firefox\Profiles directory and just deal with the Roaming.

If anyone has any more information or experience on this I would be happy to update this post!

PHP5 on 1AND1 HOSTING

If you are using PHP 5 scripts on a 1AND1 hosting package, they willl be updating the current PHP version to cover a few security holes and you may have to update your PHP code accordingly to avoid any issues.

This only for those using PHP 5.

so on 7th and 08th December, their current version 5.1.6 will be updated to 5.2.0 on all 1and1 servers.

so can get details of the changes in deployment here http://www.php.net/UPDATE_5_2.txt

DaveN

Recent Posts
Recent Comments
Tags