Using mplayer/mencoder to convert to an MPEG

MEncoder is a useful media encoder that comes with MPlayer The Movie Player

To use, you’ll need to download and install MPLAYER as well as the extra plugins. You may also need Real Player, Quicktime, Windows Media Player installed (or an alternative.)

OK I’m always having to lookup the mencoder flags for encoding video files, so heres a useful example:

c:\mplayer\>mencoder.exe input.file -of mpeg -ovc lavc -oac lavc 
                  -lavcopts vcodec=mpeg2video:acodec:mp2 -o output.file

of = Output File ovc = Output Video Codec

The rest of the options can be looked up.

Cannot delete AVI/MPEG Video Files

This problem occurs when windows is trying to show you a preview picture of your video, whilst you are trying to delete the file. So then you get a message telling you the file is still in use and the delete operation fails. Solution? Stop windows from showing you thumbnail images of your videos.

Start -> Run -> regedit
Edit -> Find

In the search box type this:

{87D62D94-71B3-4b9a-9489-5FE6850DC73E}

Tick the box titled ‘Keys’ and untick the others. It should find the key for ‘AVI Properties handler.’ Right click the key from the left window pane (with the folder tree view) and click export. Choose a file name to export the key to, and click OK. Now you can delete the key you just exported. If anything goes wrong, you can double click the .reg file you just created to restore the key.

You can also delete the following keys:

{40C3D757-D6E4-4b49-BB41-0E5BBEA28817}
Video Media Properties Handler

{c5a40261-cd64-4ccf-84cb-c394da41d590}
Video thumbnail extractor

Working with Microsoft SQL Server MDF LDF Files

This article is about .MDF and .LDF files. These files are created by Microsoft SQL Server, and if you have some of these, and you want to view their contents read on.

The files I had originated from a Microsoft SQL Desktop Edition 2000 (MSDE) server. I’m assuming these instructions will work for other versions as well.

Download MSDE2000

You can download the 42MB MSDE 2000 Release A file from here:

http://www.microsoft.com/downloads/details.aspx?FamilyID=413744D1-A0BC-479F-BAFA-E4B278EB9147&displaylang=en

Install MSDE2000

If you run the file you saved it will ask you to choose a folder to extract the setup files to. Please select a folder, or just click next. The files will unpack.

Open a command prompt from Start ->All Programs -> Accessories -> Command Prompt

It will show you something like this:

Microsoft Windows XP [Version 5.1]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\username>

Type the following in and press enter:

C:\Documents and Settings\username> cd C:\the\folder\you\extracted\your\files\to\goes\here
C:\the\folder\i\extracted\my\files\to> setup.exe SAPWD=YOUR_PASSWORD_GOES_HERE
This is the type of window that should show next
This is the type of window that should show next

Setup will commence, and you should have your server installed.

Graphical Administration Tool

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=c039a798-c57a-419e-acbc-2a332cb7f959

I tried this, but couldn’t get it to work. I wasn’t using IIS. Good luck.

Command Line Administration using OSQL

OK back to basics. osql.exe is in this folder:

%ProgramFiles%\Microsoft SQL Server\80\Tools\Binn\

By default this is:

C:\Program Files\Microsoft SQL Server\80\Tools\Binn\

Open a command prompt and cd into that directory:

C:\SQL Server\80\Tools\Binn\>osql /?
usage: osql              [-U login id]          [-P password]
etc

Read the stuff that it prints out here.

The -E’ switch means trusted connection, so we’ll use that to login

C:\SQL Server\80\Tools\Binn\>osql -E

1> sp_help
1> go

A whole load of text will fly by. This is the output of the sp_help command. As you see, you use ‘go’ to execute the commands you type in at the prompt.

Attaching the MDF/LDF Files:

To view your MDF/LDF files  you need to attach the database files to the server. The commands are as follows:

1>EXEC sp_attach_db @dbname = N'CHOOSE_DATABASE_NAME_AND_TYPE_IT_HERE',
1>   @filename1 = N'C:\YOUR_FILE.mdf',
1>   @filename2 = N'C:\YOUR_FILE.ldf'
1>go

To view info on the databases currently attached, you can use these commands:

1>select * from sysdatabases
1>go
1>select * from INFORMATION_SCHEMA.TABLES
1>go

You can now use SQL statements as follows:

1>USE YOUR_DATABASE_NAME
1>select * from YOUR_TABLE_NAME
1>go

If you want to output the result of your SQL query in a file use:

