News

 Subscribe Add to Technorati Favorites

 

 

 

 


 

 

Search My Blog:

 

 

My Stats

  • Posts - 472
  • Comments - 277
  • Trackbacks - 265

Twitter












Tag Cloud


Recent Comments


Recent Posts


Archives


Post Categories


Blogs


Miscellanous


Noteworthy Stuff


Popular Posts



It seems there is a known bug in certain versions of Windows Media Center (ie, Vista Home Premium) in which even when you remove a folder from a music/picture library in Media Center, items from those folders are not actually removed.  I searched around and didn't see much help, until finally I found this solution from a guy who works at Microsoft:

I had no problem with doing that as I just wanted to reset the library completely and do a re-index.

The instructions are:

Exit Windows Media Player.

For Windows XP:
Click Start, click Run, type %userprofile%\Local Settings\Application Data\Microsoft\Media Player, and then click OK.
For Windows Vista:
Click Start, click Run, type %LOCALAPPDATA%\Microsoft\Media Player, and then click OK.

Select all the files in the folder, and then click Delete on the File menu.
Note You do not have to delete the folders that are in this folder.

Restart Windows Media Player.
Note Windows Media Player automatically rebuilds the database.

After deleting all the files, Media Center’s library was completely reset. I readded the folders I wanted and everything has worked fine since.

Hopefully this post will make this solution more visible to other people who might run into the same problem.

 



SQL Server 2008 PowerShell Cmdlets + /n software PowerShell Server v2 = Execute SQL Queries Anywhere.

If you don’t already have the SQL cmdlets for PowerShell, you’ll need to download and install SQL Server 2008.  A warning for those of you running on x64 machines - you’ll have to export the SQL Server keys in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1 (there should be 2 in PowerShellSnapIns and 1 in ShellIds) and reimport them to Wow6432Node.

If you don’t already have /n software’s PowerShell Server V2, you’ll need to install that and run it on the same machine on which the SQL cmdlets are installed.  This server can run as an application or as a service, it doesn’t matter which.

Once you have this setup, you can go to anyplace that has SSH capabilities and open a secure connection to the PowerShell Server.  There are SSH clients nearly everywhere:  Windows, Linux, Cell Phones, Websites, you name it.  Once connected to the PowerShell Server, just send the command.

I created some scripts that I can call (so I don’t have to type so much if I am on a mobile device or something) that issue the actual sql cmdlet commands themselves.  One of them is called sql-getsearches.ps1, and it just tells SQL Server’s invoke-sqlcmd cmdlet to run a stored procedure for me that gives me back the results I want:

$query = "EXEC [table1].[dbo].[sp_LANCE_SEARCH]"
invoke-sqlcmd -query $query -ServerInstance myserver -U myusername -P password

Note: The use of invoke-sqlcmd requires add-pssnapin SqlServerCmdletSnapin100, which I include in my PowerShell Server specific profile (nsoftware.PowerShell_profile.ps1).

If anybody has any questions about getting the SQL Server 2008 cmdlets installed or using the PowerShell Server, feel free to shoot me and email or send me a tweet.

 


Technorati Tags: , ,


The new NetCmdlets v2 and PowerShell Server v2 are now available!

NEW: NetCmdlets V2 and PowerShell Server V2

  • NetCmdlets V2 is packed full of exciting new features including Parameter Sets, Object Pipelining, and new Cmdlets for SSH connectivity and Amazon Web Services (S3) Integration
  • PowerShell Server instantly enables Windows desktops and servers with an SSH secured PowerShell host entrypoint.

Try out the new featues in NetCmdlets V2 and PowerShell Server: download a 30-day trial!

If you are already a Red Carpet Subscription owner, you already have a license of NetCmdlets v2 waiting for you in your subscription manager.



New iPhone owners will commonly ask themselves how they can sync their Google Calendar with their iPhone calendar.  Or maybe how to sync their Gmail or Google Reader items with their iPhone readers.  If you do a web search you’ll find some applications that will actually do this, but don’t waste your time.  You want to go to the source, straight to Google, instead of going to Joe Bob Simpleton who has written some half thought out iPhone app to sync these things.  So here’s what you do:

