Subscribe Now: Feed Icon

Monday, January 31, 2011

Fixing Error: Error reading TrayIcon1->Visible: Cannot create shell notification icon.

The first thing I saw after turning on my computer to day was:

Error-reading-TrayIcon1

Text version:

Kvm-221verb
---------------------------
Error reading TrayIcon1->Visible: Cannot create shell notification icon.

 

I had some time to search for the error (couldn’t open VS since I was installing the new Resharper EAP Build). So I searched for what it means.

Kvm-221verb (or actually “KVM-221 Ver B Utility”)– is a program I have installed which helps with an AB switch I have (it allows me to listen to my music from one computer while still working with another and when I want to switch the sound to the other computer).

But the error doesn’t come from that program – it comes from Windows7 system. The system is trying to tell us (in it’s illiterate way) that our utility tried to load prematurely – before there was a system tray.

So what do we do?

Well there are many options, I choose a nice little program called Startup Delayer that is easy to work. You simply find the problematic program in their list:

Startup-delayer-list

Double Click on the line:

startup-delayer-add-delay

And click Save.

Closing the window you will get this warning:

startup-delayer-warning

Click Yes

startup-delayer-invisible

Click Invisible.

 

That’s it next time you start your computer the program will be delayed for 1 minute – more than enough time!


Keywords: error, windows 7, startup, delay

IceRocket Tags: ,,,

Friday, January 28, 2011

Database Queries Trick 1: Query XML

I was playing around with ESRI sde tables and one of the column was a XML column I wanted to query, like this:

  1. where (Definition like '%<blah>%</blah>%')

Will cause an error:

  1. Msg 8116, Level 16, State 1, Line 2
  2. Argument data type xml is invalid for argument 1 of like function.

But:

  1. where (cast(Definition as varchar(max)) like '%<blah>%</blah>%')

Works like a charm!

Resources:

ASP.Net Forum: Argument data type xml is invalid for argument 1 of like function

 

Keywords: XML, SQL, SQL Server 2008, Error

IceRocket Tags: ,,,

.NET Framework NGEN service stopped: What’s that?

Around two weeks ago we had a problem with one of our servers and I was trying to find the cause. I looked at the Event Viewer and found in System this information message:

The Microsoft .NET Framework NGEN v4.0.30319_X64 service entered the stopped state.

Found what it is:

NGen service allows the developer to defer the installation and update of native images to periods when the computer is idle.
The NGen queue supports a simple priority scheme to help establish the order in which applications are pre-compiled when submitting multiple jobs to the queue. The priorities also determine whether the service should wait for idle time on the machine to do the background compilation.
When the service detects that there are no more actions queued, it resets its status so that it will not restart the next time the computer is booted, and then it shuts itself down.
This means that this service will be shut down automatically if it finds that no action is needed. We have confirmed it with our product team. This behavior is by design.

For a minute there I thought it was serious…

Resources:

MSDN forum: Microsoft .NET Framework NGEN v4.0.30319_X86 not started error in server logs

 

Keywords: Error, Event Viewer, .Net

IceRocket Tags: ,,

How to fix the blog’s look?

Or WHY the hell does my blog look different on IE8, Firefox and Chrome?

I guess it all started from a setting of blogger I left at it’s default state. After pasting some code in my site using Windows live writer extension Paste As Visual Studio Code the code looked different on IE than in Firefox/Chrome. But let me show you what I mean:

IE:

Windows-live-writer-extension-Paste-As-Visual-Studio-Code-IE-version

Chrome:

Windows-live-writer-extension-Paste-As-Visual-Studio-Code-chrome-version

Firefox:

Windows-live-writer-extension-Paste-As-Visual-Studio-Code-firefox-version

So I have decided to fix that using the tools I know, I should have just Googled the problem!

But onto the story…

 

I have a confession to make I haven’t really looked at any of my Blog Posts on the site since the first one I made with Windows Live Writer till I wrote the post about Writing Code in a Post.

I knew I had a problem with paragraphs but I didn’t think it was so severe.

Another confession is though I believe in this and in this, I use all of the browsers: at home I browse with Firefox (I customized it to much to move to Chrome), at work I browse with Chrome. Oh yes I also debug using IE, why? Because the debugger sometimes crushes and closes the browser and I prefer that it closes the one browser that is useless unused by me (I have a genetic disorder (my brother has the same problem) I always have too many tabs opened so when Firefox/Chrome dies its a cause for alarm).

