Archive Page 5
First I apologize, I’m watching Rambo III as I write this (preparing for the new Rambo {!!!!!}coming out this Friday) so I may screw some of this up.
This all started with a couple of great deals I saw on slickdeals.net.
1. Got 5 x 1024mb sticks of DDR2 667 Ram for $7 shipped after rebate.
2. Got a cheap (AM2) mATX ASUS mobo, case, and PSU for $50 shipped.
So, I ordered a Athlon X2 4000+ for $55 while I was at it. This got me a cheap as hell backup pc($112 for a dual core PC w/4 gigs ram and an extra stick for a rainy day). I already had a spare optical drive and an old IDE 40gig hard drive to throw at it. I’m not going to be using it for anything needing 3-d acceleration, so I’m going to stick with the onboard video.
Now, a while back I made a MythTV box consisting of the following:
Core 2 Duo e4300
1024mb ddr2 800mhz
2×320gig harddrives
Nvidia 7300gt
DVDRW
pcHDTV tv tuner (for DVR functionality)
running Linux Mint (didn’t have to install all those codecs)
Old Antec case and an Antec Earthwatts PSU (go green).
NOTE: having a HTPC has changed my life. Just like people who have TiVo will tell you, its awesome. I could never go back. You could put together a decent one for $300-400 if you tried and its wayyy worth it.
It works pretty well, and I know that its pretty high powered for a htpc, but I needed it to handle 1080p x264 rips, which the C2D can. I’ve got about 400 gigs of music, movies, and tv rips on it.
So here is the plan:
The new AMD build will be the front end, mainly running Mythtv and the current pc will be Jen’s computer/the server. Right now, I’ve setup Samba shares for all the media, and set up Firefly (aka mt-daapd) to share all the music as an iTunes share (for my Macbook Pro). I’m also going to use it as a Subversion repository.
So, tomorrow the parts for the AMD build will be here and I’ll have to transplant some parts to it - the TV tuner, possibly the vid card (we’ll have to see how the x2 4000+ handles video.. I hope it can handle HD x264 since the 7300gt won’t help with it. I’ll setup a fresh install of Mit + MythTv and be in configuration heaven for the majority of the night I’m guessing.
Stay tuned.
Thats as far as I got tonight. My crappy D-Link router was giving me trouble so I didn’t get as far as I wanted. Wish DD-Wrt would run on it.
Since I started my nice cushy “high paying” job, Jen and I have been putting quite a bit of money away (in preparation for the move and for a rainy day) and paying down our debt. We’ve got some moola stored away in a ingdirect savings account thats collecting a nice 4.1% interest rate, but I’ve been toying with the idea of playing the stocks.
A couple of months ago I opened a dummy portfolio at money.cnn.com using their ‘live portfolio’ do hickey. I’ve got next to zero experience with the markets. Our 403(b) is invested in the Vangaurd S&P 500 Index fund(hey can’t argue with 11% historic returns), but thats about it. My state pension I really have no control over. Thats the extent of our investments.  So I opened that dummy account to see what I could do.
Well, the first two weeks were great. Made about 10% with my mostly tech stock portfolio. The last two weeks, I’ve lost all that 10% and then another 10. So I’m down right now. Kind of glad it is fake money at this point, but I think this summer, when I’m hoping the market bottoms out, I’ll be ready to actually drop a couple grand on a real portfolio and get some good stocks for cheap.
I must admit I’m learning a ton. I’ve actually begun watching CNBC in the moring before work, bought Jim Cramer’s new book, and check the portfolio about 3-4 times a day. Its fun if anything.
Its a sad day. My iPod finally quit on me. I’m not exactly sure what is wrong with it, but it has served me well(3 years!).
Oh well, guess that means I should get an Touch. Or I could just do the cool thing and get an iPhone, but then I’d have to switch to AT&T or hack the iPhone to work with T-Mobile. I like my cheap-as-hell-but-oh-so-awesome plan with Sprint I have now though. $30 for unlimited text, data, and 500 minutes isn’t bad. Besides, I don’t use my cell enough to justify it.
Farewell iPod, you were my best friend for a long time.
Yeah, I came up with this little Rails rake task called ‘rake leaves’. It will just create a text file that has all your tables, column names, and their data types. I’ve always thought it would be handy to have this so you don’t need to switch to MySQL and spend the time to look it up.
Anyways, if you want to download it go for it. All you need to do is put leaves.rake in /lib/tasks and then from the console
$rake leaves
You’ll get a file called table_structure_whatever_the_date_is.txt.
You can download if right here.
This morning there was a guy in the rails IRC room asking about using helpers in his controller and I recently wrote an app that used the great pdf-writer gem to generate some pdfs and used helpers in the controller for formatting in the pdf. If you are going to generate very complicated pdfs, its best not to put your pdf formatting code directly in the controller, but if you need just a real quick pdf generated, this works great.
First, create a new class in your application controller:
class Helper
include Singleton
include ActionView::Helpers::PdfHelper #or whatever helpers you want
end
I wanted to use my pdf_helpers
..and then:
def pdf_helpers
Helper.instance
end
Will create an instance of your new class.
Now, go to your pdf controller (or whatever) and simply:
pdf.text pdf_helpers.my_crazy_helper(@foo.bar)
The pdf.text part is not the important part, thats just for pdf-writer, but what is is using “pdf_helpers.your_helper” to create a new instance of the helper class which will allow you to use that helper.
I don’t know why I haven’t done this sooner, but I called up the four credit cards I have and flat out asked them if I could get a lower rate. Ya know what? Most did.
Breakdown:
Chase Visa - Down 5%!
Dell Credit - Down 6%!
Best Buy - No Go, they said they only have their INSANE 22% interest rate. Good thing I’ve only got about $25 on it.
BillMeLater - No go, not quite as bad as Best (Worst) Buy’s 22% but still, 19.99% fixed is still crazy. Even me threatening to cancel the card did no good. Like Worst Buy, they said they only offer ONE rate…
So, I lowered my interest rates an average of 3% each. May not seem like a lot, but in the long run it will add up on my quest to rid myself of debt.
NOTE: THIS IS AN OLD POST AND THE INSTRUCTIONS MAY BE OUTDATED. YMMV
In my first real post in a year, I thought I’d share some Ruby stuff I’ve recently done - Integrating your Rails 2.0 app with Google Maps.
So, here is what we are aiming to accomplish: You are going to provide an address, say 123 Foobar St, Anywhere, MN 55812. We are going to send it to a geocoder, get the longitude and latitude, send that to Google, and get back the map information.
whew. Actually, its not nearly as hard as it sounds.
First, install the google-geocode gem:
sudo gem install google-geocode
The install the ym4r_gm, which will talk to Google for us.
script/plugin install svn://rubyforge.org/var/svn/ym4r/Plugins/GM/trunk/ym4r_gm
Alright, finally, include the google-geocode gem in your controller.
require 'rubygems'
require 'google_geocode'
Now, you will need to get an API key from Google, and then put that key in the newely created config/gmaps_api_key.yml (as Drew Bushaw points out) or hard code it (Which I do in the example). There should be three keys already in there, and they will work when using your local machine, but will not with anything other than localhost. Alternativly, if you want to hardcode it in, place it where I have “your api key here” in the next section.
Add to your page header (prolly your layout) to include the required API javascripts, etc…
<%= GMap.header %>
<%= @map.to_html %>
Ok, now heres the fun. To get the geocode information, simply:
gg = GoogleGeocode.new "your api key here" #hard coded
#not hardcoded
#gg = GoogleGeocode.new YAML.load_file(RAILS_ROOT +‘/config/gmaps_api_key.yml’)[ENV['RAILS_ENV']]
loc = gg.locate @property.full_address
Now, I have @property and full_address is its full address (123 Foobar, Somecity, MN 55812 for example). You can also try it without some vitals, such as zip code.
Now we have to send Google Maps the correct information:
@map = GMap.new("map_div")
@map.control_init(:small => true) #add :large_map => true to get zoom controls
@map.center_zoom_init([loc.latitude, loc.longitude],14)
@map.overlay_init(GMarker.new([loc.latitude, loc.longitude],:title => @property.name, :info_bubble => loc.address))
Notice, “map_div”, which will come into play in the next step. Some useful tid bits here include the :title, which will be the title of the pin on the map, :info_bubble which will appear when you hover over the pin, and where I specified “14″. Here you specify the altitude the map will be at. Experiment for whatever your needs are.
Now, the final thing you need to do is put this to work in your view.
<%= @map.div(:width => 493, :height => 300) %>
As you can see, I’ve specified a :width and :height. Now, fire everything up and you should get something similar to…

Now in my case I had people inputing address and if/when they enter one that is non-existent or incorrect, I had to catch it since a google-geocode will throw a big error if you give it bad information.
Enjoy!
Latest Entries
Archives
Categories
- apache2 (1)
- backgroundrb (1)
- Debt (1)
- Drupal (1)
- Family (7)
- Geeky (7)
- Google (2)
- Grandma's Marathon (1)
- happenings (1)
- Hosting (2)
- iPod (1)
- Linux (6)
- Minnesota (2)
- money (1)
- moving (1)
- MythTv (1)
- nginx (3)
- PHP (4)
- Programming (11)
- Rake Leaves (1)
- Rants (1)
- rentalrundown (1)
- Royner (5)
- Rspec (1)
- Ruby (5)
- Ruby On Rails (18)
- Seattle (3)
- Slicehost (3)
- stocks (2)
- Uncategorized (9)
- Vacations (2)