Well, you can! But you need to use the sp_OA* stored procedures and VBScript. Here is a link to the user defined function that allows you to regex in sql:
Regular Expressions in T-SQL

If you check out the comments to this link you can even find a Regex search and replace solution.

You may get this error while trying to use the OLE Automation :
Msg 15281, Level 16, State 1, Line 1
SQL Server blocked access to procedure 'sys.sp_OACreate' of component 'Ole Automation Procedures' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ole Automation Procedures' by using sp_configure. For more information about enabling 'Ole Automation Procedures', see "Surface Area Configuration" in SQL Server Books Online.

The solution I've found is use sp_configure to enable Ole Automation Procedures like this:

EXEC sp_configure 'show advanced options', 1 -- make them available
reconfigure

EXEC sp_configure 'Ole Automation Procedures', 1 -- turn on OLE
reconfigure

EXEC sp_configure -- to see the new value
EXEC sp_configure 'show advanced options', 0 -- make them unavailable
reconfigure

and has 4 comments


I've first noticed her while she was playing with Sneaker Pimps, making the soundtrack for The Saint (Val Kilmer version). She looked so interesting with her vibrato voice, weird teeth and Asian features. I've even downloaded the whole Sneaker Pimps discografy before I found out that she was with Sneaker Pimps only briefly.

Now I was listening to the remix version of Linkin Park's My December featuring Kelli Ali and I recognized the voice immediately, even if she was singing faintly in the background. So I thought I would share her with you. Below is the video I think makes her look best, even if you can find a lot of videos with her playing live either as herself , either with TigerMouth or with Japanese bands Buck-Tick or Dropz. Also some links to her site and the Wikipedia entry.


SNEAKER PIMPS - 6 UNDERGROUND

[youtube:2eBZqmL8ehg]

Official web site with texts written by Kelli herself
Main Myspace site
Another MySpace site
Wikipedia entry

and has 0 comments
I've accidentally stumbled upon the concept of Text Readability while I was searching some books on Amazon. They have this feature to show you how easy it is to read by the use of some automated indexing and analysis methods. I've researched a little and I came up with this collection of links:

SMOG (Simple Measure Of Gobbledygook) estimates the years of education needed to understand a text. As input data it uses the number of polysyllables (words with 3 or more syllables) and number of sentences. Note: if your text needs a PhD to read it doesn't mean it's smart, but that it is difficult.

Flesch-Kincaid Readability Tests - the Reading Ease and Grade Level tests. They both use as input values the number of words, sentences and syllables.

Automated Readability Index - also tries to determine the years of US education needed to understand a text. It uses as input values characters/word and words/sentence.

Fry Readability Formula - it is a graphical method of determining the education level needed to understand a text. It computes the number of sentences and syllables over a hundred words and the values are plotted onto a graph.

Gunning fog index - same thing. Uses words/sentence and number of complex words and total words. A complex word is the same thing as a polysyllable, only with a higher readability index :)

Raygor Readability Estimate - looks very similar to the Fry.

Coleman-Liau Index - like the ARI and not the others, it uses characters to compute readability. Uses total number of characters, words and syllables.

Linsear Write - Uses number of simple and complex words and the number of sentences.

Zipf's law - an empirical law (based on observation rather than determined theoretically) it states that the frequency of any word in a natural language text is roughly inversely proportional to it's rank in the frequency table.

But how does that help me?!

Well, there are online tools that do the work for you:
Tests Document Readability And Improve It
Lingua::EN::Fathom Perl CGI
EULA Analyser
Style and Diction
Reproducible Fry Graphs
Readability Studio

This text for example has the following stats:
Gunning Fog index : 12.93
Coleman Liau index : 11.25
Flesh Kincaid Grade level : 11.39
ARI (Automated Readability Index) : 10.21
SMOG : 12.72
Flesch Reading Ease : 44.16

Which means that if you didn't finish high-school, you're pretty much screwed :)

and has 0 comments
Funny enough, I was considering starting writing again. I even had this story in my head and I was considering the three parts it must have, maybe even three books. But how will I ever write three books, with my notorious impatience and lack of interest for details?

