Thursday 29 November 2012

JavaScript & XML: validate an XML document

   


I think we all know how to use XML documents. For example RSS feeds are basically XML files, as well as sitemaps. Those files may be very important when managing a web site, but those examples are just a small part of the common use of XML documents. Just to make things clear, another example: when you export a Blogger blog, the file you get is an XML file.
When I've written the article on how to create an RSS feed, I discovered a very useful JavaScript snippet that helps us to validate an XML file.
Unfortunately I don't remember where I got it, but, even if I surely rearranged it, if you know the original source, please let me know so that I can give due credit to the author.
Ok, said that, let's see how to do it.

Tuesday 27 November 2012

JavaScript: validate an URL

   


I've already posted an article on how to validate forms with Regular Expression. But, have you ever needed to valid an URL?
We can do it quite easily using Regular Expressions and JavaScript. Specifically we are going to use the .test method.

The code
The first thing we need to do is set two variables: one is the URL to be validated, the second is the Regular Expression.
<script type="text/javascript">
var url = "http://www.google.com/";
var urlCheck = /^http:\/\/(www\.)?[a-zA-Z0-9-]{3,}\.[a-zA-Z]{2,}(\/)?$/;

Thursday 22 November 2012

JavaScript: document.lastModified with a trick

   


Again another JavaScript article...
This post in fact might be interesting for some of you. We are talking about those fancy lines we sometimes find at the end of a web page where we are informed about the document last modification date. Something like:


How do we do it automatically? And... that is not an European date, is it? If so, how can we manipulate it in order to make it European?

Tuesday 20 November 2012

JavaScript: check the mime type and charset

   


I always underestimated JavaScript. I know it has been a problem for me, because I've really missed lots of interesting things until I decided to explore the programming language.
In the following article I will show one of the useful things we can do with JavaScript: discover the charset and mime type of a web page.
You might wonder what's the use of it. Well... as usual try to broaden your view and consider the fact that every visitor is visiting your beloved web site from somewhere in the wide world, sitting on a different kind of chair (if not standing or lying), with a different piece of technology or device, and finally (but I could go on forever) with a specific browser ... ... type and version (the mixture of the two is a deadly issue for any web developer).
Ok, said that, don't you think that knowing the mime type and charset of a page might be useful?
Let's see how to do the magic.

Thursday 15 November 2012

jQuery: cookies!

   


I've already talked about cookies. We explored the way to use them with ASP, but have you ever wondered how to manage them with jQuery?

This is a very short article because I don't want re-write an already made guide...
We are talking about a jQuery plug-in called jquery-cookie which allows us to manage everything about cookies with jQuery.
We will be able to read, create and delete cookie sessions. The plug-in can manage session expiration and it can be configured in order to define a valid path for cookies.

Just go to the above page and see for yourself...

Tuesday 13 November 2012

SQL Server: import a MS Access database

   


As I wrote in a past article, MS Access can be used to manage databases for a dynamic web site. However, some times, it is not enough and its features can be not enough. In those cases we really need to move to a more performing software like SQL Server.
Especially in situations were large quantities of information are managed by a dynamic web site, SQL Server can be a great solution.
If you are a reader of the web thought, you know how much I am a fan of SQL Server. so in this short post I will explain how to import an Access database to SQL Server... a few steps and we will ready to go.

Thursday 8 November 2012

jQuery and JavaScript: generate and read a QR Code

   


Hello everybody!
today we are going to see something really interesting that someone in the past asked me via email.
We are going to generate a QR code using a jQuery plug in and then we are going to use a JavaScript library to read the very same QR code.
What do you think, is it interesting enough?

Tuesday 6 November 2012

JavaScript: dashboards with Drinks Toolkit

   


Web applications are evolving rapidly. While only a few years ago we just needed to manage basic operation for - as an example - a company's  intranet, today, we are asked to create effective and attractive pages together with complex functionalities.
In order to create efficient dashboards, Drinks Toolkit is a really valuable helping tool.
DrinksIt is a "Web-Based widgets to easily develop control panels and dashboards" and it includes a series of widgets each corresponding to a specific tag.

Drinks is HTML5 powered, using canvas and not needing any Flash.
It uses AJAX to gather data and it is cross browser, as long as the target browser is HTML5 compliant. In terms of simplicity, Drinks is really very easy to use, because in order to insert a widget, we just need to insert the related tag (each widget a tag e.g. <knob>).
Finally it's basically open source, thus free. In fact there are three possible options: the Open Pack which is a "pay what you want (even nothing)" option, the Business Pack for professionals and the Custom Pack (Choose what you need).
Ok, that's all for today. Go to Drinks web page and have a look for yourselves.
See you on thursday!

Thursday 1 November 2012

CSS3: use hyphens to control text flow

   


It seems that I somehow discovered CSS3 lately. I am aware that recently I wrote a lot about it, but today I feel like sharing the following info.
Have you ever needed to control the text flow in web page?
With the CSS3 hyphens property we can really do interesting things.

An intro
We can use hyphens to automatically hyphenate a justified text, giving it the same flow as we can see on books, magazines and newspapers.