I am not a hacker of html but I am a tinkerer. Most sites which I spent a lot of time in and I don’t like their design I just change in Firefox. It starts in using FireBug (an extension of Firefox – get it from here) and finding what I want to change (usually changing the background to black and text the white and font size). And then I open Stylish (an extension of Firefox/Chrome, can be found here) and just change the CSS of the site.

(I also use FireBug sometimes to change Javascripts runs – some sites like to have a count down, I like to change the counter variable to zero and see what happens… Sometimes it’s the difference between waiting a minute and tinkering for a minute per site).

So I opened Firefox and started tinkering with FireBug.

Use this tool:

FireBug-element-inspect-tool

To select the element on the screen:

firebug-inspecting-an-element-on-the-site

We get the Html of that line:

firebug-the-html-of-the-element

What we can see is that we have  a Tag <li> that wraps the code’s line and two <br> which are line breaks.

Clicking on the <li> tag will show us on the right side of FireBug all the CSS the <li> tag has (from inheritance or directly):

firebug-changing-the-style-of-the-element

The things that pop up (at least for me) are:

margin-bottom: 0.25em;

padding: 0.25em 0;

line-height: 1.4;

Another great thing about FireBug is that you can change those values on the fly. Just edit the values (you can even add new values like margin-top: -0.7em; (hint hint)).

The biggest change I managed was in line-height, it had the greatest influence. That and margin-top made the difference. My changes:

In <li>:

line-height: 0.9;
margin-bottom: 0.0em;
margin-top: -0.7em;
padding: 0.0em 0;

In post-body:

line-height: 1;
padding: 0.0em 0;

When you have all the changes all you have to do is create a CSS from them:

.widget li{
    line-height: 0.9 !important;
    margin-bottom: 0.0em !important;
    margin-top: -0.7em !important;
    padding: 0.0em 0 !important;
}
.post-body {
    line-height: 1 !important;
    padding: 0.0em 0 !important;
}

And then paste that into Blogger Template Designer->Advanced->Add CSS

And Click on Apply Template:

blogger-design-advanced-add-css

Now that we are done lets compare results:

Text Before:

text-before-the-change-in-the-css

Text After:

text-after-the-change-in-the-css

(Maybe a bit less spacing)

Code Before:

paste-from-vs-code-before-css-change

Code After:

paste-from-vs-code-after-css-change

(That’s more like it!)

Code Before with classes:

paste-from-vs-code-with-classes-before-css-change

Code After with classes: 

paste-from-vs-code-with-classes-after-css-change

Bugs:

1. I found the bug in Firefox:

css-bug-with-blogger-archive

A fix to that was adding:

.widget ul {
    margin-top: 0.9em !important;
}
ul.posts li {
    margin-top: 1em !important;
}

Result:

css-bug-with-blogger-archive-fixed

2. IE is making problems:

code-from-vs-bug-in-IE

Fixed it by using “body:nth-of-type(1)” before each class in the CSS, according to this (especially the comments) this CSS will effect both Firefox and Chrome (but not IE!).

3. Different resolution in Chrome caused this problem:

code-from-vs-bug-in-different-resolution

removing margin-top: -0.7em !important; fixed it in that resolution and it still works on the wide screen 24’ screen.

4. Not really a bug – but… I didn’t like how in some cases the lines of text I had were a bit on top of each other:

text-on-top-of-each-other

So I have added:

body:nth-of-type(1) p {
    line-height: 1.4;
}

(when using p tags (paragraph tags) use the original settings)

 

Final CSS:

body:nth-of-type(1) .widget li{
    line-height: 0.9 !important;
    margin-bottom: 0.0em !important;
    padding: 0.0em 0 !important;
}
body:nth-of-type(1) p {
    line-height: 1.4;
}
body:nth-of-type(1) .widget ul {
    margin-top: 0.9em !important;
}
body:nth-of-type(1) ul.posts li {
    margin-top: 1em !important;
}
body:nth-of-type(1) .post-body {
    line-height: 1 !important;
    padding: 0.0em 0 !important;
}

