Skip to content
Aug 31 10

How to Set Up Public WiFi at a Small Business

by mrchris

This is a quick writeup of how I set up public wifi access at a small business. The method employs two routers sharing one cable modem connection. This allows a point of sale (POS) system and the public wifi to be on separate networks. This prevents anyone from trying to sniff out credit card transactions. It also uses some basic quality of service (QOS) settings to prevent people from hogging bandwidth from the POS system. Here’s what you will need to duplicate my setup.

Now for the setup.

  1. Download and install the Tomato firmware onto the wireless router. Tomato makes a wireless router much more stable and adds features that you’ll never have with the stock Linksys firmware such as real time bandwidth monitoring, QOS settings, and much more. Carefully read and follow the instructions included in the download. If you do not know what you are doing you can brick your router so don’t skip reading the installation guide.
  2. Attach the cable modem to the WAN port of the wired router with a patch cable.
  3. Enable DMZ on the wired router and connect the DMZ port of the wired router to the WAN port of the wireless router with a regular network cable.
  4. Attach the POS system to an available LAN port on the wired router.
  5. Set the routers to be on different subnets. For example, set the IP of the wired router to be 192.168.1.1 and the IP of the wireless router to be 192.168.2.1. This will prevent DHCP conflicts.
  6. Change the default admin passwords for both routers to something else.

At this point the setup should be working and all connected computers, wired and wireless, should have internet access. All that’s left is to enable some QOS setting to ensure the POS system will always have bandwidth. This step is optional but could save a headache later on in the event someone decides to abuse the wireless network.

  1. Run an internet connection speed test and note the maximum upload and download bandwidth.
  2. Enable QOS in the Tomato settings on the wireless router.
  3. Under the QOS “Basic Settings” page set the inbound and outbound limits to be a little less than the values from the speed test. In my case I left a quarter of the upload and download bandwidth for the POS system just to be on the safe side.
  4. Save your settings. Confirm the settings work by running separate speed tests for each router. The speed for the wireless router should go only to what you set the limit to be.

That’s it! The total cost of this setup is easily less than $100 and in my experience has been very reliable.

Aug 2 10

Wireless with Arch Linux on the Dell Mini 9

by mrchris

Recently I’ve gotten into Arch Linux. Its flexibility, documentation, and well thought out method of configuration make it an excellent distro. I’ve also been running it primarily on my Dell Mini 9 netbook. This computer has a pesky BCM4312 wireless card from Broadcom. Here’s how I dealt with it. Criticism and suggestions welcome.

This is assuming that you’re using Network Manager. The b43 drivers just don’t work with WEP or WPA making it pretty much useless. First install the broadcom-wl drivers. Then install Network Manager. Now you’ll probably notice that still nothing seems to work; not even iwconfig or any of the other command line wireless tools.

The problem appears to be a bug where anything related to wireless networking with the broadcom-wl driver only works as the root user. A quick workaround for this is to enter visudo in the command line and add %wheel ALL=NOPASSWD: /usr/bin/nm-applet at the end of the file. Save and close. Reboot.

That should get you up and going at least as far network manager is concerned. My final solution for this is to just replace the wireless card with something more Linux friendly. I hope this helps.

Jun 21 10

Making VirtualBox More Seamless

by mrchris

VirtualBox is one of my favorite Virtualization tools. While my primary OS is Linux I still need to visit Windows from time to time to test in IE, Safari, or to use some specific oddball program. The latest versions of VirtualBox starting with version 3.2 has a new feature that makes these trips to Windows a little less painful.

Many are aware of VirtualBox’s seamless mode. For those who aren’t see this video to understand what it is. While seamless mode is old news, what isn’t is the ability to launch applications in the guest operating system directly from the host with the VBoxManage command line tool. For example, running Linux as the host OS and Windows XP as the guest I can launch IE with the command

"VBoxManage guestcontrol execute "Windows XP" "C:\Program Files\Internet Explorer\iexplore.exe" --username windowsusername

Replacing “windowsusername” with the username you use to log in to the Windows guest and “Windows XP” with the name you gave your guest OS in VirtualBox. Arguments can also be passed to the program being launch in the guest OS with the –arguments flag. For example

VBoxManage guestcontrol execute "Windows XP" "C:\Program Files\Internet Explorer\iexplore.exe" --username windowsusername --arguments "http://google.com"

While this is all well and good, it is not exactly convenient. In your respective desktop environment it would be relatively simple to create a launcher that can execute this command but it falls short on truly integrating it with the OS. What about the ability to right click on a file on your host desktop and have it open in it’s respective Windows based program. Using Windows notepad as a simple example, here’s how to do just that.

First, be sure that you have the VirtualBox guest additions installed. Then, in your VirtualBox settings, create a permanent shared folder in your guest OS to your host’s home directory. This will give it the access it needs to open files from your host’s file system.  After that, in “/usr/local/bin” create an executable bash script named “notepad” and paste into it this code.

