Sadaf Mansuri’s Blog

August 17, 2010

Visual C++ Debug Error - Microsoft.VC80.DebugCRT could not be found - SidebySide Error

Filed under: Uncategorized — admin @ 11:58 am
I am always affraid of programming in vc++. After long time (8 years) it happen to look at VC++ application for some enhancement. When I loaded project in Visual studio 2005 and tried to dubug, I got error
“The application failed to initialize properly (0xc0150002)”.
Well its scary message with some Hax value. I search for the error and found read lot of blogs and look like error is very serious. I usually don’t try to follow one solution but first I read couple of them and then I decided what to do. There were many different solutions to this error. I read this article
and found that VC debug need following files.
msvcr80d.dll,
msvcp80d.dll,
msvcm80d.dll.
I got it from my VC installation directory and copied to system 32 folder and rebuild project and it worked. I solved it by myself :-). Sometime (or most of the time) solution is simple and we looked at complicated things and get scared.

Microsoft Web Platform Installer

Filed under: Uncategorized — admin @ 11:57 am

Microsoft has started providing one installer for all like wamp and xamp.

http://www.microsoft.com/web/downloads/platform.aspx

It’s in beta and it install following in one go

Popular Web Apps

Install free popular ASP.NET and PHP web apps such as DotNetNuke and WordPress.

.NET Framework

Install the latest version of the .NET Framework. This includes everything you need to work with ASP.NET.

IIS and Extensions

Install the latest version of IIS, including latest IIS Web extensions like IIS Media Services.

SQL Server

Install the latest version of SQL Server 2008 Express. This includes both the database engine and tools.

Visual Web Developer

Install the latest version of Visual Web Developer Express, Our full featured free web development tool.

Extra and Goodies

In addition to everything above, the Web PI also includes the latest community version of PHP for Windows.

Back to Hotmail

Filed under: Uncategorized — admin @ 11:57 am

I started using hotmail after long time (may be 4-5 years) and very much impressed with it. I specially like functionality of everything one place. Flickr like photo album, Skydrive to store you data, Spaces for blogging, Social networking and yes email and much more. Recently I lost my data and all pictures and now trying to recover from different places so now uploading all pictures to skydrive. It allows to download whole album as zip file which is great. There is desktop tool for everything which is quit helpful. Another feature I like most is, I can add more email addresses and check all mail at one place. Great!!!

XMLDocument to string

Filed under: Uncategorized — admin @ 11:56 am
I need to save modified xml in xmlDocument to string variable. Surprisingly, there is no easy way to do it. This is what I found and working
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Xml.XmlTextWriter tr = new System.Xml.XmlTextWriter(sw);
xDoc.WriteContentTo(tr);
string xmlstring = sw.ToString();
tr.Close();
sw.Close();

xDoc is my xml document.

Error - The web services enumeration components are not available

Filed under: Uncategorized — admin @ 11:56 am
If you get error message - The web services enumeration components are not available. You need to reinstall Visual Studio to add web references to your application
goto start menu-> run and run this command

Abstract class v/s interface

Filed under: Uncategorized — admin @ 11:52 am
One of my friends asked me difference between abstract class and interface and after so many years of practical experience, I was able to answer only one or two things. I started reading article about it and try to list out more and more points about it.
Interface
  • It is a contract not a class, so cannot instantiated. You can inherited class from multiple interface.
  • It is not whole entity but part of entity behavior.
  • Once you create interface and thousand of classes inheriting, you cannot change it. If you change, all the classes needs to recompile
  • If you change interface, all classes inheriting it, should also make changes accordingly
  • Try to create interface with at most one contract. For more contract, create inherited interface. For e.g. IEnumerable, ICountable and if need both, create inherited interface ICollection : IEnumerable, ICountable. This is not kind of rule but best practice to use interface.
  • Use interface carefully. You design will not be flexible.
  • If a class is not a type of another class but they have common function, use interface.  Example: FullTimeStaff and Customer should not come from the same base class but they may have common function, e.g. discountRate; in this case, interface is more appropriate.

