Friday, November 9, 2007

Do you Zecco?

One of the first few posts that I wrote when I started writing this blog was about Zecco. $0 stock trades! The terms and conditions have changed a a little since then. It no longer works as "unlimited" number of free trades (I didn't need that anyways), but has changed to such that now you can make up to 10 free stock trades in any one month that you maintain $2,500 minimum account net equity. After that, you pay only $4.50 per stock trade.

Still a pretty fair enough deal and for most smart investors, that should work.

As an incentive for telling your friends about this, existing account holders can now receive a $50 credit in their account for referring a friend who enrolls (as a side note, I was not too happy with the whole experience dealing with opening your account at Zecco and hopefully that has changed since) and funds that account.

This is my "personal invitation link":
http://friends.zecco.com/r/08469b94e076102a8555

Please feel free to join by sending yourself an invitation using that link. As an added incentive, you get a FREE (as in Zecco trades :-)) copy of a book called Small Giants written by Bo Burlingham.

Happy Fee[sic] Trading!

Tuesday, October 30, 2007

Enhanced thinking on overseas investing

I spent a lot of time thinking about how to get my portfolio the necessary overseas/developing country exposure right from the the start when I started taking investing seriously. However, my thinking was limited to buying into country-specific funds and Vanguard Emerging Market ETF -VWO.

Around the same time, being overwhelmed with news and information about the United States economy, I understood the need to be invested in large-caps through out 2007 as it was obvious that they will be out-performing the small-caps over the new couple of years at least.

However, it seems I limited my thinking about overseas investing by exposing myself to too much risk in the form of what I owned (IIF and VWO). Luckily, the fast growing emerging markets prevented embarrassment. The US economy lags behind significantly this year in growth compared to other markets:

Country2007 growth
China11.5%
India8.9
Russia7.0
Middle East5.9
Central/Eastern Europe5.8
Brazil4.4
United Kingdom3.1
Mexico2.9
Euro area2.5
United States1.9

However, I could have done a better job of not only benefiting from overseas exposure, but even achieving a more balanced portfolio had I thought about things a little more. Large US companies have a significant exposure to foreign markets. On an average, the S&P 500 companies get approximately 50% of their revenue from goods that are made or sold overseas.
Also more recently, the falling dollar I suppose helps too in making the American goods more cost-competitive internationally. Intel (which is one of the only 2 out-and-out stocks that I own, part of a very badly managed and tiny Roth-IRA), Coca Cola, McDonald's, Exxon Mobil just to new a few HUGE companies have close to 70% of their revenues from overseas.

So, owning a large-cap U.S. growth ETF or an S&P 500 ETF, you might have provided me with all the multinationals I would need, while at the same time moving me a lot more steps closer to a balanced portfolio.

Well, lesson learned! It seems investing is like a practice. At least it is for me.

The question that bothers me however is that if all of these large-caps have so much overseas exposure AND I would think large-caps make up a significant part of the entire US economy, wouldn't all that growth in other countries in turn reflect in growth in these companies and onto the growth number of US economy itself? hmmm......

Monday, October 1, 2007

Warren Buffett thinks like me!!!

......well, not really, but its a title that makes this post without a picture a little more interesting to read!

Very often I stumble on an article or two on what successful, powerful, smart and admirable people offer as suggestions to the mere mortals. As a side note, I always wonder who these "lucky" interviewers are who get to meet these superstars and ask the question. Do you think they might slip in a couple of personal investing questions just in case they get a lucky?

Anyways, while reading about those investing tips from Warren Buffett, I noticed that if you simply adopt a discipline and the benefits of a good investment vehicle like ETF, you cover the spread on most such lists without even trying very hard. Lets analyze:

1. Invest in Businesses, Not in Stocks
When you invest with ETFs, you buy into a sector, or maybe a broader index, a basket of stocks. Not individual stocks. You have a pretty good hedge in that case on buying into a business.

2.
Only Buy Businesses that You Understand
I don't really get this because you are limiting your options in diversification if you use this rule too strongly. I work in IT and hi-tech, software industry, but I am not sure if I can even claim to understand the entire business.

3.
Buy Companies with Defensible 'Franchise'
This generally implies that you invest in large caps and avoid riskier small caps that do not have a control over the entire market segment . I think this is a sector specific subject and you should have a solid basket of stocks in consumer goods, commodity companies, etc.

4. Hold for the long term
Is there any other way? According to me, not holding for the long term means that you have to sell! Now that would just be too much work for a lazy investor. With ETFs you don't want to be paying commissions anyways, so might as well just buy and hold.

