40% off your First Order with GoDaddy.com!

Jan 29, 2010

Substitute Strings in Files with Ruby

Uses a list of regular expressions and replacement strings to make changes in text files.

Put in file "edit-all.rb" and run with
ruby edit-all.rb *.txt

Now accepts the target and the replacement from the command line or from the keyboard.

Jan 24, 2010

Easy Crock Pot Chicken Recipes

With the temptation of fast food, processed meals, and eating out, it's difficult to spend time to prepare good, healthy, home-cooked meals. If you're like many, the last thing you want to do after coming home from work is prepare a gourmet dinner. By using your crock pot and spending 5-10 minutes each morning, you can come home to delicious home-cooked meals without hours of preparation right before dinnertime. Below are three quick and easy chicken crock pot recipes you're sure to enjoy, and each with 7 ingredients or less!

Salsa Chicken

  • 6 boneless skinless chicken breasts
  • 1 ½ cups salsa
  • 1 tsp ground cumin
  • 3 tbsp lime juice

Spray crock pot with non-stick cooking spray. Place chicken in slow cooker, pour salsa over chicken. Cover and cook on low 6-7 hours or high 3 hours, until chicken is tender and no longer pink. Stir in cumin and lime juice, cover and cook an additional 15 minutes.

Note: For an extra spicy kick, add a pinch of ground red chili powder with the cumin and lime juice.

Lemon Chicken

  • 4 boneless skinless chicken breasts
  • ¼ lemon juice
  • 1/3 cup water
  • 2 cloves minced garlic
  • 1 tsp thyme

Spray crock pot with non-stick cooking spray. Place chicken in crock pot. Combine juice, water, garlic, and thyme in a small bowl, pour over chicken. Cover and cook on low 8 hours or high 4 hours.

Ranch Chicken

  • 6 boneless skinless chicken breasts
  • 1 can condensed cream of chicken soup
  • 1 envelope ranch dressing mix
  • ½ cup water
  • ½ cup sour cream
  • 2 tbsp ranch dressing
  • 2 tbsp flour

Spray crock pot with non-stick cooking spray. Place chicken breasts in crock pot. In a small bowl, combine soup, ranch dressing mix, and water; pour over chicken. Cover and cook on low 8 hours or high 4 hours. Remove chicken from crock pot. Stir in sour cream, ranch dressing, and flour; replace chicken. Cover and cook on high 20 minutes.

Jan 23, 2010

The Laws of Money

One of your major goals in life should be financial independence. You must aim to reach the point where you have enough money so that you never have to worry about money again. The good news is that financial independence is easier to achieve today than it has ever been before.

The Law of Abundance
We live in an abundant universe in which there is sufficient money for all who really want it and are willing to obey the laws governing its acquisition. People become wealthy because they decide to become wealthy. People are poor because they have not yet decided to become rich.

The world is full of thousands of people who have had far more difficulties to overcome than you could ever imagine, and they've gone on to be successful anyway. So can you.

The Law of Exchange
Money is the medium through which people exchange their labor in the production of goods and services for the goods and services of others. The amount of money you earn is the measure of the value that others place on your contribution. To increase the amount of money you are getting out, you must increase the value of the work that you are putting in.

The Law of Capital
Your most valuable assets, in terms of cash flow, are your physical and mental capital—your earning ability. How much time you put in and how much of yourself you put into that time largely determine your earning ability. Time and money can be either spent or invested. If you invest your time or money in becoming more knowledgeable and better skilled, you can increase your value.

The Law of Time Perspective
The most successful people in any society are those who take the longest time period into consideration when making their day-to-day decisions. Your ability to practice self-mastery, self-control, and self-denial, to sacrifice in the short term so you can enjoy greater rewards in the long term, is the starting point of developing a long time perspective.

The Law of Saving
Financial freedom comes to people who save 10 percent or more of their income throughout their lifetime. Savings today are what guarantee the security and the possibilities of tomorrow.

