Monday 29 November 2010

SQL Server: basic functions (part 2) - The Case function

   


This is the second part of series of posts on basic SQL functions. In the first part we saw right, left, substring, rtrim, ltrim and len.
In this post we are going to analyse the CASE function.

Friday 26 November 2010

SQL Server: basic functions (part 1) - Manipulating strings

   


In Sql Server, functions are special commands that perform some kind of operation during the execution of queries. They are used to manipulate results, refine selections, filter data and so on. Some of these functions are really handy and should be used in the query itself because, manipulating data at query level is surely better than do it afterwards.
I would like to gather some functions in some posts, just as quick reference with examples. I understand that the functions here examined are just a tiny selection of all the available commands, however we need to start from somewhere, don't we?
The functions we will see in this post are:
  • right, left and substring,
  • rtrim and ltrim,
  • len.

Wednesday 24 November 2010

Web Designers vs Web Developers

   


I post this great image just to make our brain cells work. And possibly laugh.
Click on the image to enlarge.
Web Designers vs Web Developers is brought to you by Wix.com
Use creative design to make a Free Website

Monday 22 November 2010

jQuery: random quotes from a txt file

   


If you want to create random quotes, loading the text from an external file, jQuery and its GET command could be a simple a fast solution.
We can create a div tag that will be the target of the quote:
<table>
   <tr>
     <td valign="middle"><div align="right" class="quotes"></div></td>
   </tr>
 </table>

Friday 19 November 2010

jQuery: AJAX and lightbox effect combined

   


What I'm going to show you how to use AJAX technology to get content for a container and use a lightbox effect to show it.
What we want is to populate a target container upon user request with an external page as source. Then we are going to show the fetched content with a lightbox effect (putting the requested content on top of everything).
We can use jQuery to manage all the operation in a quite simple way.

Let's get directly to the code and I will explain everything.

Wednesday 17 November 2010

jQuery 1.4.4 released

   


jQuery 1.4.4 has been released. See the original blog post on jQuery Blog.

P.S. I know I am a bit late...

Blog Ranking (part 4) - How to value your audience

   


Every blogger needs to find a way of attracting visitors.
What's the point in writing good articles when there's nobody reading them? Specifically, considering the high number of blogs and bloggers, it is fairly easy to understand how hard is being noticed, if not almost impossible. Established blogs have many advantages such as a wide audience with loyal readers, a high visibility due to the fact that they are already well ranked, they have always new proposing writers and so they can publish articles even more than once a day and so on. That is like a big wheel: a blogger needs to work hard to set it in motion, but once that it is spinning, it is probably more difficult to stop it than to make it run faster.

Monday 15 November 2010

jQuery: BlockUI Plugin

   


I recently needed to use AJAX requests and make the user aware of the fact that something was happening. If we use the classic XMLHttpRequest object in synchronous mode the entire web interface will freeze until the request is completed. You may understand that the user might be confused on what is going on in background, so we need to display simple and effective messages, explaining that the request is actually being sent and processed.

Friday 12 November 2010

SQL Server: How to deal with Acucobol date fields

   


As explained in a previous post, you can connect your Sql Server to an Acucobol db using AcuODBC. In the last part of the article I explained that there are performance issues when you query a linked server with OpenQuery and that it is better to import relevant data from the linked server to a Sql Server table in order to benefit from all the features available through stored procedures, triggers and so on.
I run some queries overnight  using SQL Scheduler to keep my local tables updated against the Acucobol tables, but, when importing the data, in some way I manipulate them to make them easier to query. What I found important in terms of performance, is to convert date fields from int to smalldatetime format. Furthermore, when importing data I insert into the newly created Sql Server table an identity field and set it as primary key.
Let's break down the query and I will explain it bit by bit.

Wednesday 10 November 2010

Wazala: create an online shop in 15 minutes

   


I usually do not talk about commercial products, but I think that in this case, some of you might find Wazala really intriguing. Wazala is an e-commerce solution easy to embed in your site, without the hassle of writing code or - let me say - of re-inventing the wheel. It is ready made and suitable for small to medium online shops.
When I found Wazala's site, what impressed me as a start was the overall look and design of the system. It is clear that Wazala's creators have put to use technologies like jQuery, to give it a really appealing feel in terms of visual effect. In addition to that, the usability of the virtual store is clear and effective, while simple actions like browsing the products and getting in depth information is fast and very intuitive.
I believe that, considering how simple is the complete embedding processes (from sign-in to complete site integration), anyone could become an online seller. You basically can choose from different shop sizes (starting from a free and limited store to a large and complete version), with monthly or annual fees suitable for mostly any need. I found the free option a great marketing move, because you can test and trial the service and see if it fits your requirements.

Monday 8 November 2010

SQL Server: How to connect and query Active Directory

   


You might need to query your domain's Active Directory for different reasons. There are limitations in doing so (which I explain below), but in case you need to retrieve those information anyway, here's how to do it.
First of all, we need to create a new linked server in SQL Server. You can connect to Active Directory executing the following small stored procedure:
EXEC master.dbo.sp_addlinkedserver @server = N'ADSI',
@srvproduct=N'Active Directory Services', @provider=N'ADsDSOObject',
@datasrc=N'W2k3dc'

Friday 5 November 2010

ASP: Scripting.FileSystemObject OpenTextFile vs Server-Side Include

   


In this short post I would like to compare two ways of including a file in an asp page. As you may be all aware, we can include a file into a page using a server-side include like:
<!--#include virtual="/example.txt" -->
In the page containing the above code, all the content of the txt file will be displayed.

Wednesday 3 November 2010

JavaScript: useful small snippets

   


There are small and simple JavaScript snippets that can be used to achieve very easy actions. Whenever you need to perform such actions, if you google for help, you will definitely find the answer.
However I want to gather some of those code snippets in one article, just as a future reference for me, and valuable code deposit for you.
So let's see what we got here!

How to insert a value into a text box, selecting an option from a listbox
The title says it all. Let's imagine you have an input box:
<input name="tobechanged" type="text" id="tobechanged" size="50" />

Monday 1 November 2010

Blog Ranking (part 3)

   


As I said before, blog ranking or - as I like to better define the concept - blog awareness is like a never ending battle. Despite the fact that articles are posted constantly and the content is good and interesting, blog ranking might still be (very) low.
After exchanging opinions with different people (especially marketing gurus, which I must admit I don't trust much), I do believe that there are good ways of increasing a blog traffic by spreading the word through the so-called social networks (like Facebook, Twitter or LinkedIn) as those gurus point out. I do believe that placing your link in your Facebook profile (for example) will increase your blog traffic, but is it what you're really looking for?