Testbeitrag Maschinenring

Hier ein tolles Wetter-Widget vom Maschinenring:

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)) />

my personal favourite tracks discovered during year 2011

These are my personal favourite tracks discovered during year 2011. Have fun listening and tell me in the comments whether i’ve forgotten anyone, if you like!

Beirut / Santa Fe
[soundcloud url=“http://api.soundcloud.com/tracks/20716116″]

Alexander / Truth
[soundcloud url=“http://api.soundcloud.com/tracks/8975154″]

The Rapture / How deep is your love
[soundcloud url=“http://api.soundcloud.com/tracks/19422484″]

M83 / MIdnight City
[soundcloud url=“http://api.soundcloud.com/tracks/19087066″]

Cassette Culture / We once had an empire (Jungle Fiction Remix)
[soundcloud url=“http://api.soundcloud.com/tracks/10026064″]

Beastie Boys feat. Santigold – Don’t Play No Game That I Can’t Win
[soundcloud url=“http://api.soundcloud.com/tracks/14174131″]

Aeroplane – Without Lies
[soundcloud url=“http://api.soundcloud.com/tracks/4437762″]

Feist – How Come You Never Go There
[soundcloud url=“http://api.soundcloud.com/tracks/25729050″]

James Blake – Limit To Your Love
[soundcloud url=“http://api.soundcloud.com/tracks/30547798″]

Eliza Doolittle – Money Box (Jamie XX Remix)
[soundcloud url=“http://api.soundcloud.com/tracks/25511331″]

Eleanor Friedberger – Inn Of The Seventh Ray
http://youtu.be/vKewaFTAvIw

Lana Del Ray – Video Games
[soundcloud url=“http://api.soundcloud.com/tracks/26528531″]

Noah And The Whale – L.I.F.E.G.O.E.S.O.N.
[soundcloud url=“http://api.soundcloud.com/tracks/11147444″]