drupal 6

Some Scala Long, Date, and SimpleDateFormat examples

At some point I’ll get all of my Scala “date utilities” together in a single class (object, actually), but until then, here are a couple of date utility methods I wrote for my Scrupal6 project (a replacement for Drupal 6):

A Scala method to create an MD5 hash of a string

If you happen to need Scala method to perform an MD5 hash on a string, here you go:

def md5HashString(s: String): String = {
    import java.security.MessageDigest
    import java.math.BigInteger
    val md = MessageDigest.getInstance("MD5")
    val digest = md.digest(s.getBytes)
    val bigInt = new BigInteger(1,digest)
    val hashedString = bigInt.toString(16)
    hashedString
}

From Drupal 6 to the Play Framework

As I wrote last week, I got tired of dealing with Drupal 6 (D6) security update issues — especially since D6 is no longer officially supported and the last unofficial D6 security update made my websites unusable — so I wrote a Play Framework (Scala) application to display my D6 database tables data.

It’s still a work in progress, but as you can see from this page on my One Man’s Alaska website, it’s coming along. As far as visitors of the website are concerned, mostly only thing the website needs is some CSS styling and maybe a search field. (I could also add support for comments and a contact page, but my D6 websites are old, and I don’t need/want those things. I probably also won’t put any effort into supporting 10-20 custom “category” URIs I used back in the day.)

As for the specific page I linked to on the One Man’s Alaska website, that’s a favorite memory of getting ready to winterize the car in October, 2010, when I lived in the Wasilla/Palmer area.

A Drupal 8 XML Sitemap generating PHP script

I’m not going to comment on the following code too much or provide support for it, but (a) if you need to create an XML Sitemap for a Drupal 8 website, and (b) you don’t like the Drupal 8 sitemap modules that are available, then (c) this PHP script can serve as a starting point for you.

A way to migrate Drupal 6 Photo content type to Drupal 8

The main script in this project — MigrateAllD6Photos.php — now seems to be working. The code is ugly and doesn't check for SQL errors, but for my purposes it seems to be working okay. To get that script to work and migrate your Drupal 6 photo content type to a Drupal 8 photo content type, you also need to run a couple of queries shown here.