Abstract Class

  • It is class with implementation or without implementation. It cannot instantiated but can inherited. You cannot inherit multiple abstract classes.
  • It defines whole entity. If you need default implementation for all inherited classes, use abstract class instead of interface.
  • With all empty methods, Abstract class is same as interface
  • You can make changes in abstract class and inherited class will work fine most of the time without recompile.
  • Good thing is , you can add functionality from it and all classes inherited from it will automatically get that functionality.
  • Bad thing is, inherited class can assume wrongly that this method is implemented in base class but it might be possible that it is not implemented or implemented differently.
  • If a class is a type of another class, use abstract class because abstract class is for inheritance.  Example: PartTimeStaff and FullTimeStaff is a type of Staff.

Here are some recommendations to help you to decide whether to use an interface or an abstract class to provide polymorphism for your components.

If you anticipate creating multiple versions of your component, create an abstract class. Abstract classes provide a simple and easy way to version your components. By updating the base class, all inheriting classes are automatically updated with the change. Interfaces, on the other hand, cannot be changed once created. If a new version of an interface is required, you must create a whole new interface.
If the functionality you are creating will be useful across a wide range of disparate objects, use an interface. Abstract classes should be used primarily for objects that are closely related, whereas interfaces are best suited for providing

Migrate your sql server 2000 database to oracle

Filed under: Uncategorized — admin @ 11:38 am
Few days back I was in need to convert sql server database 2000 to oracle.  Sql database was having plenty of tables and stored procedures. Oracle migration workbench did it properly. I came across some of the issues while working on it. Here is steps to do it.
steps
Install oracle sql developer migration workbench
Install sp3 for sql server and update for jdbc
Microsoft SQL Server 2000 Service Pack 3a
SQL Server 2000 Driver for JDBC Service Pack 3
Follow the steps from documentation from oracle

Windows service setup creation - Custom Action

Filed under: Uncategorized — admin @ 11:36 am

created one windows service and then create setup for it. It was very simple setup and I check everything. When I tried to install, it was not showing in services. I can install it through InstallUtil.exe but not showing through installer. Later I found that I have to add custom action. I thought I don’t need any custom action but after adding it, it works fine. Installer is installing service and showing in services.

How to see which ports are currently in use

Filed under: Uncategorized — admin @ 11:35 am

We were having around 10-12 win services which are using ports to communicate with each other. we always need to see which ports are currently in use. I am using this command to see it on command prompt.

NETSTAT

Just wanted to keep it here so I won’t forget when I need it.

Update: use this tool to view open ports

TCP view for windows

http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx

order of parameter while calling oracle stored procedure from odp.net

Filed under: Uncategorized — admin @ 11:35 am

I found strange behavior while calling stored procedure of oracle through odp.net. I have store proc which has first parameter as output parameter. (Generally output param should be last but this is my company’s recommendation to put OUT first then IN/OUT and IN ). While building parameters, when I add output parameter as last parameter, it gives me wrong result.

in oracle I have procedure…

procedure GetValue(p1 out number, p2 in number, p3 in number)

adding parameter to command object

m_Params = new OracleParameter[]
{
MakeInParam(”p2″ ,OracleDbType.Int32,16, v2),
MakeInParam(”p3″ ,OracleDbType.Int32,16, v3),
MakeOutParam(”p1″ ,OracleDbType.Int32,16)
};

MakeInParam and makeOutParam are my own function which is creating param object and returning

OracleCommand cmd = CreateCommand(”GetValue”, m_Params);

cmd.ExecuteNonQuery();

When I am keeping Out param last on list, I am getting wrong value. instead of 1 I am getting 0. when I am keeping Out param as first on list, I am getting proper value.

m_Params = new OracleParameter[]
{
MakeOutParam(”p1″ ,OracleDbType.Int32,16),
MakeInParam(”p2″ ,OracleDbType.Int32,16, v2),
MakeInParam(”p3″ ,OracleDbType.Int32,16, v3)
};

It should consider parameter name while returning value instead of its order.

Older Posts »

Powered by WordPress