Friday, 29 July 2011

SQL Server: create a database with queries (the full life cycle of a database)

   


When we think about a SQL Server database, we usually consider databases and tables as static objects while records contained as dynamic objects. What I mean is that we are inclined to build the structure of our database (the db itself, the tables, index and so forth), and then manipulate (insert, update, delete) the data contained in the tables. Some times we use temporary tables.
In this post we will see how to:
  1. create a database
  2. create a table
  3. create an index
  4. drop the index
  5. drop or truncate the table
  6. drop the database
The full life cycle of a database: from creation to destruction!

Wednesday, 27 July 2011

Web Development: how to test IE compatibility

   


Lately, we have seen an increasing interest in HTML5 and CSS3. The (not really recent) introduction of new features has been cautiously followed by web developers, and I don't know what's your feeling, however my impression is that the path to the new web is just full of pitfalls.

I recently had to develop a new web site and, because it was a very basic one, I decided to experiment a bit. I must say it has been quite satisfactory (coding-wise), however I had to spend quite some time to test it. I wanted to have almost a full compatibility and - as we have seen lately - the browser that gave me most troubles has been Internet Explorer.

In order to test a web site for compatibility issues, I usually publish it in a not-known sub-dir and then display it with different browsers. I test it with Safari, Opera, FireFox, Chrome and Internet Explorer. In addition, I use services like Browsershots and IE NetRenderer. However, they usually take a lot of time (especially the first) and because we know that time is money, I recently decided to look for something else.

Monday, 25 July 2011

JavaScript: get data from an xml file (like a Blogger backup file) and display it (or print it) - Part 2

   


As promised, in the following article I will explain the code published in my previous post. I don't know how many of you are interested in explanations, but because I think that understanding things is better than merely copying examples, I will torture you with this. You've been warned!

Friday, 22 July 2011

JavaScript: get data from an xml file (like a Blogger backup file) and display it (or print it) - Part 1

   


I've been running around this post quite a lot. I know that it could contain valuable information for everyone and specifically for Bloggers, but there's so much into it that I don't know where to start.
Anyway... The point here is:
1) take the Blogger backup file (xml) - or any other properly formed xml file (an Atom feed as well);
2) clean it up - if needed;
3) build an HTML page that gets the data from the xml file (using JavaScript);
4) properly style the page.

As you can see the task is not that easy... or is it? Read on, and judge for yourself.

Wednesday, 20 July 2011

Google+

   


Just a quick note out of the ordinary stream of articles... if you are on Google+, I would be delighted if you add me to your circles.
In the meantime, keep on following The web thought, and have a spledid day!

ADODB: How to query a database (the command and recordset objects)

   


In almost every article on The web thought, we are talking about retrieving data from a database. I recently realized that we've never really talked about how to do it. I don't want to get into it in a too technical way, however I would like to share the two ways I use to get data from a database using the command object and the recordset object. We will concentrate only on data collection, while manipulation (update, insert and delete) could be the topic for future posts.

Ok, let's begin then.

Monday, 18 July 2011

Browser Support: even Google is dealing with compatibility issues

   


As of August 1st, we will discontinue support for the following browsers and their predecessors: Firefox 3.5, Internet Explorer 7, and Safari 3. In these older browsers you may have trouble using certain features in Blogger as well as many other Google Apps such as Gmail, Google Calendar, Google Talk, Google Docs and Google Sites.
 
This is some news. It has been published on Blogger Buzz just last Friday (July 14th).

I've been talking about browser compatibility and support a lot lately. Older browser versions are still around, and - as web developers - we have to face more and more troubles just to make "everybody happy". When I recently had to show a new web site I developed, I couldn't believe my eyes when I saw IE6 running on the meeting room pc. And you can imagine how difficult has been to explain how IE6 is some very old software ("I bought the pc just 5 years ago! It's not old!") and that it should have been replaced a few years ago with a newer version.

I believe the above news is definitely a very good news. Everyone should force people to use newer browsers - and possibly auto-updating ones. That will make us, web developers, take a deep breath of relief!

You can read the original post (Blogger Buzz: Update on Browser Support) and then, please leave a comment about it in the section below.

Friday, 15 July 2011

CSS3: Use CSS3 in IE 6-8 with PIE

   


"Marco, the design department has prepared the layout for the new site. Please, now you can start developing it."

That's what I found in my company mailbox, the other day. Interesting enough, the design department is mainly a smart guy who's very skilled using Photoshop and stuff like that. But placing shadows, neat and polished background textures, rounded corners and every other embellishment you can think of, is drammatically easier to do with Photoshop than actually designing it with CSS, ASP and plain HTML.

Upon looking at the drafts, I immediately realized there were troubles ahead. The problem was compatibility...
I know, I know... we've been talking about CSS3 compatibility issues many times, however I believe that we can now start to talk about possible solutions... or not?

