occasionally useful ruby, ubuntu, etc

17Feb/130

Why not HTTPS every page?

It frustrates me to no end when I find login pages served from insecure (HTTP) pages (I'm looking at you, VerizonWireless and CenturyLink). I'll often put in garbage credentials and hit submit so it'll redirect me to a secure version of the login page with the "invalid credentials" error on top. But it occurred to me, this isn't much safer either.

Filed under: security Continue reading
25Nov/120

Discovering a Good Site Name with Mechanical Turk and AYTM.com

Inspired by a post from Software by Rob [1] and in turn this Pixlin [2] post from 2007, I decided to give Mechanical Turk a whirl to help me come up with a product name. I'm going to talk about my experience and how I actually went about doing this.

21Oct/120

Finding a Freelance UX Designer?

Question to any readers who've done this sort of thing before -- where do people normally go to get UX Design work done for them? Specifically, I have some ideas for a web app I want built, but I don't have the UX chops nor visual chops to design the interface. I want someone to take my written designs and talk to me to come up with some wireframes, which I can then iterate on with the designer before moving onto the visual design phase. Anyone have experience in this area?

Filed under: web 2.0 No Comments
6Oct/120

Telling Android to Conserve Data on Mobile Hotspots in Android 4.1

So it turns out there actually is a way to inform your device (as long as it's Android 4.1 or above) which WiFi networks are actually mobile hotspots. It can't (or doesn't, anyway) do this automatically, and having your other devices connect to your mobile hotspot and then download large program updates is no fun! So I discovered the somewhat elusive option in the settings and thought I'd share.

Filed under: android Continue reading
24Jul/120

Quick Start with Sequel 3 in Rails 3

This guide is using Rails 3.2.6 and Sequel 3.37.0. If you're using a different version, these instructions may not quite apply.

Edit: realized this morning the title was ambiguous, so I updated it to reflect the Sequel focus.

Here's the easiest way to get going with Sequel in Rails:

24Jun/120

Promising Java Installers

I was digging around for some good Java installers; that is, programs that can bundle up my Java program and allow them to be installed by end users easily, optionally bundling (or jit downloading+installing) the JRE. I found a few that look promising:

Filed under: java Continue reading
6May/120

How to configure a Zyxel router behind an Actiontec DSL Modem (Centurylink, Qwest)

For many weekends (5?) over the past couple years I've spent hours trying to get my Zyxel NBG-419N to work in "Router Mode" instead of "Access Point Mode" when operating behind our (old) DSL modem, the Actiontec M1000. From juggling DHCP settings, to NAT-enabled settings, to Transparent Bridging, to attempting to configure PPPoE authentication and DNS servers by hand, I had a lot of trouble getting the Zyxel and Actiontec to play nicely together. The end goal was to have the router in "Router Mode" and authenticating with the ISP directly, so port forwarding and UPnP would work better (plus I like the Zyxel interface more). Eventually I figured it out though, and the solution was ultimately a lot easier than I was expecting.

30Oct/112

Sharing session state in Node.js between your HTTP server and websockets server

At first, sharing your session state between your Node.js HTTP server and websockets server might seem difficult. However, if you're using Express and NowJS (or the technologies they're built on, Connect and Socket.IO, respectively), most of the work has already been done for you -- it's just a matter of connecting the right pieces together. An example follows, written in Coffeescript.

30Oct/112

CoffeeScript in Node.js

Here's a couple common development patterns I've come across in Node.JS+CoffeeScript.

Requiring Coffeescripts without compiling

So for the last couple weeks I've been doing Node.js development while using CoffeeScript, but I've been using `coffee -cwb .` in one console (which compiles, watches, and "bare bones"-style on the current directory) while running `node app.js` in another tab. This works okay, but whenever you add a new file you have to restart coffee, and it just seems...noisy. All these extra js files everywhere! Fortunately there's a better way, but it's not really documented.

Before:
require "./my_other_file.js" # compiled from "my_other_file.coffee"

After:
require "coffee-script"
require "./my_other_file"

CoffeeScript registers the .coffee extension automatically. This means no more lingering js files.

Bootstrapping Coffeescripts

Another trick I've discovered applies to times that you have to execute a js file -- `node --debug myapp.js` comes to mind. Well, here you can just make a bootstrap.js file that contains two lines:

require "coffee-script"
require "./myapp"

Now you can `node --debug bootstrap.js` and everything works. Simple stuff.

Loading exports from a module efficiently

Thanks to Coffeescript's destructuring assignments capability, you don't have to write code that looks like this:

MyClass = require("./my_class").MyClass

you can simply write

{MyClass} = require("./my_class")

and it will do the same thing. You can even pull out multiple exports (i.e. {MyClass1,MyClass2}) at a time, though this doesn't come up for me that often.

Conclusion

Hope that was helpful. There are certainly a number of undocumented tricks that you discover when looking at other people's source code :)

p.s. sorry about the lack of source highlighting; don't feel like embedding gists in here. Code is pretty simple anyway!

Filed under: coffeescript 2 Comments
20Aug/112

Recovering your submitted form data in Chrome

Have you ever submitted form on a website after filling in a lot of text (maybe a comment), only to get an error on the other side? And when you hit back, your nice long response is gone? There's a (sort of easy) way of retrieving it, if you don't stray from the landing page after you submit the form -- at least in Chrome.

1) Wrench icon > Tools > Developer Tools
2) Network tab
3) Click on the network request with the same name as the current page (that matches the URL)
4) Click the Headers tab in the right section of the developer tools
5) Scroll down to the section "Form Data" (you may need to Expand this section by clicking the > arrow)
6) Copy and paste your previous response into somewhere safe (Notepad?) while you attempt to resubmit the form or frame your amazing writing for later.

I'm pretty sure you can do the same thing with Firefox, but it would require you to install Firebug.

Filed under: musing 2 Comments