Archive for January, 2009

Obama’s Inauguration

Obama’s inauguration is more evidence of the “non-change” coming our way. Costing $170 million dollars and coupled with extreme perks for the wealthy it is clear nothing has changed.

His swearing into off IS a huge moment in United States history, but that is exactly what makes it the perfect moment for him to make it clear that we can no longer continue our ways of the past. Instead it is full of wasteful spending and ties to the CEO’s of this nation that thrive on the inequalities he claims to want to fight against.

This is the moment he should speak against these massive inequalities. However, now if he does it will feel empty as you look towards the VIP section and the runways of local airports filled with private jets.

Get real change, dump the bosses and politicians off your back.

Read Full Post »

Paul Krugman had a post today spelling out what he sees wrong with the Obama administration’s current economic stimulus plan and what he suggests to do.

Let me put on my capitalist hat really quick…

Assuming I care to save the economy and not take the chance that a depression and then bankruptcy of the United States would lead to a socialist revolution…

As I am not an economist anything I say can just be swept away, but I think its clear tax cuts are not whats needed. To make sure no one assumes my beliefs when I have my capitalist hat on, neither are tax increases. My understanding is situations like this occur due to having too much stuff and no one to sell it to. How is giving the ability to make more stuff for no one to buy a solution? While we need to get banks lending again to help people keep their jobs and stores able to put products on their shelves, the people who need money are at the the bottom, they are the ones who do the consuming.

Spending on creating jobs, increasing time allowed on unemployment, increasing spending on social programs, getting health care for all, etc to me seem like the obvious places the government should be pushing its money to not only help the people who need it but to keep disastor away.

If money that would be thought of as “tax cuts” is instead spent on infastructure projects it means more jobs, more money in the hands of those likely to spend it and better cities, towns, highways, …

Why would anyone let the Republicans (or the Democrats) get in the same old bullshit solution of tax cuts.

My projection: The bailouts and stimulus packages will continue coming for years and years since this attempt will not do enough, and especially not put enough money where it needs to be. This will lead to either a economic stagnation like we’ve seen in other countries before or a depression if things go very bad.

Or maybe we’ll get “lucky” and another bubble will form waiting to be popped later.

My solution: Replace capitalism’s booms and busts with planned socialism.

Read Full Post »

To continue with my descriptions of my experiences with being on Paxil, in hopes those also scouring the Intenret for information on their own experiences will find this, I’ll be talking about its effect on my dreams.

Before, I would rarely remember dreams or have very vivid dreams. I have on occasion had the experience of waking the next day and not being sure if a dream was a real memory or just a dream, very rarely though. For a while now I’ve been having extremely vivid dreams that then mix into my real memories. The day I awake I spend time trying to sort out the real from the made up. Sometimes upon waking up, others would pop into my head throughout the day and need to be sorted out.

I don’t know why, but I’d almost say the actual dreams are more work than the sorting out the next day. Its like being awake 24/7. I’d like to just be asleep and not have to do the same things I do during the day even while I’m sleeping.

From my research this is a common side effect and I have not seen anything that would lead me to believe it gets worse. So, thats all for now, I’ll write about the dreams again if anything changes.

Read Full Post »

On ABC’s “This Week” today Obama, when questioned about investigating the crimes of the Bush administration, said he wants to ‘look forward’ instead of backwards.

While he did not out right say he would investigate and did not say he would not appoint a special prosecutor, his ‘looking foward’ quote says it all to me. This is the same line we’ve heard from all top Democrat officials. The problem is, how is investigating the crimes of a past administration and prosecuting them not looking forward? Letting the crimes go is saying just what the Democrats claim they disagree with, some are above the law.

An investigation, and eventually procecutions, make it known that no one is above the law and sets a precedent for all future administations. Not going forward with an investigation is a slap in the face to the people and proof of the Democrats worthlessness when it comes to implementing real “change”.

Read Full Post »

Tilda: Alive and Moving

Tilda is alive. Thanks to Dan Krol a number of patches were merged, so look forward to many new features. Also, I’ve moved Tilda development to Git and I am hosting the code on GitHub now.

Read Full Post »

Nitrogen is a new Erlang web framework. It is event driven and a very natural fit for Erlang and makes web programming almost enjoyable.

The documentation is much better than when I first started with Nitrogen but there is still some lacking that requires searching through the source code. Here I’ll describe how I implemented users for a current project, still very much in its infancy, I am working on using Nitrogen and Mnesia.

