hurricanesoftwares

Share your knowledge and create a knowledgebase.
Tue Jun 30

How To Build Website Backlinks By Using An Organic Approach

How To Get Website Backlinks in an organic wayHow to build website backlinks in an organic way? The question is not so simple as you need to first know What are “backlinks”? Well, Backlinks are links that are directed towards your website which are also termed as Inbound links (IBL). They represent the popularity or importance as more and more people (sites) linking to you will eventually end up giving backlinks to your site.You might think that how come backlinks are important for your website though you are having excellent articles (data) on your site. But if you think in terms of search engines you will notice that they heavily rely on backlink to measure importance and popularity of any data. These search engines especially Google gives more credit to websites that have a good number of quality backlinks, and consider those websites more relevant than others in their results pages for a search query.

What Goes in the background to calculate Backlinks?

While calculating the relevancy of a site to a keyword, search engines consider the number of QUALITY inbound links to that site. Here comes a question: What is QUALITY backlinks? A quality backlink is termed as links coming back to your site from a high page rank (PR) sites specially from the same niche. So its vital to get quality back links rather then settling for mere inbound links. Search engine in order to display exact and better search results considers the content of the sites to determine the QUALITY of a link. When inbound links to any site come from other sites, and those sites have content related to your site (same niche), these inbound links are considered more relevant to your site. If inbound links are found on sites with unrelated content, they are considered less relevant. The higher the relevance of inbound links, the greater their quality.

Tips To Build Back links In an Organic Way

Although, there are numerous methods provided in various SEO sites but here is my list of building backlinks in an organic way, remember no black hat SEO tricks here
  1. Directory Submission: Search engines sometimes refers directories to find more description about a site. These directories often gives one way backlinks to your site which is good for SERP. If these directories are paid and quite old, you can simply get quality backlinks. DMOZ, Yahoo, LIL and Zoominfo are MUST for every site.
  2. Sponsered Listing: You can optionally sponsor a site which will give you good traffic along with backlinks. Make sure you opt for site in the same niche of your site. Try to look for one time payment rather then recurring payments.
  3. Forums & Blogs: Try commenting on blogs and reply on popular forums which are old and highly indexed in google. When commenting in blog make sure you provide a valid comment about that particular article and not some random text. Putting a link in your comment can lead to a SPAM. If your comment adds some value to the article, it will give you good result in long term. Create multiple profiles in popular forums and add signatures. e.g. make sure your signature contains your keywords if possible. Don’t make it look like a SPAM.There is very thin line between a valid signature, comments and SPAM so make sure you understand the difference.
  4. Content Exchange: Content Exchange will give some boost and new visitors to your site but make sure you exchange in the same niche.
  5. Submit RSS Feeds to RSS Directories: Generate a RSS feed and submit it to the RSS directories. On the Internet people are hungry for content, there might be a bunch of people waiting to put your RSS on their website and thus provide you with a bunch of free backlinks.
  6. Write Short Articles on Popular sites: Write short articles on popular sites like squidoo, hubpages and ehow with a link back to your site (containing keywords). Although, you need to build good reputation on these sites to get some traffic and backlinks but this will give good results in long term.
  7. Google and other Alert services: Though, this is not a task but think about it. Whenever a keyword is chosen for sending alert. Google will automatically fetch all the blog post or articles posts on a particular keyword and send alerts. So, your keyword rich article may be fetched by Google while sending alerts to millions of people. Chances are that people will either bookmark as favorites or simply write something about your article giving a backlink.
  8. Website Review services: There are various website review services available. Choose a popular review service and submit your site for review. In case you are chosen they will write an article about your services/site and eventually you will get quality backlink.
  9. Publish Widgets: Create and share a widget with other site owners. Contact other site owners of same niche and ask them whether they are interested in putting your widget on their site. If the other site have good traffic you are bound to get some percentage of their traffic too along with quality backlink.
  10. Ping Popular Services: If you site is a blog, ping services like Technorati to tell them that you have a new article on your site which should be crawled by them. These services are quite popular and highly indexed by search engines. When these search engines will see your link on these sites you will get some backlinks.
  11. Question & Answer Sites e.g. Yahoo Answers: Create a solid profile by answering questions of other members, few of your questions can contain links. Although, the links will be “nofollow” still it will be an advantage to have those.
  12. Social bookmarking: Although, many people think that social bookmarking is THE ONLY solution to get back links, well i contradict this point. Simply bookmarking on popular sites won’t give you much of the traffic but waste your time. You need to create very strong profiles in sites like stumbleupon, digg, reddit, delicious etc. with lots of friends followers interested in same niche before bookmarking/promoting something. They can give you instant hits and might republish your article on their sites by linking back to your site.
  13. Create blog pages on various popular sites like wordpress and blogspot: You may optionally create blog pages on popular sites like wordpress, blogspot and provide short introduction of your article with a link back to your site.
