Tuesday, October 14, 2008

Becoming a Millionaire -- A Real-Life Example

Adjusted for inflation, $5,000 in 1940 is equivalent to $66,500 today. $66,500 is no small amount of money now, and -- though I wasn't alive -- $5,000 was no small amount of money in 1940. The average salary at the time was $1,300, so he invested 3.8 times the average salary in that first year.

Investing $5,000 now might set you on the path to becoming a multi-millionaire in the year 2070, and you'll be better off than if you hadn't, but $1,000,000 won't go so far in 2070 based on historical inflation.

To get that same purchasing/giving power in 2070 that this guy has today, you'd have to start investing with $66,500 according to inflation or assuming the average salary today is $30,000, the same factor of 3.8 would require an initial investment of $114,000.

1940 average salary info: http://kclibrary.nhmccd.edu/decade40.html

Monday, October 13, 2008

The Power of Compound Interest

The Power of Compound Interest

Albert Einstein is quoted as saying, "The most powerful force in the universe is compound interest." When someone as brilliant as Big Al talks about the power of compounding, I don't know about you, but I tend to listen!

Well, here's another smart guy, this time from Kiplinger's, who says, "Time is the most powerful weapon in an investor's arsenal. Nothing comes close to it." Why? Because of the power of compounding. Here are some of his key thoughts:

  • After 30 years of studying finance, I have found few eternal truths, but the most important -- the Golden Rule of Accumulation -- is this: Start early!
  • Time is the most powerful weapon in an investor's arsenal. Nothing comes close to it.
  • Let's do the numbers. The annualized return for U.S. large-company stocks (as represented by Standard & Poor's 500-stock index) for the past 80 years has been about 10%, not including taxes. Say your goal is to build a nest egg of $1 million by the time you are 55. If you start at age 24 and invest $5,000 a year at an annualized return of 10%, you'll reach your goal. But if you wait until you are 34 to start, you'll accumulate only $357,000 by age 55. If you start at age 44, you'll have just $107,000.
  • How can this be? The answer lies in compounding, the fact that interest increases the value of interest as well as the value of principal. If you earn 5% on $1,000, after a year you'll have $1,050. After two years, you'll have not $1,100 but $1,102.50.
  • As time passes, the power of compounding accelerates dramatically.
  • One other important fact about compounding is that a small increase in the rate of return can produce a huge impact over time. In the case of the gift to your newborn daughter, if her portfolio returns 10% annually, then $10,000 grows to $4.5 million by the time she is 65. But if her portfolio returns 8%, then it grows to only $1.4 million. If it returns 5%, it grows to a mere $227,000. In other words, half the rate of return produces an account that's less than one-twentieth the size.

The article then ends with this conclusion:

But enough numbers. If you're a young person, all you need to know is that you must start early. If you are an older person who has young progeny or young friends, encourage them to start early. If you're particularly generous, set up a long-term trust or a Section 529 tax-advantaged college savings plan, or simply open a mutual fund account that the young person promises not to touch (or perhaps doesn't know anything about).

The piece then goes on to talk about where to invest your money. Me? I like index funds.

Just a great overall summary of one of the pillars of growing your net worth. Every person needs to know, understand, and apply this financial wisdom to make the most of their finances. I've been doing it for 15 years or so now and the power of compound interest is still really starting to take off -- it's really making a strong impact on my net worth. I can't wait to see what it does over the next 20 years!!!!

One of my favorite quotes about taking action is this:

The best time to plant a tree is twenty years ago. The second best time is now.

If you've lost a lot of investing time because you've procrastinated, just didn't know what to do, didn't have the willpower to save, weren't able to save, or whatever reason you might come up with -- stop fretting about it. It's water under the bridge. There's nothing you can do to get back that lost time. But you can still make a difference in your finances. How? Start saving today! 20 years from now, you'll be glad you did. ;-)

Wednesday, January 09, 2008

C# NET 2.0, Formatting and Validating Data

C# NET 2.0, Formatting and Validating Data


Binding CValueBinding = new Binding("Text", dsView, "contents.cvalue");
CValueBinding.Format += new ConvertEventHandler(this.textValue_FormatCurrency);
textCValue.DataBindings.Add(CValueBinding);

