Archive for the ‘Technology’ Category

Running pfSense on my home LAN

Saturday, July 4th, 2009

I just got pfSense running on my home LAN. I had a cheap Walmart/Everex PC that wasn’t doing anything. And with the three day weekend I realized that I could use it to create a better home network. I added an Ethernet card that I had plus a new Linksys 10/100 Ethernet card that I found at my local Target for $11.99. This gave the computer 3 network interfaces: WAN, LAN, and Opt1WiFi. I have DSL service, so I hooked the WAN interface of the computer to the DSL router. The WAN interface gets a DHCP address. I hooked the LAN interface to an Ethernet switch that I had around. The LAN interface is configured with a DHCP server. I can hook a laptop into the LAN switch, get a DHCP lease from pfSense, and access the WAN interface out to the Internet.

Yeah, yeah, this could also be done with a typical router like the Linksys WRT54GL. Well, I do have a WRT54GL, which I hooked to the Opt1WiFi interface on the pfSense server. So the WRT54GL also has a concept of a WAN<->LAN interface. In my new configuration the WAN side of the WRT54GL is receiving a DHCP address from the Opti1WiFi interface and the DHCP service of pfSense. The LAN side of the WRT54GL is providing addresses via WiFi (which is how I am posting this from my laptop).

So why have both the pfSense server and the WRT54GL? What the 3 interfaces of the pfSense server allow me to do is separate the WiFi traffic from the LAN. I can add a firewall rule in pfSense to only allow the WiFi traffic from the Opt1WiFi interface to the WAN and block access to the LAN. This will allow me to have services on the LAN network interface that are protected from any WiFi connections.

But what if I want my laptop, connected over the WiFi network, to access my home LAN network? I believe that there are a couple different ways the pfSense will allow me to do that. But that is another task for another time. Because at this time, there isn’t anything (yet) running on my new LAN network segment.

Authenticate via OpenID

Wednesday, March 18th, 2009

You can now use OpenID to authenticate at this blog! w00t!

I have just installed the Wordpress plugin OpenID (version 3.2.1). Installation was very simple: just upload the “openid” directory to the “plugin” directory and then active the plugin. The plugin allows you to assign multiple OpenIDs to your account to log in to your blog account.

Google can sort

Saturday, November 22nd, 2008

Google recently announced that they were able to sort 1 terabyte (TB) in 68 seconds using 1,000 computers. The previous record holder was 209 seconds on 910 computers. I was impressed by this because I recently read about MapReduce and have been studying some of Google’s papers about the Google File System. Google used both MapReduce and the Google File System to attain this sorting record. But, being Google, they thought that since they did 1 TB so successfully, why not try sorting 1 petabyte (PB). (A petabyte is a thousand terabytes.) Google was able to sort 1 PB in six hours and two minutes and used 4,000 computers.

Why does Google care about sorting? One reason may be that their primary revenue source is based on advertising. And they have vast access to massive amounts of data submitted by their end users in the form of search queries. The more efficient Google is at crunching this information, the better they can target their advertising to users, resulting in more revenue. And Google can use their data for other purposes too, like predicting flu outbreaks.

I have been very impressed by what I have been reading about MapReduce and the Google File system. These sorting results help prove how efficient their infrastructure is. I particulary like how they use commodity computers to achieve these results. I know that using multiple nodes can get tricky very quickly. But their techniques seem to be designed from the ground up to use multiple nodes. And with this mindset, they can more adequately manage and utilize their collective computing resources.

What I’m reading: locks!

Friday, October 10th, 2008

I have been reading some of the papers published by the Google engineers. It started with Bigtable: A Distributed Storage System for Structured Data. I am not sure how I started. The Official Google Blog posted a link announcing their new technology round series. I watched the “MapReduce” discussion, where the engineers talked about Bigtable and how it is used in MapReduce. This lead me to look for more information about Bigtable as I was looking for information on distributed “communication” techniques to enhance the littles3 implementation. (The current littles3 architecture is very simple and only supports one node. It works, but doesn’t do any cool things like scale storage or be fault tolerant.) I had heard Bigtable discussed in different technical blog settings, but I had no idea that there was a paper from 2 years ago that described the Bigtable system. (I guess I don’t read the technical CS journals like I should. I may have to become more active in IEEE.)

