3, 3, 3, 3, 3, 3, 3

As of now (5:23pm on my watch), Sarah was born 3 years, 3 months, 3 days, 3 hours, and 3 minutes ago.

Advertisements

Will Jeff ever post an entry without bold?

I got a question from a co-worker about the easiest way in PowerShell to count the number of instances of a substring in a given string.

If you read FSJ you’ve probably read about how Walt MossGoatberg is infamous for posting with a ridiculous use of first-person pronouns.  I get the feeling that there’s a similar game to be found in the amount of bold tags used by Jeff Atwood. :)  I love his blog, but there certainly is a liberal use of bold tags. :)  They’ve got that whole implication of "I’m saying something profound here and you need to pay attention, mister!"

So, to put the two together, here’s a simple script that counts the number of times a substring occurs during the posts of a given RSS feed’s items.

param (
    [uri] $rssfeeduri = 'http://feeds.feedburner.com/codinghorror',
    [string] $substringToFind = '<b>'
)

$wc = New-Object system.Net.WebClient
[xml] $feed = $wc.DownloadString($rssfeeduri)
$feed.rss.channel.item |
    ft -a title,@{
        l="number of $substringToFind found"
        e={[regex]::Matches($_.description.psbase.innertext, $substringToFind, 'ignorecase').Count}
    }

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

And the output on Jeff’s feed at the moment:

# .\get-countinrss.ps1

title                                                                 number of <b> found

—–                                                                 ——————-

Don’t Go Dark                                                                           6

ASCII Pronunciation Rules for Programmers                                              55

Markov and You                                                                          6

Exploring Wide Finder                                                                   6

Finally, a Definition of Programming I Can Actually Understand                          3

The Greatest Invention in Computer Science                                              4

Please Give Us Your Email Password                                                      7

Large USB Flash Drive Performance                                                       5

Whatever Happened to UI Consistency?                                                    4

Revisiting the Black Sunday Hack                                                        2

Strong Opinions, Weakly Held                                                            7

Designing For Evil                                                                      9

It’s Clay Shirky’s Internet, We Just Live In It                                         6

OpenID: Does The World Really Need Yet Another Username and Password?                  15

PHP Sucks, But It Doesn’t Matter                                                       10

Hilarious! what a difference 8 years makes

Seen via reddit, but there’s some great quotes from this 8-year-old article about the campaigning Texas governor.

http://www.nytimes.com/library/politics/camp/062800wh-bush.html

Gov. George W. Bush of Texas said today that if he was president, he would bring down gasoline prices through sheer force of personality

"Ours is a nation that helped Kuwait and the Saudis, and you’d think we’d have the capital necessary to convince them to increase the crude supplies," he said.

Asked why the Clinton administration had not been able to use the power of personal persuasion, Mr. Bush said: "The fundamental question is, ‘Will I be a successful president when it comes to foreign policy?’ "

He went on to suggest, as he did in answer to other questions, that voters should simply trust him.

On a more serious note, Mr. Bush said that he had disagreed with the Supreme Court’s 7-to-2 ruling on Monday that upheld the reading of Miranda warnings to criminal suspects.

He said he would "make the case that I’m the person that can change the tone of Washington, D.C.," and added, "Just give me a chance to be the president."

You could certainly make the case that D.C. has a different tone than it did 8 years ago.

Windows: set a static IP until next boot

I gave my father-in-law a linksys router we weren’t using any more.  Unfortunately, since I (still, unfortunately) use my Linux box for my dhcp server, this meant that it didn’t Just Work because once he hooked it up, his computer couldn’t dhcp an address from the router.

To get around that, I needed to be able to tell him to set a static IP address so he could connect to the linksys box (at http://192.168.1.1) and enable the DHCP server.  I didn’t want to tell him to click through a bunch of UI and set values by hand – I wanted something he could copy-paste and have it (hopefully) Just Work.

I vaguely knew of netsh and it seems to be able to do what I need.  Here’s what I just emailed him to try (worked on my Vista box) to set the interface for a static IP.  The "store=active" is key since the default is to make it persistent.

netsh interface ip set address "Local Area Connection" static 192.168.1.3 255.255.255.0 192.168.1.1 store=active

new blog theme

I’ve only been making around $3/mo off the adsense ads on the blog, the lowest by far of my channels, so I switched back to a theme I actually like – basically no ads, but much easier for me to read 🙂

Of course, those of you reading this on RSS 1) didn’t know and 2) didn’t (and don’t!) care.  I’m currently loathe to stick ads in the RSS feed, despite more and more of the blogs I’m reading doing exactly that.