Perform Satistical Operations on Columns in CSV Files
lokety | 07 Mar 2007 | Posts | 55 views
This is a simple but powerful way to process files in Unix, using the humble program awk.
To calculate sum or average of a numerical column of a comma separated file, create a text file like so:
{ s += $3 }
END { printf “sum = %.2f, avg = %.2f, hits = %d\n”, s, s/NR, NR }
Use your creative juices to save it with a meaningful name, say, test.awk.
Call awk with this file, like so:
You should see the sum, average and number of lines processed. In this example, it is assumed that the values in each line are separated by commas, and the numerical column is the third one.
For more information on awk, RTFM or Google it.
Technorati Tags: programming, unix, awk, comma separated values, csv, sum, average, statistical
Related posts:
- Print Unix File Timestamp Accurate Down to Seconds
- Print Yesterday’s Date Using Perl
- Over-Generous Taxpayers or Defective Calculators?
Speed Up Performance of Mozilla Firefox
lokety | 19 Feb 2007 | Posts | 545 views
There are some tweaks that you can put in the Mozilla Firefox web browser to speed up your web user experience. Pages will render faster using more simultaneous connections, prefetching and other tricks.
In a blank Firefox window, enter “about:config” in the location bar. Some of the preferences below already exist, and you can check if they are there by typing the beginning in the “Filter” line. If a preference exists, you can change its value by double-clicking on it in the list. If a preference does not exist, right click on the window and select either “New”, then the appropriate “Type”. Enter the value and press “Enter”.
| No. | Preference | Type | Value | Description |
| 1 | network.http.pipelining | boolean | true | send multiple http requests before receiving any responses |
| 2 | network.http.pipelining.maxrequests | integer | 8 | as previous |
| 3 | network.http.proxy.pipelining | boolean | true | as previous |
| 4 | network.dns.disableIPv6 | boolean | true | disable IPv6 DNS servers’ bug of returning IPv4 addresses for IPv6 requests |
| 5 | content.interrupt.parsing | boolean | true | allow browser to respond to UI events by interrupting parsing of a page |
| 6 | content.notify.interval | integer | 750000 | as previous |
| 7 | content.switch.threshold | integer | 750000 | as previous |
| 8 | nglayout.initialpaint.delay | integer | 0 | set time delay from initial page loading to the first page that is rendered |
| 9 | browser.cache.memory.capacity | integer | 65536 | memory size used for storing pages for instant recall |
Restart Firefox to make the changes take effect.
If you are not comfortable with messing with the above and/or want more complex enhancements, try the Fasterfox extension for Firefox. It can prefetch links, tweak network settings, and block popups created by Adobe Flash.
List of options in Fasterfox (bold means described earlier):
- Enhanced prefetching
- Page load timer
- Memory cache
- Disk cache
- DNS cache expiration
- DNS cache entries
- Max. connections
- Max. connections per server
- Max. persistent connections per server
- Max. persistent connections per proxy
- Pipelining
- Pipelining first request
- Proxy pipelining
- Max. pipelining requests
- Initial paint delay
- Submenu delay
- Disable popups from plugins
Related post:
Mozilla Firefox 2.0.0.1 Web Browser Released
<URL:http://glob.lokety.com/2006/12/mozilla-firefox-2001-web-browser.html>
Links:
Fasterfox
<URL:http://fasterfox.mozdev.org/>
Download Firefox
<URL:http://www.spreadfirefox.com/?q=affiliates&id=187103&t=213>
Technorati Tags: firefox, mozilla firefox, web browser, firefox hacks, firefox tips, speed up, fasterfox, pipelining, prefetching
Related posts:
- Mozilla Firefox 2 Web Browser Released
- Mozilla Firefox 1.5.0.8 Web Browser Released
- Firefox Into the Sky!
Get paid cash to review posts on this site
lokety | 12 Feb 2007 | Posts | 410 views
I’m with an ad network called PayPerPost.com (PPP). Its sponsors pay me when I review a product or service that I’m interested in or have had experience with. I think it’s a great way to share something that I like and get some reimbursement for it.
Now PPP has an even better way to attract like-minded people like you to its network. If you have something to say about my posts, sign up with PPP and review my posts in your website. When you do this, you get paid US$7.50 via Paypal.com! This feature is known as “Review My Post” and you can get started by choosing posts that interest you and click on the “GET PAID TO REVIEW MY POST” button at the end of the posts.
Of course, I don’t mind if your review is negative, as I welcome all feedback except spam, which is what I usually get in my guestbook on my main site. The main purpose of this feature is to generate more traffic for both parties, and of course, the network. There may be minimum review requirements, like minimum number of words, web links to add, and minimum Google PageRank. Don’t worry, once you get the hang of reviewing and getting paid, it becomes too easy to link your topics and what the network has to offer.
PPP’s affiliate program features both this “Review My Post” and “Referral Program“. I think these are two great ways for PPP members to generate publishing income further than the sponsored posts. I suggest that PPP creates more colours and styles for those buttons for us to choose from, to better blend with our sites’ styles.
Technorati Tags: payperpost, sponsor network, review post, review, paid, money
Related posts:
- Blogger.com Template Tip: Render Previous Post Link At Bottom Of Main Page
- News – From nntp to rss
- Blogger.com Template Tip Part 2: Render Previous Post Links

Comments