October 06th, 2010
Fixing Spotify uxtheme.dll error on Windows 2000
Topics: Windows, HowtoSpotify's recent update broke it for use on Windows 2000, it causes this error:
Cannot find 'UxTheme.dll'. Please, re-install this application
Anyway I've figured out a solution, no guarantees but this works for me. I've cross-compiled the Wine implementation of the DLL for Windows. (I followed the instructions here.)
Long story short download this zip and extract it into c:\winnt\system32 .
Hope that helps. Cheers, Dave.
Edit: Great this seems to be working for other people too.
Edit 2: The latest version (0.4.10) of Spotify has broken Windows 2000 support again. This time the client disappears immediately on launch with no errors or messages. Luckily though the Spotify team have figured out the problem and are fixing it in the next version, here's the message Magnus left on the support forum:

Edit 3: There's a preview version avaliable that fixes the new problem.
October 01th, 2010
The Good JuJu List Machine
Topics: Php, Project, NewsI have just released the first version of The Good JuJu List Machine. This is a viral list building application that's similar to Frank Kern's Good Karma List Machine.
If your not familiar with the idea basically it's a tool to help increase opt-ins to your mailing list virally. It offers free content as bait to get people to subscribe to your mailing list. Then when the subscriber confirms their email address they receive their prize and are also encouraged to share the link with their friends to receive even more free content.
I have listened to the people on the warrior forums and have implemented mostly everything that's been asked for, I know there where sticking points with a lot of the alternatives.
Features
- Wordpress plugin, written for version 3.0.1
- Supports any list provider like Aweber that can forward confirmed opt-ins to a "thank you" page
- Doesn't require password or anything else that could confuse or annoy potential subscribers.
- Free + opensource, I've coded it from scratch and released under the GPL.
- Completely customisable HTML for each page.
- Link reminder feature helps keep everyone happy.
Opt-in Process
The script works slightly differently to the alternatives, I've re-designed the process to reduce confusion and annoyance. First off I removed passwords, replacing them with a "private page link". I did this because we're trying to increase opt-ins not protect access to the bait content. Second I've re-structured things to allow integration with pretty much any list provider.
Download
Demo / Screenshots
I developed the script on a new website I'm working on, the site isn't finished but you can give the JuJu list machine a test. Just opt-in at the top right and you will see how it all works. Also here's a quick screenshot , I'll add some more later.
Setup Instructions
Setting this thing up is easy:
- Firstly download the script and extract the archive into your wp-content/plugins/ directory.
- Now load your Wordpress admin, click 'Plugins' and then click 'Activate' below the 'Good JuJu List Machine' plugin.
- Now click 'Good JuJu List Machine' under the Plguins menu on the left hand side.
- OK, now follow the instructions on the JuJu page. (There's not much to do, just customise the templates, set 3 preferences and configure your email list.
Template codes
There are a few codes you can use in your templates to help insert the dynamic elements:
- %private-link% - The user's private page link.
- %referal-link% - The user's referral link.
- %referals-sofar% - How many referrals the user has racked up so far
- %basic-link% - Link to the free content.
- %extra-link% - Link to the extra free content given for the referrals.
- %email% - The user's email address.
- %content-links% - The links to the content, it includes either the basic links or extra links depending on their referals.
- %lost-link% - A link to the "I've lost my link" page.
- %outside-link% - A link to the front page of the script.
- %referals-needed% - The number of referrals needed for the extra bonus content.
Cheers, Dave
Edit: This didn't go down too well, the warrior forum guys just deleted my post and no one even tried it. The code isn't too nice, it was a very quick initial version I wanted to get out there to get feedback. It's not bad but it's got plenty of room for improvement, who knows maybe it will take off sometime. It definitely taught me that I don't want to work with the warrior forum crowd anyway.
October 01th, 2010
Web.py checkboxes
Topics: Web.py, Python, Howto, CodeCheckboxes are a bit tricky with web.py, here's how to get them working:
import web
from web import form
example_form = form.Form(
form.Checkbox("lovelycheckbox", description="lovelycheckbox", class_="standard", value="something.. Anything!"),
form.Button("Update checkbox", type="submit", description="Send"),
)
class grabresults:
def GET(self):
f = example_form()
return f.render()
def POST(self):
f = example_form()
theresult = f['lovelycheckbox'].checked
OK, so that's a dumb (and untested) example, but it gives you an idea. The 'theresult' variable is going to be true or false depending on if the 'thelovelycheckbox' was ticked or not.
Things to note:
- The checkbox has to be given a value, it's a bug with web.py.
- To get the result you use .checked instead of the normal .value
Cheers, Dave.
April 18th, 2010
How to setup a simple Compojure project
Topics: Compojure, Clojure, Howto, CodeIf you read my last Compojure post you will soon discover (like me) that you need to put in a little bit more work to get a practical setup. Thanks goes to arbscht in #compojure for showing me all of this.
So first up you need to create a new Leiningen project. Luckily there's an in-built command to help.
lein new example cd example
Now you should be able to see the skeleton of your new project. Next you need to setup the project.clj file, it's used to set the name and dependencies for the project.
You will need to add a description, adjust the version and add the required dependencies for a Compojure based website. Here's what an example:
(defproject example "0.0.1" :description "Test website to learn Compojure" :dependencies [[org.clojure/clojure "1.1.0"] [org.clojure/clojure-contrib "1.1.0"] [compojure "0.4.0-SNAPSHOT"] [hiccup "0.2.3"] [ring/ring-jetty-adapter "0.2.0"] [leiningen/lein-swank "1.2.0-SNAPSHOT"]])
Now inside ./src/example/ we need to create a server.clj we can use to setup the webserver, here's mine:
(ns example.server
(:use compojure.core
ring.adapter.jetty))
(defroutes main-routes
(GET "/" []
"<h1>Hello World</h1>")
(GET "/test/:name" req
(test-page (:name (:params req))))
(ANY "*" []
{:status 404, :body "<h1>Page not found</h1>"}))
(defn start []
(run-jetty #'main-routes {:port 8080 :join? false}))
(defn test-page [name]
(str "<b>Hello" name "</b>"))
Three interesting things to note with that example:
- The call to run-jetty has been put inside a function. That way when the file is included the server doesn't automatically start. Inconvenient but it lets us :reload the file as much as we need.
- run-jetty is passed #'main-routes instead of just main-routes, that is useful so that any changes to our routes are put in effect as soon as the (defroutes main-routes ...) s-exp is re-evaled.
- The page /test/* is going to display "Hello *" as an example of how to capture "parameters" from the user. Try just passing req instead of (:name (:params req)) to see what else is available to you.
Now we are ready to give this a go, make sure you're in the root of your project and type
lein deps lein swank
To start a Clojure process for your project that also runs a Swank server. Then you just need to open Emacs and do the following:
M-x slime-connect ret ret (use 'example.server) (example.server/start)
Now browse to http://localhost:8080 and you should see a hello world page. Browse to http://localhost:8080/test/Dave and it should say "Hello Dave". Finally change your server.clj to say "Hello new world" and re-eval the (defroutes ...). The change should take effect as soon as you refresh your browser!
Cheers, Dave.
April 15th, 2010
An idea for a better webmail
Topics: Thoughts, IdeaCurrently webmail is broken, Squirrelmail looks old and dated, Roundcube got me hacked and Gmail isn't opensource and on my server.
So here's how to fix it, write a restful JSON API to perform all the functions like connecting, listing messages, sending emails etc. that works in the same way as CouchDB.
Next make a PHP theme to use this new API to create a Squirrelmail clone, another one for use from mobile devices and a third snazzy theme using just HTML and Javascript for desktop use.
The API could be written in anything but I suggest PHP just for practical deployment everywhere that Squirrelmail worked.
I would call it Davemail and lay it out something like this:
davemail/api/* - for all the actual requests to access imap davemail/themes/* - for the different themes, one per directory that can be easily indexed dynamically so people can just chuck new themes inside and use them without any configuration davemail/config/ - Everything inside the config directory would get read by davemail for all the configuration details. That way it could just be a symlink to /etc/davemail/ or wherever. The files would set which imap server to use, login details, email domains accepted etc
Once Davemail takes off the API can be re-written in whatever language or with whatever optimization tricks that we might want in the future and all the themes will still work.
The first step is writing the API, I think we should start with the Squirrelmail IMAP includes and modify them to return the JSON expected.