Posts

Showing posts from December, 2004

Firefox Extensions

Firefox Extensions are small programs (or plug-ins) that add new functionality to the Firefox browser.

Data Access Application Block

" Application Blocks are C# and VB.NET classes distributed as Visual Studio projects that can be downloaded from Microsoft's Web site and used in any .NET application, including ASP.NET Web applications. Application Blocks were designed by reviewing successful and efficient .NET applications and combining the optimum implementations into classes for our use. As a result, Application Blocks incorporate the current best practices endorsed by Microsoft. However, the greatest facet of Application Blocks is that they are surprisingly well documented. Each Application Block is distributed with complete documentation and source code examples. Even the source code is commented. A pattern is a way to describe commonly encountered problems. For example, many of us have written (or will write) code that authenticates users for access to a Web site. Our tools are frequently the same, username and password text boxes, a submit button and the code that is executed behind the scenes t

Fetch records selectively from XML file by passing dynamic value through XSL

This code snippet called on Page_Load shows how to selectively pick records from a XML file based on a dynamic value passed through XSL and doing a transformation in C# . Needs a little more fine tuning.... XsltArgumentList does the trick! string node = Request.QueryString["country"]; if (node!=null) { XmlDocument docXml = new XmlDocument(); docXml.Load(Server.MapPath("users.xml")); XslTransform docXsl = new XslTransform(); docXsl.Load(Server.MapPath("users.xsl")); XsltArgumentList xslarg = new XsltArgumentList(); xslarg.AddParam("country", "", node); docXsl.Transform(docXml, xslarg, Response.Output); } else

Datetime as Primary Key?

"In general, you should avoid using datetime as a primary key. First, datetime is an 8-byte data type, and narrow keys tend to be more efficient and faster than wider keys. If your table is going to be very large, a smaller integer-based data type, such as the 4-byte int or the 2-byte smallint, might be a better fit. Second, and much more important, datetime is accurate only to one three-hundredth of a second, or 3.33 milliseconds (ms). By definition, primary key columns must be unique, and you can't ensure that you'll have unique values in a datetime column. Your business rules might say that entering multiple records within 3.33ms of one another is impossible, but I think that making that assumption is dangerous. Business rules and technical assumptions can always change." From SQL Mag's 38 Extra Development Tips

Scott Mitchells' Axioms of Programming

Scott Mitchells ' Axioms of Programming Axiom 1: Writing more code leads to more bugs, which leads to a longer development cycle, which leads to higher costs. Therefore, a minimalistic approach should be taken to writing code. One way to write less code is to reuse our existing code. Axiom 2: The longer a piece of code is used, the fewer bugs it contains. The more you reuse existing code, the more you ensure that the code is bug free. The only bug free code is old code.

VB vids

Visual Basic At The Movies brings downloadable videos showcasing ASP.NET Web Development features and resources. There are 101 videos in the collection overall providing VB.NET tips and tricks to both beginners & advanced developers in an entertaining way. The other categories include: Controls Data and XML Deployment How-To Development Environment Language and the .NET Framework

Tip: Tracking HTTP headers

There is a lot of HTTP communication that takes place everytime you hit a URL, a request goes to the web server and the response reaches back to your browser in seconds (if you are having a good day and have a good internet connection). For developers debugging a web application, its really helpful sometimes if you could know what exactly is happening in the background. livehttpheaders and ieHTTPHeaders are two utilities that show you the HTTP Headers on Firefox and IE respectively and even tell you what kind of web server the remote site is using.

Review - MCAD/MCSD Self-Paced Training Kit: Developing Web Applications with Microsoft Visual Basic .NET and Microsoft Visual C# .NET

Image
The book is aimed at Microsoft exams 70-305 and 70-315 aspirants but it's well organized content is also suitable for beginners learning to build .NET web-applications. There are 15 well-planned chapters matching the prescribed Exam curriculum and covering web application development using C# and VB.Net. Breezy, modular, easy to understand. Useful Q&A at the end of each Chapter.

Diagnostics and Logging in ASP.NET

Key points from K. Scott Allen 's article : The ability to record and retrieve diagnostic information is an important characteristic of robust software. Diagnostic information could include the amount of time needed to execute a critical method, the number of transactions committed per second, or the number of users currently with active sessions. The three keys to successful diagnostics include: 1) Making a list of requirements. 2) Matching those requirements to the available diagnostic and logging features. 3) Implementing a layer inside your software to make logging flexible, configurable, and effective. Strategies to choose from: ASP.NET Tracing - ASP.NET has built in tracing capabilities at the Page and Application level Performance Counters - great place for your application to expose high frequency events Event Log - can be both a source and a destination for diagnostic information. Not well suited for high frequency events. Web Logs - usefu

Bane of pop-ups and pop-up blockers

Don't we all hate pop-up windows pop-ups that try to sell us everything from discounted airline tickets to unmentionable-s. There are myriad pop-up blockers now to counter these popping monsters. In fact all browsers now come with in-built blockers. The trouble with these however is that when as a developer you have some genuine functionality to show in a cute child window instead of the parent window itself, it gets blocked too! And the user may be unaware of this.... The javascript below does not prevent a genuine window from being blocked but gives a prominent alert to the user about the blockage. <SCRIPT LANGUAGE="JavaScript"> <!-- function blocker() { mywin = window.open('show.html',"","left=100,top=50, height=600, width=700, statusbar=no"); if (!mywin) alert("A window was blocked. Please disable your blocker or whitelist this website"); } //--> <BODY onload=blocker()>

Code: Programmatically add text to an image

The System.Drawing namespace offers a great deal of functionality that could be achieved only with paid third party tools in ASP earlier. Try the following code snippet. It assumes that you have the image and text with you already... <%@ Page language="C#" ContentType="image/jpeg"%> <%@ Import Namespace="System.Drawing" %> <%@ Import Namespace="System.Drawing.Imaging" %> <%@ Import Namespace="System.IO" %> <script runat="server"> void Page_Load(Object o, EventArgs e) { String FileName = "image1.jpg"; String Message = "Season's Greetings"; Color FillColor = Color.FromArgb(127,255,255,255); SolidBrush FillBrush = new SolidBrush(FillColor); Rectangle FillRectangle = new Rectangle(5,5,310,50); Font TextFont = new Font("Comic Sans MS",20); SolidBrush TextBrush = new SolidBrush(Color.Navy); StringFormat TextFormat = new StringFormat(); TextFormat.Ali

Protocols and Ports - a quick reckoner

1. DNS(Domain Name Service): 53 2. FTP(File Transfer Protocol): 20/21 3. HTTP(Hypertext Transfer Protocol or WWW): 80 4. HTTPS(SecureHypertext Transfer Protocol): 443 5. ICA(Independent Computing Architecture): 1494 6. POP(Post Office Protocol): 110 7. RDP(Remote Desktop Protocol): 3389 8. RPC(Remote Procedure Call): 135 9. SQL Server: 1433 10.SMTP(Simple Mail Transfer Protocol): 25 11.Telnet: 23

Page breaks

If you need to show a web page as a formatted report with page breaks that can be printed, apply the style "page-break-before:always" ... ... <table> <tr> <td>this must be shown in the first page</td> </tr> </table> <table style="page-break-before:always"> <tr> <td>this must be shown in the second page</td> </tr> </table> .... ....