Starting a WebForm Project

    I started working in the DotNet while it was in the Beta stage. Ewe Beta! Since then I discovered there is more than one way to tackle a start of a project and I have perfected it for my purpose.

    I would suggest starting with an empty project rather than letting Microsoft build you one. By you creating an empty project you are able to control what goes in it. The “Web Forms”template that Microsoft offers has so many files and structure that you would likely not even use.
    Continue reading Starting a WebForm Project

Auto-Link Using Regular Expressions

Auto-LinkingI was recently asked if I could automatically turn website text (ex: www.google.com ) into HTML hyperlinks.  My first thought was ah CRAP!  I also wondered why they could not use the link tool in the editor, but they asked so I delivered. With about 5 minutes on Google, I found the perfect solution that worked for me.

Mind you I was working in C# for this, but since it is a regular expression solution; it will apply to virtually any language.  The one change that I had made from the original code was to add in a piece that also auto-linked when the text included “http://www.”.  You may or may not want the extra addition that I had made.

Continue reading Auto-Link Using Regular Expressions

Do Not Get Boxed

As a developer, it is important to look around and experience new things, as it helps you to stay sharp and marketable. This doesn’t mean that you need to quit your job.  Just do not get boxed in as single purpose developer.

It is important not to be just a developer of one kind. Do not just be a PHP Developer, DotNet Developer, or a SQL Developer. Strive to be more than what you are currently doing.

As an example; when I was just starting out as a developer I had two unique jobs. First job was a Visual COBOL Developer and the second job was a Factory Automation Integrator specializing in database and Visual Basic integrations to Allen-Bradley PLC. If I had allowed myself to be boxed into either one of these developer types, I would not have had the opportunities to do more. With the Factory Automation Integrator, I would probably be pumping gas as the firms I used to work for and see around are mostly gone now and who the heck is using Visual COBOL anymore?

As a Web Developer working for a web development firm, you may be asked by a customer to do a mobile application or a windows application to complement their other work you may have done.

I strive every day to learn something new. I learn it until I know it well enough to be productive. I also practice what I have learned in the projects I work on in my spare time. .

In my current job I am a Web Developer, SQL Developer, Windows Developer, Mobile Developer and a Support Specialist.  I have also worked where I had a single focus as a Web Developer at a web development firm, but I stretched myself to do business needs analysis. It is important to be forever evolving as a developer. Just don’t speak of the new technologies. Learn the new technologies and know and practice what have you have learned.

Posting Data From HTML to ASPX

Recently I had a need to have a web site post credentials to another web site.   The first site was standard HTML and the second site was DotNet (ASP.NET).

In this example, we will be passing a user name and password to another site.

Sending Web Site
In your sending website, you will need a log in  panel similar to the one below.

    






Receiving Web Site
In the form load of your DotNet (ASP.NET) site, you will need the following code to get the values from the request object and then pass to your log in routine.

                NameValueCollection nvc = Request.Form;
string userName = "";
string password = "";
if (!string.IsNullOrEmpty(nvc["txtUserName"]))
{
userName = nvc["txtUserName"];
}

if (!string.IsNullOrEmpty(nvc["txtPassword"]))
{
password = nvc["txtPassword"];
}

ExecuteLogin(userName, password);

HTML Centering DIV Tag ( DIV Element )

The easiest way without JavaScript to center a DIV tag is to use a style tag or css that resembles the following.

style=’padding:5px;width: 400px;height:200px; margin-top:-100px; margin-left:-200px; left:50%;top:50%; border:outset 1px #ccff99; background-color:#ccff99;position:absolute;font-weight:normal;’

Sample Image

Making Your Web Page Accessible

It seems like a lot of work to make your web page accessible for people with sight impairment, and the audience seems small, but it is worth it. There are a couple of things that web developers often miss when they are evaluating such a task. If people cannot read the website, it is a good possibility that search bots and spiders from sites like Google and Yahoo will have difficulties too (although they have gotten better). By taking the time to properly plan out your site and take the time to follow the W3C standards, you should accomplish 90% or better of the goal to make your site accessible. Making your site accessible is easy and W3C publishes the guidelines.

Here are a couple of quick steps

  1. Use “alt” tags on any content that is not text ( images or graphics
  2. Use the title tags on your hyper links (a) type tags
  3. Create a consistent page layout including heading, menus and content area
  4. Where you use flash, or other plug-in framework, provide a text alternative with an easy and obvious link to it.
  5. Tables should be laid out using the following
 <table>
   <caption>this is a table caption</caption>
   <tr>
       <th>column heading 1</th>
       <th>column heading 2</th>
   </tr>
   <tr>
       <td>column 1</td>
       <td>column 1</td>
   </tr>
</table>

 

Javascript equalsIgnoreCase Function

This week’s code sample is JAVASCRIPT based. I found this while researching user validation routines. This function is a javascript version of a common Java function. We have replicated the calling syntax as a java programmer would expect to use it by effectively appending it as a method of the javascript String Object.

For more great scripts: http://www.apriori-it.co.uk

Important Note: Works with IE and FireFox

//The first line assigns the MatchIgnoreCase function as 
//an equalsIgnoreCase method of the String object 

String.prototype.equalsIgnoreCase = MatchIgnoreCase; 

function MatchIgnoreCase(strTerm, strToSearch) 
{ 
	strToSearch = strToSearch.toLowerCase(); 
	strTerm = strTerm.toLowerCase(); 
	if(strToSearch==strTerm) 
	{ 
		return true; 
	} else { 
		return false; 
	} 
}

Hot Keys

alt-1 – Load help

This week’s code sample is JAVASCRIPT based. It traps a keyup event in a web page that contains this code. The function then goes a step further and looks for the Alt key. Once we have the Alt filtered out we can begin to look for key combinations.

Below the code sample shows traping for numeric keys. The key code is actually an ASCII representation, so therefore you will need to know some common ASCII codes. Our example shows 48, 49, 50 being used. This translates to 1, 2, 3. So in short we are making a routine that will trap the following:

  • Alt-1
  • Alt-2
  • Alt-3

Important Note: Works with IE and FireFox

Try the Alt keys.