And then I wept because I found the blogger settings to fix the problem and didn’t need all the tweaking…

Resources:

FireBug site

Web browser hacks, Css hacks - ie, firefox, chrome, safri, Opera

Tweaking your Blogger blog

Keywords: Blog, code, IE8, Firefox, Chrome, FireBug, Blogger, Spaces, line, paragraph, Stylish, CSS, Internet Explorer, bug, text, settings, line break

Fixing Error 2104: Unhandled Error in Silverlight Application (IIS7)

My team leader asked me to fix a bug on an older version and I run into this error…

Error in trying to run Silverlight application:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E; Tablet PC 2.0)
Timestamp: Tue, 25 Jan 2011 08:55:25 UTC


Message: Unhandled Error in Silverlight Application
Code: 2104   
Category: InitializeError      
Message: Could not download the Silverlight application. Check web server settings    

Line: 59
Char: 13
Code: 0
URI: http://localhost/pVersion/Project/Map.aspx?param1&param2=3

Googled: Unhandled Error in Silverlight Application 2104
Found this, the Location for the MIME Types in IIS7:

IIS7-mime-types-location

But I had the Mime types installed:

iis-7-silverlight-mime-types

 

Decided to go back to the basics and just delete the XAP file from the web project. For some odd reason it was checked in, so I deleted it from the source control and rebuilt the Silverlight application project.

Works!

 

Edit (9/2/2011):

Felix from my team just had that error, his problem was a bit different: he dragged and dropped the ClientBin folder into another folder (without even noticing) and next time he tried to ran the application this error popped. We fixed the problem by dragging the folder to it’s right location…

 

Keywords: Error, Silverlight, MIME, XAP

IceRocket Tags: ,,,

To Resharper or not to Resharper

My love affair with Resharper started four years ago when my team leader hooked us up with Resharper. There are many benefits of using Resharper and I am not going to get into all of them:

  • The fact that unused variable are getting grey color is one great feature
  • The simplified template system – I have tried to use the snippet manager once back in 2005 but it was too complicated)
  • Converting loops to LINQ – I don’t know about you but I think better with loops than with LINQ
  • Inspecting issues in  the solution – getting those annoying little code review standards out of the way The fact that I haven’t written any “using” statement since starting to use Resharper. And also Code cleanup in the solution…
  • All the refactor options
  • Intellisense with add reference and with acronym – ANE + ctrl+space => ArgumentNullException

Well four years ago my team leader got the bosses to spend the money on licenses for all the team.

When I moved to another team I used that license until someone else complained that I used his license, and then started the trial version – thank God my team leader got us some licenses.

