Dragging Files To OneNote

I just learned something really cool about OneNote.  I was not sure how it would respond if I did a drag and drop of a PDF file to a OneNote page.  The result is impressive.  Well done OneNote team!

Insert Link, Insert a copy of the file onto the page, Insert the file as a printout so I can add notes to it

Drag and Drop Dialogue

Collection Was Modified; Enumeraton Operation May Not Execute

Some Background

This was a very interesting bug for me to track down.  Initially it did not bubble up as the error that is in this title.  Initially it revealed itself as an out of bounds error when I tried to set IsOpen to true for a ContextMenu in a Silverlight project.  After lots of debugging I finally landed on this culprit.

The Task

The task I was trying to accomplish was pretty straight forward.  Given a List<T> remove any duplicate entries based on a given object.  Again, a straight forward task, or so I thought.


foreach(MyClass item in myListOfMyClass)
{
    if(item.SomeValue == objectOfMyClass.SomeValue)
    {
        myListOfMyClass.Remove(item);
    }
}

Read the rest of this entry

Left or Right Curly Braces

Should you put your curly braces on the left or right?

function foo(){
    //My curly brace is on the right.
}

function bar()
{
    //My curly brace is on the left.
}

Read the rest of this entry

One Advantage of CodeWriter

A few weeks ago I posted about WebMatrix, which is a really nice light weight tool if you don’t want to fire up full Visual Studio.  I also indicated that I was using CodeWriter.  I have noticed one real advantage that CodeWriter has over WebMatrix.  I can run CodeWriter on my Surface 2.  My Surface 2 is not a pro version so I cannot run Visual Studio on it, and in turn I cannot run WebMatrix on it.

I will admit, I do not do a whole lot of dev work on my Surface 2.  In fact I normally write something up in CodeWriter so I can copy/paste it into OneNote or test something really small.

The JavaScript Object Literal

I have been really trying to beef up my JavaScript skills lately.  One really interesting aspect from this experience is how cool I find the object literal.

You can use it to create really any kind of data structure you desire.  It can hold the primitive types like strings and numbers, it can hold objects like arrays or other object literals, and it can store functions.  I created a fiddle at JSFiddle to demonstrate the object literal.

Here is the JavaScript for my object literal which I call oPerson.

var oPerson = {
    firstName: "John",
    lastName: "Doe",
    age: Math.floor((Math.random() * 33) + 17),
    "favorite color": "Blue",
    Interests: {
        movies: ["The Blob", "History of the World Part 1", "Ferris Bueller's Day Off"],
        bands: ["Lacuna Coil", "Soft Cell", "Naked Eyes"]
    },
    greeting: function () {
        return "Hello, my name is " + this.firstName + " " + this.lastName + ".";
    }
};

Read the rest of this entry

Some History Of I, J, And K

I learned a little bit of geek history today.  A lot of us have used the variable I (or i rather) in our loops, and sometimes for nested loops we would use j and then k.  Do you know where that started?

Apparently it started in FORTRAN.  The variables i, j, and k were to be only used for integer type variables.  I am sure there is more to it than that but a quick search gave two different sources that confirm it.

Wikipedia

StackOverflow

I know this is nothing ground breaking or anything, I just thought it was something neat.

WebMatrix Collapsible Areas

Just a quick post about something I noticed in WebMatrix today.  It has some very cool collapsible areas, something I wish I had in Visual Studio 2013 Premium.  Take a look at the screenshot below, you’ll see what I am talking about.  Don’t worry about the code, it is just some basic JavaScript I threw together for this post.

WebMatrix Collapsible Areas

Scheduling Prometric Exam Advice

I have a bit of advice to pass on that I just learned at the School of Hard Knocks.

What Happened

I wanted to schedule my next exam with Prometric.  I had entered everything, including my 3 for 1 voucher, but I needed to double check the date.  So I use the go back button on their page (not the browser) to look at the dates.  I kept the same date and continued to the page I was on using the buttons on their page.

My voucher was no longer applied.  I tried to add it again but was given the message that it was no longer valid.  So I scheduled the exam anyways because I didn’t want the date to fill up and hoped that it was applied to my account.

I used their button to schedule another exam and it let me put the voucher on it, but the price did not change!  So I will need to contact Prometric to get it fixed.

What Should Have Happened

My voucher should have remained and not disappeared when I used their site navigation to go back.

Advice

Do NOT apply your voucher until you are ready to check out.  Even if you think you are ready, wait a few minutes before you apply it before finishing your process just to make sure.

After Contacting Prometric

To fix it I need to cancel my current exam at a fee of $35 and start over again.  Of course I have the option of just keeping the current exam and applying my voucher on my next one, which is even worse as it is a 3 for 1 voucher.  These exams are $150 each.  So I’ll take the $35 hit to save $300.  Of course as luck would have it I am not able to cancel it now, I get a message on their site that an error occurred.

Hello WebMatrix

I have been using a tool for some PluralSight classes and currently a book I’m reading.  Normally I just jump into Visual Studio, but I will admit it is a bit over kill for just playing with HTML5/CSS3.  The PluralSight courses and Pro HTML5 with Visual Studio 2012 make use of WebMatrix.  In fact when I’m on my Windows 8.1 box I often use CodeWriter for the lightweight stuff, but the instructor and writer used WebMatrix so I followed suit.

Not only is WebMatrix quick and lightweight it has intellisense and even the ability to create your site in Azure if you take that option.  Like Visual Studio you can launch your site from the tool in the browser of your choice.  I have not explored everything WebMatrix can do, but I will definitely be using it for small minor things where Visual Studio would just be over kill.  At this time I really don’t see myself using it for real work, just for when I want to play/learn outside a real project.  For example I know you can create an MVC project in WebMatrix but I feel more comfortable in Visual Studio for the real projects.

So if you’re looking for something lightweight that feels like Visual Studio I highly suggest Web Matrix.

Breaking Into Your Lambda

I just learned something new today at Microsoft Virtual Academy.  Heck I almost always learn something new or even things I forgot at Microsoft Virtual Academy.  In this case I thought it was pretty neat.  We all use break points throughout our code, most of the time I just break on a line.  I just learned how to break into a Lambda expression.

Basically you click inside your Lambda expression and then press F9.  To show this I will create a quick class called Stuff.

    public class Stuff
    {
        public string Name { get; set; }
        public int Quantity { get; set; }
    }

In another area I am going to use this class to create a List<Stuff> and then use a Lambda on that list.

            List someStuff = new List()
                            {
                                new Stuff{Name = "Dice", Quantity = 2}, 
                                new Stuff{Name="Cards", Quantity = 52}, 
                                new Stuff{Name = "Tokens", Quantity = 20}
                            };

            var result = someStuff.Where(s => s.Name.Length > 4);

Next I click in my Lambda and press F9, below is a screenshot of the break point inside my Lambda.

Breaking Into Lambda

Follow

Get every new post delivered to your Inbox.

Join 224 other followers