Archive for November, 2003
Vim Tip #
Card sorting #
Or “My customers can’t find anything on my site!”
A very tricky problem in web design is how to organise the information on the site into categories. Card sorting solves this problem in a way that’s really pretty obvious.
You write out the items you’re going to have on the site on cards (assume for a moment we’re just talking about a bunch of simple documents you want to publish). Then you take that stack of cards and ask a customer to group them for you. Take a note of what they do, then go see another customer and ask them. Do this with a few customers, the client and maybe some other people and then look what consensus arises.
Frickin’ obvious. Gold dust. Thank you DoS.
“Best tip of all” #
# Recording (BEST TIP of ALL)
qq # record to q
your commands
q
@q to execute
@@ to Repeat
# editing a register/recording
“qp
you can now see contents of register q, edit as required
“qdd
# deletes the line back into q
Neat, expecially the part about editing the register contents.
Also :set ff=(unix|dos|mac) and then write the file to sort all your line ending woes.
:filetype indent plugin on #
Turns on ftplugins! Took me ages to work out why they just weren’t getting read. That’s much better than setting up loads of autocommands. Just have one which sources a file once per buffer, rather than on every BufRead.
I also set up some Mac-like motion key commands, like Apple-right and such, so they behave as they do in standard OS X text controls. This will make it a lot easier for me to make the transition.
Autocommands #
au BufRead * set keywordprg=/Users/ben/Documents/bin/google.php
au BufRead *.java set keywordprg=/Users/ben/Documents/bin/google.php\ java\ site:sun.com
Autocommands are a powerful tool in Vim. By assigning autocommands to the BufRead action, I can specify commands to run whenever I move to a buffer. The next argument is a pattern to match on the file name. So here I’m saying, when you transfer to a buffer, set the keyword program to my Googling script. Then if the file is a java file, set the keywordprg to the Google script with some extra arguments which make the search more likely to return Javadoc for the thing I’m Googling.
Result: a custom editing mode for Java which knows more about the document that the standard environment. As I edit more and more files I’ll be adding a lot of autocommands for each filetype using much of Vim’s functionality, like macros for tags for an HTML mode. Because the menus in Vim are editable from scripts, I can add custom menus for each filetype as well.
It sounds like I should actually be doing this stuff with ftplugins as of version 6 though…
SUPER YAY! #
It’s an age old bug bear of mine. I have a tabbed browser, but it opens windows for pages from other apps in new windows. Blows.
Never occurred to me that if I told Safari to just open the new pages in the same window it would be bright enough to open them in new tabs. I assumed it would overwrite the current document like IE does. Safari is bright though. SUPER YAY!
That makes me so happy, no more browser window proliferation. Exposé or no, I really dislike having more than one browser window. Works well with my Vim hack (below) as well.
Thanks to inessential.com for the tip off.
More Vim hacks #
:set keywordprg=google
Where google is a shell script that simply looks like:
#!/bin/sh
/usr/bin/open http://www.google.com/search?q=$1
The net effect is the whenever I hit K in Vim, I get a google search of the keyword under the cursor. By default Vim uses man, which is OK for C hackers, but not so good for Sun Certified Programmers for Java. :-)
BTW, open is a clever OS X program which uses OS X’s database of applications to find the right application for whatever you tell it to open. In this case it will fire up Safari. Using it here means that this hack works from both the command line and GUI versions of Vim.
Vi iMproved usage improved #
Under urging from Miles, I’ve put BBEdit in a drawer and gone over to using Vim as my main editor. I’ve been using Vim for a while now, but I’m not proficient enough with it to use it as fluidly as I use BB.
I’m trying to learn a bit more now though. I’m kind of trying to resist buying a book. I don’t really get along with the interactive help.
Anyway, one thing I found out from the newbiedoc project, was how to set up macros, particularly insert-mode macros:
imap <h1 <h1></h1>
This macro types “<h1></h1>”, positions the cursor between the two tags and goes into insert mode. Useful. There’s a lot more you can do, Vim supports functions as well, so I’ll have to get into those. I wonder if it’s possible to do the kind of things that you can do with the Perl regex pattern modifier e. That would be handy. I really need to conquer Vim’s regex syntax, I keep tripping up at the moment.
Now I’m reading Bram Moolenaar’s Seven habits of effective text editing. It’s pretty damn informative.
Patterns #
Just reading The Design of Sites, my new web authoring book. The bulk of the book is a bunch of design patterns for web developers, some of which are pretty obvious, others are new to me (at least I’ve yet to apply them).
Patterns are interesting because they provide simple recipes to solve simple problems, but when you combine several patterns together you can solve much bigger problems. This made me think, is there any limit to this combinatorial approach? Would a site that simply collected and catalogued patterns in all domains be useful? You would carefully structure the pattern input process and provide features for linking to other patterns in the database (including some form of backlinking) and allow users to rate the quality of patterns as they apply them.
Given that nothing is as discrete as we would like to believe, I think that this might be quite a useful site and I may get off my ass and make it. I had a quick look around but all I found was a lot of software patterns and some architecture and web patterns. I started out looking for business patterns. E.g. “I’ve learnt a lot about the subtleties of my trade, but I’m finding it hard to teach my clients about the subtleties and manage my projects in such a way that means we don’t fall into these known traps.” I’m not the most amazingly skilled businessman ever and a set of simple small business patterns or freelance patterns could help me out a lot sometimes. It also seems likely to me that a repository that’s based around statements of problems would be knowledge in a form that’s easily applicable in a way that web browsers tend to like.
I like #
aspell -H
Interactive curses spell-checker that is bright enough to avoid flagging HTML tags. Coolness. Got to work out a good way to run it in batch-mode on a whole site next.
Certified! #
I passed my exam! I got 88%, 54 questions right out of 61. I’m well chuffed. I had no idea whether I would pass or not right up until when they told me my mark. The test was pretty hard. I had a good twenty minutes at the end to check through my answers and there were a good fifteen that I wasn’t confident about. I think I may have been quite lucky in some of my choices.
I got a good breakdown of the test. Threads and garbage collection were my weak points. Especially threads. GC isn’t so bad, there were three questions, I got one wrong. Overall, I got 100% in five of the nine areas.
All in all this is my best exam performance since about 1995. I think it may also be the first time I’ve revised since then. I did work moderately hard on the revision.
Afterwards I celebrated with a trip to Blackmarket Records and a new Warp t-shirt from Selectadisc. To be honest, that was more my usual pattern of rewarding myself for going to Soho. Used the tube competently again, well done me.
Public Discussion #
Hypercapitalisation #
Too many people think that Capital Letters should Be Used to Emphasise Important Words. This is an annoying habit, nearly as annoying as hyperexclaimation!!!!!
Blaargh #
I was ill. Big cold, fever for a couple of days. Not fully fixed yet, still bunged up. I had to miss my grandfather’s funeral because of the need to catch up on work. Grr.
The sun’s up to something. Ever since I watched 2010, the solar system sometimes really badly gives me the creeps. Being on Earth is like running and hiding under my duvet. It’s no help at all, but at least I’m not suspended in the cold nothing staring at a sun that is trillions and trillions times bigger than me and pissed off.
Web writing style guide #
The Cast Of Musical Elephants #
It’s a mnemonic:
T: Types
C: Control
O: Objects
M: Modifiers
E: Exceptions
These are the major classes of keywords in Java. Types is things like byte and char, control is if and do, objects is class and implements, modifiers is public and final and exceptions is try and catch and the rest.
SJCP revision 2 #
I found an excellent set of study notes for the SCJP exam. They are very comprehensive. Every Java programmer should read them really, it helps to know everything about the language you’re coding in, it may be able to do some things that will really help your code.
The nice thing about this set of notes is that each section has a couple of tips and traps to watch out for, here’s the full set.
Gaming, Doom style #
I’ve just been playing Metroid Prime for the last couple of hours. I was playing the section where you get the thermal visor. Suddenly everything goes black, so you switch on the visor. This is not much better.
Before I bought Metroid, I read a Eurogamer review where the guy said the feeling he got while playing it was the feeling he got when playing Doom. I wasn’t sure before, but reading that made me buy it. It really is like playing Doom.
When I first got Doom (one HD, one DD, of course) I played it through. It shat me up. It has a very similar bit, which I’ll never forget, where it’s just pitch black and you’re just letting off rounds and it’s basically a maze and there’s all kinds of nastiness in there and then you get the light amp and it’s all OK. I just remember hearing the sounds of demons off in the distance whilst playing Doom late at night and being really scared. I was about 14. Now I’m 25 and the sounds of Space Pirates patrolling somewhere where I can’t see them in a huge dark room scares me almost as much. Ain’t life grand.
CSS Hacks #
Remember when I said I’d used a hack for the first time? That same stylesheet now has four different versions of one property, each using a different hack to single out IE 5 PC, IE 5 Mac, IE 6 PC and compliant browsers like Moz and Safari! There are some others where two values are used, one for IE 5 and one for the rest. The document is still fully valid CSS though.
My copy of the Design of Sites arrived today as well.
Kill Sound Before Sound Kills You by kid606 #
kid606 albums duck and dive. The last one was minimal soundscapes. This one is massive hardcore. In many ways it sounds like kid606 does Bogdan, which could be a good thing. It’s a bit tired though.
Some bits are undoubtedly ‘ardcore (inherently a good thing), but a lot of it is just trotting out the same samples and effects in an effort to press buttons. It sounds he’s shouting “I REALLY FUCKING WANT TO MAKE A GREAT FUCKING ALBUM!!!”, which is a shame. Some of the tracks are more thoroughly thought out that others, but the overall impression is pretty similar to that of Go Plastic unfortunately.
That said, it’s not unlistenable, it’s just not as good as it should be/everyone says it is.
Leslie Godfrey, RIP #
My grandfather died on Friday. It was very much a surprise to every one. He was in his eighties, but was doing very well both mentally and physically for somebody of that age. Then, sometime in the night, he just stopped.
He was my paternal grandfather and I’ve spoken to my Dad a couple of times since then. Yesterday he seemed pretty haggared, but today he seemed OK. I think he may have been thinking about the fact that one of his parents would probably die soon for several years, as must be the way when your parents reach 80. Christ, by the time my Dad’s 80, I’ll be 55! My Dad is only 49 at the moment.
I’d been the only person I knew with four grandparents for a long time. Louise has only had one since she was 13.
It’s kind of strange. It’s a similar sensation in a way to the fact that I’m now 25. Nothing feels different, then occasionally I catch myself thinking “I’m 25” or “Leslie’s dead”. I hadn’t seen Leslie for a long time, perhaps ten years. I regret this, but my Dad put it into focus when he said that we probably all regret not seeing him that one last time.
My sympathies go to Vanessa, his second wife. They celebrated their fortieth anniversary earlier this year. They were still both pretty active and enjoying life. Now she is alone, living in a world of things she shared with him for so long. It must be terribly hard. It seems that it might be easier to give up than to go on alone, especially when you too are perhaps just counting out the days. Not that I think Vanessa is. She’s a very loving person and she has a good few children, grandchildren and step-grandchildren to attend to, amongst other things.
I also kind of wonder how my paternal grandmother must feel about it. She hasn’t been married to this man for more than forty years, but still, his life and hers were always attached through their children. It must be sobering to hear that your old adversary is dead.
IE doesn’t like floats inside position:relative; blocks
#
They just vanished! Took me ages to work it out.
Applies to 5 and 6 on Windows. May apply to others.
Tests and hacks #
Well, I’ve been using it for a couple of hours now and Virtual PC is already making testing so much easier. I’m confident that installing it will improve the quality of my work significantly.
Now that I can actually test properly on IE 5 instead of just happening by a copy every once in a while, I’ve used my first CSS hack. A hack hides a property from an older browser, IE 5 in my case. You set the property to the old browser version and then use a hack to hide a second setting of the property. Simple. Ugly, IMHO. But I found one that’s really very simple. The simplified box model hack preys on IE 5’s lack of compatibility with escape characters in selector names. Old versions of Opera fall fowl of it too, but I’m not supporting those because they’re below my usage threshold.
For some good reading on CSS hacks, see the hacks page on the CSS Discuss wiki.
Windows on a Mac #
I’ve spent much of the last 24 hours installing Windows on my Powerbook.
I need to run IE 5 and all of the PCs I have access to are running 6, so my only option was a virtual PC. Knowing that Microsoft had bought Virtual PC (the market leader in PC emulation for Macs) I decided to try and stay away from that if I could and installed Bochs instead.
Bochs is pretty good, but it’s not complete and it’s very slow at some things. It took it about ten or so hours to get through a Win 98 install last night. When the install was finished I was impressed at the emulation, but there are some major problems from my point of view. I was unable to find any way to get out of standard VGA mode video. This is a big point. I need to test pages in many colours and at 800x600. Also, I couldn’t get the networking going or work out how to eject removable drives. This meant I had to reboot the machine every time I needed to change the pages I was testing — not good.
Bochs is incomplete, but getting there. It’s more of a research project I think. For instance, they use the word simulation a lot in their docs. Also it’s designed to be portable code, which often means slower. There is a commercial product, Wintel, that provides Bochs with a small GUI frontend. I really hope those guys are giving a big portion of their profit back to the Bochs developers to work on the product.
So I gave up on Bochs and installed Virtual PC instead. I got version 6, the last Connectix release.
I’m midway through installing 98 on it, but so far it’s a pleasure to use. It’s much faster. It also has a virtual drive system whereby the drive grows as you write data to it, which is a real bonus, you don’t need to allocate space permanently that you may never use. Virtual PC has a world of neat convenience features like that. You can drag files out of the PC emulation window and on to your Mac desktop, and vice versa. You can access printers, USB devices, everything. It is a very mature product that has spent a lot of time being carefully tweaked and tested. It’s a triumph of usability as far as I can see. Well done Connectix! I wonder if M$ will fuck it up or make it ridiculously twee like Windows XP. They’ve already announced that they won’t be supporting any OS except Windows. Grrr.
Update: The bastard thing played the Windows startup sound on it’s first boot! It autodetected a decent PC’s worth of devices, I’m now in 800x600 and about to test networking. Sweet.
Some more basic synthesis #
BTW, I’m hanging out in Norwich with the Thickthorn crew at the moment. Well, not now. They’re all asleep. But during the day. I’m actually heading back to da smoke tomorrow to get back into the work routine. I came up to begin work on a new project which is design and build of a smallish site (about 150 pages). Got to get feedback on the design. If all goes well, I’m outta here. Otherwise, um, I’m not sure. It’s been nice hanging around here again though, playing F-Zero GX and Soul Caliber II. Ian’s been up as well and it was good to see him again.
I got talking to Martin today and told him about the cool things I’d seen with computers and music at Dorkbot and how this had inspired me to start coding sound stuff. He liked my idea, which basically revolves around building a synthesis machine that has loads of STK’s functionality compiled in and then allowing other systems to control it via SKINI messages. One system would be a graphical frontend built with SDL. Others could be built in any kind of programming language as SKINI is just text sent down a TCP socket. I forsee there being a command line interface of some kind. I also like SuperCollider’s idea of being able to create objects within the synth server. Those objects could be created visually and then tweaked algorithmically using a Python program for example. Synchronisation is going to be an interesting problem to solve.
This evening I got into doing some actual coding. I copied out the “Hello, Sine!” STK example and built it on the command line. Then I built the real time version that played the sound (via CoreAudio on OS X) rather than dumping it to a WAV file. Then I integrated that code into my SDLAudioTest project from my last experiments. This is a SDL/Cocoa shell app that has a window (currently empty) and can make noises.
STK uses a sample for your basic sine wave, which makes sense. Why calculate the data each time when you can store the thing? It’s tiny anyway. Mac OS X applications are a directory structure and there’s a place to put resources such as sound files. Once I brought the file into my project, I had to work out how to use the CoreFoundation functions to get a filename string of the location of that file. Now that I’ve done that the thing is nicely self-contained.
Next stop is a basic piano keyboard interface in the window.
New book #
More Panthery bits #
The window decor has changed for Panther. Instead of the grey and white stripes on the title, each window now sports a light grey grad fill. It’s a bit of a return towards the creeping grey that eventually made OS 9 look so ugly, but for now it’s OK. The gem buttons — close, minimise, etc — are now also set back into the title bar instead of sitting on it. Again, I think I prefered the old version, but it’s not big thing.
What I do like is that they’ve chucked Sendmail out of the window and installed Postfix instead. Woo hoo for a mail server that doesn’t have to run as root!
Journalling is now enabled by default on HFS+ it seems. It can be disabled with the new disk utility.
Also SMB name resolution seems to work as well. I just asked Mart to connect to my machine and he was able to connect to \\Margaret rather than my IP. I didn’t just appear in his Network Neighbourhood though, but then neither do most of the Windows machines :-)
Panther #
Installed Panther today. It’s a bit of an anti-climax. Apple claim 150 features. It depends on what you would categorise as a feature really. I couldn’t point to 150 things around the OS and say, “hey, check this out, it’s the coolest!” In fact, there’s only really Exposé that’s worthy of that. Now there’s a feature. I’m going to have to see how it fits into my daily life really. And there we have it IMHO. Panther is not a wow OS, it’s an evolution that is going to make my working life much easier. When it comes to things that are going to save me time, the list looks better:
- Exposé first of all, I mention it twice. It has three modes though and they’re all cool.
- Better file dialogs system-wide.
- Save as dialogs allow you to click an old file to overwrite! Finally! I’ve been waiting for this all along, it’s going to take a while before I remember I can do it.
- Maximum mouse speed is much higher! Hooray!
- Junk mail filtering is better in the new version of Mail. Only a little bit. But then only a little bit of my junk got through the old system.
- Preview is faster than Acrobat Reader now and does haven’t have Reader’s long load time.
- Much much faster interface all round. Windows are snappier, scrolling is faster, GUI mouse operations feel like less effort.
The new Finder I’m not sure about. It doesn’t really fit the way I use either Finder or hierarchical systems like Explorer or GMC etc. With Finder, I traditionally have a window for each folder, I know where those windows go and everything has it’s place. With Explorer I have one window with which to view everything. That window stays where I put it and that makes me happy. With the new Finder I can kind of have one window, but if I double click a desktop folder ot connect to a server, a new window opens and it’s the wrong place and it’s the wrong size. This sounds pretty anal, but that’s the way I use my file navigator.
The new mode of operation for connecting to CIFS/AFS shares looks pretty good, but I don’t really connect to network machines that much.
Other than that, there’s not a lot to report really. I get the feeling that I may well dig out more stuff over the next few days as I get back to work.