Turn on your iPhone, and start Safari.  Browse to www.google.com, and login.  You can login to iGoogle if you like, but I personally don’t due to speed issues.  Anyway…  On the top Google menu bar, click on “Calendar” (or “Gmail” or “Reader”, etc).  You’re now looking at the mobile version of Google’s web app – designed by Google for mobile users.  New iPhone owners won’t realize that you can add an icon for this exact URL directly to the “Home Screen” of your iPhone just be clicking the “+” button at the bottom of the browser, and then the “Add to Home Screen” button.



Update:  Here is how I did it, with the published version of PowerShell Server:  http://geekswithblogs.net/Lance/archive/2008/12/22/how-to-execute-sql-powershell-commands-anywhere.aspx

I was talking to Richard Giles at Idera today and he made me realize that I’d never blogged about running PowerShell commands from my  secondary Linux desktop, and from the iPhone.  Here are the pictures, I posted them on Flickr a while back. 


This is done by using /nsoftware’s PowerShell Server (currently awaiting v2 release scheduled for the end of November!) on the Windows machine. 


More on PowerShell Server to come on this blog in the near future!  In the meantime, if you have questions, let me know.  I might be able to get you a sneak peak at the server too.  Shhhhh!  Don't tell anybody else!

 

 




Technorati Tags: , ,


Intro

My cable bill is $125 a month.  Ridiculous.  That includes road runner and hd cable.  It also includes that lovely $8/month fee for the dvr.  Over the lifetime of that dvr I’m pretty sure I have paid for it about 5 times.  My plan is to set myself up with an alternative to cable, perfect it, and get as many other people as I can to do the same thing.  My first goal is to keep Time Warner Cable from making $1250 a year from me.  After that, I will start preaching and hopefully converting other people as well.

My plan:

  1. Get an over-the-air digital antenna, to receive local channels (including all the major networks, and HDTV) for free.
  2. Build my own DVR,  possibly with Windows Media Center.
  3. Watch “cable channels” such as Comedy Central and Food Network over the Internet.
  4. Cancel my cable, except the road runner part so that I can still do #3.
  5. Research other options for Internet.

Part 1

Most people (including me until not long ago) don’t realize that tv stations all over the place are broadcasting over-the-air (OTA) HD signals, and that the quality of those signals can be better than what you can get over cable or satellite (because these OTA signals don’t use all the lossy compression that cable and satellite signals do).  Buying a UHF digital antenna will allow you to pickup these signals, for free.

So, I bought a UHF digital antenna.  Specifically I got the Philips PHDTV1 Silver Sensor indoor antenna from Amazon.com, I connected it to my tv and it works great!  Now of course I’m not receiving MTV and Comedy Central with this – instead I just get whatever signals are broadcast in my geographic location.  In my case those are FOX/HD, CBS/HD, NBC/HD, ABC/HD, PBS/HD, CW/HD, WRDC/HD, and some spanish channels.  Sweet!

 



I published SimpleTracker, is a simple service that will accept a tracking number or package id from major shipping companies (FedEx, USPS, and UPS), and spit out an RSS feed which you can then subscribe to in your favorite feed reader (FeedDemon, Google Reader, Outlook, Bloglines, etc).

Oftentimes I’m obsessed with knowing where my packages are and why they aren’t on my doorstep yet.  Now I’ll always know, without having to keep visiting the tracking website over and over!  :)



So I’ve been using PowerShellPlus for the last few days, and in short – its awesome.  The ability to put my script editor on one monitor, click run right there and see the results of the script on the other monitor made me very happy.  :)  If you haven’t checked it out, you definitely should.  Its basically an integrated development environment for PowerShell scripting and debugging.  A PowerShell console combined with an editor complete with watch window and step-through debugger.