If you’ve got any thoughts, comments or suggestions for things we could add, leave a comment! Also please Subscribe to our RSS for latest tips, tricks and examples on cutting edge stuff.
Tue Jun 23

Top 12 Smart Tips To Work With SQL

Your users probably don’t know a thing about SQL, but you know its value. It’s everywhere, it’s easy to learn, and SQL solutions are simple to implement. Whether you use SQL a lot or sparingly, working smarter with SQL will help you avoid errors and improve performance. Many SQLs are vendor-specific. The following tips apply to Jet and Transact-SQL, but most SQL products are similar.

1: Working with Jet SQL in the Access SQL window

Access users create SQL statements every time they create a query; they just don’t know it. They’re using the Query Design window, a graphic representation of the actual SQL. Most users can’t create the appropriate SQL statements they need, so the graphical interface is helpful, but it can help you too. If you can’t create error-less SQL code off the top of your head, let the SQL window help out:
  • Create a query using the Query Design window and then copy the code from the SQL window into a VBA module for use in code.
  • When a query in code returns one of VBA’s meaningless error messages, copy the SQL statement to the SQL window and run it. Access will usually return better information about the error than VBA.
You can’t always copy a SQL statement straight from the module to the SQL window. If the statement includes concatenation or variables, add a Debug.Print statement right after the definition statement. Then, if you need to debug the statement, copy the evaluated statement from the Immediate window. For instance, the following statement in code won’t run in the SQL window because of the variables and concatenation:
"SELECT * FROM " & tbl & " ORDER BY " & fld
However, if you follow the statement with a Debug.Print statement, you can copy the evaluated results, which follow, from the Immediate window:
SELECT * FROM Employees ORDER BY HireDate

2: Words reserved by SQL

SQL reserves several words, such as keywords. Avoid using these words to name columns, tables, variables, or any objects. Their use outside of the context in which the engine expects them confuses the engine and generates errors, or worse — incorrect results.

3: The difference between ALL, DISTINCT and DISTINCTROW

SQL’s SELECT statement supports three predicates: ALL, DISTINCT and DISTINCTROW. ALL is the default and returns all records that fulfil any specified conditions. DISTINCT limits the results to unique values in a specific column or columns. For instance, the following statement would return only one record for each LastName value:
SELECT DISTINCT LastName
In other words, if you have a record for both John and Mary Smith, this statement returns only one record for Smith. However, DISTINCT works with all the columns, not just the column that immediately follows. That means, this statement will return a record for both John and Mary because the combined columns don’t produce a duplicate record:
SELECT DISTINCT LastName, FirstName
If the SELECT clause references more than one column, the combination of values from all the selected columns must be unique for a given record. DISTINCT has a few quirks you should know about but might not expect:
  • Don’t use DISTINCT with the asterisk character (*). You must specify columns by name.
  • Any query using DISTINCT can’t be updated, which makes sense.
While DISTINCT works with columns, DISTINCTROW works with records. (Transact-SQL doesn’t support DISTINCTROW.) This predicate has a few limitations of its own, which can make an error hard to troubleshoot:
  • The engine ignores DISTINCTROW if there’s only one table in the query.
  • The engine ignores DISTINCTROW if you reference all columns from all of the underlying tables.

4: Retrieving only what you need

It’s tempting to use the asterisk character (*) when retrieving data via a SELECT clause, but don’t, unless you really need to retrieve all columns. The more data you retrieve, the slower your application will perform. For optimum performance, retrieve only the columns you need.

5: Variations in aggregates

Both SQL and VBA support aggregate functions, but not the same aggregates. Although they aren’t interchangeable, you can often use one or the other. Table A compares the two types within the context of Jet and Transact-SQL.

Table A