5.
Ignore Short-Term Fluctuations in Price
Looking at short-term fluctuations is like thinking your married life is going to be as much fun as that one night stand and running off to vegas for a drive-through wedding! Ok, not exactly an example that makes perfect sense, but you get the point.

6.
Buy Good Businesses When Prices are Down
My thoughts exactly! My reason for this is however very simply due to the fact that I don't really have a very solid "when to buy" set of rules. So I only buy an ETF when I am convinced that it is below a 200-day moving average and has gotten there after a downward trend and there are strong factors that have brought it there.

7.
Don't Be an Active Trader
That would require you to be "not lazy". Forget that.

8.
Do Not Over-Diversify
Not out of choice, but I think I got this covered :-). Aren't you aware of my constant struggle to getting to that Zen-like diversified portfolio?

9.
Invest Only When There is a Margin of Safety
This probably sits better with funds, but if I figure out how to translate this to EFTs, will let you know. I think it means you try and buy something that has a higher value than the current price reflects. But isn't the whole purpose of the stock market to balance out the price and value?

There you go, though I can still not figure out why the title of that article is "Billion dollar investing ....."!

Friday, September 28, 2007

Portfolio Update

I haven't been doing a lot of investing over the last few weeks. Actually I haven't been doing a lot of financial anything since the last post. Just stuff, life throws at you. Actually that is part of the challenge of personal finance and investing. There are factors that are personal, and those have so much influence on your life and hence on your finance.

Anyways, as opposed to my general philosophy of not selling ever, I had to make a decision to move things around a little bit. In a way, this is also an attempt at balancing out my portfolio a little more. I am still in a broader pursuit of having a 50-50 distribution between foreign (a very generic term) and domestic holdings.

So, just an update to maybe get things restarted on writing more often again.

Thursday, August 16, 2007

Temptation and Emotion


Wow, what a few weeks for an investor! I am tempted to say, what a disastrous few weeks, but that would be unfair to all the smart investing advice I have been given through books and other reading material. Then again, I cannot even say what exiting few weeks, since all these corrections and buying opportunities cannot give any normal investor any confidence about what to do right away.

So I will just write about what my own thoughts are regarding all this. To begin with, I am pretty sure if I had money to invest right now, I would have bought something missing from my highly unbalanced portfolio. However, as is the habit, even though I have nothing to gain/lose from that action, every morning I check how the market is doing and how my portfolio is holding up. Now, I have no intention of doing anything in a time like this that involves selling or panicking, I am after all a mere mortal. And sadness and disappointment does lead to a very strong temptation to "do something".

The idea of course is to resist the temptation to do anything. I know that, and so does probably anybody who has had made an effort to learn all the basis of common sense investing. I can give out all sorts of charts showing you how not selling, sticking to the long-term investing strategy in a market like this works out way more beneficial for an individual investor as compared with somebody who does such "crazy" things, but then I would not be able to call myself a "lazy investor". So, just believe me or pick up any decent investing book.

I guess what I am saying is that even after knowing what the right things to do are, investing, money, personal finance, the stock market, etc have a very strong human element to it. We are all emotional human beings and panic, disappointment, excitement and most importantly temptation are factors that no book or knowledge or advice can teach you. That unfortunately has to be handled individually.

As for me, I generally deal with days like these by a few minutes of silent cursing followed by some sulking, a brief moment of panic and then moving on with life......

Tuesday, August 7, 2007

A tool I could use

I haven't had the need yet to rely on tricks and tools that are now freely and readily available online for a regular investor these days.

I use all the information I can from Yahoo! Finance, once a while I will use Morning Star's Instant Portfolio XRay and maybe sometimes ETF Connect's Fund Sorter. These seem to have done the job for the information I was looking for, though in no sense do I consider myself a "power user" for any of those.

However, very recently I have felt the need to have a tool that could give me a list of ETFs, from a list of stocks that I provide as input. What I want to do is to see, if say for example from a list of 10 companies I like, in a sector that I like (or need for a balanced portfolio), which ETF(s) do a maximum number of those stocks belong to.

Sounds simple enough, and I refuse to believe there isn't anything like this out there. Maybe I haven't been looking for it hard enough. Or maybe such information is not needed by the mere fact that following a balanced investing scheme using ETFs, you would never have the need for looking up that sort of information.

It would be at least a fun thing to play with...

C quiz question

I was looking at coming up with a few small C/programming questions for a number of interviews that I am taking these days. Here is one that is interesting:

What would be the output in the following piece of code?
main()
{
int a[5] = {1,2,3,4,5};
int *ptr = (int*)(&a+1);

printf("%d %d" , *(a+1), *(ptr-1) );
}

