Posts

Showing posts from 2008

Online Web Service - How responsive it has to be?

While I was working on a new online web service for my company, the initial idea is to process the request that came in immediately, and have the response to be posted back immediately as well. It does not seems wrong, but in reality this is not a practical way to do. Indeed that nowadays the Internet has given us a lot of freedom in accessing a lot of information almost instantly. Thus, it would be normal to judge in such a way that if I could get my response back within a few seconds, then why i.e. your service can't do it? There are a lot of factors that we need to deal with. In my case, I need to deal with 2 major issues - the time taken to process the request, and the time taken to send out the response. Both are affected by external factor, i.e. mail server, how fast it could send out the email. I used to think that there would be mail server software out there some where that could do something like allowing third party software to do extensive processing, of which case

Online Web Service - What is the best way to develop it?

I've been working with online services since the first day I joined Handisplay. Back then, I was working with classic ASP as the front end, while writing the back end code using Active X (in DLL format) written in C++, my favourite yet hard-to-master programming language. Since then, I've tried to work with different kind of programming languages and technologies: Java Servlet, JSP, SQL Server, MySQL, Linux C++, and now ASP.NET with C#. Looking back since the first day that I stepped into the real world, there are a lot of things that I need to pick up on my own, of which I'm sure everyone would agree with me. What I have learned during my time in university was just basic fundamental, of which it was useful enough for me to expand on it. Though I've heard a lot of people saying that the university should teach certain programming languages, yet the reality doesn't seems to work that way. The reason is simple, as the technology is advancing in a considerably fa

ASP.NET - ReportViewer & Report

In the new ASP.NET 2.0, there is a control called ReportViewer, which could be used to display a report. It provides a lot of in-built functionality that could ease website development, such as sorting, page navigating, printing, and even exporting it into Excel. As mentioned above, ReportViewer is used to display a report. It acts as a container to display a report with RDLC extension (.rdlc), much like a web brower is used to display web page in HTML format. One container can be used to display report file, but it cannot used to display more than 1 report at the same time, unless it's a nested report (report within a report). RDLC is basically a template, where we could drag and drop the desired controls to create our own report. The underlying language is actually XML. The process to develop a ReportViewer is quite straight forward, but it can be very complicated at time as well do deal with. In Visual Studio 2005, the ReportViewer control is placed under the section Data

Setting up Windows 2008 Server

The new Windows Server 2008 installation is pretty neat and tidy. Plus, it's even easier to install as compare to it's predecessor. The installation interface looks pretty nice and it looks just like Vista. Yet, in my opinion, there's 1 major problem. After the installation is completed, it will prompt to enter a new password for the administrator account. Unlike in the past that I could just ignore it or simply type a simple, non-complex password to proceed, this would actually disallow me to enter non-complex password. The kind of password complexity is something like "CoMpleXP0ss3w0rD". Yes, it's as complex as this. There is no way to bypass this page as from my experience.

Include JavaScript source file in ASP.NET 2.0 web page

I was trying to work on CustomValidator control for the past few days and I have finally able to use it without facing anymore major problem (IMHO). During the development, I found out that the <script> tag, which can be used to reference to a JavaScript source file (.js extension), could affect the post back event of the ASP.NET page. I have functions written within a JavaScript source file that would be referenced by CustomValidator.ClientValidationFunction properties. I included the source file within the <head>...</head> section with this line of code: <script type="text/javascript" src="formValidation.js"/> It is technically correct, isn't it? Since we are allowed to do <tag_name/> in the XML schema, so I would expect that this would work. Yes, indeed that my CustomValidator object is able to fire the client-side validation function, but yet the Submit button would not fire its OnClick event. So I tried to search for solut

Develoment with Visual C++