T-SQL Jet VBA Explanation Considers Null
Avg Avg DAvg Returns the mean or average of the specified domain No
Count Count DCount Counts the number of non-Null values in the specified column No
Count(*) Count(*) DCount(*) Counts the number of rows Yes
Sum Sum DSum Totals the values in the specified column No
Min Min DMin Returns the smallest value No
Max Max DMax Returns the largest value No
First Returns the value from the first row in the specified column Yes
Last Returns the value from the last row in the specified column Yes
StDev StDev DStDev Returns sample standard deviation No
StDevP StDevP DStDevP Returns population standard deviation No
Var Var DVar Returns sample variance No
VarP VarP DVarP Returns population deviation No
Don’t use VBA’s domain aggregates when a SQL aggregate will do. When you must use VBA’s domain aggregates, apply an index to the underlying column for best performance. Keep in mind that although SQL’s GROUP BY doesn’t eliminate null values, most SQL aggregates don’t evaluate them. If you want null values considered, you must accommodate them in the expression.

6: GROUP BY considerations

SQL’s GROUP BY clause defines subsets of data. The most important thing to remember when including a GROUP BY clause is to include only those columns that define the subset or summarise data for the subset. In other words, a GROUP BY can’t include extraneous data. For instance, to learn the number of orders placed on a specific date, you’d use a statement similar to the following:
SELECT OrderDate, Count(OrderID) 

FROM Orders

GROUP BY OrderDate
This query would return one record for each date. Each record would display the date and the number of orders for that date. You can’t include any other columns. GROUP BY is versatile. You don’t need to specify a column in the SELECT clause to group by it. For instance, you could omit OrderDate from the above query and return just the count for each date (although the results wouldn’t make much sense). As long as the GROUP BY column is in the source, SQL doesn’t require it in the SELECT clause. On the other hand, if you refer to a column in the SELECT clause, you must also include it in the GROUP BY clause or in an aggregate function. For instance, the following statement doesn’t work because the Freight column isn’t part of an aggregate or the GROUP BY clause:
SELECT OrderDate, Count(OrderID) AS TotalForDate, Freight

FROM Orders

GROUP BY OrderDate
In truth, it doesn’t really make sense to try to include a column in this way. If you want the Freight data within the context of a GROUP BY query, you probably want a summary of the freight values in the group, as follows:
SELECT OrderDate, Count(OrderID) Max(Freight) 

FROM Orders

GROUP BY OrderDate
Jet can’t group a Memo or OLE Object column. In addition, you can’t include a GROUP BY clause in an UPDATE statement, which makes sense. SQL would have no way of knowing which record to update.

7: Altering table structure

There are several SQL statements for altering the design of a table. Always approach such a task with care because you could destroy data. For instance, if you change a column’s data type, the engine might truncate or delete existing data to accommodate the new column’s data type. Keep the following limitations in mind when altering tables:
  • You can’t alter an existing column’s data to COUNTER if the column already contains data.
  • You can’t rename a column. You must remove the column using DROP COLUMN and then re-create it using the new name. To preserve the data, create the new column, copy data from the original column using UPDATE, and then delete the original column.
  • Before altering a table using ALTER TABLE, close it. Otherwise, the engine will return an error. The following VBA code will close an open table and inhibit the error that’s generated if the table isn’t open:
On Error Resume Next

DoCmd.Close acTable, table

On Error GoTo 0
  • You can’t delete a column if a constraint exists on that column. First, delete the constraint using DROP CONSTRAINT.
  • Remove a CHECK CONSTRAINT before deleting the table to which it applies.
  • You can’t modify an existing relationship. You must delete it and then re-create it.

8: SQL’s problem child, INSERT INTO

SQL’s INSERT INTO statement lets you add new data to an existing table. Used correctly, INSERT INTO works great, but you must remember one critical thing: although the table designs don’t have to match, the specific columns identified on both sides of the task must match. In short, the table that receives the new data must contain the same columns as the incoming data. You can also explicitly identify each column using the VALUES clause as follows:
INSERT INTO target (col1, col2, col3, ...)

VALUES(value1, value2, value3, ...)
However, this syntax adds only a single row at a time, so it will have limited use. You can omit the column references only if you supply a value for every column in target. When including the column references, their order must match the order in the table definition. You must include the primary key column, unless that key is an auto-numbering column — it isn’t necessary to include an auto-numbering column.

9: Using UPDATE to delete values

SQL’s DELETE statement deletes entire records. The statement won’t return an error if you specify a list of columns, but it will ignore the list. For instance, the following statements would delete all the data in a table named Employees:
DELETE

FROM Employees
DELETE Employees.*

FROM Employees
DELETE Employees.Salary

FROM Employees
Even though the last syntax specifies Salary, SQL will delete all the data, not just the Salary values. To delete specific values, use SQL’s UPDATE in the form:
UPDATE source

SET source.column = Null

