Reset the identity key for a column in SQL Server

Sometimes you need to reset an identity column value back to 0 (after inserting test-data and deleting the rows again for example). Of course, generally you shouldn’t change primary keys and of course primary key values doesn’t matter at all, but for the case you want to start with an new idenity 1 for the first row then simply use:

DBCC CHECKIDENT('YOURTABLENAME', RESEED, 0)

CSS: display an URL after each hyperlink

This is an awesome and comfortable way to automatically display the URL from the href-attribute after each link just with CSS:

a:after { content: attr(href);}

When using this CSS rule, your links will be displayed something like this:

This is your Linktext http://yourlink.com/

Have fun and use this basic css technique for example in print stylesheets or, in an extended way even on your site.

getting the number of files in a certain directory (linux or os x)

This is a quick way to get the number of files in a certain directory.
The following command even counts files potentially existing in subfolders and works as well in Linux as in Mac OS X.

find /home/some/folder -type f | wc -l

Hint: If you’re looking for the number of directories in a certain path of course you can use the option -type -d in your command

use cfhttp in cfscript version

With the cfhttp Tag (Definition: „Generates an HTTP request and handles the response from the server“) you can easily get content from other URIs.
Here’s a short example how to use cfhttp inside in CFScript, that worked for me very well.
Please note that this example works properly with getting content from username / password protected URIs, too. I’ve tested my Code with Railo 3.3.1 final


//get cfhttp result
string function getCfHttpResult(required string targetUri="") output="false" access="private" hint="returns http result for a given uri" {
try {
http = new http();
http.setMethod("get");
http.setURL("#arguments.targetUri#");
http.setUsername("#getUsername()#");
http.setPassword("#getPassword()#");.
ret = http.send().getPrefix().FileContent;
}
catch (any e) {
ret = 0;
}
}

CSS3 substring matching

This sounds really interesting: there’s are some new attribute selectors in CSS3 which give you the power to select attributes for the patterns „begins with“, „ends with“ and „contains“.  For example you could use this technique to easily style a link list (internal links, mailto-links, external links…) with different icons.
I do not know something about the performance of these selectors but i assume you should be careful while using them. However, the Browser-Support is surprisingly good.

[att^=val] – „begins with“ attribute selector
[att$=val] – „ends with“ attribute selector
[att*=val] – „contains“ attribute selector

I recommend reading the whole article written by css3.info which you can find here: http://www.css3.info/preview/attribute-selectors/

How to convert a coldfusion query to an array

There’s a quick way to convert a query column to an array. Of course there a more, but a nice one is to do that with the functions ValueList() and ListToArray().

Let’s assume your query is named “superQuery”, and a column is named “superColumn”. You’re able to turn that into an array with:

<cfset mybrandnewArray = ListToArray(ValueList(superQuery.superColumn)) />

AssociateTag for Amazon Product Advertisting API mandatory

I recognized at the end of october 2011 that my Amazon Product Advertising Classes are not working anymore. The reason ist that now a parameter called „AssociateTag“ is required which wasn’t before. You’ll find the whole description in german language here: http://blog.emeidi.com/2011/11/13/der-associate-tag-ist-fuer-die-amazon-product-advertisting-api-nun-zwingend/
If you prefer english please check https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html

iPhone simulator in white

You wanna be fancy and you’re tired of the good old  black iPhone Simulator while developing your brandnew app?

White iPhone Simulator

White iPhone Simulator

In this case you should look over to http://aentan.com/design/white-iphone-4-simulator/ and download the two png-Files on http://www.cl.ly/7GIA.
Place them in Mac­in­tosh HD/Developer/Platforms/iPhoneSimulator.platform/
Developer/Applications/iPhone Simulator.app/Contents/Resources.
Hint: To open iPhone Simulator.app as a folder, right-click it and choose Show Pack­age Con­tents and you’ll the the used graphics called homePressed.png and frame.png. Of course it’s a good idea to backup the original Files for the black iPhone, so can switch again if you’re fed up with the white Simulator

mobile web app debugging with bugaboo

Debugging code on a mobile device is still one of developers biggest problemes. But nowadays, there are a couple of possibilities to manage this. Today i want to give you a short introduction to Bugaboo (http://bugabooapp.com/), which is an open source tool for mobile web developers that provides an interactive javascript console for WebViews. This is very useful for designing and debugging mobile web apps and sites on iOS devices.

After downloading Bugaboo from iTunes Store you can follow these steps to use the helpful tool:

First of all your iOS device and your computer have to be connected to the same Wifi network. This is a must.

If you’re in one network start Bugaboo on your iOS device and browse to the website you want to debug. Now tap on the little wifi icon inside Bugaboo in the toolbar on bottom side.

Browse to a url in bugaboo

Browse to a url in bugaboo

After pressing the icon you’ll see a dialog with an url – now open a web browser of your choice on your computer and you should see a web page named „Bugaboo Javascript Console“ as shown below.

Bugaboo Javascript Console

Bugaboo Javascript Console

As you can see alle the javascript commands you type in will be executed on the web page shown in the Bugaboo app on your iOS device. Great tool for debugging javascript variables or objects – you can dump everything as usual, open alert windows etc. Of course you can also manipulate your DOM elements via javascript as usual.

Alert-Window via Bugaboo

Alert-Window via Bugaboo

DOM element manipulated

DOM element manipulated

 

For more information you can find two videos on youtube that show you bugaboo in action:

Bugaboo Introduction:
http://www.youtube.com/watch?v=G8x_gAJ_vuo

Bugaboo in Depth:
http://www.youtube.com/watch?v=6a8Llw-m7Lg