Tuesday, December 21, 2004

Console application with ADO in Delphi

I am working on this project which need little plug-in to be written. Main thing is that the plugin should be console application and must have database access support. So, I started writing a code in Delphi but couldn't get things work properly. No matter what I tried, I got memory access violation. With little research, I found that CoInitialization is needed to be called before any ADO component is initialized and used. Below is the source of sample console application with ADO support in Delphi;
program Project1;


 conMain : TADOConnection;
 tab1 : TADOTable;

 conMain := TADOConnection.Create(nil);
 tab1 := TADOTable.Create(nil);

 conMain.ConnectionString := '{your connection string here}';
 conMain.LoginPrompt := False;

 tab1.Connection := conMain;
 tab1.TableName := '{your table name here}';
 tab1.Active := True;

while not tab1.Recordset.EOF do begin writeln(tab1.Recordset.Fields[1].Value); tab1.Recordset.MoveNext; end;

CoUninitialize; end.

Monday, December 13, 2004

My first PHP application

Since I am a delphi lover, I haven't got chance to develop serious application in it. Instead, I had to learn new things. First of all, we had this project in C#. Now, I had to work on PHP. But, the PHP project was really interesting. The main objective of this project was to parse various XML files and update MySQL database. Also, to develop web front end to implement search function. This project was actually a part of www.shoes--boots.com site.

Monday, November 29, 2004

First impression of Delphi 2005

Last week, I downloaded trial version of Delphi 2005 and played little bit. I must say, this is the version of Delphi everybody was waiting for long time. With multiple personality, it supports Delphi.NET, Win32 application and even C#. I was only able to explore ASP.NET part of it and everything work fine. I opened my Delphi 8 project 'worklog application' in Delphi 2005 and compiled. No problem! everything went smoothly. Also, tried opening and compiling my old Delphi 7 Win32 project in it. Worked find. I even tried refactoring tool in this project. Greate feature! Again, opened C# project written in C# Builder. Worked fine again! What to say now? I read few post about bugs in Delphi 2005 but couldn't reporduced any of them in my machine. I need to explore so many things in this version. Let's see how many bugs I will find. ;-)

Thursday, November 25, 2004

Size does matter

Size may not matter everywhere but when it comes to application file size, it does matter. I was working on a small encryption routine for my pet project. I decided to put this routine in an assembly so that it can be used for other application also. The assembly is to be written in C# language and development tool was Borland C# Builder. Simply, I created a project in C# Builder and added 2 .cs files, wrote a code and compiled it. The resulting assembly (.DLL) file was 7.5 KB big. Simple! Worked everything fine. Now something came to my mind and I fired up MS Visual Studio.NET. Created a project and added those 2 .cs files to it. Compiled it. Now what I saw was really surprising. This time assembly was about 20 KB big. I double checked everthing in both dev. tool for file count. Both projects had 2 .cs files. Now, can somebody tell me what is happening? Why VS.NET is producing bigger file than C# Builder? I am still confused !

Tuesday, November 16, 2004

What's new in Delphi 2005

Bob Swart wrote article about Delphi 2005 new features, including IDE and compiler enhanchment.

Monday, November 08, 2004

Error handling in ASP.NET

I've been doing some research on error handling in ASP.NET. All I wanted to show error detail in custom page instead of giving user Microsoft's ugly page. The sample code I found was using VB.NET, another ugly thing. In VB, there is some thing called shared class, which can not be implemeted in C# or Delphi. Using this shared class, whole exception can be passed to custom page, but it is no use for me. Then I found a sample code, which is also in VB, but gave me clue how to achieve things I wanted for long. I used HttpContext.Current.Response.Write() method to give output. So, I wrote a library to handle all the errors generated in my application. Written completely using Borland's C# Builder, this library can be used with other ASP.NET application. I am planning to write an article on error handling and post it to codeproject.com along with source code of library.

Wednesday, October 27, 2004

Dashain is over

Dashain is over and we are back at work! Although Dashain is our great festival, I enjoy it very little. It is no more fun as it used to be before, when we were child. When we were in school, we used to get full month of holiday. Then, we got 15 days off in collage days. Now, it's only 5 days. Damn! :-( Also, people are not in festive mood as political situation of Nepal is not so good.

Tuesday, October 19, 2004

Festiv Season

It is festival season in Nepal. It's Dashain! We will be on vacation from 20th to 26th of October. But, I will be working on my pet project 'Worklog Application' at home. My target is to finish it by the end of the vacation.

Sunday, October 17, 2004

Popup calendar component

I was looking for good calendar component for my pet project, which must have feature to show calendar with pop-up. ;-) Googling gave me several links. Some of them were javascript based and some were written in C#. None of them were promising. While looking into some more links, I came to know about this site. Along with calendar componet I was looking for, there are several interesting components in this site. Also, there is a deployment tool for ASP.NET application known as 'Unleashed It'. Above all, every thing is FREE, except source.

Thursday, October 14, 2004

Delphi 2005 announced!

Borland has announced Delphi 2005, new version of Delphi(code name "DiamondBack"). According to press release, it is expected to ship in Nov. 2004.

Monday, October 04, 2004

Change image on condition in Datagrid

In my ASP.NET pet project,there is a page where list of users is shown in a datagrid. I wanted to have one column showing active status of users. I mean, if user is 'active' the grid will show color image. Similarly, if user is inactive, it should be represented by gray version of same image. Google was not able to find the solution(may be, search word was wrong). There was one forum where question was asked for this kind of functionality. Sad but truth, there was NO answer. So, I moved forward with other work in same project. After few days, while I was working with Repeater control, I had to look into it's help. My eyes stopped at a sample code for ItemDataBound event. That code gave me an idea to change column value at runtime. What you will see below is a code to show image in datagrid's column which change according to condition. First, insert an image in itemtemplate section in .aspx as shown below;

      <asp:image id="imgActiveStatus" runat="server"/>