[WHERE condition]
However, even this will return an error if column properties are in conflict. For instance, if a column requires data, it will reject Null.

10: Dropped properties with SELECT INTO

SQL’s SELECT INTO creates a new table by copying rows from an existing table using the following form:
SELECT list|* INTO newtable

FROM sourcetable

[WHERE condition]
However, this statement doesn’t copy the table exactly. It won’t copy the original table’s primary key, indexes, or column and table properties (beyond the default settings). In addition, it ignores Caption settings and uses the original column names. When including a SELECT INTO statement, keep in mind that this statement will replace an existing table if one of the same name (newtable) exists within its scope. Fortunately, SQL will warn you first. In some cases, the engine will delete the existing table before it actually creates the new one, so if something goes wrong, you can’t rely on the original table because it’ll be gone. Before running a SELECT INTO, it’s a good idea to make a copy of the existing newtable, if one exists. In addition, if newtable is open, SQL will return an error. You don’t have to copy data to the new table. You can create a new empty table by adding a WHERE clause as follows:
SELECT * INTO newtable

FROM source

WHERE FALSE
SQL will create newtable but copy no data to it because no record can satisfy the FALSE condition.

11: The difference between WHERE and HAVING

The WHERE and HAVING clauses perform similar functions but they aren’t interchangeable. WHERE limits the data returned by the SELECT clause; therefore, a GROUP BY is inconsequential. The engine compares data and eliminates records that don’t satisfy the WHERE clause before it groups the records. On the other hand, the HAVING clause eliminates data that doesn’t satisfy the grouping criteria. If you have trouble remembering which clause to use, remember that the WHERE clause is positioned before the GROUP BY clause and the engine applies the WHERE clause before grouping the records.

12: UNION match-up

SQL’s UNION operator lets you combine records from different sources using the following form:
SELECT1 list|*

UNION 

SELECT2 list|*
The important thing to remember with a UNION is that the column order in both SELECT statements must match. The column names don’t have to match, but each list must contain the same number of columns and their data types must be compatible. If the data types don’t match, the engine sometimes chooses the most compatible for you. The results might work, but then again, they might not. By default, UNION sorts records by the values in the first column because UNION uses an implicit DISTINCT predicate to omit duplicate records. To include all records, including duplicates, use UNION ALL, which eliminates the implicit sort. If you know there are no duplicate records, but there are a lot of records, you can use UNION ALL to improve performance because the engine will skip the comparison that’s necessary to sort (to find duplicates). Author: Susan Harkins If you’ve got any thoughts, comments or suggestions for things we could add, leave a comment! Also please Subscribe to our RSS for latest tips, tricks and examples on cutting edge stuff.

Top 12 Smart Tips To Work With SQL

Your users probably don’t know a thing about SQL, but you know its value. It’s everywhere, it’s easy to learn, and SQL solutions are simple to implement. Whether you use SQL a lot or sparingly, working smarter with SQL will help you avoid errors and improve performance. Many SQLs are vendor-specific. The following tips apply to Jet and Transact-SQL, but most SQL products are similar.

1: Working with Jet SQL in the Access SQL window

Access users create SQL statements every time they create a query; they just don’t know it. They’re using the Query Design window, a graphic representation of the actual SQL. Most users can’t create the appropriate SQL statements they need, so the graphical interface is helpful, but it can help you too. If you can’t create error-less SQL code off the top of your head, let the SQL window help out:
  • Create a query using the Query Design window and then copy the code from the SQL window into a VBA module for use in code.
  • When a query in code returns one of VBA’s meaningless error messages, copy the SQL statement to the SQL window and run it. Access will usually return better information about the error than VBA.
You can’t always copy a SQL statement straight from the module to the SQL window. If the statement includes concatenation or variables, add a Debug.Print statement right after the definition statement. Then, if you need to debug the statement, copy the evaluated statement from the Immediate window. For instance, the following statement in code won’t run in the SQL window because of the variables and concatenation:
"SELECT * FROM " & tbl & " ORDER BY " & fld
However, if you follow the statement with a Debug.Print statement, you can copy the evaluated results, which follow, from the Immediate window:
SELECT * FROM Employees ORDER BY HireDate

2: Words reserved by SQL

SQL reserves several words, such as keywords. Avoid using these words to name columns, tables, variables, or any objects. Their use outside of the context in which the engine expects them confuses the engine and generates errors, or worse — incorrect results.

3: The difference between ALL, DISTINCT and DISTINCTROW

