General

National Debt Crisis

Are you sleeping a lot ? Want get worried ? Loose your sleep ? here take a look at this link , now if this does not frighten you I don’t know what will ! Close to 9 trillion !! And the interest rate, 19% . I wonder what the monthly payments on this are ?

How are we ever going to pay this ?

General

Backup Office E-Mail in Gmail

A simple and effective solution, create another gmail account for yourself <youname>_<officemail>@gmail.com and forward any mails you want to keep around. No more annoying ‘reached account size’ mails and easy to search rather than trying to get outlook to search.

General

Getting Windows Vs. Mac

If you want to buy a windows laptop, you will have to decide
Dell/HP/SONY……….which one………………..
And then
Windows Vista/Windows XP/………….
And then
LATITUDE/INSIPRON/…….
CONFIGURATION…………………………………………………………………………

Now if you getting a MAC
MACBOOK/MACBOOKPRO..

And the cost difference between them ? for the same hardware configuration 0$

General

Spring + Jruby “undefined method”

If you are trying out spring and jruby and get this exception “org.jruby.exceptions.RaiseException: undefined method” do not fret. Take a look at this link , looks like as of spring 2.0 and 2.0.1 there is a bug where any objects that are passed into jruby by spring do not seem to know there methods and the fix is part of 2.0.2 , will just have to wait till 2.0.2 is available.

General

Follow up to the Use Ruby to Prefix all lines /Postfix all lines/Remove empty lines/Replace strings in all lines of a file

In my previous post, I showed a ruby program that can help you iterate over lines of a file and make changes to the file, here I rewritten the code in a much more ruby-way, where I am using code blocks and iterators take a look
module DevFileutils
include FileUtils::Verbose

# Open file, iterate through each line and yield on each line, take results of yield
def each_line_of_file file_name
temp = File.new(file_name+”.tmp”, ‘a+’)
IO.foreach(file_name) do |line|
value = yield(line)
temp.puts yield(line) if value
end
temp.close
mv file_name+’.tmp’, file_name
end

# Opens a file and adds prefix to each line
def prefix  file_name, prefix
each_line_of_file(file_name) { |line| prefix + line }
end

# Opens a file and adds postfix to each line
def postfix file_name, postfix
each_line_of_file(file_name) { |line| line.chomp + postfix }
end

#removes all empty lines from a file
def remove_empty_lines file_name
each_line_of_file(file_name) { |line| line if !line.chomp.empty? }
end

def replace file_name,string,with_string
each_line_of_file(file_name) { |line| line.gsub(string,with_string) }
end
end

General, ruby, Tech

Use Ruby to Prefix all lines /Postfix all lines/Remove empty lines/Replace strings in all lines of a file

For some reason or the other I had to do bulk operations on files, like prefix/postfix all lines or remove empty lines
, yeah I could do it with some unix command, but I am already using ruby to massage the data just wanted to extand that.So here
is what I did wrote a ruby script to do it now I can do stuff like

prefix ( ‘c:\tmp\zip.txt’,’some-prefix’ )

The script, hmmm I wonder if I could submit this to ruby people.

require 'fileutils'

module DevFileutils
include FileUtils::Verbose

# Opens a file and adds prefix to each line
def prefix file_name, prefix
temp = File.new(file_name+".tmp", 'a+')
IO.foreach(file_name) do |line|
temp.puts prefix + line
end
temp.close
mv file_name+'.tmp', file_name
end

# Opens a file and adds postfix to each line
def postfix file_name, postfix
temp = File.new(file_name+".tmp", 'a+')
IO.foreach(file_name) do |line|
temp.puts line.chomp + postfix
end
temp.close
mv file_name+'.tmp', file_name
end

#removes all empty lines from a file
def remove_empty_lines file_name
temp = File.new(file_name+".tmp", 'a+')
IO.foreach(file_name) do |line|
temp.puts line if !line.chomp.empty?
end
temp.close
mv file_name+'.tmp', file_name
end

def replace file_name,string,with_string
temp = File.new(file_name+".tmp", 'a+')
IO.foreach(file_name) do |line|
temp.puts line.gsub(string,with_string)
end
temp.close
mv file_name+'.tmp', file_name
end
end

General

New Job, New Domain

As of October 16th I started a new job, things are finally settling down and life is coming back to order.

Now I work for Apollo Group (also know as University of Phoenix), including this job now I have worked in 4 different domains

1. Education ( present )
2. Government ( Arizona state retirement system )
3. Financial ( vitalps, now know as http://www.tsysacquiring.com/)
4. Travel (Sabre Inc)

Each with its own unique characteristics/problems and unique solutions. It has been great, maybe I’ll write a post about each domain.