Blend 4 + VS 2011 (Preview) = Problem?

Problem: 

Microsoft Expression Blend 4 crash on startup after installing Visual Studio 2011 Developer Preview on my machine..

Solution: 

I found this bug report in MS Connect.  Christopher Cole from Microsoft Expression responded that report with the solution below.

There is a compatibility problem with .Net 4.5 installed as part of the Developer Preview and Blend 4. This issue was fixed, but too late to make the preview build.

The workaround is to run:

%windir%\Microsoft.NET\Framework\v4.0.30319\ngen uninstall “%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Framework.dll”
%windir%\Microsoft.NET\Framework\v4.0.30319\ngen uninstall “%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Blend.dll”
%windir%\Microsoft.NET\Framework\v4.0.30319\ngen uninstall “%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Project.dll”

If “%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.WindowsPhone.dll” is present (for scenarios like Blend V4 SP1 or future releases), please also run:
%windir%\Microsoft.NET\Framework\v4.0.30319\ngen uninstall “%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.WindowsPhone.dll”

I just tried it on my machine and it works for me so I’m sharing it with my readers here..

Edit: 

Error: Unrecognized option Files

You have integrated Git with Command Prompt, you will get this error when you run “ngen”. If you happen to have the older preview version of git, you will get the error below when you try to uninstall it. I had to delete the git folder manually.

—————————
Error
—————————
Runtime Error (at 18:1292):

Could not call proc.
—————————
OK
—————————

 

 

Tip for Windows Phone Wi-Fi issue

I’ve been using HTC Mozart Windows Phone for a few months and I’m quite happy with that phone. 

Unfortunately, I got an issue after updating latest version of Mango yesterday. I was using the early version of Mango as well. I didn’t have any problem until yesterday. The problem is that I couldn’t able to detect my wi-fi network from my phone. I tried quite a few way to fix that issue. I even did the hard-reset for my phone but didn’t work. My friend suggested me to change the wireless channel of my router. Finally, the trick did work. So, I’m just sharing what I found here. Hopefully, it would help someone.. :)

HTC 7 Mozart – C1010009 in updating Windows Phone 7.1 (Mango)

My phone “HTC 7 Mozart” was having problem in updating Windows 7.1 Mango “7.10 (7720)”. I kept on getting “C1010009″ error whenever I tried to update.

After doing some researches and googling a bit, I came to know that it’s because of the USB port. I was using the USB ports which are in front of the system box . So, I switched my phone USB cable to the port at the back of my system box then it works.

If you are also having C1010009 error, please try switching different USB port and try updating again. Please feel free to share if you have any other solution!

Encoding MP4 Problem in Expression Encoder 4 Pro

I wanna tell you guys about one problem that I’m facing with Expression Encoder 4 Pro. Do you guys ever see this error “This functionality is only available in the fully-featured Expression Encoder Pro” while you are using Expression Studio Ultimate licensed version?  I heard that the most of users who are using the MSDN subscription version of Expression Studio are having this problem.  When you change the Output Format “Windows Media” to MP4, you will get this error.

The screenshot of that error is as below..

I think Microsoft is aware of this issue and I hope we will get the fixes very soon.. Emily Anderson from Microsoft wrote below in IIS7Media forum ~

Thanks for your interest in Expression Encoder.  We have two version of Expression Encoder 4: The first is included in Expression Ultimate purchased through volume licensing, MSDN, and Bizspark, and does not include royalty-bearing codecs.  The second version is included in Expression Ultimate purchased through retail channels, and does include the codecs. The reason for needing two product versions is due to codec redistribution and reporting requirements. Unfortunately we’ve experienced some technical issues with MS store, but we expect the problems to be resolved in the next 48 hours and Encoder to be available again before the end of the week.

If you are wondering whether you have the same problem or not, you can go and check the AboutPage of Encoder 4. The following is mine. If you have “(without codecs)” then you will probably have the same problem..  The only solution that I know is to wait a few more days to get the latest version of Encoder 4 from MSDN subscription. Let me know if you know other workaround..