While reading the paper (I did find it very readable. Okay, I am a computer geek. Fair warning.) I noticed that Bigtable, which is a highly scallable distributed database (not relational), used a “lock service” called Chubby. What is a “lock service”? Well, the The Chubby Lock Service for Loosely-Coupled Distributed Systems paper will tell you. I am currently reading this paper. (Again, this is from 2006! Where have I been?) Mike Burrows, the author of The Chubby Lock Service for Loosely-Coupled Distributed Systems, sprinkles humor into a computer science paper discussing Paxos, “a family of protocols for solving consensus in a network of unreliable processors”. What I found interesting is how the “lock service” is used to share information in a highly distributed system. The Bigtable implementation is a client of the “lock service” and uses it to elect a leader; the leader is the node that aquires the lock–only one node will get the lock. The “lock service” can also store small amounts of information, like metadata or configuration information, that a client application can read from the “lock service”.

Next up is the paper Paxos Made Live – An Engineering Perspective. This paper provides some details on how the Google team implemented Chubby, some of the history of the previous implementation, and some of the issues that they discovered implementation the Paxos algorithm.

Together, these papers provide some details of how Google has implemented highly distributed systems. So far, the information about Paxos has been very enlightening. And I am impressed with the way in which a “lock service” is used to coordinate communication and direct cooperation in a automated distributed network. It seems that they have created simple building blocks that together work in sometimes unique ways to make a complex system.

Hello, Android

Sunday, July 13th, 2008

So, July 11, 2008, came and went. What happened on July 11? The iPhone 3G came out.

But I don’t have an iPhone. The other big thing is that the Apple iPhone App Store opened. But I don’t have a Mac, so I can’t run the emulator or create my own apps for the emulator.

So, I celebrated by creating my first Android app.

Hello, Android

This is the “Hello, World” version of an Android app running in the emulator. It was very easy to make. What made it easier for me is that Android apps are written in Java. (I am a Java developer by day.) The “Getting Started” tutorial even shows you how to use Eclipse.

I have only created the sample app so far, but it looks pretty easy for a Java developer to write an “Activity“. But, of coarse, the apps currently can only run in the emulator. But the emulator can be integrated very easily into Eclipse.

Though, it is not like having real hardware like the Apple iPhone. :-)

Arduino ordered

Monday, May 19th, 2008

I just ordered an Arduino Diecimila from SparkFun. I am looking forward to playing with this little device.

Keeping data secure in Google App Engine

Thursday, April 10th, 2008

While going through the “Getting Started” documentation provided for Google App Engine, I noticed something interesting in the “Using the Datastore” section. The datastore included in the App Engine is not a relational database, but it has some similarities. When querying the datastore, you can use GQL, which is similar to SQL. For instance:

greetings = Greeting.gql("WHERE author = :1 ORDER BY date DESC", users.get_current_user())

Notice the parameter replacement where “:1” is replaced with the value of “users.get_current_user()“. The documentation states:

Unlike SQL, GQL queries may not contain value constants: Instead, GQL uses parameter binding for all values in queries.

As Wikipedia points out, using a parameterized statement like this GQL parameter binding is one way to mitigate an SQL injection attack. The SQL injection is mitigated because the parameter value can consistently be properly escaped within the execution of the parameter binding. I find it very interesting that Google decided, in implementing GQL, to enforce the use of parameter binding. This must have been a conscious decision to help App Engine developers to make their apps more secure. I think that this is a good decision.

Worked through the Google App Engine “Getting Started” introduction

Tuesday, April 8th, 2008

I just finished trying out the Google App EngineGetting Started” introduction. I haven’t programmed in Python for a very long time. The introduction was pretty cool.

Except for the problem with Windows in the static file CSS example. I found a discussion about the issue by Googling “App Engine InvalidAppConfigError”. They have a simple work-around to get the sample to work. But it looks like there will have to be fix in the API for the problem to be resolved.

But all in all, this is a pretty neat framework. I look forward to playing with the SDK some more.

(And being a pilot, I am a bit biased toward the App Engine logo. You can see it at the home page. It is a jet engine with wings and a vertical stabilizer. :-) )

My first Butterfly program… success!

Monday, April 7th, 2008

