Replacing the water cooler

The water cooler failed.  After ripping the son of a bitch out, it appears the internal copper bits corroded, probably from using distilled water instead of blue stuff, which is not available anywhere except mail order.

Water cooling is not ready for consumers, here’s a few reasons, based on my experience:

The cooler did not work at all with a standard case.  It endangered parts should it have ever leaked, required brackets and screw holes that don’t exist on standard case.  It was too huge and bulky to actually fit in a rather big box.  The tubes interfered with expansion cards and were hard to position without crimping.

The water cooling system was extremely loud and not much better at cooling that the huge heat sink I have replace it with.  My replacement runs at 36 at idle and 45 at 100% CPU usage.

The water cooling system appears to have required some weird chemical to keep the internals from corroding.  Given that the coolant appears to somehow evaporate and escape from this seemingly sealed system, it cool run out of coolant at any moment.  Ordinary consumers not going to stand for a cooling system that requires mail ordering coolant.  I’m not even entirely sure about this theory, as I have always suspected that the company was trying to pry more money out of me by saying that only their secret blend of weird chemicals worked in their cooler.  Rather than have give them another buck, I’ll tell them to themselves f*k.

Proprietary cooling chemicals.  You don’t put proprietary software into your machine, why put proprietary cooling chemicals in your machine?

Installation.  I have a huge box full of parts left over from installation.  The cooling system increased the number of parts in my computer by a full 50% at least.

(brand names & links to the guilty to be added later)

Using Random in ASP.NET

In C# and ASP.NET you can generate random numbers like this:

Random r = new Random(System.DateTime.Now.Millisecond);

double d = r.NextDouble();

But, in an stateless ASP.NET world, you will get the same random number generator starting over at it’s pseudo-random beginning each time the page posts back and you create a new Random object. To keep a random number generator moving forward with new random numbers, use something like:

public static double roll() {

Random r;

if (HttpContext.Current.Session["r"] == null)

{

r = new Random(System.DateTime.Now.Millisecond);

HttpContext.Current.Session["r"] = r;

}

else

{

r = (Random)HttpContext.Current.Session["r"];

}

return r.NextDouble();

}

Outsourcing Identification

Three of my favorite website now use the same cryptographic keychain and password:

  • Paypal
  • Half.com
  • Ebay.

That’s because Ebay owns them all. Similar situation for Flickr and Yahoo.  Gmail and Google Analytics.  Make you wonder if it is the ID system that helps drive consolidation or if it’s just cheaper to have one authentication system for the whole portfolio of companies a big corporation owns– probably a bit of both.

I wish Ebay would make their authentication service available to the world, in an InfoCard/OpenID sort of way, because plain OpenId is still single factor identification.  (InfoCard is a type of two factor identification if you call your entire physical computer the one factor and the network logon/InfoCard pin the other factor.)

