Leave a comment

How to retrieve the column names for an MSSQL table

Ever wanted to retrieve just the column names from a table?

All you have to do is run this simple query:

SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = ‘yourTableNameGoesHere’

Enjoy!

Leave a comment

How to determine the last time an MSSQL table was updated.

Today I needed to get the last updated timestamp for a table and this simple query tells me just that.

SELECT last_user_update
FROM sys.dm_db_index_usage_stats
WHERE (object_id = OBJECT_ID(‘yourTableNameHere’))

Hope this helps you!

Leave a comment

CFEclipse – how to import my snippets!

This always seem to stump me and figured I should share how this is done.

It’s easy if you know how. Basically, all snippets are stored in the snippets folder within your workspace.

{workspace location}\workspace\.metadata\.plugins\org.cfeclipse.cfml\snippets

Simply dump all your xml snippets in there and presto, they will appear in Eclipse when you open the application.

Leave a comment

Ever needed to add an IF condition to your queries?

Today I needed to create an ORACLE query with an IF ELSE condition.  If you need to do this, give the CASE WHEN statement a go:

Here’s an example:

SELECT emp_name, CASE WHEN  sex  = ‘F’  THEN ‘Female’ ELSE ‘Male’ END as sexInwords
FROM employees

Works a treat!

1 Comment

How to delete a remote GIT branch

Today I needed to delete one of my remote branches.  Here is the solution I found, simply run this command from GIT Bash:

$ git push origin :remoteBranchName

So if for example your remote branch is called “testBranch” and the remote is called “origin”, you would run:

$ git push origin :testBranch

Hope this helps anyone out there.

Leave a comment

Why Google+?

If you haven’t heard, Google+ is the latest social network on the block and is taking the world by storm at the moment. And it’s still in beta!

Some people refer to it as the grown up version of Facebook and I have to say I agree completely. Google has done a magnificent job in addressing the faults and limitations of Facebook. Have a look at the following videos to find out all you need to know about Google+ enjoy!

2 Comments

How to password protect my site?

To password protect your site or a folder within your site, the quickest method is likely to be the .htaccess method.

You simply need two files:
1. .htaccess
2. .htpasswd

The .htpasswd file contains the login details (username:encryted password) of the users allowed to enter the area of the site you are protecting. This ideally should be placed outside of the web root so it is inaccessible to the world.

The .htaccess file needs to be placed in the folder you wish to protect. Basically if someone tried to access any file below the folder location of the .htaccess file, they would be prompted to enter login details. The contents of this file states that authorisation is required and also points to the location of the .passwd file so that the entered login details can be checked against.

There is a great and easy to use tool on Dynamic Drive to help you generate these two files.

As a web developer, a great use for this is to password protect your client site until it is ready to go live.  This allows the search engines to only start crawling the site once the site is goes live.

More reading: http://www.javascriptkit.com/howto/htaccess3.shtml

Hope you found this useful! :)

Follow

Get every new post delivered to your Inbox.

Join 32 other followers