tech

Tesco and Amazon mp3 download services

Not sure how long these have been around, but Tesco and Amazon now both have mp3 download services.

Tesco's site is abysmal. So slow as to be unusable, particularly when you're doing a search; has a wierd tilting album cover browser; and an over-reliance on Javascript for what should be simple links (note to web developers: if you're fetching a new page of results, use a frigging link, not Javascript). 77p per track is too much (compare with eMusic's 16p per track, albeit for stuff most people don't want to buy). All in all, a disaster.

Amazon's is far, far better. But the issue here is the price: it's still TOO EXPENSIVE (unless you're buying really common chart stuff, when it might be cheaper). For most things, it's 79p per track. It doesn't take a genius to work out that if I can buy The Early Years by Roxy Music for £6.98 on CD, or download it as mp3s FOR THE SAME PRICE, I'm going to buy the CD and wait two days for it to arrive. I'd rather have the physical object, thanks very much. How complicated is it to work this out? If the mp3s were around £3, I'd have bought them: immediacy + lower price - transience of medium > possession of the physical object - higher price - 2 days waiting.

Of course, the temptation is always there to skulk around bittorrent sites looking for it. Bear in mind I already own all the tracks on that CD, across all the early Roxy Music albums. I resent having to pay at all: I've already paid once. Don't get me started.

Remember this?

gopher://gopher.floodgap.com/1/new (your browser, if it's not Firefox, might not know what to do with this)

I was there.

Started using Twitter

I started using Twitter last week. Mainly peer pressure, but also as an experiment. Call me a member of "the early majority".

That's not the point of this blog entry though. Here's the point. Coming right up.

I use Google Reader, which is good; but it can't read Twitter feeds, as they require authentication. So I used FreeMyFeed, to which you give your Twitter username, password and friend feed URI. In return it creates an alternative, non-authenticated feed with the content of your original feed. Which you can get at with Google Reader.

There's the point. FreeMyFeed: useful.

Wiisic - mp3 server with Wii UI

I got a Wii for my birthday a couple of months back. It's great: I love Zelda, got tennis elbow playing Wii Sports, and like playing Super Monkey Ball (Banana Blitz) with Nicola and Madeleine.

Tonight I have also been playing with the video playing stuff: copying videos off the camera onto another SD card, then browsing it using the Photo Channel. Nicola and I enjoyed watching videos of Joel and Madeleine (on the trampoline) on the big screen with the Wii's frankly marvellous interface. So far, I've discovered the Wii is OK with .avi files but not .mp4s or .mpgs.

I also bought the internet channel (basically Opera browser) for it. This means that sometimes you can watch stuff on the BBC iPlayer (but it's generally unwatchable due to long pauses on my internet connection), and YouTube works OK. Also discovered YouTube now has a specialised Wii interface, which is much nicer (though buggy).

But no Last.fm. I use Last.fm a lot, and it now has so much data about the music I like, I frequently use it as a personal radio station. So a bit of a blow it doesn't work on the Wii.

Instead, I went in search of a way to browse from my Wii to some kind of mp3 server on my laptop, so I can play my mp3 collection from my Wii. (Ideally, I'd have my mp3s out on the net somewhere, with a web app to play them, but maybe one day.) In the meantime, I discovered Wiisic, a little Java application to play mp3s out of folder on your computer and stream them over HTTP, to a Flash client in the Wii browser.

To get it working, I downloaded the jar, then did:

sudo java -jar wiisic.jar

A little GUI pops up so you configure a couple of options. I found that I had to run it as root on Linux so it could run on port 80: the Wii didn't seem to like port 9999. And had to turn off Apache as a consequence. The GUI also shows you the address you need to browse to on your Wii to get to the Wiisic server (10.0.5.3 in my case). So I fired up Opera, browsed there, and got the simple but functional Flash interface and started playing my mp3s, served off my laptop. Neat.

Here's what it looks like (on my paltry TV). I christened it with the epic The Anal Staircase by Coil.

Ideally, I'd like to see this as a PHP app. (perhaps) using S3 as its backend. Should be possible...

Most promising open source CMS

I was a judge this year on Packt Publishing's Most Promising Open Source CMS award: the results have just been announced. The winner was SilverStripe.

I was personally impressed by the slickness of the interface, and by the fact that it has been designed to scale well to large websites. The developers have obviously thought carefully about the architecture, and are aiming for the "CMS plus web platform" approach of Drupal. I was also personally impressed by the responsiveness of the development team, their willingness to work in the community, and the clarity of their vision for the product. Worthy winners. Give it a look.

Microsoft .NET for Programmers

I've finally found a decent .NET book which suits the way I want to learn it: Microsoft .NET for Programmers by Fergal Grimes. Unlike most other .NET books I've looked at, it has the following plus points:

  • The coding is explained using code, rather than screenshots from Visual Studio.
  • The examples build around a simple core application (a poker game), demonstrating different aspects of .NET such as database access, validation, web services, email, XML, web forms, web sessions, Windows forms, and building up through short tutorials.
  • The code examples are succinct and pragmatic, but contain enough detail to be useful. (One book I've looked at about coding ASP.NET shows how to build a web application using two stage views with XSLT transforms, which has seemed a bad idea to me for several years - impractical, hard work, and not how I want to learn how to program .NET.)
  • It does explain .NET in a way that makes sense to programmers, rather than trying to teach programming at the same time as teaching .NET: coverage of constructors, destructors, data structures, packaging, configuration, reflection (though the large section about writing a compiler seemed slightly dense and unnecessary). There's also some good coverage of how to debug and trace applications, obviously written by someone who's done a lot of it.
  • It's got a big appendix explaining C# language constructs which is a useful reference.

So even though it's not an ASP.NET book, there's enough about ASP.NET to get you started with decent coverage of the main elements you need to know about, and enough pointers to go further. Good for me, anyway.

Using MySQL with ASP.Net, under Mono on Linux

Right, I decided there's not much point writing more about ASP.Net pages until I can show you how to do something useful with them. So I'm going to dive straight in and install the MySQL connector for ASP.Net, so we can do a bit of database-driven page stuff.

Setting up a MySQL database

First, you'll need MySQL. I'm not going to tell you how to install that (depends on your Linux), but hopefully it could be as easy as it was for me on Ubuntu:

sudo apt-get install mysql-server mysql-client

How you create your database and users is up to you. I like MySQL Query Browser and phpMyAdmin. The latter needs PHP and a web server; but MySQL Query Browser is a standalone desktop application. If you want to do this in a tutorial style via the command line, you can run these once you've installed the MySQL server and client packages:

$ mysql -uroot -p
...

mysql> CREATE DATABASE cdcat;
Query OK, 1 row affected (0.10 sec)

mysql> USE cdcat;
Database changed

mysql> CREATE TABLE artist ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) );
Query OK, 0 rows affected (0.09 sec)

mysql> INSERT INTO artist VALUES(null, 'Wire');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO artist VALUES(null, 'The Fall');
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM artist;
+----+----------+
| id | name     |
+----+----------+
|  1 | Wire     |
|  2 | The Fall |
+----+----------+
2 rows in set (0.00 sec)

mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON cdcat.* TO cdcat@localhost IDENTIFIED BY 'hardpassword';
Query OK, 0 rows affected (0.12 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.13 sec)

What we've done here is setup the first table in a CD catalogue database, namely:

  • Created a new database called cdcat
  • Created a table called artist in that database
  • Put two artists into the table
  • Created a user called cdcat with SELECT, UPDATE, DELETE and INSERT privileges on all tables in the cdcat database
  • Made those privileges active

Installing Connector/Net

Now you've got a MySQL database server, database, table and user set up, you'll need the MySQL connector for ASP.Net. You need to download Connector/Net from the MySQL website. The one you need is Windows Binaries, no installer (ZIP).

Once the zip file is downloaded, create a directory somewhere and unzip its contents into it. The file you're after is in the resulting bin directory, MySQL.Data.dll. To install it, use the gacutil tool included in the Mono installer, which puts it into the right place in your Mono library directory:

gacutil -i /path/to/unzipped/connector/bin/MySQL.Data.dll

If gacutil isn't on your path you'll need to reference it correctly using its full path.

Creating a simple page to show data from a table

To prove you've got everything installed correctly, we'll create a page to display the contents of the artist table using one of the standard ASP.Net controls. Like I've said before, this isn't going to be a full ASP.Net tutorial, so I'm not going to try to explain Web Forms and all that jazz: I'm just giving a few examples to help you get the pieces working nicely together. See one of the countless ASP.Net books for more detail. (By the way, if anyone can recommend a half-decent tutorial book for ASP.Net, please let me know, as the ones I've looked at are generally good reference works, but lousy tutorials.) I'll try to put more tutorial material in as I learn more about ASP.Net.

First, create a file called artists.aspx inside your project folder.

Next, put this code into the file and save it:

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="MySql.Data.MySqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>CD cat</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script runat="server">
    private void Page_Load(Object sender, EventArgs e)
    {
       string connectionString = "Server=localhost;Database=cdcat;User ID=cdcat;Password=hardpassword;Pooling=false;";
       MySqlConnection dbcon = new MySqlConnection(connectionString);
       dbcon.Open();

       MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM artist", dbcon);
       DataSet ds = new DataSet();
       adapter.Fill(ds, "result");

       dbcon.Close();
       dbcon = null;

       ArtistsControl.DataSource = ds.Tables["result"];
       ArtistsControl.DataBind();
    }
    </script>

  </head>

  <body>
    <h1>Artists</h1>
    <asp:DataGrid runat="server" id="ArtistsControl" />
  </body>

</html>

Finally, you need a web.config file, again in the project root directory. This contains application settings, such as which libraries your application needs. It should contain the following to enable the MySQL libraries to be loaded:

<configuration>
  <system.web>
    <compilation>
      <assemblies>
        <add assembly="MySql.Data"/>
      </assemblies>
    </compilation>
  </system.web>
</configuration>

Now run your application again with xsp2 from inside the project directory and browse to http://localhost:8080/artists.aspx. You should see this:

I didn't get to code-behind pages this time. Maybe next time.

Getting ASP.Net (C#) running on Linux, using Mono and xsp2

I'm going to keep this brief, but hopefully explain how to get ASP.Net to work on a Linux machine. Your best choice here is to use Mono, which implements most of the important bits of ASP.Net (in fact, probably all of them, but don't quote me). So for starters, here's how to get a simple ASP.Net page up and running under Linux. (Note that I didn't enjoy the MonoDevelop experience much, and didn't find a decent C# plugin for Eclipse, so I'll be writing code direct for now.)

First off, you're going to need Mono itself. The download site is at http://www.go-mono.com/mono-downloads/download.html. However, there aren't any official package for Ubuntu there, so I tried http://www.mono-project.com/Other_Downloads instead. If you can find a package for your distribution, that may well work.

I struggled to compile the source for Ubuntu and couldn't get the debs to work (I've got an old version of Ubuntu), before I noticed there's a cross-platform Linux installer which worked fine for me. However, Michael Hutchinson mentioned in a comment below that this isn't such a good idea; his blog entry links to another set of installation instructions I didn't manage to find on the Mono site, which look promising. I'll try those next time.

Here's the link in case you want to try it:

http://ftp.novell.com/pub/mono/archive/1.9.1/linux-installer/2/mono-1.9.1_2-installer.bin

From a terminal, make it executable and run it:

chmod +x mono-1.9.1_2-installer.bin
./mono-1.9.1_2-installer.bin

This starts up the graphical installer. Follow the prompts to get it on your system. I recommend putting it into a directory out of the way of the standard Linux directory structure: I installed it into a directory within my home directory.

Next, create a directory for your project and put a basic ASP.Net page into that directory, so you can test that the Mono compiler's working properly. Create a file called index.aspx with this content:

<%@ Page Language="C#" %>
<html>
<head>
<script runat="server">
private void Submit(Object sender, EventArgs e) {
  button1.Text = "You clicked me!";
}
</script>
</head>
<body>

<h1>ASP.Net on Mono</h1>
<form runat="server">
<asp:Button id="button1" Text="Click me!" runat="server" OnClick="Submit"/>
</form>

</body>
</html>

I took this from the W3Schools tutorial on ASP.Net and modified it for C#.

To run your page, get a command line up and connect to your project's directory. Then run the embedded server xsp2 (bundled in the Mono installer), to start your application in its own web server:

xsp2 --port 9192

To see your site running, visit http://localhost:9192/ in a web browser. You should see a clickable button whose text changes when you click it.

That's enough for one night. Next time, where to put your code-behind pages, and perhaps how to get MySQL working with Mono.

Yeah, I've been learning ASP.Net (C#)

You wanna fight about it?

I might even write a blog entry about it. Try to stop me.

Story understanding: an approach whose time has come?

During my Ph.D. research, the AI community was pretty much obsessed with neural networks, genetic algorithms, and other biologically-inspired, emergent approaches to intelligence. I, on the other hand, was pretty much at the opposite end of the spectrum: I was (and am) interested in that awkward place where psychology and AI meet, cognitive science; and in approaches to AI which concentrate at the symbolic level. I've written previously about how I view the differences between the low-level approaches and the high-level symbolic approaches: for me, a symbolic approach helped me explain what was going on during understanding, as I could more easily form a "narrative" of how the understanding was reached. The same could be done using those low-level approaches, but without the abstraction, I think it would be pretty complex.

Anyway, I was therefore pleased to see an inkling that maybe story understanding as a discipline is finding applications in interface design. Specifically, that there is a conference workshop dedicated to it happening next year: Common Sense and Intelligent User Interfaces 2009: Story Understanding and Generation for Context-Aware Interface Design.

Perhaps I should submit a paper? After all, the work I was doing on coherence of inference during language understanding has an application here. For example, a user keeps searching Google for "holiday Devon", and clicking through to websites about cottages for rent, B & Bs, hotels, tourist destinations in the area. You might want to design a butler application which sits in their browser, watches the interface and their searches, and tries to help them find what they're after.

One way to help would be to infer what they might be trying to do, based on what they've done already: for example, a valid inference might be that they're trying to book a holiday in Devon; from that, you could infer that they might want to hire a car, might be looking for a flight (depending on where they live), they might want to know about good restaurants in the area, buy travel accessories, etc.. At the same time, there are potentially a lot of valid but less useful inferences: they want a holiday (not just in Devon), they are a travel agent who lives in Devon, they know someone on holiday in Devon, etc.. Inferences which are probably logically valid (depending on the knowledge base), but to a human, potentially wasteful or even unwarranted. How does a system know when to stop making inferences and how to prioritise them? That was basically what I was trying to address in my thesis. I'm just happy to see these kinds of issues surfacing as more AI creeps into applications.

Syndicate content