- Blog -

(A cheesy homepage for Justin Collins)
Sqwee and Unicode

As someone quite correctly pointed out, Sqwee wasn’t supporting Unicode very well. In fact, not really at all. You could put it in, but then things got weird. You might not think this would affect me much (I am generally a pretty ASCII kind of guy), but what happens when I want to do a little mathematical notation? Perhaps I need to write down {x, y} ∪ {z, y} for some reason. That would make Sqwee mildly blow up.

So I tentatively started poking into the Unicode world, expecting at any moment to have a dragon fry me to a crisp or to fall into some large crevasse. Interestingly, neither happened, but it was a little bit of a journey.

First, I found out all I needed to do was add a nice little meta-tag:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

Simple enough, right? I tried it. Didn’t help a bit. Manually switching the encoding (in Firefox) did work, though. After examining the headers using Live Headers, it was clear the content type was still being sent as iso-8895-1.

I figured this was due to the Lighttpd webserver not setting the content type correctly, so I went about trying to change that. I thought it would be possible to change it in the mimetypes:

mimetype.assign             = (
  ".html" => "text/html; content-type: utf-8" 
)

I saw this suggested somewhere, but it didn’t help.

Then I read that in Prototype Unicode doesn’t work with “get” and only with “post”, so I tried that:

 new Ajax.Updater("main", "index.rhtml", {
           method: "post",
           //...
        });

But it didn’t help either!

At this point I was getting somewhat frustrated, but then I remembered that eruby generates its own headers. Perhaps that was the problem?

Indeed it was! Fortunately, it is possible to set the content type via a commandline switch:
usage: ./eruby [switches] [inputfile]

  -d, --debug           set debugging flags (set $DEBUG to true)
  -K[kcode]             specifies KANJI (Japanese) code-set
  -M[mode]              specifies runtime mode
                          f: filter mode
                          c: CGI mode
                          n: NPH-CGI mode
  -C [charset]          specifies charset parameter for Content-Type
  -n, --noheader        disables CGI header output
  -v, --verbose         enables verbose mode
  --version             print version information and exit
Now I was in business! I went ahead and changed the Lighttpd config file to add in the appropriate switches:

cgi.assign = (".rhtml" => "/home/justin/sqwee/bin/eruby -Ku -C utf-8")
Unfortunately, this doesn’t work at all, because Lighttpd uses stat to check if the specified program exists and the options mess it up. To work around this, I needed to create a little script to launch eruby with the appropriate options:

#!/bin/env ruby
require 'pathname'
exec("#{Pathname.new(__FILE__).dirname}/eruby -KU -C utf-8 #{ARGV.join(' ')}")

That worked perfectly, and suddenly Sqwee had Unicode! That means time for a new release.


More Sqwee

Yes, I’m going talk more about Sqwee. I think it’s mostly because I’m excited about writing software with real version numbers… just kidding.

I’m still working on a good description of it. It’s incredibly simple stuff, but kind of hard to explain. It’s like a wiki, without lots of revisions and multiple users. So it’s like a personal wiki. But it is oriented towards being quick to install and quick to use, while retaining the flexibility for people to use it as they like. That’s why I sort of have the ‘prepackaged’ and ‘no frills’ versions, for running on a desktop and a shared server, respectively.

Anyways, enough blabbing about that stuff. I have been using Sqwee to take notes for a couple weeks now, and it actually works pretty well. But I noticed a couple of things that bugged me quite a bit:

First, if you are editing a page (taking notes) and you want to save it, but keep editing, you have to click ‘save’ and then ‘edit’ again. So I added the ‘quick save’ feature which will save the page but keep you in editing mode.

But then…how do you know it has really saved it and there wasn’t some problem? Or maybe it takes a long time to save or load a page…it would be nice to know when that kind of thing is “working on it” and when it has failed. So what I do now is have the button you press “gray out” while it is work in, then come back when it is complete. It works well when things are slow, but isn’t annoying when they are fast.

Anyhow, the point is that version 0.2.1 is out and I’m excited about the changes. Which, I forgot to mention, include the ability to search.


I don’t know why this matters and stuff

But I just realized that the three main computers I use (home desktop, laptop, lab desktop) all have different layouts. I use Xfce for my window manager, which (by default) has two panels: one is sort of a taskbar/system tray (like MS Windows) and the other is a launcher bar (like OS X).

At home, I have the launcher bar on the left, with auto hide, and the task bar across the top (and gkrellm on the top right). But on my laptop, there is a lot less screen space, so I only have the taskbar, which is stretched across the bottom and auto hides. In the lab, I have a bigger screen, but I basicly only use three applications: Firefox, Thunderbird, and a terminal. So I just have the taskbar across the top with a few buttons for launching programs. I don’t have any menus set up, because I pretty much launch all programs (besides those mentioned above) with Alt-F2 (run program) or from a terminal. If I get desparate, Xfce let’s me access a menu from right-clicking the desktop. And that’s it…