I needed to compile and confirm, but the output in this case would be "2 5".
How we get "2", is obvious. The interesting one is how we get the "5".
The reason being ptr is a pointer to the array of integer. Not a pointer to an integer.
So when you do &a+1, you are pointing to the next array of integer, and not a[1].
Hence, when you do *(ptr - 1), you end up dereferencing a[4].

It gets interesting when I next ask you for output of the following piece of code:

main()
{
char a[5] = {'a','b','c','d','e'};
int *ptr = (int*)(&a+1);

printf("%c %c\n" , *(a+1), *(ptr-1) );
}

Thursday, August 2, 2007

Seinfeld, and the logic of investing

Like anybody with a TV and some sense of humor, I watch a fair share of Seinfeld reruns whenever I am too lazy to do anything else. In one episode, there was this funny bit on the show towards the tail end when he does the stand-up part; he was talking about the whole "let your money work for you" part of the basis of successful investing and wealth management.

He said something like, "I don't get the whole let your money work for you bit. I like to do the work and let my money relax. Because ever so often, it happens that my money that I send out to do the work, decides to disappear. You go and check what happened and they say...yeah, your money, was no good....showed up late for work, took long lunch breaks, etc....so we had to let him go". :-)) Really funny stuff.....

Anyways, the reason I sort of decided to write that Seinfeld bit down was mainly to not forget such a cool joke and partly because very recently I was thinking about all the things you learn about financial planning, wealth management and investing and if the knowledge of those things really does get you ahead in the game? Whenever I stumble upon an article or blog post or a book talking about good practices and steps that one should take, I realize that I am already doing 90% of the things mentioned, but there is no instant grading of what really worked? There is very little instant gratification unless you make an even bigger effort of analyzing things to the death and looking into the future.

Wouldn't it be nice to have something like a score that you could look at and see if some steps, like making two payments a month (if your mortgage company allows) on your home mortgage instead of just the one monthly, is really doing an excellent to your financial future and in turn encouraging you to do more. Maybe that is a really nice opportunity to come up with such a system. Say for example like the credit score (not necessarily the best example, but lets go with it for now), where you have a "financial health score". It is determined by a complicated formula that takes into account your age, income, active investments, retirement portfolios, cost of living, lifestyle and a ton of other things and gives you a number to look at, to analyze and work with. That would be instant gratification. That would make me want to really do things to get my score higher. It appeals to the natural competitive nature of all human beings.

Oh well, its a good thought......and its never bad to dream.

Thursday, July 26, 2007

Spiritual awakening


Nothing like waking up to an overcast summer morning, running a slight fever due to what could possibly be flu and looking at the stock market shed probably the second largest points for the year.

Actually, I was looking for a dip in the market because I was looking to buy (in case you didn't know, my investment theory does not involve any selling) in my every increasing pursuit of getting a strong, balanced and distributed portfolio. Unfortunately, I wasn't prepared enough to know what to buy. So I ended up getting some more "foreign" stocks.

So, I decided today is going to be the first day for the rest of my balanced portfolio. I need the following things:
a) define a goal.
b) get a good analysis of where I currently stand.
c) figure out a plan to get from (b) to (a).

Its damn hard; I mean investing is easy, I would say even making some money in the process is easy, but it is hard to do it well, do it right. All I have needed to do since some time now is get a good understanding of what my portfolio looks like, figure out what is missing, pick one of the model portfolios and do a few trades to get me there.

So, as a first step, I sort of figured out what my portfolio looks like currently. I will need some more time to figure out a goal so some things will have to wait. But as of 26th July, 2007, I know what I am working with...........I am awake!! (for a little while, at least until the medicines kick in)

Wednesday, July 18, 2007

The IIF conundrum


As they say, incomplete knowledge is worse than no knowledge...or something like that.

When I actively started investing about 2 years ago, I was convinced that index funds were the way to go. That was till the time I discovered ETFs and I ended up with a portfolio where 30% of my assets are Index funds and the rest is all in ETFs.

So, about a year and a half ago, when I purchased a bunch of IIF (Morgan Stanley India Investment Fund), my intention was to get a piece of the amazing growth and development that India has been observing and which is being reflected in the SENSEX reaching all time highs. The idea was right, but my execution a bit flawed as I realize that now.

So, without doing a lot of research, I sort of assumed that IIF is an ETF and the best way to get a good basket of strong Indian equities. The holdings included all the proven Large-caps and stayed away from the much more risky small-caps and IPOs that seemed to be going crazy over in India since the last few years. I figured having such a focused fund was risk enough.

Now, IIF is not an ETF, it is a close ended fund. Which, now that I am a little wiser (refer to the previous posts where I claim to be reading books), I believe is not what I was looking for. Here is why:
A closed-end fund looks, walks and talks like an ETF. The shares are listed on securities exchanges, are actively managed and trade intra-day on the open market. However, the price is not completely reflected by the total value of the underlying net assets (NAV) as is the case for ETFs. So these shares of closed-end funds can trade at premiums or discounts to their underlying NAVs. I believe this is reflected by the sentiment of the investors.