The Law of Conservation
It's not how much you make but how much you keep that determines your financial future. The true measure of how well you are really doing is how much you keep out of the amount that you earn.

The Law of Three
There are three legs to the stool of financial freedom: savings, insurance, and investment. One of your major responsibilities, to yourself and to the people who depend on you, is to build a financial fortress around yourself over the course of your working lifetime. To be fully protected against the unexpected, you require liquid savings equal to two to six months of normal expenses.

The Law of Investing
Investigate before you invest. This is one of the most important of all the laws of money. You should spend at least as much time studying a particular investment as you do earning the money to put into that particular investment. The only thing easy about money is losing it. If you think you can afford to lose a little, you're going to end up losing a lot. Invest only with experts who have a proven track record of success with their own money.

The Law of Magnetism
The more money you save and accumulate, the more money you attract into your life. The Law of Magnetism has been written about for more than 5,000 years. It explains much about success and failure in every area of life, especially in the financial arena. The more positive emotion you associate with your money, the more opportunities you will attract to acquire even more.

Jan 22, 2010

Ruby CSV to XML Converter

This code will take an input CSV file and output XML. IT was easy to write, but I haven't found anything out there to do this. The first line of the CSV file should contain the element names.

Jan 20, 2010

GDM2 Setup Gets A New Look And An Ubuntu PPA

GDM2 Setup is a GUI configuration tool for the new GDM (2) something that was missed by a lot of people. It doesn't have as many options as the old GDM setup tool, but that's because the new GDM2 doesn't support too many customizations.

Add the GDM2 Setup PPA in your source list using:
sudo add-apt-repository ppa:gdm2setup/gdm2setup

Update source list using:
sudo apt-get update

Install GDM2 Setup using:
sudo apt-get install python-gdm2setup

Jan 17, 2010

The Seven P Formula for Marketing Success

Once you have developed your marketing strategy, there is a seven P formula you should continually use to evaluate and reevaluate your business activities. These seven are: product, price, promotion, place, packaging, positioning, and people. As products, markets, customers, and needs change rapidly, you must continually revisit these seven P's to make sure you are on track and achieving the maximum results possible for you in today's Market.

To begin, develop the habit of looking at your product as though you were an outside marketing consultant having been brought in to help your company decide whether or not it is in the right business at this time. Ask critical questions such as: Is your current product or service, or mix of products or services appropriate and suitable for the market and the customers of today?

Prices Deserve Attention
The second P in the formula has to do with price. Develop the habit of continually examining and reexamining the prices of the products and services that you sell to make sure they are still appropriate to the realities of the current market. Sometimes you need to lower your prices. At other times, it may be appropriate to raise your prices. Many companies have found that the profitability of certain products or services does not justify the amount of effort and resources that go into producing them. By raising their prices, they may lose a percentage of their customers, but the remaining percentage generates a profit on every sale. Could this be appropriate for you?

The third habit in marketing and sales is for you to develop the habit of thinking in terms of promotion all the time. Promotion includes all the ways you tell your customers about products or services and how you then market and sell to them. Small changes in the way you promote and sell your products can lead to dramatic changes in your results. Experienced copywriters can often increase the response rate from advertising by 500 percent by simply changing the headline on the advertisement.

The fourth P in the marketing mix is the place where your product or service is actually sold. Develop the habit of reviewing and reflecting upon the exact location where the customer meets the salesperson. Sometimes a change in place can lead to a rapid increase in sales.

The fifth element in the marketing mix is packaging. Develop the habit of standing back and looking at every visual element in the packaging of your product or service through the eyes of a critical prospect. Remember, people form their first impression about you within 30 seconds of seeing you or some element of your company. Small improvements in the packaging or external appearance of your product or service can often lead to completely different reactions from your customers.

The next P is positioning. You should develop the habit of thinking continually about how you are positioned in the hearts and minds of your customers. How do people think about you and talk about you when you are not present? How do people think and talk about your company? What positioning do you have in your market, in terms of the specific words that people use when they describe you and your offerings to others?

