I wanted to contribute a little to the book discussions we've been having on the imason blogs. Scott had two of these [1] [2] and Steve had another.

I just finished reading Rich Dad Poor Dad by Robert Kiyosaki.

I'm not too much into self-help books. I always feel like they are just a way for the author to make some more money. This book is similar. It is written in very plain English and has a lot of repetition - it is meant for anybody and everybody to read. However, I am impressed with the motivation it provides. (Just as a self-help book should). Maybe that's why it was on the New York Times best seller's list. Similarly it has its bad sides. It is a self-help book and this article does a great job as showing exactly how the author is just making money off of this book - and I partly agree.

But, nevertheless, overall, it offers great motivational advice, such as:
1. Act rather than not act. If you don't act, you will never succeed
2. Take risks sometimes, don't be a chiken. This links to #1 I guess
3. Surround yourself with (e.g. hire) people smarter than you
4. Learn a market by reading books or going to courses
and always:
5. "Think and Make Money" not "Work Hard and Make Money". - i.e. always try to think of new ways to invest your dollar

The financial advice is:
1. Learn accounting (so you can know what an asset/liability/income/expense is)
2. Learn investing (when to know what is a good deal)
3. Learn marketing (so you can notice trends in advance)
4. Learn the law for your market (so you can take advantage of it)

Then the master rule: buying assets that make you monthly income rather than buying liabilities that cause you monthly expenses.

That's a short version of it, except with a lot more motivation and "get out there and stop being so lazy", and "you can be rich too" talk.

 

 

 

Filed under:


Seeing how Steve is doing a good job of advertising his mo, I thought I would do the same... to keep the competition alive!

Here is how my mo is measuring up:

 

Does it look vaguely familiar?

Filed under:


If you try to programaticaly set/remove values of fields in InfoPath, you might have come across the following error message:
"Schema validation found non-data type errors"

A number of blogs and MSDN articles describe what to do in this case. They work for setting values, however I could not find how to clear values.

The problem

Values that are non-string (DateTime, Time, Date, Boolean, Whole Number, Decimal) cannot be blank (Empty String). If a value is set to the emptry string you will get the error above, because the empty string is considered a string and you are trying to set it to a field that is non-string. When one of these non-string fields is blank, it has an attribute "xsi:nil" that is set to "true". As soon as you type a value in this field in InfoPath the attribute is cleared.

The solution

Therefore, if you are trying to set values programatically you need to clear the "xsi:nil" attribute, or set it to "false". And if you are clearing the value of such a field, then you need to place the "xsi:nil" attribute back in, or set it to "true".

Other blogs on the internet say that clearing the value and setting the xsi:nil attribute to true is very simple, however the snippets of code they offer do not work.

  • This is because a nil field looks like so: <my:value />
  • After you type something, it looks like so: <my:value>123</my:value>
  • If you try and add the nil attribute in <my:value></my:value> you will get the "Schema validation found non-data type errors" error when you load the form.

The solution is to follow the steps below, depending on what you need to do with your field.

Editing a non-string field:

  • If you are going to try and programatically edit a field that is non-string, then you have to remove its "nil" attribute
  • Now you can change its value

Code (as on all other blogs and articles, this piece was taken from http://blogs.msdn.com/infopath/archive/2006/11/28/the-xsi-nil-attribute.aspx):

//Create a Navigator object for the main data source

XPathNavigator xn = this.MainDataSource.CreateNavigator();

 

//Create a navigator object for the field (node)

//where we want to set the current date value

XPathNavigator xnfield1 = xn.SelectSingleNode("/my:myFields/my:field1", this.NamespaceManager);

 

//Check if the "nil" attribute exists on this node

DeleteNil(xnfield1);

 

//Create a new dateTime object for the current date

DateTime curDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day);

 

//Set the value of field1 to the current date in the

//correct format: yyyy-mm-dd

xnfield1.SetValue(curDate.GetDateTimeFormats().GetValue(5).ToString());

public void DeleteNil(XPathNavigator node)
{

if (node.MoveToAttribute("nil", http://www.w3.org/2001/XMLSchema-instance))
      node.DeleteSelf();

}

Clearing a non-string field:

  • If you are going to programatically erase the value of a non-string field, then you have to re-construct the XML node to what InfoPath expects and add the "nil" attribute. This code is slightly different from dooke's Sharepoint place blog.

Code (slight change from dooke's code):

public static void InsertNil(XPathNavigator node)

{

if (!node.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance"))

      {

            string result = string.Empty;

            int endIndex = node.OuterXml.IndexOf(">");

            result = node.OuterXml.Substring(0, endIndex) + " xsi:nil=\"true\" />";

 

            node.OuterXml = result;

}

}

This code will reconstruct the <my:value>123</my:value> to <my:value xsi:nil="true" /> which will clear the field.

In my particular case, I wanted to clear the field, no matter what it was (string or non-string):

private void ClearAllFields()

{

 

XPathNavigator node = xNav.SelectSingleNode(xPath, xNameSpace);

 

      if (node == null)

            return;

 

      try

      {

            // try this as a Date, Integer, Boolean node, set the nil value

            InsertNil(node);

      }

      catch

{

            // if it is a string, the nil value won't work, so just set it to empty

            node.SetValue(string.Empty);

      }

}

 

public static void InsertNil(XPathNavigator node)

{

if (!node.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance"))

      {

            string result = string.Empty;

            int endIndex = node.OuterXml.IndexOf(">");

            result = node.OuterXml.Substring(0, endIndex) + " xsi:nil=\"true\" />";

 

            node.OuterXml = result;

}

}

Filed under:


When setting up Visual Studio to run load tests you might have noticed a nasty warning message such as this one:

"The connection string for the database has not been set. To store your results in a database for post-run analysis, set the connections string to a valid load test results store."

image

 

This happens because Visual Studio is trying to store your test results in a database store. This way you can load it later (in case you close your current open Visual Studio application). This post will show you how you can configure Visual Studio to stop bugging you.

We will get rid of that message by actually listening to it and configuring a database for Visual Studio to use. You will need access to an SQL database server and access to the Management Studio - you will need to run a SQL Query.

1. Open SQL Management Studio

image

2. Find the SQL Query that will create your database store

This file is C:\Program Files\Visual Studio 9\Common7\IDE\loadtestresultsrepository.sql
This is the directory for Visual Studio 2008, but this file should be there for other versions as well.

image

3. Run the SQL Query file

Hopefully you will get the "Command(s) completed successfully" message

image

 

4. Link Visual Studio to this new database

Open Visual Studio.

Go to Test > Administer Test Controllers...

image

And enter in the LoadTest database name in the dialog that appears

image

 

Et Voila! No more error message!

Filed under: ,