And then I've stumbled upon this book, Pandora's Star. Just the first part of a larger, two books, story, it amounted to 2Mb of text. That's like four slim books or two large ones. The author didn't even bother making the first part stand alone, I mean it is not a book that you can read and know it's over, but it can still be continued. It just stops in mid story and you have to read the other book (Judas Unleashed) to understand anything. So what this actually is... is a single story that has the size of about five normal sized novels.

The plot is also interesting, with many distinct arches that touch occasionally within a coherent world. Placed somewhere in the 24Th century, the human kind has spread to hundreds of worlds using artificial wormholes and has found the secret of rejuvenation. More than this, electronic implants make death obsolete, as anyone can be cloned and their memory restored even if their body is destroyed. So everything is nice and beautiful until they find a Hive-type alien who considers any other species a threat to be eliminated and the peace loving Commonwealth must now do battle with an expanding mind with no conscience, limits or the concept of pain.

I've just started Judas Unleashed, but my reading will probably be slower this time around. A very nice book, a bit humbling for any aspiring writer, it will hopefully end at least as well as it started.

and has 0 comments
It seems I have been challenged to a blog game that involves following some silly rules and getting out a post. I dutifully did that, that is: answer questions with randomly selected playlist items, and this is the result:
1. How are you feeling today?
Limp Bizkit - Hot Day

2. Will you get far in life?
Theatre of Tragedy - Cassandra

3. How do your friends see you?
AudioVent - The Energy

4. Will you get married?
Guano Apes - Quietly

5. What is your best friend’s theme song?
Sepultura - We who are not like others

6. What is the story of your life?
The Start - Trinity

7. What was high school like?
Savage Garden - I want You

8. How can you get ahead in life?
Ill Nino - Turns to Gray

9. What is the best thing about your friends?
Nigthwish - Two for Tragedy

10.What is in store for this weekend?
Muse - Citizen Erased

11.What song describes you?
3 - Alien Angel

12.To describe your grandparents?
System of a Down - X

13.How is your life going?
Breed - Happy Again

14.What song will they play at your funeral?
Moby - Everytime You Touch Me

15.How does the world see you?
Tsunami Bomb - A Lonely Chord

16.Will you have a happy life?
Red Flags - Crash Course

17.What do your friends really think of you?
System of a Down - Johnny

18.Do people secretly lust after you?
Anouk - R U Kiddin' Me

19. How can I make myself happy?
Muse - Endlessly

20.What should you do with your life?
Black Atmosphere - Muscle in Plastic

Now, the funny thing is that these were really randomly chosen. I had nothing to do with it! And it fits! :D

and has 0 comments
An American company has developed a microwave system that decomposes hydrocarbon into something resembling the oil it came from. That means it converts plastics of almost any kind and rubber into fuel!

Just read the link: Giant microwave turns plastic back to oil or watch the video below.

and has 0 comments
I really enjoyed the Warcraft and Starcraft ministories in the game and I was happy to hear that books have been written that take place in those parallel worlds. One of these is Starcraft Uprising.

I am disapointed to say that the book sucks. It is like a fast forward screenwrite test, with ideas that are both boring and badly conceived. The entire book can be read online, but I've lost the link, but I tell you this: it is not worth it. And the action takes place just after humans discover the Zerg, but have no idea what they are, a prequel to the Starcraft storyline.

and has 0 comments
Nu scrie ea prea des, dar cind scrie te prapadesti de ris. Ia verificati veriga asta: Negrul asta e nebun.

and has 0 comments
The root of all evil has finally been found!


related link: The true key to happiness

and has 0 comments
Two articles in today's BBC News: Bush spares Libby from jail term and 'Scepticism' over climate claims.

The first talks about Bush, very concerned about the "excessiveness" of the jail sentence for Lewis Libby, a vice-presidential aide tried and convicted for purposefully disclosing the name of an undercover CIA agent in order to harm her husband who opposed the war in Iraq and then perjury and obstructing justice. The sentence was 2.5 years in jail (a lot less than stealing something), but the president of the United States decided it is ... excessive. Hailed as a victory of justice, the whole trial was negated by this one action of president Bush. Who knows what this Libby guy has on him?
I was incredulous at first, as I was yesterday when I was reading an article about banning superfoods in Europe, stuff like blueberries, salmon, spinach and soy. But it was the name 'superfood' that was banned, not the food itself, so I had reasons to be incredulous after all. But what about this? How can one stand and watch the whole media being grossly manipulated, the population lied to and sent to war on bogus reasons, then, when people get convicted for this, they get sprung out of jail by Bush! To tell you the truth I am still incredulous. I must have misread something.