SQL’s SELECT statement supports three predicates: ALL, DISTINCT and DISTINCTROW. ALL is the default and returns all records that fulfil any specified conditions. DISTINCT limits the results to unique values in a specific column or columns. For instance, the following statement would return only one record for each LastName value:
SELECT DISTINCT LastName
In other words, if you have a record for both John and Mary Smith, this statement returns only one record for Smith. However, DISTINCT works with all the columns, not just the column that immediately follows. That means, this statement will return a record for both John and Mary because the combined columns don’t produce a duplicate record:
SELECT DISTINCT LastName, FirstName
If the SELECT clause references more than one column, the combination of values from all the selected columns must be unique for a given record. DISTINCT has a few quirks you should know about but might not expect:
  • Don’t use DISTINCT with the asterisk character (*). You must specify columns by name.
  • Any query using DISTINCT can’t be updated, which makes sense.
While DISTINCT works with columns, DISTINCTROW works with records. (Transact-SQL doesn’t support DISTINCTROW.) This predicate has a few limitations of its own, which can make an error hard to troubleshoot:
  • The engine ignores DISTINCTROW if there’s only one table in the query.
  • The engine ignores DISTINCTROW if you reference all columns from all of the underlying tables.

4: Retrieving only what you need

It’s tempting to use the asterisk character (*) when retrieving data via a SELECT clause, but don’t, unless you really need to retrieve all columns. The more data you retrieve, the slower your application will perform. For optimum performance, retrieve only the columns you need.

5: Variations in aggregates

Both SQL and VBA support aggregate functions, but not the same aggregates. Although they aren’t interchangeable, you can often use one or the other. Table A compares the two types within the context of Jet and Transact-SQL.

Table A

T-SQL Jet VBA Explanation Considers Null
Avg Avg DAvg Returns the mean or average of the specified domain No
Count Count DCount Counts the number of non-Null values in the specified column No
Count(*) Count(*) DCount(*) Counts the number of rows Yes
Sum Sum DSum Totals the values in the specified column No
Min Min DMin Returns the smallest value No
Max Max DMax Returns the largest value No
First Returns the value from the first row in the specified column Yes
Last Returns the value from the last row in the specified column Yes
StDev StDev DStDev Returns sample standard deviation No
StDevP StDevP DStDevP Returns population standard deviation No
Var Var DVar Returns sample variance No
VarP VarP DVarP Returns population deviation No
Don’t use VBA’s domain aggregates when a SQL aggregate will do. When you must use VBA’s domain aggregates, apply an index to the underlying column for best performance. Keep in mind that although SQL’s GROUP BY doesn’t eliminate null values, most SQL aggregates don’t evaluate them. If you want null values considered, you must accommodate them in the expression.

6: GROUP BY considerations

SQL’s GROUP BY clause defines subsets of data. The most important thing to remember when including a GROUP BY clause is to include only those columns that define the subset or summarise data for the subset. In other words, a GROUP BY can’t include extraneous data. For instance, to learn the number of orders placed on a specific date, you’d use a statement similar to the following:
SELECT OrderDate, Count(OrderID) 

FROM Orders

GROUP BY OrderDate
This query would return one record for each date. Each record would display the date and the number of orders for that date. You can’t include any other columns. GROUP BY is versatile. You don’t need to specify a column in the SELECT clause to group by it. For instance, you could omit OrderDate from the above query and return just the count for each date (although the results wouldn’t make much sense). As long as the GROUP BY column is in the source, SQL doesn’t require it in the SELECT clause. On the other hand, if you refer to a column in the SELECT clause, you must also include it in the GROUP BY clause or in an aggregate function. For instance, the following statement doesn’t work because the Freight column isn’t part of an aggregate or the GROUP BY clause:
SELECT OrderDate, Count(OrderID) AS TotalForDate, Freight

FROM Orders

GROUP BY OrderDate
In truth, it doesn’t really make sense to try to include a column in this way. If you want the Freight data within the context of a GROUP BY query, you probably want a summary of the freight values in the group, as follows:
SELECT OrderDate, Count(OrderID) Max(Freight) 

FROM Orders

GROUP BY OrderDate
Jet can’t group a Memo or OLE Object column. In addition, you can’t include a GROUP BY clause in an UPDATE statement, which makes sense. SQL would have no way of knowing which record to update.

7: Altering table structure