private void
textValue_FormatCurrency(object sender, ConvertEventArgs e)
{
// The method converts only to string type. Test this using the DesiredType.
if(e.DesiredType != typeof(string)) return;

// Use the ToString method to format the value as currency ("c").
e.Value = ((double) e.Value).ToString("c");
}

-------------


Binding notesBinding = new Binding("Text", dsView, "author.notes");
notesBinding.Format += new ConvertEventHandler(this.textBoxNotes_FormatBlob);
textBoxNotes.DataBindings.Add(notesBinding);
The following gives details of the Format Blob Routine

private void textBoxNotes_FormatBlob(object sender, ConvertEventArgs e)
{
Byte[] byteBLOBData
= new Byte[0];
byteBLOBData = (Byte[])e.Value;
MemoryStream stmBLOBData = new MemoryStream(byteBLOBData);
e.Value = System.Text.Encoding.UTF8.GetString(byteBLOBData);
}


-----

dataGridView1.Columns["bal"].DefaultCellStyle.Format = "c";

Thursday, December 13, 2007

FAQ: How to recursively adjust file and directory permissions

Using the UNIX shell
Note: The find command automatically assumes that it should start from the current directory. To be safe, go to your public_html directory and specify a path as the first argument. Some shells, such as bash on Apple OS X, must have a path specified in the find command.

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 707 images
chmod 707 images/stories
chown apache:apache cache

Saturday, July 21, 2007

how to query analyzer within command line

psql -U postgres-su -d tp -h localhost

postgresql on ubuntu

PostgreSQL on Ubuntu Linux - How To (updated)

This 'How To' has now been replaced with an update. Check there for slightly better instructions. :D

Following on from my last post about PostgreSQL, i've found a couple of things were 'off' with the setup, so this is a quick re-write and update... on with the show!

