•  
     
  •  
     
 

Using radio buttons instead of a slider 

by matt on August 19, 2009

Q: I have a survey on my site and I want to give the user the option of agreeing a certain % with a statement. I was thinking about using a slider  (0 – 100%) where people can slide it to select how much they agree with the statement. I am wondering if this is the best solution.

A: Most of the slider widgets I have seen are written in jQuery. jQuery is a library written in JavaScript to take advantage of Ajax. Ajax, which stands for asynchronous javascript and XML, is a term used to describe client side technology for web applications. Most sliders should be pretty easy to integrate into your survey but I would suggest that doing this would lead to some issues down the road. Read the rest of this entry »

Read Question Here
 
 

Synchronizing Website Data 

by matt on June 29, 2007

Q: I would like to know if it is possible for my website to be updated when I update information in a software package on my computer. For example, if I update the shipping status of an order in my software is it possible to have that then go and update the information on the website so when the customer comes and looks at it they can see the new status?

A: The great thing about computers is that most thing are possible they just take time, planning, and in this case a lot of know how.

Since you already have a solution in place for keeping track of your business data it would make sense to do what you are asking, having a way to update your website by way of your local software package. This is, unfortunately, a complicated thing to do because you might want to, at some point, let your customers update information on the website and then you would also have to put in place a method for getting the data from your website to your software package on your computer.

This should not be too difficult, depending on the software package and what data you want to transfer, for a web programmer with some experience. There are many firms out there that do this, just make sure you do a little research because some are better than others. Get a few quotes and when doing so remember that you get what you pay for. This does not mean you should over pay but if most people are saying the job will cost $1,000.00 and someone offers to do it for $150.00, chances are the $150.00 is going to be more problems than it is worth.

Now for everyone else who is thinking about starting a business that wants to have some type of web integration, you might want to think about web based solutions, especially if you travel a lot. This will allow anyone to have access to the information via a web site. Mobility in today’s business world is something that really should be taken into account when making any software decisions.

 
 

What Is A Hex Dump 

by elise on May 1, 2007

Q: What is a hex dump useful for? What exactly do you do with it and how do you turn the code into English (so to speak)?

A: A Hex Dump is a display of the contents of a digital file in Hexadecimal code. Traditionally programmers could use the Hex code to determine where a computer program was failing. The most commonly recognizable use of Hexadecimal code is in web design. Hex Triplets are used to determine the colors of a web site when prefaced with a “#” in HTML and CSS code. Hex has also been used by spammers to obscure a URL so the person who has clicked on it does not know that they are going to a site they may not want to visit.

Since computers communicate in Binary, if you were to attempt to convert Hex to English, it may need to be converted to Binary first. There are several Hex to Binary converters available on the internet, some of which are free. Since the Hex Dump is the contents of a digital file, once translated the contents of a Hex Dump may not translate directly to English words, but may translate into commands that would only be recognizable to the application created to read that file.

This article has a good explanation of the use of Hex Dumps and Hexadecimal in computing. Answers.com also has an extensive definition of Hexadecimal and explanation of its uses.

 
 

Store HTML and Cascading Style Sheet Code In MySQL 

by matt on August 22, 2006

Q: How do I store html and cascading style sheet code in a MySQL table?

A: You would want to use a text data type. Depending on how much data you are going to need to store you might need to use mediumtext or longtext but look at the Data Type Storage Requirements page in the developer docs to get more information.

 
 

Generate a CSV file using PHP 

by matt on February 28, 2006

Q: How do you create a CSV file dynamically with PHP? I have tried many of the examples on the web but while the save/open prompt does show, it lets me know my file is unable to be opened. I need this to not be a file that is stored on my server but instead created at the time of demand.

A: The key to generating a CSV file using PHP that will be sent to your users web browser for them to open and do with as they want is to make sure you tell the browser that it is coming. Normally using PHP you just send the browser an html document and that is what the browser expects.

You need to tell the web browser to expect a file. In order to do this you have to use the header() functions built into PHP.

header(’Expires: 0′);
header(’Cache-control: private’);
header(’Cache-Control: must-revalidate, post-check=0, pre-check=0′);
header(’Content-Description: File Transfer’);
header(’Content-Type: application/vnd.ms-excel’);
header(’Content-disposition: attachment; filename=”file_name.xls”‘);

Then you just echo your data. You have to make sure not to send any information before you call your header functions or else you will get errors on your page and the file will not be downloadable but will be displayed in the browser.

 
 

Open source forum software 

by matt on February 25, 2006

Q: Do you know of any good open source forums? I’m working on a site running on the Apache web server and I was wondering if there are any good ones.

A: The most well known piece of open source forum software is phpBB, which is programmed in PHP. This software should be easy for you to setup on your apache environment.

I know many people that use phpBB on their sites and like it a lot. I have personally opted for a non-open source product called vBulletin to use when I have to setup forum software. The reason I go this route is phpBB gets very slow if you have a lot of visitors to your site at a time or over a million or so posts.

If you expect to keep things small then phpBB is a great option; there are also options for migrating to paid forum software down the road from phpBB.

 
 

JavaScript random function 

by matt on January 31, 2006

Q: How do I create a JavaScript random function that does not return two consecutive identical results?

A: Random functions are always interesting topics but this one just caught my eye because the user wanted a random function that did not repeat two numbers in a row. This means 1,2,1,5 is acceptable but 1,1,2,5 is not because there are two returns in a row that have the same value.

Thankfully JavaScript makes this a very easy task for us. We will create a global called randNum and set it equal to 0 and then we will create a function called randNoDups that will take an argument of maxNum (which will be 1 larger than the largest number possible).

The key is to look at our current random number and compare it to our last random number. If they are equal to each other then we need to generate another random number. Here is the code!

<script language=”JavaScript”>
var randNum = 0;
function randNoDups(maxNum)
{
tmpRand = randNum;
while (tmpRand == randNum) {
tmpRand = Math.round(Math.random()*maxNum);
}
randNum = tmpRand;
return tmpRand;
}
</script>

 
 

Calling a function in JavaScript a few seconds after page load 

by matt on January 28, 2006

Q: How do you call a function, using JavaScript, in your web browser a few seconds after a page loads? We would like to display a portion of a page for about 5 seconds and then minimize the section after that.

A: To call a function once a page load you want to use the onLoad method in the body tag of your html. To do the delayed call we will need to use the JavaScript function window.setTimeout( function, time ).

The two arguments that the function takes are the function you want to call and the time in milliseconds you want it to wait before calling that function.

Putting both together we would use the code below to achieve what this user was trying to do.

<body onLoad=”window.setTimeout(’my_function()’, 2000);”>