Posted August 25th, 2008 by admin
Before you read any further, take into context this isn’t going to fully help you in terms of lessening your spam. However, it is a neat trick and will help some, or at least deter some spamming bots from picking your e-mail address and using it for spam.
While at work today I was performing some maintenance on a project that was handed to me and I noticed a tiny bit of javascript used to print an e-mail address, but by doing so kept it seperate and not connected.
<script type="text/javascript">
emailE=('roberthash@' + 'yahoo.com')
document.write('<A href="mailto:' + emailE + '">' + emailE + '</a>')
</script>
What you see first is that a variable is assigned two values that are added together. By splitting the e-mail into two pieces (in theory), this will assist in deterring spam bots searching for a valid e-mail address.
emailE=('roberthash@' + 'yahoo.com')
From there we utilize the document.write() function to print this text to the browser window.
document.write('<A href="mailto:' + emailE + '">' + emailE + '</a>')
Another beautiful part is that if Javascript is not installed, this means there won’t be an e-mail address showcased. However, this could be a pain if you have someone trying to find your e-mail address that has a legit reason to contact you - but doesn’t have Javascript.
As usual, it is a method to be used at your own risk or if you feel it is indeed the solution for your project.
With further research, I have found the origination of this code, which can be found at http://www.joemaller.com/js-mailer.shtml.
As you can see - it is a very simple approach that even a novice programmer can understand. Who says you can’t learn new tricks?
Posted August 22nd, 2008 by admin
I have found through my web application development experience that it can be quite the pain if someone messes up a date. This is a huge headache for reporting purposes.
Methods to get around this can be one of many things. Validation for example simply forces the user to put in a date before they can submit information. Who is to say they are putting in the right date anyway? The ASP.NET calendar control is nice, as it gives a calendar and allows the user to pick a date. One method that I have found to work quite nicely for data that is entered for a day is to have the date set automatically.
What would be a scenario for this? The ideal setting is to track a date when an action is committed. Examples include form submission (no-brainer), requests, updates, etc.
For example, let’s say we have the following form:
<form runat="server">
<asp:Textbox ID="dateBox" runat="server"></asp:TextBox>
</form>
Now, using the code behind file, we can write a simple line of code to send today’s date straight to the dateBox ASP Textbox upon the loading of the form.
With an aspx file, in the code-behind we can add an attribute to the Page_Load method to autopopulate a date (or set any value - same premise). Below we will set it within an IF statement for when the page posts back:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// This will happen upon a postback
dateBox.Text =DateTime.Today.ToString("MM/dd/yyyy");
}
Or you can set the value in outside of the PostBack IF statement:
dateBox.Text = DateTime.Today.ToString("MM/dd/yyyy");
As you can see, that simple line of code will send today’s date straight to the textbox without the user having to enter it. We have included it in the page load portion to see that it fires upon, as you guessed it, the loading of the page/form. To break it down further, we can add some pretty neat attributes to the code to produce other effects:
If we want to add tomorrow’s date, we can use .AddDays(+1)
DateTime.Today.AddDays(+1).ToString("MM/dd/yyyy");
If we want to add yesterday, we can use .AddDays(-1)
DateTime.Today.AddDays(-1).ToString("MM/dd/yyyy");
Want to populate a year? You can use the same premise. As Nico VanHaaster has pointed out, you can call the AddYears() method to combat leap year occurances:
DateTime.Today.AddYears(-1).ToString("MM/dd/yyyy");
As one can see, it’s a very simple approach to solving a problem with user’s entering a date and becoming frustrated if they have to do this more than once (such as they enter this data after each task on a given day).
Happy Programming!
Posted August 22nd, 2008 by admin
Here is a listing of XHTML tags that I’ve kept as a reference for a long time. I figure if they were a great resource when I was learning XHTML, then they can be a great resource for you as well.
*Original credit goes to http://www.w3schools.com/tags/default.asp*
XHTML Tags, Description and Document Type Declaration
| Tag |
Description |
DTD |
| <!–…–> |
Defines a comment |
STF |
| <!DOCTYPE> |
Defines the document type |
STF |
| <a> |
Defines an anchor |
STF |
| <abbr> |
Defines an abbreviation |
STF |
| <acronym> |
Defines an acronym |
STF |
| <address> |
Defines an address element |
STF |
| <applet> |
Deprecated. Defines an applet |
TF |
| <area> |
Defines an area inside an image map |
STF |
| <b> |
Defines bold text |
STF |
| <base> |
Defines a base URL for all the links in a page |
STF |
| <basefont> |
Deprecated. Defines a base font |
TF |
| <bdo> |
Defines the direction of text display |
STF |
| <big> |
Defines big text |
STF |
| <blockquote> |
Defines a long quotation |
STF |
| <body> |
Defines the body element |
STF |
| <br> |
Inserts a single line break |
STF |
| <button> |
Defines a push button |
STF |
| <caption> |
Defines a table caption |
STF |
| <center> |
Deprecated. Defines centered text |
TF |
| <cite> |
Defines a citation |
STF |
| <code> |
Defines computer code text |
STF |
| <col> |
Defines attributes for table columns |
STF |
| <colgroup> |
Defines groups of table columns |
STF |
| <dd> |
Defines a definition description |
STF |
| <del> |
Defines deleted text |
STF |
| <dir> |
Deprecated. Defines a directory list |
TF |
| <div> |
Defines a section in a document |
STF |
| <dfn> |
Defines a definition term |
STF |
| <dl> |
Defines a definition list |
STF |
| <dt> |
Defines a definition term |
STF |
| <em> |
Defines emphasized text |
STF |
| <fieldset> |
Defines a fieldset |
STF |
| <font> |
Deprecated. Defines text font, size, and color |
TF |
| <form> |
Defines a form |
STF |
| <frame> |
Defines a sub window (a frame) |
F |
| <frameset> |
Defines a set of frames |
F |
| <h1> to <h6> |
Defines header 1 to header 6 |
STF |
| <head> |
Defines information about the document |
STF |
| <hr> |
Defines a horizontal rule |
STF |
| <html> |
Defines an html document |
STF |
| <i> |
Defines italic text |
STF |
| <iframe> |
Defines an inline sub window (frame) |
TF |
| <img> |
Defines an image |
STF |
| <input> |
Defines an input field |
STF |
| <ins> |
Defines inserted text |
STF |
| <isindex> |
Deprecated. Defines a single-line input field |
TF |
| <kbd> |
Defines keyboard text |
STF |
| <label> |
Defines a label for a form control |
STF |
| <legend> |
Defines a title in a fieldset |
STF |
| <li> |
Defines a list item |
STF |
| <link> |
Defines a resource reference |
STF |
| <map> |
Defines an image map |
STF |
| <menu> |
Deprecated. Defines a menu list |
TF |
| <meta> |
Defines meta information |
STF |
| <noframes> |
Defines a noframe section |
TF |
| <noscript> |
Defines a noscript section |
STF |
| <object> |
Defines an embedded object |
STF |
| <ol> |
Defines an ordered list |
STF |
| <optgroup> |
Defines an option group |
STF |
| <option> |
Defines an option in a drop-down list |
STF |
| <p> |
Defines a paragraph |
STF |
| <param> |
Defines a parameter for an object |
STF |
| <pre> |
Defines preformatted text |
STF |
| <q> |
Defines a short quotation |
STF |
| <s> |
Deprecated. Defines strikethrough text |
TF |
| <samp> |
Defines sample computer code |
STF |
| <script> |
Defines a script |
STF |
| <select> |
Defines a selectable list |
STF |
| <small> |
Defines small text |
STF |
| <span> |
Defines a section in a document |
STF |
| <strike> |
Deprecated. Defines strikethrough text |
TF |
| <strong> |
Defines strong text |
STF |
| <style> |
Defines a style definition |
STF |
| <sub> |
Defines subscripted text |
STF |
| <sup> |
Defines superscripted text |
STF |
| <table> |
Defines a table |
STF |
| <tbody> |
Defines a table body |
STF |
| <td> |
Defines a table cell |
STF |
| <textarea> |
Defines a text area |
STF |
| <tfoot> |
Defines a table footer |
STF |
| <th> |
Defines a table header |
STF |
| <thead> |
Defines a table header |
STF |
| <title> |
Defines the document title |
STF |
| <tr> |
Defines a table row |
STF |
| <tt> |
Defines teletype text |
STF |
| <u> |
Deprecated. Defines underlined text |
TF |
| <ul> |
Defines an unordered list |
STF |
| <var> |
Defines a variable |
STF |
| <xmp> |
Deprecated. Defines preformatted text |
Posted August 22nd, 2008 by admin
It is very safe to say that the modern work industry is not only fast-paced but also an easy place to find yourself distracted. Below are five helpful tips that help me throughout the week.
Don’t Take On Too Much At Once
This is something we’re all guilty of. We want to jump out, show we can take on a heavy workload and get the job done. What we don’t realize is that after time it takes a threatening toll on our health, focus, and ability to perform. Pay close attention to the amount of time you have and the amount of time it will take to complete the tasks you take on. Remember - sleep and time outside the office dictate how stressed you get in the long run!
When Stumped, Dont’ Google Solutions First
What? We live in a digital age and I’m not recommending to hit Google first? That’s correct! Yes - there are a ton of message boards out there you can find through Google that have probably come across the same issue that you’re having. Sadly though, by going this route first you put yourself into dangerous area for procrastination.
If you’re stumped, try walking away from the situation for five minutes or so to catch your thoughts. Then, once back in the office, try drawing out your project and how you think it should work. Trace your steps and go into more detail on the task at hand. Weirdly enough, this has usually helped me find areas that I may overlook to being caught up in finishing a project.
Coordinate
Sometime’s it is tough to build a routine in the IT industry. If you can, try to implement certain elements of your day into a set schedule. Maintenancing your e-mail early in the morning, reviewing your calendar for tomorrow’s activities in the late afternoon, finishing projects in the early morning can all be effective ways to combat procrastination and loss of time. Try tackling projects early on in the day while you are the most awake and energetic. Finish your day off with the least important activities or the ones that require the least amount of energy.
Read Up!
It’s rather nice to keep up with all of the news in your related field. Although it may not relate to your company at large, a lot of what happens in the industry can either help or disrupt you in the long run. Keep up-to-date with whats going on. As cliche as it sounds, knowledge truly is power.
Retouch Your Skills
In this industry, it is impossible to use your entire skillset in one single day or week. I’ve found that retouching certain skills, techniques, or software can maintain your knowledge of the respective area. Who knows, you may even learn more about it than you knew before.
As you can see, these are 5 random points of advice. The IT industry is truly growing and with that comes with responsibilities that will only grow in time. Keep your mind healthy, knowledgeable, and free to think and you will find much more comfort in your abilities and career.
Posted August 22nd, 2008 by admin
As a designer you can run into a lot of conflicts. What do I think looks the best? What do they think looks the best? I understand this but will they be able to comprehend? These are all valuable questions that designers face. For that, I am going into 3 common areas in which most designers either take sink or swim!
1) Assuming the User Understands
I don’t have the statistical research, but this is one of the biggest problems designers face today. As developers and designers we tend to take our own knowledge of what we understand for granted. Do all users know this type of link goes here? Is it common knowledge a house means that you will go to the index or home page?
Take into deep consideration how much your design speaks to the user. It is a safe route to break down navigation as simple as possible, add visulizations and tool-tips where needed, and to place objects where users can easily see them.
All and all - your design should tell the user what to do. That tends to eliminate the confusion.
2) Small Text Sucks. Period!
One of the biggest issues I have with design is small text. It could be the fact that I’m very close to being legally blind. Just think about it. Your site or application is used by the 17-50 year-old range. Will all of your users have the same eye sight? Will they even look at your site on the same screen resolution? This was especially an issue during the Dot Com days as Verdana with font-size 10px being the forerunner. Now, bigger text is in with the whole Web 2.0 movement.
Of course - your users could probably utilize the zoom feature in their browser. How convenient is that though? Remember folks - this is all about the user experience!
3) Your Browser Isn’t The Only One Bud
I really didn’t think it was such a problem ,but there are many designers that don’t think to test their applications in various browsers. This site is included! There are some subtle differences between all browsers that can hamper the user experience. It may seem like the tiniest fragment but trust me - it will hurt a lot more than you imagine.
Test, Test, Test! That’s the only way you can assure that your site is your site no matter the environment.
And we close…..
Those are three elements that can be overlooked, assumed, or can even lack the proper attention. Remember - every element put into your web site/ applicaiton interface dictate how your users will effectively use it. Your users can use it proudly. Yet again, they can move on to the next search result due to frustration.
Posted August 22nd, 2008 by admin
For those of us that enjoy using PNG graphics in our layouts, it is common knowledge that Internet Explorer is a point of frustration in the entire process.
Fortunately javascript can be utilized to assist in this matter. Be sure to use the defer type.
<html>
<head>
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
</head>
<body>
And for the actual code
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
if ((version >= 5.5) && (document.body.filters))
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style="" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src='" + img.src + "', sizingMethod='scale');"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
Easy Enough Eh? A special thanks goes out to
http://homepage.ntlworld.com/bobosola/pnghowto.htm for posting this helpful fix.
Posted August 22nd, 2008 by admin
There comes a time in every developer’s life where we tend to get bored and test our knowledge. Now the question lays - where do I go?
Below I have compiled a short listing of items I found while taking a stroll through Google. Enjoy!
Codesplunk
http://www.codesplunk.com/
Codesplunk is a very very very, and I mean very simple layout. What’s nice though is the idea behind it - it’s a web site for programmers to test their knowledge and to even submit questions and answers. Questions include from AJAX, PHP, XML, C, JAVA, Javascript, and more.
W3C Schools Online Tests
http://www.w3schools.com
I’m pretty sure everyone has been to these at some point, either to read about a language of your choice, read about online standards, or just to see some of the examples to answer your query. One of the neat things is the quizzes section, which boasts a variety of quizzes, including:
Funtrivia Quizzes
http://www.funtrivia.com/quizzes/sci__tech/computers/software_and_programming.html
Funtrivia offers quote a few quizzes ranging from programming, computer concepts and even database technology and concepts. Some of the quizzes include:
Misc Quiz Links
HTML
CSS
Javascript
PHP / MySQL
C# / DOTNET
JAVA
XLST/XPath
Posted August 22nd, 2008 by admin
Drop-down lists have long been a form designer’s friend in terms of packing a lot of choices into a single area. The maintenance of these however can become tedius over time if you must continually update the list.
In the static Web 1.0 days, we would have coded each option in the list. Fortunately through the use of a server-side language and a database we can make this a lot more efficient.
In this example I will showcase how to do this in PHP. For those that use ASP.NET, I’m pretty sure you are accustomed to the drag-n-drop capabilities of Visual Studio, where you simply drag-n-drop and set your connection settings accordingly.
In PHP however, it is a little more work. In the following I will have assumed you already have a table named states created with 3 columns (I used state_id, state, state_abbr - *If you haven’t created the table, Kim Briggs has a wonderful sql example at http://kimbriggs.com/computers/computer-notes/mysql-notes/mysql-create-state-table.file .*
I will also assume that you have already connected to the database in your file.
We will begin first by creating a variable which will hold our SQL query. From there we will create a variable that will hold the result.
<?
$query="SELECT * FROM state";
$result = mysql_query ($query);
Then we shall begin the drop down list:
echo "<select name='state' value=''>State</option>";
And we will use a while statement to create an array to cycle through the results printing HTML options for each item. As you will see, we will be binding the columns to the values that we want to print on the page.
while($myfetch=mysql_fetch_array($result)){
echo "<option value=$myfetch[state_id]>$myfetch[state_abbr]</option>";
}
From there we will close the list and the PHP file.:
echo "</select>";
?>
And for the code in its complete form:
<?
//Create SQL Query
$query="SELECT * FROM state";
// Variable for results
$result = mysql_query ($query);
// Begin select tag
echo "<select name=state value=''>State</option>";
//Return each result
while($myfetch=mysql_fetch_array($result))
{
echo "<option value=$myfetch[state_id]>$myfetch[state_abbr]</option>";
}
//End select
echo "</select>";
?>
Easy enough huh? Do note that with the query, we can control how the results are printed (IE alphabetical, by id, etc.). This can be used for a variety of fields, from states to categories.
Posted August 22nd, 2008 by admin
As some of you may know, I just recently accepted a position to move on to Virginia Tech as a developer for the Office of the VP of Research.
Virginia Tech is a fine institution and will allow me to return to the New River Valley (where I attended Radford University). I feel it will allow me to broaden my career expertise and allow me another proving ground in my field.
I would like to personally thank all of my friends and collegues I’ve made at The Results Companies.
Nico, James, Ian, Sarah, Blaine, Ben -
You’ve all been an aset during my corporate experience. I have grown a lot under the tutileage of you all. We’ve shared a lot of laughs, explicitives, victories, and frustrations. I wish you all the best and don’t be afraid to give me a call if you ever need anything.
Eric, Jason, Diane, Jon, Kevin, Dave, Michael , Rose, Cindy, Ryan, JoBeth, Dondea, Bobbie, Amy, Chris, Sherry, Cindy, Michelle, Randy, Michael
I think each and every one of us have been through a lot in the growth of this company. I appreciate all of your hardwork and honest critiques during times of development. I know you’ll all keep bringing great ideas to the table to increase the strength of Results Galax.
Although I will still be a contracted developer for Results - It’s time to move on. It’s time to take up a new challenge.
Posted August 20th, 2008 by admin
Okay, out of fairness I thought I would post the same tutorial for my favorite dynamic duo - ASP.NET and C#. We will assume we are using the same database name or table name. We will work with a asp:DropDownList control such as:
<asp:DropDownList id="state" runat="server"></asp:DropDownList>
We will create a method called StateDropDown:
private void StateDropDown()
{
}
From there we will define our connection settings - typically what we have set in the web.config file.
SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["MySettings"].ConnectionString);
From there, much like the PHP example, we will create an SQL query that will scope the database table to populate the dropdown. We will assume i’m connecting to a database named info and a table named state.
string Sql = "SELECT * FROM info..state";
Now for the fun of C# - creating a dataset, filling the dataset, then applying that dataset to your asp:dropdown control.
SqlDataAdapter sqlAdapter = new SqlDataAdapter(Sql, Con);
DataSet ds = new DataSet();
sqlDA.Fill(ds);
state.DataSource = ds.Tables[0];
state.DataTextField = "state_abbr";
state.DataValueField = "state_id";
state.DataBind();
}
And now for the unmolested code:
private void StateDropDown()
{
//Define your connection
SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["MySettings"].ConnectionString);
//Create your SQL query/string
string Sql = "SELECT * FROM info..state";
SqlDataAdapter sqlAdapter = new SqlDataAdapter(Sql, Con);
DataSet ds = new DataSet();
sqlDA.Fill(ds);
//Define which control will accept this dataset
state.DataSource = ds.Tables[0];
state.DataTextField = "state_abbr";
state.DataValueField = "state_id";
//Bind the dataset to the control
state.DataBind();
}