20 Helpful jQuery Methods you Should be Using

So you’ve been playing with jQuery for a while now, you’re starting to get the hang of it, and you’re really liking it! Are you ready to take your jQuery knowledge to level two? Today, I’ll demonstrate twenty functions and features you probably haven’t seen before!


1 after() / before()

Sometimes you want to insert something into the DOM, but you don’t have any good hooks to do it with; append() or prepend() aren’t going to cut it and you don’t want to add an extra element or id. These two functions might be what you need. They allow you to insert elements into the DOM just before or after another element, so the new element is a sibling of the older one.

$('#child').after($('<p />')).text('This becomes a sibling of #child'));
$('#child').before($('<p />')).text('Same here, but this is go about #child'));

Read more

How to run ASP on the Mac

I have an old web app that’s using Active Server Pages, and I want to run it on my (Intel) Mac. This is basically not a big deal, because you can simply use Microsoft IIS under Parallels.

But I wanted to use IIS only for ASP files, and let Apache handle the rest. And here’s how to make sure IIS only handles what it’s supposed to:

1. Make a share of your Webserver Root directory in Parallels.
2. On the PC, in the IIS Control Panel, click on the default Website, click on Properties, then choose Home Directory, select that the content should come from A Share located on another computer and enter .PSFyoursharename as the network directory.
3. Make sure you allow ASP under Web Service Extensions
4. On the Mac, uncomment the following lines in /private -> etc -> httpd -> httpd.conf (remove the #’s):

      LoadModule rewrite_module
      libexec/httpd/mod_rewrite.so
      LoadModule proxy_module
      libexec/httpd/libproxy.so
      AddModule mod_rewrite.c
      AddModule mod_proxy.c

Read more

Read Text File (.txt) Using JSP / Java

<% BufferedReader input = new BufferedReader(new FileReader(“text2read.txt”)); String line = “”; while ((line = input.readLine()) != null) { out.println(line); } output.flush(); input.close(); %> Source: http://experts.about.com/q/JSP-Java-Server…xt-file-JSP.htm Additional example http://www.jguru.com/forums/view.jsp?EID=536740

Valid styles for converting datetime to string

I wrote this little table and procedure to help me remember what style 104 did, or how to get HH:MM AM/PM out of a DATETIME column. Basically, it populates a table with the valid style numbers, then loops through those, and produces the result (and the syntax for producing that result) for each style, given the current date and time.

It uses also a cursor. This is designed to be a helper function, not something you would use as part of a production environment, so I don’t think the performance implications should be a big concern.

Read more

Use CAST (or CONVERT) to handle Null Date values in Microsoft SQL Server

In an SQL Server View, a problem is that the DateTime field has many Null values which is causing a problem with the parsing of the data in MSAccess.

How to I use CAST (or CONVERT) to handle Null Date values in my SQL Server view?

There is a way to use CAST or CONVERT similar to the nz type function in MSAccess to handle null date values but I can’t remember the syntax.

What is happening now is that I get a data mismatch in my MSAccess function when it hits a Null Date value. Can I somehow use the ISNULL or ISDate function? I believe I need to somehow return “” instead of Null.

Read more

MS SQL Server / SELECT clause with a CASE expression

In SQL Server, if you have a column which has NULLs and instead of nulls, if you want to display ‘Nothing’, what would you do?

The following query

SELECT CASE Dept_Name WHEN NULL THEN 'Nothing' ELSE Dept_Name END Dept_Name
FROM Inventory

would still display the nulls and not ‘Nothing’.

Workaround:

Read more

SQL SELECT INTO Statement

The SQL SELECT INTO statement can be used to create backup copies of tables.

The SQL SELECT INTO Statement

The SELECT INTO statement selects data from one table, creates a new table with the exact structure and size and inserts automatically the selected data into the new table.

SQL SELECT INTO Syntax

We can select all columns into the new table:

SELECT *
INTO new_table_name [IN externaldatabase]
FROM old_tablename

Or we can select only the columns we want into the new table:

SELECT column_name(s)
INTO new_table_name [IN externaldatabase]
FROM old_tablename

Read more

JBoss in Action

This book is divided into four parts, containing 15 chapters and two appendices. Chapter 1: The JBoss Application Server If you are using JBoss than you can simply skip Chapter 1. This chapter gets you up and running with JBoss by describing the directories and files that are part of JBoss AS, how to start … Read more

How to create an auto-incrementing column in MS SQL Server 2000

Unlike Microsoft SQL Server 2005 and 2008, MS SQL Server 2000 does not have a ROW_NUMBER() function which applies only to the results of a SELECT query as it doesn’t store any permanent value in the DB. The way it works is in keeping with the principles of relational databases. There is no implict ordering … Read more