docwhat's avatardocwhat's blog

All posts

For those upgrading to macOS Catalina

Catalina (macOS 1.15) comes with tighter security.

Tighter security can cause headaches for developers.

I’m here to help out by providing you with some handy fixes.

To allow running any program from your command line terminal:

  1. Open the “Security & Privacy” system preference.
  2. Click the “Privacy” tab.
  3. Scroll down to “Developer Tools”. If “Developer Tools” is missing, you need to upgrade X-Code first; see below.
  4. Add and enable (check the box) for all the terminal programs you use.

    Some examples:

    • Terminal.app
    • iTerm.app
    • kitty.app
Read More…

User credentials in a Jenkins pipeline

The Credentials User Guide implies you can use user credentials. These are credentials that are owned and managed by a user instead of the administrator or the owner of a folder.

The guide explains how to use them with Freestyle jobs (classic Jenkins jobs) but not how to use them with the newer declarative pipeline jobs.

In this post, I’ll show you how to:

  • Set up a job to ask for credentials when triggered.
  • Allow users to provide their user credentials as a parameter.
  • Configure the pipeline job to use the passed in credentials.
Read More…

DNS not working with Go binaries and VPNs

If you are having DNS problems (i.e., Host not found) while using a Go binary while connected via a VPN… then I have a solution for you.

The solution is dns-heaven. Just use this command if you trust shell scripts running as root from random people on the Internet:

sudo -v \
  && curl -L https://git.io/fix-my-dns-plz \
   | sudo bash

What’s going on?

