Wednesday, October 26, 2011

Reset SQL Server Express 2008 sa password and change from windows authentication to SQL server authentication


The challenge ... get sa access to an unknown SQL server express 2008 R2 database using SQL server authentication without installing SQL server management studio when database was setup with windows authentication.

I needed a database on the remote server, and it already had a SQL server express database but i didn't know anything about it including username/passwords. I could log on from my machine using SSMS using windows authentication, but did not have enough permissions to create a database. I figured i needed an sa login (both for my SMSS connection, and for using the database later from software). There's lots of information out there for doing this with SMSS installed locally on the machine, but i didn't want to install SMSS because it's just so big (500MB) and takes a long time and i have a wifi connection to the remote server and i was up for a challenge of how to do it without SMSS.

First, we need to reset the sa password. (Actually, SQL server by default installs without sa enabled and you would normally set a strong password in SMSS and enable the account)

You need to switch SQL server express to run in single user mode i.e. the -m switch.
Start SQL server Configuration Manager (Start > Programs > Microsoft SQL Server 2008 > Configuration Tools), and right click on the Sql server process and select properties. On the "advanced" tab, select startup parameters and you see "-dc:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\master.mdf;-ec:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Log\ERRORLOG;-lc:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\mastlog.ldf". Add ";-m" to the end of this and restart service.

You can run MS SQL Server commands with osql e.g. from command prompt run
osql -E -q "SELECT * FROM sysdatabases"
List your database instances with
osql -L
then run commands on your chosen instance.
Set the sa password to something new...
C:\Users\Administrator>osql -S instance -E
1> sp_password NULL,'yourPassword','sa'
2> go
and enable the sa user
C:\Users\Administrator>osql -E -q "ALTER LOGIN sa ENABLE"
1> go

When i tried to login with SQL Server authentication, i got error 18456
Checking event viewer on the server, it says SQL server is setup for windows authentication.

We need to enable Mixed mode authentication. This is easy enough by changing registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQLServer\LoginMode = 2

Now i can login with sa using SQL server authentication

Wednesday, January 12, 2011

Completely silent/quiet PVR / Home Theater PC system


The hard part in building your own completely silent PVR / home theater PC system is choosing the correct components.

You need the following
- a quite PC
- a tv receiver
- a remote
- software

For software, you have lots of choices like mythtv, windows media center etc.
After trying a few, we found ourselves using microsoft media center. It's super easy to setup and use, virtually configures itself with the hardware you have (remote, tv receiver), and gives you program schedules (what's on tv) for your zip.
I did like the XBMC UI, but it requires a myth backend and gets complicated.

For a quite PC, you can't beat the Shuttle XS35GT. If you install an SSD hard drive, it's completely silent. It has no fan. It's super powerful too with dual core hyper-threaded (4 cpus in task manager). Cost ~240
http://www.newegg.com/Product/Product.aspx?Item=N82E16856101114
It comes with a handy CD that has all the windows 7 drivers which makes windows 7 installation a breeze. e.g. network drivers etc.

Matching memory can go up to 2GB.
Cost ~32
http://www.newegg.com/Product/Product.aspx?Item=N82E16820220281

SSD silent hard drive - Grab the biggest you can. win7 takes about 12 gb. Media center will want about 10GB for cache (allowing pause etc), and you need 15GB per hour of digital tv. I got a 120GB for $169. , otherwise i'd probably buy one of these http://www.newegg.com/Product/Product.aspx?Item=20-148-348&nm_mc=EMCPB-012011&cm_mmc=EMCPB-012011-_-PB010811-_-Item-_-20-148-348 which has sweet specs)


For a remote, i like the VRC-1100 MCE remote. It includes controls to move the mouse as well which is handy.

The tv receiver is a cheap kworld ub435-q usb thingo. cost = ~30
It has win7 driver.

Works great.

** note about network storage --- windows media center simply does not support or allow recording directly to network locations. However, it's not a big deal because you can create a windows task scheduler task to move recorded programs to a network drive immediately after the recording completes. You do this by starting task scheduler (type task scheduler in the start button find box), and select action > create basic task. Give it a name (e.g. copy recorded tv programs to network location) and hit next. Select the task to start when a specific windows event occurs, and in the drop for event, select media center and the source being recording and the event id is 1 (for when a recording finishes normally). Then create a batch file in notepad (i.e. a file with name tv_copy.bat where you save it using "All Files" so that it really ends in .bat and not .txt) and it contains one line like
start /MIN move /Y "C:\Users\Public\Recorded TV\*.*" L:\
where L:\ is the destination (mapped network drive)
This will move recorded programs that end normally. To move recorded programs that are stopped manually, create another task that uses event id 3.
reference

Saturday, January 8, 2011

MAME in 5 minutes

Mame emulates arcade machines.
grab mameui32 from here http://www.mameui.info/
and install it. Current version is 141.
Each Mame build is linked to a set of games/ROMs, but mame itself doesn't come with any ROMs.
In the tree view on the left, you'll see all the All Games, and Available. Available will be empty.
You have to supply them yourself and copy them into the roms folder.
For example, download space invaders ROM from http://www.romnation.net/srv/roms/mame103/s.html and store it in your mameui32/ROMs folder
Start mame, and hit F5 (or select refresh from view menu) and then your game appears in the available folder.
There're over 8000 games - and they vary a lot in size. Some sites sell DVDs will the entire collection. The complete set is about 12 DVDs. But a minority of games (about 250) are much bigger, and require significant hardware to run (think quad CPU with SLI graphics) and so are hard to run and so you can also get 7DVDs that contain all but those.
As a rough guide, the above game runs fine on a core2 laptop.

Monday, January 3, 2011

Music event at Julia's preschool - Dec 2010


Here's some video of the Dec 2010 music event at Julia's preschool.
The video was taken by another parent - so you see their child a lot. We couldn't make it to the event and were so happy to get these videos with Julia.

Looks like video quality not as good as facebook. Check them out on my facebook page for better quality.