Friday, December 22, 2006

Print Yesterday's Date Using Perl

Quick tip for working with Unix scripts that need yesterday's date. If you have Perl, try this:

perl -e '@y=localtime(time()-86400);printf "%04d%02d%02d",$y[5]+1900,$y[4]+1,$y[3];'

should print to stdout the date in the yyyymmdd format. Much simpler than writing an entire function in a script and messing around with 1st of the month, leap years, and possibly dates beyond 2037 (check Perl documentation).

Links:

The UNIX Forums - get yesterday in yyyymmdd format
<URL:http://www.unix.com/showthread.php?t=20181>

Technorati Tags: , , , ,

Wednesday, December 20, 2006

Mozilla Firefox 2.0.0.1 Web Browser Released

Mozilla Firefox (FF) 2.0.0.1 has been released on December 19 2006. The second release from 2.0 has 8 general bug fixes and many new features.

Always use protection. Firefox.

Among the fixes, the five critical ones are:
Click on each of them to view details.

New stuff I haven't seen before are:

Live Titles - Allows you to create bookmarks with microsummaries on the bookmark labels that can be regularly updated, as opposed to a static label. Web site owners can quickly put bits of updates on their site <title> tag without having to implement a RSS feed.

JavaScript 1.7 - New scripting language version includes support for generators, iterators, array comprehensions, let expressions, and destructuring assignment. More ways to complicate browsers and confuse visitors :P

Client-side session and persistent storage - Online transactions that make use of client-side storage for document and mailbox management can now store large structured data. Useful for websites like Google Docs and Spreadsheets http://docs.google.com and online banking sites.

New Windows installer - Uses the Nullsoft Scriptable Install System, which is neat and stable. You may have probably seen it used in Winamp.

Personally, FF 1.5.0.8 has been very stable for me. Although I have more than 10 tabs and 10 extensions installed, it has crashed no more than a few times since I started using it.

Click on the download link below to get this release.

Update (21 Dec 2006): If you are still on 1.5.0.x like me, you should get the update to FF 1.5.0.9 which contains the almost the same set of bug fixes as FF 2.0.0.1. The download should be about 510KB.

Related posts:

Mozilla Firefox 1.5.0.8 Web Browser Released
<URL:http://glob.lokety.com/2006/11/mozilla-firefox-1508-web-browser.html>

Mozilla Firefox 2 Web Browser Released
<URL:http://glob.lokety.com/2006/10/mozilla-firefox-2-web-browser-released.html>

Firefox Into The Sky!
<URL:http://glob.lokety.com/2006/05/firefox-into-sky.html>

Links:

Mozilla Firefox 2.0.0.1 Release Notes
<URL:http://www.mozilla.com/en-US/firefox/2.0/releasenotes/>

Download Firefox
<URL:http://www.spreadfirefox.com/?q=affiliates&id=187103&t=213>

Technorati Tags: , , , ,

Wednesday, December 13, 2006

Blogger.com Template Tip Part 2: Render Previous Post Links

Enhancing on the previous session of Blogger.com template goodies, I've finetuned the behaviour of the "Previous Post/Month" link at the bottom of three types of blog pages. The common tip that other bloggers use to display the previous post's link will not work well in the individual post pages, thus the need to enhance using JavaScript here. They are:
  1. MainPage - display link to the n + 1 page, where n is the number of posts to display per page
  2. ItemPage - display link to the previous post
  3. ArchivePage - display select combobox with all months of posts
You may want to read up on the previous session first before proceeding below.

Place this (updated) JavaScript code anywhere in between your template's <head> tag. Same thing, adjust nMaxPostsOnMainPage to the number of posts that you have set to display.

<script type="text/javascript">
// This JavaScript code created by Teng-Yan Loke
// Date: 12 Dec 2006 2349hrs
// Website: http://glob.lokety.com
// E-mail: lokety-at-gmail.com
var nMaxPostsOnMainPage = 2;
var nItemTitleTruncateLength = 50;
var aPosts = new Array(nMaxPostsOnMainPage + 1);
var n = 0;
var sItemTitle;
<BloggerPreviousItems>
sItemTitle = String("<$BlogPreviousItemTitle$>").substring(0, nItemTitleTruncateLength);
aPosts[n] = "<$BlogItemPermalinkURL$>|" + sItemTitle; n = n + 1;</BloggerPreviousItems>
function writePrevPostOnMainPage()
{
var sTmp;

sTmp = aPosts[nMaxPostsOnMainPage].split("|");
if (sTmp[1].length == nItemTitleTruncateLength) sTmp[1] = sTmp[1] + "...";
document.write("<a href=\"" + sTmp[0] + "\" target=\"_top\">" + sTmp[1] + "</a>");
}