C:\...\Binn>osql /E /d YOUR_DB_NAME /Q "select * from YOUR_TABLE_NAME" -o outputfile.txt

If you want to do it using a host/username/password to login:

C:\...\Binn>osql /U sa /P YOUR_PASSWORD /d YOUR_DB_NAME /S your.server.name.or.ip.address /Q "select * from YOUR_TABLE" -o outputfile.txt

Some more useful commands:

1>sp_helpdb mydb
1>go

1>EXEC sp_grantlogin ‘Test’
1>EXEC sp_grantdbaccess ‘Test’, ‘database_name’
1>EXEC sp_addlogin ‘test’,’hello’
1>EXEC sp_password ‘OLDPASS’, ‘NEWPASS’,’Test’

Have fun.

Microsoft .NET Framework 3.0 SP1 error 2711

Whilst installing .NET framework 3.0 Service Pack 1, I accidentally pulled the power cord on the laptop. When I started up again, it kept giving me the 2711 error message.

Cleaning the temporary file folders didn’t solve this. The answer was stowed away on a forum found via google:

  • Go into Start Menu -> Control Panel -> Add/Remove programs
  • Find the  ‘.NET framework 3.0’ entry and click the ‘change‘ button
  • The setup will run, you should select the repair option.
  • Once that completes, you can rerun the SP1 setup and it should work fine.

Zombie laptop

Lesson of the day: Some laptops don’t spin up CPU fans or switch on the screen when powering up

So I had a laptop which stopped working for apparently no reason. None of the lights came on except for the charger light when the battery & charger were connected. The power button didn’t do anything.

I assumed it was dead because the CPU fan wasn’t spinning up when pressing the power button (like in desktop computers.) I tried opening the laptop up, removing and connecting everything up outside of the case, which then got it working (second time around) The CPU fan still doesn’t spin up at boot time, so it’s pretty hard to troubleshoot the issue.

Basic Checks

Something you can try first is to find the documentation for your laptop/notebook. Go online and find the manuals for your machine. Try to find the service manual as well. This can be very useful.

First of all, check your battery. If you’re lucky and you have a friend/neighbour who has the same kind of laptop, you can test your battery with their machine. Otherwise, get hold of a multimeter and check out the voltages and currents coming out of the battery terminals. Sometimes (for example on an IBM Thinkpad) the expected voltages/currents are written in the service manual. This way, you can tell if the battery is dead or not. If your battery isn’t dead, it should allow you to start the laptop, even if the charger is having problems.

Check your charger. Again, if you have a friend/neighbour with the same machine, ask them to test the charger. It’s possible, but not very safe to check if you’re getting any voltages/currents out of the charger terminals with a multimeter, just to see if it’s supplying any power or not. Check if the fuse has blown on the charger’s plug.

Sometimes your charger is fine, but the charger connector on the laptop is messed up. In this case, you’ll have to wiggle the wire around, and hold it until the charging light shows. Make sure the battery is plugged in when you do this, otherwise the charging light wont show at all. Sometimes, a bit of pressure upwards/downwards or sideways does the trick and gets your charging light showing again.

If you are sure your battery isn’t dead, your battery holds charge, and/or your charger is working, then you can try the power button. Try holding it down for a couple of seconds, and wait around 10 seconds to see if it’s having any effect.

If your power button isn’t helping, you can try reseating the RAM module. You should consult your manual (or google) on how to do this.

If re-seating RAM doesn’t help, try removing and reinserting the hard drive.

You may have a problem with the graphics card/display. Some machines overheat after long periods and this screws up some of the parts which get hot, such as the graphics chip.

Surgery

Your laptop isn’t worth spending a lot of money on to have it repaired? Take it apart and have a closer look. You’ll need a service manual to do this the first time, because some of the screws and tabs and stuff are hard to spot, but you can get the thing open without it if you try hard or google. Keep a log of the order in which you take out screws, and keep each group of screws seperate. For example, I’d write,

Step 1: remove 3 screws securing keyboard to top of case, and then place them together

This way it makes it alot easier to put it back together, you just follow the steps backwards. Don’t lose/mix up the screws, you won’t remember which ones go where. Trust me.

Having a working battery and charger is useful when you’ve opened up the laptop, and want to check if the board is fried or not, by checking the lights on the laptop.

This one time..

I just took the whole laptop apart, out of the casing and connected up the battery and charger. This is quite a dangerous thing to do. It can easily short out and fry the board/components or give you an electric shock.

