Adding social tech site buttons to Blogger

ObiShawn asked me how I added the buttons at the end of each post for the social tech sites. You can look at the end of this post to see what I mean.

It's simple!

Edit the HTML for your template (Layout -> Edit HTML), click on 'Expand Widget Templates". Look for this code:


Immediately after that code, add this:

<p><a expr:href='&quot;; + data:post.url + &quot;&amp;title=&quot; + data:post.title' expr:id='data:widget.instanceId + &quot;_kickit&quot;' rel='nofollow'><img alt='Submit this story to DotNetKicks' expr:src='&quot;; + data:post.url'/></a>
<script type='text/javascript'>
var dzone_url = &#39;<data:post.url/>&#39;;
var dzone_title = &#39;<data:post.title/>&#39;;
var dzone_style = &#39;2&#39;;
<script defer='defer' src='' type='text/javascript'> </script>
<script type='text/javascript'>
digg_url = &quot;<data:post.url/>&quot;;
digg_title = &quot;<data:post.title/>&quot;;
digg_skin = &quot;compact&quot;;
<script defer='defer' src='' type='text/javascript'/>

That's the exact code I'm using in my template at the time of this post. It's not visually perfect, but it works.

Like this post? Please share it!

See a mistake? Edit this post!

Disable constraints in "After Insert" trigger

I have a table that stores extra information (Users) that gets associated with the "aspnet_Membership" table in my application. Since my table references the membership table, I have a foreign key for referential integrity.

I added a trigger to the membership table so that rows automatically get inserted into my table. The problem is, the trigger violates the foreign key constraint! Here is the trigger code:

Create Trigger dbo.Trigger_CreateExtraUserRecord ON aspnet_Users
After Insert
    Set Nocount On
    Insert Into tfs_Users
    Select UserId From inserted

As you can see, it's an "After Insert" trigger, so the first insert will be done at this point (I have verified that).

It must be using some kind of transaction, and the foreign key is violated because it's not committed.

The solution (not perfect, but it works), is to use this before the insert to disable the foreign key check:

Alter Table tfs_Users Nocheck Constraint All

And use this after:

Alter Table tfs_Users Check Constraint All

Instead of disabling all constraints, you could also specify the constraint name, which would obviously be better in most cases.

Does anyone have a better explanation for this behavior?

Like this post? Please share it!

See a mistake? Edit this post!

Using iStockPhoto to make your website awesome

The look of a website is key in determining the emotion that your visitors will feel when they look at it. For example, it's been proven that photos of people on your website will increase customer confidence, and lead to a higher sales conversion rate.


Traditionally stock imagery has been expensive to purchase, and time consuming to create. Many sites that I have seen simply steal images from other sites, or even hotlink in some cases.

I wanted to make sure my blog is using images that are legal, and I discovered iStockPhoto.

As of this writing, they have over 3 million images. The majority are extremely professional, and be just what it takes to give credibility to your website. I'm usually able to find a picture for each of my blog posts, which makes breaks up the content and makes it easier to read.

Here is a site for monitoring your position in a search engine, which I took the liberty of redesigning with some stock imagery.

Before: ugly

After: with stock photos

Like this post? Please share it!

See a mistake? Edit this post!

Jason Young I'm Jason Young, software engineer. This blog contains my opinions, of which my employer - Microsoft - may not share.

@ytechieGitHubLinkedInStack OverflowPersonal VLOG