The second article talks about the public perception of climate change in Great Britain. Apparently, 56% still think that global warming is a matter of debate. By the time they "think" global warming is a problem, they will probably be boiling in their own air conditioning juice. What does it need to make them see? Sinking of the British isles? A tornado in London? Hell freezing over?

and has 0 comments
A while ago I wrote an entry about the series I have been trying to watch to relieve by boredom. Here is a new set:

Blood Ties - this one is a collection of stereotypes like cops using only paperwork, cop made detective, tough cop love, vampire looking like a young Michelangelo and helping the police, etc. It looks and feels like a 1980 show and it might just as well be one, with new actors. Bottom line: stay away from it. It sucks ass.

Dr. Who revisited - the wife likes this show and I've come to enjoy it, too. It is is silly at times, yes, but also very serious sometimes. I also admire that is a truly British production, with a lot of satire and a real effort to keep it about England. There is also an offshoot of Doctor Who, called Torchwood which is fun, but infested by the "agency" or "bureau" or "cop/fire station" bug.

Jericho felt a lot like Lost, a series that I totally despised. The premise is similar: a bunch of Westerners are stranded in an isolated place and must survive. There is even that sort of musical bang after something new appears in the show. Also, the same "we are holier than thou" attitude. But the show does have a point, it has a script, makes sense, sort of, and is a lot better than Lost overall. The main story is that the US are attacked by a lot of nukes, apparently terrorist acts, and there are these people in a small and annoying town called Jericho that must survive the lack of infrastructure, power, the thieving gangs, warmongers from other towns, etc.
Overall, a pretty nice show if you can stomach Pamela Reed, which I can, barely. A lot of American overdone morality and stuff so sweet that can lead to quick runs to the toilet, but overall, a nice watch.

Painkiller Jane is about a female cop that doesn't seem to be able to die. Based on comic books and using the same old and decrepit "secret group hunts another secret group" it is a show that sucks just as much as any. The only positive thing in it is Kristanna Loken :)

But now I am really out of shows. What can I do?! :-S

I've spent two hours today trying to understand why my application works. I mean, I was glad it worked, but, based on my understanding of the ASP.Net cycle, it shouldn't have.

Long story short: in Page_Load I was instantiating and adding to the Page Controls collection some controls. To my astonishment, the postback worked! With events and everything. Even worse, even if the controls were being created every time (independent of IsPostBack) and the data was always added from the database, the postback data was overwriting it!

As far as I knew, the postback data is being loaded before the Page_Load event. And when you change something in the Page_Load, it stays changed. But things are different with dynamically generated controls. My guess is that the Page_Load method is being executed for the page, then recursively for the child controls. If a control has not yet retrieved it's postback data, it tries again.

Yet, if you try to do the same in a button event or in Page_LoadComplete, it doesn't work.

So, if you dynamically add the same controls in the Page_Load in between postbacks, the postback data will be saved and the events will fire.

This video is hilarious just because it is so true. B movie legend Bruce Campbell is telling them as he sees them. Don't miss his upcoming movie "My Name is Bruce" in which he stars as himself battling demons! I can't find it anywhere for now, but I will keep searching.

