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”.

Clint Michigan rocking Grey’s Anatomy

My wife and I picked up the Clint Michigan album (and by “picked up” we all know I mean downloaded from iTunes) back in June. Clint Michigan is actually a folk duo and the male half the the team just so happens to be my wife’s Cousin.

There is a song on the album that really resonates with me called “Hawthorne To Hennepin”. Like me, Clint also lost his brother, and there is a wonderful lyric in the song that sings “What my brother could have been, thats what I’ve been wonderin’…” and it spoke pretty deeply to me. Because that is a common thought of mine that I will most likely continue to have for the rest of my life.

Yesterday, Jaimi (my wife) was watching a recording of a popular show that she enjoys called “Grey’s Anatomy”, when a song started playing in the background. She recognized it but because of the fact that the song was on a show that averages 20 million viewers, she had a hard time thinking of the band’s name. Suddenly it struck her, “Thats Clint’s Band!!!” and she called me at work all excited. You could hear in her voice that she was just tickled.

Anyway, I don’t plug music I don’t like. But I really enjoy Clint Michigan. And Jaimi and I couldn’t be more excited for their big success. So here are some links below. And if you happen to like what you hear, please throw them a couple bucks by downloading a song or two from Amazon or iTunes.

MySpace

Amazon

iTunes

Shadows lurking

I read Tim Duy’s post “It’s Not About Interest Rates Yet” and Tim left me in a deep think state. As Tim points out, the government program to buy Mortgage Backed Securities is set to end. But it now sounds like they may (surprise, surprise) extend the program. And reading this, it was yet further confirmation to one of my key beliefs about Real Estate. You see, many people do not seem to realize the scale of  government intervention with the National Real Estate market. Others that are in the know, probably see the government as simply distorting demand. But in actuality the government IS the demand being both mouth and stomach. They are the loan holder, the real estate buyer, and everything in between. And with the government at the center of housing, the inflated prices are just another form of shadow tax. One that no person is able to articulate or describe to their friends. Because we as tax payers are conditioned to believe that taxation happens mainly on our pay check or in the annual ritual of filing our 1040. So to those looking to buy, how can you, I, or anyone possibly hope to compete against this? In my opinion we can’t. We can only wait until the demand is gone.

Speaking of shadows, I think the word “shadow” epitomizes the MSM (Main stream media) and even the local boys (IE, Bulletin, KTVZ, etc). It is why I thoroughly inspect every nugget of supposed news that is reported. For there exists something at every major news corporation that lurks in the shadows. Just like shadow statistics, shadow inventory, shadow tax, this one is known as shadow opinion. The thought came to me a while back when reading an OP-ED piece from the Bulletin. Some where along the line, the newspaper came up with the idea that if they put the word “Opinion” in the title, it would let the reader know that the article was the opinion of the writer. Also implying to us, the readers, that the rest of the written document is news. In actuality and truth, we should know that the news is all opinion. The paper, magazine, news channel or what have you has an opinion about all things. And should you listen closely on when, if, or how things are published, you can hear the true “Voice” of any given media outlet.

But I think Duncan over at BMW is right in his ongoing subtle analysis of the MSM. The bloggers seem to have an edge on them. At least they have a much tighter voice. Usually being written by one person, or at most, a handful of people. And about a specific topic no less. Plus the scope and draw of the content is on the ground and global. As these folks can be or are, literally, all over the world. Instead of watching or reading the MSM as it regurgitates the same garbage over and over again, my opinion (heh) is that listening to the voices of many bloggers of all creeds is a much better representation of actual News.

Finally, it was funny this morning, because as I was sitting at breakfast today clicking through my RSS reader. I pulled back from the individual articles, and took a long look at all the blogs that I love to read. Suddenly an image of my father sitting at my childhood breakfast table thumbing through his paper filled my thoughts. This struck me, because I know that this will be an image that my daughter will never have.

Older Posts