Update a table from a Select query

I had to update a table with missing product id’s using the item master table to do the correlation. This led to having to formulate a lovely SQL query that would let me update the table based on matching criteria. In effect, I knew the SKU in both records should match, so I could correlate them via that data point. This SQL can easily be adapted to work with your scenario. I used this against a SQL Server 2005 database.

update torderdetails set torderdetails.productid = tproducts.productid
from torderdetails join tproducts on tproducts.partnumber = torderdetails.partnumber where torderdetails.productid =0

Hopefully this helps someone out their with the headaches of these rare tasks.

What is the Visual Studio 2008 resolve using hotkey/shortcut..

I hate manually typing the using statements at the top of my classes so I invariable just type the class/object name for the type I want to use then use the Visual Studio resolve function. Right click -> Resolve.

Well, its a real pain to move to the mouse to resolve when I am typing away. So I finally got off my laurels and looked up the keyboard shortcut.

Here is the magic: CTRL + .

That’s right, CONTROL PERIOD. <insert female joke here ;)>

Hope this saves you a few clicks.

XP decides opening new windows is no fun….

I happen to do a lot of multi-tasking. I have 4 copies of Visual Studio 2008 open with Management Studio for 2008 open plus a number of different browser windows and explorer folders. I eventually run into this invisible wall where no new windows get created. No new tabs, links stop working, applications won’t launch etc. Whats the temporary fix? I start closing windows and boom, I can now open up new ones.

It seems Windows has a very unfriendly bouncer that says the club is full and until people decide to leave, no one gets in.

I get these awesome event log entries:

Application popup: ftpit.exe – Application Error : The application failed to initialize properly (0xc0000142). Click on OK to terminate the application.

So, what is the fix? Disclaimer, changes to your system can cause inoperability if done improperly. Advice is without warranty 🙂

The system seems to allocate memory to the desktop heap by certain system boot parameters. All handles GDI object and User objects seem to use this 48mb desktop heap.

The solution I tried and sitting around to see if works well is to change these boot params.

I am changing the reg key:

HKEY_LOCAL_MACHINESystemCurrentControlSetControlSession ManagerSubSystemsWindows
From : %SystemRoot%system32csrss.exe ObjectDirectory=Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16
To: %SystemRoot%system32csrss.exe ObjectDirectory=Windows SharedSection=1024,8192,2048 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16
You can read more about it on MSDN.
If this solves your problem, let me know.

Would you like a ticket for having a bike rack in Tampa, FL?

What a lovely city Tampa is for bicyclists. They have great trails and an abundance of bike lanes in the nicer communities. However, if you want to transport your bike on a bike rack, Tampa is not the place for you.

Today my wife got pulled over for what…speeding? nope….illegal lane change?…nope…..having a bike rack blocking a portion of her license plate? ding ding. You got it.

Apparently in a city that is being hit by the economic slump, the police have nothing better to do than pick on law abiding citizens.

The officer said that he could write a ticket for the obstruction of her license plate by her bike rack which is a non-moving violation. What a pile of crap.

So, next time you are out and want to take your bike out to the bike trail on your bike rack, remember the gestapo Tampa Police Department may decide you deserve a ticket.

Oh…What about the Tampa Police Department and their bike cops with their bike racks? Oh…They are above the law as usual, of course.

The police should be out to protect our way of life and keep us safe; not pick on law abiding citizens trying to go about their day.

Write your mayor, sheriff, and congressman to try and get this fixed.

How to view an exception that wasn’t explicitly caught in C#?

So, you decided to do that catch statement without actually declaring the Exception err variable. Sure, code analysis said you weren’t using it. You didn’t want to log it, and you just thought you wanted to swallow the error whole and never see it again. Until…..

Wow, it keeps crashing in the Try block and you have no access to the error when it hits the catch now. What to do? Never fear.

Open your immediate window. Debug->Immediate.
Type $exception then hit enter.
Yep, there is your exception staring at you in all its glory.


Thought on complexity….

After reviewing the new database design for a project I am working on, I invariably declared that no one can do anything straight forward and simple anymore.

In a world of exceedingly complex thoughts and designs, developers inevitably strive to push the bounds in ways never thought possible. In essence, simplicity does not serve the ego well enough., Brian Seekford

The joy of watching your Polycom Soundpoint IP 650 rebooting endlessly…..

So…I was provisioning a new Polycom 650 and came across a lovely mind numbingly painful situation.

Let’s start out from the beginning. I went to the Asterisk box and created the proper [mac].cfg files in the tftp boot folder. I set the appropriate phone[ext].cfg files and the sip.cfg file. I then confirmed with my DCHP server that the option 66 setting was correct to the tftp:// address of the pbx.

So far so good. The phone boots up and then tries and load its application module. It says application loaded and then reboots. Hmm…WTF.

I do what all good IT folks do, bang my head on a couple of walls and visualize throwing the phone through various windows.

So I go back to the TFTP server and lo and behold, there is no SIP.ld or bootrom.ld. Great, someone decided to delete these.

I went to Polycom’s website, fearing they were still overly paranoid folks and not going to make their firmware available(as it was a couple years back), but was pleasantly surprised to find an entire archive. I downloaded the new split package, pretty cool to get the smaller files, and loaded it onto the TFTP site.

Phones rebooted and downloaded the new application and bootrom. All good right? Sure…that is until it rebooted continuously again. Damn. More head banging and vicious thoughts of gutting the phone.

I review the boot logs and find that its looking for a logo-600.bmp. Hmm..>Why would anybody have deleted that? Well, they did. So I make  new logo file and uploaded that to the TFTP server along with the missing SoundpointIPWelcome.wav file and the phone decides its happy again and boots up.

Why in the world does the phone REQUIRE that all misc files are present is beyond me, but that’s how it works.

So if your Polycom is rebooting continuosly AND you see boot logs on your tftp site (if not, you haven’t configured it to point right) then make sure all MISC files are available along with your SIP and BOOTROM files. One missing bitmap can cause your PBX empire to crumble.

Entity Framework and Views.. Too many keys on the keychain…

I am currently working pretty heavily with the Microsoft Entity Framework for .NET. I just ran into a nice quirk in the Model Wizard for Views.

Well, it seems the model wizard is not able to intelligently determine the primary keys for a view so it resorts to deciding that any NON NULLABLE field must be a primary key. Retarded…yes.

So how to fix this? Well, as long as you don’t mind never using the wizard again you can go in and remove the entity key flag off the conceptual model fields and then delete the key references on the storage model. This all in the XML editor naturally, because of course you can’t do anything useful int the modeler.

Note: Once you fix your keys, if you rerun the Model Wizard to import/refresh tables, you will have the pleasure of hand editing the file again for all your views.

Will this be fixed in 4.0? We will wait and see