I was getting an orange charger light if I pushed the charger cable down in the charger socket. The charger port was dodgy and needed replacing.
There was a green light with a plug icon above it which flickered green when I applied power. When I tried the power button, I got nothing.

When I took it apart, there was a small daughter board attached to the motherboard, which I’ll call the power board, into which the charger went. This board was connected to the main mother board via a connector with about 20-40 golden pins.On my machine this was the problem. When this power board was connected, and held up at an angle, and the charger cable pushed down, I began getting a green power light.

At this point I connected the hard drive, RAM and keyboard, and the hard drive began whirring.

Once it worked, I put the machine back together.

Horrible Problems with nVidia Geforce Drivers and Vista x64

Aaaargh! That’s how you feel when you install nVidia Geforce drivers for your brand new card and suddenly your display goes blank!!

Hint: If you have more than one display connected to your card, try plugging one display first then add and configure the rest.

Hint: Try using a VGA cable. This works for some people.

Hint: This will take a few hours to resolve

That didn’t help? You can sort it out by logging in from another computer using RealVNC. From the remote computer, you select your monitor as the ‘primary display’, and choose a compatible resolution so your display shows up OK.

You can also login to windows vista from another computer using Windows Remote Desktop. This didn’t work for me, because it didn’t let me change the graphics settings from another computer. VNC works slightly differently, so it works well when trying to fix this problem.

The Problem

So you buy a graphics card, PCI Express, nVidia Geforce 8 Series (8400GS in this case) connect it up using a DVI/VGA cable to an LCD display (mines a Fujitsu-Siemens). You have Windows Vista x64 (I tried Business Edition). You’ve installed all the windows updates.

You come round to installing the graphics driver, so you put the driver CD in (or you get the latest version from the website) and install. It asks you to restart. The system loads, you see the the login screen loading at a nice resolution (so the driver’s working). You login, you see the welcome screen and then… BOOM. ‘No Signal Input’. The green LED turns orange, and your screen turns off. What??

Background

This problem seems to be quite old. One suggestion is to use a VGA cable, but this doesn’t work for everyone. One explanation offered by some of the forums is that the nVidia drivers can’t read the EDID data held in the monitor. This EDID stuff tells the card what resolutions, refresh rates, colours etc. the monitor supports, so you don’t accidentally set the wrong options and fry your shiny new screen. If you’re monitor doesn’t have this data, or the card can’t read it, you might be getting the black screen problems.

You can view your monitor data using ViewSonics EDID tool. If you look at your screens EDID data and everything is fine, you must be wondering why your screen is still not working?

In my situation, my graphics driver settings were the problem. The card was saying I had a TV connected as the primary display instead of an LCD. Stupid machine.

Things To Try

I restarted the computer, pressed F8 after the BIOS screen, and chose safe mode. I downloaded guru3ds driver sweeper and the latest drivers from the website of the guys who packaged and sold my graphics card (a subvendor called Gigabyte). I ran driver sweeper, and cleared out the nVidia drivers. I restarted, installed the updated drivers and restarted.

If you get a black screen after doing this, try a different cable (ie from VGA to DVI or vice versa) then try a different monitor (if you have one).

If you still get a black screen, reboot into Safe mode, run driver sweeper, reboot into normal mode.

If you still get a black screen?? Read on…

Fixing the Problem with VNC

Note: Step 4 has instructions for Windows Vista – please Google instructions for other versions of Windows

  1. Start in safe mode so you can use your monitor, and remove the nVidia drivers using the guru3d driver sweeper.
  2. Restart into normal mode, then download and install RealVNC. If RealVNC has trouble starting as a service (you get an error message when you try to login ‘connection closed unexpectedly’) unregister the service (from the start menu, all programs, realvnc, unregister as a service) and run it in user mode.
  3. Right click the green V icon in the system tray and choose options. Configure RealVNC to authenticate using a password, and make one up.
  4. Setup your windows firewall to allow VNC through. If you see a dialog asking if you want to allow this program through the firewall choose yes. If you don’t see the dialog, you can do this from the Control Panel -> network connections & sharing option, click the windows firewall link at the bottom left of the window. Then choose allow a program through the firewall in the left hand menu of the new window, and choose add program, browse to the vnc folder, choose winvnc.exe and set the scope to your local subnet (usually 192.168.0.*).
  5. Set RealVNC to start up in user mode every time you log in. Do this by copying the shortcut for starting the server in user mode from the start menu->all programs->realvnc to the startup folder for ‘all users’. To do this, right click on start->all programs->startup folder, from the menu choose open all users, and paste the shortcut into there.
  6. Remove all user accounts from the system, except for the administrative account you use to install drivers. See step 8 to understand why.
  7. Install the latest nVidia drivers and restart the computer when it asks you.
  8. The computer loads up. If you see the login screen, login, and wait for the display to go blank. If the screen is already blank at the login screen, just type in your password and hit enter. This works because you only have one account installed. Vista should be logging you in even though you can’t see anything.
  9. Once you’re logged in, VNC should have started up. This means you can connect from another computer. Connect to the VNC server from another machine in your network using the vncviewer software and login using the password you selected before.
  10. You should now be able to see the desktop. Right click on the desktop and choose nVidia Control Panel. Run through the wizard, select a compatible resolution and click ok. In the nVidia control panel, there is a menu on the left, choose the option ‘manage multiple displays’. On my computer it was detecting the screen as a TV. I chose to display the same image on two displays (clone) and then selected P17 + TV in the drop down list (my monitor was called P17.) I Chose my P17 monitor as the primary display. I then Clicked apply, clicked OK to keep the new settings. And the flat screen started working correctly.

