Mark 的个人资料Mark's Log照片日志列表 工具 帮助

日志


10月20日

Here's where to get the Win7 Hyper-V management stuff

Because you can't just search on "Windows 7" and "Hyper-V" or "Hyper V". Nooooo. You have to know to search on RSAT.
 
 
9月18日

Home made DVD burner robot for actual use

Someone finally made a DVD burning robot for actual extended use. Personally I'd use the Lego version if I could make it, but he's got a point that it might not be the most durable thing in the world.
 
Drawbacks to his design:
 
1. Cheated on the CD/DVD grabber by using one from a commercial machine that he bought. This was the piece I was looking forward to seeing how he solved - and he didn't solve it, he bought it.
 
2. He also used two or three parts from companies that are out of business or no longer sell to the kit crowd.
 
3. He didn't post the Perl for me to see. :)
 
Other than that it's great. Oh and I'm jealous I don't have a Mini-ITX sitting around to use for this.
8月28日

IE 8 Beta 2 first impresssions

My buddy is a dev on the IE team, and last night he asked me for my impression of IE 8 Beta 2. I told him I hadn't found it for install though I'd read that it was out, so he pointed me at http://blogs.msdn.com/ie and after following a few links I found the file to install.
 
Problem 1: To install IE 8 Beta 2, you must first uninstall IE 8 Beta 1.
Problem 2: Uninstalling IE 8 Beta 1 requires you to reboot.
Problem 3: Installing IE 8 Beta 2 requires you to reboot.
 
Compare to Firefox: Firefox usually makes you restart FireFox, which is a lot less hassle. I'm sure there are critical reasons why IE makes you reboot, but as a user... I don't care. I just don't. I shouldn't have needed to reboot.
 
The rest so far is learning curve:
 
1. I like that there's no IE7 compatibility mode, it seems to know when it's going to break something and switches for you.
 
2. It took me a while but I finally understand why the heck the tabs are turning odd colors - it's so you can see groups of tabs. Open a tab by middle clicking on a link (something I do constantly) and both the parent tab and the new tab get highlighted in the same (seemingly random) color. Annoying when I didn't know what it is, not so much now. It could be better though: I'll start at, say, http://my.live.com where I have easily 15+ RSS feeds that don't much relate to each other. I'll pick and choose links, middle-clicking each one. IE8 Beta 2 color-codes them all the same and while they were all opened from the initial page, most of them don't relate to each other at all, so the colorizing doesn't help me much. Also, it means I have to look much more closely to see which tab is the foreground tab.
 
3. InPrivate seems like a neat feature, but I have yet to find out what the downsides are. In other words, why would I ever want non-InPrivate (InPublic?) browsing?
 
4. So far it has crashed on me twice, though each time only the single tab was effected. That's a great improvement, but not crashing in the first place would be an even better improvement. (Again, user mode here, I don't care whether or not it was a third party plug-in that caused it to crash. Don't crash!) Here's a page that seems to crash repeatedly - just wave the mouse around the page a little: http://www.time.com/time/magazine/article/0,9171,924100,00.html
 
5. The accelerators (right-clicky do stuff with this link) thing seems to be even better than Beta 1. Over all I like it.
 
6. How many copies of IE 8 Beta 2 does it take to display a web page? 2, at least for the first page. When I open IE8 Beta 2 and display a single page, I get two copies of iexplore.exe running. After that, I appear to get a new instance of iexplore.exe per tab, which explains how they do the tab-based crash recovery - you're really running a separate browser for each tab. In fact, I'm guessing that's probably what's going on in the first place here - one instance of iexplore.exe to host the tab system and one instance to show you the page you're looking at.  Right now, with only this page that I'm editing this entry in , I see two iexplore.exes, one of which is taking just under 7MBs while the other is up around 35MBs. I guess it's something I'll get used to.
 
7. Why does Windows Vista (Ultimate, x64, SP1) think I need a cumulative IE7 security update now? KB953838. Seems odd. The update says it installed successfully. Why did my PC need it? Did it need it before?
 
With stuff like this http://labs.mozilla.com/2008/08/introducing-ubiquity/ and that http://www.foxiewire.com/Mozilla/mozilla-drags-ie-into-the-future-with-canvas-element-plugin/ out there, and with the awesome collection of addons available for FireFox, I think Internet Explorer has a ways to go to catch up still, but so far it seems to be improving.
 
12月10日

Things that are cool

There are many cool things out there, and sometimes I forget about them.
 
1. Robots. Far too many to link. Legos, Phidgets, Trossen, iRobot, it goes on and on.
 
2. Flashlights, and a forum of people who love them. If I had more money I might be one of these people, and I'm not sure how I feel about that, heheh. I like my 3xAAA LED maglite just fine, but there sure are some nice flashlights out there for those of you who need more.
 
3. Cameras that record what you (or your cat) did today. I wish I could buy one of the former, the latter is available - and tempting. I don't have a cat. I wonder if I could use the CatCam until the SenseCame is available? 
 