As soon as you type “get-“ (or any other verb), PowerShellPlus intellisense kicks in, giving you a list of available cmdlets to choose from.  Finish your cmdlet and type in the “-“ for an attribute, and intellisense kicks in again, giving you a list of available attributes you can use.

Another great feature is that PowerShellPlus integrates the help of all of your installed snap-ins into one central “learning center”.  No matter what snap-in you need documentation for, its all in the same place in a much more readable chm format.



I have been a long time user of FeedDemon, which I think is an excellent product.  Unfortunately I do not feel the same way about NewsGator’s online reader, and its sync with FeedDemon on my desktop leaves much to be desired.  In an effort to be able to read my subscriptions from anywhere, I’ve decided to make the switch to Google Reader.  I tried GR a long time ago, when it first came out, and I didn’t like the interface, but they have cleaned that up.  Thankfully.  :)  Also, I do plan to keep FeedDemon around on my desktop for certain local feeds that I keep that GR cannot access.

So my experience this time is MUCH improved.  I like it a lot.  Here is what I am missing:

  1. There is a feature to mark articles as read once I scroll past them.  There is one problems with this, though:
    1. Sometimes when there is only one article, which does not require scrolling to read, and I shouldn’t have to scroll just to mark it read.  I’m missing an option to mark articles read as soon as I click on the source and load the articles.
  2. Per subscription viewing options.  This is one of my favorite features of FeedDemon.  Some feeds are best viewed in what Google Reader calls “List view”, and others are best viewed in what Google Reader calls “Expanded view”.  FeedDemon actually provides a dozen or so different display styles that any feed can use.  With Google Reader, its all or nothing.  All feeds display as either a list of titles, or an expanded title + full description.  Big hole here.
  3. Use of attention data – FeedDemon will show me the feeds I pay the most attention to, the feeds I pay the least attention to, and “newspaper” displays of posts from my favorite feeds.  Google Reader has a similar “Trends” page, but the “Home” page of Google Reader doesn’t appear to take this information into account when choosing what stories to highlight.  But I should give this more time because maybe it just needs to catch up with my habits.
  4. Editing of Feeds.  I can rename or trash subscriptions, but I cannot edit their urls.   Not a huge feature, I realize, but useful for me.
  5. updated 10/1/2008: I’d love the Gmail “Labels” feature here.  I need some way of “flagging”/”starring” items that I want to pay attention to later, but I want them to be separated in the display by category/tag/label.

What I like about Google Reader:

  1. I love the way I can choose whether or not to show all my feeds, or only the ones that have updates.  This eliminates a lot of the clutter that I feel with FeedDemon.
  2. I love the Google Reader gadget that I can add to my iGoogle page, even though it also doesn’t take advantage of attention data.
  3. The speed is quite impressive.  Not just for a web app, but for any app.  Shockingly fast, almost.
  4. Of course, that good ole’ built-in Google search that I love so much is there for my feeds as well.

Hmm…let me explore some more…

Technorati Tags:


Good news from Pandora yesterday – The Webcaster Settlement Act of 2008 was passed in the House, enabling Internet radio to exist without paying ridiculous per listener fees.  Here’s the email from Pandora:

Hi, it's Tim from Pandora;
Today, thanks to the extraordinary support of many Pandora listeners, we took a giant step forward when the House of Representatives supported Pandora and Internet radio and passed the Webcaster Settlement Act of 2008.  Now we need your help so that the Senate will pass it also - and quickly... The finish line is in sight!
After a yearlong negotiation, Pandora, SoundExchange and the RIAA are finally optimistic about reaching an agreement on royalties that would save Pandora and Internet radio.  The legislation would give us the extra time we need to finalize the deal.
Please call your Senators Monday morning starting at 9:00 (Eastern) and ask them to support the Webcaster Settlement Act of 2008.
The person who answers the phone in your Senator's office may ask for the bill number - it's H.R. 7084 (if they ask for a Senate bill number, you can assure them that in this unusual case, the Senate is actually voting on the House bill number).
Senator Richard Burr: (202) 224-3154
Senator Elizabeth Dole: (202) 224-6342
If the phone is busy, please try again until you get through. These calls really do make a difference.
Thanks so much for you ongoing support.
Tim