On macOS, if a Go program is compiled with CGO_ENABLED=0 then Go uses its own internal network name resolver. This resolver only knows about /etc/resolv.conf and doesn’t know about the libSystem (macOS libc

Read More…

Rules for a good announcement

Writing for the digital medium (email, blog posts, slack, discord, etc.) requires breaking the rules you learned in school.

I’m going to explain some rules I use to create announcements for email and slack. These rules work for other digital mediums as well.

To be clear; By announcement I mean notices saying there will be an outage or an upgrade, etc.

Read More…

Vim: indirect variable access

In Vim you can use a variable as a variable name.

Instead of using the variable name directly, wrap it in curly braces ({}). This will use the contents of the variable as the variable name.

let l:variable_name = 'b:infosec_username'
let {l:variable_name} = 'George'

echo exists(l:variable_name) " => 1
echo {l:variable_name} " => George
Read More…

El Capitan and the evils of OpenSSL

Are you having trouble with SSL on El Capitan (OS X 10.11)?

Me too.

Read More…

Spread your knowledge

I found myself trying to figure out how to disable something called NeoComplete (previously known as NeoComplCache) when editing markdown in Vim.

It was colliding with my Markdown stuff pretty badly and had really bad suggestions anyway (I mean, I’m writing text, not code… so no surprise) and I was…

Read More…

Chef, Puppet, Heat, Juju, Docker, etc.

Someone emailed me with this question:

I am interested in learning different orchestration mechanisms and would like to understand how they differ.

What are the differences between Chef, Puppet, Heat/HOT, Juju, and Docker?

When would I use a specific one?

There seems to be a lot of similarity between these.

Read More…

Setting your environment in test-kitchen

When using test-kitchen it may be necessary to set the environment of your nodes.

You can do with by changing your .kitchen.yml file. In my example, I’ll show it at the root, but they can be set on a per-suite level as well, which is handy to test different environments.

Read More…

Unindenting HEREDOCs in Ruby

This is a bit of code I wanted to save.

When using HEREDOCs in Ruby, the <<- operator is handy to keep everything indented in the source. But it doesn’t help with the content of the HEREDOC.

Example:

def example
  puts <<-EOF
This is left.

  This is indented two.
  EOF
end

In rails, you can do this:

def example
  puts <<-EOF.strip_heredoc
    This is left.

      This is indented two.
  EOF
end

There’s a helpful Stack Overflow question on this, in fact.

Here’s a…

Read More…

How to rename a Chef node

In Chef the node_name is for human usage. By default it is set to the fqdn. Which is annoying for typing.

In my network, all hosts have the same domain name. However, we knife bootstraped this one system without setting the node name with the -N flag.

Therefore I wanted to rename the nodes. With some experimentation, I figured it out.

Read More…

Tracebacks in bash

I don’t like to write programs in bash. It’s not a very pretty language. But it has one advantage over a lot of other languages:

It’s on your system. Every Unix-like system has /bin/bash; Redhat, Ubuntu, and even OS X.

But bash is still a lousy language.

This is where bash tracebacks come in…

“Whaaaaa? Bash has tracebacks?” I can hear you ask.

Yup, it can.

Read More…

Busting cached 301 redirects in Chrome.

The Chrome browser caches HTTP 301 permanent redirects very aggressively. This is normally a good thing, unless you’re the one setting up the 301 and you make a mistake…

There is no obvious place in chrome to refresh that cache, but there is a nifty trick.

Read More…

40days - Simple isn't easy

40days

I wrote a simple one-page web application called 40days. It shows you what the date is for 40 days in the future. I say “simple” but simple isn’t easy. It never is.

Read More…

Re: All https, all the time

Will Norris posted a blog post titled All https, all the time.

It’s a good article and I recommend you read it. docwhat.org is now only using https.

I did want to add one note about his apache configuration at the end.

He should be using [L,R=301] instead of just [L,R]

By default, the R is a 302 Found redirect. It was originally a…

Read More…

More on Vim with ruby crashing

I finally figured out all the reasons why Vim keeps crashing on me. I started collecting info in OS X Vim with Ruby crashes but there were still crashes happening.

It’s an interesting story. Grab a beer and pull up a chair…

Read More…

OS X Vim with Ruby crashes

On my OS X systems, Vim and MacVim has been crashing a lot. The main symptom is that anything using Omni completion, such as NeoComplCache, would try to use the built in Ruby and cause vim to die with Vim: Caught deadly signal SEGV.

Read More…

vim - preserve your cursor and window state

In vim, you can re-indent a whole buffer by using gg=G in normal mode. I like this command so much I have it mapped to <leader>g</leader>.

This is great except that you loose your cursor (and window) position.

Read More…

Updating VIM on OS X

The version of Vim that comes with OS X is a little old, but more importantly, it doesn’t have all the bells and whistles enabled.

Specifically, it doesn’t come with ruby and python support compiled in. Which is a shame, because some plugins for Vim need it.

Read More…

git gc for a bunch of directories

Every so often, you might want to run git gc to keep your git repositories running fast. Here’s an easy way to do that.

Read More…

PSA: Turn on 2-step verification in Google

If you use any Google services (GMail, GTalk, etc.) and you care even a little bit about the data in that account, then you should turn on 2-step verification.

Read More…

TextMate 2 Articles

Last week, TextMate 2.0 early-alpha was released. This release has been a long-time coming. It includes lots of improvements that people have wanted for a long time.

I am currently a TextMate user. Mainly because I’m an OS X and do Ruby programing and TextMate has lots of things to make this easier. I still love Emacs, though. One of the things I’ve been waiting for has been mark-and-select (a.k.a. control-space in Emacs). I haven’t seen it yet, but then again, I’m only starting to play with TM2.

Read More…

Fix git-gui’s “Spell checking is unavailable” dialog

Unashamedly stolen from a Hints and Kinks blog post; I added information about the Homebrew solution

If you use ‘git gui’ on the Mac, you may find that it repeatedly pops up a message about spell checking being unavailable. This happens when using the MacPorts or Homebrew versions of git.

Read More…

Undoing a rails generate

I just learned this today, while taking a Ruby on Rails class from Jumpstart Lab.

I have, many times, messed up a rails generate command. For example, using singular where plural is needed or the reverse.

Today, I learned that you can undo a generate by using rails destroy with the same arguments you used for the generate…

Read More…

Ruby crashing on Lion

Apparently Ruby doesn’t work well (or barely at all) with Lion and X Code 4.1

In fact, it crashes with gusto when compiled with X Code 4.1… UNLESS you know the magic words!

Read More…

New Look (2)

Every so often, I get bored with my theme. I notice usability issues, things I wished I did differently, etc. and I want to play with new technologies like HTML5, CSS3.

I had been using Thematic which is very nice. It has good semantic markup as well as other nice features. But it isn’t HTML5 and I wanted HTML5.

Read More…

Virtualenv on OS X

So I decided to try to install virtualenvwrapper (and virtualenv) on my Mac Book Pro. Virtualenv was explained to me as being python’s version of Wayne E. Seguin’s RVM (Ruby Version Manager).

I’ve tried installing virtualenv/wrapper twice before and failed miserably. But this time I decided to actually do it.

Read More…

Jenkins

We have recently started using Jenkins at work and it is awesome.

Jenkins describes itself as a continuous integration software, but it really is more. You can use Jenkins to build, test, and do cron jobs, etc. It’s very powerful and really useful.

Read More…

Gerrit: Rename a Project

At work we’ve been trying out Gerrit. It is awesome in many ways, and yet in others it is sorely lacking.

One of the more obvious problems is the lack of administration functionality. For example, there is no administration interface for deleting or renaming a project.

However, I needed to rename a project and here is how I did it.

Read More…

IAT 1.5

I just uploaded It’s All Text! 1.5 to AMO. [edit: It’s out!]

Assuming I made no mistakes, then it should appear shortly.

The big changes are that it supports Firefox 4.0b7. In addition to that, I have fixed some of the problems with OS-X. In part because the ability to launch applications in Firefox is becoming more annoying with each release.

Read More…

Git Tip: empty branch

Ever wanted to make an empty branch (with no history in it) in git? It’s not hard…

Why would you want to do this? Well, for example, I have a new project in github. I’m trying to implement it in several ways, jRuby, Java, Qt, etc. Having separate branches is really handy.

Another reason you might…

Read More…

JRuby FileChooser example

I’m working on the next version of It’s All Text! and it needs a stand-alone editor server. I’ve had a couple false starts other languages but I’m thinking it should be Java or JRuby so that it is fairly portable without me having too much grief. In addition, installing Java is a little more acceptable to a random group of people than installing Ruby (at the moment, it may change in the future).

Read More…

Code Retreat

I had a wonderful time today doing a Code Retreat at my work.

The principle is simple. You spend 45 minutes pair programming with someone writing code for Conway’s Game of Life. When the 45 minutes are up, you delete all your code, take a break, and do it again with a different partner.

Read More…

Thematic featured images

I was wondering what the “Featured Images” box was when creating new posts and discovered that it’s a handy way to add images to a post. It auto resizes, crops (if you want), and can make it just “work” in your layout. The only drawback I’ve seen is I can’t use URLs for the image.

Read More…

Setting up CEDET/ECB for Aquamacs

Aquamacs 2.1 is now out.

UPDATE [2011/08/04]:

Aquamacs 2.3a (the latest at this time) has CEDET already in it; skip the part about installing CEDET. I still recommend creating the site-start.el file for CEDET but beware the differences between CEDET shipped with Emacs and the stand-alone version. When you get ECB, you need a version newer than 2.40, which at this time means getting the CVS version.

Read More…

bash: Checking a port number

Nucella lapillus

Ever needed to check if a given port number is valid in bash? It’s harder than it looks because if you accept any input from the user, you can’t use declare -i since it spews errors and aborts functions with malformed input.

Read More…

IAT on Cygwin

For those that use Cygwin on Windows, Mike Hostetler has a post detailing how to use Cygwin editors with It’s All Text!

Read More…

Two ways to improve OS-X...

I found this excellent article, Mac OS X SSD tweaks by Ricardo Gameiro, and have stolen two of the ideas for my non-SSD MacBook Pro laptop. I’ll cover all three, though, since I don’t agree with his hibernation trick.

Turn off “atime”

This is pretty simple. Setting noatime turns off recording of when files…

Read More…

Ruby Debugging

There is a ruby-debugger gem which is very handy for trouble shooting problems in a ruby script. The built in debugging is quite powerful and worth learning to use.

Read More…

Stupid Git Trick

This was one of those dumb things that I should have figured out earlier.

If you use emacs for editing then you probably have a customized .emacs file. Even if you don’t, your system is probably loading a boatload of features for emacs.

Read More…

Logging while monitoring a shell script

You may be familiar with redirecting the output of your shell script to a file using exec

However, what do you do if you want monitor the output while logging at the same time? I just figured this out (probably again, since I tend to forget things… which is why I’m blogging this).

Read More…

It's All Text! 1.4 (FF3.6 compatible)

I have just finished Firefox 3.6 after working like crazy since FF 3.6 came out.

Read More…

Firefox Fix

I have a tendency to switch my default browser every so often. I like playing with new toys.

I just switched from Safari to Firefox 3.5.5 and discovered I couldn’t stand the way external links open in new tabs though I wanted new-window links such as target="_blank" to open in a new tab.

Read More…

Smoking craters are good

Every wondered how to make bulletproof software? What tricks do the guys who build bank machines use to be sure their software doesn’t ever crash?

Look no further!

History

Tandem Computers used to make Non-Stop fault tolerant hardware and software. Their premier system was a million dollar Mainframe system…

Read More…

RVM: ruby version management

I just discovered RVM, a tool for managing multiple versions of ruby on the same system. This is really useful on my MacBook Pro, since the built-in Ruby “has problems”. Such as having gems in weird locations which makes updating them difficult. Plus the fact that the OS X updater may clobber your…

Read More…

DWPS: iKlear

A quick Doctor What Product Suggestion: The iKlear Complete Cleaning Kit is great.

I thought at first that it was a stupid overkill for the price; I mean it only has a few cloths and some cleaning solution.

Read More…

Happiness is a warm SCM

Linus Torvald posted on his blog ”Happiness is a warm SCM“:

Part of the problem is that ‘git’ is such a flexible tool that you can use it in various modes, and mix things up freely. The whole distributed nature means that there’s no gatekeeper, you can do whatever you want. And the flexibility and power is good, but it does mean that it’s also easy to make a mess of it - the old UNIX philosophy of giving people rope, and letting them hang themselves with it if they want to. So it takes time for people (me included) to learn the rules that work. And it seems people are learning. And that feels really good.

Read More…

IAT in LJ

The Linux Journal’s Associate Editor Mitch Frazier has done a one minute video on It’s All Text! that is really handy to show what IAT can do:

Read More…

Scripting on Android

There is a nifty new project for the Android phone: Android Scripting Environment.

This lets you use Lua and Python to write scripts on Android. Not quite the same as writing a whole application in those languages, but a great start!

Read More…

Useless Error Messages

I’ve had the misfortune of having to work on getting a product to work as an ASPX script instead of the CGI it was originally.

This is a misfortune in two ways:

  1. I’m not an experienced Windows developer. The last time I used Visual Studio was when it was version 1 while welding a copy of the first edition of Charles Petzold’s “Programming Windows”.
  2. Windows is horrible to do anything out of the ordinary in.
Read More…

Lots of cool software cheap

If you haven’t heard of MacHeist, then you should go check it out right now. It’s only good for four more days. What they do is sell a bundle for \$39 that includes lots of different mac software from different vendors.

They exact amount of software you’ll get depends on how many people sign up. As each milestone is met, another package is unlocked. 25% of the $39 goes to one of their 10 charities (or split between all 10), your choice.

Read More…

Comparing "duh" sizes

The
NeXTStationUber geek-star Wil Wheaton blogged about the magnitude of a “duh” moment he had recently. Warning: avoid Wil Weaton’s post if don’t want spoilers for the D&D campaign “Keep on the Shadowfell”. My post doesn’t have any spoilers, though.

Go read Wil’s post so I can properly compare magnitudes with Mr. Wheaton. I’ll wait.

Okay, pretty funny, right? But I think I can one up that.

Read More…

Wifi Tethering via the Android

Warning: This article is very out of date and no longer applies.

In my post ”How to beat the iPhone” I mentioned that an ideal device would be a portable wifi hotspot.

Well, now one exists for the G1: android-wifi-tether project.

Read More…

New Look!

Alrighty! I have me a new look and it is FRESH. 😉

I got sick of working around some of the problems in sandbox. I don’t want to maintain an offshoot of an existing theme (or worse, code my own); I’ve done that before it I don’t like it.

So using some simple patches to add some extra semantic markup to the default wordpress theme, I created this page.

Read More…

Aquamacs vs. Dvorak-Qwerty layout

I love Aquamacs Emacs. It totally rocks.

However, I use the Dvorak-Qwerty keyboard layout (AKA DQ) and Aquamacs doesn’t like the command key bindings that the DQ layout uses. DQ is dvorak except when you use the command key. Then it becomes QWERTY. This was invaluable when I first started using OS-X since it matched all the docs.

Read More…

Learning Java

Since I have an Android phone I have to write software for it. To write software for the phone, I have to use Java.

I’ve been looking around for something like Dive Into Python but for Java. So far, no luck.

Any recommendations would be very welcome.

Read More…

Google Phone

Robin and I both got Google phones while in New York over the holidays. She bought a G1 and I ordered the ADP1.

I’ve been working my way through ”Hello, Android” by Ed Burnette. So far it’s been decent. You can get 30% off (till 2009/1/31) using a special code. I bought the PDF and paper book for less than Barnes and Nobels is selling it down the street. Good deal, I think.

Read More…

IAT made Network World

Cool! It’s All Text! made it into Network World in 10 Firefox add-ons for better browsing.

I’ve had software in magazines before (actually shipped on CDs) but this is the first time in an English magazine.

Read More…

Switched from YUI to jQuery

I just switched my (rather limited) JavaScript from YUI to jQuery.

jQuery took a little (a couple hours) to learn how to write something close to idiomatic code. My new code is much smaller and easier to read.

Read More…

Xen Networking

Gerf.Org just switched to Xen. It’s running in a domU on hardware that is massively more powerful than it used to be. The original hardware (until about 3 years ago) was a 333Mhz box with 20gigs of disk-space. Since then it has been running on newer hardware. However, the hardware was flakey and getting flakier.

Read More…

Designed For Reliability

I used to work for Tandem. These computers were amazing and the only thing that’d take them down was human error…

Here’s a “Daily WTF” about the Tandem computers. The comments are fun, too: Designed For Reliability

Ciao!

P.S. Yes, I’m having fun with the “Press This” feature in Wordpress 2.6.

Read More…

OS X: Make an ISO

You can use Disk Utility to create ISO images in Mac OS X:

  1. Click “New Image+” on the tool bar
  2. For “Image Format” select “CD/DVD Master”
  3. For “Encryption” leave it at “none”
  4. Rename the resulting .cdr file to .iso

I found this handy hint on the Internet as well. To convert a .dmg file, you can use hdiutil to convert it!

Read More…

BBS the Documentary

There is this great documentary called ”BBS the documentary” by Jason Scott. It’s an amazing documentary about computer bulliten boards and it’s 5 and 1/2 hours long with tons of extras.

For those who don’t remember BBSes: You would use a modem to dial up a computer system that had one or more modems and you could send messages (like email) and download files (like ftp) and play online games.

Read More…

The web belongs to the viewer

The single most important fact that web site owners forget is that the web belongs to the viewer. It doesn’t belong to the web site owner; they don’t control how the viewer will use the site.

This video is a perfect example of this (3 minutes, 30 seconds):

Read More…

msnbot: the stupid bot

Generally, most people with websites want to have their sites indexed so that people can find them.

However, if the bot is really really stupid, then maybe it isn’t in your best interest.

My experiences with msnbot have been pretty much negative.

This site has 15% of the searches supplied by…

Read More…

Mac Tricks: Shell Script Dialogs

As you may know, I have had a MacBook Pro (15” - glossy) for a few months now. I am starting to feel pretty comfortable in it and have started to learn more of the advanced features that I don’t need to get things done, but because I like learning how stuff works.

In this case, I discovered how to create dialogs from the command line or a shell script. In Linux, I’d use gdialog

Read More…

X-UA-Compatible and IE8

There is a new META header being proposed called X-UA-Compatible. It was thought up by Aaron Gustafson and has been added to IE8.

This is a flag for browsers to change how they render the web page, not by standards that are being followed, but by the browser that it is known to work with.

Read More…

Bang! Bang!

So, me and my wife got home from Ikea with a new Billy bookshelf for the dinning room (aka, book room #2 — book room #1 is the living room). We lucked out and found a spot nearly in front of our house, right on the outside of the curve that our house in on.

We unloaded the shelf (it weighs a bloody ton) and had just finished getting it together when I heard a bang noise. I thought perhaps the storm door was open and the wind pushed the door open or shut.

Read More…

My laptop has died

My laptop has died a horrible death and I’m not happy about it. I bought it about 3 years ago from Linux Certified, way back when Linux laptops was a novel concept.

It flat out won’t power up. There is power from the power cord (checked it with a multi-meter), but the light won’t light, the power…

Read More…

GTD and Mutt

I found this article about Getting things done with mutt. It talks about using the techniques from David Allen’s productivity book ”Getting Things Done: The Art of Stress-Free Productivity. I’ve been reading GTD for a week now (taking my time, you know) and think it’s pretty interesting.

Since Mutt is my favorite email client, I spent a little playing with it and making changes. I’m using a different editlabel

Read More…

It's All Text! v0.8.0

I have just released version 0.8.0 of ”It’s All Text!”, the Firefox extension that answers the age old question, “What happens when you give a yo-yo to a flock of flamingoes?”1

Read More…

HX-20

I was walking through Squirrel Hill today with Robin and my Dad. There was a house with some junk on their porch and a sign saying, “For sale. $1 each.” I looked through the stuff and found an Epson HX-20!

Oh. My. Gawd!

When I was in High School a guy named Randy had a TRS80 Model 100 portable computer (made in 1983). It was the coolest thing. I got him to loan it to me so I could write a small text adventure (only like 6 rooms, but a huge deal at the time).

Read More…

Mashups and JavaScript Security

I found this excellent video Gears and the Mashup Problem of Douglas Crockford (discoverer of JSON) talking about the security problems inherent in Mashups and of JavaScript as a whole.

He proposes a solution involving what he calls vats; a self contained JavaScript interpreter with limited communication to the page. The JavaScript in the page would be the only trusted code running and the code in the various vats would not be trusted.

Read More…

Wordpress User-Agent

Well, I just got a nasty shock!

I got in at the tail end of a thread about the new update notification feature in WordPress 2.3.

One of the comments I read kept ricocheting around in my head. Matt Mullenweg said something about the dashboard RSS feeds transmitting my blog URL. I thought, initially…

Read More…

Site Redesign

I have redesigned my whole site. While a lot changes are visual, there are even more changes in the way the unseen back-end parts have changed.

Previously, I had a modified copy of the default WP 2.x theme (which is based on Kubric theme). It was reasonable markup, but I spent a lot of time modifying the classes and adding containers to hang my CSS off of. In addition, tracking the changes to the default theme was a pain.

Read More…

WordPress anti-spam recipe

Here’s a simple recipe to cut down on comment spam in WordPress. I assume you have basic understanding of Unix commands or can translate them to windows.

Read More…

SimCity DS Landmark unlock codes

Yeah, I bought SimCity DS and found that it had an unlock code for the Washington Monument (a GameStop Exclusive!).

I figured that there were more and searched the web. I found a list, but it was missing one of the monuments (#12). Being the kind of person who can’t stand a missing bit of information, I went looking. I finally found it, but it took some work because none of the lists had the number next to them. So I compiled a complete list to share with anyone else who gets SimCity DS.

Read More…

What language would you like it in?

So I have finally submitted It’s All Text! to Babelzilla, the Mozilla translation site. It took a little work to get in, though. There isn’t anything so simple that I cannot break it. :-)

Their system automagically created a discussion thread and it’ll track changes as I upload them. They have mixed a lot of technologies to produce something pretty spiffy. I know how hard it is to mix this stuff and the fact it works well is amazing.

Read More…

It's All Text! v0.6+

[screenshot]

Get It’s All Text!

I wrote It’s All Text! for myself. When Firefox 2.0 was released it broke MozEx so I went looking for a replacement. The others weren’t very good. So I set about fixing MozEx. It was then that I realized that MozEx had way more stuff in it than I needed and some parts were just a…

Read More…

A bug report from Japan...

Wow! I found a blog post talking about It’s All Text! on a blog called Another 朝顔日記 written in Japanese!

According to babelfish, the author found a silly bug in It’s All Text! (I left out a var declaration) and is explaining the way to fix this. Neat!

Read More…

Containing blocks and offsetParent: the secret of position absolute

Ever used position: absolute in CSS or JavaScript? You probably got it to work reliably. I have in the past. These were pages that I controlled in their entirety and it worked fine.

But when I tried to use it with It’s All Text! for the gumdrop edit button which in injected into any web page that has a textarea, I kept having problems. It was driving me batty. I found something that worked on my simplistic test cases, but it wouldn’t work on gmail. I got it to work on gmail, but it stopped working on trac installations, or Wikipedia. Or if I got it to work on one of those, it’d fail to work on my simplistic test cases.

Read More…

Cleaning up parts of the blog

You may have noticed that I’ve been cleaning up parts of my blog. This is because there were some things that really bugged me: My template was too verbose and was too far off default, my colors weren’t and still aren’t ideal, my text formatting was done through a plugin I increasingly came to dislike, and I moved my feeds over to feedburner.

Read More…

It's All Text!

Have you ever had to fill in a form on a web page and wished you could open it in an editor? If you use lots of blogs, post lots of comments or file many bugs then you probably get annoyed at the lack of true editor commands.

I’ve seen some solutions that embed a JavaScript editor into a textarea on demand. Generally, I don’t like them. They are re-inventing a wheel. Especially since I like my particular flavor of wheel, Emacs, though I have no problem with other flavors.

So when I discovered the Firefox extension MozEx I was a very happy hacker indeed. But as time went on I didn’t like the way the extension was going. It was trying to solve a problem I didn’t have; it wanted to add handlers for things like ssh://, etc. and I didn’t need that. I needed an external editor!

Read More…

Making JavaScript transparent

A disclaimer: I’m writing this just to share (and record for myself) this one stupid trick in JavaScript. While I’m here, I thought I should kvetch about most JavaScript usage.

First, the stupid trick.

Have you ever been on a page and you try to control-click or right-click on a link only to discover that the link is something stupid? Such as:

javascript:window.open(‘http://someurl/’);
The underlying HTML for this looks like so:
You should click on this:
<a href="javascript: window.open(’http://someurl/’); ">link</a>

What this is is a popup link. When you click on it and it’ll pop up a new window. It isn’t a real URL. It can’t be opened in a new tab. It cannot be bookmarked. It cannot be saved. It doesn’t work if JavaScript is disabled or has a bug in it.

The solution is one of these things that should be obvious once it’s explained. Instead of making the href useless by filling it with the javascript: junk, you use a real URL. And then use the onclick attribute to fetch the href and open it in a new window.

Example:

You should click on this:
<a
    href="http://someurl/"
    onclick="try{window.open(this.href,’_blank’);
               event.returnValue = false;
               return false;}
               catch(e){event.returnValue = true; return true;}"
    >link</a
>

This will work even with JavaScript disabled. It’ll work even if I made a mistake in the JavaScript. The event.returnValue = boolean and return boolean parts are important. If you return false then the browser will assume that the onclick event isn’t handled and won’t continue. If you return true or don’t use return, then the browser assumes that you didn’t handle the onclick event and then do the normal thing (open the link). And IE 7 needs the event.returnValue and won’t hurt any other browser.

Now, onto the kvetch.

Notice that this isn’t much harder. Notice how this is easier to validate. Notice how it delivers to the user the expected behavior.

Why isn’t this done more often. I hate it when I visit some site, hover over the link to see the URL and get JavaScript junk instead.

This requires more work when you have a complicated URL to generate, but with the ability to change the DOM tree directly there is no excuse.

Keeping everything working the way your user expects it to work is an important principle in user interface design and engineering. Ignore it at your peril.

UPDATED 2006-1-12

Okay, for those keeping score, IE 7 continues the tradition of sucking.

I can add another bug to IE 7’s growing list. I tried to make a simple test case. But when I make it simple it starts working correctly. Bah. I don’t have enough patience or desire to do this much work — for free — for a company with as many employees and dollars as Microsoft — for a browser I don’t own and only use to find and fix bugs like this.

Basically, under certain circumstances, onclick’s return value is ignored. In this case, we had an A tag that used the trick mentioned above. So that meant the popup url would appear in both the parent window and the popup window.

The work around? Set event.returnValue right before returning. Bleh. The code has been updated.

EDITED — Related links:

Read More…

Cosmic Wimpout for the Palm

CWimp for the Palm

Way back when, I wrote a version of Cosmic Wimpout for the palm.

The page that had the links to the sources, the bug tracker, etc. have been slowly decaying. Since I have moved to a new webpage I decided to move Cosmic Wimpout over to Trac.

Link: CWimp on GitHub

Maybe someone will want to work on…

Read More…

Moving to a blog

My first web site went live when the Mosaic (The original web browser; made by NCSA.) web browser was released.

My website, my skills and my interests have all evolved over the years. I have tried things like Zope, PHP, server-side includes, and even Front Page.

The problem is: I really don’t want to have to manage the nuts and bolts of my site.

Read More…

My older projects have been moved.

This is really just administrata, due to my recent move to wordpress.

I had been moving my stuff over, bit by bit into a Trac installation (linky) but some things didn’t really fit into it. One of these days I might make a Trac for all my miscellaneous projects. Meanwhile, till then, here is some links to these old unloved projects.

Read More…