Archive for February, 2009

Stimulus package

I have been, in my short political life, generally a proponent of fiscal conservatism. I also listen to Rush / Hannity every day, so I hear anti stimulus package remarks for the majority of the day.

Why I think it will work
The recent tag line they are using is that if we took all the money from the rich, it still wouldn’t pay for our debt. That point is 100% true. However, creating money and spending it, if you are the government, actually can.

Imagine the scenario of the government handing out money for public transit. In this transaction, every single piece is taxed. Government gives money to company A. Company A pays corporate taxes on it, and all of their employees required pay taxes on it. The supplier for the construction materials and vehicles also pays taxes. Their employees, who also pay taxes, probably buy things for their families. They also pay taxes when they receive their paycheck, and again when they pay sales tax.

In addition, people who could not previously afford transit may now be able to get to work. This creates more productive citizens, and a larger supply of workers, allowing companies to product goods at a lower cost. The houses knocked down for right of way decrease the supply of homes on the market. The decreased supply of homes, combined with the increased value of living within reach of public transit, revives that housing market. There are so many advantages in this idea.

If you can create projects which the majority of money will be spent in a manner in which the people involved will spend the majority of it domestically, the economy will grow without actually losing money.

Inflation to the rescue
The other aspect of this, is that inflation is not inherently evil. When our dollar is strong, or even gaining against foreign currency, it is a better idea to hang onto it. If our currency starts losing value, this would be a great boost to the ailing real estate market. In order to fight inflation, you have to invest in assets rather than holding cash so that you grow with the inflation. Inflation also decreases imports as foreign goods are not as affordable as domestic goods. This will create a boost of manufacturing as people will need to invest to keep their value, and the demand for domestic goods would increase.

In short, not everything is black and white, so just question what these guys say. These ideas have not traditionally worked before, because the world has never seen this level of worker productivity. We can now produce more food than can be consumed, more cars than can be driven, more houses than can be lived in, and more computers than can be operated. The world has changed since the previous economic models where derived.

Tags: , ,

The Cherokee Webserver

Cherokee Webserver Logo

Cherokee Webserver Logo

After seeing some of the performance graphs on Alvaro’s blog, I decided to give Cherokee a shot with a project I am working on. The project I am working on has a web browser on kiosk machines, and runs Django on the backend. I was in need of a fast, secure web server. I have always used Apache in the past, and have used Nginx, so I figured I should investigate Cherokee.
Read the rest of this entry »

Tags: , , , , ,

Python Commands Module

Python logoPython Commands Module

The Python module ‘commands’ allows commands to be ran on the system. I frequently use this in combination with Django to launch processes.

Get a directory listing:

#!/usr/bin/python
import commands
status, output = commands.getstatusoutput('ls')
print "Status: " + str(status)
print "Output: " + str(output)

This program will print out the directory contents of where you ran it from. An important thing to note about programs in Linux in general is that on success they return 0, and anything not 0 is probably an error. I commonly check the status of the returned code:

Check if status is not 0:

if status != 0:
    print "An error occurred!"

This allows us to do some really fancy things with this module. For instance, I created an application that is a django app that provides the user a menu to launch programs. This runs on their Firefox browser, but will launch the programs on their system. Each system runs it’s own Cherokee webserver locally, which is extremely lightweight and fast. To install Cherokee to use django I followed this guide: http://www.cherokee-project.com/doc/cookbook_django.html

The users run as the user ‘autologin’, however the webserver runs under the user ‘www’. This is probably a bit hackish, but it works. What I do is copy autologin’s .Xauthority file to the www user’s home directory, then launch the program as autologin using sudo.

Launch a local X program from a django program:

def launchAutologinXProgram(commands):
    status, output = commands.getstatusoutput('sudo cp /home/autologin/.Xauthority /home/www/')
    os.spawnl(os.P_WAIT, "/usr/bin/sudo", "sudo", "-u", "autologin", "-H", "/bin/bash", "-c", 'export DISPLAY=":0.0"; . /etc/profile; nohup ' + str(commands) + ' &')

Obviously you want to check the status variable and make sure it completed. To do this you need to update your sudoers file to make the www user be able to run commands as autologin. This is for a kiosk type setup, so www and autologin don’t have sensitive data, I am sure there is a more secure way to do it. But it sure is fun.

Tags: , , ,

Finding the difference between two files

Ever need to find what you changed between two files or directories? The universal way to find these differences is to use the ‘diff’ command. The diff command is used by most open source projects, and people use it to communicate their changes / bug fixes etc.

Console using diff

Console using diff

Sometimes I find the diff command to be boring. Much like my terminal prompt, I like consoles to have color. The color helps me figure out what is going on a bit quicker. Do get diffs in color, you can ’sudo apt-get install colordiff’. The resulting output will look like this instead:

Console with color diff

Console with color diff

But there are some people out there who just don’t like consoles / terminals for one reason or another. There is also a GUI based diff tool called meld. You can install meld by running ’sudo apt-get install meld’. Your diff will now look like this:

Screenshot of meld

Screenshot of meld

That is a brief overview of the tools I have found useful, using screenshots.

Tags: , , , , ,

Groupwise 8 + OpenSUSE 11.1

To use the Groupwise 8 client on OpenSUSE 11.1 x86_64 I had to:

sudo zypper in openmotif22-libs-32bit libstdc++33-32bit

After extracting the package, run ./install and it should work.

Tags: , , ,

Getting started with Xorg development

I am doing some work with thin clients, so I wanted to figure out if there is a way I can replicate what I saw in a kvm demo video (Live migration while the client was playing an HD video). I believe they are using a version of the RDP protocol.

I would like to implement an open source alternative, and I figure that starts with Xorg as the protocol itself isn’t optimal for video apps over the network. So like anyone else, I went and did a git clone of the repo.

The question I have now is: is the best way to learn about how it works to just read the source over and over? The xorg wiki is devoid of most details, and the branch I was looking at (dmx-2) is pretty sparse when it comes to comments. Suggestions?

Tags: , , ,

Now standards compliant

Valid XHTML 1.0 Strict

Was looking today at why my blog is so low on searches on google (everyone who aggregates my posts were in the top results, and I was at the bottom). Turns out, I had a big list of links in a UL that was marked as hidden. So if you blog, do yourself a favor and do a ‘View Source’ and make sure it’s sending out what you think it is.

I suppose it was either a Wordpress flaw or because I am on a shared Dreamhost. Might be the catalyst to switch to Slicehost?

Economics

With this supposed economic downturn, for most 1st world countries, I wonder if we haven’t reached critical mass on the supply side. Panasonic announced layoffs because not enough people are buying their tv’s. Demand for cars is in decline also. But everyone I know has a car, and has a TV.

Is it possible that we simply have reached a point where we are efficient enough to produce all these goods to the point where it appears as a weakened global economy? Rather that we make so much so efficiently, that demand just can’t keep pace, and the world just needs those resources reallocated to places where there is still demand?

On a side note, if you have multiple monitors and xinerama, and your mouse stops working randomly, and you are running AMD64 you can download fixed X packages at http://www.sharms.org/ubuntu. My build VM I only setup for AMD64, but the changes in the bug report will build on i386 also.