The senators listed there are from North Carolina.  Find your own senator contact #’s here.  There you have it.



The question was posed on the newsgroup: how do I delete emails (over POP or IMAP) on a remote mail server through PowerShell?

Here’s an example of one way to do it – through the use of the get-imap, set-imap, and get-pop cmdlets that are included in NetCmdlets.

## deleteemail.ps1: Delete all email from a particular sender ## deletes emails from an IMAP or POP server. ## Returns a collection of objects containing information about deleted emails (from, to, subject) or mailboxes (name, flags) in a mail server. ##  ## By default, IMAP will be used.  To use pop, add set the pop argument to 1.  param( [string] $server = "",
[System.Management.Automation.PSCredential] $cred,
[string] $sender = "someperson@somewhere.com",
[int] $pop = 0,
[int] $imapexpunge = 0
)

function get-emailaddress($header) {
[int]$index = $header.IndexOf("<")
if ($index -gt -1) {
$retval = $header.Substring($index+1)
$index = $retval.IndexOf(">")
$retval = $retval.Remove($index)
return $retval;
}
else {
return $header;
}
}

if ($server -eq "") {
$server = read-host "Mail Server [localhost]" if ($server -eq "") { $server = "localhost" }
}

if ($pop -eq 1) {
$msgs = (get-pop -server $server -cred $cred)
}
else {
$msgs = (get-imap -server $server -cred $cred)
}

Foreach ($msg in $msgs) {
$address = get-emailaddress($msg.From)
if ($address -eq $sender) {
$msg
if ($pop) {
get-pop -server $server -cred $cred -deletemessage $msg.Id
}
else {
set-imap -server $server -cred $cred -message $msg.Id -expunge:$imapexpunge -delete
}
}
}

trap{
write-host "Exception occurred (please find more information below), script execution was terminated." break }

There you are.  First I have defined a function to take a sender address and parse out the email address (in case the sender address includes a friendly name – if you’re not familiar with this, its not really important anyway).  Then I check to make sure we have a server to connect to, and depending on whether or not we’re using POP or IMAP, I connect to the server and get a list of waiting messages using get-pop or get-imap.  Finally, I loop through each message, and if the sender address matches the one I’m looking for, I output and then delete the message.  

 

 

 

 

 

 

 

Technorati Tags: , , , ,


I was looking around for how to load images faster than the .NET System.Drawing.Image class and found this awesome finding from Omar Shahine.  The .NET 1.1 SP1 update included a new signature for System.Drawing.Image.FromStream that takes a boolean “validateImageData”.  If you set this to true, the loading time is *much* faster.  Does anybody know what validation is actually performed when this parameter is true?



 Every once in a while its good for all of us, after a hard work day, to enjoy a tasty cold beverage.  In these times of enjoyment, you should never be caught without the means to open said tasty beverage.  Enter the BrewzKey.  Your key to bottled goodness.



If you’re into PowerShell at all and you haven’t listened to the PowerScripting Podcast, you should definitely check it out.  I know you’ve seen me write about the show before, but I also know that alot of us don’t have time to listen.  Try downloading a copy and burning it onto a cd for your drive home, or copy it onto your mp3 player.  The show is done by Hal Rottenberg and Jonathan Walz, two great guys who are a big part of the PowerShell community and who work hard putting together a great show.

The show is great – heck even the advertisements are interesting.  IMO, the best things about the show are the interviews and the Ustream channel.  The interviews are always with very interesting people who are doing interesting things, and listeners can ask questions in advance or even from the Ustream chatroom.  

They post excellent show notes on their blog, and you can listen to previous episodes there too, or subscribe to their feed to get the podcasts in your podcast client (like the Primetime Podcast Receiver.  Have I mentioned that I hate iTunes?  And iPods?).

Technorati Tags:


In my last post I described AWSLink, my bookmarklet for generating Amazon Associates product links.  It helps if I provide a link to AWSLink, huh?  Here it is!


I don’t know if there is already an easy way to do this that I just don’t know about, or what…but it sure seems like there should be.  I always find it a pain in the ass to create Amazon Associates links – I’ve always had to go to their website, click “Build Links”, click “Text Links’, paste in the URL to the product page, etc.  Annoying.  The URL isn’t that difficult to build, so I just created a little bookmarklet that will do it for me.  You can use it with your own Amazon Associates tag if you like.  Just go to AWSLink, type in your Associates tag, click “Generate Bookmarklet”, and drag the link into your bookmarks.  Then when you’re on an Amazon product page you’d like to link to, just click the bookmarklet and grab the URL.



I had an awesome 32nd birthday yesterday.  I had some family in from out of town and we had a great time.  Then I headed to the pool with the gf to enjoy a few tasty beverages and an awesome afternoon in the sun.  After that we headed out to a secret dinner destination, which turned out to be the famous Angus Barn restaurant in Raleigh, where I devoured a 24 ounce t-bone and we enjoyed some nice wine.  Here’s the awesome camera that Lauren got me.  I’d been talking about buying a new, smaller camera that I’d be able to easily slip in my pocket!  I love it!



“Quintas" was another of the winners of the PowerScripting Podcast’s NetCmdlets scripting contest.

Quintas submitted an espn-download script, which retrieves podcast feeds from espn.com and downloads the mp3 files for later listening.

Here is Quintas’ script:

# ESPN-Download  param($DownloadDir=$(throw "Usage:  ESPN-Download.ps1 DownloadDirectory Show LatestorAllDownloaded`nShows`n1. Mike & Mike`n2. PTI`n3. Around The Horn`n`n[L] for latestshow or [ A ] for All shows`n"),
[string]$ESPNShow=$(Read-Host "Enter number of the ESPN Radio Show you want to download: `n1. Mike & Mike`n2. PTI`n3. Around The Horn`n"),
[string]$numberDownloads=$(Read-Host "Enter [ L ] to download just the latest show or [ A ] to download all in the feed`n") )

