Recent Posts

January 2010

(Nerd) ^M Removing control characters using VIM

hat tip Matthew Turland

Have you ever opened up a file using VI and found the following?

<?php
    echo '<html>'^M
    echo '<head>'^M
    echo '</head>'^M
    echo '<body>'^M
 
...

That stupid control character from some other horrid text editor is trailing every single line. And you are annoyed enough to Google for an answer. ^M

Now, hopefully you are aware of the powerful regex tools built right into VI. But in this case, the fix is pretty simple, and we won’t have to craft any regFu. After you open your file using VI, we will then use the search/replace functionality. And we will eventually end up with a line that looks like this.

:%s/^M//g

But there is a gotcha to this solution, so you may need to read on to find out more. And before proceeding, press esc to make sure you are not in insert mode.

First type the following.

 Shift + :

Which should just print the colon at the bottom of your screen.

:

Then type this exactly how it looks.

%s/

Now we need to type the control character. You may be thinking “Jared, I will just hit shift + 6 and get that character onto my screen in no time.”. And you are more than welcome to do that, but you would be wrong.

You will need to press the following keys.

Control + V

Which will get you this printed out.

:%s/^

Then type the following.

Control + M

Which should have you ending up with this.

:%s/^M

At this point you can type the rest of the characters exactly how they look.

//g

Which leaves you with a finished line that looks like so.

:%s/^M//g

Press enter, and you will now replace the ^M character with nothing.

Part 2(kinda): Small search and replace example.

This would replace Dog with Cat.

:%s/Dog/Cat/g

Cat with Mouse.

:%s/Cat/Mouse/g

Mouse with Trap.

:%s/Mouse/Trap/g

So our line to replace the ^M character is literally saying “Replace the ^M character with nothing”.

Wells Fargo posts profits, again.

What the brains are reporting

LINK

BR Capital Markets analysts on Thursday upgraded Wells Fargo & Co.(WFC 27.88, -0.13, -0.45%) to market perform from underperform and raised its target price to $26 from $21, saying earnings continue to surprise on the upside. “The big takeaways from the quarter are flat revenues and stabilizing total credit losses,” FBR said in a note. Wells Fargo on Wednesday said it swung to a fourth-quarter profit that beat analyst expectations. The stock was up about 1% in early trading Thursday.

LINK

Fourth-quarter earnings at the four major commercial banks show a divide between those that achieved profitability (JPMorgan Chase(NYSE: JPM) and Wells Fargo (NYSE: WFC)) and those that didn’t (Bank of America (NYSE: BAC) and Citigroup (NYSE: C)). Nevertheless, even in the “lead pack,” loan loss rates continued to rise across virtually every loan category. Should Wells Fargo shareholders be concerned?

Shares look cheap
The risk of further credit losses at quality banking institutions is offset by share valuations, which look pretty cheap … on the basis of “normalized” earnings that are probably a couple of years down the road (see table). Last week, for example, value guru Bill Miller of Legg Mason (NYSE: LM)spoke approvingly of the shares of JPMorgan Chase and Bank of America. As far as Wells Fargo is concerned, I continue to believe the acquisition of Wachovia will add enormous value to the franchise over the long term.

What the mouth is saying

(Video) Wells Fargo on repaying TARP funds.

What the hand is doing

Wells Fargo Postit Note

Believe me, once that “normalization” process starts. Meaning that Wells Fargo actually has to value its crap-tastic assets at market value, we should see some pretty painful news again.

So, you want to learn about China

I received a lot of flak email concerning my thoughts about the Main Stream Media, including the local paper The Bend Bulletin. I won’t argue my case out right, instead I will point you to one of my all time favorite blogs, that also happens to be about China.

Right now, there is a lot of talk concerning our landlord neighbor to the east. And it is hard to decypher what is the truth. How can we answer questions like;

  • Is the rapid expansion of lending in 2009 leading to a catastrophic bubble in China?
  • Are the growth numbers that came out for Q4 acurate or are they simply puff?
  • How committed to understanding China should I be?

The only one of these that I can out right answer is the last one. Yes. You should be very committed to learning all you can about our owners friends. Which brings me to Michael Pettis. He is an author and professor at the Peking University Business School and with this position, he has the unique advantage of working/learning/living in the country of interest.

Blog
Bio
Books
(Sorry Dunc)

The depth of his knowledge is vast. And when I first started my self motivated education five years ago, on real estate and world markets, Michael’s blog would have been a challenge to read. But I encourage everyone, to read his stuff. It is just that good.

Take his post on currencies.

Already some of my students whose parents own their own businesses have been telling me that Chinese speculative money held abroad is flowing back into the country.  One of my students from rich coastal city Wenzhou, the most free-wheeling and business-savvy city in China, and perhaps the world, just rolled his eyes when I asked him if his family and friends were tying to bring money into the country.  “Of course,” he said.  I didn’t get the impression that he thought mine was an especially astute question.

That is the type of “on the ground” perspective that Michael can offer. Which helps me out a lot. For a while I watched the dollar as it tanked into the 70′s. Wondering if we were going to break lower. Michael’s post on the dire straights of other world economies and their fiat currencies was enlightening. It made me realize that holding US dollars (right now) is not that absolute worst position in the world (though not the best). Maybe I should own more RMB.

Also, I personally would love to go to a school like this.

a) Economics and fianance are a real passion/hobby of mine

b) The Chinese market will be an area of continued growth

Learning from a school in China would be extremely insightful into how the Chinese people think. Also, learning the language would be a great tool towards anyone’s career.

And now I will bring up someone who is a buddy of mine. The dude is totally brilliant. His name is Tony Bivens and he is currently completing a degree in linguistics from a University in Thailand (Tony, I know you read this, so post in the comments about the University if you get time).

I think his degree will be highly effective in his future career. As the world drifts from the US being the sole super power, we will have a great need for accurate communication with many emerging countries. So I am envious of Tony a wee bit. I see him as having a ton of opportunity. I only wish he blogged a tad more so I could read up on his thoughts. Though I really enjoy our skype conversations. :-)

Jared.Out()

Older Posts