hexadecimal value 0x00 is an invalid character

This is usually an encodnig issues. Invalid characters in the string going into the xml. Remedy this by converting your string data into UTF8 when assining the data to your XML element.

Example:

XRecordDetail = New XElement(Header, System.Text.Encoding.UTF8.GetBytes(OriginalDataString))

Or

XMLData = XMLSystem.Text.Encoding.UTF8.GetBytes(OriginalDataString)

10 Cool Things You Can Do In Visual Studio 2010

 

 

This one is so useful and helpful that I think it deserved a replicated post.

Found it here and original is here.

1. Pin variables when debugging

At debugging when hovering over variables the “Pin variable” option appears. Clicking on this makes the variable stick next to the source code until removed (and the pin stays there between debugging sessions). It is a really hand utility eliminating having to add variables to the Watch window one by one or search through the Locals window to find the variable one’s looking for. Definitely one of the top 3 new features I use on a day to day basis!

clip_image001

2. Box selection

While holding down the Alt key box selection can be made on the screen. At first glance this feature doesn’t seem to useful. However when typing anything in the selection the same text appears in all lines. So this selection is extremely useful for mass renaming of e.g. visibilities or anything else that involves changing the same thing in all lines.

clip_image002

3. Search on-the-fly

When pressing Crtl and , (comma) the new Navigate To window appears. This is a real-time search window offering basically the same functionality as the Find and Replace window (opened by Crtl + Shift + F) but doing it on-the fly, without having to wait seconds for search results. So the list of results updates the moment you type the next letter in your search expression. Scott said that the search database used by this window is built continously in the background by Visual Studio.

4. Zooming

There’s a small zoom drop down box on the left bottom of the application. It’s barely noticeable but is really useful when showing your code to someone else or doing presentations. Not a function you’ll use too often but comes handy every once in a while!

clip_image003

(Note: zooming can also be used with Crtl + mouse scroll)

5. View Call Hierarchy

Exploring code has been made much easier with the new View Call Hierarchy command in the context menu when right clicking a method. The Call Hierarchy window shows calls from the method, calls to the method and overrides of the method (if any). This little add-on makes exploring someone else’s code so much easier.

clip_image004

6. Sequence Diagrams

The professional and above versions of Visual Studio 2010 come with built-in sequence diagram generation functionality. Simply right click on the method and select Generate Sequence Diagram to get a nifty call sequence diagram.

clip_image005

7. Dependency Graphs

The professional and above versions of Visual Studio 2010 come with a built-in dependency graph generator that generates an interactive, browsable dependency graph. When there is a large number of object this graph can get overwhelmingly large. However the fact that it can track dependencies at assembly, namespace and class level as well make it a useful tool for getting an idea for the project dependencies.

clip_image006

8. IntelliTrace and Dump Debugging

Ever had clients submitting bug reports that you were unable to reproduce and made you wish you could just debug right on their machine? IntelliTrace brings this to reality. When running an application with IntelliTrace enabled it records the series of events happening within it and lets the developer play these back. Note however that IntelliTrace collects less information than one might need at debugging and also has a slight performance overhead when turned on. IntelliTrace is only available in Visual Studio 2010 Ultimate. For more information on Intellitrace see MSDN.

Dump Debugging is the feature that enables to open dump files from production machines and debug those. This is a great feature to use for debugging crashes happening on a production machine. See a video on how to use this feature on Channel 9.

9. Multi-monitor support

Few people knew that Visual Studio 2008 actually had multi-monitor support. You just had to launch an instance on each monitor! Aside from this joke, this feature was one that was really wanted. Now windows can be positioned across monitors making developing and debugging a much better overview on dual screens.

10. Intellisense – lots of small improvements

Intellisense has gone through lots of small improvements. The most important ones are:

  • When selecting any variable all instances of it are highlighted – a well needed improvement that has been around for in lots of text editors
  • Search is not limited to prefixes any more, it is done within strings. So when typing time for example, DateTime will be offered as well (previously only names starting with time were)
  • Intellisense can search just knowing the capital letters of a class. When searching e.g. for HttpCachePolicy it’s enough to type HCP - nice!
  • Javascript intellisense is extensive: all major Javascript libraries are supported (JQuery, Ext.JS, Prototype). Expressions are also evaluated on the fly and Intellisense is offered accordingly.

IntelliTrace

Finding how you go to that deep class method that failed…

IntelliTrace cool 2010 feature, if you are debugging the app and it fails on its own, it will show you everything that was called up until that point. Even but button’s you clicked on the website.