Notes:

If you install the latest RealVNC Enterprise/Personal Edition trial, it may be more compatible with Windows Vista and above. If you do this, it will register and run as a service. This means you don’t have to delete all your accounts in step 6 and try to login without seeing anything in step 8. I’ve not tried this though, so someone try this out and see if it works.

Comments welcome!

Building Your Own Computer and Fixing The Problems

You might fancy putting together your next desktop computer instead of buying it off the shelf. Here’s some (useful?) advice to help you along the way.

Why Build Your Own?

These days even the big manufacturers can build you a computer tailored to your needs. In fact, companies like DELL have

  • competitive prices
  • plug and play, ready to go, they can even set it up for you
  • you get support when things go wrong
  • you can purchase a guarantee in case you have an accident/theft

Those are the advantages of buying new, what about building yourself? Here are my personal favourites:

  1. Getting packages delivered in the post
  2. You don’t have to wait on hold on the phone when things go wrong, instead you get to fix it yourself

What You’ll Need

You’ll need to buy the components and put them all together. I like to shop at Scan Computers, for good prices and great service.

When buying components you need to do your homework to get a good deal. Find out what’s hot and what’s not using websites like tom’s hardware. Also check out the specs, reviews, customer feedback, buying guides, and price comparisons before parting with your hard earned cash.

The essential components you need are:

  1. Motherboard: Buy a good motherboard that supports the best CPU, RAM speeds in your budget. Motherboards may have network cards, sound cards, and even graphics cards built in to them. Check to see exactly what you’re getting, you don’t want to go back to buy missing parts.
  2. CPU: Buy the best you can afford. You can buy retail boxes with CPU fans in them or buy the CPU fan separately. You need good cooling on your CPU to stop it overheating and getting damaged. Intel or AMD? AMD are cheaper, some say intels run cooler/faster. You’ll need to research the chips you can afford and make a choice.
  3. RAM: If a CPU is like a person cooking in the kitchen. The RAM is like the worktop. You need plenty of space to cut and chop and mix and whisk etc. So get plenty of RAM, especially when it’s cheap eg 1GB-4GB. 2GB is recommended for vista apparently
  4. Graphics Card: You need one to connect a monitor to the base unit. You can buy a motherboard with a graphics chip built in (it’ll say something like ‘onboard vga’), in which case you don’t have to buy a separate (usually more expensive) card. New cards come out all the time, so get the best card you can afford. If you’re into games and stuff, you might look for an SLI capable motherboard, and buy two cards, which work together for better performance.
  5. Hard Disk Drive: This is your permanent storage. Depending on what you plan to do on your PC, you can easily fill around 60GB to 250GB of HDD space. Buy as big as you can. 40GB minimum.
  6. Wireless Networking Card: To connect to your WiFi network
  7. Optical Disc Drive: To use CDs, DVDs, BluRay discs. Try a DVD-RW drive so you can write to DVD discs as well, so you can make data backups etc.
  8. Case: A good case to put it all in. You can buy cases with power supplies already in them, or you can buy the two separate. You’d generally go for a 450W or above power supply. You should also look out for front panel USB/speaker connectors on your case, so you’re not reaching round the back to plug things in all the time.
  9. Cooling: You’ll need a fan on your CPU, a fan attached to your case to draw air into the case, optionally, a fan to blow more air directly onto the CPU, and an optional fan to extract air out through the front of the case.

 

Putting It Together

