Saturday, February 18, 2012

The Bigger, The Better

Guest written by our friend Gladys Fuentes

So they say everything is bigger in Texas. After moving to Texas, we logged on to planotxsatellitetv.com to purchase our satellite TV package. We were pleased to see that our range and variety of channels was, in fact, much more wide than what we had previously had. This got me thinking about the movie “Supersize Me.” In this documentary, a man goes on a journey to only eat McDonalds for a given period of time. He forces himself to “super-size” each portion that he orders from this restaurant. Over the course of his experiment, it is shocking to see the physical changes to this man’s body and health. He goes from a very average weight and health to a man that is obese and physically sick. With each step of the challenge, this man’s blood counts get worse and worse. Not only does he change physically, but his mental well-being worsens as do his food habits. He admittedly becomes less and less energetic. He claims to feel mentally “foggy” and has a hard time concentrating on basic tasks. He dips into pretty severe depression and lethargy. Sadly, this entire negative change is from the food he puts into his mouth. This food, consumed by millions each day, literally poisons his body and mind. It makes you think twice about stopping for something “fast.”

5 Unix Tips From Hemingway

I read a good blog post on Writing Tips from Ernest Hemingway.

Hemingway could have been giving Unix advice:

Writing tips:

1. Use short sentences.

2. Use short paragraphs.

3. Use vigorous English - make your writing forceful.

4. Use positive words instead of negative ones - i.e. software is "stable" rather than "bug-free".

5. Write one page of masterpiece vs. 91 pages of garbage.


Unix Tips:

1. Create small subprograms that do one function.

2. Use subprograms to build a small program that does one task.

3. Make use of unix pipes and powerful command-line utilities.

4. Create programs that interface with other programs, instead of user interfaces.

5. A one page shell script vs. many pages of C or java.

Friday, February 10, 2012

How the Internet and Technology is Changing Advertising and Marketing

It used to be that, if you wanted to advertise your product or service, you would engage an Advertising Agency who would create print, radio, and/or television ads for you. Then, they would buy time or space on television, radio, newspapers, and magazines.

These ads would be expensive. There would not be any tracking or recording of actions taken. There would not be any interactivity. Instead, the shows would have a known rating while newspapers would have a certain circulation.

For the most part, except for certain specialty publications, the audience would be general in nature. Your ad agency would have advised you to not expect any special results - such as a rise in sales. Instead, the ad was meant to raise "awareness" of your brand.

Now fast forward to today. Today, everything has changed and new ad agencies - such as That! Advertising Agency, are helping their clients thrive in the new environment of advertising.

They can help you adjust to a world where TV, magazines, and newspapers compete with "on demand" programming, the internet, streaming movies, etc. The audience for mainstream media are smaller and more fragmented. Also, viewers are more jaded about advertising, and have technical ways (such as DVRs) to skip ads.

On the other hand, people are interacting online on social networking sites, chat rooms, and forums. They tune out many online ads, but are attracted to sites that give useful content. They are more likely to buy from a site that gave away basic information, or that was recommended by an online connection.

In addition, new technology makes it possible to track interactions and the results of ads. Advertising can be targeted and honed to appeal tightly to specific groups (for example, left handed 50 year old males in Portland) and measure specific results (for example sign-ups to a newsletter).

Thursday, February 09, 2012

Splitting a Unix File into Smaller Files

Let's say that we have a large unix file. For example, a text file called my_list with 100,000 lines.

We need the data contained in smaller files with no more than 1000 lines each.

We can use the unix split command:

split -1000 my_list

This will create 100 files in the current directory that each contain 1000 lines from my_list. Since we did not specify a name for the output file, the files will be named by an x, followed by two letters of the alphabet (from aa to zz).

So, for example, the first 1000 lines of my_list will be in file xaa, the next 1000 lines in xab, the next 1000 in xac, etc.

If we had specified an output file name like this:

split -1000 my_list my_list

then the output files would have been my_listaa, mylistab, etc.

Programming Quotes

There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.

— C.A.R. Hoare, The 1980 ACM Turing Award Lecture