I was trying to write a simple dialog program with Visual C++ just to refresh my C++ knowledge and Windows Programming. C++ is the language that I truly wanted to master, but yet I don't really have any time to sit down and to use it to write program, not even in my work, where I'm using C# most of the time because it is easier and faster to develop a program with it. Yet, I still find that it's very fun to write a program with C++ because of all the extra procedures and rules that we need to follow. During the course of writing that simple program, I encountered 2 things that I need to note it down, otherwise I'd have forgotten about it again. 1 - Adding DDX (Data Exchange) member variable that associated with a control when developing the dialog box program What happened previously when I was learning to write a windows application with MFC from Ivor Horton's Beginning Visual C++, I learned about the usage of DDX member. Yet, over here, I couldn't get any v

VMWare Workstation - 64-bit alert

Virtualization has been such a popular method nowadays to run different operating system in one computer. With this, we could have a Windows Vista desktop that could run Windows XP, Windows 2000, Windows Server 2003, Linux, etc at the same time. This is such a brilliant piece of software engineering. There's a lot in the market nowadays either it's commercial or open source that could do virtualization, even Microsoft is aiming at it too. I'm using VMWare to create a few virtual desktop to host different OS for development and testing purpose. It was fine until recently when I'm trying to create 64-bit virtual desktop. I tried to create a 64-bit virtual desktop on a 64-bit server, a very powerful server (dual Xeon processor with Hyper Threading, 8GB memory), that I thought it should be easy, and again I was wrong. Although it's powerful, VMWare tool that I used was giving me warning that the server could not create the 64-bit virtual desktop. I was puzzled bec

ASP.NET - dealing with Layout & positioning - PART 2

Previously I have dealt with the problem of positioning in the web page. Yet there's another thing that I'd like to deal with, which is to layout the controls nicely. At first I thought of using the HTML table to segment the controls properly, but I have a problem with that. Once it's rendered into HTML, it may looks pretty with IE6 and IE7, but the positioning will definitely out with Firefox because of the absolute positioning. During developing the content page, I drag a few HTML tables into the page, put all into relative positioning, and align them properly. Then, in order to add the controls into the table, I'll just drag the control and move it to the desired table (highlighted with blue frame), and it will align to the top left corner of the table to show that I drag to the right place. Note here, that the controls within the table are all absolute positioning. I can't use relative positioning here because the alignment process will not work. So once

ASP.NET - dealing with Layout & positioning

It is much easier to build a website nowadays with Visual Studio 2005 because Microsoft has made the web development similar to windows application development. Of course, it may still not as good or as rich features as compare to Adobe (if they still have the web development software), but yet for simple development, it's good enough. Using Visual Studio 2005, we could create a master page, which will be the main frame of the page, and we could create as many content page as we want that would reside within that master page, brilliant! (Top Gear word) However, there's 1 problem. While placing the controls into the web page, we could use absolute positioning to move them to the desired location. Then, we could align those controls as well by few clicks. This works well in normal page, but in a content page, it doesn't. The controls will appear on an undesired location once the web page is rendered. In order to fix this, there's another positioning called relative

ASP.NET PostBack event

In ASP.NET, 1 new thing being implemented is called the PostBack event. This is an event triggered whenever there's a response from a user that will need immediate action to be taken on the server side, either be a redirection or disabling some interface control. This is a welcoming event for me because I know how hard it is to make a web page to be user friendly, especially when I need to make all the buttons to be disabled when certain selection is done in JavaScript. It is pretty difficult for me and sometimes certain JavaScript codes don't work on certain browsers. With this PostBack event, I could just write everything in the back end codes instead. Of course, there are some drawback to use the PostBack event as I'd assume, because everytime a PostBack is triggered, the page will be reloaded with the Page_Load event, and there's a communication being made with the server, so the server will be heavily loaded. The thing is, though the server will be heavily load

C# DataSet

I have this experience in C# that although an object is not NULL, if it's an array or a string, it doesn't mean that the length is equivalent to 0. In C# NULL and 0 length are 2 different conditions and both have to be deal with. Because of the above, I've tried to check on DataSet to see if the same would happened. I'm using Stored Procedure and Microsoft Practice Pattern Enterprise Library to get the DataSet. At first I thought that if there are no matching result, than the DataSet should be NULL instead. Then I have a hunch that might not be the case because of the experience that I mentioned above. So I do a check by having the Stored Procedure to check for a result that does not return a matching result. My guess is that although it's empty result, the DataSet will still be instantiated/created by the method. The test result proves my guess, because the DataSet is created/instantiated, and it has a 0 row count. Note that it happens with the Enterprise Li