... drum roll ... the solution is already out there!

Wednesday, 13 July 2011

56K Modem Sounds Slowed Down 700%

   


Today, I just want to show a crazy thing. Remember when we were used to surf  the internet with 56k modems? Well, there's this guy who decided to make some sort of song with the sound that comes out when the connection is established and the result is absolutely creepy. See and hear for yourself and have a nice day (if you can...)



Monday, 11 July 2011

ASP: export data to a Ms Word document

   


We can create a Ms Word document as output of an ASP page. In the past I published articles about exporting to Ms Excel, to Ms Access and to PDF. In this post we'll see how to export data to Ms Word.

The way data is exported to a Ms Word file is probably the easiest. I assume we gather data from a database and have a resulting recordset (called RS_Word). We can display the records with a repeat region or not. In the following example I assume the data is unique, thus we will not use a repeat region. Let's imagine the data is just some pieces of plain text.

Saturday, 9 July 2011

One year ago...

   


One year ago I published my first post.

The web thought has grown amazingly since then.

It has more than 100 pageviews every day, and, even if not many comments have been submitted, I must admit I am quite happy about it - comments will eventually come. On the other hand, I really would like to know more about what you think, what are your experiences and thoughts and how my articles helped you (if they did at all).


I really need to thank everybody who supported me during this year and I hope to continue offering good quality articles to all of you.

The web thought could really grow more and more... but I think I do need your contribution, now. Please, post your comments, share the contents, add your account to the followers list and - if you like - submit your articles for publishing. That way we might know each other better... and make The web thought a good place where to find information about web developing.

Test for echo...

Friday, 8 July 2011

ASP: use FPDF to create a PDF with a dynamic table

   


Following my two previous articles about FPDF (Create PDF files with FPDF and FPDF MultiCell with multiple lines and positioning), today I would like to share a way to create a table dynamically, getting the items from a database, and displaying those items one after the other.

As usual, we have to make some assumptions. First of all we have a database from which we will get the records for the table. As an example, we can imagine our table is something like:

FRUITIMAGE_URL
orange/images/orange.jpg
apple/images/apple.jpg
pear/images/pear.jpg

Our goal is to create the PDF with the above table. We will create the table dynamically, and the table will have two columns: one for the fruits and one with the image of the related fruit.

If you are interested in the following explanation, but you haven't read the previous articles about FPDF, I suggest you read them before continuing, because here I assume you already know how to create a basic PDF file using FPDF.

Wednesday, 6 July 2011

ASP & IIS: global.asa and current user count

   


The first time I've heard about the global.asa file, it was a long time ago when I wanted to show the current users on a home page. In fact, using the global.asa is not that difficult, and showing the users online is an old trick. I would like to show you what global.asa is and then use it to create a users online badge.

The global.asa
The global.asa is a small and optional file that you create in the root of your web site. We use the file to specify event scripts and objects that have session or application scope. As I said in the previous article (where we talked about sessions), the global.asa can be used to handle sessions - or, more specifically, to bind events to session.
There must be only one global.asa in the root of your web site and it can contain only:
  1. ASP built-in object events;
  2. object declarations;
  3. TypeLibrary declarations.

Monday, 4 July 2011

ASP: the session object (vs cookies)

   


I've been talking about cookies some time ago, however you should know there's another way of storing information if you use ASP: the session object. There's a big difference between cookies and sessions: cookies are client-side, while sessions are server-side. When we open an ASP page, the server creates an unique identifier that will determine the session id. While cookies can have a long expiration time, usually sessions have a predetermined timeout (20 minutes). Cookies are completely controlled by the code of the page and can be created, changed and destroyed using appropriate commands - as we saw in the aforementioned article. That is true for sessions as well, however the session unique identifier is always created when an ASP page is opened. By default, when an ASP request is made to the server, the session is automatically started and the unique identifier is stored for future use. The session ends after 20 minutes by default (it's possible to change that value programmatically or in IIS).

Friday, 1 July 2011

ASP, CSS & jQuery: dynamic styles and jQuery code for accordion menus

   


In a recent project I developed, I had to create a dynamic accordion with jQuery. The accordion is basically a gallery menu, and the tree structure of the menu itself is taken from a table in a database. What I had to do was to apply different styles to elements that needed to have different ids. Why different ids? Because I had to apply different behaviours to every single tree element with jQuery.
To do so I created a loop to style the elements and dynamically generate the related jQuery code. The following example uses asp, css style sheets and jQuery, all together.

We start from here
Some assumptions have to be taken. First of all, there's a database with a table containing the menu. Something like:
msm
DrawingsHand drawn
DrawingsPrinted
PhotosColour photos
PhotosBlack and white
The above table is called menugallery. What we want is a tree menu with an accordion effect. The menu will be dynamically generated from the table.