Linq strikes again

Linq has become one of my favorite things to use. It allows you to approach the concepts of objects just as you would a sql query on a database. Linq is very flexible and i have not found an instance in when it does not work, but…….
And yes there is a big BUT, i have now found a situation where the performance suffers substantially.

The theory for me was “use linq on objects in memory and it will be even faster”, well this was not the case. I used linq on various datatables in memory and it worked but was very very slow. It seems the more i added to the where clause of the linq statement the slower it got. Since this was a program in which the performance hit was very very noticeable i had to remove all instances of linq. Since i was using a data table i went back to the dataview and the rowfilter.

The row filters performance was far superior to the linq statement.

The moral of the story is check the things you change first before you alter your code around the problem instead of getting rid of it completely. For my AI crowd its sort of like a conflict set!

Posted in Uncategorized | Tagged , , , , , , , | Leave a comment

Blurb of the day

ADO.net

If you using ado.net and are getting this error

Could not load type ‘ADODB.FieldsToInternalFieldsMarshaler’ from assembly

You need to go to your project references-> Embed Interop Types: false.

Once you do this it will fix your issue.

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Wisdom of the day

When dealing with vectors (or any object) PLEASE make sure the vector (or any object) is set to something and not null/nothing before you start to process it. If you don’t you will spend a lot of time diagnosing a self inflicted issued that should have been a non issue from the beginning.

Even though this is 101, sometimes we forget the basics….

Posted in Uncategorized | 1 Comment

Blurb of the day: More .net Madness

If you are using web services and are using visual stuido 2010, when you consume that service to be used in your application make sure the machine that it is being deployed to has .net framework 3.5 sp1. If it only has .net framework 3.5 that is not good enough. You will get an error like this

an error occurred while loading attribute ‘xmlserializerformatattribute’ on method blah blah blah

This error is basically telling you to install 3.5 sp1. Then the error will go away.

This happens because in vs2010 there are a few attributes that get added to web service proxies that are only usable when 3.5 sp1 is installed.

 

Posted in Uncategorized | Tagged , , , , , , , | Leave a comment

Blurb of the day: .net framework madness

Soooooooo what do you do when the a .net framework update wont install……. Go CRAZY!!!!! or you can try everything you can until something works.

I kept getting a 1603 msi error when installing the .net framework. So i went to check the error logger. It gave me a error 25007. Error occurred while initializing fusion. Setup could not load fusion with LoadLibraryShim(). Error: 0×80131700.

Looking at this error i saw that i should be able to solve it by deleting the polices folder from the windows\winsxs folder. Of course i renamed the folder instead of deleting. Next i retried the installation of the .net framework. And i get what?… You guessed it, the same error. After hours of search i found light at the end of the tunnel. This bright fellow here,
realized that if you had the .net framework 4 installed while trying to do an update on a previous version it would fail.

And once i uninstalled the .net framework 4 using the .net cleanup tool from here, everything worked just fine.

Below are all of the useful links i found for this problems:

http://da.mned.co.uk/2012/04/error-25007-error-occurred-while-initializing-fusion-setup-could-not-load-fusion-with-loadlibraryshim-error-0×80131700/

http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/47c93410-2ee2-4dd1-812a-04475d50de7c/

http://blogs.msdn.com/b/astebner/archive/2008/08/28/8904493.aspx

Posted in Uncategorized | Tagged , , , | 1 Comment

Blurb of the day: Data Retrieval from Sybase using .net

If you ever need to pull data from a sybase database and you are using .net to accomplish this task, you will need download the sybase developer kit for the version in which you are attempting to use. Now i may edit this but i have now found the new versions of the developer kit to be compatible with the older versions. Once you have the developer kit downloaded you will be able to utilize the .net dll’s that accompany the package and then use your connection string to connect back to the database. The best source for connection strings is http://connectionstrings.com/

Posted in Uncategorized | Tagged , , | 1 Comment

Deciphering the Database

Data migrations for one systems to the next are always a bit tricky. The level of involvement can be minimal. The small things like already knowing where certian tables are located or even using a sproc/view that can get you the requested data in an instance make some migrations as easy as pie.

On the other ther hand if you dont have help from the other party(whatever the reason may be) this is where the process can get somewhat time consuming. If this is the case you are stuck with days (possibly weeks) of data analysis before you can even start to understand the complexity in which they have structured their db. While specifc table names that denote what a table does or the data that it holds can come in handy it can also be misleading. A good db will have a lot of comments when the structure is complex. This can help tremendously. If this is not the case then you can just start at the sprocs(stored procedures).

