Tag Archives: Linux

Debugging MSSQL Connections from Ubuntu

You might need to install a fair bit of stuff,

sudo apt-get install unixodbc unixodbc-dev tdsodbc freetds-dev freetds-bin -y

There’s a neat trick you can do to automatically configure FreeTDS on you Ubuntu machine (discussion here: https://gist.github.com/rduplain/1293636)

sudo dpkg-reconfigure tdsodbc

This will write data to /etc/odbcinst.ini for you. This file configures which drivers FreeTDS will use. You could write this by hand, but this operation reduces the risk for error.

I was trying to access a remote server using pyodbc and I was providing a connection string like,

import pyodbc
conn = pyodbc.connection('DSN=<dsn>;UID=john.doe;PWD=<password>')

For some reason, I wasn’t able to connect at all. It turns out that I needed to put a space after UID… it’s weird, but it worked. Maybe this is because there was a dot in my UID? I’m not sure. You can also set the UID and PWD in /etc/obcd.ini, but that’s probably not ideal.

If you’re stuck, you can list the connections on a given host with this,

tsql -H <host> -L

You’ll probably need to install tsql, which I think is located in the freetds-bin package listed above.

Use Vagrant to Manage an OEL6 Virtual Machine

Vagrant is a tool that you can use to set up, configure, and access a VM through the command line. This is a life changer. I love it. In this post I’ll walk through setting up an OEL6 virtual machine, installing a non-ancient version of Python, and configuring the port forwarding so that you can use it for backend web development. (The port forwarding is not obvious on RHEL/OEL.)

Continue reading Use Vagrant to Manage an OEL6 Virtual Machine

Handle EADDRINUSE Error in Node

When a node application crashes unexpectedly, you might get a EADDRINUSE, Address already in use error when you try to restart it. This means that the port you’re using is already being used by the crashed application. What you need to do is fun the PID of that process, and then kill it. There’s more than one way to skin that cat, but I like to use netstat. N.B. You’ll need to run this as sudo for it to work.

Continue reading Handle EADDRINUSE Error in Node

Using tmux

I found this great tutorial on tmux by Daniel Miessler that was designed to take you from “wtf tmux” to “omg tmux” with extreme haste. I’m reproducing parts of that blog post here because I find myself googling it at least three times a day. (Because it’s that useful.) Briefly, tmux is a utility that allows you to connect to a remote server, start a job, and then log off without quitting your job. When you log back in from another location, you can access that job again through tmux. The screen utility also does this, but not as well. For instance, if you have a really long username, then you might not be able to start screen, because edge cases.

Continue reading Using tmux

Two Quick Nim Scripts

Today I Googled something like “julia lang compiled” for the umpteenth time in several months, and then I remembered that Nimrod existed, except it’s Nim these days, and it might make it to version 1.0 any week now. I decided to look around a bit, and I discovered that the documentation seems to have improved, and the language has gotten more fleshed out. I decided to try two small things I’ve been doing a lot of lately, SSH-ing and HTTP-getting and posting, and see what they look like in Nim.

Continue reading Two Quick Nim Scripts