Then, write a code for ItemDataBound even for grid as below;

if (e.Item.ItemType = ListItemType.Item) Or
   (e.Item.ItemType = ListItemType.AlternatingItem) then
    if DataBinder.Eval(e.Item.DataItem,'Active').ToString = 'True' then
      (e.Item.FindControl('imgActiveStatus') as Image).ImageUrl := 'images/user_active.gif'
      (e.Item.FindControl('imgActiveStatus')as Image).ImageUrl := 'images/user_inactive.gif';

Friday, October 01, 2004

Delphi 8

I've been using Delphi since it's first version. It is my first and last choice as application development tool. Now, after using Delphi 8, I am little disappointed. Even after installing update 2 and applying unofficial patch, it is messing up my code. I use this 8th version mostly for ASP.NET application. It is only .aspx files that Delphi is messing around. Beside that, I love Delphi 8. I thank Borland for giving Delphi lover like me a chance to develop .NET application using Delphi language. Also, I feel very confident and productive developing ASP.NET application these days. I still have more to look into Delphi 8, namely, BDP, VCL.NET etc. But I think I will be looking all these stuffs in Delphi 9 only.

Tuesday, September 28, 2004

Agile, Scrum.... what next??

Our boss is pushing Agile method while we are practicing Scrum with small project. Also, few are also with pair programming. So what next? Too many things to learn here. Personally, I found scrum method is interesting and worth practicing.

Wednesday, September 22, 2004

Presentation on GNU/Linux

Beside programming, I also do some networking stuff. Administrating office network is my another job. Our boss has started new trend. According to which, everyone will be giving presentation on what they are comfortable with, either technical or non-technical. Today was my turn and I gave presentation on GNU/Linux. Everybody was listening carefully. I talked mostly about administrating GNU/Linux. I found that people were paying their attention more than I expected. ;-)

Friday, September 17, 2004

Good Friday

Since we are free, everybody wanted fun. So, today is party day. First of all, we had special lunch. The reason for saying 'special' to our lunch is, we had really good fish curry made by one of our collegue. Then, we had a beer ;-)! Now everybody is feeling sleepy and wants to go HOME! By the way, I didn't have chance to look into StarTeam Integration with VS.NET.

Thursday, September 16, 2004

StarTeam Integration

I've successfully integrated StarTeam with C# Builder. After installing Microsoft SCC Integration, C# Builder immediately identified the provider and I was already working with the project from repository. This is my first experience with commerical VCS. Really nice to see everything working smoothly. Also, I am monitoring posts in Borland newgroup so that I don't miss anything important. My next task is to integrate it with Visual Studio.NET. In order to explain everything to my friends, I need to understand the whole process, so it is not just integrating and testing. I will be relying on Starteam documentation which is really really good.

Wednesday, September 15, 2004

StarTeam working

After spending few hours with StarTeam manual, I was able to get idea about how things work with it. My aim was to install and configure StarTeam server and client and understand how this software works. After insallation, I tried with my small C# project and really worked smoothly. I have an experience of FreeVCS, so I already know how version control system works. I must say, StarTeam is feature rich but little complicated to understand at first. I will be looking at StarTeam Integration with C# Builder and Delphi 8 tomorrow.

My GMail account

I got GMail account with id milan.np. Thanx to Vicky for invitation. Just downloaded GMail Notifier from google site. Cool application.

Tuesday, September 14, 2004

About DiamondBack

It is understood that Borland is putting more and more effort on making single IDE for Win32 application and .NET application, but I came to know Diamodback(Delphi 9) is also going to support C# as well. This is great news. Also, I got some more info on Diamondback from Nick's Delphi Blog. According to Nick, Delphi 9 will have Refactoring tool, Unit testing tool, enhanced HTML desinger etc. Also, there will be tight integration between IDE and Starteam. Also, it will have Web Deployment Manager to deploy ASP.NET application. Isn't it GREAT? I wonder when Borland gonna release this great software. By the way, congratulation to Nick on getting 2004 Spirit of Delphi award. :-)

Monday, September 13, 2004

Version Controlling

I am also doing some research on version controlling system while updating myself for BorCon. Just installed Borland StarTeam. Seems like very complicated software. It was FreeVCS that made our life easier. But our team need some more. They need a software which can be integrated with development tool. We are focusing on C# Builder so obviously StarTeam will be my first choice. Honestly, I am still happy with FreeVCS. I still use it at home for my pet projects.

Borland Conference 2004

Today is already 3rd day of BorCon. I am monitoring Borcon events from various sources. One of which is Marco Cantu's site. Another is Nick's Delphi Blog.I was really interested in getting more information on upcoming version of Delphi, code name 'DiamondBack'. And guess what? I found it here.

Friday, September 10, 2004

Books I am reading

1) Professional C# (2nd Edition) - Wrox Press - Robinson, Allen, Cornes.... 2) Pragmatic Unit Testing in C# with NUnit - Andrew Hunt, David Thomas

Learning Time

Since we are free, everybody is busy learning something. Somebody is learning 'Agile Software Development', while others are busy with 'Scrum' and 'Pair programming'. I am busy with .NET. ;) I am working on small pet project which is ASP.NET application. With Delphi 8, this project is going very smoothly. Also, I am trying to learn C# , with Borland's C# Builder. Recently, I found this build tool called FinalBuilder. If you want to automate your build, then this is the perfect tool for you. I wish there was a free version of this software.

The Beginning

I've been blogging for a long but this is my first post in Blogspot. My old blog is still here.