People are Everything
The final P is people. Develop the habit of thinking in terms of the people inside and outside of your business who are responsible for every element of your sales and marketing strategy and activities. Your ability to select, recruit, hire, and retain the proper people, with the skills and abilities to do the job you need to have done, is more important than everything else put together.

Jan 16, 2010

Rails: How to use a custom RDoc template from a rake task

I just need to do that, use a custom rdoc template to generate a documentation for a Rails project.

My main concern, regarding the different solutions I found on the web, was I didn’t want to have a template in the ruby installation directory but one that resides in a subdirectory of my rails application.

In fact it’s not a problem … when you find the good command. Here’s my rake task to generate the documentation (I put the Jamis Buck customized template in RAILS_ROOT/doc/rdoc_template/jamis.rb)

The important part is :
rdoc.template = "doc/rdoc_template/jamis.rb"

I tried to use the—template= and -T options in rdoc.options but it didn’t work… then I found that the RDocTask appends its template variable to the options passed to RDoc bypassing mine.

Jan 15, 2010

RSS Twitter Bot with Ruby

A short Ruby script that will read an RSS feed and republish it to your Twitter account. This could be useful for livestreaming or getting some sort of commercial presence on there.

Jan 14, 2010

Cheese-Pumpkin Soup

  • 1/2 cup sliced green onions with tops
  • 2 Tbs. butter or margarine
  • 2 Tbs. all-purpose flour
  • 1 tsp. seasoned salt
  • 1/2 tsp. nutmeg
  • 1/4 tsp. cinnamon
  • 2 cups milk
  • 1 can (10-3/4 oz) chicken broth
  • 1 can (16 oz.) pumpkin
  • 1 1/2 cups shredded Cheddar cheese

  • In large, heavy saucepan, lightly saute green onions in the butter.
  • Stir in flour, seasoned salt, nutmeg and cinnamon. Remove from heat. Add milk and chicken broth. Cook, stirring, about 15 minutes until thickened.
  • Blend in pumpkin. Simmer 5 minutes longer, stirring frequently. Add cheese, Stir until melted.
  • Ladle into soup bowls. Top each serving, if desired, with a slice of tomato, sprinkled with cheese and green onions.

Jan 13, 2010

Install GNOME Activity Journal in Ubuntu Karmic

The GNOME Activity Journal is a tool for easily browsing and finding files, contacts and other resources on your computer. Using Zeitgeist, it keeps a chronological journal of your activity and supports tagging and bookmarking (using the new Tracker 0.7) and establishing relationships between resources.

While this first release only supports basic browsing of file activities, the underlying infrastructure can do much more and you can expect the missing functionality to become available in future releases.

Open the terminal and run the following commands:

Add the GNOME Activity Journal ppa
sudo add-apt-repository ppa:zeitgeist/ppa

Update the source list
sudo aptitude update

Install GNOME Activity Journal
sudo aptitude install gnome-activity-journal

You can open from Applications -> Utility -> Activity Journal

Jan 11, 2010

Rails: Minor annoyances in Rails

Here's one "surprise" and one annoyance I've found while working with Rails.

Using PostGreSQL as the DB works beautifully in the development environment, but often fails in the test environment; however it only fails on rake test and only on the unit test portion of the full suite. Integration and functional tests run fine. One fix, was to change the database.rake file, in the db:prepare task to always use db:test_clone_structure instead of db:test:clone.

