JUN | SEP | OCT
| 10 |
2006 | 2007 | 2009
23 captures 3 Mar 06 - 31 May 09 |
| Close Help

# sjs

## geeky ramblings

## 5 ways to avoid looking like a jerk on the Internet 3

Posted by sjs
on Thursday, August 30

Let me begin by stating that these are tips I have gathered by posting in many public forums on the Internet and I have learned most of these rules by making the mistakes myself. I'm not trying to point fingers at anyone or act all holier-than-thou. It's a cold, emotionless medium text is. It can be difficult to accurately convey one's feelings when typing a quick reply somewhere. John Gabriel's theory certainly plays a part as well, but I'll try and assume that you are generally a nice person. I also assume that we are talking about a text medium (IRC, forums, Slashdot/Reddit/Digg). None of that fancy voice or video conferencing stuff!

Also, this is not a guide on how to really be an arrogant prick, but just not look like one when you engage in conversations on the Internet. It's also not a guide on not being a jerk. Should you lack basic manners you will have to learn them elsewhere.

### Rule #1: Forget the medium

One thing that is quite difficult to do is look past the medium and remember that these are all real people conversing with each other. Don't type anything that you wouldn't say to their face in real life. This is, of course, not exclusive to the Internet.

### Rule #2: Remember the medium!

While obeying Rule #1 it's important to remember that in a text medium there is no emotion or tone to our words. If you think that smilies / emoticons are lame and for 12 year olds, well you're right. However, there's no reason for an adult to refrain from using them as well. They can be important quick clues to how your message should be interpreted. You can always rephrase what you write so that there's little ambiguity to your words, but if you're typing something quickly on Digg, Reddit or some forum then you probably aren't spell checking and proof reading each and every post.

### Rule #3: Avoid know-it-all responses

Starting a reply with "But ...", "Well ...", "No ...", or "Your mother's a ..." often sounds confrontational. There's obviously no harm in using these in the right context, but many times I have found that removing these from the front of a sentence can drastically alter the tone and make it clear that I am trying to converse rather than argue.

### Rule #4: Address the correct party

If you're not speaking directly to the reader avoid using "you" when you mean "one". This is a particularly hard one to get in the habit of doing, for me at least. I am just not used to speaking so formally but in writing it really does make a world of difference. People are defensive creatures by nature and we don't like being singled out or accused. Hell, half of the time we don't even like honest, kind advice.

### Rule #5: Accept the fact that people know more than you

Geeks often come across as know-it-alls. While most geeks probably do think they're rather clever (guilty as charged) they probably also know that they don't know everything. When one knows nothing of a topic it's easy to admit that others are right and they are wrong (often because they won't have an opinion on the subject yet). The trouble starts once they learn something about the matter, once they have formed opinions and ideas about it.

I'm not saying that we should all stop discussing things we're not experts on, just that we should try harder to keep open minds about things and realize that others may have some insight we do not. If in doubt, partake in civil discourse and try not to dismiss others without even asking them to back up their claims or ideas.

Cue the comments pointing out how many of these rules I broke in this very post... :)

- Tags: life netiquette
- Meta: 3 comments, permalink

## Captivating little creatures 0

Posted by sjs
on Sunday, August 26

Someone posted this JavaScript implementation of an old gem on Reddit, Lemmings! There goes my Sunday! :)

- Tags: games lemmings
- Meta: 0 comments, permalink

## Cheat productively in Emacs 0

Posted by sjs
on Tuesday, August 21

By now you may have heard about cheat, the command line cheat sheet collection that's completely open to editing, wiki style. A couple of weeks ago I posted cheat.el which allows one to cheat from within Emacs. There's an update. However, before I get to cheat.el there's a small detour.

Cheat is not just about Ruby! A few examples of cheats available are:

- bash and zsh
- $EDITOR (if you happen to like e, TextMate, vi, emacs, RadRails, ...)
- GNU screen
- Version control (darcs, svn, git)
- Firebug
- Markdown and Textile
- Oracle and MySQL
- Regular expressions
- and of course Ruby, Rails, Capistrano, etc.

As of today, Aug-21 2007, the count is at 166 cheat sheets so there's probably something there that you'll want to look up from the command line or Emacs sometime. That's enough stroking cheat's ego, but there seems to be a notion that cheat is only for Ruby stuff and that's really not the case.

So what's new in this version of cheat.el? Completion! The only thing that bothered me about cheating in Emacs was the lack of completion. It now has completion, thus it is now perfect. :) In all likeliness this won't be the last release, but I can't really foresee adding anything else to it in the near future. Enjoy!

Download it now: cheat.el