#!/bin/bash
oldPath=${1//\/home/\/\/VBOXSVR}
newPath=${oldPath//\//\\}
VBoxManage guestcontrol execute "Windows XP" "C:\Windows\notepad.exe" --username windowsusername --arguments "$newPath"

This simple script takes the full file path that gets passed in and converts it to a valid Windows path. What goes in as “/home/username/Desktop/test.txt” would become “\\VBOXSVR\username\Desktop\text.txt”. The path then gets passed to the guest OS’s program for opening. Save that file and don’t forget to give make it executable with

chmod +x /usr/local/bin/notepad

In your respective desktop environment (mine is Gnome) create a file called test.txt on your desktop and associate the command “/usr/local/bin/notepad” to it. With Gnome this is done by right clicking on the file, clicking “Properties”, going to the “Open With” tab and clicking the “Add” button. An “Add Application” dialog will pop up. In that window, expand the “Use a custom command” dropdown and enter “/usr/local/bin/notepad” into the textfield provided. Then click the “Add” button then the “Close” button.

To get the full effect, put your guest OS into seamless mode then right click on “test.txt” on your desktop, mouse over “Open With”, then click on “notepad”. If you did everything correctly the Windows notepad should launch with the contents of “test.txt”. Here’s a video of the whole thing put together.

This example can be applied to any Windows program. With a little modification, the script can be applied to other guest operating systems as well.

Jun 4 10

Getting Xorg to Work for Ubuntu 10.04 on the iMac G3

by mrchris

If you feel so inclined to install Ubuntu 10.04 on an iMac G3 you’ll find that xorg doesn’t work properly without some adjustment. I found the answer as per this forum post.

Create /etc/X11/xorg.conf then paste the contents from below into it.

# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
# sudo dpkg-reconfigure -phigh xserver-xorg
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
EndSection
Section "Device"
Identifier "ATI Technologies Inc Rage 128 RL/VR AGP"
Driver "r128"
# Option "BusID" "PCI:0000:00:10.0"
# Option "Screen" "0"
# Option "VideoRam" "128000"
# Option "MemBase" ""
# Option "IOBase" ""
# Option "ChipID" ""
# Option "SWcursor" "on"
Option "NoAccel" "on"
# Option "Dac6Bit" "off"
# Option "VideoKey" ""
# Option "Display" "CRT"
Option "UseFBDev" "on"
# Option "VGAAccess" "off"
EndSection
Section "Monitor"
Identifier "Generic Monitor"
Option "DPMS"
HorizSync 59-61
VertRefresh 75-117
EndSection
Section "Screen"
Identifier "Default Screen"
Device "ATI Technologies Inc Rage 128 RL/VR AGP"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Depth 1
Modes "1024x768" "800x600"
EndSubSection
SubSection "Display"
Depth 4
Modes "1024x768" "800x600"
EndSubSection
SubSection "Display"
Depth 8
Modes "1024x768" "800x600"
EndSubSection
SubSection "Display"
Depth 15
Modes "1024x768" "800x600"
EndSubSection
SubSection "Display"
Depth 16
Modes "1024x768" "800x600"
EndSubSection
SubSection "Display"
Depth 24
Modes "1024x768" "800x600"
EndSubSection
EndSection

That’s it!

May 28 10

How to Add Title Attributes to Magento’s Main Nav

by mrchris

You may have heard that it’s good to have a title attribute defined in your most visible links for SEO purposes. Unfortunately, Magento’s main nav does not do this. It’s easy to add. Just follow these steps.

First, copy “app/code/core/Mage/Catalog/block/Navigation.php” to “app/code/local/Mage/Catalog/block/Navigation.php”. Create the needed directories if they do not exist. This will override Magento’s core version and will allow your changes to survive an update.

Next, open the file you just created. Find the the function drawItem then find the line that looks like

$html.= ‘<a href=”‘.$this->getCategoryUrl($category).’”><span>’.$this->htmlEscape($category->getName()).’</span></a>’.”\n”;

And replace it with

$html.= ‘<a href=”‘.$this->getCategoryUrl($category).’” title=”‘.$this->htmlEscape($category->getName()).’”><span>’.$this->htmlEscape($category->getName()).’</span></a>’.”\n”;

That will insert the category’s name into the title attribute. Save and it should be working.

May 18 10

Getting Ack to Work in Vim on Ubuntu

by mrchris

As a Magento developer I often have need to search through hundreds to thousands of files just to find a specific piece of text. The tried and true work horse for this type of operation is grep. Unfortunately, grep is a bit sluggish when it comes to a directory tree as large as Magento’s. Enter ack. Ack is fast. I dare say ack is wickedly fast.

With any great search tool, text editor integration is important. For Vim there’s a great plugin for ack. If you’re running any fairly modern flavor of Ubuntu, when you try the plugin you’ll likely encounter the message ”/bin/bash: ack: command not found”.

According the the instructions on the ack Vim plugin page you have to install it with “sudo aptitude install ack-grep”. After that, you’ll still get “/bin/bash: ack: command not found”. The solution?

sudo ln -s /usr/bin/ack-grep /usr/local/bin/ack

After that, you’ll be searching in Vim at blazing speeds.

Apr 1 10

Gray Cat Is Gray

by mrchris

I’ll admit it. Angela and I are cat people. So much so that we have three of them. Today, that has changed as we’ve just crossed the line from “cat people” to “crazy cat people” by adding a fourth.

In true crazy cat person form, I’m blogging about my feline friends. Today we added a new member to our  family. His name is Gray Cat. It should be known that Gray Cat…is Gray.

I’ll keep this story brief. This is an outside cat from the rental house we used to live in. The first time we saw him he just ran up to us. The whole time we were there we would see him outside and he’d be friendly with us. Yesterday I stopped by to check in on him to find him covered in pollen, leaves, dirt, and what was either blood, poop, tree sap or a combination of all three. He is also not neutered so we can imply that he is not properly cared for. Today, I drove by and rescued him.

Currently he is happily sitting next to me in our garage. The garage is temporary until he gets checked out as not to infect the other cats. It’s odd, he shows no signs of being scared and has already made himself quite comfortable. Anyways, on with the pics. Welcome home, Gray Cat.

Mar 27 10

Simple Secure Screenshot Sharing For Ubuntu

by mrchris

If you’ve ever wanted to share a screenshot with someone, you undoubtedly know the hassle it is to save your screenshot somewhere then share it though email or uploading it to an image sharing site. The need to make this easier has been met for Windows and OS X users for some time now with TinyGrab.

This need has also been somewhat met for Linux users with a great screen capture utility called Shutter. Shutter has the option to upload to a remote server but the way it does is not as streamlined as TinyGrab. First, the upload options is something that you have to do manually after you’ve already taken the screenshot. The second is that you are then left with a copy on your hard drive that you have to manually delete. The third is that it only supports FTP which as most people know is entirely insecure.

I’ve come up with a combination of tools that allows Shutter to function as a much more capable screenshot sharing tool. These tools are a remote server you can SSH into, a web server (lighttpd in my case), SSHFS, and of course Shutter. Here’s how to do it.

The secret to the magic is SSHFS. It will allow us to mount a remote folder via SSH. This makes sending files to that server as easy as drag-and-drop and since it goes through SSH it’s encrypted and secure. Now then, let’s get started. Please note that this example will assume this is all being done with Ubuntu so modify this tutorial for your distro.

1. SSH into your remote server and create a folder on the file system which will contain your uploaded screenshots. Throughout this tutorial, remember to replace “myhost.com” with your remote host’s URL and “remoteuser” with your username.

localuser@localcomputer:~$ ssh remoteuser@myhost.com
remoteuser@remotecomputer:~$ mkdir ~/screenshot_uploads

2. We need a web server to make our screenshots accessible over the internet. Assuming that there isn’t a web server already installed, a simple need such as this is easily met by lighttpd.

remoteuser@remotecomputer:~$ sudo aptitude install lighttpd

3. Point the web server document root at our screenshot_uploads folder. To do this open “/etc/lighttpd/lighttpd.conf” in your command line text editor of choice and set “server.document-root” to “/home/remoteuser/screenshot_uploads”. The end result will look like

server.document-root = "/home/remoteuser/screenshot_uploads"

Normally it is not advisable to assign the entire document root to such a folder. This is going under the assumption that this web server will be used for nothing but screenshot sharing. If your needs are different you should modify this part of the tutorial to fit them. After you’ve made the change, restart the web server.

remoteuser@remotecomputer:~$ sudo /etc/init.d/lighttpd restart

At this point, your screenshots folder should be accessible from http://myhost.com. Be sure port 80 is open for that your remote server.

4. Log out of the SSH session  and install SSHFS.

remoteuser@remotecomputer:~$ exit
localuser@localcomputer:~$ sudo aptitude install sshfs

5. Now we can mount our remote folder to our local machine. We will assume that our local folder is /home/localuser/screenshots.

localuser@localcomputer:~$ sshfs remoteuser@myhost.com:screenshot_uploads \
/home/localuser/screenshots

Now anything placed in /home/localuser/screenshots will be automatically sent to the screenshot_uploads folder on your remote server.

6. If you haven’t done so already install Shutter. Then open Shutter and go to Edit->Preferences and set the save directory to be your SSHFS mounted folder. You may want to consider mapping the take screenshot action to a keyboard shortcut. After that it will look something like this.

Shutter Preferences Shutter Preferences 2

That’s it! Take a screenshot, point your browser at the URL for your web server, grab the link and send it to your friends. Truthfully, you can use any screenshot tool and point it at your sshfs mount and it will give you the same result. Shutter just does it in a much more polished fashion.

There are some final considerations. There are the piles of screenshots you’ll undoubtly accumulate from using this nifty setup. On my server I set a daily crontab command to clear out that directory. Another may be have your SSHFS mount set up automatically at boot time. This could be done by registering a public key for your computer with the remote server and adding an entry to the /etc/fstab file that looks like this.

sshfs#remoteuser@myhost.com:/home/remoteuser/screenshot_uploads /home/localuser/screenshots fuse user,auto 0 0

Happy screenshot sharing!