Tuesday, January 26, 2010

Registering a new address with AT&T DSL

AT&T wants to guide you through one of its pages, but it doesn't seem to like any browsers that people actually have installed. Go here instead: 144.160.11.35/register

When you're done, it still may not work. Unplug your modem for 30 seconds, plug it back in, and then try again.

Saturday, January 16, 2010

Rudimentary PowerShell wrapper (CMD.exe replacement)

PowerShell rocks, but CMD.exe sucks is too limited for my tastes. I'm going to try making a wrapper/CMD.exe replacement for PowerShell. And what better language to write it in than PowerShell script itself? I'm calling it "IggyPosh" for now (POwer SHell).

Here's an early draft. No prompt or command history, but you can type commands and they are executed, so it's a start.


function test($str) {
$str = $rs.CreatePipeline($str).Invoke() | Out-String
$history.Text += $str -replace "\s+$([Environment]::NewLine)",[Environment]::NewLine
$history.SelectionStart = $history.Text.Length
$history.ScrollToCaret()
}

# Prepare the window
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$form = New-Object Windows.Forms.Form
$form.Text = "IggyPosh"
$form.Size = New-Object Drawing.Point 600,400

$history = New-Object Windows.Forms.TextBox
$history.Multiline = $true
$history.ReadOnly = $true
$history.ScrollBars = [System.Windows.Forms.ScrollBars]::Vertical
$history.Dock = [System.Windows.Forms.DockStyle]::Fill
$history.BackColor = [System.Drawing.Color]::FromArgb(0,64,0)
$history.ForeColor = [System.Drawing.Color]::FromArgb(224,224,224)
$history.Font = New-Object System.Drawing.Font("Consolas", 9)
$form.Controls.Add($history)

$command = New-Object Windows.Forms.TextBox
$command.Dock = [System.Windows.Forms.DockStyle]::Bottom
$command.add_KeyDown({
if ($_.KeyCode -eq "Enter") { test($command.Text); $command.Text="" }
})
$form.Controls.Add($command)

# Try to init a powershell instance we can talk to
$rs = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspace()
$rs.Open()

$form.ShowDialog()

Wednesday, January 6, 2010

Fix: Installers fail because of "pending reboot" (windows)

If an installer refuses to run because of a "pending reboot" to your system, it may be because of files listed in the "PendingFileRenameOperations" key in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations

Open that key in Regedit and check the entries. If they look harmless (especially if they are in some sort of Temp folder), remove them and try again.

More information here.

Tuesday, January 5, 2010

Create directories and upload files to Sharepoint from PowerShell

Create a new folder on Sharepoint server hosted at http://server/:
$url = "http://server/Shared%20Documents/newfolder/"
$req = [System.Net.HttpWebRequest]::Create($url)
$req.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$req.Method = "MKCOL"
$res = $req.GetResponse()


Add a file to that folder:
$dest = $url+"newfile.txt"
$src = "C:\myfile.txt"
$wc = New-Object System.Net.WebClient
$wc.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$wc.uploadfile("$dest", "PUT", $src)

Sunday, January 3, 2010

IEEE float special values (infinity, NaN)

I couldn't find anything in the Cg documentation on how to specify infinity or NaN, but these seem to work:

Infinity: 0x7f800000
-Infinity: 0xff800000
NaN: 0x7fc00000

Saturday, January 2, 2010

Solved: "Why won't my quad show up?!?"

Order of vertices is important. This will show up if put in front of the camera:

glVertex3f( size, size, z);
glVertex3f(-size, size, z);
glVertex3f(-size, -size, z);
glVertex3f( size, -size, z);

This, on the other hand, won't (it'll show up if you move the camera past it and turn around):

glVertex3f(-size, size, z);
glVertex3f( size, size, z);
glVertex3f( size, -size, z);
glVertex3f(-size, -size, z);

Guess which one I was just trying for 30+ minutes. :-/

This was due to my using backface culling. Durr. ><