When I got to my current job I saw we had no Resharper and asked for a license – that was a mistake apparently, I had to demand one instead. So I installed the trial and when it ended after a month I tried to go through withdrawals. For the next 3 months I have tried other programs/extensions like CodeRush Express and Productivity Power tools (for ctrl+click) but it wasn't the same:

  • I had to disable the clicking because every time I tried to copy a word with ctrl+shift+C I got to the definition instead. I think I got sick of seeing the definition of a string – "hello;-("… (in Resharper ctrl+shift+click doesn't go to definition!!!)
  • I couldn't find anything that adds a reference "on the fly" by using ctrl+alt+space in Resharper
  • The copy paste of references clashed between the various Extensions, so that sometimes all I got for my troubles are Exceptions to my face.

So when I had to format my computer (the IT guy couldn't fix a problem with my screen resolution), I jumped on the chance to reinstall Resharper trial – even if it was for just a month… I even met my boss and this time demanded a Resharper license – but of course we run out of budget and the order was returned…

At the end of the month by some God of luck the EAP (Early Access Program) for Resharper 6.0 started and I jumped on the chance to work on Resharper (without having to format my computer one more time – I have learned my lesson and this time I was going to format my computer).

So I of course submitted some bugs one of them even causing me to have an email conversation with a lead QA in the Resharper team about a bug they couldn’t reproduce, unfortunately I didn’t know why the bug occurred but I experienced another bug with the references in Silverlight and wanted to know why it still exists. Then I had another bug with a few add references with the same text. Because of all those bug he even asked for our code base (signing NDAs was even mentioned).

Some bugs are funny (at least for a developer like me) like:

image

When changing the settings in options. I had a LOL moment seeing that one.

There are some great features in Resharper 6 like:

  • Copy of code will "ask" you if you want to copy the references as well (alt+enter after copying)
  • Not really my cup of coffee but Resharper now supports JavaScript and CSS

There were some days last month where I have spent more time trying to reproduce the Resharper bugs than coding for my project. I am feeling kinda bad about it…

That is until I got this email :

Hi, Roy!
Sorry for the delay but I was ill. So GREAT! thanks for the feedback. It's really useful for us. All your request I posted to my YouTrack account and rather soon you could be able to vote for them in public.
Also, we would like to give you the present from our team for your feedback. What type of R# license do you have ? We could provide you with free personal license of R# (probably you want to use it at home ;) ), dotTrace, dotCover or probably Java oriented products?
P.S. OOM is still not reproducible on my side. Do you use any additional third party controls in your custom control?
Regards!

--
K F
.NET Team QA Lead
twitter : m
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

So now, I am a proud owner of a personal license for R# and dotTrace (performance and memory):

dotTrace memory:

dotTrace-memory-license

dotTrace performance:

image

Resharper:

Resharper-license

(well I am still with the EAP and going to stay there – but at least I know it will work with R# 5)

Cool! (you can imagine me doing a happy dance…)

It does help to be a Good Samaritan…

 

Monday, January 17, 2011

Switching Comment System: IntenseDebate

I have to admit me not liking the comment system of Blogger is nothing personal against Blogger. It just that AdBlocker in Firefox (in Chrome it works) blocks it…

So I have decided to look at other implementations, my requirements were:

  1. Easy to install
  2. No changing of Html source involved (I have already experienced first hand Blogger resetting my Html template)
  3. Looks good
  4. Easy to use

 

First lets look at what we have:

No-adblock-blogger-comments

With Firefox AddBlocker it looks like this:

Firefox-AdBlocker-Blogger-Comments

Well:

  1. It' is easy to install – no installation needed
  2. Built in
  3. Looks ok if you like grey as it is I don’t like it much
  4. Disabling AdBlocker is not so easy or that useful

 

IntenseDebate

Now I have to admit that so far I only tried one system but it’s a good one.

IntenseDebate-blog-comments-system

Now this one look much better, but lets look at the checklist:

Installing:

Just sign in to an account in IntenseDebate and either as part of the signing in choose to be a blog/site owner or:

IntenseDebate-add-a-blog

Enter the blog URL:

IntenseDebate-enter-blog-url

If you have a domain you will have to choose your blog Platform (my notes blog was identified automatically):

IntenseDebate-choose-blog-platform

Step 1: Widget

IntenseDebate-install-step-1

Step 2: On all blog posts

IntenseDebate-install-step-2

Step 3: Click on the link

IntenseDebate-install-step-3

Step 4: In Blogger->Settings->Comments:

Bloggr-Settings-Comment

Set comments to hide:

Blogger-comment-hide

Set new posts to not have comments:

Comments-Default-for-Posts-not-have

Click on Save Settings

Warning I ignored:

IntenseDebate-blogger-warning

Please Note: If the options to the right of the "New Post" button are "Edit Post, Settings, Template" then you are using Blogger Classic, which is currently unsupported.

My Settings seem to be for Blogger Classic but they still work.

Step 5: Add Widget to blog:

Click on the link

IntenseDebate-install-step-5-link

Select your blog:

Blogger-Click-on-Add-Widget-and-choose-blog

And then click on Add Widget.

Click on Save:

Blooger-save-design

Done.

 

Current look:

IntenseDebate-basic-look

Now you might say it doesn’t look the same. Well now we go to the tweaking:

Click on the link:

IntenseDebate-blog-settings

My Account Settings:

IntenseDebate-Account-settings

My Comments Settings:

IntenseDebate-Comments-Settings

My Activated Plugins:

IntenseDebate-My-Activated-Plugins

And now it looks like:

My-blogs-new-comment-system-looks-IntenseDebate

IntenseDebate-addon-share

Going back to the requirements:

  1. Done and easy
  2. No changes in the Html
  3. Looks good
  4. Easy to use – AdBlocker doesn’t block!

 

Keywords: blog, blogger, comments, IntenseDebate,AdBlocker