Most investors like this because it gives them an option to make their purchasing/selling decisions based on this property that the fund is either trading at a premium or a discount.

I started looking into this because I realized that the Indian market has recorded record-breaking gains over the last few months, but IIF isn't even close to its all time high. In fact, currently it is trading at a discount. Now, I would like to re-balance my portfolio and move this concentration on a country specific fund to someting a littler broader, I am looking at BLDRS Emerging Markets 50 ADR Index (ADRE).

I certainly would have done better being invested in something like ADRE which has a few excellent Indian stocks. Also, it has more concentration of the Asian/Pacific region and telecommunications as opposed to VWO (which I also own). I am debating if I should make the plunge, or wait for the investor sentiment to change (which I believe at some point it will and drive the IIF away from the 10% discount that it is currently trading at), or buy into an ETF that is already reflecting the NAV which is at recording breaking levels!

Apparently, I am obviously not the only one to have made this mistake. TheStreet.com explained this in a September 2005 article. Seems this is a common thing for single country investing!

Lesson learned?

Monday, July 2, 2007

ETF: To buy or not to buy, that is the question


Since I expressed the lack of understanding about a set of rules or information on when actually to purchase an ETF, I have been making an effort just learn more about the subject.

Read this recently in some article about an financial firm that looks to build client portfolios entirely from ETFs:
A couple of basic rules regarding what ETFs they track before making purchasing decisions:
a) Only be invested in ETFs that are above their 200-day moving average.
b) Only look at ETFs with some track record. Nothing under $75 million in assets.
c) Look for consistent volume and liquidity (not really sure what this would exactly mean when looking at a yahoo-finance page).