On a totally different note, I decided to start taking notes on my laptop this quarter to make them easier to study and search later. So, I went looking for a good note-taking program. The good news is that other people have gone on the same search. I looked at a few (Basket is really cool) before remembering that I have Sqwee and I specifically mention in the description that it can be used for note taking…oops. So I tried it out…it works pretty well, actually. Nice and simple. But I did find a problem with ‘special’ characters. I wanted to add in some ∩ and ⊆ kind of stuff, which you can do (fairly) easily by just using HTML. Strangely, that works fine, until you edit and then re-save the page. When you edit it (at least in Firefox) the characters are no longer displayed as HTML entities (&cap;) but as the actual characters (∩). That’s pretty cool, but then when you save the page the get manged into ASCII or something. Kind of annoying…I guess I should fix that.

I don’t know why anyone would need to know the preceding, but I felt like sharing.


New Year Garbage

I guess it’s pretty much 2008 now. I’m comfortably in bed in Arizona, my girlfriend is in China. We’ve never spent New Year’s together. Each year I think the same things…plan the same plans…regret the same regrets. I was lazy again, I won’t be this year. I didn’t accomplish anything of significance, I will this year. I was a bum to my girlfriend, I’ll be better this year. I blew my money on silly things, I’ll save more this year. I didn’t study enough, I’ll study more this year. I didn’t do enough, I’ll do more this year. I procrastinated last year, I’ll be ahead this year.

Each year it’s the same, sadly. I always feel like I ought to do something spectacular, something new, something I can be proud of, something which makes a difference. To see something no one has seen before, or put two facts together and get a third no one has thought of before. Or just do something nifty and cool.

I guess it is good to take a little look back, though. Let’s see…Pi, No Forks put out a single new song, while Black Orange was formed and debuted something of an album. I bit the bullet and got a real web host and put up this site with yet-another-place-to-blather. We got the turtles, which has made my life more interesting…or at least gave me animate objects to say hello to when I get home. I finished my first and started my second year of graduate school, which included joining a lab I enjoy. I worked at PC Club for three months and then was able to escape, though it was cool working with the guys there (just not most of the customers). I’ve been to Seaworld, Los Vegas, Disneyland, and Knott’s Berry Farm and somehow gotten over my fear of (some) roller coasters. My first real software thing was released. I wrote my Written Qualifying Exam paper, but am behind on all the paperwork. Ummm….I guess that’s pretty much most of it.

So, what’s up for this year? I’ll be working on a paper to submit to MobiQuitous, working on new music for Black Orange, working hard at school (I hope), and trying to be all-around better. I still want to work on Kingdoms of Ahln but who knows. I think that’s pretty much it. A few nice scientific breakthroughs would be nice, but I don’t think that’s going to happen.

Anyhow, here’s to a nifty new year. I hope everyone is awesome and continues to grow in awesomeness as the year progresses.


My first official software release – Sqwee

Yes, so. That project I previously called “MyWiki” has been rebranded as Sqwee – Simple Quick Web Editing Engine. Which is silly, but I like the acronym.

This project came about because I was using Pimki for keeping track of various thoughts and things, but accessing my home server remotely started to become a pain (stupid ISP, I imagine). It became such a pain that I got a real hosting plan with Site5 (link over there somewhere) and this nifty domain name.

But! I didn’t think Site5 would appreciate me running Pimki because it is tied up with WEBrick and therefore had to be running as a background thing and use a non-standard port. I looked around for something Ruby-based (like Pimki) but easy to set up on a shared host.

Sadly, I didn’t find anything that I liked. So, as these stories usually go, I made my own. I had some specific goals in mind:

  • Easy to install
  • Fast
  • Simple design
  • Quick creation and editing of pages

Out of that came the very minimalist Sqwee. It’s like a wiki, but only in that you can dynamically create and edit (and delete) pages. There are no accounts, revision tracking, or other bells and whistles (on account of wanting to keep it fast). It doesn’t even have password protection built in…but that’s because it would be a pain and any web server will have that already.

There are some planned features, but the idea is to not let anything slow down page rendering or creation. In fact, pages are basically stored as static HTML. The only “rendering” is putting the header, navigation section, and the content together, like many websites do.

This was my first time doing AJAX stuff, so I went ahead and used the Prototype library to get going. It’s pretty nice. So that means nice, quick creation and editing of pages. I like it.

Well, that’s probably enough rambling about Sqwee. If you are curious, see the website or check out the demo.