Update: I found it, having been delayed for a year for redoing some scenes with extra budget, but it failed. :( I almost did not find it funny. Better luck next time.

Also, you might find useful the information that he played in all three Spiderman movies. And, as he says himself in another youtube clip, if he didn't name the hero in the first film, the entire franchise would have now been named "The Human Spider", while in the second, as the doorman of a cinema in which Spiderman did not enter, Bruce Campbell is the only person that ever defeated Spidey! :)

This man is just hilarious, watch this clip and all the Bruce Campbell Movies you can get your hands on.


Update: trust lawyers to screw with my blog. I had to replace the youtube video above with one from a live performance. Pretty much the same idea, only the interview was funnier and more complete.

I've updated this page a few times, adding more optimizations, so get the last version.

I was asked to find a way to maintain the vertical scroll in a selection box (that is a select html element with a size bigger than 1). I checked to see what property was changing when I was scrolling the select and I noticed that scrollTop was the one. So I used
sel.scrollTop=value;
.

Well, this works fine in FireFox and apparently works fine in IE7, too. However, in Internet Explorer 7, if you click on the up/down arrows of the select scrollbar, the scroll resets to 0. Worst than that, in IE6 you can't even set the scrollTop property. You don't get an error, but it doesn't work.

One suggested solution for people that tried the same thing is to set the size attribute to the number of options, thus getting rid of the select scrollbar, and place the select in a div with fixed height and overflow auto. It will look like a select listbox, but the scroll will be from the div and easily changed. I didn't choose this solution, basically because I felt it was cheating.

So, I've applied another solution, one that changes the selected item so that the select element scrolls itself to a position as close to the desired vertical scroll position as possible. Then, I set the scrollTop property, so that it goes at that exact position in IE7 and FireFox. If one clicks the up/down scroll arrows in IE7, the scroll position resets to the one found by the selectedIndex, not 0. And it works in IE6, too.

Here is the code:
JS Code - vertical scroll a select element
function setSelectVerticalScroll(sel,y) {
if (!sel||(sel.options.length==0)) return;

// remember the selectedIndex (for single selection selects)
var selectedIndex=sel.selectedIndex;

// find the item that selected will yield
// the best match for the required scrollTop
var best=-1; var bestMatch=100000;

// try to guess the starting index based on select height
var optionHeight=parseInt(sel.size)
?parseInt(sel.offsetHeight)/(parseInt(sel.size)+0.0)
:parseInt(sel.offsetHeight);
var startIndex=parseInt(y/optionHeight);
if (startIndex>=sel.options.length) startIndex=sel.options.length-1;
var c=startIndex;
while (c<sel.options.length) {
var selected=sel.options[c].selected;
sel.options[c].selected=false;
sel.options[c].selected=true;
if (Math.abs(parseInt(sel.scrollTop)-y)<bestMatch) {
bestMatch=Math.abs(parseInt(sel.scrollTop)-y);
best=c;
}
sel.options[c].selected=selected;
// best match has been found, no point of going further
if (Math.abs(parseInt(sel.scrollTop)-y)>bestMatch) break;

// try to jump to the right index
var inc=parseInt((y-parseInt(sel.scrollTop))/optionHeight);
c+=(inc>0?inc:1);
}

// select best match, to force scrolling
if (best>=0) {
var selected=sel.options[best].selected;
sel.options[best].selected=false;
sel.options[best].selected=true;
sel.options[best].selected=selected;
}

// set the selection back
if (sel.selectedIndex!=selectedIndex)
sel.selectedIndex=selectedIndex;

// now this should have been enough,
// but it doesn't work in IE6 and it's bugged in IE7
sel.scrollTop=y;
}


Warning! This will not work if the select is hidden by way of display=none or visibility=hidden. Also, for large selects, it will look funny scrolling through all the options. Optimizations can be applied, that try to find the correct selectedIndex or stop after the scroll position has been found (like in this example) or that search the best scrollTop match by dividing the options in two parts rather than taking them one by one, etc.

I've accidentally stumbled upon Star Wreck, a Finnish film that parodies Star Trek and Babylon 5. The special effects are as good if not better than the original shows, the parody is cool and very funny and the fact that the film was made by some unknown guys in a makeshift studio gives it a lot of extra points. Not to mention that this is one film Danezia is very unlikely to comment on :D

What's even better is that the movie is freely downloadable from the net, so the major drive for the film was fun! When did you last see a movie made for fun, not money?

Update: Spoken too soon, apparently. After a while the film was released on DVD and removed as a download. But still, while it lasted it was cool.

All fans of Star Trek and B5 will love this.

You can also watch it here, but it's lower quality and maybe it will disappear after a while. Enjoy!