switch ($ESPNShow)
{
1 { $rss = get-rss -Feed http://sports.espn.go.com/espnradio/podcast/feeds/itunes/podCast?id=2445552 }
2 { $rss = get-rss -Feed http://sports.espn.go.com/espnradio/podcast/feeds/itunes/podCast?id=2406595 }
3 { $rss = get-rss -Feed http://sports.espn.go.com/espnradio/podcast/feeds/itunes/podCast?id=2839445 }
}

switch ($numberDownloads)
{
"A" {
Foreach ($feed in $rss)
{
$title = $feed.Title
$title = $title.Replace('/','-')
$title = $title.Replace(':','-')
$fname = "$title.mp3" $filename = "$DownloadDir\$fname" Write-Output "Downloading $filename" (New-Object System.Net.WebClient).DownloadFile($url,"$filename")
}# Foreach } default {
$title = $rss[0].Title
$title = $title.Replace('/','-')
$title = $title.Replace(':','-')
$title = $title.Replace(" ","")
$fname = "$title.mp3" $filename = "$DownloadDir\$fname" Write-Output "Downloading $filename" (New-Object System.Net.WebClient).DownloadFile($url,"$filename")
}
}
Technorati Tags: ,


Its easy to forget about the –debug parameter, but a lot of times it can be very helpful, especially with NetCmdlets where in many cases –debug will output the protocol interface (the “PITrail” as we call it at /n software) of the connection.  The PITrail includes a trail of communication between the cmdlet and the remote host it is talking to.

Rob emailed me to ask for help diagnosing a 425 error he was getting when using the NetCmdlets get-ftp cmdlet.  As I described to Rob, in a nutshell the 425 problem happens because the FTP client (the cmdlet in this case) is unable to open a TCP data connection (for transferring data like file directory listings or file contents) on the ip and port that the server told it to use. 

Adding the -debug parameter to the get-ftp call, I can see what ip and port the server is telling me to connect to:

PS C:\> get-ftp -server 10.0.1.1 -user myusername –password ******* -debug                                                    
DEBUG: VerbsCommon.Get-FTP started processing.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a
DEBUG: Info: Connecting to FTP server.
DEBUG: Server: 220 (vsFTPd 2.0.4)
DEBUG: Client: USER myusername
DEBUG: Server: 331 Please specify the password.
DEBUG: Client: PASS *******
DEBUG: Server: 230 Login successful.
DEBUG: Client: PASV
DEBUG: Server: 227 Entering Passive Mode (10,0,1,1,225,79)
DEBUG: Client: LIST
DEBUG: Server: 150 Here comes the directory listing.

DirEntry : drwx------ 2 1036 100 144 Nov 16 2007 test.txt
FileName : test.txt
FileSize : 144
FileTime : Nov 16 2007
IsDir : True

DirEntry : -rw------- 1 1036 100 14 Jun 20 14:56 test2.txt
FileName : test2.txt
FileSize : 14
FileTime : Jun 20 14:56
IsDir : False
In Rob's case, his 415 error happened right after the LIST command.  By using –debug, we were able to see without a doubt that the server was actually sending a valid ip and port in its response, but that port simply wasn’t open on the firewall guarding the server machine. 

The firewall *should* have been able to see the port that the server chose and open it up, but I guess this particular firewall just isn’t that smart.  Anyway, Rob was able to correctly configure a smaller passive port range in IIS FTP and sync that range with his firewall.

Related:  FTP Error 425,
FTPS Through NAT



Mark Schill was another of the winners of the PowerScripting Podcast’s NetCmdlets scripting contest.

Mark submitted a tweet-im script, which sends an instant message about new tweets found in the Twitter RSS feed.  They explained on the podcast that Twitter used to have an IM-bot feature which went away, so Mark created this script himself to meet this need.  The script simply sits and fetches your Twitter friends timeline feed every x seconds, checks to see if the items it finds are newer than the last check, and if so sends out an IM (jabber/xmpp) containing the content of the tweet.

Here is Mark’s script:

# Here is a script that interrogates the Twitter RSS feed and sends an IM for each posting. 
# It starts out with all of the postings in the feed and then posts each subsequent posting as it is added.
# Author: Mark Schill

$TwitterUsername = "user"
$TwitterPassword = "password"

$IMServer = "server"
$IMRecipient = "recipient"
$IMCredential = get-credential

$ThisPath = $MyInvocation.MyCommand.Path | split-path
$TempFile = "$ThisPath\twitterstatus.txt"

$PreviousContent = ""

while ($TRUE)
{
    $CurrentContent = ""
    [xml]$Feed = (Get-HTTP -user $TwitterUsername -password $TwitterPassword https://twitter.com/statuses/friends_timeline.atom).Text
    $Entries = $Feed.feed.entry
    foreach ( $Entry in $Entries )
{
        $PublishTime = New-Object System.DateTime( $Entry.published.Substring(0,4),
        $Entry.published.Substring(5,2),
        $Entry.published.Substring(8,2),
        $Entry.published.Substring(11,2),
        $Entry.published.Substring(14,2),
        $Entry.published.Substring(17,2),
        [SYstem.DateTimeKind]::Utc
        )
        $CurrentContent += "($($PublishTime.ToLocalTime())) $($Entry.title)`n"
    }

    Compare-Object -referenceobject ($PreviousContent -split "`n" ) -differenceobject ( $CurrentContent -split "`n" ) | % {
        if ( $_.SideIndicator -eq "=>" )
{
            Send-IM -Server "im.flosoft.biz" -Credential $IMCredential -Recipient $IMRecipient -Message $_.InputObject
            Write-Host $_.InputObject
        }
    }

    $PreviousContent = $CurrentContent
    #Sleep for 5 minutes
    Start-Sleep 60
}
Technorati Tags: ,