Thursday, August 25, 2011

Setting up Motion for Fedora 13


Here's a quick and dirty for getting Motion setup with an old AipTek Pen Cam on Fedora 13.

Don't use the RPM, install from source:

Go here: http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome and download latest version.

Then:

cd /usr/local


tar -xvzf /path/to/motion-3.2.x.tar.gz


cd motion-3.2.x


sed -ie 's/ret = 2/ret = 0/g' video_common.c


./configure


make


make install


cp /usr/local/etc/motion-dist.conf /usr/local/etc/motion.conf


vi motion.conf

Look for webcam_localhost and change it to: off

save motion.conf

motion -n (to run in non daemon mode to test)

Use your web browser locally first and check http://yourip:8081

You should now see live stream of your video.

kill motion (Ctrl-C)

Run it again in daemon mode and test again.

Thursday, March 24, 2011

Error 500 After Migrating From IIS6 to IIS7

I was getting an error 500 after migrating from IIS6 to IIS7 using "msdeploy". I couldn't figure out why for a while. Database was OK, proper app pool for ASP was there, and all was referencing each other OK, or so I thought.

The key was to get a better handle on the error. Testing externally I kept getting the generic 500 error. I tried adjusting how the error is shown under ASP for IIS7, but this didn't work.

I read on Experts Exchange to add IUSR to the security of the site and allow it view, read, and write. This didn't work either and I had to revert back.

After further reading, I saw that if I test from the browser locally on the server hosting the site, I should get a better error. BINGO!

Now I get: http error 500.22 0x80070032

This can be due to attributes in web.config being invalid (apparently security and other things were changed in IIS7, so certain attributes will BREAK when carried over from IIS6 to IIS7). Fret not! You don't have to manually go through and change things to get it to work. You can use an application to do that for you. :)

Here's a link that sums up how to do this nicely: http://www.prolificnotion.co.uk/use-appcmd-to-migrate-web-config-from-iis6-to-iis7/

For those who don't want to click, here it is below:

Run this to get the site identifier from your troubled site:

%systemroot%\system32\inetsrv\APPCMD list sites

This will dump info about your sites, you want to look for whatever is in between quotes (the identifier).


Ex.
SITE "MyMostAwesomeSite" (id:2,bindings:http/*:82,state,Stopped)


So in this case the site identifier is MyMostAwesomeSite.

The next step is to run the command that fixes the attributes in web.config:

%systemroot%\system32\inetsrv\APPCMD migrate config "MyMostAwesomeSite/"

If all goes well, you'll get the following response:


Successfully migrated section "system.web/httpModules"

Successfully migrated section "system.web/httpHandlers"


That's it! Test, and hopefully all is back to normal again.

Changing Drive Letter with MSDeploy

I've been doing a lot of migrations from IIS6 to IIS7 recently. This is a handy way of changing the drive letter when using Microsoft Web Deploy to import a site into IIS, say from drive C:\ to D:\

A Full Command Changing the Source Directory of the Archive "msdeploy-site" From "C:\" to "D:\":

Note: That there are no carriage returns, it's one long string.

C:\Program Files\IIS\Microsoft Web Deploy>msdeploy -verb:sync -source:archivedir=D:\msdeploy-site -dest:metakey=lm/w3svc/1863507787 -replace:objectName="metaProperty",scopeAttributeName="name",scopeAttributeValue="Path",targetAttributeName="value",match="c:",replace="d:"

The "replace" here looks for "c:" and changes it to "d:", which will now put the archive under d: when it was originally on c: on the source server.

Excerpt of the relevant part of the command:
-replace:objectName="metaProperty",scopeAttributeName="name",scopeAttributeValue="Path",targetAttributeName="value",match="c:",replace="d:"

Just change the drive letters of "match" with the original drive from the source server and "replace" with the destination drive on the new server.

Now, let's say you wanted to test this command before you ran it. Well then you do this:

C:\Program Files\IIS\Microsoft Web Deploy>msdeploy -verb:sync -source:archivedir=D:\msdeploy-site -dest:metakey=lm/w3svc/1863507787 -replace:objectName="metaProperty",scopeAttributeName="name",scopeAttributeValue="Path",targetAttributeName="value",match="c:",replace="d:" -verbose -whatif

The "-verbose -whatif" will run the command as a test in verbose mode in the command prompt and let you know if there are any issues it runs into and allow you to confirm that the drive letter destination is correct. You can also output this to a file using " > output.txt"

Let me know how this works out for you.