Monday, December 20, 2010

Jammin at VV's


Party at VV's was lots of fun... So much I restarted my blogger just so I could post this picture...

Thanks Victoria....


Tuesday, March 9, 2010

Evoke: Deliver Value

Deliver value; what are the benefits for people using the end product, does it improve a persons life?

Although "improve a person's life" is subjective, its a good question to ask - not yourself - them. We can imagine how a person life would be improved if they just did this or that but to them the mountain may be too high or the forest too thick. So the first step is ask them and if they say yes it would - celebrate. If they are unsure then you have to go back and think again. Why can't they see it? Could it be you are wrong? Maybe you can cut some trees down or give them some mountain boots to help them - but careful fearless social innovator - be sure when you step back or out of the situation they don't just fall or get lost in trees - it has to be sustained value....

Saturday, May 31, 2008

transaction.records.create!(row.to_hash)

This one I really like:

transactions.records.create!(row.to_hash)

But now I have a problem. Is this where I indicate what table I want my csv file imported to? I used the word transactions and maybe should use a different one not to be confused with the .transaction class method.

Note my table name is plural... Should I use the plural here?

(row.to_hash)

James told me this magic allows me not to have to specify a hash for all my columns that I want to import into my database table. If I did not have this I would have to do this:

transactions.records.create!(:date => date, :amount => amount, :card_id => card_id

If I had a ton of columns this would hard to do... Also James said that in order for this row.to_hash to work you need to have headers set to true or specify the headers in the block or it will complain.

do |row|

Now comes the part where the action happens...

do |row|



:headers => true,

This one I get...

:headers => true,

This tells the FasterCSV that the file you are uploading has headers. So that answers one of the questions. If you don't have headers it is :headers => false

FasterCSV.foreach...

This is the FasterCSV statement


FasterCSV.foreach("csv_test/public/csv/test_copy.csv",

for reading the file line by line. You can read about it here:

http://fastercsv.rubyforge.org/

I decided to start simple because I was having trouble understanding the code to make the import work from HTML. Once I get this to work I will work on getting the import file to work.

begin

Now for the begin statement:

begin
Record.transaction do

The Record.transaction do is nice and descriptive and tells the app that we want to record a transaction... right? Well, I would think so... breaking this up we see that Record is a class (because it starts with a Capitalization... ) But I have not defined Record anywhere so it must be a built in class in Ruby... I have searched for it but cannot find it... any help here?

The .transaction I did find out and is explained pretty well here:
http://api.rubyonrails.org/
by going to the file:
vendor/rails/activerecord/lib/active_record/transactions.rb

in a nutshell we are using .transaction because we want the insert to our database to be done only if the whole insertion succeeds. Thats why transaction is called a protective block... If it does not succeed then we can role the transaction back... no harm.

3. Import Controller code (FasterCSV)

So now for the real code.


The FasterCSV code I received from emailing James Edward Gray II who was nice enough to get me started on working on this...

I am going to break this code apart in bits in subsequent posts and hopefully get a better understanding about what is going on with comments from others...

Here is my first attempt:

class ImportController < ApplicationController
require 'fastercsv'

def index
end

def csv_import

begin
Record.transaction do
FasterCSV.foreach("csv_test/public/csv/test_copy.csv",
:headers => true)
do |row|
transactions.records.create!(row.to_hash)
end
end

flash[:notice] = "Successfully added."
redirect_to 'index'
rescue
#do something with the error
flash[:error] = "error adding. Please try again."
redirect_to '/import/index'
end

end

end

2. Creating the csv_test app

So for the app... I am going to call it csv_test so I get going:

>rails --d mysql csv_test
# I specify mysql bc the mac keeps creating sqlite and I like mysql better (i think)


#stuff gets created

>rake db:create

#this creates my databases...

>ruby script/generate controller import

#creates my controller

>ruby script/generate model transaction

#I create a transaction model mainly because I want to create my transaction table this gives me the file : 001_create_transactions. I open this and add the following items for my table:

class CreateTransactions < ActiveRecord::Migration
def self.up
create_table :transactions do |t|
t.datetime :date
t.integer :amount
t.integer :card_id

t.timestamps
end
end

def self.down
drop_table :transactions
end
end

#So its a simple table that has three columns :date, :amount, :card_id. These will hopefully correspond to my csv file I am trying to import.


Here are the contents of my data file - test.csv:

date, amount, card_id
5/06/2008, 20, 1234
06/05/2008, 50, 1235
10/30/2008, 45.45, 1342

I have a date, amount and a card_id just like my database table. Pretty simple.

Tuesday, May 27, 2008

1. Rails and FasterCSV Intro...

This is my attempt to use the FasterCSV plugin for rails. I am a very begin, begin again, programmer so it is my hope the some of this is true and others can point out whats wrong with the code:

Ok the problem:

To import a csv file (thats a comma delimited file) into a database (mysql for me) table.

Pretty simple task but if you don't know it all kinds of things crop up like:
How do I get the file in there?
How does it know where to map the data?
How do I not import the headers or blanks?

I have been emailing back and forth with a James Edward Gray II who wrote the FasterCSV in the first place and I hope that he can comment here so I can make this a working example for all to see.

Also I don't know how this is going to work on blogger but this is my easiest way to publish currently.

Thursday, November 1, 2007

Ryan Adams is God!!!

Ok. So not God or a god in fact as he reminded me upon leaving his glowing presence, 'he is the band and I am the audience'.... I thought about this on the drive home. Wow. He really burst my bubble. I thought I was the band. Damn. And then I thought about the show.

It was great music. "The Band" sounded great and really showed that Ryan is continuing to pushing his music to new heights. Some of the old tunes we spot on and rearranged into something new. I kept thinking I would like own this new version. The new songs were full walls of sound and Ryan's voice raging and then stopping to a whisper and then raging was outstanding. So I enjoyed the music but did I enjoy the show?

The answer is no. I am still trying to pick up the pieces of my fandom so I can't really pin it on one thing. I left the show as part of the audience but i came the show as a Ryan Adams fan.

I saw his "solo cd" release party at the Local 506 in NC (some time ago). It was just him the guitar and the voice. It was an amazing show. He even choked on the song "pick me up" relenting after the nth time a fan from the crowd (not audience) pleaded for it. That night I became a fan of the man, the music and the thoughts he was portraying in his songs. Yes he was drinking and maybe he does not remember that night. But for me, magic.

Earlier that same week I saw another band at the 506 called The Drive By Truckers. They were raw and fun and I enjoyed them when ever they came to town. It is relevant the this discussion because two nights before my recent audience with the blessed Mr. Adams I was in Rams Head Live reveling in another Truckers show (now called simply DBT). It was fun, really fun. People were dancing and singing and moving to the grovin... ok. Also the band was having fun. They were all seated for most of the show I was standing for all of show. They smiled and laughed and passed Jack around and smiled and laughed some more. They took requests (from people up front). Told us how much they loved us... played some more. It was one of the those nights where you don't want to go home. You just want to stay with your friends and sing some songs. The music was great and songs were reworked a bit. I left that show with new CD a tee shirt and a big smile feeling good.

So I am now driving home from DC with the DBT cd playing and deciding that I am not a fan of Ryan Adams anymore. I still love the music and will play the songs but I don't really want to see him again. Will I purchase his music? Maybe. But that is not really the point is it? There is something missing in Ryan's world view of music and fans. Maybe he does not want fans. Maybe he wants a new kind of fan one that sits in an audience claps when he is finished lets him decide what songs he plays, when he plays. A fan that never yells for a song, does not dance in the isle, doesn't drink. Doesn't ever get delusional that he is singing for them or about them or with them. He wants a classical music fan.

He wants the music to stand the test of time not the experience. Well good luck with that. I want the experience too. I like classical music but it ain't rock and roll.

Wednesday, July 18, 2007

The gorilla...


So this is the missing half of the bunny. Read below. The last song said it all... Hot Sand - On my toes!!!! Or said something.

Something about bunnies... or a bunny



Where are we again? Oh yeah the 8x10 on Monday night. Now this act was special not only because musical bunnies are special but because she was good and accompanied by the bartender in a gorilla outfit. That picture did not make it... So all I have is her. Mysteriously shortly after this the bartender disappeared and has not been heard from...neither has the bunny. Stay tuned.

Monday, March 19, 2007

lonely beer....


Sad but true... these fellas are lonely. The crowed was sparse tonight but I also got to the show late (10:00) so I missed a few bands like Shook and Ed Bones that I wish I didn't but hey I had stuff to do. Anyway I did have a few brews to keep these guys company and it turned out to be an ok night of music on the edge of monday.

Juice box heroes... from germany?****


No. They are not from Germany but tonight they had a special (uninvited) guest from Germany who eventually got punted from the bar. But he seem to love the JBH's. I think for good reason. Last week I stated that they played a few covers... Actually this week I talked to the band and all we original. I could have sworn that one of the songs was a cover (the Reihl thing). Their sound is nirvana like but fresh. I enjoyed their set tonight and although they were a little off I am giving them the star of the night for being so good. Their songs are catchy and would do well on the radio... I have asked my friend to get Sony down to take a look. We will see. Until then they are at the 8x10 throughout march so come see them for yourself.

In the moment...


This was actually a three piece band that combined rap with a hard edge rock riffs. I highlight the guitarist because he looks like my nephew but alas is not. Also because he was the difference in the band the lead singer was good but the guitar was the edge that cut through and made you pay attention.

Jim


Jim said he had a song for Osama but we wanted to hear about heartbreak so he played a song about his girl who left and about how he is a changing man... I like Jim a lot. He stated that the song was a work in progress and it showed a little... he states that he is a changed man but apparently that does not matter because she has found someone new... I would like to know what he had changed anyway... so Jim if you are not finished yet maybe you can add that in... The last song of his was really good and showed his impressive writing skills...

Piano Man almost...


Yes, I know I am having too much fun with photoshop but hey when you don't have the best camera you have to make thing interesting. This guy was actually both piano and guitar... on guitar he played two light covers and had a decent voice but on the piano he did much better. Did not catch the name but it was a good change up.

Someone has to be last...

Christopher drew the last act tonight and it pretty much was an empty bar. He flew through his three song set. I have to say that i liked the style he was putting out. His playing sounded a little out of tune and when asked about it after he said that he likes to add something different... I couldn't tell if it was extra chords or what but the fast strumming blended well with is voice. Hope to see more

Monday, March 12, 2007

Ed Bones


Ed Bones (Teddy) was one of two rap artists to hit the stage tonight... He was late getting on which was too late for Peter Parker who had to get home (maybe next week peter). Ed almost made it as the stand out tonight. I am not a big fan of the sound track for the rap artist but there is not much you can do live with out a whole band here... Anyway Ed is very good and his flow is timed and spaced for maximum impact. But what makes him great is the stories behind the spit. The subject matter is clearly emotional for him but he shows it in subtle ways that draw the audience in ... I am not hip hop guru but I like what I hear. Hear him yourself on myspace: search for ed bones... He is also playing live at Sonar on March 31st so check him out.