Rummage through this blog

Sunday, 20 December 2009

Finally....

I think the HTPC is ready to go! Finally. It's been a long road, largely because I like fiddling and want everything just right. I've worked my way through Vista, XP and onto Windows 7. Now it all works. It is not perfect (for instance, Media Browser is rather slow to start, I could fix that with a ramdisk but that just adds complexity to the solution hence more things to fail) but it is usable by normal people.

Finally have all my move information up to date, Mediabrowser is a great product and when coupled with Media Center Master to get movie information works well. Incidentally, I installed the latter on a different machine so I can control updates and avoid extra software on the media centre machine.

Happy? No, now I want to put it into a smaller box (disappointingly the dual core atoms are still a little lacking and I would already need to have two 640Gb laptop drives so getting costly and limiting on hardware). I also want a mini wireless keyboard with built in mouse / trackball but don't want to pay £30 for one - I'll test the remote more and see how we get on without.

Thursday, 17 December 2009

HTPC

Finally, after, shall we say an extended period, I got around to attaching my home theatre pc to the television downstairs. The TV is an old CRT so I didn't hold out much hope but to my amazement I have a picture where the Windows 7 Media Center text is readable (I've connected up using a VGA to RGB / s-video converter off of ebay).

The sound works fine through the TV although a little quiet via the stereo, however, time to try the toslink optical cable. Er, yes, a little louder, I could see the cones moving through the mesh on the speakrs, certainly the loudest they've ever handled. Ouch.

So all in all a resounding success.

Just one more job, putting the HTPC into the TV cabinet.

Oh dear, when I measured the cabinet it was big enough for the HTPC case (a silverstone gd01). I forgot hinges! Doh.

Saturday, 5 December 2009

One of those days

We went to see Alex at Stagecoach today - every term there is a session where the children how off the things they have learned & how he grinned. I filmed almost all of it on my Panasonic DMC-TZ5 in HD format. The camera did give me a warning that it had to stop recording because the Sd card couldn't keep up. So imagine my disappointment in discovering that the whole card is corrupt!

But some good news. I purchased Photo Rescue (v 2.1) just over 4 years ago & still had a copy on hand. It works perfectly, churned away at the SD card for about 30 minutes, fully automatic, spot on.

Wednesday, 11 November 2009

More Woes

There is plenty on the net talking about how insomniac Windows 7 is - it wakes up for everything. That's generally pretty easy to resolve, open up task scheduler and edit all the tasks (30 mins if you can keep focus on the excitement).

However, one task is missing from the scheduled jobs & that is Windows update. I've had it confirmed by a Microsoft person that automatic updates will wake the PC if it is asleep to download updates. Personally, I find that really annoying & it should be a setting on the automatic updates page, however, we are where we are. I searched high & low throught scheduled tasks to discover, unless it is hiding under a cunningly disguised name, Windows update is not a scheduled task.

But clearly it is scheduled. Aha, it's hiding, right here : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update