There are several SQL statements for altering the design of a table. Always approach such a task with care because you could destroy data. For instance, if you change a column’s data type, the engine might truncate or delete existing data to accommodate the new column’s data type. Keep the following limitations in mind when altering tables:
  • You can’t alter an existing column’s data to COUNTER if the column already contains data.
  • You can’t rename a column. You must remove the column using DROP COLUMN and then re-create it using the new name. To preserve the data, create the new column, copy data from the original column using UPDATE, and then delete the original column.
  • Before altering a table using ALTER TABLE, close it. Otherwise, the engine will return an error. The following VBA code will close an open table and inhibit the error that’s generated if the table isn’t open:
On Error Resume Next

DoCmd.Close acTable, table

On Error GoTo 0
  • You can’t delete a column if a constraint exists on that column. First, delete the constraint using DROP CONSTRAINT.
  • Remove a CHECK CONSTRAINT before deleting the table to which it applies.
  • You can’t modify an existing relationship. You must delete it and then re-create it.

8: SQL’s problem child, INSERT INTO

SQL’s INSERT INTO statement lets you add new data to an existing table. Used correctly, INSERT INTO works great, but you must remember one critical thing: although the table designs don’t have to match, the specific columns identified on both sides of the task must match. In short, the table that receives the new data must contain the same columns as the incoming data. You can also explicitly identify each column using the VALUES clause as follows:
INSERT INTO target (col1, col2, col3, ...)

VALUES(value1, value2, value3, ...)
However, this syntax adds only a single row at a time, so it will have limited use. You can omit the column references only if you supply a value for every column in target. When including the column references, their order must match the order in the table definition. You must include the primary key column, unless that key is an auto-numbering column — it isn’t necessary to include an auto-numbering column.

9: Using UPDATE to delete values

SQL’s DELETE statement deletes entire records. The statement won’t return an error if you specify a list of columns, but it will ignore the list. For instance, the following statements would delete all the data in a table named Employees:
DELETE

FROM Employees
DELETE Employees.*

FROM Employees
DELETE Employees.Salary

FROM Employees
Even though the last syntax specifies Salary, SQL will delete all the data, not just the Salary values. To delete specific values, use SQL’s UPDATE in the form:
UPDATE source

SET source.column = Null

[WHERE condition]
However, even this will return an error if column properties are in conflict. For instance, if a column requires data, it will reject Null.

10: Dropped properties with SELECT INTO

SQL’s SELECT INTO creates a new table by copying rows from an existing table using the following form:
SELECT list|* INTO newtable

FROM sourcetable

[WHERE condition]
However, this statement doesn’t copy the table exactly. It won’t copy the original table’s primary key, indexes, or column and table properties (beyond the default settings). In addition, it ignores Caption settings and uses the original column names. When including a SELECT INTO statement, keep in mind that this statement will replace an existing table if one of the same name (newtable) exists within its scope. Fortunately, SQL will warn you first. In some cases, the engine will delete the existing table before it actually creates the new one, so if something goes wrong, you can’t rely on the original table because it’ll be gone. Before running a SELECT INTO, it’s a good idea to make a copy of the existing newtable, if one exists. In addition, if newtable is open, SQL will return an error. You don’t have to copy data to the new table. You can create a new empty table by adding a WHERE clause as follows:
SELECT * INTO newtable

FROM source

WHERE FALSE
SQL will create newtable but copy no data to it because no record can satisfy the FALSE condition.

11: The difference between WHERE and HAVING

The WHERE and HAVING clauses perform similar functions but they aren’t interchangeable. WHERE limits the data returned by the SELECT clause; therefore, a GROUP BY is inconsequential. The engine compares data and eliminates records that don’t satisfy the WHERE clause before it groups the records. On the other hand, the HAVING clause eliminates data that doesn’t satisfy the grouping criteria. If you have trouble remembering which clause to use, remember that the WHERE clause is positioned before the GROUP BY clause and the engine applies the WHERE clause before grouping the records.

12: UNION match-up

SQL’s UNION operator lets you combine records from different sources using the following form:
SELECT1 list|*

UNION 

SELECT2 list|*
The important thing to remember with a UNION is that the column order in both SELECT statements must match. The column names don’t have to match, but each list must contain the same number of columns and their data types must be compatible. If the data types don’t match, the engine sometimes chooses the most compatible for you. The results might work, but then again, they might not. By default, UNION sorts records by the values in the first column because UNION uses an implicit DISTINCT predicate to omit duplicate records. To include all records, including duplicates, use UNION ALL, which eliminates the implicit sort. If you know there are no duplicate records, but there are a lot of records, you can use UNION ALL to improve performance because the engine will skip the comparison that’s necessary to sort (to find duplicates). Author: Susan Harkins If you’ve got any thoughts, comments or suggestions for things we could add, leave a comment! Also please Subscribe to our RSS for latest tips, tricks and examples on cutting edge stuff.
Mon Jun 1