The computing scientist's main challenge is not to get confused by the complexities of his own making.

— E. W. Dijkstra


The cheapest, fastest, and most reliable components are those that aren't there.

— Gordon Bell


One of my most productive days was throwing away 1000 lines of code.

— Ken Thompson

Monday, January 23, 2012

New Middle Eastern Search Engine Marketing Trend is Social Network Optimization

Social networks and "web 2.0" are now such an important part of the internet, that the most recent trend among Middle Eastern search engine marketing firms is advising clients on how to design social media friendly sites.

This is a growing way of attracting traffic to Middle Eastern web sites, which is the ultimate goal of any middle eastern search engine optimization firm.

While the search engine optimization part of their service is still concerned with getting the website ranked higher by the major search engines, the newly created social media optimization part is concerned with encouraging visitors to communicate about the site, and pass out links, to their social connections.

This primarily involves 2 activities: encouraging the creation of content that excites your target audience, and providing widgets or links that allow them to easily share your content with one click (for example, a "like" icon to share on Facebook).

This new social traffic can also be fed into middle eastern ppc management campaigns.

The Unix Change Directory Command

In unix, the cd command is used to change directories. For example, cd /tmp will put you in the /tmp directory.

Here are some tips/tricks for cd:

cd by itself or cd ~ will always put you in your home directory.

cd ~username will put you in username's home directory.

cd dir (without a /) will put you in a subdirectory. for example, if you are in /usr, typing cd bin will put you in /usr/bin, while cd /bin puts you in /bin.

cd .. will move you up one directory. So, if you are /usr/bin/tmp, cd .. moves you to /usr/bin, while cd ../.. moves you to /usr (i.e. up two levels). You can use this indirection to access subdirectories too. So, from /usr/bin/tmp, you can use cd ../../local to go to /usr/local.

cd - will switch you to the previous directory. For example, if you are in /usr/bin/tmp, and go to /etc, you can type cd - to go back to /usr/bin/tmp. You can use this to toggle back and forth between two directories.

Thursday, January 19, 2012

WATCHING REALITY TV

Guest post written by my buddy Royce Heath

I started watching another reality television show on Direct.TV. It is one that I swore that I would never end up watching, but I actually really enjoy it. I know that everyone makes fun of it and thinks that it is totally ridiculous, especially after the big celebrity wedding that my favorite reality television show family had in August. Yes, I watched the wedding special. I even had some friends over to the house to watch the two day houbla. You can image our sheer and utter disappointment when we found out on Halloween that Kim Kardashian and Kris Humphries were ending their marriage after only seventy two days. I even felt a little betrayed, like the wedding may have been for show, but of course, I am watching the new season. I have to find out what happens to the marriage. So far, I can see exactly why the things ended up the way that they did. Kim and Kris barely spent anytime together after they got married. He was in Minnesota after they moved to New York and she traveled to Dubai without him. They also lived with Kim’s sister and her boyfriend.

Temperature Conversion Through Awk

Here is an awk program to convert between celcius and Fahrenheit temperatures. 
 
Unlike most of my programs, this program is interactive.  Once started, it interacts with the user at the command line, and accepts commands until the user quits.
 
Here is the run:
 
[513]-> cel_fahr
 
Current input set to: fahrenheit
 
enter q, f, c, or temp:
 
212
 
212 degrees F is 100 degrees C
 
Current input set to: fahrenheit
 
enter q, f, c, or temp:
 
rt
 
Current input set to: fahrenheit
 
enter q, f, c, or temp:
 
c
 
Current input set to: celcius
 
enter q, f, c, or temp:
 
0
 
0 degrees C is 32 degrees F
 
Current input set to: celcius
 
enter q, f, c, or temp:
 
q
 
 
In the run above, the user input is in black, while the displayed text is in green.  Notice that when I type in a number, the system interprets it as either degrees C or F (depending on the input setting), and prints the conversion.
 
If I type "c" or "f", the input units are changed.  If I type "q", the system quits.  If I type anything else that is not a number (example "rt"), the program ignores it.
 
Here is the script:
 
nawk '
 