My first program, Blinky, from the “C Programming for Microcontrollers” book has been downloaded to my Butterfly ATMega169 and works. The program cycles through 8 LEDs, turning one LED on at a time. It looks like the Cylon robots (old school – or the newer Cylon Centurions from the new series) robots. (Or the original KITT from “Knight Rider”.)

I had a problem initially with downloading the “hex” file to the Butterfly. It appeared to be the serial port… ahhhh, serial ports. So, if you get the Butterfly++ Mini-Kit, you get a DB-9 female connector and some wire. The “Butterfly++ Mini-Kit Assembly Instructions”, and the book, instruct that you are to wire the DB-9 connector to certain holes on the Butterfly. The instructions indicate that you cross the transmit and receive lines from the Butterfly to the connector. Okay, all is good… so far.

It is very hard to find a serial cable now: USB rules. But I did find a USB-Serial adapter at Best Buy. One end is a USB connector and the other end is a DB-9 male connector. I installed the driver, for Windows XP, and installed the cable. It installed like a charm as “COM5″. I was able to use the terminal program provided on the CD with the book and use “COM5″ and communicate with the built-in Butterfly program to set my name for the “name tag” function of the factory-programmed Butterfly.

But then when I used the provided AVR Studio to try and download the Blinky program to the Butterfly, AVR Studio couldn’t find a suitable device. Hmm. It appeared the AVR Studio provided on the book’s CD wasn’t working with the USB serial device. I even tried upgrading to the latest AVR Studio downloaded from the Atmel site. It still wouldn’t program.

I did have a “real” serial port on my computer, which is a DB-9 male connector. But I couldn’t find a DB-9 M-F connector in my collection of cables. I had null modem DB-9 F-F and DB-9 M-M (null modem cables have the transmit and receive links cross-linked). Then I thought, wait! The Butterfly has a DB-9 female connection and the computer has a DB-9 male connector; just hook them together. The problem is the Butterly DB-9 female connector is connected to the Butterfly with about 2.5 inches of wire. So it took a bunch of rearranging to get the Butterfly close enough to the serial port on the computer, which is in the back of the computer. But I was able to get the Butterfly, the power supply, and the breadboard with the LEDs for the Blinky project close enough. Now, with the Butterfly directly connected to “COM1″, the AVR Studio found the device. I was able to download and program the Blinky.hex file. After successfully downloading to the Butterfly and cycling the power to the Butterfly (and moving the joystick “up”), Blinky started up and blinked the LEDs, sweeping back and forth.

So it appears that I need a DB-9 M-F “straight through” serial cable. (I have seen this type of cable referred to as an “extension” serial cable too. No wonder everyone likes USB better-it just seems to work, but it is more complex at the signal and component level.) I was able to find at Cables for Less a six foot DB-9 male to female cable for $1.89. I ordered it. With shipping the total came to $8.48. Hopefully it will come soon so that I can get the Butterfly out from behind my computer. But at least I have successfully tested the ability to program the Butterfly.

(I think that there is some way to download the hex file using avrdude instead of the AVR Studio. This may allow the USB-Serial adapter cable to work on “COM5″. But I haven’t had a chance to try that yet.)

Butterfly++ WORKS!

Saturday, April 5th, 2008

AVR ButterflyI had purchased a “Book + Butterfly + Projects Kit” from Smiley Micros some time ago. The AVR Butterfly is a demonstration board for a Atmel AVR ATmega169PV microcontroller. The package that I purchased included, in addition to the Butterfly, a book and some components in the “project kit” to execute the samples from the book. The first thing that you have to do is add a connector it the board so that you can add a serial port connection. The serial port connection is used to download code to the microcontroller. The kit includes some wires and a female DB-9 connector which you get to solder together. I did it (successfully). The kit also includes a battery pack that you get to mod to add an LED as a power indicator and some headers to solder to the Butterfly to make it easier to attach and reconfigure wires to the device.

After performing this preliminary soldering, I followed the test procedures to make sure that it works. I was able to power the Butterfly from the external battery source and download my name via the serial port to the Butterfly. (The Butterfly has a sample program that will display your name on its LCD display.)

Now that the preliminary work is done, I can try the samples from the book… (I am finally putting my EE degree to use!) and maybe write my own code. (Yeah, I do write code, like web applications, for a living. Not usually something as cool as making blinking LEDs!)