Those seem like sensible rules. However I still need to figure out what qualifies as a good time to buy a particular ETF if you have been tracking. There was some mention of selling when the ETF falls below a 200-day moving average or 8% of its high (without going below the 200-day average). Which would imply that if an ETF is above the 200-day moving average (and not below 8% of it's high) and the sector trend is upwards, and the ETF fits the bill into your diversified portfolio, you buy.

Linux for human beings

I finally gave up on Redhat and Fedora and went with Ubuntu (Feisty Fawn 7.04) for my home/personal laptop; to put it simply and elegantly (as Ubuntu would appreciate), it is excellent!

Well, maybe I am just biased by the fact that everything, including the wireless card on my fairly old Toshiba Satellite worked pretty flawlessly right off the bat. The interface is very well organized and even tough being a "Red Hat" user for a while now, most of the things just make more sense in Ubuntu world. The command line package management with "apt-get" is great to use. The unique concept of not having a "root" user login is something that takes a little getting used to, but the more you use it, the more it seems to make sense.

Even though a Live CD install gives you more or less everything you will need for a Desktop system, we are never completely satisfied, and those basic needs are taken care of by this UbuntuGuide.
Most of us will probably end up doing the following:
- Macromedia Flash plugin for Mozilla/Firefox
sudo apt-get install flashplugin-nonfree
- sudo apt-get install build-essentials
- sudo apt-get install libncurses5-dev
- sudo apt-get install azureus
- The DVD codec for most DVDs seems to not have been included for legal reasons.
sudo apt-get install libdvdread3 libxine1-ffmpeg
sudo /usr/share/doc/libdvdread3/install-css.sh

This is a very short list, but that is a good enough start for me to get working on a Desktop at home. I will try and post as many things as I figure out and build this system up. Right now, I am really happy with this "Linux for human beings".

Friday, June 29, 2007

Reading assignments

Since I mentioned not having figured out good strategies and skills when making investing decisions, specifically related to purchases, and more specifically for ETFs, I am proactively trying to fix that.

Step one in the process is getting book smart. Currently on my bedside is John Bogle's Little Book of Common Sense Investing. Maybe I really wasn't expecting it, but the book reall is little....as in "hey look....somebody just got out of the pool...see how little......"; well, moving on, no comments yet on what I think about the content yet, I am just a few chapters into it. Besides, I do have a day job writing software (which incidentally I should be doing right now....oh well).

The other book is still in my Amazon queue.....Understanding Exchange-Traded Funds by Jr. Archie Richards.

This dudn't make sense...............


So, after spending a reasonable amount of time trying to make sense out of this, a TheStreet.com TV report explaining the top 5 ETFs to short now (early june) including VFH, I still went ahead and got my portfolio as much VFH as my spare change would let me purchase.

The issue is that I tried to make sense of that report about a couple of times and did not make much progress. I really haven't read anything about why financials would be a bad sector to be buying right now. However, in my sense of the world, this was one of the few sector ETFs that is currently somewhere below a 52-week maximum. My portfolio needed it, so I bought. Simple.

In the bigger picture of things, this forms about 8% of my portfolio which to begin with is REALLY not very well diversified, but I am actively getting there. Till I get somewhere which is respectable enough to be shown to public, I will not publish it. Lets just say I am way too heavily concentrated on Developing Nations........

Maybe if I keep making decisions this way, I will form my own set of rules as to what defines a good time to buy an ETF. Hopefully the whole process is not too expensive.....

Tuesday, June 26, 2007

ETFs...ources

First, ignore the title for this post. I just didn't want to post another set of links with the title "some more links" again.

Moving on, I recently stumbled upon a great ETF information resource at ETF Trends. I am almost embarrassed to admit that I haven't seen it before. In addition to considering myself a "King Of Links" (a title I just gave myself some time ago when I analyzed my responses to a lot of queries and questions in all forms and realized that I begin most of my statements with the words "Wait...let me send you a link for that...."), I also have been doing all my investing in ETFs.

I have been using the well known ETF Connect most often and I have sometimes browsed on Yahoo!'s ETF page. The thing is, I really haven't needed to investigate ETFs in general as much as I have had to spend time just doing basic investing. So my lack of knowledge is justified....I guess.

Well, the King is resting now.............

Sunday, June 24, 2007

Waiting.........

It has been a while since I last made a purchase in my portfolio. Certainly the lack of cash for my investing experiments (I always max out my 401k contribution in addition to paying off more than my monthly dues for my HELOC and primary mortgage, so don't judge ;-)) has been a big factor. But so has my desire to time the market and wait for a correction. It has been a while since the last major correction, and when the last one happened, I did buy then.

As an avid investing student, I read as much as one can, but very rarely have I come across a decent article or book on how timing works with ETF investing. There have been some mentions on the basic rules of when to sell/stop the bleeding/cut-and-run.
1. Keep an 8% stop-loss on all ETFs.
or
2. Sell when it falls below the 200-day moving average.

But as far as buying into an ETF goes, I really have to figure out a strong strategy. My investing theory does not permit selling very often, so when I do buy, it has to be that special one.......:-). I have read a number of times that May-November are historically the worst times for the stock market. So technically I should be looking into buying sometime between now and November. It is almost end of June and all kinds of stocks are reaching new highs, some even closing in on six-year-highs. So, what do I do now? Buy and hope the rally continues? I don't have the discipline to be a $-cost-avg investor, so that is out of question.

What do I do? I am waiting........

Tuesday, June 5, 2007

Own Sweet Home

I had started writing this blog with a (partly) selfish reason of getting some writing practice in the process.

You see, for a very long time, I used to think that I have the ability to organize information and present it in a manner that is optimal for reading. I did do well on most writing assignments back in school as well on most tests that required a non-objective representation of my knowledge. However, ever since I got started writing software code, this writing "skill" that I might have possessed seems to have deteriorated rather significantly.

So, I figured if I force myself to write this way (blog) about things (investing, finance and software) that might interest me, maybe I might get a bit better at this. I digress enough, but one of the things I have been doing recently is listen to Grammar Girl's podcast which is pretty good.

I mention all that above just to say that even though my intention has been to "write", here is another post that is pretty much just a dump of some links that I have been saving in my bookmarks until I figure out how to effectively use them.

I keep coming across these new and cool house searching tools and websites:
http://www.zillow.com/
http://www.trulia.com/
http://www.redfin.com/
http://www.cyberhomes.com/

http://realestate.yahoo.com/Foreclosures
- Search foreclosures by zip code

I haven't needed to use any of these because I had purchased a small home before the whole Web2.0 phenomenon hit the web. Nor am I looking into selling my place for a foresee-able future. I think it would be an interesting exercise to see how would I have done differently if I have these tools available. Maybe I should just look into buying an "investment home" with a much better arsenal of such resources?

Monday, June 4, 2007

Vacation

I was out on vacation for almost a week now. The image is one I took lying on a boat, listening to music and drinking beer.......you get the picture.

Anyways, so the reason for this post which is not particularly related to investing (I guess it could if you buy stocks of some of the online travel agents like orbitz and priceline), is because on my looong flight back I was thinking about all the online tools that I have stumbled upon over the last few years for finding great airline deals.

For a while, I kept a little list of bookmarks that I would go through before booking a flight. I would think that with so many options to search for great deals, I would have found something that actually looked like a deal at least once! I haven't had any luck, but maybe others have effectively found the best way to go about this?

Here is my list of sites that at some point or the other I have used without much success:

The old and the trusted:
http://www.orbitz.com/
http://www.expedia.com/
http://www.priceline.com/

The meta-searchers:
http://www.kayak.com/
http://farechase.yahoo.com/
http://www.trabber.com - Courtesy of Dan's comment. Thanks!

The new and the interesting searching tools:
http://farecast.com/
http://www.mobissimo.com/search_airfare.php
http://skybus.com/
http://www.yapta.com/

Thursday, May 24, 2007

some c code to debug

...dumping an old post from my older WordPress blog:

I stumbled upon http://www.advagato.org today and spent a few minutes trying to solve this “spot the bug” quiz.

According to the person who posted it, the challenge is to find atleast 2 memory-related bugs in the code (potential memory leak and/or a dangling pointer creation) in the mydata_add() function:

typedef struct {
int count; // number of items in each array
Foo* foos; // array of Foos
Bar* bars; // array of Bars
} MyData;

Now, here’s the function used to add a (foo,bar) pair to the data structure:

static int
mydata_add( MyData *data, Foo foo, Bar bar )
{
Foo* new_foos;
Bar* new_bars;
int count = data->count;
 if ( count == 0 )
  new_foos = malloc( sizeof(Foo) );
else
new_foos = realloc( data->foos, sizeof(Foo)*(count+1) );
if ( new_foos == NULL )
return -1;
if ( count == 0 )
new_bars = malloc( sizeof(Bar) );
else
new_bars = realloc( data->bars, sizeof(Bar)*(count+1) );
if ( new_bars == NULL )
return -1;
new_foos[count] = foo;
new_bars[count] = bar;
data->foos = new_foos;
data->bars = new_bars;
data->count = count+1;
return 0;
}

Answer:
First, I had to figure out what realloc() did. According to the man page:

void *realloc(void *ptr, size_t size);

realloc() changes the size of the memory block pointed to by ptr to
size bytes. The contents will be unchanged to the minimum of the old
and new sizes; newly allocated memory will be uninitialized. If ptr is
NULL, the call is equivalent to malloc(size); if size is equal to zero,
the call is equivalent to free(ptr). Unless ptr is NULL, it must have
been returned by an earlier call to malloc(), calloc() or realloc().
As for the answer to the original question:

The two memory errors was basically of the same type. It happens when the second allocation fails (either malloc() or realloc()):
1. In the case when count was 0, it would leak a newly allocated (malloc()) block of memory.
2. In the case when count was > 0, it would have reallocated the block pointed by data->foos, but would not have updated the corresponding pointer. Now in this memory block would not be in the same position as the original one (before the realloc()), which would be more or less the case, we would have created a dangling pointer.

Wednesday, May 23, 2007

Whats the time?

I had a very interesting and amusing realization today. After a few months of not having that extra "cash" that I use for doing my investing, I finally have enough to make a decent purchase and take one more step towards that ideal-balanced portfolio .

Now, I have been keeping an eye out on a few ETFs that my portfolio could certainly use right now. I am way too lean on small cap (growth or value) and financials. That is true even for Energy, but that is a whole new topic. I have sort of convinced myself that the next purchase is going to be either a small cap or a financial ETF.

As I look at the market today, call me skeptical, but I don't feel too comfortable buying right now. It all comes back to basics of investing.
1. Don't try to time the market.
2. Dollar-Cost-Avg out everything you buy and everything you sell.

Well, I have never been able to get to #2 with my "taxed" investing portfolio. I leave that for the 401k (...also another topic of interesting discussion as to why most...well..if not most, at least most small investors I know never treat their 401k and their active-investing accounts/portfolios in the same way and with the same principles?). As for #1, I have every reason to believe Karma has something to do with it. Either that, or for some reason, the economics of the world somehow scheme together so that every time that I have my investing money ready, it is NEVER a good time.

So, for somebody like me, who has not yet figured out how to get $$-cost-avg to blend into my lifestyle (to be fair....I haven't heard it mentioned any time before, but THAT is a pretty hard thing to achieve), for now timing is pretty much everything. I am probably just going to wait for a short dip...hopefully which should happen sometime soon or else I am sure that money is magically going to disappear soon into the unrelenting appetite for my money that day-to-day living has!

On a positive not, I still need to verify this, but remember reading somewhere that Zecco pays decent (around 4%) interest for money that you transfer, but not invest into your account. I should probably do that transfer instead of writing this right now...........

Sunday, May 20, 2007

useful reading


Some time ago I had convinced myself that if identified a few good financial bloggers, the power of that combined with my 5-year subscription to Money and Kiplinger's magazines, would provide me with enough arsenal to be a better investor.
About 6 months down the line, I am not sure how effective those have been, but I would like to believe that it certainly hasn't done any harm. I haven't gone off to buy the top 10 funds that come out monthly in either of the magazines, nor have I found tips on hot markets or stocks/funds from any of the blogs that has made me rich over night.

In any case, here are a few good links that I read more than a couple of times a week:
http://mymoneyblog.com - very popular
http://bankdeals.blogspot.com - haven't really been able to use any of the information that i have come across on here, but do give it a look before I do anything else with my money.
http://www.thebuylist.com - I need to figure out if there is an effective way to use this information.

Also, had stumbled upon this article from Morningstar which has links to a couple of useful tools for personal portfolio checkups.

I have also been listening to a couple of podcasts which though not particularly focused on stocks in general, do offer some sensible tips ever so often:
http://money-guy.com
http://moneygirl.qdnow.com

I guess till I figure out if these are not really helping or significantly hurting my investing decisions, I would gladly keep these around as long as my daily routine permits it.

some pthread basics

So it doesn't look like I will be able to sustain two separate blogs, one for stocks and the other for software. I am almost convinced that I should change the name to "Bits and Bulls" which should sum up the two things I am most likely to write about; software and stocks.

Well, to get me started, I was reading up on some thread basics and saw this simple and basic pthread_create implementation. Could be a good c programming interview question:

Question: What is wrong with this simple code?

/* Parameters to print_function. */
struct char_print_parms
{
/* The character to print.*/
char character;
/* The number of times to print it. */
int count;
};

/* Prints a number of characters to stderr, as given by PARAMETERS,
which is a pointer to a struct char_print_parms. */
void* char_print (void* parameters)
{
/* Cast the cookie pointer to the right type. */
struct char_print_parms* p = (struct char_print_parms*) parameters;
int i;

for (i = 0; i <>count; ++i)
fputc (p->character,stderr);
return NULL;
}

/* The main program. */
int main ()
{
pthread_t thread1_id;
pthread_t thread2_id;
struct char_print_parms thread1_args;
struct char_print_parms thread2_args;

/* Create a new thread to print 30,000 ‘x’s. */
thread1_args.character = ‘x’;
thread1_args.count = 30000;
pthread_create (&thread1_id, NULL, &char_print, &thread1_args);

/* Create a new thread to print 20,000 o’s. */
thread2_args.character = ‘o’;
thread2_args.count = 20000;
pthread_create (&thread2_id, NULL, &char_print, &thread2_args);

return 0;
}


Answer: The main thread (which runs the main function) creates the thread parameter
structures (thread1_args and thread2_args) as local variables, and then passes pointers to these structures to the threads it creates.

So, it is very much possible that Linux will schedule the three threads in such a way that main finishes executing before either of the other two threads are done? So, if this happens, the memory containing the thread parameter structures will be deallocated while the other two threads are still accessing it.

Solution:
/* Make sure the first thread has finished. */
pthread_join (thread1_id, NULL);
/* Make sure the second thread has finished. */
pthread_join (thread2_id, NULL);

Wednesday, May 16, 2007

Microlending for mainstream - kiva.org


I had read about kiva.org from a financial blogger who I read fairly often. Yesterday while watching local PBS in HD (since it is either that or Discovery that seem to have the only decent quality HD programming) that I saw a good segment on kiva and spent some time today looking into it.

I guess enough has been said about the creativity of the idea and the ease and effectiveness of it on various blogging sites. The 100% repayment rate so far is certainly impressive and it seems to be getting more attention each day.

I am not a charitable person when it comes to donating money, but this appeals to even my charitable side. Of course micro-lending is not charity. However, I am looking at it as most people like me would do; Loan some amount that you are comfortable with, hope that it helps someone with the need to get setup or make a small business work. If that works, I suppose the feeling of having helped can only be good. When the repayment comes across, I am sure you are not going to need the money then, so see if you can help someone else. Call it pseudo-charity, but this is something I could see myself doing with the selfish reason of enjoying the feeling of having helped.

I like ideas like this that work.

Tuesday, March 13, 2007

A balancing act


My biggest weakness with investing has been the struggle for achieving a "balanced portfolio".

How hard can that be?, I have always wondered. But after almost a year of active investing (I still think of my 401k-Roth IRA accounts and my taxable investing account as separate entities), I am not really completely diversified.

Part of the problem has been my investing cycle. Which hasn't been Dollar-Cost-Averaging. I have invested in chunks and so bought particular index funds and ETFs in those chunks. So in a way I am still working my way up to being balanced (a recent trade trigger that I had setup for an IIF when the price falls below $43 didn't help the process and now I am heavily loaded on the International side), but there is a long way to go. Add to that the fact that I haven't really rebalanced ever, things are not that simple with getting to a the end goal of having a very balanced portfolio.

So, my first goal in the near future as far as investing goes is to get there.

Step 1: Define the goal


What is the right balance? Using "type-of-equity" as a reference, I read recently that there is an old rule of thumb when distributing between stocks and bonds: the stock allocation percentage should be 100 minus current age.

Fair enough, and there is enough data to prove that in fact if you do track the popular mixed-funds from Vanguard, Fidelity and the likes, that formula holds up really well.

Next part of the goal is to allocate your stock assets also in a balanced manner. Currently here is how my allocation looks:
66% - International
20% - Mid Cap
14% - Large Cap Growth

There are a couple of free and useful tools that can help in figuring out the current allocation:
Morningstar Instant XRay page:
http://portfolio.morningstar.com/NewPort/Free/InstantXRayDEntry.aspx?dt=0.7055475
Also, a lot of professional and unprofessional advice on suggested portfolios can be found online.
Fund Advice Portfolios:
http://www.fundadvice.com/portfolio.html

Step 2: Identify the holes

After Step 1 is done and I have a clear idea of what is missing, I plan to dig into the details of which small cap (for example) ETF I should be buying. That seems to be the easy part and perfectly in tune with my investing theory as a lazy investor.

Step 3: Rebalance current positions

This might be a little tricky as with the small size of my portfolio, I avoid trades, but switching to Zecco (see previous post) can make this simpler.

Step 4: Sit back and relax

Never forget get the basic rule of investing.....be lazy!

Wednesday, February 28, 2007

To Zecco Or Not


$0 commision for any (well...almost any) kind of trade sounds pretty good. Specially when all you care about is individual stocks, index funds or ETFs.

So lets analyze before I dive into opening an account and do all my future investing (I use the word "investing" instead of "trading", because that is a core part of my investing belief; more on that later, probably later posts), lets see if we can analyze it:

The Good

Nothing beats not having to spend the $9.99 or the $14.99 every time you identified a good ETF to add to your portfolio. Say I have a $1000 currently saved ready to be invested. I generally buy ETFs and hate to shell out $9.99 on my Ameritrade account and would rather wait till I get my balance up a bit so that I can buy a bunch of these shares at a time. It has happened to me in the past and I have lost out on an opportunity to get in on a big temporary low in the market be it with fewer money because I didn't want to pay the trading fees (again later).

The Bad
A lazy investor should never be tempted to trade. The basic rule is, unless you need to, why ever sell what you have bought? You did all the hard work, you did the research, waited for the right time (a low, a pullback) to buy and now you let your portfolio be that way. When you sell from your diversified portfolio, you are forced to re balance. A lazy investor never sells unless re balancing or needs the money. I believe $0 commission trades sound too tempting and might make me trigger happy.

The Ugly
Do I need one more account? I am already guilty of treating my 401k, my RothIRA and my investment account as totally separate entities which is kind of a kick in the nuts as far as having a "balanced" portfolio goes (I am already working towards changing this). Do I really need one more account to save me around $9.99 every few months?

Adding another investment account would not be as bad though since I can always think of my combined Ameritrade and Zecco accounts as one. Just with two totally different interfaces and all that.....

And So
The odds are in favor of having a Zecco account, so guess I will be opening one later today. I have browsed around the website (in case you are still wondering, it's http://www.zecco.com), and the blogs and forums pages are kinda nice and interesting. That helps!

Tuesday, February 20, 2007

Just what you have been waiting for...


...another investing/stock market blog. Since the 17 that you have been reading already aren't sufficient enough.
If you haven't guessed already, I am a little cynical.
To be honest, I shouldn't be. As of writing this post, I have approximately $15,000 in my investing portfolio currently "invested". A couple of index funds and a few ETFs. In the next few posts, I will get into details about what those exactly are and how did I get myself into that situation. I recently managed to transfer an additional $2500 into the account ready to be invested as soon as I figure out where that goes.
The portfolio has gained around $1600 since I started actively investing which was around a year ago (10 months and a few days to be precise). This idea of "active investing" goes against the very basis of my investing theory, which is summarized as "Lazy", but more on that later (another post most likely).
What I am getting at is that, yes, this is another investing blog. I will talk about stocks and ETFs and mutual funds (which I am pretty sure I am never going to invest myself) and index funds, but not to educate or to preach. I am going to do that so that when I go back and look at why my portfolio is at where it is, there has to be some thought process involved. Lets see if I can keep an account of that through this.
Hopefully in future, when I look at my Roth IRA account and see 3 stocks of Symantec (SYMC), sitting at 32% loss, I don't scratch my head and wonder.....what was I thinking?