4. Motion sensing software that you can have. (Ties in with #1) I have zero use for this, and yet I find it fascinating all the same.
6月19日

Things I should have known but didn't, and x = exit

I've used DOS style commands for most of my life, to the point that I actually missed out on some of the cooler additions to them, possibly due to not reading the release notes. This first part of the post shall be a confession of the cool things I should have known about but didn't, for CMD shell commands and scripting.
 
  1. %date% and %time%. They expand properly, and are handy for use in log files.
  2. %random% will generate a random number, handy for when you're starting some process many times quickly and want to use a log file for each process. 
  3. The F8 key completes commands from what you've typed before. No, I really didn't know that before, and yes, I kick myself once per day now in atonement. 

I already knew about set /a, so it doesn't count. (set /a 2+2  prints 4, for example)

How does this relate to Powershell? Well, over time I've accumulated the custom of writing several small batch files that I use in CMD the way Powershell uses aliases. For example, d.bat, somewhere in my path, executes dir /w /on /ad, showing my all subdirectories. dd.bat does the opposite, dir /w /on /a-d, showing me only files. x.bat (x.cmd, anymore) types exit for me, closing the CMD window. (s.cmd executes start ., which opens explorer.exe in the current directory, but I digress.)

I couldn't get this to work in Powershell. set-alias x exit succeeds, as a command, but fails to run:

>set-alias x exit
>x
Cannot resolve alias 'x' because it refers to term 'exit', which is not recognized as a cmdlet, function, operable pro
gram, or script file. Verify the term and try again.
At line:1 char:2
+ xx <<<<

There's another way however - create a function named x, add that to my $profile, and things work like I want.

function x()
{
    exit
}

5月24日

Close Outlook tasks from Powershell

I want to be able to create and close tasks from Powershell. As I was experimenting with this, it occurred to me that it would be great if each task had a unique number so that I could use that when closing it. I was in for disappointment. Yes, each task does have a unique number, but it's huge!

Example: 0000000054053A5AAF751245878345951938FF0A0700FAA3A5EE761BD9439C9D3980E21B1386000001E07A30000071D3B96BC8BA4C459F0D620C68922A1B0000031D22200000

Yeah… I'm not typing that in Powershell in order to close a task. I also don't want to have to copy/paste the entire title. What to do? I eventually gave up and decided to manually (for now) isolate the characters that seem to be unique among my tasks. Now my get-outlooktasks.ps1 file looks like this:

$olApp = new -com Outlook.Application
$namespace = $olApp.GetNamespace("MAPI")
$fldTasks = $namespace.GetDefaultFolder(13)
"Gathering incomplete tasks... please wait"
$unfinisheditems = ($fldTasks.Items | ? {$_.Complete -eq $false})
foreach($item in $unfinisheditems)
{
    $arrayofentryid = split-string -Input $item.EntryID    

    for ($a = 129; $a -le 136; $a++)
    {
        $smallid += $arrayofentryid[$a]
    }

    $item | format-list subject,percentcomplete,duedate,@{label="Id";expression = {$smallid}}
    $smallid = $null
    $output = $null
}

There's probably a much better way of getting that substring of the EntryID, but I don't know what it is, yet. I'm sure it would be more appropriate to do this some entirely different way, at the very least diffing three or more EntryIDs and finding a contiguous unique range on the fly. Maybe someday I'll bother. J For now, my complete-task.ps1 file looks like so:

param ([string] $pattern)
if($pattern -eq $null -or $pattern.length -eq 0)
{
    "Error - supply a portion of the entry id"
    return
}

"Getting incomplete tasks..."

$olApp = new -com Outlook.Application
$namespace = $olApp.GetNamespace("MAPI")
$fldTasks = $namespace.GetDefaultFolder(13)
$unfinisheditems = ($fldTasks.Items | ? {$_.Complete -eq $false})
write-host Getting task whose EntryID contains $pattern
$tasktoclose = $unfinisheditems | ? {$_.EntryID | select-string -pattern $pattern}

if($tasktoclose -ne $null -and $tasktoclose.count -eq $null)
{
    $tasktoclose.Subject # display the subject at the console
    $tasktoclose.Complete = $true
    $tasktoclose.Save()
    write-host "Task has been marked completed and saved."
}
else
{
    "More than one task returned OR no task found. Aborting."
}

It may not be pretty, but it works!

5月17日

IT - where every day is like an episode of Star Trek

In IT, every day can be like an episode of Star Trek*, or maybe MacGyver, or maybe even a Ninja movie!

 

Today’s problem:

 

A server, I’ll call it X, cannot be connected to via terminal services. When you try, you’re told you have to activate Windows and prompted to activate, log out again, or shut the server down. However, when you agree to activate, you are logged out. Examining the event log remotely shows that oobe.exe is crashing with the fault lying in urlmon.dll.

 

Searching the Internet for that eventually leads to a support post which contains a link to the real problem and a possible solution at the bottom, which is to try uninstalling IE7 and THEN activating Windows. Some of you are thinking to yourselves, “Wait, how can I possibly do that when I can’t log in?” The answer is psexec,  if you can run the uninstaller in unattended mode. To find out whether or not I could, I ran \\x\c$\windows\ie7\spununinst.exe /? so that the uninstaller would run locally on my machine, and sure enough, there’s a /quiet switch. There was also a /norestart switch – perfect.

 

Next, I ran this:

 

psexec \\x cmd /c %windir%\ie7\spuninst\spuninst.exe /quiet /norestart

 

At that point I sat back and pondered the absurdity of the cosmos. I mean, this is really reaching. If it works, I should get some kind of medal.  

 

Update: It worked.  No reboot required. I was able to connect to the machine via terminal services and activate windows. All is well.

 

(Disclaimer – this was an inherited server, I wasn’t responsible for it originally.)

 

Thanks PsExec!

 

 

*Particularly the scenes where they have to overcome some technical problem by doing something almost completely unintelligible.