function writePrevPostOnItemPage()
{
var sTmp;
var sItemTitle;
var i = 0;
var j = 0;

sItemTitle = String("<ItemPage><Blogger><$BlogItemTitle$></Blogger></ItemPage>").substring(0, nItemTitleTruncateLength);
do {
sTmp = aPosts[i].split("|");
if (sTmp[1] == sItemTitle)
j = 1;
i++;
} while (j == 0);
sTmp = aPosts[i].split("|");
if (sTmp[1].length == nItemTitleTruncateLength) sTmp[1] = sTmp[1] + "...";
document.write("<a href=\"" + sTmp[0] + "\" target=\"_top\">" + sTmp[1] + "</a>");
}
</script>

Main Page

Use the JavaScript function writePrevPostOnMainPage() as before, on the main page. You can use something like:

<MainPage><div style="">Previous post: <script type="text/javascript">writePrevPostOnMainPage();</script></div></MainPage>

Item Page

For individual posts, use the following code. You can place this just next to the preceding code of the <MainPage> tags.

<ItemPage><p>Previous post: <script type="text/javascript">writePrevPostOnItemPage();</script></p></ItemPage>

Archive Page

This last part may be no surprise to some of you as you may have seen a variant of this elsewhere. Place this code next to the preceding code:

<ArchivePage><p><a href="<$BlogURL$>" target="_top">Back to Home</a> |
Other Months: <form name="previouspostform"><select name="previouspostselect" size="1">
<option>click here</option>
<BloggerArchives>
<option onclick="javascript:window.location.href='<$BlogArchiveURL$>';"><$BlogArchiveName$></option>
</BloggerArchives>
</select></form></p></ArchivePage>

Same your template, publish, and test these goodies out!

If you try all these code, please let me know how it goes for you. Leave comments here...

Related posts:

Blogger.com Template Tip: Render Previous Post Link At Bottom Of Main Page
<URL:http://glob.lokety.com/2006/11/bloggercom-template-tip-render.html>

Technorati Tags: , , , , , , , , ,

Tuesday, December 12, 2006

Google Finance Website Revamped

Google has changed its finance news and charting website, Google Finance.

Google Finance Screenshot

The new layout much cleaner and presentable as the page is divided into three columns. Recent quotes, stored using browser cookies, has been moved from the top right corner to the lower left corner. General news and corporate news of the recent quotes are featured in the center column. Most links on the page will bring you to a different page, except the top movers on the lower right.

However, the individual stock pages have not changed. :|

Overall looks pretty, but I have a few suggestions:
  • Dynamically refresh each section using individual settings (they do change now, which is really cool)
  • Display summary or beginning of news articles when mouseover links
  • Background colour-code recent quotes with their related news
  • Include stock historical prices and options
Maybe I should feedback these pointers to the Google Finance team? Although the traffic to this site is a fraction of that to Yahoo! Finance, I'm staying here because there are no fancy advertisements (full of offers that hardly benefit most of us but only the advertiser).

Technorati Tags: , , , , , , ,

Sunday, December 10, 2006

Cell Therapeutics to Submit New XYOTAX Drug Trial to FDA

Cell Therapeutics announced on Friday that it will close a XYOTAX drug trial, known as PIONEER, to submit a new trial protocol to the Food and Drug Administration (FDA). The new protocol will be known as PGT306 and will be submitted to the FDA by year's end.

Because of the particularly low death rate among women patients during the trial, CTIC wants to focus its research on women with normal estogen levels. CEO Dr. James Bianco hopes that this group will be able to increase its uptake and metabolism of the chemotherapeutic drug because of estrogen.

Shares of CTIC dipped 2.2% to $1.86 on 8 December 2006.

Share chart of CTIC

Related posts:

Cell Therapeutics To Suspend Enrollment for PIONEER Drug Trial
<URL:http://glob.lokety.com/2006/11/cell-therapeutics-to-suspend.html>

Cell Therapeutics Signs Deal With Norvatis
<URL:http://glob.lokety.com/2006/09/cell-therapeutics-signs-deal-with.html>

Cell Therapeutics Up After Positive Xyotax Phase 1 Results
<URL:http://glob.lokety.com/2006/08/cell-therapeutics-up-after-positive.html>

Cell Therapeutics Signs Financing Agreement
<URL:http://glob.lokety.com/2006/06/cell-therapeutics-signs-financing.html>

Technorati Tags: , , , , , , ,

Wednesday, December 06, 2006

Five Tips To Be Financially Independent

1. Limit or reduce the number and amount of loans. Banks and financing companies live on interests charged on loans that people take up. Credit card loans are the top killers, as they typically charge double-digit rates per day, so don't owe the banks such money! Other loans include cars, consumer goods, and cash. Interest-free loans are quite harmless, but you may be penalized if you fail to pay or pay less than the installment amount. Likewise, property loans are not necessary evil. There are loans which are healthy to have, such as borrowing money to invest with calculated risk.