ASP.NET Response.Redirect & Server.Transfer

Yes, another hurdle of the day that I encountered when I was testing the process flow of a registration website that I was in-charged with. In classic ASP, there are 2 methods that could be used to transfer/redirect to another page: Server.Transfer - What it does is that it will transfer all the state information like Session, Application, and all Request collections to another page, which the page will have the same Session ID as the previous page. Response.Redirect - Another method that would widely be used I believed. This method will stop all processes that are executed and then proceed to connect to a different URL. This method will not transfer the current state to the new URL. The above methods can be executed from the ASP file with ease. Since ASP.NET has both methods provided to us, I would assume that it would behave the same. Yet, I was wrong. ASP.NET is a totally new technology with an ASP.NET page ties with a background code written either in VB.NET or C#. Much like c

Application Center Test & Password Recovery

2 things to cover here since I encountered these 2 issues today at the same time. 1. Application Center Test As those who have used the Application Center Test would probably know how useful it is to use this little simple tool to perform stress testing on web application - either it be a web page for sign in, web service, or web page for document upload. PROBLEM IS: If one is trying to perform stress testing on a web page that does file upload, one will find that the test result would produce a lot of error, and the end product would be a lot of error feedback from the web page. The reason is because when a test is recorded, there will be a possibility that a whole chunk of bytes went missing. It happens when I'm trying to upload a file with 24Kb, and only 5Kb being recorded inside the test script, thus therefore there will always be problem. The possible cause for this could be traced back to the reason that the file is uploaded as text, and because certain files' format hav

Stored Procedure

It is such a painful experience to learn Stored Procedure. It is not hard to create a Stored Procedure if one would know what he has in mind, but the problem is with the program that would utilizes the Stored Procedure. Each Stored Procedure has its own set of input parameters and output parameters. If we are going to create a wrapper object around it, and if the object is not robust enough, it would be forever a process of adding new codes to handle specific Stored Procedure and would IMHO that the code will become unmanageable and chaotic. I have an idea of instead calling the Stored Procedure right away, why not using the power of XML instead? The idea would be complex but it may helps to reduce changes made to the code and make it more robust and more portable. i.e. we could have an XML file that stored the name of the Stored Procedure, the number of input parameters, and the number of output parameters. In return, the object wrapper could just return the result in an XML strin

Note on Programming Practice

I have been attending 2 code review sessions since coming back from Tawau. Here's what I've learned. Put comment into the source code, i.e. what it does, and which function is calling it. Exception handling on HANDLE that could not be closed properly. Code that repeats several times can be put into 1 function. This way, it will be centralized and easy to debug. Pointer must be deleted to avoid memory leak. std:vector can be used instead of fix size array. It is better not to use query all statement to query everything out from the database. strncpy and strncat are safer way to manipulate string. Construct an exception class to throw error instead of throwing number. Don't use too much pointer if can. Database connection must be caught and handled. Have constant localized at 1 place. This way, it makes it more easy to manage. Declare only the functions that need to be interfaced with other class as public; otherwise the rest should be private. Use const keyword to avoid a

ASP.NET 2.0 - Validation Control

I am currently working on converting an ASP page to ASP.NET 2.0 with C#. The reason to convert to ASP.NET 2.0 is because ASP.NET is the successor to Microsoft's ASP technology, which it will replaced ASP for web development. I'm impressed on the amount of things that ASP.NET can do. Basically I can develop a website similar to developing a Windows application, by simply drag and drop the buttons and controls. Yet, as easier as the software development wanted to be, the more complex it will be to learn the new technologies. I encountered problems with the validation controller in ASP.NET, of which I would assume that the Custom Validation control can be used to write my own customized validation procedures. I was right at 1 point, and wrong at the other end. Even though the name implied customize, yet if I tried to develop a validation procedure that's already being handled by another type of validation control, then it will not work. I supposed that the rational behin