Saturday, June 06, 2009

Media Coder Samsung P2 presets

I’ve been using Media Coder to encode videos into my P2 for a while now and its been a great alternative to what comes out of the box.

Well, all *was* great until I lost the presets for the P2! It took me an whole afternoon to reconfigure the settings that work with the P2. I’m posting the preset file here in the interest of saving someone else some time.

These setting work great for me. Your mileage may vary.

Creating “App Paths” using Powershell

I’m a big fan of Slickrun and its a tool I recommend everyone should have in their toolbox.

Unfortunately, working onsite on the client’s computers, installing third-party software is usually frowned upon. So I’ve got to make due by using the app paths.

The App Path technique of launching applications have have been around for a while. Read More:

http://www.tweakxp.com/article36950.aspx

The purpose of the script is to make the whole registry editing process a bit easier.

You can download the script here:

And execute it as such:

appPath.ps1 -key "notepad2.exe" "c:\windows\notepad2.exe"
or
appPath.ps1 -key "notepad2.exe" -path "c:\windows\notepad2.exe"

Where –key is the entry you would type in the Run dialog (please note that the extension is required).  And –Path being the actual path of the file.

Disclaimer: This script modifies the registry. Use at your own risk, I will not responsible for anything that breaks as a result.

Friday, June 05, 2009

Troubleshooting Orphaned Users in SQL Server 2005 / 2008

A couple of days ago, I was tasked with moving a database from an older server to a new souped-up box. Unfortunately the transition was not as smooth as I had hoped for. After restoring the db into the new server I started running into trouble with orphaned users.

An orphaned user is basically just that, a database user without a corresponding server login.  This usually happens when trying to restore a database into a new server, like what I was doing or accidently deleting the server login.

Luckily this issue can be solved relatively easy using the sp_change_users_login stored procedure.

First I get a list of orphaned users and their SIDs using the following procedure:

sp_change_users_login @Action='Report';

Next, I create the missing login from scratch (e.g. “NewLoginName”). The server mappings are not required as the database user roles are preserved in the database.

Then execute the stored procedure again with the following parameters:

sp_change_users_login
      @Action='Update_One',
      @UserNamePattern='dbUserName',
      @LoginName='NewLoginName';

This re-jigs the broken “dbUserName” user with the newly created Server Login “NewLoginName”.

Its worth mentioning that even though there might be a login name existing on the new server identical to the database user name, they are not the same until linked together. You can find out for sure using the above stored procedure with the “REPORT” parameter.

Finally, hereare some instances where sp_change_users_login cannot be used:

  • Cannot be used to map database users to Windows-level principals, certificates, or asymmetric keys.
  • Cannot be used with a SQL Server login created from a Windows principal or with a user created by using CREATE USER WITHOUT LOGIN.

More information: