Thursday, November 8, 2012

Insert song title here.

I wonder if I may lie.
breathe slowly
open your eyes
can you hear me
and end this journey
what do you see?
were we ever really alive?
Lets switch off together
lets float to no more
goodbye...


goodbye to everything.

To slip the surly bonds of flesh and bone
expand through endless and infinite time
sallow pain and grounding,
bindings to nothing


This adorned box from Pandora,
Fastened around the neck of the willing and unwilling alike
Move, fall, slip away from this
push forever and make no difference


sleep, dream, fly, float, wake, die.
tears, blood, hate, rage, cry.
I turn an eye inward and expand forever more
I look outside and waste away


pathetic, useless, physical existence
when a journey awaits would the guards but leave.
Where does this lead? when does this leave?
Why must I breathe? Why must I grieve?

Does anyone really believe that this is how it should be?

Tuesday, November 6, 2012

SQL Server Templates

SQL Server Management Studio comes with a bunch of pre-built templates for scripting out procedures, functions, tables, administrative functions and more. All they are essentially are a .sql file with some special syntax in the script where values can be pasted into place. The special syntax is pretty easy to get a handle on, but at first glance can seem a little strange. Here's a sample of what you might see if you were looking at a SQL Server template (minus all the red lines I added).



There are several parts to this. Let's start with the window that's currently being displayed (in the picture, it's the window with the header "Specify Values for Template Parameters"). To get to this window, you must have a query window open in SSMS, and it wouldn't hurt to have a few tags in it (more on that later). In this query window, press ctrl+shift+M. I have no idea what the M is a mnemonic for... para(M)eters? Whatever. Once you're in this view, you'll be able to replace the special notation inside the script with values you input on this screen.

So how do you set that up? You put in tags with the notation
<[Parameter], [Type], [Value]>

[Parameter] is like the identifier for your replacements. Anywhere in your script, any time you have, say tagged in the script, all instances of that Database tag, will be replaced with the value you put in that popup window. This is the only part of the tag which is NOT optional. Think of it as your primary key.

[Type] is really just a hint to yourself about what datatype the script is expecting. Often times it's irellevant. If you're building a new Proc, you might have a tag which says , but you could just have easily put "Int" instead of "Sysname" and it wouldn't care. It's not a data type validator, it's just so that if you have a script which requires data of a certain type you know what to enter. It's worth noting that this is entirely optional. Also, if you change this data type throughout the script, it won't care. Only the first instance of the tag will be used to populate the [Type] column in the popup window.

[Value] is an optional default value in the field. In the example I showed above, more often than not, I'm looking for information_schema.columns, so I set the default of Parameter:SubType to "Columns". If i wanted to make it Routines or Tables, I just have to replace the "Columns" value with the value I want.



When you then click OK, all the values you have are propagated into those replaced tags throughout your script. It's worth mentioning that SQL treats each replacement of a value as a single undoable action, so if you've got a huge parameter list and you accidentally hit OK too soon, all the values you did (or probably didn't) submit will have to be undone one by one till you get back to your original script.



My final note on this is that if you don't have SQL 2012, or do and cant figure out how to use the snippets feature, get something like the SSMS Toolspack. It's free, and comes with a bunch of helpful tools, my favorite of which is a really simple code snippet interface. I've built little 2 - 3 character shortcuts for some of my most commonly used functions, such as the one I listed here. I type "info"+tab and it populate my query window with that code. I've got others as well, "tab"+tab for tables, "IX" for indexes and so on. When you combine this template format with the ability to call these templates up in a fraction of a second, you can really cut down extra typing time a LOT.

Monday, November 5, 2012

Evolutionary Causes of Depression

I read an interesting article hypothesizing an evolutionary cause for depression which stated that depression is a state people get in which is conducive to intent thinking and personal change. There's more to it than that and I suggest you read the article in full because it's quite good.

Having been depressed off and on for quite some time, i'd say that theory is imperfect, but as with all theories of psychology, they're applicable only to a generalized description of the disorder, so it still may hold water.

I was thinking about evolutionary causes for depression, and while I preface this with the giant asterisk of "since you can't really prove something like this, it could be just about anything", I still think it's interesting, if not morbid.

What if depression is a state of mind evolved to sort of say "shit or get off the pot"? Being depressed certainly brings about different patterns of behavior. Some are so painful and disparaging that the only way out is through a cathartic change of lifestyle. Some people simply fluctuate out of depressive states, some people change their lives to get out of depressive states, some people never leave their depressive states, and more often than not, those who cannot or do not ever leave their depressive states, take their own lives.

Could it be that depression is a means of either forcing people to improve their live or remove themselves from the gene pool? Again, this is a pretty morbid though, but while it's difficult to come up with true comparisons to a human psyche, there is plenty of self terminating behavior in computing. Competing threads may be automatically terminated if they are in a deadlock. anti-virus software isolates, quarantines, and destroys malignant software. It's not beyond the realm of possibility that humans have evolved their own sinister way of weeding out the unproductive.

Again, this is a generalized statement too, and i'll remind you, based on nothing but introspective experiences. There are a plethora of psychological ailments which probably have nothing to do with a normally functioning brain. True chemical imbalances like those brought on by under active endocrine systems, genetic defects such as trisomies, and brain damage from traumatic events are certainly not something evolution has chosen for. But within the realm of Major Depression discussed in this article, I think this is a interesting thought.

(Article):http://www.scientificamerican.com/article.cfm?id=depressions-evolutionary

Bing v Google

Microsoft is focusing a lot of effort on web and cloud based technologies, trying to diverge from their existing model of software installed on local PC's. This is a laudable goal, and is probably imperative given the way things are going. I'm actually a big fan of Microsoft's product, much to the affront of Open Source fanboys around the world, but that's just the way it is. I write in TSQL (SQL Server's dialect of SQL), I dabble in C#, I run Windows, and more.

Now unless you've been living under a rock or the oppressive heel of a World of Warcraft subscription, you've probably seen Microsoft's ads for IE9, Windows 8, and of course Bing.

Bing.

If you haven't yet, I'd go take the "bing it on challenge" to get more of an idea of what I'm talking about. Plus then I don't have to explain how it works. I'd also recommend reading Microsoft's explanation of the study.

The key findings of the study were the following:

"When the results were tallied, the outcome was clear – people chose Bing web search results over Google nearly 2:1 in the blind comparison tests. Specifically, of the nearly 1000 participants: 57.4% chose Bing more often, 30.2% chose Google more often; 12.4 % resulted in a draw.*

*The overall sampling error rate for the study is +/- 3 percent at the 95 percent confidence level."

As they say, the outcome is clear... ish. Ignoring the "draw" votes Bing won. There are certainly flaws in the study, but given that everyone on earth knows what google looks like, there are limitations to how the studies can be performed.

select 57.4 / 30.2 --1.9:1 select 54.4 / 33.2 --1.6:1 select 60.4 / 27.2 --2.2:1

But not to sound cynical, but who cares? There are more reasons people use Google than the sorting algorithm. Sure, if Google's algorithms were garbage, it might matter to the end user, but they're not. If we were to base our decision on which search engine was better based solely on this study, then Bing would be superior. But by how much? Google is great, Bing is greater. I also have a Gmail account. and a blogspot blog (a google product). I use youtube. I use google docs. I say "google it". I don't have nearly that much invested in Microsoft technologies when it comes to my web based suite of products. there's just not enough motivation to me to change from Google to Bing.

I think the main goal of this campaign by Microsoft was to try to remind people that Bing was there, and hope they can convert or incept enough users to make it a contender with Google. Will it work? In my opinion, no.