Best Practices of ActiveX Data Object (ADO)

ADO - ActiveX Data Object is a library to manipulate data i.e. retrieving and storing records. Being a Microsoft library ADO offers great ease to help developers with their database queries. ADO is quite flexible and powerful as it doesn’t let the developer bother how the database is implemented. They can straightaway use the database if you can successfully connect to it. Although, ADO provides a great set of features to be used but here are best practices to use ADO objects efficiently to get the best out of it.

How to Instantiate Objects In ADO

Don’t use shortcuts while creating a new objects. If you use shortcuts then Visual Basic works harder to find out the object. If you use the following
Dim conn As New ADODB.Connection
The above method will create a new ADO connection and then assign to string conn. I would recommend you to use in the following manner
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
This will perform better than the its tempting shortcut.

Whether or Not to Qualify the Library

ADO and DAO share many of their objects so there is a chance that you won’t get the intended object if the library isn’t explicitly declared. Instead of using
Dim cn As Connection
use the following
Dim cn As ADODB.Connection
Calling the library explicitly removes any chance of wrong reference.

Data Source Name (DSN) Connections Should Be Avoided

For a single connection to the database DSN will work perfectly fine but in case of large applications where you need to connect multiple times DSN will drastically slow your application down. You should avoid specifying all the connection details in code by referring to a DSN. However, there are few limitations to it i.e.
  1. You must install the DSN on each client system. Updates must be made to each client.
  2. They require a hit to the Registry.
  3. They often take longer to connect than OLE DB.

Don’t Forget to Release Connections

OLE DB establishes a new connection every time you connect. If you fail to release those Connection objects, you could eventually run out of connections. After you close a connection be sure to set each Connection object to Nothing as follows:
 connectionobject.Close
 Set connectionobject = Nothing

Do Not Use Recordset Data To Update Your Database

Use stored procedures or SQL statement to update your database rather than Recordset. Recordset objects are very costly and requires lot of resources. Ideally, stored procedures are best for updates, deletes etc. for the following reasons:
  1. A stored procedure is faster than an equivalent action query.
  2. Stored procedures cache execution plans, so they perform better.
  3. Stored procedures can handle multiple insert, update and delete operations, which reduces network traffic. Combine multiple tasks into one stored procedure, when possible. One trip of many tasks will (usually) perform better than several short trips.
  4. You can call a stored procedure from different applications.

OLE DB Providers Should be Preferred

Native OLE DB providers are best when it comes to database connections. As they give you access to properties and methods which others connections fails to provide.

Think About Efficient Cursors in ADO

Default cursor in ADO which is forward-only performs best and require very less overhead. When you are not using forward-only cursor, you have a choice to choose from the following cursors:
  1. adOpenStatic - provides a static copy of the records (you can’t see additions, changes or deletions by other users), but all types of movement are enabled.
  2. adOpenDynamic - is a dynamic cursor that requires more overhead, because updates are immediate and all types of movement are enabled. The dynamic cursor isn’t currently supported by the Microsoft Jet OLE DB Provider (Access), and therefore defaults to a keyset cursor if you specify adOpenDynamic against a Jet database.
  3. adOpenDynamic - is similar to the dynaset recordset type and dynamic cursor, but the resulting recordset is based on a single table. Since the dynamic cursor type isn’t currently supported by the Microsoft Jet OLE DB Provider, Jet defaults to a static cursor when you apply the adCmdTableDirect option.
  4. adOpenKeyset - allows you to update existing records at the time of creation, but you can’t see additions or deletions. All types of movement are enabled.

Record Count Property Should be Avoided with Forward-Only Cursor

ADO returns -1 instead of an error if you try to record count with the forward only cursor which is bit strange. You may try to count the record with other cursors too but unfortunately the results may not be correct. When the RecordCount property doesn’t return the right number, add a MoveLast method. Either way, moving through the records can take awhile, so avoid counting records during heavy processing times.

Connection Should Be Used Whenever Possible

You can pass a connection string to a Command, Recordset or Record object and in doing so, implicitly create a Connection object each time. A more efficient solution is to use one Connection object and pass it to each object when an active connection is required.

Read Connection String