Pretty cool. Can’t attach to a process, have to actually run debug.  It’s window on the right or you can open it via, Debug/Windows/IntelliEvents.

It’s shows more usefulness if the app fails a few classes deep.

Note: Only works if you run Debugger

clip_image002

 

image

 

 

IntelliTrace Events Only Option Gives You This:

image
image

IntelliTrace Events and Call Information Give You This:

image
You can see how I got to the error now, which methods call which other methods.
image

Windows 7 Genuine Validation Fails on Genuine Install

 

I was having problems trying to download XPMode because the website tries to validate your Windows 7 operation system.  Even though I activated successfully and I ran the MGA Diagnostic Tool locally and it said Genuine. It still failed the online check.

image

I even called Microsoft to see if they could figure it out. No luck. They tried the obvious stuff, re-entering my product key, re-activating.  They couldn’t figure it out. Even gave me a new product key and still no luck.  Then I told them I had to go.

Found the answer on my own..

I was getting Event Errors in my Application Log.

Source: CAPI2
Event ID: 257

The Cryptographic Services service failed to initialize the Catalog Database. The ESENT error was: -1011.

Then I caught online something on bypassing XP Genuine has to do with the Cryptographic services. Putting two and two together, I figured this error was the source of my problem.

After a little digging I found this article which gave me steps to wipe out my System Catalog Database. 

This fixed my error and allowed me to validate my windows online.

  1. Click Start, point to Administrative Tools, and then click Services.
  2. Right-click Cryptographic Services, and then click Stop.
  3. Click Start, and then click Computer.
  4. Navigate to %systemroot%\System32.

    By default, %systemroot% is located at C:\Windows.

  5. Rename the catroot2 folder to catroot2.old.
  6. In the Services snap-in console, right-click Cryptographic Services, and then click Start.

Information Architecture for Beginners

 

Great blog post on Information Architecture.

 

Complete Beginner’s Guide to Information Architecture

Information architecture is an often misunderstood job title. Are they Designers? Developers? Managers? All of the above? In this article we’ll discuss what information architecture is, why it’s related to usability, and what are the common tools/programs used in information architecture.

 

Information architecture encompasses a wide range of problems. But regardless of the specific context or objectives of a given information architecture project, our concern is always with creating structures to facilitate effective communication. This notion is the core of our discipline.

Jessie James Garrett

What does an Information Architect do?  What tools do they use?

Read More..

Are Easter Eggs in Software a thing of the past?

Was reading a post that Office Easter eggs no longer exist due to the government regulating that every software feature has to be documented.   I was developing a silverlight app and wanted to place in my own Easter egg.

Basically holding down Shift-Ctrl-Windows Key and clicking on the Logo, brings up my face :)

 

image

Silverlight & WCF Debugging and using Fiddler!

 

Fiddler2 Best program out there I think for debugging WCF errors in silverlight when you get “NotFound” error messages.

 

Example. I had a Silverlight application where I had to enable it work over https and change the host headers. As many of you may know, WCF on .NET 3.5 you can not bind to website with multiple headers. You have to hardcode the WCF Address in the web.config. (I’ve read that .Net 4.0 will allow this but still not for ssl).

All my setting from what I can tell in my web.config and my clientConfig were correct, and the app worked fine in http mode only, however I would get the most generic message ever.

image

This is my custom error window I use to have users send the errors to the server.  As you can see the error is “The remote server returned an error: NotFound.”  this is basically the equivalent of the old server error message “An Unexpected Error Occurred”.  Basically who knows. Something’s wrong.  The WCF service is not responding. Could be your firewall, your IIS, your service is erroring out or 100 other things. 

Download and install Fiddler2 and let the magic begin.  I did try WebDevHelper which is like FireBug for FireFox but it works in IE.  It’s pretty good, but like FireBug, doesn’t give you that WCF error.

Loading up Fiddler, I can inspect the traffic and actually see the .Net error. It even highlights it in red for me.  (Had to block out the app names).

image

From this I was able to expand the information like below to see the real error message.

image

Cannot be process at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher.  Check that the sender and receiver’s EndPointAddresses agree

After I realized what the problem was I was able to fix my service by adding the attribute AddressFilterMode:=AddressFilterMode.Any to my WCF class.

<ServiceContract(Namespace:="")> _
<ServiceBehavior(IncludeExceptionDetailInFaults:=True, AddressFilterMode:=AddressFilterMode.Any)> _
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
Public Class xxxxxxxxxxxService

 

Problem Solved.

 

WCF logging:

You can also log all your WCF Traffic to a Log file on your server.

  <system.diagnostics>
      <sharedListeners>
          <add name="WcfListener"
                  type="System.Diagnostics.XmlWriterTraceListener"
                    initializeData="C:\logs\wcfLog.svclog"/>
      </sharedListeners>
      <sources>
          <!-- switchValue attribute has no impact on MessageLogging -->
          <source name="System.ServiceModel.MessageLogging">
              <listeners>
                  <add name="WcfListener" />
              </listeners>
          </source>
          <source name="System.ServiceModel"
                        switchValue="Warning, ActivityTracing"
                        propagateActivity="true" >
              <listeners>
                  <add name="WcfListener" />
              </listeners>
          </source>
      </sources>
  </system.diagnostics>

 

<system.serviceModel>
    <diagnostics>
        <messageLogging
             logEntireMessage="true"
             logMalformedMessages="false"
             logMessagesAtServiceLevel="true"
             logMessagesAtTransportLevel="false"
             maxMessagesToLog="3000"
             maxSizeOfMessageToLog="2000"/>
    </diagnostics>
</system.serviceModel>

 

Other useful posts..

Silverlight and WCF – WCF Logs and Debugging

Service Trace Viewer Tool (SvcTraceViewer.exe)

Silverlight & WCF - HTTPS

My Customized version of ClarkLab’s Animated Drop Down Menu with jQuery

 

I found this post on Clarklab.net, Animated Drop Down Menu with jQuery.  Looked simple to use and I loved that I didn’t need any plug-in files like other “plug-ins”. I guess this really isn’t a plug-in.  Just nice, basic jquery and css.

They give the step by step and why you nee each line of code.

This is their version and their demo is here.

Row colors

 

 

My Need for it and How I Used

I had an application that had two date pickers.  The goal was to make it easy for the user to be able to set the date on the second date picker based on the date from the first date picker. Adding X days to the date in the first date picker.

I’m using Telerik’s AJAX Calendar control for my date picker so some of the Javascript you’ll see is specific to their Client API.

image

I followed their steps but altered the CSS and UL list of course.

My CSS:

<style type="text/css">

.menu_head{border:0; margin-top:10px}
.menu_body ul, li{margin:0; padding:0; list-style:none;}
.menu_body {display:none; width:100px; margin-left:-40px; font-size:small;}
.menu_body li a:hover{font-weight:bold;}

</style>

Added my UL list..

<img src="/Images/BlueArrowRight.png" alt="Copy Date Over" height="24px" width="24px" class="menu_head" />
<ul class="menu_body">
    <li><a href="javascript:CopyDate(0);">Copy Date</a></li>
    <li><a href="javascript:CopyDate(15);">Add 15 days</a></li>
    <li><a href="javascript:CopyDate(30);">Add 30 days</a></li>
    <li><a href="javascript:CopyDate(45);">Add 45 days</a></li>
    <li><a href="javascript:CopyDate(60);">Add 60 days</a></li>
    <li><a href="javascript:CopyDate(90);">Add 90 days</a></li>
    <li><a href="javascript:CopyDate(120);">Add 120 days</a></li>
</ul>

 

Then added my jQuery.. I’m sure there is a better way to close the menu, but I threw it in my CopyDate() method. Again, note that picker.get_textBox() and get_selectedDate() are Telerik Client API methods on their controls.

<script type="text/javascript">
    $(document).ready(function() {
        $("ul.menu_body li:even").addClass("alt");

        $('img.menu_head').click(function() {
            $('ul.menu_body').slideToggle('medium');
        });

        function CopyDate(TotalDays) {
            AddDueDate(TotalDays);
            $('ul.menu_body').slideToggle('medium');
        }

        function AddDueDate(TotalDays) {
            if (TotalDays >= 0) {
                var picker = $find("<%= calDateOfLetter.ClientID %>");
                var textBox = picker.get_textBox();
                var destination = $find("ctl00_ContentPlaceHolder1_calDueDate_calDatePicker");
                var destTextbox = destination.get_textBox();

                var CurrentDate = picker.get_selectedDate();
                CurrentDate.setDate(CurrentDate.getDate() + parseInt(TotalDays));
                destination.set_selectedDate(CurrentDate);
                picker.hidePopup();
            }
        }
    });
</script>

 

Finished Version (yes the dates are old, the record I’m testing on happens to be old)

image

Clicking on the arrow you get the menu..

image

Click on a date and it gets added and the menu closes..

image

Works great! I love it, client loves it, end-user loves it.  Thanks Clarklabs!