The annoyance is that controller modules appear to be bolted on without much consider for how they interact with the rest of the system — they greatly constrain your routes; most test tools seem unaware of them (rcov's rails task doesn’t know to look for subdirectories in the functional tests, etc) Some of these are easy to fix, some aren't, but it definitely feels like controller modules aren’t considered truly part of Rails.

Jan 10, 2010

The Law of Time Perspective

The most successful people in any society are those who take the longest time period into consideration when making their day-to-day decisions. This insight comes from the pioneering work on upward financial mobility in America conducted by Dr. Edward Banfield of Harvard University in the late 1950's and early 1960's. After studying many of the factors that were thought to contribute to individual financial success over the course of a person's lifetime, he concluded that there was one primary factor that took precedence over all the others. He called it “time perspective.”

Plant Trees
What Banfield found was that the higher a person rises in any society, the longer the time perspective or time horizon of that person. People at the highest social and economic levels make decisions and sacrifices that may not pay off for many years, sometimes not even in their own lifetimes. They “plant trees under which they will never sit.”

An obvious example of someone with a long time perspective is the man or women who spends ten or twelve years studying and interning to become a doctor. This person takes extraordinarily long time to lay down the foundation for a lifetime career. And partially because we know how long it takes to become a doctor, we hold doctors in the highest esteem of any professional group. We appreciate and admire the sacrifices that they have made in order to be able to practice a profession that is so important to so many of us. We recognize their long time perspectives.

Long Time Perspectives
People with long term perspectives are willing to pay the price of success for a long, long time before they achieve it. They think about the consequences of their choices and decisions in terms of what they might mean in five, ten, fifteen, and even twenty years from now.

Short Time Perspectives
People at the lowest levels of society have the shortest time perspectives. They focus primarily on immediate gratification and often engage in behaviors that are virtually guaranteed to lead to negative consequences in the long term. At the very bottom of the social ladder, you find hopeless alcoholics and drug addicts. These people think in terms of the next drink or the next fix. Their time perspective is often less than one hour.

Delayed Gratification is the Key to Financial Success
Your ability to practice self-mastery, self-control, and self-denial, to sacrifice in the short term so you can enjoy greater rewards in the long term, is the starting point of developing a long time perspective. This attitude is essential to financial achievement of any kind.

Jan 9, 2010

Ruby: Pronounceable Random Password Generator

This piece of code generates a random password of the specified length, but mixes the two sets of letters so that a pronouncable password is being generated.

Jan 4, 2010

Ubuntu: More Popular than Britney Spears in 2009

Apt-Get Me, Baby… One more Time!

Ubuntu was more popular than Britney Spears in 2009 - at least in terms of searches.

When you consider than she's shifted more than 83 million records and commands publicity like no-other, it's a curious footnote in itself.

Jan 3, 2010

Create Your Daily Personal Growth Schedule

There are seven disciplines you must develop if you want to achieve all that is possible for you. You can learn these disciplines through practice and repetition until they become automatic.

Goal Setting
Every morning, take three to five minutes to write out your top goals in the present tense. Get a spiral notebook for this purpose. By writing out your ten goals at the beginning of each day, you will program them deep into your subconscious mind.

This daily goal writing will activate your mental powers. It will stimulate your mind and make you more alert. Throughout the day, you will see opportunities and possibilities to move more rapidly toward your goals.

Planning and Organizing
Take a few minutes, preferably the night before, to plan out every activity of the coming day. Always work from a list. Always think on paper. This is one of the most powerful and important disciplines of all for high performance.

Concentration on your Highest-Value Activities
Your ability to work single-mindedly on your most important task will contribute as much to your success as any other discipline you can develop.

Exercise and Proper Nutrition
Your health is more important than anything else. By disciplining yourself to exercise regularly and to eat carefully, you will promote the highest possible levels of health and fitness throughout your life.

Learning and Growth
Your mind is like a muscle. If you don't use it, you lose it. Continuous learning is the minimum requirement for success in any field.

Time for Important People in Your Life
Relationships are everything. Be sure that in climbing the ladder of success, you do not find it leaning against the wrong building. Build time for your relationships into every day, no matter how busy you get.

Time for Important People in Your Life
These seven disciplines will ensure that you perform at the highest level and get the greatest satisfaction and results from everything you do. Study these seven disciplines and then make a plan for how you can incorporate each of them into your daily life.

Jan 2, 2010

Ruby: Extract Age from Birth Date

A Ruby function for extracting one's age by passing in the birth date as a parameter.