An open Command, Recordset or Record object can return its connection string using the following statement:
obj.ActiveConnection.ConnectionString
Use a MsgBox() function or Debug.Print statement to display the statement’s results. Or use the above statement to specify the connection string in other statements or to return information about the connection. Ideally there are various tips to improve ADO performance which i might write in my next post. If you’ve got any thoughts, comments or suggestions for things we could add, leave a comment! Also please Subscribe to our RSS for latest tips, tricks and examples on cutting edge stuff.
Fri May 29

MooTools v/s jQuery

MooTools v/s jQuery is a hot topic as with the advent of technology every developer is using JavaScript in one way or another. Picking up a library is not an easy task specially if you are working somewhere where they already have a set pattern or their libraries defined. Ideally, every company is either working with Moo Tools or jQuery based on their past experiences or developement expertise. Although, both of the This article will bring some of the points to your notice before choosing between Moo Tools or jQuery as your library. Apart from Moo Tools and jQuery there are other frameworks too which are used quite extensively like Dojo, Ext, YUI and Prototype. But, we are not going much into these framework at this moment and will only consider Mootools and jQuery. I will write an analysis covering all the JavaScript framework later.

Ease Of Learning

jQuery is quite easy to learn and has a good community support. If you are not a JavaScript freak still jQuery will be easier to learn and accomplish things where Moo Tools will require you to spend more time. In one line we can say that learning curve will be steep in Moo Tools than jQuery. In terms of community support, availability of books, search queries on Google its clearly evident that jQuery is leading the race with huge margin. Why jQuery is more popular? We can say just because of the learning ease, excellent documentation and active promotion of jQuery library.

DOM & Pure JavaScript

When we want to work only with DOM (Where 99% of all JavaScript runs) jQuery is far superior than Moo Tools. One reason why jQuery is so popular because of the reason that it does not expects you be learn JavaScript inside out. You are not required to think through prototypal inheritance, binding, “this”, and native prototypes. But, when we think in terms of JavaScript in full breadth we will notice that jQuery is simply focusing on DOM only. jQuery doesn’t address inheritance, basic utilities of all the native types in the JavaScript language etc. Still, if you want to do these you have to write your own stuff. jQuery makes the DOM your playground, but the rest of JavaScript is just not in its scope. Moo Tools on the other hand is quite different and covers entire JavaScript language not just DOM. This is one of the reason of Moo Tools being bit hard for the early developers. Because MooTools focuses on making the JavaScript API itself more stable and coherent, it is focused less on giving you an interface that “changes the way you write JavaScript” and more on making JavaScript as a whole less frustrating; MooTools is an extension to the JavaScript language. MooTools tries to make JavaScript the way it is meant to be. A significant portion of the core library is spent on augmenting Function, String, Array, Number, Element and other prototypes. The other big thing it offers is a function called Class. jQuery does not offer an inheritance system nor does it offer any enhancements to native objects (Function, String, etc). This is not a deficiency of jQuery as the authors of jQuery could easily offer these things. Rather, they have designed a toolkit with a different goal in mind. Where MooTools aims to make JavaScript more fun, jQuery aims to make the DOM more fun and its designers have chosen to limit their scope to that task. In broader way we can say that everything you can do in jQuery can be done in Moo Tools but there is no way to emulate stuff done in Moo Tools into jQuery code because of jQuery’s focus on the DOM. MooTools has a broader functionality than jQuery, but there’s nothing about jQuery that prevents you from doing those things. jQuery focuses on expressiveness, quick and easy coding, and the DOM while MooTools focuses on extension, inheritance, legibility, reuse, and maintainability. Further, the MooTools core does not contain every feature you can imagine and neither does the jQuery core. Both frameworks keep their cores rather lean, leaving it to you and others to write plug-ins and extensions. Their job is not to give you every feature you could want but to give you the tools so that you can implement anything you can imagine. This is the power of JavaScript, and of JavaScript frameworks in general, and both frameworks excel at it. MooTools takes a more holistic approach and gives you tools to write anything you can imagine beyond the scope of the DOM, but pays the price by having a steeper learning curve. MooTools extensibility and holistic approach gives you a superset of jQuery’s features, but jQuery’s focus on a slick DOM API doesn’t preclude you from using the native inheritance methods of JavaScript or from using a class system like MooTools if you want it. Slickspeed is a small analytical approach to benchmark the performance of JS frameworks. If you’ve got any thoughts, comments or suggestions for things we could add, leave a comment! Also please Subscribe to our RSS for latest tips, tricks and examples on cutting edge stuff.