Bill Monk is interesting because , but you can sign in using your Facebook ID. [I can't tell who owns them, maybe the same company as Facebook?]  I’m planning on using bill monk to keep track of how much money I owe my son.  He gets paid for chores & accomplishments and sometimes is allowed to spend it.  Accounting is currently done on a piece of paper on the fridge, not exactly a web 2.0 user experience.

Running a Ps1 File and PowerShell Signing

Invoking a Powershell Script

By default, powershell does not run any unsigned ps1 files. Also, to invoke a script, you need to prefix it with .\

.\myScript.ps1

The following will get a bemusing error message:

myScript.ps1

If you don’t sign it, you will get an error message about not trusting the code.

Should we sign it?

If you distribute the code, you might want to sign it. If you are paranoid about accidentally running malicious code, you might want to sign your code, maybe if you work at a bank or some other attractive target for hackers. Signing PowerShell Scripts is a very challenging chore.

  • If the script moves to another machine, you will need to bring the certification authority with it.
  • If the script’s signature expires, you will need to resign the script (and this will probably be a different user, with different access to tools and documentation)
  • If you don’t do self signatures, you will have to harass the system administrator who has access to the companies SSL cert, or worse spend money on a SSL cert.

Here is how to turn off signing and return to the security policies that govern .BAT files.

Set-ExecutionPolicy Unrestricted

Set-ExecutionPolicy RemoteSigned

Remote signed is not a hassle like the other two because it only applies to scripts that were sent to you, say by the Mafia.

Registering the PowerShell MSAccess Provider

Compile the provider. It is called a provider, but treated like a snap in.

set-alias installutil $env:windir\Microsoft.NET\Framework\v2.0.50727\installutil.exe

installutil c:\….. path to the .net assembly

see if it worked

get-PSsnapin -registered

In the next step use the snap in name

add-pssnapin “AccessDBProviderPSSnapIn05

This was the part I missed. This time the name is the provider name.

New-PSDrive -Name AccessDB -PSProvider FileSystem -Root “c:\myaccess.mdb”

To get to the new ‘drive’, use

set-location … name of drive…

You should now be able to navigate to the MS-Access database as if it was a file system and use PowerShell file system commands to do stuff.

Hosting PowerShell in ASP.NET

PowerShell can be run inside of your application, even an ASP.NET one. I started with Dominick’s sample on hosting powershell in ASP.NET.

The UI was modestly difficult. I used a label and a textbox that uses AJAX to update the label with the output of a PowerShell command each time I hit enter and trigger the Ajax updated event.

First odd thing, the runspace (which is like the powshell session) is stored in cache, so it is a global object. If the application is multi-user or multi-browser with one user, effects in one browser or user will bleed over into the other. So far my only idea for possible improvement is to store the user session ID or user name into the cache. The user docs state that there needs to be a one to one relationship between the PSHost and the runspace.

Next odd thing, not all commands work. When using the default PSHost and if you don’t add a “output-default” command, the runspace emits a pipeline of objects (roughly corresponding to rows of output you’d get from a cmd.exe command). In Dominick’s example, the rows are converted to text and usually look okay. I added the ‘output-default’ command to the pipeline and switched to a custom host:

So I wrote a class that extended PSHost
and
PSHostUserInterface
. The former has to do with starting and stopping PowerShell. The latter is the basic user interface. With the PSHostUserInterface, you can provide a way to output warnings, writeline’s etc. There is also a Raw UI that needs to be extended to get commands like CLS to work. The PSHostRawUserInterface lets the host know what to do when someone’s code wants to write to a particular part of the screen. From the docs: “The user interface model is based on a two-dimensional grid of cells referred to as the screen buffer.”

Communication between the ASP.NET page and the PSHost was challenging. They appear to run on different threads. I ended up passing state between the page (which displays the output) and the PSHost (which has first access to the output after an invoke) by shuffling the text rows to a database and back. There isn’t an obvious way to let the PSHost keep a usable reference to a page or to pass the PSHost a usable reference to the calling page.

Now if I run my hosted PowerShell, the popularity of commands like “more” create a problem. More launches a process and waits for input. The process is launched as the ASPNET user (I’m running IIS on XP), even though I have impersonation turned on in web.config.

So my next challenges:

  1. Figure out if it is possible to get impersonation to work (either by launching the PowerShell host with credentials of my choosing or changing the credentials once inside of PowerShell)
  2. Implement PSHostRawUserInterface. It looks like it will be required to get anywhere close to approximating a windows PowerShell user experience.
  3. Figure out what to do when a process gets launched accidentally from ASP.NET–and is invisible! Unfortunately almost no applications check to see if they are being run remotely and can’t expect to get user input.
  4. Determine what constitutes a carriage return that means “line continuation inside a command or expression” and what means “send this command to the pipeline and invoke it!” This will also be tricky to do inside of a multiline HTML textbox.

Better ASP.NET Web Controls

I created a better asp.net drop down control that supports missing values better than the default control. It’s now set up as a complete library and opensource project on Google Code.

Development Agenda

A better HyperLink tag. Hyperlinks should support FOAF like properties. XFN is one kind of FOAF like property.

A better HyperLink title. Hyperlink titles in MSIE show a tool tip, but in Firefox, the anchor title is virtually inaccessible. A good improvement would be to add browser sniffing and javascript tooltips that work for Firefox. A great improvment would be to add design time fetching to the target page’s “Title” to use as a default title.

Google Pack

Google Pack, (not to be confused with Google Apps) is a bunch of desktop applications, some created by Google and some created by other companies. Importantly, it allows one update application to track new versions of many applications. This is better than having you or a separate update program for each application try to keep thing up to date.

Created by Google.

Google Earth. Competes with Microsoft Earth and NASA WorldWind. I recommended getting all three.
Google Toolbar for Firefox or MSIE. Important for popup blocking. Optional–modern browser already let you block some popups in the preferences.
Google Desktop. Better than either of the Windows desktop search technologies. It is fast and easier to configure. Recommended. Also includes widgets, similar to Vista widgets or Yahoo Kombobulator. Widgets only recommended if you have a huge screen.
Picasa. The best way to remove red eye from photos. Also, with time you can learn to fix a lot more defects. Recommended.
Google Photo Screensaver. Very pretty. Recommended.
Google Talk. Yet another IM client. Useful for chatting with people who have gmail, but not any other IM client. Not really recommended, Google talk is an also ran in the IM universe. An exception might be if you plan on using Google Apps and can ensure everyone in your small company will have a Google talk account.

Not created by Google
Norton Security Scan.
I use clamwin. Not recommended.
Spyware Doctor. I use Windows Defender. Not recommended.
Adobe Reader. I’m fed up with Adobe’s update system, I use Foxit. Not recommended.
Skype. Skype is yet another IM/Voice chat application with emphasis on the voice chat. Unlike most IM chat clients, you can use Skype to call physical telephones. Skype seizes your left over balance if you don’t use them frequently and continuously. This is recommended, just be careful about giving Skype money.
Real Player. The BBC has a crapware free version of realplayer. Use that one instead if you come across a site that offers content only in real player format. The market for media players is very crowded with good free competitors, many with better sound quality. Last.FM has better sound for streaming radio. Democracy player and Songbird have better support for rss subscriptions to media. Not recommended.

In sum, just because an application is bundled with a bunch of high quality Google Applications, that doesn’t mean you want it on your system.

Ready to set up a new computer fast?

Google Apps

Google apps is where a small business decides to use Google’s office browser based applications and email instead of Word/Excel/Outlook/Exchange

The other competitor is Open Office, Thunderbird and Sunbird, who likewise is free, but is client based. Google wins over these client based applications only in that Google’s apps don’t need to be installed and Google take care of the backup.

You can do some fancy smancy DNS record manipulation to get email sent to johndoe@yourdomain.com to be sent to your Google Apps gmail account. Personally, I just have my web host forward my mail to my google account where I can pick it up with POP access.

Pros: It is dramatically cheaper than installing applications to all your user’s desktop machines. The business version of Google Apps costs money though.

Cons: People are already somewhat used to office apps. Anyone that already has Word is going to be reluctant to change. But Google apps can read most MS formats.

Ready?

Google Checkout

Google check out is a 3rd party payment processor. It also is an authentication mechanism, albeit only at time of purchase.

Pros.

They are paying customers $10 at time of sign up.

You don’t have to store credit cards at your web site.

Your customers can have fewer passwords for money.

It is a REST based API– meaning your application communicates with Google via HTTP GET commands, instead of HTTP POST. You can build your app in .net, java or PHP.

Fairly cheap as far as payment processing goes, 2 percent plus 20 cents with discounts for merchants who have big Ad Words bills.

Cons.

No two factor identification, like what Paypal has.

You aren’t integrated into the Google authentication infrastructure. So you will still need to create a user account in your own infrastructure, then at time of purchase, the user will be asked for a 2nd password. The only saving grace of this 2nd password is that it is one that they probably already use frequently and can use at other sites that take Google Checkout. The other way to look at it is Google checkout purchases will be treated as if they were a different customer than the one in your custom user table)

Limited Authentication Claims. The merchant doesn’t seem to necessarily get the purchasers email address and can’t correlate all from the same person without some detective work.

Ready to try it out as a buyer?