I am still trying to find out if it is possible to only do updates if already awake (automatically, I don't need the hassle of having to press a button for myself) but a more important issue raises itself - what other Microsoft (& other less dodgy stuff like trojans & viruses) makes use of "hidden" scheduled tasks?

Big brother probably is watching  incidentally did you hear the news that the UK government is going to store all of our web activity soon?. Sitting comfortably?

Sunday, 8 November 2009

Windows 7, less impressed

Well my Windows 7 installation is completed. Just a bit more tinkering required - primarily I wanted to get My Movies installed but I seem to have fallen foul of some issues & I'm not the only one it seems.

Firstly, it seems at random that the live tv fails - well, that is where I first noticed it but on further testing it seems that live tv, recorded tv and movies all have an occasional problem where they just spend forever trying to load or do load and then stutter or just show a black screen. A reboot seems to clear the problem but I had to start fiddling when the problem happened immediately after boot up for the firs time.

The behaviour is reminiscent of codec problems but I'm using the new Media Foundation, Divx (to handle MKV & DIVX) and PowerDVD. The oddity is that if this really were a codec issue surely it would be everytime? A check with filmerit reveals problems with quicktime files but that clearly isn't the problem because they play fine. A longer check with gspot reveals a problem with PowerDVD (version 8 something) but uninstall only makes more of a mess of the codecs - they are still registered but clearly not accessible. Testing some files reveals that the missing codecs have made no difference whatsoever & gspot confirms the problem exists even with mpeg 1 files created when recording tv. Not sure how to progress this one but there are other problems which this has revealed......

It seems that after a movie has finished playing the system keeps the file locked & hence never allows sleep mode to happen automatically - you can press sleep (menu or remote) and that works and sorts the issue out, it is just the automation dies. While on the sleep subject, I changed the scheduled tasks to stop Windows waking up for every event microsoft could think of (goto scheduled tasks & check / edit each one - you will find most are running far more frequently than you need and if they are set to be stopped if they run for too long, too long is considered to be 3 days so you might want to change that too).

Not sure if this behaviour happens for music because it is at that point that I broke my install and have had to start the reinstall - that's pretty disappointing because I had also found that no matter what I did I could not get windows to acknowledge the 2nd partition with a duplicate copy of the first on it - my XP install had this arrangement so if the first got corrupted I could just copy the second  back, as opposed to mirroring where the corruption gets copied too, but Windows 7 just ignores it's own settings. So, I broke the install by flagging both partitions as active - you don't want to do that! At least I now get to rethink my install sequence and make backups as I go along.

I've found a new problem during the reinstall. Windows has some nasty files it hides (bootmgr being the one in my mind now as it caused the reinstall) during install, so when I installed on my 2nd drive and removed the first on reboot, sure enough it seems that nasty files are stored on the first disk.

While the install works itself through, I will mention My Movies, this is a smart product to include decent pictures & movie information into WMC. It works nicely but the user interface is hardly intuitive (the "let's find what movies you've got" isn't the first option or even presented in a Wizard) and it has 3 other huge problems. Ffirstly, it constantly reindexes the files it already has recorded which meant I kept getting messages like "5 new files added" which you have to manually ok. Secondly, series are very messy (they are in Movies too). FInally, the worst issue is that the movies I found information from the online service where I had an ISO file (.ISO image of the original - ie the ones I own) would insist on loading the file exactly as labelled on the original disk - so if you didn't have precisely the same version as the person who uploaded the information in the first place it became worthless & would ask you to put the CD in. I can see why this is but I would have thought the sensible code would allow you to run whatever file it finds in the given directory then users can choose (and rename files to something meaningful in some cases).

Better finish fixing Windows 7 now. Wish me luck and the memory to avoid that Realtek 8139 driver update on Windows update that kills the device.....

Sunday, 1 November 2009

Media Center on Vista

I'm almost "finished" configuring my shiny new Windows 7 install for HTPC use & this will feature Windows 7's Media Center product. In a fit of enthusiasm I thought I would have a look at MCE on my Vista laptop to see if I could make use of it & hence remove MediaPortal to reduce the amount of installed software.

All started well, the interface, although largely the same is subtly different & I'm left wondering why my videos are hiding under the pictures section rather than TV & Movies. Unfortunately what I've now discovered is the Vista's MCE is pants. For starters the codecs installed on my laptop are solidly ignored so none of my home videos open (not the .avi ones, not the .mov ones & not the .mp4 ones) and what is worse is when I point the library at my movies it causes MCE to crash. Of course, Microsoft have been helpful in that it tries to restart but unsurprisingly, having crashed one, it crashes again, and restarts, and crashes again. No, that is not fair, it crashes just the once and gives up, sometimes I get taken to a Microshaft page which says I should check for updates (done & there aren't any - surely the software could check before offering the option?) and asks me if the information was helpful.

My conclusion on Windows Media Center on Vista? Well, can you imagine how much fun I had repeatedly explaining why the information offered was not helpful, oh yes and then some but I bet no one reads it as the online answers to "I have a Vista problem" now seem to be "why are you still using Vista?".

Monday, 26 October 2009

Windows 7, it's here

Well, launch day for Windows 7 was 22 October 2009 & I can see that my copy (yes, I have purchased a legitimate copy of Windows 7 Professional) was posted in time to arrive on the launch day.
Sure enough I arrived home to find the package in my house on the day of launch - I'm pretty impressed that the release was co-ordinated well enough to deliver on the release day. Happy so far.

So, what shall I do with it? Well, first try is an old 80Gb SATA (that's SATA not SATA II) drive in my htpc. Boot off DVD, 20 mins of churning and it's there. Impresed twice now, no having to manually reboot several time, good progress info but nothing on screen saying "your install will complete in 28 minutes" for 2 hours. Nice.

Does it work though. Well, yes. My sound card & wireless card have not been picked up but everything else is functional, even the graphics card gets a driver first time out.

Installing the wireless card proves a trial - largely because I've forgotten a trick - I have a netgear WPN111 and the smartwizard makes light work of installation unless you cancel it the first time, oops, yes I did just that & now it opens & closes and does nothing else. So I have to rely on the built in Windows wireless config - so after half a dozen reboots and having to enter the same information repeatedly the settings finally stick. There must be an easier way of getting wireless config sorted but it's certainly not unique to Windows 7. Luckily the sound card installs no problems.

It's only then that I remember to check for driver updates from the motherboard manufacturer (I'm using a Gigabyte GA-MA78GPM-DS2H which in theory is a great board but was dropped pretty quickly, probably because Gigabyte got sick of me raising queries about why their BIOS randomly forgets or ignores settings). To my surprise there are some updates so they get loaded on too. No problems so far. Still impressed.

Windows Update is busily doing it's thing & is painless.

Boot times are acceptable especially given that boot times on Vista were measured in geological ages & I've got an old SATA drive in use (which I later discover has a problem and occasionally decides to have a rest) & is certainly on a par with XP Professional which my HTPC install has been using.

Sleep mode is something else. I have no idea why but XP sleep always goes via the BIOS loading screens first whilst Windows 7 sleep goes direct from pressing the power button to the login screen, massive restart saving. I'm happy with that especially having recently discovered that this machine uses 4.1 watts in sleep, 3.8 in standby and 3.8 turned off - that was a surprise that my machine is off but it's using the same level of power as hibernate whilst sleep uses an irrelevant amount more considering the benefit. A bit of research (with my friend google) discovers that the PSU always takes power to enable facilities such as WOL (wake on lan - that nice idea that doesn't work with wireless cards for some reason). I use a UPS so having the machine in sleep mode is pretty safe.

I've changed the config to log me straight into the desktop (security freaks please run screaming around the room now) - much more practical for a HTPC which the wife might try to use that having a password on a box that might not have a keyboard attach. Going straight to desktop is a little weird in Windows 7 because it does a lot of loading of services and whatnot after login to reduce start time so sometimes it does loads of disk churning before showing the desktop when bypassing the password which would ordinarily not show while you peck away at the keyboard.

Why am I installing Windows 7 on my HTPC? I've spent something like a year (or is it two?) trying to get a "perfect" setup or at least something that I can live with. I don't have Media Centre on XP but I do on Vista and it's rubbish, it's can't play HD, it can't do this, it can't do that and it doesn't play this format or that one etc Yuk Yuk Yuk. So I've tested all the freely available media centre products I could lay my hands on and iMedian which came with my Silverstone GD01 (great case, far too big but I have a passive CPU cooler & only using one of the internal fans with the guard removed so pretty quiet). iMedian was probably a student's final year project to demonstrate how to make a difficult to use system. The best product out there is MediaPortal. It has everything and does everything but takes quite a lot of configuration and has endless options. Great product and fully working but just when I'm happy the next version appears with no upgrade path.......and Windows 7 is coming so let's wait and try MediaPortal on Windows 7 for a kicks.

If you are still reading you will be interested to know that I started typing this as soon as I commenced a reinstall on my machine using a Hitatchi 1TB SATA II drive & I've got this far and Windows 7 is sitting at the desktop ready to use with me having only had to configure half a dozen simple steps the hardest of which was rekeying the product key - so install time < 30 minutes. A reinstall already surely not? Yes, I've spent a few hours this weekend and two solid evenings tinkering with Windows 7 and I'm happy that it works, all my questions answered and it's stable. All files formats I need work (I've had to use Divx Converter to convert my MKV files to DIVX but that was no big deal).

Windows 7 is awesome - Microsoft you have got it right, well done, I think I'm going to add this to the list of Microsoft successes (the other two are Visio and SQL Server so it seems to me that this is the first one that Microsoft have actually developed for themselves).

So what's converted me. Well Windows 7 installs easily. Everything I have tried works. Unlike on Vista, file operations happen in the near future - I don't think they are as good as XP was still and certainly pathetic compared to Linux but not painful. Sleep is great and happens when expected, I've had one hiccup on resume but that hasn't repeated since the piles of updates have been downloaded.

Windows Media Centre for Windows 7 is excellent, it picked up my TV card (hauppage wintv-hvr-3000) with no problems, loaded up the satellite channels, gives me a TV guide. Adding My Movies makes movies a pleasure to access and adding Divx resolves the only file format problem I encountered. TV recording within 5 minutes of original install. My iMon remote and front panel work perfectly too which is miles better than I every managed with MediaPortal.

All in all Windows 7 is very impressive and is going into service tonight.

Tuesday, 20 October 2009

Taking one's life into one's hands

I have not made much effort to make "social comment" as such but today I thought a gripe was due.

Last night I cycled between Wivelsfield Green and Burgess Hill. It is dark out there, really dark, virtually no street lights, not a whole lot of traffic and just bike lights. To add to the collection my rucksack has reflective strips on the straps.

Clearly, I am not going to be as visible as a car but hardly invisible so why is it that some drivers persist in driving at you with full beam on. Do they thing that whilst it might blind another driver it won't blind a cyclist? Is it just because a cyclist cannot retaliate with his own full beam. Oh no, my suspicion is that both inconsiderate and stupid drivers are out there at night as well as during the day.

Well I feel better for that so if you are one of those drivers, please try thinking about what you are doing.

Friday, 16 October 2009

Abstract Rose


Here is a second version of my earlier abstract rose picture - this again was taken with a Fuji S602 zoom and is off a rose which was growing in the garden of my last house and was taken using natural light coming in through the patio doors.

Wednesday, 14 October 2009

Alex's Fourth Birthday

Alex's 4th birthday has come and gone - we had a party with a horde of 3 to 5 year olds on Sunday where the rampaged around the house in packs creating havoc for a few hours, we didn't need to organise anything, just let them run wild, huge success. The party food is worth a note - Alex had some cocktail sausages, well, Alex had most of the cocktail sausages and nothing else, just a big plate of sausages. Clyde had some tuna sandwiches, shame he can't do the plate thing yet.

Tuesday was the birthday day complete with a trip to the Brighton Sea Life Centre by train. A fantastic time had by all, even feeding the big turtle and having a trip to Nandos on the way home. I took Alex and Ewan on the train home and they did yet more playing and present opening on arrival of grand parents with Ewan staying overnight.

Now I need a rest.

Sunday, 4 October 2009

Sunday

Woken up early by an all too sprightly Alex who wants to play with me - in fact he's built his hot wheels track and to show me attached it to a tape measure and towed the whole lot into the bedroom, obviously only waking me up in the process.

I think he's on something, after breakfast there is lots of bouncing around the lounge and making a car out of my carrymat (why it has become a car I don't know), unfortunately the mind your drink (pineapple juice) warning failed as somehow the car managed to shoot him out of its window (?), off of the settee, across the nest of tables and into a heap on the floor, along with said drink soaking him and everything else in the process. Lovely aroma of pineapple wafting around the lounge now.

Then we went swimming, had to purchase some new goggles because the plastic between the lenses had broken on his original Speedo ones but the new Zoggs ones are all in one moulded plastic and fit much better which has been a boost for what can be done around water, hence, swimming was a huge success with lots of swimming on his own, still with arm bands and mad splashing but followed by lots of jumping in (he now knows that a belly flop hurts) and going down the slide and leaping through the waterfall.

Thursday, 1 October 2009

Butlins - a holiday?

Well we are back from 4 days spent in Butlins, Bognor Regis.

As adults without babysitters the entertainment is a little limited but for Alex (almost 4 years old) the place is fabulous. There is the swimming pool - not much space for swimming but it has a good selection of slides for all ages (I had to try them all out) & a wave machine to make things more interesting and we went every day, a soft play centre (children running around in packs for many hours) and the fairground rides along with a number of pay for activities (far too many of those actually) such as the Formula K go-kart racing (expensive but fun, shame no bumping is allowed), the electric motorbike / quad bike ride (still no bumping but all the driving can be done by a 3 year old) and there is even dodgems (yes dodgems, it used to be called bumper cars when I was a young visitor but bumping gets you thrown off now). There are also loads of fruit machines & video games - all to be paid for and dragging a 3 year old away from them can be hard work.

Then there is the entertainment, perhaps a tots disco (how loud?) or watching a fairy tale acted out by people or puppets. There were acrobats - I'm sure we will be seeing Alex doing more stunts on his bike soon following their example and the highlight of the week has been the Skyline Gang :
6 characters having fun with music and dancing, involving the children, oh yes, and the adults, he he he. Alex was completely taken with them; bright, colourful, funny (What do you call a nut with a cold? A cashew!), interactive and some great eye contact with the kids - even ad-libbing where the audience participation was more participative than expected. I have seen some live artists who were not as enjoyable to watch (both Meat Loaf and Paul McCartney spring to mind, sorry you guys you need to brush up your acts).

Accomodation is clean & comfortable and ideal for the short break and the on site restaurant selection worked well with plenty of healthy options available (if you felt the need) - Alex who doesn't like pizza did pretty well at the each as much as you like pizza place (was Pizza Hut, now Papa Johns).

Well worth the trip and in a couple more years Alex won't tire himself out so easily so he will be able to take part in many more of the activities that are planned throughout the day. My only worry is will he accept the idea that the Skyline Gang aren't the same people if it is still running......

I know, it is Butlins but for a short break it is brilliant value if you get some offers (their standard pricing makes me think their marketing department are trying to make the resort look exclusive, perhaps they are paid too much because it ain't working). We'll be back.

Monday, 28 September 2009

Adobe Updater

Adobe updater can be really annoying - it will try to update your machine persistently. Clearly if you have legitimate software this is not a problem, or is it?

Yes it is, if you are sitting behind a web proxy which you do not control it might be difficult to configure adobe updates to work correctly.

So the trick is to force adobe to think that it isn't due for another update by editting the gile AdobeUpdaterPrefs.dat in (on Windows XP, it will be in the equivalent on Vista which you can google) c:\Documents and Settings\YourUserName\Local Settings\Application Data\Adobe\Updater5

Just change the date between the LastDateCheck tags to be a date wildly in the future and job done, or is it?

Yes, I am writing this because I have just been updated to Adobe Reader 9 and my previous fix has just failed (it fails in that I get logged out of the network about every minute when Adobe Updater is failing so is just a little frustrating) - the AdobeUpdaterPrefs.dat files now sits in the Updater6 folder.

For those people au fait with a registry editor (eg regedit) remember to delete the adobe speed launcher thing from the run settings unless you use acrobat very frequently. The run settings are under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run and HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run, if you care about performance you will already be actively managing the contents of both.

Friday, 18 September 2009

Bald sunflower


A few days on and Alex has brushed all of the coloured heads off of the now hardened seeds on his fallen sunflower so time for another picture

Tuesday, 15 September 2009

Grand Tour

Well, mum & dad are off to Australia for 6 months now, crikey they'd not even left the country before phoning! It is the grand tour, Hong Kong, Australia, New Zealand & Thailand.

Alex is hugely impressed with the enormous Australia map they have given us - he has not quite got the hang of the idea of the scale difference between that one and the little world map he has so he won't have it that Australia is both that big blob on one sheet and that little blob on the other but he will get the hang of it once we start sticking things onto it to show progress.

Even better - they have left and the fridge is actually empty and perishables are gone and inspite of the horrid rain all day Tuesday even had time to clean the pond pump! Now I've redirected the flow back into the middle of the pond even the fish are happy. Boy, we now have 6 jars of mustard (open) and a lifetime supply of marmite to deal with. Such is life.

Friday, 11 September 2009

Moving tempdb

I'm doing it again, moving the SQL Server tempdb. For some reason people setup tempdb in places which just makes no sense whatsoever - like in the same location as other files. It's well documented that tempdb should be on its own drives as its performance is critical to that of the system as a whole.

What type of drive is arguable, generally I've used raid 10 although raid 1 is viable too.  There are arguments for raid 0 out there for the performance benefit, the downside is that if you lose 1 drive then your whole instance is in trouble so not really worth the risk.

You should have 1 tempdb file for each core (I've seen a suggestion of up to 8 files, after which .5 files per core applies but I've no evidence at that scale) and every file must be exactly the same size so the server can create 1 thread per file and use proportional fill.

Microsoft's own advice (this is from Microsoft staff presenting but doesn't make it into written documentation) is to fill the tempdb drive to 90% and have your tempdb at a fixed size ie figure out the max tempdb size you'll ever need, add a bit just in case & create your disk partition so that the size of the tempdb you calculated is 90% of the partition size then create the tempdb files to go in there. I would put a caveat on that, auto-grow is stupid - why would anyone with a live database want auto-grow to come along and trash their database performance while doing its thing & fragmenting your hard disk - plan properly! That said, I like the idea of planning in advance for file sizes but as long as disk space exists auto-grow I leave auto-grow turned on because it is better to take that performance hit rather than your database stop because it has no space. Naturally, you will be reporting regularly on database space used and free disk space to avoid issues won't you? While on "auto" things, there's no point in having auto create stats on and auto-shrink / auto-close are not appropriate for tempdb.

Big note, from SQL Server 2005, each time the instance restarts the tempdb is copied from MODEL so inherits some config options (eg ALLOW_SNAPSHOT_ISOLATION).

It is worth talking a little about the tempdb log file - yes it has one and is used. However, SQL Server 2005 has been optimised so that instead of the usual before & after log, some after logs are not saved so reducing the traffic and file size.

No real advice exists about the placement of the tempdb log file, I would say that if you are forced to keep your tempdb on the same drive as your data then at least place the log file with your other log files, otherwise the norm appears to be to keep the log file next to the tempdb datafiles.

Here is the Microsoft summary which is unfortunately woolly on some details (eg what type of drive to use) but specific on others http://technet.microsoft.com/en-us/library/cc966545.aspx

If you just want to move your tempdb, that's easy, just run the following query to identify what you already have in the way of tempdb files :
USE tempdb


GO

EXEC sp_helpfile

GO
and then run the following to move your files replacing tempname with the name of the file & c:\tempdb.mdf with your new path, similarly change the templog alter command. You will need to use the alter command for each file that you are moving

USE master

GO

ALTER DATABASE tempdb MODIFY FILE (NAME = tempname, FILENAME = 'c:\tempdb.mdf')
GO

ALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME = 'C:\templog.ldf')

GO

Having done that you will need to restart the database and once successfully started and you have confirmed the changes are in place remember to delete the old tempdb files.

Saturday, 5 September 2009

Alex's sunflower

Alex has a sunflower, well had a sunflower, it was growing nicely with plenty of stakes to stop in blowing over, however, there is a limit and that limit was reached & it blew over and snapped at the base.


The seeds are not ripe but the insects seem to like it and it was an opportunity for some close-ups & grandma has a much talled sunflower that is still intact.

Friday, 4 September 2009

Shoreham Airshow

From 2009 Shoreham on Sea Air Show
Once again Shoreham Airshow was a great success with the thundering Typhoon and the world's only flying Vulcan bomber (a friend in Crawley remarked on how noisy it is) and a general all round spectacle for the family

Typically, Alex & his cousin Ewan probably had more fun on the bouncy slide and the diggers than they did watching the aeroplanes. That said Alex is still talking about the "ladies who walk on the planes" aka wingwalkers.

Friday, 28 August 2009

Granting privileges to stored procedures

I've just encountered a user who wanted to run a stored procedure or 3 against as SQL Server database on which he ws not the owner of the stored procedures. This was a bit of a surprise because although added to the database after creation he is in there as dbo. Never mind needed a solution sooner rather than later.

It's simple really in that Securables can be manually editted for that user, unfortunately there are a large number of procedures potentially required - in fact it is a 3rd party product so we won't have a full list of required procedures until we've run the process repeatedly weeding out each issue as it arises.

The answer :
select 'Grant Execute on ' + name + ' to "username"'
from sysobjects where xtype in ('P')
This works nicely by outputting a full list of statements that can be copied from the output and executed in the query window in SSMS. The important feature here is the username - this is the full username ie if you are using Windows accounts it will be DOMAIN\user enclosed in the shown speech marks to ensure spaces are handled properly.

Friday, 21 August 2009

Restoring SQL Server databases to a different machine

SQL Server is extremely flexible and allows databases to be backed up and restored very easily and independently of hardware requirements.

There is, however, one nagging problem when restoring a database to a different machine(say copying a development database to a live environment) and that is SQL Servers security system.

SQL Server has logins against the instance and then users against each database - so each database has security independent of all the other databases unless logins have been granted access to any server roles.

When the database restore process completes there might be users listed on the database who do not have logins on that instance or even if the user has a login the guids might not match.

So for SQL Server 2000 and above firstly identify what the problem is by running :

exec sp_change_users_login @Action='Report'


Then for each UserName identified you can either match existing logins to database user using :
exec sp_change_users_login 'Auto_Fix', @UserNamePattern ='username'

(replacing username with the UserName from the first query).

To save having to check which to do manually it does no harm to run that command for users that don't exist yet - just run the first command again to identify who is still not sorted and then run the following to create logins for each remaining user :
EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'


Just make sure you are connected as an admin user and you are connected to the correct database before running the commands.

It's also worth pointing out that this isn't news - I was passed most of this info when I started the role and have modified as I've gone along and there are plenty of postings out there with the same /similar information.

Wednesday, 19 August 2009

Abstract Rose

abstract rose
I loaded up the hoverfly photo yesterday and had some positive feedback so I thought I would start to upload other pictures. This one is one of a series taken of roses from my then garden and was taken with a Fuji Finpix S602 zoom when it had just been released. I just popped the roses in a vase in my patio doors and snapped away testing the settings that the camera could provide. The resolution is low in today's terms - especially as this was a crop of the larger picture but I'm still happy with the result.

Tuesday, 18 August 2009

When is a bumble bee a hoverfly?

hoverfly
I was showing Alex all the bumble bees busily collecting pollen from the thistle flowers in the garden - at least 4 different types of bumble bee and a bog standard bee all buzzing away and decided to take some pictures. Yes, lots of pictures of bumble bees eveyone of them at least a little disappointing but the sole picture I took of a hoverfly came out beautifully. Taken with Panasonic TZ5 in macro mode - so pretty much point & press. The specs on the flower are specs of pollen not bad pixels!

Monday, 17 August 2009

Changing timings of SQL server agent jobs on mass

This is an example of how to change the timing of a series of jobs on the SQL Server agent - in this instance we needed to change all of our full backups to run every third day (well Monday then Thursday, Tuesday then Friday and Wednesday and Sunday leaving Saturday for other maintenance activities).
-- Routine to set the times of all jobs named "Full backup%" on a machine, splitting the jobs into 3 batches, Mon&thur, Tue & Fri and Wed & Sun
-- log backups should be occuring the rest of the time which leaves saturday for maintenance work
-- output is a series of statements which when executed to text output can be copied and executed in a new query window.
set nocount on
create table results (dsp varchar(500))
declare cJobs cursor fast_forward for
select schedule_uid from msdb..sysschedules where name like 'Full Backup%' order by name, schedule_uid

declare @UID varchar(128)
declare @count int
declare @MT int
declare @TF int
declare @WS int
declare @MTStart int
declare @TFStart int
declare @WSStart int

set @MT = 0
set @TF = 0
set @WS = 0
set @MTStart = 40000
set @TFStart = 40000
set @WSStart = 40000

set @count = 1
open cJobs
fetch next from cJobs into @UID
while @@fetch_status = 0
begin
if @count%3 = 0
begin
set @MT = @MT+1 -- Mon & Thur = freq_interval = 18
insert into results select 'update msdb..sysschedules set freq_interval = 18, active_start_time='+cast(@MTStart as varchar)+' where schedule_uid = '''+@UID+''''
set @MTStart = @MTStart + 200
if @MTStart = 46000 begin
set @MTStart = 50000
end else if @MTStart = 56000 begin
set @MTStart = 60000
end else if @MTStart = 66000 begin
set @MTStart = 70000
end else if @MTStart = 76000 begin
set @MTStart = 80000
end
end else if @count%2 = 0 begin
set @TF = @TF+1 -- Tue & Fri = 36
insert into results select 'update msdb..sysschedules set freq_interval = 36, active_start_time='+cast(@TFStart as varchar)+' where schedule_uid = '''+@UID+''''
set @TFStart = @TFStart + 200
if @TFStart = 46000 begin
set @TFStart = 50000
end else if @TFStart = 56000 begin
set @TFStart = 60000
end else if @TFStart = 66000 begin
set @TFStart = 70000
end else if @TFStart = 76000 begin
set @TFStart = 80000
end
end else begin
set @WS = @WS+1 -- Wed & Sun = 9
insert into results select 'update msdb..sysschedules set freq_interval = 9, active_start_time='+cast(@WSStart as varchar)+' where schedule_uid = '''+@UID+''''
set @WSStart = @WSStart + 200
if @WSStart = 46000 begin
set @WSStart = 50000
end else if @WSStart = 56000 begin
set @WSStart = 60000
end else if @WSStart = 66000 begin
set @WSStart = 70000
end else if @WSStart = 76000 begin
set @WSStart = 80000
end
end
fetch next from cJobs into @UID
set @count = @count +1
end
close cJobs
deallocate cJobs
print 'Mon Tue:'+cast(@MT as varchar) +', Tue Fri: '+cast(@TF as varchar)+'Wed Sun : '+ cast(@WS as varchar)
select * from results order by 1
drop table results

Update : we have discovered that the table sysjobschedules hold start times too but cycling the agent should bring everything back into step.

Friday, 14 August 2009

SQL Server 2005 BIDS Installation Problem

Here’s a new one – I’ve just installed SQL Server 2005 and selected everything including client tools and Business Intelligence and the install completes perfectly only to find that BIDS is not installed, it is missing, no trace of devenv.exe or related components on disk.

 

After several attempts via Google I finally found an answer that works here http://weblogs.asp.net/kdente/archive/2007/03/07/the-case-of-the-missing-business-intelligence-studio.aspx, it seems from MSDN that lots of people have the problem so I’ll repeat the answer :

 

Goto the installation CDs, find disk 2 and in \setup run firstly vs_Setup.exe – you’ll get absolutely no notification that anything is happening for what seems like an age and then it will be finished. Then run from the same location sqlrun_tools.msi and select the components you want – in my instance they were shown as missing by it seems that is not always the case so just go and reselect everything you want and run the install.

 

Job done.

 

Another MS feature to make my life painful.

 

Friday, 8 May 2009

Pirate Pussy Cat

clyde the pirate pussy cat
Clyde, our cat, who is something in the region of 17 years old, has had his eye removed yesterday. He had lost sight in it sometime before but recently punctured it & it hadn't healed properly before he caught it on something again so as it was causing him a lot of pain.....

Friday, 1 May 2009

Using Sql Server Management Studio Offline

First post, a tip I desperately needed today.

I have been using my laptop offline and occasionally find myself faced with a "cannot generate sspi context" error message.

Working offline I have found that I was unable to connect to my local instance (SQL Server 2005) using the server name so I was having to connect as localhost and for most local SQL / T-SQL purposes that was fine. However, any attempt to access DTS was met by the aforementioned problem.

The solution turned out to be simple - open SQL Server Configuration Manager (under the Microsoft SQL Server 2005 program group in Configuration Tools) and goto SQL Native Client Configuration then Aliases. Right click on your instance name and goto Properties. I found that the protocol was set to TCP which is not fully functioning without my work network so changing to Named Pipes means the whole communication is internal to the laptop.

Now I can logon to the expected instance name and work with no problems. 5 minute fix.

Click here for a discussion of the SSPI problem on SQL Server Central

Welcome

I've started this blog as a convenient location to store useful SQL Server scripts that I come across.



I'm currently working with SQL Server 2000, 2005 and a little bit of 2008 (ok a tiny bit) so what I put on here will relate to those and differences that I know about will be specified.



I will credit the authors where the scripts were not home grown and where I have a weblink I'll back link to the source but I am going to keep my own code here because of those differences and the occassional disappearing link which I do not want to bother managing.

Tuesday, 28 April 2009

Bridge Guide

Points
HCP A=4 K=3 Q=2 J=1 All aces =+1 13 pts no aces =-1
LP : each card in suit over 4:+1/ card (Opening = HCP + LP)
SP : Void =5 Singleton =3 Doubleton =1 (Fit of 8+ trumps =HCP + SP)
Bad : Each singleton K/ Q/ J = -1
Weak Holdings : Doubleton Q-J or 4-3-3-3, for 2 of = -1

Patterns
Balanced : No void or singleton, max 1 doubleton (4-3-3-3 / 5-3-3-2 / 4-4-3-2)
Semi-balanced : 2 or 3 doubletons, no void or singleton (5-4-2-2 / 6-3-2-2 / 7-2-2-2)

Tricks
K-x / Q-J-x = .5, K-Q / K-J-10 = 1, A-Q / A-J-10 / K-Q-J = 1.5, A-K = 2, A-K-Q = 2.5

Game Going?
Points : <26 stop in lowest poss. part score, 3NT=26+ & bal., 4H/4S=26+ & 8+ trumps,
5C /5D=29+ & 8+ trumps, 6(suit)=33+ & 8+ trumps, 6NT=33+ & 8+ trumps, 7(suit)=37+ & 8+ trumps, 7NT=37+
Slam With 8-9 trumps should have A-K-Q, with 10-11 have A-K, Small = opponent cannot take 2 immediately, Grand = opponent can take none immediately.
Remember : Suit Quality Test - length + hons in suit = no. of tricks to bid, count J-10 if higher hons held

Hints and Tips
Don't rescue partner & show strength when have it.
If suit has unequal length between the 2 hands win tricks with high cards in the short hand first.
Usually cover an honour with an honour
When there is a trump suit leading from A-K combination is usually effective while leading from other holdings headed by the Ace is usually not effective ie can tell if leader has ace
Best counter to crossruff likelihood is to lead trumps early & often
The lead : if NT & longest, strongest suit headed by 3 touching high cards lead o­ne of them - else 4th highest. If trump & longest suit is headed by 2 touching high cards lead o­ne of them

Opening
Pre-emptive Shut out, opening 3+ = <=10 HCP & 7+ card suit & within 3 tricks of the bid (non vulnerable) /2 (vulnerable) i.e. 3 (suit) =6 / 7 tricks. Do not pre-empt beyond game & don't bid again unless forced, count each card in long suit as 1 & add other winners.

After opponent's pre-empt use take out doubles / next minor suit (as agreed with partner)

Balanced hand 12-14 = 1NT (don't do if partner passed), 15-19 = bid suit & move to NT later, 20-22 = 2NT, 3NT = long, solid minor & hope. With 5-3-3-2 & 5 card major prefer suit opening

Unbalanced 0-11= pass unless pre-empting, 12-20= 1(suit)(or 10-11 & LP), 18-20 & 8/9 playing tricks=2D / 2H / 2S, 21-23 & 5+card=2S / 2H / 2D (alt:benjamin / weak 2s), 23+ or 10+ playing tricks =2C

Suit selection 5+ card = open longest, 5-5-x-x or 6-6-1=open highest rank, 4-4-3-2 outside NT range = open lowest, 4-4-4-1 black singleton = open middle / red singleton = open below single

Responding
May know point count & if game possible (show strength or 1 rnd forcing) else weak reply

Prefer 1(major) to raise to minor or 1NT

Support = 4+card (or 3 if 6-10 & shortage)

1S-2H=5 hearts in responders hand, opener should raise hearts with 3+ trumps

Bidding by a passed hand Jump shift (1S-3C)=max pass, 11-12 & 4 card supp. for partners suit, not forcing, change of suit=@1 lev (4+ & 6-11) @ 2 lev (5+ & 10-11)

Pre-emptive response Count winners (A-K-Q in partners suit=1,others A-K=2,A-Q=1.5, K-Q=1, K=.5), support+singleton=+1, support+void=+2. If winners <=required then pass else game / slam (prefer openers suit), change of suit is forcing (5+ strong), if partner opened 3C / 3D try 3NT with bal. & 16+ & other suits covered

1NT response 2C=Staymen (Opener strength=11+, at least 1*5+ card major& shortage or weakness=<11 & long clubs - rebid @ 2 or 3 level to show weakness, respond 2S = 4S!4H, 2H=4H maybe 4S, 2D= no 4 card major), 2D/2H/2S=weak, to play, 3NT (13) to play, 3C/3D / 3H/3S=force to game, 5+card,2NT= 11-12pts not suitable for staymen, opener pass o­n 12 else 3NT, 4H / 4S to play (12-14 & 6+), 4NT=inviting slam 17-19, opener pass (12), 5NT (13), 6NT (14-often fails) alt 17-19 use Gerber o­n 33+

2NT Response Game bids to be played, 3C=staymen, 3D/3H/3S=5+ card forcing to game, stronger than game bid, 4NT inviting slam opener pass (20), 5NT (21), 6NT (22) alt Gerber

3NT Response 4H / 4S to play, 4C/4D/5C opener passes or bids the other minor if is openers longer suit

1 suit responses pass (0-5), new suit @ 1 lev (6+, 4 card, 1 rand forcing), new lower suit @ 2 lev (10-16, 4 card, 1 rnd forcing), jump bid in new suit (16+ HCP, forcing to game, maybe slam), 6-10 points any shape = 1NT. NTs - 1NT (6-10 denies major except 1S-1NT also 6-10 any shape), 2NT (11-12 bal no 4 maj), 3NT (13-15 bal no 4 maj), Raises to 2 lev (supp, 6-10), 3 (supp, 11-12), 4 (exceptional supp, unbal < 11 HCP, shutout). With 13-15 HCP & supp for openers major bid new suit now & go game next

2C Response 0-7 2D -ve, 8+ or 1.5 tricks +ve suggesting slam

2D/2H/2S Response (Not weak 2s or Benjamin), 0-7 2NT -ve, 8+ or 1.5 tricks +ve forcing to game, 3H / 3S stronger than raise to game suggesting slam, 8-11 3NT bal

Opener Rebids
If fit use HCP+SP, don't raise 1 lev resp with 3 trumps, bid new suit @ 1 lev rather than 1NT

Balanced after 1 lev resp 1NT (15-16), 2NT (17-18), 3NT (19), after 2 lev 2NT (15-17), 3NT (18-19 or 17 with few weak holdings or bad features).

Unbalanced 12-16 raise resp suit with 4 supp, bid new 4 card @ 1 lev, bid lower @ 2 lev, rebid 1st suit; 17-18 jump raise responders, bid new (inc reverse), jumps rebid your 1st with 6+ card & no 2nd, 19-22 jump to game in responders major, your major or jump shift

After 2C opening 1st suit rebid is 5+ card, game forcing, 2NT=23-24 bal not forcing - contine as 2NT opening, raise to below game stronger than game, after +ve resp bidding usually ends in slam (Blackwood)

After 2D/2H/2S opening After 2NT -ve if opener rebids a new suit higher than opening suit or jump rebids below game responder must bid back, after +ve resp bid at least to game

Responder Rebids
Don't raise openers 2nd with o­nly 3 card (2nd implies o­nly 4 card), in bidding game prefer 4H/4S/3NT/5C/5D. Don't rebid 5 card if any other action poss, after 3 suits 2 or 3NT promises stopper in other. Jumps rebids by responder (except in new suit) are not forcing, don't bid jumps if can go game.

6-10 Raise openers 2nd, support openers 1st, rebid own 1st, bid 1NT. New suit=4th suit forcing except after 1NT, if opener responded with jump raise or jump rebid then pass o­n 6-7 & bid back to 8-9. Must respond if opener jump shifted.

11-12 Jump to 2NT, jump raise openers 1st or 2nd or own, all non forcing, encouraging, else use 4th suit forcing

13+ insist or bid game, 4th suit forcing, jump in new suit

Defending Partnership Bids
Neil double = always a double ie not a penalty after 1NT opening

Take out doubles @ 1 or 2 lev & partner not bid (not inc. 1NT which is penalty double), 12-15 shortage in suit doubled & supp or tolerance for unbid suits esp. majors & 3-4 card majors = double then pass any min reply, 16-18 unsuitable for NT overcall=double & bid again without jumping (not NTs), 19-21=double&bid NT,22+ double & jump in NT or new or partners suit. In exceptional cases may jump to game after partners min reply - if powerful hand & superb supp. in partners suit. Responder HCP+SP, 0-2 pass if at high lev else bid 5 card maj, 3-8 pts bid at cheapest lev, prefer 4 card maj, 9-12 jump bid, 13+ bid game or enemy suit, NTs-deny major + show stopper in opp. suit: 1NT (6-10), 2NT (11-12), 3NT (13-15). Priority majors, Nts, minors

Simple Overcalls Suit overcalls : 5+ card & 2-3 honours, HCP+LP 8-10=1 lev, 11-16=2 lev. NT overcalls : 1NT=16-18 bal & hon. in opp. suit proceed as 1NT opening, 2NT=both 5+minors & 8-12 & 2+ hons can be sacrifice bid o­n 2S / 2H opening, 3NT=solid 7 card minor & stopper in opp. suit run 9 tricks when get lead. Replies (not forcing, changes of suit= 5+card) : 8-11 + supp = raise, 8-11+bal=1NT, 12-15+supp=jump raise, 12-15+bal = jump to 2NT, 16+=bid game, jump shift, bid enemy suit (ie points for game unknown suit). 3Card okay for supp.

Jump Overcalls Strong 17-20 & 5-6 card. Responding=If >=26 pts in partnership & JO was major try to supp, if minor try to 3NT, change of suit is forcing (5+card), 1st to bid NT promises stopper in the opposition suit. Double or triple JO=pre-emptive & work as pre-emptives (except JO to 4H or 4S (can inclue up to 15HCP)) replying to triple JO is same as resp to pre-emptives

Conventions
Staymen shows strength (11+ & min 1*5 card maj & shortage) or weaknes (<11& long clubs, rebid @ 2 or 3 lev to show) - if poor hand pass - is looking for strength in majors. Responses : 2S=4S!4H, 2H=4H maybe 4S, 2D=no 4 card major

Blackwood min 33. 4NT (5C=0/4 aces, 5D=1,5H=2,5S=3) 5NT (6C=0 kings,6D=1,6H=2, 6S=3, 6NT=4)

Gerber min 33. & after 1 or 2NT opening, 1 suit higher at 1 lower lev than Blackwood, 4C (4D=0/4A,4H=1,4S=2,4NT=3) 5C (5D=0 kings, 5H=1, 5S=2, 5NT=3, 6C=4) (4C=Always Gerber)

Oddities
Cue bidding of enemy suit bid directly over opening, take out bid, force to game, need 2 opening hand (2C, 2D in Benjamin)

4th Suit Forcing strong hand >=10, no clear rebid & enough for game & slam poss. Opener rebids after 4th suit by priority to 3 supp. for responders major & NT if has stopper in 4th suit. With more than min opening hand opener should rebid over 4th suit. Responders jump rebid in 4th suit shows at least 5-5 in the suits bid & enough for game

Reverse bids by opener new suit bid @ 2 lev in a suit higher ranking than that opened, not forcing but invitational. Promises 1st suit longer than 2nd. Never with equal len suits. Promises more than min opening (>=15 HCP). Rebids after reverse: 6-8=not forcing raise openers 1st or 2nd, rebid responders, bid 2NT; opener may carry o­n but is warned. 9+ = forcing - any jump rebid below game, building the 4th suit. After an initial 2 lev resp (ie the responder's first bid - the o­ne before the reverse) there are no weak rebids by responder & is game forcing.

Jump Shifts by opener - o­n rebid - jump rebid in new suit, forcing to game, 20+ hand which with responders is enough for game, promises unbal, usually 5+ in 1st & 4 in 2nd or equal len. Responder rebids after jump shift - prefer openers 1st if have 3 supp, raise openers 2nd if 4 supp. If can supp both the supp. longer. Rebid responders suit if 5+ card, Rebid NT is have 4th covered, Rebid 4th suit. Don't pass below game, consider slam poss. with 11+ & trump fit. Prefer openers major to minor

Tips
Do not rescue opponents – why bid when you have their suit?
The lead from J x is the worst lead
Concentrate o­n the opening lead – decide what it tells you about length and strength in that suit
Review the bidding – use the opening lead and bidding to try picture hands
For suit contracts count your losers, for NT contracts count winners.
Lead attacking combinations such a Q-J-10-x

Saturday, 25 April 2009

It seems that this blogger thing has a lot of capabilites - in fact it does a lot of what Postnuke did without any of the setup hassle, no perfect but it is time to start transferring content from my old site which might be a struggle given that the site is down, always up for a challenge.

Welcome

Welcome to my blog, this is my first effort and I've labelled it "The Page Family" blog because I'll have once location to cover everything I'm going to post relating to myself, Chris Page, my wife, Lorna Page and our son, Alex Page.


This would be incomplete without including our pets - we currently have 1 cat (Clyde) who is being treated for a punctured eye at the moment having been blind in one eye for sometime now, our fish - currently two tanks, one tropical and one coldwater, two hamsters and Lorna has a horse.


Eventually I will get around to transferring old site contents - after all I start this site with the demise of my Postnuke based website which I simply don't have time to maintain properly.


Chris