Monday, May 20, 2013

Download "Stock Trading Riches" Free This Week

The Kindle version of "Stock Trading Riches" is free on Amazon all this week (Monday 5/20 - Friday 5/24).

Here is the link: http://www.amazon.com/Stock-Trading-Riches-Transforms-ebook/dp/B0065CE3VO 

Remember that, to enjoy Kindle books, you don't need to own a kindle. Amazon has free kindle readers for macs, PCs, iPads, etc.

Monday, March 25, 2013

My New Unix Book

Advanced Unix Shell Scripting: How to Reduce Your Labor and Increase Your Effectiveness Through Mastery of Unix Shell Scripting and Awk Programming is now available in paperback and kindle formats.  It will help you add shell scripting to your skills and resume!

Saturday, March 24, 2012

Building Java ClassPaths Automatically With Unix Scripts

Scenario: You want to run a java program from a shell script. Before you invoke the java command, you want to build the CLASSPATH vaariable dynamically with all the jar files in a certain directory (denoted by $java_dir).

Solution:

for line in $java_dir/*.jar

do

CLASSPATH="$CLASSPATH:$line"

done


This for loop will cycle through each file in the directory $java_dir that has a ".jar" extension.

During each pass, the variable "line" is set to the full pathname of the jar file. We add the jar's pathname to the CLASSPATH.

Monday, March 19, 2012

Ev Bogue and "Minimalist Business" Interview

On my "Stock Market Zen" blog, I have a two part interview with Ev Bogue, author of the best-selling eBook "Minimalist Business".

Here is the link to part I of the interview.

Saturday, February 18, 2012

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.

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