Burning DVD+RW on Ubuntu – When all else failed…

I had a bit of fun tonight trying to copy some DVD’s to DVD+RW’s, but could not use Brasario nor E3D…

Another option is the command line. I found this nice little article which outlines how to do it:

I didn’t have to install the tools and my device name was different but it was this easy…

growisofs -Z /dev/scd0 -R -J /home/myName/whereTheFilesAre

Advertisements

CodeRush Express Hide the “What Happened” message as well as other settings…

I’ve been wondering about this for a while now… "How do i edit the Code Rush settings”…

Ctrl+Shift+Alt+O {Letter “o”) does the job.

There are a few settings there that are nice. The best one is Editor | Code Style | Identifiers | fields and i changed it to “camel Case” … that’s been annoying me for a while.

I think you remove those messages that are useful when you start using the tool by changing the “Level” at the bottom left of the options dialog. (change from “New User” to “Advanced” or “Expert” not sure what they do at the moment…

FlagsAttribute [Flags]

Just used this for something I’m working on and thought I better write the details down due to a slight oddity I found while using it.

Note that the important point that you need to remember is that you must start the numbering at 1… not 0(zero)!!!

Take a flags enum like this:

[Flags]
public enum MyFlagsEnum
{
    Archived = 1,
    Closed = 2,
    Open = 4
}

The important thing about the above is that I’ve specified the values and started at one(1) Don’t start with zero(0)

Another way to do this (especially if you’ve got a fair few items:

[Flags]
public enum MyFlagsEnum
{
    Archived = 1,
    Closed = 1 << 1,
    Open = 1 << 2
}

Which generated the same enumeration with the same values.

If you want to combine values into another option, you can do this…

[Flags]
public enum MyFlagsEnum
{
    Archived = 1,
    Closed = 1 << 1,
    Open = 1 << 2,
    All = Archived | Closed | Open
}

The following unit test shows assigning of a new variable of type MyFlagsEnum and assigns the Open and Archived option…

[TestMethod]
public void OpenAndArchived()
{
    MyFlagsEnum options = MyFlagsEnum.Open | MyFlagsEnum.Archived;

    Assert.IsTrue((options & MyFlagsEnum.Open) == MyFlagsEnum.Open);
    Assert.IsFalse((options & MyFlagsEnum.Closed) == MyFlagsEnum.Closed);
    Assert.IsTrue((options & MyFlagsEnum.Archived) == MyFlagsEnum.Archived);
}

As you can see you do this by ORing the flags together

MyFlagsEnum options = MyFlagsEnum.Open | MyFlagsEnum.Archived;

To test whether the  options variable has the Open flag you AND the option against the type that you want to check the variable contains (for lack of a better word!) This anding should return either zero(0) which is why you don’t want to include an enum with a value of zero(0), or will return just the value you are looking for (The ANDing essentially returns a MyFlagsEnum(in this case) which doesn’t includes the value of only the item that you ANDed the variable with)

Assert.IsTrue((options & MyFlagsEnum.Open) == MyFlagsEnum.Open);

Windows Identity Foundation Services WIF (Geneva)

Type of conditional expression cannot be determined because there is no implicit conversion between ” and ‘System.DateTime’

I had the error contained in the title where I was trying to assign a DateTime to an object property that could be nullable. If the value is not null I had to parse the value as a DateTime… The code is as following:

results.Add(new MyObject() {
    ID = new Guid(row["MyObjectID"].ToString()),
    Title = row["Title"].ToString(),
    DateDisabled = row.IsNull("DateDisabled") ? null

     : DateTime.Parse(row["DateDisabled"].ToString()),
});

The easiest way to solve this is as follows:

results.Add(new MyObject() {
    ID = new Guid(row["MyObjectID"].ToString()),
    Title = row["Title"].ToString(),
    DateDisabled = row.IsNull("DateDisabled") ? (DateTime?)null
     : DateTime.Parse(row["DateDisabled"].ToString()),
});