Get an antistatic wrist strap. You can get away withouth one, but it’s better to be safe than sorry. You should touch a grounded surface before you start, to discharge any static electricity.

I like to insert the CPU & RAM into the motherboard before attaching the board to the case. Just be careful of the board when you attach it, because it can be chunky, and heavy.

You’ll need open your case, and find the screws that come with it. Sometimes the pack of screws gets stuck in some corner, so look for it properly. You have to attach the motherboard to the case. The motherboard musn’t be in contact with the case though, as the case is grounded, so if it touches, it’ll short out the board and probably screw your system up. Your motherboard manual should show you how to attach the motherboard, if it doesn’t google for a guide.

Attach your graphics card next, unless it’s onboard. Once the graphics card is connected, connect the cables coming out of the front of the case for your Motherboard Power, PC speaker, Hard Disk Drive Usage Light, Power Switch and Reset Switch to the motherboard. There should be some help in your motherboard manual telling you where to connect what. The cables should be labelled positive, ground etc. so make sure they’re in connected right way around.

Booting Up

Connect a PS2 keyboard up. Sometimes the USB ones don’t work with the BIOS the first time. You can go into your BIOS settings by pressing F2/delete keys on your PS2 keyboard and enabling an option usually called ‘legacy usb support’.

Connect a mouse, monitor and a power supply. See if it starts up, and you get your BIOS screen (usually a logo, and black screens with your PC specs). If not, wait a couple of seconds, sometimes things might take a couple of seconds to show on screen. If you’re still not seeing anything on the monitor, continue to troubleshooting.

If on the other hand you’re system boots, attach a Hard Disk Drive, Floppy and Optical Drives and boot the system again. If it starts again, you can proceed to install windows.

Next install the drivers for your motherboard chipset, graphics card etc. from the CDs you get with the boards.

If all goes well, install the latest windows updates to your system such as the service packs, .NET frameworks etc.

If all is still going well, visit your motherboard/graphics card/etc. manufacturers’ websites and download the latest updates. I don’t recommend flashing the BIOS unless you’re having problems. I wouldn’t even update the drivers unless theres a good reason for it, eg security update, performance increase etc. This is because, sometimes you have to think about the saying ‘if it ain’t broke, don’t fix it’. In other words, new drivers can bring new problems. Especially the driver updates suggested by windows update.

You’re all setup with windows now so you can go ahead and install your own software.

Troubleshooting

Assuming you’ve hooked up the graphics card, and your system isn’t booting:

The first thing to ask is this: are all the cables connected properly?

Is the power switched on, and connected? Is the monitor  switched on & connected?

Is the power cable coming out of the PSU connected to the motherboard? Sometimes there is a separate 12v connectors which you may have missed.

Is the power switch cable connected properly? Sometimes it’s hard to get it onto the pins, or it might not be the right way round.

Do you have all the right components? Is your RAM/CPU the right compatible with the motherboard?

Are you getting error lights/beeps/codes? Check these in your manual.

Is the RAM seated properly?

At this point, you could take out the graphics card and test it in a separate system. If it’s working fine, re-insert it into the motherboard. If you can’t test it elsewhere, try reseating it anyway.

Re-seat the CPU. Take it out and put it back in carefully.

Re-seat the CPU Fan. If the fan is loose, you’re system might start, then cut out. You can usually check the CPU/motherboard temperature in the bios (to see if the CPU fan is working/connected). Some fans need to be attached quite firmly so you might need to get it on tighter.

You’re system should be booting by now. If it isn’t try searching for your problem online. Usually other people will have already asked the same question on a forum somewhere. You just have to search for the right words, and read loadsa silly posts, totally unrelated to what you want, until you hit gold.

Problems Installing Windows

Sometimes your computer boots but you get other wierd problems. For example, your computer boots, but your display doesn’t turn on if you restart the computer. Or windows won’t install properly, eg setup begins but you get unexpected read errors (like hard drive read/write errors) which make the setup fail.

Most of the time this is to do with your CPU clock speed. You need to go into your BIOS (F2 or delete on startup) and set your CPU clock speed manually to a lower setting. Be careful when making these kind of changes, check your manual to make sure you’re settings are compatible with your components.

Rarely: You get windows installed, but it starts crashing etc. This may be solved by updating your hardware drivers. If this doesn’t help, try updating the motherboard BIOS.

If you screw up when updating the bios (eg you accidentally hit the standby button on you’re keyboard) you’re system can stop booting. This is when you dig out the manual and carefully follow the instructions. In most instances you can fix the problem no matter how serious and scary it looks.