Easy SQL Script for handling SQL Image Data

Obviously, I’m not a SQL expert and I was focusing on WPF, Silverlight and patterns during last two years. But recently, I got an opportunity to wear multiple hats in my new job and SQL is the one of the hats that I’m wearing now. :)

Okay. Let’s talk about this post.. This post is about how to read the SQL image data, save it as an image file and how to update the existing image data with new image file from SQL Query Panel.

This is the screenshot of one of our games. As you can see in this screenshot, there are some images that we are using in our Silverlight game. Those image comes from database.

I thought that SQL 2008 R2 Management Studio would have something that allows us to view or change the existing images (binary) but Unfortunately, it has nothing that you can view the images. (Please take a look at the screenshot below. This is how you will see the image data in SQL 2008 R2 Management Studio. very powerful tool, isn’t it? :) )

I looked for open source or free tool that I can view the image from SQL database and save it as a file. I found a few trail tools but none of them are good enough. I decided to do some experiments on SQL script and here is something that I come up with.. I’m not sure whether this is a good solution for you guys or not but it’s good solution that I can live with for now. If you have any good solution that you are using in your work then please feel free to let me know..

Let’s take a look at the script.

Enabling Ole Automation Procedures in SQL

Before running the script, you need to enable “Ole Automation Procedures” by using the script below. Note that you need to have an administrative right to run the script.

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO

Once you enable the option then you should be able to read the image by using Ole and save it as a file.

Reading Image Data and Save it as a image file

You need to set the path where you want the generated image to be saved. Did you notice that I mentioned the file extension in @filePath? It’s because I know that all images that we are using are .jpg but it would be great if we can write something that can detect the image format from the binary data. If you have the script please share with me. ^^

DECLARE @objStream INT
DECLARE @imageBinary VARBINARY(MAX)
SET @imageBinary = (SELECT imagedata FROM dbo.tblDefaultImages WHERE imageid = 121)
DECLARE @filePath VARCHAR(8000)
SET @filePath = 'C:\\MS\\r.jpg'
EXEC sp_OACreate 'ADODB.Stream', @objStream OUTPUT
EXEC sp_OASetProperty @objStream, 'Type', 1
EXEC sp_OAMethod @objStream, 'Open'
EXEC sp_OAMethod @objStream, 'Write', NULL, @imageBinary
EXEC sp_OAMethod @objStream, 'SaveToFile', NULL,@filePath, 2
EXEC sp_OAMethod @objStream, 'Close'
EXEC sp_OADestroy @objStream

Updating the image

Here is the script for updating the existing binary data with new image file. I didn’t use Ole here because OpenRowSet is very easy to use and much shorter..

UPDATE [YourDatabase].[dbo].[tblDefaultImages]
SET imagedata =  (SELECT * FROM
OPENROWSET(BULK N'E:\\FTPRoot\\MS\\rhyme\\rhymeObjects\\wine.png', SINGLE_BLOB)
AS Document)
WHERE imageid = 127

Okay. That’s.. What do you think?

Tip: “Object reference not set to an instance of an object” Error in Silverlight for Windows Phone 7

Problem :  “Object reference not set to an instance of an object.”  messagebox will be displayed when you are running Silverlight Windows Phone 7 Application in Visual Studio 2010.

Solution : Shawn Oster, Program Manager of Silverlight for Window Phone team, confirmed that this is a known issue that they are currently working on fixing for next update. The workaround for this issue is that you need to ensure that the solution is not highlighted in Solution Explorer.

Let’s take a look at the picture below. Solution “WP7ApplicationBar” is highlighted in Solution Explorer, right? That’s why you are getting this error.

In order to fix this, you need to move the selection by clicking on Project Name or other files in Solution Explorer. As you can see, Solution “WP7ApplicationBar” is highlighted in previous screenshot. And we moved the highlight to ProjectName in second screenshot. Then, you can try to run the application from Visual Studio again. I think it will work this time.

Hope you find it useful. I’m facing this problem quite so often lately. This funny trick helped me to solve this problem. :) If this trick doesn’t help you then please feel free to let me know.