For any newcomers, just drop this into `~/.emacs.d`, `~/.elisp`, or any directory in your `load-path` and then `(require 'cheat)`. For more info check the original article for a rundown on the cheat commands.

- Sections: Emacs
- Tags: cheat emacs
- Meta: 0 comments, permalink

## Catch compiler errors at runtime 0

Posted by sjs
on Sunday, August 19

While coding just now I had a small epiphany about Ruby. Though Ruby is highly dynamic and compiled at runtime, that doesn't preclude one catching some mistakes at compile time. I'm not talking about mere syntax errors or anything either. The only proviso to catching mistakes at compile time is that you must have a decent chunk of code executed during compilation. One benefit of Ruby's blurring of compile time and runtime is that you can run real code at compile time. This is largely how metaprogramming tricks are pulled off elegantly and with ease in projects such as Rails.

Sure you won't get all the benefits of a strictly and/or statically typed compiler, but you can get some of them. If you have a library that makes substantial use of executing code at compile time then the mere act of loading your library causes your code to run, thus it compiles. If you `require` your lib and get `true` back then you know the code that bootstraps the runtime code is at least partially correct.

Compile time is runtime. Runtime is compile time. Just because you have to run the code to compile it doesn't mean you can't catch a good chunk of compiler errors before you send out your code. Tests will always be there for the rest of your mistakes, but if you can pull work into compile time then Ruby's compiler can augment your regular testing practices.

I admit that this is of limited use most of the time, but let it not be said that you can't catch any errors with your compiler just because you have to run your code to compile it. With Ruby the more meta you get the more the compiler rewards you.

[Of course this is true of languages such as Common Lisp too, which make available the full programming language at compile time. I just happened to be using Ruby when I realized this.]

- Tags: ruby
- Meta: 0 comments, permalink

## Opera is pretty slick 0

Posted by sjs
on Saturday, August 11

Though I usually prefer free software, I don't have any problems using proprietary stuff if I think it's good. I had Firefox open for a couple of days and noticed that it was using 700M of memory. That's not a problem at all since I have 4G but it's also a lot of RAM to be in use for just one window with one tab open. The fact that Firefox gets sluggish after some time and needs to be restarted tells me that this isn't expected behaviour and is likely not due to caching for quick back/forward or whatever they claim is taking up the leaked memory.

Konqueror is ok but I'm not a huge fan of it, partly due to its kitchen-sink browser/file manager hybrid design. IMO the KDE folks should break out the file manager part, but I digress. I can't really put my finger on anything specific I dislike about Konqueror, it's just not for me. To my dismay it seems to be the snappiest browser on Linux.

The only other decent browser I know of (for Linux) is Opera so I found some quick instructions on the Ubuntu forums and shoehorned the x86 build of it into my amd64 installation. Everything went well, Flash works and all that stuff. Opera is not nearly as snappy as I like but it is still fairly pleasant to use, once you find a skin that fits into your desktop. For the record Firefox isn't snappy enough either. Apart from AdBlock I don't miss many extensions for every day browsing.

I'm not sure if I'm going to stick with it yet but I've been using it for 2 days and haven't really missed Firefox at all. Of course as soon as I do any development I need Firefox for Firebug and the Web Developer extension and such. I've yet to investigate development tools on Opera. I'm comfortable developing in Firefox already so why switch?

Man am I glad we're not in a Netscape/IE world anymore! If I open up my MacBook I can choose from at least 2 other browsers for every day browsing (Camino, Safari).

- Tags: browsers firefox opera
- Meta: 0 comments, permalink

## Cheat from Emacs 4

Posted by sjs
on Friday, August 10

Update: I had inadvertently used `string-join`, a function provided by something in my ~/.emacs.d. The script has been updated to work with a vanilla Emacs (23, but should work with 22 as well).

Update #2 [2007.08.10]: Editing cheats and diffs have been implemented.

Update #3 [2007.08.21]: I added completion to cheat.el. The file linked on this page is still the latest version.

We all know and love cheat. Now you can cheat without leaving Emacs (and without using a shell in Emacs).

Just save cheat.el in ~/.emacs.d and then `(require 'cheat)` in your ~/.emacs. I also bind `C-z C-c` to `cheat`, you may want to do something similar.

You can't do everything you can do with cheat on the command line yet, and for most of the commands the cheat command itself is used. Now you can do everything the command line client does from within Emacs, though you may need to revert to using `cheat-command` (described below).

Here's the rundown:

Any time you enter a cheat name there are both completion and a cheat-specific history available. Unless you are adding a new cheat. In that case you should use a new, unique name (duh).