Starting with the sprocs will allow you to see the naming conventions they use and also the manner in which they pull data themselves. This can be a great starting poing for that reason. Once you have a somewhat small grasp on whats going on or even if they dont have any sprocs, the next place you go is into the Views.

The views will be your best friend through it all. The views will allow you to see the matter in which the data is connected. The point of a view is usually for the end user to use. In this case it will be the data they want to see in the way in which they have requested. Using the create sql for the view you should be able to back track to the actual tables that are a part of it and see how everything is linked together. Once you have those links it should be simple to start creating your own sql statements to pull the required data from the database.

You can also use the functions to see if there is anything to help you decipher the structure also.

If once you are done you have the info you were looking for then you have successfully reverse engineered the database. (It helps to some how be able to verify the data in which ou have retrieved from the database.)

Posted in Uncategorized | Tagged , , , | 7 Comments

Native Boot A VHD, from not working to working

To remedy this issue with my VM performance in my previous post.  My coworker suggested i take a look at scott hanselmans blog at the Booting from a VHD post. This was a great post and I never had any idea that this was even possible. So i converted my vmdx(or whatever the vmware hd format is) back to a vhd and then went to making the changes to the boot partation using bdedit that were suggested…..

c:\> bcdedit /copy {current} /d “myVHD”

Copy the CSLID that is displayed and then run…

c:\> bcdedit /set {CLSID} device vhd=[C:]\vhds\vhdname.vhd

c:\> bcdedit /set {CLSID} osdevice vhd=[C:]\vhds\vhdname.vhd

c:\> bcdedit /set {CLSID} detecthal on

This didnt work, but upon further looking i found this. It used the bdboot command instead.I ran this command and then it booted right up into my server 2012 vhd.

I must add that i used the disk managment tool to attach the vhd in my 32bit host first and i gave it a drive letter of p. Then i ran the bcdboot (driveletter:\windows) command and it worked.

ex.
bcdboot p:\windows

This created the boot entry and did all the setup that was needed. I restarted the computer and booted from the new entry.

Dont forget to backup your boot partition first.

Backup:
bcdedit /export c:\BACKUPBCD

Restore:
bcdedit /import c:\BACKUPBCD

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Windows Server 2012 64bit VM on 32bit Windows 7 Host, Azure Testing

I’ve been doing a lot of work with azure lately. Its been fun but annoying at the same time. The fun part is putting the apps in the cloud and watching the magic happen. The annoying part is when developing on a 32 bit machine and everything works fine in the emulator, but then moving it to the 64 bit azure cloud and not getting any useful data back about why your service or app isnt running.

As first i was at a loss because even with all the debugging and blobs enabled it wouldn’t tell me the error since the service never actually ran. Then i got the smart idea of loading a 64 bit server in a VM on my 32bit host machine…. While this was a good idea I had some inital issues. The first thing i did was saw there was a RC for Server 2012 available on MSDN. So I downloaded the VHD for Hyper-V, Even though im not using Hyper-V, and started to fiddle. This is when the issues started to arise.

1) Virtual PC, Doesnt like 32bit host running a 64 bit guest. -sooooooo alright then. Moving on.

2) Virtual Box, Can load a vhd image without any changes. YAY, i thought but it kept crashing on load.

3) VMWare Player. worked like a charm. I had to convert the vhd to a vmdx or whatever it was but it worked out fine.

With the third option i went ahead and loaded visual studio on to the machine and also sql server management studio and everything was great. Since we use source control i just connected to the TFS server and then loaded my project, then their it was….The dreaded error that i was using 32bit dlls with my production 64bit service. It never occurred to me since it was working fine on my 32 bit machine. While this worked well for a while sharing my ram and CPU between my host and my VM became an issue. My performance suffered on the VM drastically the more i worked. So I naively booted instead from a VHD. The trials and tribulations of this will be in the next post.

 

Posted in Uncategorized | Tagged , , , , , , , | 2 Comments

Small annoyances with IE on windows server 2008 R2

So today i had to setup a VM to do some azure testing. Well this is all simple until IE’s enhanced security come into play. I logged into my MSDN account to download visual studio to the machine and the addon wouldn’t let me. After making sure everything was enabled i will still stumped because nothing worked. Well after noticing i was adding a lot of sites to the safe list, i saw when i clicked the button it was attempting to access a site within the MSDN domain but with an https protocol. So i added the https://*.msdn.com to the safe sites and magically everything worked. While the length of my frustrations were short it was still a annoying. So if i can save anyone else from this momentary annoyance i have done my good deed for the day.

Posted in Uncategorized | Leave a comment