2. Keep track of your expenses. Use spreadsheets and record every expense you incur day to day. For each expense, write down the date, description, and amount. At the end of each month, compare the total expense amount with your income streams, such as salary. You can also categorize the expenses, such as credit card repayment, food and beverage, travel, and luxuries/"wants". Draw up charts to help you understand your spending patterns easily. By having such data and charts, you can decide how and where to control your spending habits to better motivate yourself to (a) increase the amount of cash to save or invest (b) think of ways to increase the number of income streams. I have an Excel spreadsheet which is pretty good for such a purpose. Contact me if you want a copy.

Time is money.3. Increase the number of income streams. An important mantra of many rich gurus like Robert Kiyosaki and Spencer Johnson. Streams such as salary, rent, dividends and investment returns are some examples. Why is this important? Well, look at the opposite. Most of us have lots of expenses; expenses coming from your basic necessities, loans, bills, family commitments and so on. Compare this with the number of income streams you have, isn't it very unbalanced? Think of the problems that will arise if and when you happen to lose that stream of income. Reduce that risk by thinking of ways to increase income streams. Getting another job is one way, but not a very wise one. Try owning properties and collecting rent from them. Invest in a business venture or the stock market.

4. Carefully choose the form that your assets are stored in. Do you keep a lot of cash in a savings account? Or do you have it in gold, stocks, mutual funds, or under your bed? Where and for how long you maintain your assets will determine how much you are potentially growing or at the least avoid being eaten by the inflation rate. Inflation makes your spending power and the value of cash and other assets depreciate over time. Don't be caught by surprise when you realize that your $10,000 in the bank is worth $1,000 in 15 years' time. Study and plan where the cash should be stored, or invested in.

5. Give it away! Not all expenses are bad ideas and be avoided at all costs (no pun intended). A good habit to have is to ask yourself whenever you are about to spend: is my money leaving my pocket with the possibility of returning later, and maybe even more than before? Identify ways and chances when you can actually spend money to get more in the future. It could be buying some antique collection, or buying a piece of land. It could be paying for a nice car, but actually selling it at a higher price the next day. Lastly, believe in the mantra of good karma: giving your money and assets to needy people or to your religious authority will reward your kind deeds. Give freely even if there will be no returns. Feeling happy about it is already a good thing!

This is not a list to help you to get rich. The purpose is to be financially independent or financially free, meaning you don't have to depend on money as much as before or not at all. If you do happen to lose some or all of your assets, you won't be very worried about the loss and you would know exactly how and when to make it up.

When you are financially independent, you take out one big worry in life and have more of one of the most important resources in life: time. Time is precious and most of us have less than one hundred birthdays to celebrate.

Think about that.

Links:

bloggingstocks - Your first $10,000: Getting Started
<URL:http://www.bloggingstocks.com/2006/12/20/your-first-10-000-getting-started/>

Technorati Tags: , , , , , , , ,

Friday, December 01, 2006

Secure and Convenient Keyless Door Locks

Most of us who have locked doors to open at home or at the office know the hassles of using keys to lock and unlock them. In no particular order:
  • Losing the key meant having to replace the lock and all copies of the key
  • Scratches and dents on the door around the lock
  • Fumbling, searching, sorting, selecting the right key while running the risk of getting mugged in front of the door
  • Ensuring that you are holding the key before you close a door which automatically locks
  • Keeping keys in a pouch, wallet, purse, or pocket, causing wear
Instead of messing with keys, try using something that only you own and can never lose: fingerprints! BrickHouse Electronics has a quality range of keyless door locks which use the uniqueness and convenience of your fingerprint to gain access.

BrickHouse Electronics Fingerprint Door LockFingerprints are tested to be very unique as there is only a chance of false acceptance of a fingerprint in tens of millions of fingerprints. It is obviously more convenient to use as you have it with you all the time. Other family members or staff can also train their own fingerprints into the locks, so there is no need to share fingerprints (which is not possible anyway).

For the above peeves of using keys, I would buy and use one of these locks in the future. Residential crime is prevalent in Malaysia and having one of these devices can save the time spent opening doors and getting in safely. I don't have to duplicate keys for others anymore, so there is no risk of the key smith copying your key unscrupulously.

One disadvantage of fingerprint door locks would be in the event of power loss. BrickHouse locks use batteries, which the lock will remind you to change when they are low on power. You have to be vigilant in changing batteries about every year. Fortunately, even if the batteries are flat and the fingerprint sensor does not work, you can still use a mechanical key to unlock - very clever!

The last thing to consider is the price. These locks cost about five times more than key locks, but I think they are worth the convenience, enhanced security and cool factor. Imagine, no keys clinging, no need for bright lights at the doorway, and silent and smooth access into your home or office!

Links:

BrickHouse Electronics Biometric Door Locks
<URL:http://www.brickhousesecurity.com/keylessdoorlock-electronicbiometric-fingerprintlock.html>

Technorati Tags: , , , , , , ,