The functions I reference can be found in the source code for the beerenthusiats.org project on github. I will not link directly to the source file for each module but instead the source directory, in case a filename changes or is moved to a subdir in the future. The source for the actual page generation of even the simple pages is long for a blog post so please view those through the github interface. Nitrogen’s templating system and callback system are very simple and you can learn those from Nitrogen’s documentation, thus I don’t bother to explain how the pages work.

We’ll have simple user accounts storing just username, password (hash) and email address. Thus we need a page that allows users to enter this data, look at web_register.erl in the git repo.

This module sends the data to another Erlang module, db_backend, for checking and insertion to the database. The database backend must hash, we’ll use sha1, the password and check that the username is not already in use and finally insert.

First, we need a record that describes the users table:

-record (users, {username, email_address, password}).

Next, we have an init/0 function that is only run once that creates the database and the table.

init () ->
  mnesia:create_schema ([node()]),
  mnesia:create_table (users, [{attributes, record_info (fields, users)}, {disc_copies, [node()]}]),

The create_table function takes a list of attributes, here we use the record_info function to get that list from the users record, and parameters describing how and where the data is to be stored. Here we use disc_copies and only send node(). This means that the data in users should be stored on disk, but also in main memory, as opposed to storing only on disk or only in memory. Sending node() tells Mnesia we are only storing this table on the current node. Obviously, we can see it would be very easy to store the database across multiple Erlang nodes.

Lastly, we have a start/0 function that is run each time the app is started to start Mnesia and crypto, which is used for hashing the password.

start () ->

The add_user/3 (called from web_register) function inserts the record (a table row) to the users table with the write/1 function that you can view in the db_backend module’s source and see how it works and how it uses transactions. You can ignore the call to couchdb_util:db_create/1. However, if you are interested in how I work with Couchdb those files are in the repo as well.

add_user (Username, EmailAddress, Password) ->
  <PasswordDigest:160> = crypto:sha(Password),
  Row = #users{username=Username, email_address=EmailAddress, password=PasswordDigest},
  case write (Row) of
    {atomic, Val} ->
      couchdb_util:db_create (Username),
    {aborted, Reason} ->
      io:format ("Adding user failed!~nRow: ~s aborted.~nReason: ~s~n", [Row, Reason]),

Now a user is in the database, users must be able to login. web_login is the module containing beerenthusiasts.org basic login page. Here is the main event function from that login page that is called when the user tries to login from that page:

event (login) ->
  case db_backend:validate(hd(wf:q(username)), hd(wf:q(pass))) of
    {valid, _ID} ->
      wf:flash ("Correct"),
    _ ->
      wf:flash ("Incorrect")

This page uses the function validate/2 which takes a username and password from the fields and checks if it matches in the users database:

validate (Username, Password) ->
  <PasswordDigest:160> = crypto:sha(Password),
  case do (qlc:q ([X#users.username || X <- mnesia:table(users), check (X#users.username,
           X#users.email_address, Username), X#users.password == PasswordDigest])) of
    fail ->
    Results ->
        length (Results) == 1 ->
          {valid, hd(Results)};
        true ->

I won’t go into all the details of how Mnesia is queried, but as you can see from the code above it does not use SQL. Instead, you use list comprehension, the same as anywhere else you use it in Erlang, to query the database tables. qlc:q/1 takes a list comprehension and returns a Mnesia query that can be run, look at the do/1 function in db_backend to see how it is send to Mnesia. List comprehension and the record syntax (X#users.username for example) is a very natural fit for relational algebra and for me personally much nicer than SQL.

Nitrogen provides the function wf:user() to check if a user is currently logged in.

case wf:user() of
  undefined ->
      Header = "";
    _ ->
      Header = "user_header"

The wf:user/0 function goes to the wf_session module. This module handles creating, destroying and checking sessions. Nitrogen contains a separate process which tracks users and state. This process is queried when a call to a wf function requires knowledge of the current session, if one exists.

Read Full Post »

Watch Gupta on CNN about health care:

http://www.youtube.com/watch?v=JpKoN40K7mA (also many follow ups on CNN’s Larry King)

Lovely, can Obama please appoint ONE goddamn progressive or at least one TRUTHFUL person?!? ONE!

Happy with your “change” yet people?

Read Full Post »

Older Posts »


Get every new post delivered to your Inbox.