- `cheat` - Lookup a cheat sheet interactively (`cheat <name>`)
- `cheat-sheets` - List all cheat sheets (`cheat sheets`)
- `cheat-recent` - List recently added cheat sheets (`cheat recent`)
- `cheat-versions` - List versions of a cheat sheet interactively (`cheat <name> --versions`)
- `cheat-clear-cache` - Clear all cached sheets.
- `cheat-add-current-buffer` - Add a new cheat using the specified name and the contents of the current buffer as the body. (`cheat <name> --add`)
- `cheat-edit` - Retrieve a fresh copy of the named cheat and display the body in a buffer for editing.
- `cheat-save-current-buffer` - Save the current cheat buffer, which should be named `*cheat-<name>*`.
- `cheat-diff` - Show the diff between the current version and the given version of the named cheat. If the version given is of the form m:n then show the diff between versions m and n. (`cheat <name> --diff <version>`)
- `cheat-command` - Pass any arguments you want to cheat interactively.

(Added) I may add support for `--diff` and `--edit` in the future.

Please do send me your patches so everyone can benefit from them.

- Sections: Emacs
- Tags: cheat emacs
- Meta: 4 comments, permalink

## Snap, crunchle, pop 1

Posted by sjs
on Thursday, August 09

I think that every now and then we need to be reminded of the frail nature of our human bodies. Yesterday morning as I walked to my kitchen I was turning right by pivoting on my right foot when my 24 years of walking experience suddenly failed me. I clearly did something wrong, as I heard a crunching pop or two in my right ankle and went down. Luckily it's just a sprain but my foot is fairly bruised and still sore today. I'm trying to follow the RICE method for recuperating but one can only lay down for so long before having to eat, work, use the bathroom, etc. Thank goodness I don't work on my feet or I'd be out of commission. If it still hurts next week I'm going to see a doctor but till then I'm trying not to leave my house. The idea of hopping and hobbling to a bus to go to a doctor does not thrill me in the slightest.

Oh, if you find yourself in a bind an upside down hockey stick is a decent makeshift crutch. You'll need 2 hands to operate the thing though.

At the opposite end of the spectrum there are times when we seem to be amazingly resilient creatures. Check out a documentary called "101 Things Removed from the Human Head" if you can find it anywhere. One of those things was a boat anchor, I kid you not.

- Tags: humans injury life
- Meta: 1 comment, permalink

## ElSchemo: Boolean logic and branching 0

Posted by sjs
on Thursday, August 02

Well it has been a while since my last post. I'll try not to do that frequently. Anyhow, on to the good stuff.

I've been developing a Scheme interpreter in Haskell called ElSchemo. It started from Jonathan's excellent Haskell tutorial which I followed in order to learn both Haskell and Scheme. Basically that means the code here is for me to get some feedback as much as to show others how to do this kind of stuff. This may not be too interesting if you haven't at least browsed the tutorial.

I'm going to cover 3 new special forms: `and`, `or`, and `cond`. I promised to cover the `let` family of special forms this time around but methinks this is long enough as it is. My sincere apologies if you've been waiting for those.

Continue reading...

- Tags: elschemo haskell scheme
- Meta: 0 comments, permalink

## people 0

Posted by sjs
on Thursday, July 12

Sometimes this is difficult to remember for someone who (likes to think that he) thinks somewhat logically.

> When dealing with people, let us remember that we are not dealing with creatures of logic. We are dealing with creatures of emotion, creatures bristling with prejudices and motivated by pride and vanity.

—Dale Carnegie, How to Win Friends and Influence People

- Tags: life people
- Meta: 0 comments, permalink

## See your regular expressions in Emacs 0

Posted by sjs
on Friday, July 06

First, if you are an Emacs newbie then be sure to read (at least) the introduction of Being Productive with Emacs. For some reason the PDF and HTML versions are slightly similar.

Anyway, it mentions `re-builder` which is an awesome little gem if you use regular expressions at all1. What this baby does is open a small window at the bottom of your screen in which you can type a regex. It is parsed as you type it and matches are highlighted in the other window. Genius.

[1] If you don't use them I encourage you to "learn them"http://regex.info/. Don't pay any attention to Jamie Zawinsky and his lack of appreciation for a fantastic tool.

- Tags: emacs regex
- Meta: 0 comments, permalink

## RushCheck: QuickCheck for Ruby 0

Posted by sjs
on Thursday, July 05

I cannot wait to try out RushCheck. It is QuickCheck for Ruby. I don't have experience with QuickCheck or anything but it's clear to see how this helps you make certain your code is robust.

- Tags: quickcheck ruby rushcheck
- Meta: 0 comments, permalink

## A TextMate tip for Emacs users 0

Posted by sjs
on Tuesday, July 03

Update: The only place I've seen this mentioned is in a comment on the MacroMates blog.