BEGIN {
 
f = "fahrenheit"
c = "celcius"
choice = f
 
while (x != "q")
{
 
print
print "Current input set to: "choice
print "enter q, f, c, or temp: "
"read x;echo $x"|getline x
close "read x;echo $x"
 
if (x == "f") choice = f
if (x == "c") choice = c
 
if (x ~ /^[0-9]*$/ || -1*x ~ /^[0-9]*$/)
{
if (choice == f)
print x" degrees F is "5/9 * (x - 32)" degrees C"
if (choice == c)
print x" degrees C is "x*9/5 + 32" degrees F"
}
 
}
}'
 
Let's analyze the script.  First, this script is completely in a BEGIN section, so it is a procedural program. We set the default choice to be fahrenheit, and then loop until the user enters a "q".
 
In the loop, we start by printing the menu, and then use getline to create a shell process which reads from the keyboard into unix variable x and then echos unix variable x into getline, where it is assigned to x in the awk program.
 
We then close the process so that, the next time we run the process, it will do a fresh read.
 
If the input is either "f" or "c", we set the choice.
 
Then, if the input is either a positive or negative number, we convert it from the input units to the other unit, and display the result.

Saturday, December 31, 2011

Why You Might Want To Leave Advanced SEO To The Experts

Most people who create web pages want the search engines to index their site, and send them lots of visitors. To get more visitors, they want to engage in SEO (optimize their site for the search engines to rank it high).

Anyone can create good content that will get indexed by the search engines, and rank higher for some key words and phrases - thus generating some traffic. However, if you want to attract a large amount of traffic by ranking high for competitive key words (like "insurance"), you may want to hire an expert at search engine optimization (seo).

If you try to do your own optimization, you will have to spend hours away from your area of expertise (your business) and focus on concepts like choosing keywords, meta tags, keyword frequency, keyword density, etc.

Also, someone trying to do SEO on their own will probably try to teach themselves site optimization through info products (books, ebooks, videos, mp3s, etc) that are probably out of date. This is because search companies are frequently tuning their algorithms to refine their listings, and eliminate sites that are trying to game their rankings.

SEO experts, on the other hand, are continually studying and learning. Besides books and websites, they attend conferences, seminars, study white papers, and test / tweak / experiment on their own sites.

For them, SEO is their expertise, so they can afford to devote a lot of time to studying and learning the latest tends and techniques - while the owner of the website could be advancing in his or her own business.

Another challenge for an individual doing his own SEO is the new opportunities and pitfalls involved in local search engine optimization. With the growth of mobile computing, local search engines and search results are increasing tremendously. When potential customers filter a search for local results or use an engine that reads their GPS coordinates, a website that has optimized for location can jump ahead of someone who ranks higher for the keyword.

Most website owners will not know all the nuances involved in optimizing for local searches.344 For all these reasons, website owners may want to outsource their search engine optimization to an expert.

Friday, December 30, 2011

A Random Coupon Generator Written in Awk

Here is an awk script I use to generate 100 random 8-character coupon codes.

Each character has 62 possibilities (a-z, A-Z, and 0-9). This means there are 8^62 possible coupon codes.

BEGIN {

s="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"

srand()

for (i=1;i<=100;i++){ code="" for (j=1;j<=8;j++) code = code""substr(s,int(rand()*62)+1,1) print code } } Let's analyze the script. First, we set string s to hold all 62 possible characters.

Next, we call srand() to seed awk's random number generator. We left the argument blank, so that the current date is used for seeding.

We now loop 100 times, because we want to output 100 coupon codes.

In this loop, we first set the coupon code back to the empty string. Then, we have an inner loop that executes 8 times to build the code. Finally, we print the code.

Notice the command in the inner loop. This command uses the random (rand) function. Since rand() returns a number greater or equal to 0, and less than 1, we multiply it by 62 and use the integer (int) function.

This will return a number between 0 and 61. Why? Because int(0*62) = int(0) = 0 and int(.999...*62) = int(61.99...) = 61.

We then add 1 to the result to get a random number from 1-62. We then use this result in the substr function to randomly pick a character.