So, if the last guide worked, what's different with this set-up...

  • We now enable and use the default 'postgres' user account to administrate our database server (saves creating a new one)!
  • We also fix a couple of issues with the networking set-up.
  • We now use the latest build of PostgreSQL - v8.1.
  • This set-up is less of a 'hack', than the last guide (i've been reading since then).

Before we move on, this guide was tested on (and intended for) the current stable build of Ubuntu (5.04 - Breezy Badger), but it should also work fine on any other build of Ubuntu/Debian (6.06 - Dapper Drake etc).

First off, PostgreSQL 8.1 isn't in the main repositories in Breezy, you'll need to have backports enabled to get hold of the latest packages. Once you've done that, let's move on.

Right, now let's install the database server. At the command-line, enter the following (Or you can do all this in Synaptic - just search for and install the packages listed in the commands):

> sudo apt-get install postgresql-8.1 postgresql-client-8.1
> sudo apt-get install pgadmin3 pgadmin3-data

This installs the database server, and the pgAdmin administration application (If you don't really get on with the pgAdmin GUI, there is an alternative in the form of phpPgAdmin - a web-based administration interface. A quick 'How To' on getting this up will be coming shortly! ;) ).

Now we need to reset the password for the 'postgres' admin account for the server, so we can use this for all of the system administration tasks. Type the following at the command-line (substitute in the password you want to use for your administrator account):

> sudo su postgres -c psql template1
template1=# ALTER USER postgres WITH PASSWORD '*password*';
template1=# \q

Then, from here on in we can use pgAdmin to run the database server. To get a menu entry for pgAdmin do the following...

> sudo gedit /usr/share/applications/pgadmin.desktop

Then paste the following into the file:

[Desktop Entry] Comment= PostgreSQL Administrator III
Name=pgAdmin III
Encoding=UTF-8
Exec=pgadmin3
Terminal=false
Comment[en_GB]=PostgreSQL Administrator III
Icon=/usr/share/pixmaps/pgadmin3.xpm
Type=Application
Categories=GNOME;Application;Database;System;
Name[en_GB]=pgAdmin III

Then save the file and exit gedit. You should find the launcher in the System Tools section of the Applications menu. Alternatively, you could just type 'pgadmin3' at the shell. The wizards to connect to the database should be pretty simple to figure out.

Finally, we need to open up the server so that we can access and use it remotely - unless you only want to access the database on the local machine (The guidelines here are for opening up your server on a secure LAN - if you are not on a secure LAN you may want to look into adding SSL authentication before proceeding with these steps).

To do this, first, we need to edit the postgresql.conf file:

> sudo gedit /etc/postgresql/8.1/main/postgresql.conf

Now, to edit a couple of lines in the 'Connections and Authentication' section...

Change the line:

#listen_addresses = 'localhost'

to

listen_addresses = '*'

and also change the line:

#password_encryption = on

to

password_encryption = on

Then save the file and close gedit.

Now for the final step, we must define who can access the server. This is all done using the pg_hba.conf file.

> sudo gedit /etc/postgresql/8.1/main/pg_hba.conf

Now add the following lines to the file:

# Allow any user on the local system to connect to any database under
# any user name using Unix-domain sockets (the default for local
# connections).
#
# Database administrative login by UNIX sockets
local all all trust

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all md5

# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5

# Connections for all PCs on the subnet
#
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
host all all [ip address] [subnet mask] md5

and in the last line, add in your subnet mask (i.e. 255.255.255.0) and the IP address of the machine that you would like to access your server (i.e. 138.250.192.115). However, if you would like to enable access to a range of IP addresses, just substitute the last number for a zero and all machines within that range will be allowed access (i.e. 138.250.192.0 would allow all machines with an IP address 138.250.192.x to use the database server).

That's it, now all you have to do is restart the server and all should be working!

> sudo /etc/init.d/postgresql-8.1 restart

Sunday, May 20, 2007

computer whiz woes

ah god... i'm growing tired of answering why the internet is slow, why their email send/receive is flaky. i can not perform miracles. really, sometimes internet flakiness/ISP's QoS should be reported to company's internet service provider. sometimes i just want to go back to philippines or elsewhere, find a job where a programmer can just concentrate on programming again. i can not perform miracles.

hope somebody will give me a gift like this


Quality of Service definition

Friday, April 13, 2007

ONLINE ORIGINAL: Carlos Slim: "The Key Is the Internet": "A: It's not a question of arriving [at a new company] and putting in a whole new administration, but instead, arriving and 'compacting' things as much as possible, reducing management layers. We want as few management layers as possible, so that executives are very close to the operations. We also don't believe in having big corporate infrastructures.
"

Thursday, April 05, 2007

Slashdot | HardOCP Spends 30 Days With Vista

Slashdot | HardOCP Spends 30 Days With Vista: "
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Curr entVersion\Explorer\Advanced]
'EnableBalloonTips'=dword:00000000"

Tuesday, March 13, 2007

Chris Taylor : Remoting Exceptions

Chris Taylor : Remoting Exceptions:

System.Reflection.Assembly remoting =
System.Reflection.Assembly.GetAssembly(
typeof(System.Runtime.Remoting.RemotingConfiguration) );



Type remotingConfigHandler = remoting.GetType
('System.Runtime.Remoting.RemotingConfigHandler');

Type customErrorsModes = remoting.GetType
('System.Runtime.Remoting.CustomErrorsModes');



FieldInfo errorMode = remotingConfigHandler.GetField('_errorMode',

BindingFlags.Static | BindingFlags.NonPublic);



FieldInfo mode = customErrorsModes.GetField( 'Off' );

errorMode.SetValue( null, mode.GetValue( null ) );

Friday, March 02, 2007

: "1. Change your thinking by asking better questions.

Often, when we're struggling financially we ask the wrong questions. Asking negative questions like why you're always broke or can't get a raise can lead to negative answers. If you believe you can't make more money and consequently do nothing to change, you'll prove yourself right. If you think it's just too hard, it will be.

But if, instead, you empower yourself by asking, 'What can I do to make more?' then you'll change your life. I asked Dan and Sally, 'What can you do to earn more money' They focused on the answer, and together we went to work on their plan.

It took a lot of work (theirs, not mine): Dan picked up an additional coaching job and grew his summer lawn-care business, while Sally picked up summer school teaching jobs and started a mini-eBay business. It wasn't easy for them, but they did it. "

Saturday, February 24, 2007

how to shrink transaction log

DBCC SHRINKFILE(starhonda_log, 2)
BACKUP LOG starhonda WITH TRUNCATE_ONLY

DBCC SHRINKFILE(starhonda_log,2)

Tuesday, December 26, 2006

Make MSHFlexGrid Editable without help of any - visual basic, vb, vbscript

Make MSHFlexGrid Editable without help of any - visual basic, vb, vbscript:

Private Sub msh1_KeyPress(KeyAscii As Integer)


Select Case KeyAscii
Case vbKeyReturn, vbKeyTab
'move to next cell.

With msh1


If .Col + 1 <= .Cols - 1 Then
.Col = .Col + 1
Else


If .Row + 1 <= .Rows - 1 Then
.Row = .Row + 1
.Col = 0
Else
.Row = 1
.Col = 0
End If

End If

End With

Case vbKeyBack


With msh1
'remove the last character, if any.

If Len(.Text) Then
.Text = Left(.Text, Len(.Text) - 1)
End If

End With

Case Is < 32
Case Else

With msh1
.Text = .Text & Chr(KeyAscii)
End With

End Select

End Sub

Slashdot | Vista Security The 'Longest Suicide Note in History'?

Slashdot | Vista Security The 'Longest Suicide Note in History'?:

by aralin (107264) on Monday December 25, @07:05PM (#17362088)
You know this is a problem when dealing with Microsoft. You come into the process as objective person without prejudice to them and then you study the subject. If you study in a sufficient detail, you will become so enraged by what they are doing and that you are now hopelessly prejudiced against Microsoft. Look at the judge Jackson in the Microsoft trial. That is a person who's living depends on being objective and he got so pissed off by studying Microsoft practices that even he was not able to keep being perceived as impartial and so his ruling got thrown out by court of higher instance.

The most sad part is that Microsoft is abusing this by pointing to every such study as prejudiced and often rightly so. But what is the general public to do now? You either have experts that study the matter and become prejudiced or you have those with only superficial knowledge who can keep the illusion of objectivity but more often than not they do not know enough about the matter. Often to the point to believe studies paid by Microsoft as being a source of objective information. And if you want to keep the illusion of objectivity you need to cite those and it just seems wrong to me.

Sometimes you are just not supposed to be objective. Some topics do not invite that form of discussion. Is the Earth flat? I don't think anybody expects you to present the supporting opinion in equal length. Did holocaust happen? Again, not really a question in need of giving equal space to both sides. So why 'Is Microsoft crooked and do they intentionally cripple their product to harm consumer and competition?' needs any more discussion even after it was affirmed by Findings of Fact published by a federal judge? The matter of do they or don't they has long been settled. At this point the only question should be: "How exactly are they trying to cheat this time?"

Friday, December 22, 2006

Slashdot | Why Palm Still Covets Palm OS: "PalmOS is definitely stone-age internally, but guess what: being a PITA for programmers has *NOTHING* to do with its unmatched usability for end users.

I don't care how good WinCE's CLR is - it's a usability nightmare on a phone-sized device (why should I care what apps are running? I have zero interest in quitting this program to free up enough memory to run that program. The PIM functions also blow. And a Start menu? Please die.)

And J2ME is a very decent programming model? Yeah, great for programmers. Shitty for users. Have you ever actually *USED* third-party java apps on a Blackberry? I had the displeasure of having to carry one for $WORK years ago. Here's four words that sum up J2ME: 'loading... um... still loading.'"

What's the suspicious Rundll32.exe process?

What's the suspicious Rundll32.exe process?: "o know the module which is executed by Rundll32, proceed further. Without any third-party tools, here is a neat way to track down what the Rundll32 is executing. Open a Command Prompt window and type the following command:

tasklist /m /fi 'IMAGENAME eq rundll32.exe' >C:\rundll32.txt

rundll32-2.JPG (35490 bytes)Now, open the file C:\rundll32.txt file and identify the 'odd' modules. (filter out the system files and dependencies used by Rundll32.exe. The odd one (in this example) is the timedate.cpl file. Yes. I had the Date/Time dialog open and this is what Rundll32.ex"

Thursday, December 21, 2006

Slashdot | Drinking Alcohol May Extend Your Life

Slashdot | Drinking Alcohol May Extend Your Life:

by Ancient_Hacker (751168) on Wednesday December 20, @04:26PM (#17317792)
Well, that would be *excellent*, I love a glass of wine or three a day. A beer or two on a hot day is just heavenly.

But unfortunately the correlation may not imply causation. i.e. people who live longer drink more, but not vice-versa.

  • Maybe really sick people don't drink as much.
  • Maybe the people that have four drinks a day have to be quite healthy to keep that up day after day after day.
  • Maybe drinking keeps them off the streets, or out of other dangerous places.
  • Maybe all the 4-drink-a-day people have died already and were not around for a survey.

Lotsa possible ways to spoil things.