Archives

Archives / 2004
  • Is your IDE screwed?

    I recently uninstalled some non-functioning VS.Net add-ins, that really screwed up my IDE and i started getting these messages on build
     
    "Load of property 'AllowUnsafeBlocks' failed."
    "Load of property 'ApplicationIcon' failed."
    "Load of property 'AssemblyKeyContainerName' failed."
    and so on...
     
    All projects got the Output type set to Application and ofcourse i could not build, the csproj files were all ok so obviously it was the IDE that was screwed and this just one week from release ... aaargh!!
     
    Anyways if you ever face this problem this link saved my butt
     
    Basically what you need to do is register csproj.dll all over again
     
    The suggested solutions were
     regsvr32 "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\vcpackages\csproj.dll"

    regasm "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\PublicAssemblies\VSLangProj.dll"

    devenv /resetskippkgs
     
    The first one worked for me.
     

  • Damn CS-RCS

    Yesterday, i installed CS-RCS from ComponentSoftware, i was looking for a configuration management component which we could integrate into our product which needs to support document versions. ( I still haven't found any suitable candidates) So anyways i try to open the solution today and it says that source control status is invalid. After beating my head for one hour trying to figure out what was wrong with VSS i saw that the repository selected was CS-RCS...aaargh, the least these guys could have done was provide a SCC switcher like these guys and this guy and this guy and this guy have already done.  Is that too much to ask? (Even i didn't know there were so many options before i googled)

    It turns out that CS-RCS changed my SCC provider to CS-RCS now to restore it i had to execute ssint.exe from vss\win32 folder and i could access source control now. But the episode was really nasty, especially  coming from a company that makes configuration management tools. So if any guys from ComponentSoftware are listening,  please provide a SCC switcher or atleast restore the previous one on uninstallation.

  • Differences between OleDb and Sql in ADO.Net

    I usually develop applications that use SQL server so i never really had a chance to work with Access DB before. So yesterday i had to write some data to an access DB and i thought how different can it be. So i set up my queries and parameters as usual, althought it felt a little strange having to write SQL code in VS.Net :) , and i run the app and obviously it bombs. That was expected but the error was a little strange what is got was "Data type mismatch in criteria." hmm...so i look up my OleDbTypes that i have setup for my params seemed OK to me.

  • Build Management in .Net

    I recently had to do some research on build management techniques for .Net. Atleast till MSBuild comes out with VS.Net 2005, the existing tools available from MS are not upto the mark. Here are some intresting links and tools i came across

    http://www.theserverside.net/articles/showarticle.tss?id=NAnt
    http://www.15seconds.com/issue/040621.htm
    http://radio.weblogs.com/0106046/stories/2002/08/10/supportingVsnetAndNant.html

    Slingshot is a tool that converts .sln files to NAnt build scripts ,it is part of the NAntContrib project, there are some great tools
    for NAnt in this project
    http://sourceforge.net/projects/nantcontrib

    For continuous integration
    http://hipponet.sourceforge.net/
    http://cruisecontrol.sourceforge.net/

    Team Development Guide from MS and MSBuildIt
    http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=94FDB8C8-5A87-4545-AF75-6053F32C7ECA
    http://www.microsoft.com/downloads/details.aspx?FamilyID=b32497b0-77f7-4831-9c55-58bf3962163e&DisplayLang=en

  • Two great tools

    Came across two great tools today

    1. NUnitForms - Want to do unit testing for WinForms, this project is for you. Start contributing.

    2. BKResizer - I one problem i always faced with WinForms development was resolution independence. BKResizer solves that problem for me, and is not to hard on my pocket either,

  • The x86 Prayer

    Found this amazingly geek goody on Matt's site ( Shame on you if you don't know who he is) . I was literally ROTFL after reading this,

    Our Caller, who art on the stack frame
    Hallowed be thy Parameters
    Thy Address Space come
    Thy I/O be done
    In Registers, as it is in Memory
    Give us this day our periodic timeslices
    And forgive us our page faults
    As we forgive those who pass invalid parameters
    Lead us not to unconditional JMPs
    But deliver us from segment registers
    For thine is the Address Space, the Registers, and the I/O ports
    Jmp $
    Ret

  • OpenWave Mobile SDK

    If you are into developing mobile applications, you might want to take a look at the OpenWave Mobile SDK . Deepak Gulati was using it in the TechEd 2004 session held in delhi. It seems to have some nice emulation features.

  • TechEd 2004 Delhi, India

    TechEd 2004 was held in Delhi from Aug 25-27. We had planned to organize some community evangelizing for our user group (Delhi .Net SIG) at TechEd. To be honest things didn't work out as planned, most of the time was spent on the Passion Quotient contest, which was basically all about WindowsXP SP2. We gave away some cool SP2 watches but didn't get too many new members for our community.

     
    The event itself was great, got to look at a lot of cool technology coming out of Redmond. Here is a day by day summary.
     
    Day 1
    We started out with a keynote address that was basically Microsoft's vision for the next 5 years. The slides that we saw in the keynote were to be standard in all sessions. Strangely there was not much talk about Longhorn, but more about Whidbey and SQL Server 2005.
     
    The first session was about Visual Studio Team System, the whitehorse designers totally blew me away, If it is implemented as well as it is visualized this could be a killer. The class designer with complete round trip engineering support was cool. Debug Visualizers are a great addition. Also the project properties can now be used to configure a lot more stuff like security and deployment via ClickOnce (more on that later).
     
    The next session was on the new features in the CLR by Tarun Anand. Tarun at TechEd 2004 The SQL-CLR integration is a great new feature. I will be exploring that in the coming days and hopefully should be able to post some info on that. Other than that Tarun also talked about generics.
     
    Next up we had a session in which the new WSE 2.0 features were discussed, there is some really good stuff coming out of redmond in this field. I was especially impressed with WS-Transactions, if that gets implemented it's going to be absolutely great.
     
    For the next session, i switched from the developer track and attened the DBA track on SQL-CLR integration. Mahesh Prakriya was such a wonderful speaker and gave some very good insights into why some things are implemented in a paticular way inside SQL-CLR. One intresting thing to note is that currently to host the CLR in your app, you need to implement 4 COM interfaces, in CLR 2.0 there are about 50 interfaces available to runtime hosts to minutely control the behaviour of the CLR!
     
    Day 2 The day started out with a session on BizTalk server 2004. BizTalk is one helluva good product and i am looking forward to working on it.
     
    Next up was Tarun again with ClickOnce, which is basically an attempt to give smart clients the ability to automatically update themselves. Well there is nothing radically new in the implementation, i will be writing more about this technology in a different post. But one thing that struck me was the inability to do incremental updates, which IMHO is a very serious disadvantage. Also some initial inspections showed that the app was getting installed not in 'Program Files' but in 'Documents and Settings' Folder.
     
    Next Deepak Gulati (Developer Evangelist, Microsoft India) gave a nice talk on mobile app development with VS 2005. The unified control architecture for mobile controls is a good idea and will help in reducing development headaches across various mobile platforms. The demos for this session were among the best at TechEd 2004, illustrating the concept and ease of the technology very well. Hats off to Deepak.
     
    The last session fo the Day was ASP.Net data controls by Vinod Unny, the new controls that ship with ASP.Net 2.0 are so cool. Easy to use, easy to configure, consistent architecture. This is what makes it such a joy to develop with MS technologies. Unfortunately VS.Net simply refused to work and we were unable to see some of the demos, nonetheless a great session.
     
    Day 3
    Day 3 was the hands - on lab, i had registered for the VSTS lab and got to work for 3 hours on the new VS 2005 class designers and whitehorse. I must say the product was surprsingly stable for a Beta 1, although some bugs were encountered.
     
    In general my feeling about TechEd was that it was too much marketing. I mean this is supposed to be meant for developers, not for managers who have to sell this technology to their bosses. My eyes start to glaze over after going through 3-4 ppt slides, have more demos please, code speaks volumes more than a ppt can. If anyone from MS is reading this, please have more demos, don't show us abstract ppt's show us concrete code.
     
    Well we got SQL Server 2005 Beta 2, VS.Net 2005 Beta 1 and ISA 2004 Beta 2, RC1. I have already installed whidbey on my Virtual PC 2004, looking forward to exploring the new technologies. Also i was unable to install SQL Server on my VPC, the error message indicated that SQL Server and VPS were not compatible, so i installed SQL Server Express edition instead.

  • Rapid Data Forms Development

    I discovered a quick and dirty way to manipulate DB tables using .Net Windows forms. "Drag and Drop"
    1.  Drag a table from "Server Explorer" and automatically get a connection and dataAdapter object
    2. You can use the dataadapter object to generate a typed datasets
    3. Drop a Datagrid on the form and and set it's datasource to the dataset
    4. Couple of buttons 4 lines of code (bit more if you want lookups as well)
     
    and you got yourself a pretty neat data entry form for that table.
     
    Average time to develop per form 5 minutes.
     
    Also the "Data Form Wizard" is pretty neat too, the only limitation being that it can't seem to handle multiple tables.
     
    Another useful trick is the Connection and DataAdapter wizards (when you drag connection and adapter objects onto your form) which allow you to generate completely customized objects.
     
    Looking forward to seeing what improvements are in store in Whidbey.

  • Identity Crisis

    I had  been trying to connect my laptop to my home pc using a cross cable for so many days. Finally yesterday i decided to get it done no matter what.  The problem was that despite all  proper TCP/IP settings the two computers were not able to ping each other. I cleared my ARP cache, reinstalled the cards, changed subnets and IP addresses but to no avail. The green light was flashing on both cards and yet somehow they could not ping each other.
     
    Well after going through all the settings again and again and again, it finally hit me, both comps were named 'Sijin' , that might be causing the problem. So i renamed my home pc and after a reboot i had two way pinging wooooooot!!! :D :D
     
    Moral of the day : Give your babies seperate names.

  • ADO.Net powertoys

    Shawn Wildermuth aka ADO guy has a great book on ADO.Net called Pragmatic ADO.Net. It's a definite must read for anyone involved in ADO.Net programming, i have been working with ADO.Net for over a year and yet the book taught me so much, a definite buy. Also i recently used the ADO.Net powertoys to generate my typed datasets. That works great too. Basically the problem is that the methods that the normal typed dataset generator generates are not virtual so if you override the typed dataset then it only hides the base class methods. The ADO power tools has a Typed Dataset generator that defines the methods as virtual and offers other customization abilities. Other than that it has a Utility library of DB functions and a stored procedure generator.

  • Binding problems

    I recently came across a problem in a GUI i had designed. The UI was data bound to an object, now when the user entered some text in a textbox, the change only got propogated back to the object when the user moved the focus away from the textbox. Not acceptable!!  plus if the user happened to press the toolbar save button or use keyboard shortcuts, the value in the textbox was not saved back to the object.
     
    The problem is that by default, data is written to the source only when the validating event of the control fires.
    The solution i used was to derive a custom textbox
     
    public class FastValidatingTextBox : TextBox
     {
      protected override void OnTextChanged(EventArgs e)
      {
       base.OnTextChanged (e);
      
       Binding binding = this.DataBindings["Text"];
       if(binding == null)
        return;
     
       binding.BindingManagerBase.EndCurrentEdit();
      }
     }
     
    Using this class as soon the text changes the value gets committed back to the object.

  • These controls rock

    Divil has updated his excellent UI controls for .Net. These controls totally blew me away, much more easy to use and way better looking than some commercial controls, and the prices are simply amazing. It's free for non-profit use. The controls include Menu and toolbars which can be docked to any side and have custom renderers, Docking window controls, outlook bar etc. This guy is really a guru of windows forms control development.

  • Interfaces can be both value and reference type

    Yesterday someone posted a message on our user group asking if interfaces were reference or value type. Initially i thought reference type, but then i thought that since value types can implement interfaces too, it needs to be a value type as well.
     
    I wrote a small code snippet and used propertyGrid control to get visual results :)
     
    public interface ITest
     
    {
     
    }
     
    public class TestClass : ITest
     
    {
     
    }
     
    public struct TestStruct : ITest
     
    {
     
    }
     
     
     
    Here TestClass is a Ref type and TestStruct is a Value type.
     
    i wrote this code in the Form_load event
     
    private void Form1_Load(object sender, System.EventArgs e)
     
    {
     
    TestClass tc = new TestClass();
     
    ITest itc = (ITest)tc;
     
    propertyGrid1.SelectedObject = itc.GetType();
     
     
     
    TestStruct ts = new TestStruct();
     
    ITest its = (ITest)ts;
     
    propertyGrid2.SelectedObject = its.GetType();
     

    }
     
     
     
    When i ran the propertyGrid showed that
    itc.ValueType is 'false' and its.ValueType is 'true'.
     
    So interface has the same semantics as the type that implements the interface.
     
     

  • My session for Delhi .Net User Group

    July session of Delhi .Net UG
     
    I did  session on advanced data binding in the Windows Forms. Basically i talked about how to setup two-way databinding in Windows Forms, implementing custom collection classes which implement IBindingList. Also i talked about implementations of  IDataErrorInfo, IEditableObject etc. The session was well liked by everyone (I think :) ). Here is the source code for the demo.
     
    One thing i realized while making the presentation for this demo was that Data Binding is basically an implementation of the MVC architecture for .Net basically the framework is provding the interface for the controller part of the MVC architecture, the model is our object and the views are the forms.
     
    It was my first talk at a UG meeting and i really enjoyed it. I met the manager of our group Saurabh Verma(an MVP) again, it was Saurabh who had invited me to give the talk. Also i met a lot of core group members of our user group. It was nice to meet so many fellow developers. Being an independednt softwae developer i don't get to meet many of them. :) Looking forward to giving a presentation this month also.

  • Pop Quiz

     public class MyBase
     {
      private string _foo = "Hello World";

  • CVS .Net

    It's been 2 weeks since i switched my SCC provider to CVSNT http://www.cvsnt.org . It has solved a lot of problems that i had before when i wanted to work on a new release but still maintain the old codeline for bug fixes and patches. Now using the branching capabilities of CVS i have two codelines life is much easier.

  • CVSNT and VS.Net

     Finally got decided to switch source control to CVSNT http://www.cvsnt.org , I have been using VSS for a long time now, but my project requires some advanced branching and release management. I evaluated Perforce, which looks like the best, although it is free for 2 users it costs 750$ per user for more, so I decided to give CVS a shot.

  • Bug or Feature

     A strange thing happened today, I was implementing a small security package for my app. The project file was called Security and it created a Security.Dll file as output. I compiled and ran and BOOM no connection to the database!!! … I am thinking how can adding a new module totally unrelated lead to DB connectivity problems…So I do the usual checks, network connectivity, name resolution, I can connect thru enterprise manager, I can connect using SQL authentication. It seems that when I try to connect using SSPI I get the exception “Cannot initialize SSPI package”….Oh Boy…I am thinking corrupt memory, hard disk what could have happened, is my .Net installation corrupt?...So as any good windows user would do..i reboot…no help…problem persists. Its been an hour and I have only allocated 30 mins…someone suggests trying an earlier build….i think..well let’s give it a try..Viola it works…Light goes on…it has to be the security module, because that is the only change….i change the name of the project output to XXXSecurity.Dll and it works. Problem solved!! What a rush…Ahhh the joys of fixing problems.