My Linux box is down due to a hardware failure; a cheap SATA controller to be specific. Perhaps that will be a story for another day. As a result I've been working on my MacBook and back in TextMate. Old habits. And I haven't gotten comfortable in any of the OS X Emacsen yet.

This gave me an opportunity to accidentally discover some shortcuts in TextMate. A result of the Emacs shortcuts that my fingers are already wired to, here are some TextMate keyboard shortcuts that may or may not be documented (I need to RTFM some day).

- As in most Cocoa text areas, `C-f`, `C-b`, `C-n`, `C-p`, `C-a`, `C-e`, and `C-t` work as expected (and others I'm sure).
- `C-k`: behaves as a vanilla Emacs, killing till a newline or killing a bare newline. I use the word killing specifically because you can yank it back with...
- `C-y`: yanks back the last thing on the kill ring (paste history). You still have to use `C-S-v` to yank previous items.

I think TextMate may have helped ease me into Emacs without me even knowing. I had my suspicions that Allan was an Emacs fan and now I'm certain of it. I keep finding things in one that the other has, which makes switching between them easy. Well done Allan.

- Tags: emacs keyboard shortcuts textmate
- Meta: 0 comments, permalink

## Controlling volume via the keyboard on Linux 0

Posted by sjs
on Saturday, June 30

I was using Amarok's global keyboard shortcuts to control the volume of my music via the keyboard but I wanted to control the system volume as well. A quick script later and now I can control both, and thanks to libnotify I get some feedback on what happened. It's not as pretty as OS X's volume control or Growl but it'll certainly do.

↓ Download volume.rb

I save this as ~/bin/volume and call it thusly: `volume +` and `volume -`. I bind Alt-+ and Alt—to those in my fluxbox config. If you don't have a preferred key binding program I recommend trying xbindkeys. apt-get install, emerge, paludis -i, or rpm -i as needed.

- Tags: alsa linux ruby volume
- Meta: 0 comments, permalink

## Recent Ruby and Rails Regales 0

Posted by sjs
on Thursday, June 28

Some cool Ruby and [the former on] Rails things are springing up and I haven't written much about the two Rs lately, though I work with them daily.

### Rails on Rules

My friend Jim Roepcke is researching and implementing a plugin/framework designed to work with Rails called Rails on Rules. His inspiration is the rule system from WebObjects' Direct to Web. He posted a good example for me, but this baby isn't just for template/view logic. If some of the Rails conventions were specified in a default set of rules which the developer could further customize then you basically have a nice way of doing things that you would otherwise code by hand. I think it would be a boon for the ActiveScaffold project. We're meeting up to talk about this soon and I'll have more to say after then, but it sounds pretty cool.

### Sake Bomb!

I've noticed a trend among some recent posts about Rake: the authors keep talking about booze. Are we nothing but a bunch of booze hounds?! Well one can hope. There's some motivation to learn more about a tool, having more time to drink after work. This week Chris Wanstrath dropped a Sake Bomb on the Ruby community. Like piston, sake is something you can just pick up and use instantly. Interestingly the different pronunciations of `rake` and `sake` help me from confusing the two on the command line... so far.

### Secure Associations (for Rails)

Jordan McKible released the secure_associations plugin. It lets you protect your models' *_id attributes from mass-assignment via `belongs_to_protected` and `has_many_protected`. It's a mild enhancement, but an enhancement nonetheless. This is useful to enough people that it should be in Rails proper.

### Regular expressions and strings with embedded objects

taw taught me a new technique for simplifying regular expressions by transforming the text in a reversible manner. In one example he replaced literal strings in SQL - which are easily parsed via a regex - with what he calls embedded objects. They're just tokens to identify the temporarily removed strings, but the important thing is that they don't interfere with the regexes that operate on the other parts of the SQL, which would have been very difficult to get right with the strings inside it. If I made it sound complicated just read the post, he explains it well.

If you believe anything Steve Yegge says then that last regex trick may come in handy for Q&D parsing in any language, be it Ruby, NBL, or whataver.

- Tags: rails rails on rules regular expressions ruby sake secure associations
- Meta: 0 comments, permalink

## Emacs: tagify-region-or-insert-tag 0

Posted by sjs
on Monday, June 25

After axing half of wrap-region.el I renamed it to tagify.el and improved it ever so slightly. It's leaner, and does more!

`tagify-region-or-insert-tag` does the same thing as `wrap-region-with-tag` except if there is no region it now inserts the opening and closing tags and sets point in between them. I have this bound to `C-z t`, as I use `C-z` as my personal command prefix.

`<` is bound to `tagify-region-or-insert-self` which really doesn't warrant an explanation.

- Tags: emacs tagify
- Meta: 0 comments, permalink