Most Popular Posts

Most Commented On

Current Bloggers

Sponsors

Wikis

  • You have not yet contributed to any pages.

Puppet ACLs–Mask Specific

Posted by Rob Reynolds, Thursday, April 10, 2014 (713 views)

Access Control Lists and permissions can get inherently complex. We didn’t want to sacrifice a sufficiently advanced administrator/developer/etc from being able to get to advanced scenarios with ACLs with Puppet’s ACL module. With the ACL module (soon to be) out in the wild, it may be helpful to explain one of the significantly advanced features of the ACL module: mask specific rights. I am going to interchangeably use the term “acl” to mean the module during the rest of this post (and not the Access control list or discretionary access control list).

Say you need very granular rights, not just RX (read, execute), but also to read and write attributes. You get read attributes (FILE_READ_ATTRIBUTES) with read (FILE_GENERIC_READ), see http://msdn.microsoft.com/en-us/library/windows/desktop/aa364399(v=vs.85).aspx.  ACL provides you with the ability to specify ‘full’,’modify’,’write’,’read’,’execute’ or ‘mask_specific’. Mask specific is when you can’t get the specific rights you need for an identity (trustee, group, etc.) and need to get more specific.

Let’s take a look at what mask specific looks like:

acl { 'c:/tempperms':
  permissions => [
   { identity => 'Administrators', rights => ['full'] }, #full is same as - 2032127 aka 0x1f01ff but you should use 'full'
   { identity => 'SYSTEM', rights => ['modify'] }, #modify is same as 1245631 aka 0x1301bf but you should use 'modify'
   { identity => 'Users', rights => ['mask_specific'], mask => '1180073' }, #RX WA #0x1201a9
   { identity => 'Administrator', rights => ['mask_specific'], mask => '1180032' }  #RA,S,WA,Rc #1180032  #0x120180
  ],
  inherit_parent_permissions => 'false',
}

Note specifically that “rights=>[‘mask_specific’]” also comes with a mask integer specified as a string e.g. “mask => ‘1180032’”. Now where did that number come from? In this specific case you see it is RA,S,WA,Rc (Read Attributes, Synchronize, Write Attributes, Read Control). Let’s take a look at http://msdn.microsoft.com/en-us/library/aa394063(v=vs.85).aspx to see the Access Mask values (integer and hex).

SYNCHRONIZE
1048576 (0x100000)

If we look here, 1048576 is the one we want. Let’s whip out our calculators. You knew that math in high school and college was going to be put to good use, right? Okay, calculators out, let’s add those numbers up.

S  = 1048576
Rc =  131072
RA =     128
WA =     256
-------------
     1180032

That’s the same as the number we have above, so we are good. You know how to make mask_specific happen with the acl module should you ever need to. 

Understanding Advanced Permissions

Oh, wait. I should explain a little more advanced scenario. RX, WA – like we started to talk about above. How do you get to that number, where is FILE_GENERIC_READ? Back to http://msdn.microsoft.com/en-us/library/windows/desktop/aa364399(v=vs.85).aspx, we can see that it includes FILE_READ_ATTRIBUTES, FILE_READ_DATA, FILE_READ_EA, STANDARD_RIGHTS_READ, and SYNCHRONIZE. FILE_GENERIC_EXECUTE contains FILE_EXECUTE, FILE_READ_ATTRIBUTES, STANDARD_RIGHTS_EXECUTE, and SYNCHRONIZE. Notice the overlap there? Each one of those flags only get added ONCE. This is important.  If you are following along and looking, you have noticed STANDARD_RIGHTS_READ and STANDARD_RIGHTS_EXECUTE are not listed on the page with the rights. Where did those two come from? Take a look at http://msdn.microsoft.com/en-us/library/windows/desktop/aa374892(v=vs.85).aspx down in the C++ section. See if you notice anything? Wait, what?

STANDARD_RIGHTS_READ, STANDARD_RIGHTS_EXECUTE, and STANDARD_RIGHTS_WRITE are all synonyms for READ_CONTROL. What? Why not just call it read control? I don’t know, I’m not the guy that wrote the Access Masks. Anyway, now we know what we have so let’s get our calculators ready again.

RA    =     128
RD    =       1
REa   =       8
StdRd =  131072
S     = 1048756
FE    =      32
REa   =       8
StdEx =  131072
S     = 1048756

Let’s remove the duplicates (and the tricky READ_CONTROL duplicate).

RA  =     128
RD  =       1
REa =       8
Rc  =  131072
S   = 1048756
FE  =      32
-------------
      1179817

That doesn’t quite work out to what we were thinking of ‘1180073’. Did we forget something? Yes, we got a little wrapped up in just getting RX sorted out that we forgot about WA, which adds another 256 to the number.

RA  =     128
RD  =       1
REA =       8
Rc  =  131072
S   = 1048756
FE  =      32
WA  =     256

-------------
      1180073

 

Parting Thoughts

While the ACL module has a simple interface you can definitely see that it packs some power with it. Having this kind of power is really helpful when you need to get fine-grained with your permissions.

Filed under: ,
Discuss (0)

Mobile Application Testing w/ no Cell Signal

Posted by Derik Whittaker, Monday, February 17, 2014 (2,114 views)

I am working on building a Windows Phone 8 Application for our enterprise and I while doing so I have learned a very painful lesson.  A lesson in testing your application with a phone which only has wifi, not a cell connection.

When building the application I took the needed steps to ensure that my app would handle idle/resume and background/forground correctly.  However when doing this testing I either used my phone which is connected to a cell network OR I used the emulator which is on our corp network.  And for the most part things are going ok.

However, once I handed the app over to our QA team they started reporting very odd bugs (most sadly were crashes).  These bugs all were found while doing idle/resume or background/forground testing on physical phones.  But these phones were different, they were special.  None of the phones were connected to a cell network, only connected via wifi.  This meant that they were able to find some very special, and very hard to reproduce bugs Smile.

The moral of the story is that you need to make sure you test your application with as many different devices and configurations as possible.  Also do NOT assume everyone will have a cell connection on their phone when doing your testing.

Till next time,

Filed under:
Discuss (0)

My New Blog

Posted by Rob Eisenberg, Friday, February 07, 2014 (2,061 views)

After almost 8 years of blogging on devlicio.us, I've decided it's time to move my official blog. I'm thankful for the devlicio.us community and the opportunities that have come from being a part of it. In the last few months some big things have been forming around my company and its open source contributions. Careful consideration has lead me to "re-focus" my blogging around what has emerged as my career's central theme: UI Architecture and Development. I’ll be cross-posting here for a little bit, but I hope you’ll join me on my new blog.

UI Frameworks and Libraries
If you're interested in UI frameworks and libraries, you are going to want to check out my new blog. I'll be talking about Durandal, Angular, Polymer and more. Is building rich web applications something you're interested in? There will be plenty of that. Of course, we'll also look at other platforms such as Unity3D and real-time GUIs.

The Present and Future Web
The web is changing rapidly. Right now there are tons of new specifications being designed in various "Working Groups". There are some good ideas...and some not so good ideas. If you're interested in keeping up to date on how the web is evolving, I hope you’ll subscribe to my new blog.

Patterns and Practices
Frameworks, libraries, tools and new technologies are fun, but we need more than that. We need to know how to use them wisely and when not to use them at all. How do we translate recent decades of software craftsmanship practices into these new areas? What types of UI patterns solve the real world problems we encounter? These are things I've spent a lot of time thinking about over the years and it's my intent to share those ideas with you.

So, I hope you'll join me on this new adventure. There's going to be some pretty interesting news coming and a ton of great content to boot.

Using DataTriggers to control Visual State Change

Posted by Derik Whittaker, Monday, February 03, 2014 (2,039 views)

In the continuation of my ‘wow did not realize that existed in xaml’ series I wanted to post about how you can use DataTriggers bound to a value in your view model to trigger a visual state change.

Having the ability to trigger a state change via Binding is an awesome improvement over having to use the view’s codebehind as it is just another step towards total freedom of needing the code behind.  If you were using the code behind to change state you would need to have a line similar to the following

VisualStateManager.GoToState(this, "ShowAuthenticationState", true);

So how do we trigger a state change via XAML and Binding?

First we need to reference the following namespaces in our XAML

xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"

Next we need setup our trigger in XAML as seen below

image

If you look at the XAML above there are 2 things to focus on

  1. I am setting up my DataTrigger to bind to a property called ScreenMode (you can of course bind to any property you want), I am also defining the value I want this to trigger off of, in my case Diagnostics
  2. I am defining the GoToStateAction for my DataTrigger.  For my GoToStateAction I provide it the State Name of ‘ShowDebugState’, this is the name of one of the states I have defined inside my VisualStateManager (it is assumed you already know how to work with the VisualStateManager, if not there is plenty of information on StackOverflow

Once I have this XAML wired up correctly, each time my ScreenMode property changes to one of the defined values the corresponding ViewState will be set.

Till next time,

Filed under: , ,
Discuss (0)

Using EventTriggers for DataRequested for RadJumpList

Posted by Derik Whittaker, Thursday, January 30, 2014 (2,300 views)

I am a fan of MVVM and I buy into the idea NOT using code behind it at all possible.  When using the Telerik RadJumpList (or anything based off of DataBoundListBox) there is a feature that you can enable which will all you to provide ‘infinite’ scroll ability to a list box which could contain virtually unlimited items.

Typically when you implement this behavior you need to do 2 things:

  1. Set the DataVirtualizationMode value, in my case I wanted OnDemandAutomatic
  2. Create an event handler in your views code behind to listen to the DataRequested event.

I have no ‘MVVM’ issues w/ the DataVirtualizationMode value being hard wired, but I really do not like the idea of having an event handler in my Code behind whos only job it is, is to call a method on my view model.  Fortunately for use we can solve this problem with ease by using EventTriggers.

Take a look at the xaml below for an example on how to accomplish this

image

Make sure you reference the namespace for System.Windows.Interactivity as below
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

Once you use this event trigger you can create a ICommand property on your ViewModel and avoid your code behind.

Hope this helps!

Till next time,

Filed under: , ,
Discuss (0)

WPF Everywhere…For REAL this time….

Posted by Rob Eisenberg, Monday, January 20, 2014 (4,197 views)

I wanted to share something cool with you. Hop on over here and check out this demo video of NoesisGUI. The Noesis team has ported a powerful subset of WPF and Silverlight over to native C++ and has it up and running on Windows, OSX, Linux, Android and iOS. It’s fine-tuned for realtime,, vector-based graphics and it has bindings for several major technologies such as Ogre, OpenSceneGraph and……Unity3D. That last option is what I’m most excited about. With a pro version of Unity and the Noesis library you can write XAML (even using Blend) and still write your app code in C#. With Unity, you can easily build for all the above platforms. Additionally, it fully integrates with 3D. Pretty sweet.

The folks over at Noesis Technologies have been making frequent releases to expand the supported platforms, add more WPF features, improve performance and graphics quality and….enable better support for MVVM. Yes, that’s right, they’re keenly interested and working towards enabling better MVVM workflow support at the API level.

I hope you’ll check it out. The Noesis team is doing some amazing work. Right now they have a New Year’s sale going on. If you are a Unity user you might want to take advantage of that.

Reading a embedded content file in WinRT & C#

Posted by Derik Whittaker, Friday, January 17, 2014 (2,270 views)

Have you ever had the need to read in an embedded content file when working in WinRT, how about using the PCL with WinRT?  Maybe you have a .json or .xml file you want to use to test data (which is my case).

There are a ton of different suggestions on how to accomplish this on the net, I found most of them to partially accurate or just down right wrong.  Because of this I thought I would demonstrate how I was able to accomplish this.

Step 1: Adding the file to be read to your project:

Below is my file to be read and its folder structure.  You can see that my file is 2 folders off of the root.

image

Step 2: Setting the properties for this file:

Below is the screen shot of the properties panel (Right click the file and select properties). Pay attention to the fact that my Build Action is ‘Content’

image

Step 3: Create the logic to read in the file and return the contents as a string

Below is the code I used to read in the file.

public async static Task ReadJson()
{
    var jsonFile = Path.Combine(Package.Current.InstalledLocation.Path, "JsonSerialization/json/DirectorySearchResults.json.txt");

    var jsonFolder = await StorageFolder.GetFolderFromPathAsync(Path.GetDirectoryName(jsonFile));

    using (var jsonStream = await jsonFolder.OpenStreamForReadAsync(Path.GetFileName(jsonFile)))
    {
        using (var streamReader = new StreamReader(jsonStream))
        {
            var json = streamReader.ReadToEnd();
            return json;
        }
    }
}

When looking at the code above there I do need to call attention to the first line.

In the first line I am creating the path to my json file.  When providing the name of the file make sure to provide the name of EACH folder in the file path.  If you do not do this you will not like your results.

Hope this helps.

Till next time,

Filed under: ,
Discuss (2)

Kickstarter Wrapup

Posted by Rob Eisenberg, Monday, January 13, 2014 (3,255 views)

I want to say this first: Thank You. From the bottom of my heart, I'm thankful for every single person who was willing to support this project. As you probably know by now, we did not succeed in raising the funds we were aiming for. But, that does in no way diminish the gratitude I have for everyone who believed in what I was trying to do and who helped to spread the word. Again, thank you.

Assuaging Your Fears

Now, on to the second point...please hear this loud and clear: Durandal is alive and well. Some have been afraid that if the Kickstarter failed that the project would die. That is not going to happen and there was never any chance of that. There have been some unsavory folks out among the interwebs who have actively spread this rumor in an attempt to damage Durandal's reputation as well as that of me and my company. If you weren’t born yesterday then you know that this type of person exists in every community. Please pay them no heed. It's important that we foster a community of creative ideas, hard work and constructive criticism.

Hidden Gems

Though the funding for this project was not successful, there are some great things that have already come about as a result:

  • We connected with people. People and relationships matter and the Kickstarter helped to strengthen existing relationships and begin new ones.
  • We got the word out. Kickstarter isn't just about raising funds, but also about raising awareness. Now, more developers than ever know about Durandal.
  • We cast a vision. We were able to dedicate time to building the NextGen prototype to a stable enough point that we could demonstrate how elegant and simple JS app development can be. Whether it is released or not, I believe the developer experience demonstrated in this video sets a bar that all other frameworks will have to rise to.
  • Doors have been opened. I've been contacted by a number of companies who have presented several intriguing opportunities, many of which would have a positive effect on Durandal. We shall see what happens…

Moving Ahead

So, you might be wondering "What is the plan now?" Let me break that down into three categories: 

What Will Happen

Our top priority is to prepare the 2.1 release of Durandal. That will hopefully happen in the next month or two. After that release, we will be expanding the core Durandal team by adding some additional official committers. There's a strategic reason I haven't done this yet, but after the 2.1 release, the time will be right. Along with or immediately after the 2.1 release, we will do a 1.1 release of Wayland, to fix some of its issues and add a few new features related to additional build scenarios. Docs will be added/updated correspondent with these releases.

What Might Happen

We've got a start on the Grunt-based tooling. So, I may be able to get that out after the Weyland tooling is released. Once we add more official committers, I think this is a likely task for someone on that team.

I'd really like to get at least one video training series published this year. It requires a lot of time to put something like that together. We've got the "Help Desk" sample app ready to go, so I'm hopeful that I can carve out time to put the videos for that together.

What Probably Will Not Happen

We hope we'll be able to create one video training series, but it's highly unlikely that we'll be able to create three. The amount of time that it would require simply won't fit into the schedule without dedicated funding. Additionally, the "Live Views" tooling will probably not get developed. If I have a committer that is passionate about that, I can lay out a couple of strategies for accomplishing it, but if not, it's going to have to be shelved for now. 

Finally, the big thing that isn't likely to happen is the NextGen implementation. It's a tremendous time investment to build a framework like this. The NextGen, being built on future web standards, means keeping up with all those specs and pollyfills as they change and taking an extremely active role engaging the standards groups. The time investment is massive. This alone is easily a full-time job for a year by itself. I'll continue to work on it when I can squeeze in an hour or two, but it's not likely to see the light of day and I'm afraid to release it to the public too early due to the maintenance cost it would incur on my company. This particular point is probably the biggest disappointment for me personally. But, maybe we'll figure something out. I’m still investigating options here…

Business

There are many business models for open source. Most successful projects use a variety of models in combination. Currently, Durandal is funded by donations, commercial support, corporate sponsorship, training and consulting. Crowd Funding is a relatively new business model for open source. I thought I would give it a shot. While it didn't work out this time around, I'm not completely ruling it out as a possibility for the future. I suspect that we'll see more crowd funded open source in the coming years.

Final Thoughts

Consider that Durandal was officially released less than a year ago. Amazing things happened in 2013. The community exploded. Tons of apps went into production on every device and platform. We had multiple releases, created new tools and put together some great documentation. I'd say 2013 was a great success.

It was March 15, 2010 when I first had the idea to build Durandal, after presenting a similar framework designed for Xaml runtimes. Some crazy friends of mine put the idea in my head right after the talk. Since then I've been brainstorming and prototyping all sorts of ideas. What you see as Durandal today is only the tip of the iceberg. Even though our Kickstarter wasn't funded, I'm still excited about the future of Durandal and anxious to see what we can do in 2014.

Discuss ()

Using DataTriggers to control Storyboard Animations

Posted by Derik Whittaker, Thursday, January 09, 2014 (15,482 views)

XAML has many very cool features, it seems I learn about new features every week. This week one of the features I found was how to use DataTriggers to control storyboards.

Why am I excited about this? Well I use the MVVM pattern when building any XAML based application and any time I needed to start a storyboard I would send a message to my view’s code behind from my view model to instruct the view to start the animation, this worked by always felt dirty to me. With DataTriggers I can simply use binding to start/stop my animations, this feels so much better to me.

So how does this work?

The first thing to show is our XAML which implements the DataTrigger

** Note **
To use Triggers and DataTriggers make sure you import the following namespaces
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"    
xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
xmlns:eim="clr-namespace:Microsoft.Expression.Interactivity.Media;assembly=Microsoft.Expression.Interactions"

image

When looking at the above XAML there are 3 things of importance to point out

  1. The DataTrigger expects you to bind to your view model via the ‘Binding’ attribute.  This works in the exact same manner as all other binding in XAML.  Make sure you set the mode == TwoWay if the bound value is going to change
  2. The DataTrigger expects the Value attribute to be set.  When setting this value you want to put in the property value which is expected to trigger the animation.  In my case since I am binding to a boolean I am going to set this value to true.  If you were binding to a string you would put what ever string value needed to trigger the storyboard
  3. The ControlStoryboardAction expects a the Storyboard attribute to be populated.  In our case I am binding it to a local storyboard which is part of my DataTemplate.  This binding works that same as all other StaticResource binding

When you have this setup correctly the changing of the ShowPresenceSelection property in my underlying viewmodel will trigger one of my Storyboards to play.  I like this method because it feels better in an MVVM setup.

Till next time,

Filed under: , ,
Discuss (0)

Last Chance to Back Durandal

Posted by Rob Eisenberg, Tuesday, January 07, 2014 (3,384 views)

At 9:45am EST on Friday morning the Durandal Kickstarter Campaign will come to an end. We will either be fully backed and able to proceed with our full vision in 2014 or we won’t. It’s an all or nothing deal. As I post this, it’s Tuesday morning, and we still need significant help from all of you. I hope you’ll consider the full affect of your contribution. Not only will you get some great rewards, but you’ll be supporting open source and helping to advance the web. Whether we succeed or not, I’m certain that in the coming years people will look back at our Next Gen Prototype as an important milestone in the history of web technology. It would be a tremendous loss for the web if it were to be left unfinished and unavailable.

Here’s a quick summary of information and videos for you:

I hope you’ll join us by supporting the project and helping us to do more releases in 2014, create more and better tooling, publish top notch JS client app training materials and build the future of the web with our Next Gen technology. It is in your hands now.

Seven Reasons to Back Durandal in 2014

Posted by Rob Eisenberg, Thursday, January 02, 2014 (3,407 views)

When I began planning the Durandal Kickstarter campaign, I knew that raising the necessary funds wouldn’t be easy. However, I’ve been really surprised at the small number of supporters (though the few have been very generous). Since the strength of crowd funding isn’t in a small number of supporters donating massive amounts of money, but rather a large number of supporters each contributing a little….I thought things would go a bit differently. After all, this blog post will be seen by upwards of 20,000 developers in the next few days. It’s interesting to think that if each person who saw this donated $5 then the project would not only be fully funded for the entire year, but would be moving towards additional stretch goals as well.

Alas, I am no marketer. I have ideas and I write code. I build things people use to write software…a lot of people and a lot of software. I’m not sure if I’ve given good reason to back the project or not. Naturally, there are concrete rewards for backers. But, I thought I would also give you a list of seven other reasons you may not have thought about. Time is running out for our campaign. I hope you will take it to heart.

1. Support Open Source

If you’re a web developer…no… if you are any type of software developer, you’ve probably leveraged open source libraries, frameworks or tools at some point. Have you ever considered how much time and effort went into creating those? Have you ever considered how much money you or your business has saved by not having to develop all the functionality represented by the open source you used? Or how much time you saved? One of the things my company has done over the years is contribute financially to projects and individuals whose open source we’ve used on different projects. We don’t contribute to everyone all the time, but we usually pick one or two projects and send them some cash (or even something from their amazon wish list).

When you think of open source, I hope you feel a great sense of gratitude. I hope you’ll express that gratitude by regularly financially supporting projects that you leverage. Naturally, I would love for you to support Durandal (and get cool rewards too)…but if you don’t want to do that, please go find some project you can get behind and help them out with a financial contribution.

2. Advance Web Development

If the Durandal Kickstarter is backed, we’ll be brining our NextGen Preview to life. This implementation is the easiest, most powerful and flexible SPA framework to date. It also performs better than other frameworks (yes, including Google’s) and is based on more web standards than any framework. It’s a major win for the web development community. It’s certainly far ahead of it’s time, but it will never see the light of day without you.

3. Protect the Open Web

There are lots of future web technologies being worked on by ECMA and W3C; everything from new JavaScript language features to improvements in the networking stack to enhancements and extensions of the DOM. It could make the browser into an awesome development platform...or it could destroy it. How do we know we can use what they are designing? How do we know they won’t favor a certain company’s framework or “way”? How do we know that they’ll even enable good web development practices that have emerged over the years? I’d hate to be stuck with bad or useless technology when amazing opportunities exist.

Durandal has already gotten involved with these groups and affected changes in existing specs. We want to continue to engage these groups by providing the real world scenarios that only a project like ours can bring to the table. But without your support we won’t have the time and resources to adequately participate.

4. Prevent Monopoly

We’re at an exciting point in history…and a dangerous one. Google is poised to truly own the web. They’ve got the leading web browser, the leading search engine, the leading app framework and a new programming language they created which they are standardizing and trying to put into the browser.  They’ve also got one of the most popular OSes, are leading the mobile adoption world and are making strong movements in the desktop and “living room” space. Do we really want one company to dominate everything? Certainly our industry experience (ehem…Microsoft) tells us that this is really, really bad for everyone.

I hope you believe that it’s not only BIG companies that can make a difference or have good ideas. I hope you see the value in small business and the contributions of individuals to making the world a better place. If you do, you should back that up. We believe that and would love your help.

5. Learn Something New

The web is changing and the future will be filled with more and more SPA applications. Do you know how to build an app like this? In my experience this is untrod territory for almost all developers. Even those that have worked in this area find themselves lost when trying to build more complex systems.

The Durandal Kickstarter offers you an opportunity to get ahold of some awesome training materials for cheap.  If we succeed, we’re going to create three full courses. Each course will take you through building a different SPA from end-to-end. No stone will be left unturned. From data-binding, validation and dirty tracking to routing, history, pub/sub and UI architecture patterns, these courses will not only give you knowledge but walk you through real scenarios and empower you to create awesome applications for the future. Check out this quick video showing the app we’ll build in the second course then head on over to our Kickstarter campaign to grab it up.

6. Get New Tools

Durandal has plans to create tooling that will fundamentally transform the way web apps are developed. Our Kickstarter is about taking the first steps in that direction. But, if we can’t take these first steps, we’ll never get to the truly transformative bits. We need your help to bring these tools to life.

7. Do Something Good

It’s a new year. What does that hold for you? I hope you’ll fill it up with good things. Might I suggest one thing in particular?

Async/Await & ‘Does not contain a definition for GetAwaiter’ error

Posted by Derik Whittaker, Sunday, December 29, 2013 (2,960 views)

I have been working on a side project and today I ran into a really odd error which had me stumped for a few minutes.  I would run my code and the following error would be thrown.

{"KioskUpdateManifest' does not contain a definition for 'GetAwaiter'"}

Take a look at the code below

public async Task<KioskCheckinManifest> Checkin(dynamic manifest)
{
    try
    {

        if (manifest == null) { throw new ArgumentNullException("manifest", "Provided manifest was null"); }
        if (manifest.Context == null) { throw new ArgumentNullException("manifest", "Provided context was null"); }

        if (manifest.Context != null)
        {
            var asJson = manifest.Context.ToString();
            var asManifest = JsonConvert.DeserializeObject<KioskCheckinManifest>(asJson);
            var checkinResult = await _kiosksService.Checkin(asManifest);
                    
            return checkinResult;
        }
    }
    catch (Exception e)
    {
        Logger.LogException("KioskHub.Checking", e);
    }

    return new KioskCheckinManifest();
}

At first when trying to debug this code I thought something was wrong w/ the way my object was being deserialized, but no that was correct.  Then I thought that maybe my KiosksService.Checkin call was producing the error, but again no it was not.  I took a look at this for a bit longer and I realized that the GetAwaiter was part of the async/await stuff.  Realizing I was dealing w/ async issues I knew the following line of code had to be the culprit, but why.

var checkinResult = await _kiosksService.Checkin(asManifest);

To try to resolve the issue I went to the implementation of my .Checkin and I quickly realized that I was trying to await a method which was not awaitable.  As soon as I removed the await keyword from my call everything worked as expected.

Now it makes 100% sense to get an error when trying to await a non-awaitable method, but my real issue is why does the compiler not give me a warning, or better yet an error?

The moral of the story is this.  If you get this error make sure you are not awaiting a non-awaitable method.

Till next time,

Filed under: ,
Discuss (1)

Durandal Next Gen Sneak Peek and Herding Code Podcast

Posted by Rob Eisenberg, Thursday, December 26, 2013 (4,118 views)

I’ve got some really cool stuff to share with you all today. A couple of days ago I released a video to my Kickstarter backers giving them a sneak peek of application development and new features in the NextGen version of Durandal. You are really going to want to see this. In the video I begin by building a simple "Hello World" screen. Then we configure a simple router and transform our application into a navigation-style app. We end by building out a second page that pulls images from Flickr and we demonstrate navigating back and forth between the two pages. It’s a great example of how simple SPA apps can be. There’s nothing quite this simple and elegant anywhere else today. Here’s some cool facts about the NextGen Durandal implementation:

  • Modules - Use AMD, CommonJS or ES6 modules to build apps. (Built on the ES6 native script loader API).
  • Data-binding - Bind to plain JavaScript objects. (Built on the native Object.observe API).
  • View Templates - Use simplified {{}} binding expressions. (Built on native HTML Templates and WebComponents).
  • Custom Elements - Create your own templatable and bindable elements. (Built on native WebComponents, HTML Templates and Object.observe).
  • Performance - It's fast! The composition system is up to 2x faster than Durandal 2.x. The data-binding system is marginally faster than AngularJS. With native Object.observe enabled in Chrome, it is 2-3x faster than AngularJS.
  • Isolation - There is nothing in global scope. You can run multiple isolated Durandal apps on the same page, even multiple instances of the same app.
  • External Dependencies - None.
  • Browser Support - Built on future browser technologies, pollyfilled for today's browsers. Works on >= IE10 and all other modern browsers. (There are some glitches on IE9, but I'm hopeful about getting it working if the Kickstarter is backed.)

In addition to the sneak peek, I also had the pleasure of joining Jon Galloway and K. Scott Allen on the Herding Code Podcast. We discussed the Durandal Kickstarter and it's goals. We also had a good discussion on the NextGen preview and some directions we are moving towards in 2014 and beyond. I hope you enjoy listening to the discussion and help us out by backing our Kickstarter.

Join Durandal. Build the Next Web.

Posted by Rob Eisenberg, Wednesday, December 18, 2013 (9,527 views)

Durandal is a lightweight JavaScript framework designed to make building Single Page Applications (SPAs) simple and elegant. It has strong support for MVC, MVP and MVVM so that no matter what type of front end architecture you prefer, Durandal can handle the task. With RequireJS as its base and a thin layer of conventions, Durandal can provide amazing productivity while helping you to maintain SOLID coding practices. Pair that with out-of-the-box support for rich UI composition, modal dialogs, messaging, widgets, transitions, routing and more....and there's no doubt you'll be able to build whatever apps you can imagine.

While Durandal has only been publicly available for about a year now, the community has grown at a breakneck pace. As a result, we’ve launched a Kickstarter to help us accomplish some amazing things in 2014. I’d like to take a few minutes to share our planned initiatives and invite you to join us in shaping the future of the web. Our goals break down into four categories: releases, tooling, training and the next generation.

Releases

Durandal had 16 releases in 2013. That’s 2 major releases, 2 minor releases, 4 patches and 8 pre-releases. It was a ton of work, but it was worth it and we were able to maintain a rigorous adherence to semantic versioning principles along the way as well as provide upgrade guides to our developers. But we aren’t satisfied with that. 2014 has to be better. We want to be able to address bugs faster and get release packages out sooner. We want to be able to rev the framework in a non-breaking way so that we can better meet the increasing demands of our customers as they explore ever challenging landscapes. We want to have richer, task-based documentation that helps developers fall into “the pit of success”. All this requires enormous time and effort. We are up to the task but we need your support.

Tooling

Traditional web development tooling has come a long way over the years. But Single Page Apps are so new that the tooling tends to be fairly primitive or non-existent. Durandal has a good start in this area due its collection of starter kits geared to various build platforms. But, we consider that a bare minimum and it falls far short of our vision. In 2014 we want to take things a little further by putting some more essential pieces in place. First, we want to improve our own build tool, Weyland, by fixing some bugs and opening up new scenarios. Second, we want to add better support for Grunt, a very popular JavaScript build tool. Finally, we want to create a dev-time tool that monitors your views and modules for changes while you work. When a view changes, it will update the html "in place" inside your app without needing to restart it or refresh the browser. If your code changes, it will automatically refresh the browser for you. We know this will change the way many build apps. There will be no more “design-time”. The running app will be the design surface. We’ve wanted to build this for a long time now. We know how to do it, but we need your support in order to carve out the time to make it happen.

Training

The web is changing. In much the way that AJAX transformed the way web apps were written in the last decade, SPA frameworks are changing things today. It’s an exciting time with amazing possibilities, but many developers are left having to “figure it out” by themselves. There are precious few resources on building these apps, and among the resources that do exist, many are poor or incomplete. The Durandal project aims to change that. We want to produce three full series in 2014. Each series will take you through building a different SPA from end-to-end. No stone will be left unturned. From data-binding, validation and dirty tracking to routing, history, pub/sub and UI architecture patterns, these courses will not only give you knowledge but walk you through real scenarios and empower you to create awesome applications for the future. We’re confident that this will be some of the best JavaScript learning materials on the web. Want to see one of the apps we’ll teach you how to build? Check this out. We want you to have it. Will you join us?

NextGen

Durandal is opening up amazing new opportunities for developers today. We’re working hard on our current versions and that’s a big part of our plans for 2014. But we’re also thinking about the future. Right now groups like ECMA and W3C are planning a host of new technologies for the browser; everything from new JavaScript language features to improvements in the networking stack to enhancements and extensions of the DOM. It could make the browser into an awesome development platform...or it could destroy it. How do we know we can use what they are designing? How do we know they won’t favor a certain company’s framework or “way”? How do we know that they’ll even enable good web development practices that have emerged over the years? I’d hate to be stuck with bad or practically useless technology when amazing opportunities exist. Durandal can help with this. In 2014 we want to build an alternate implementation of Durandal on top of emerging browser technologies. We want to put these specs to the test and provide the standards groups will real case studies. As it turns out, the ECMA and W3C groups really want this. They’ve been asking for it because they don’t want to mess up. They want to help web developers get what they really need. As a result the Durandal project has had some great interactions with these groups and has already been able to affect changes and improvements in some specs. But, we need time to really dig in and re-imagine the framework in terms of things like Web Components, Object.observe and ES6. With your help we can build an awesome NextGen app framework and provide the needed feedback that the standards bodies desire. Check out this video that demonstrates our progress to date.

Taking Action

The Durandal project has helped thousands of developers build awesome apps. As you can see, we’ve got big plans. But, we need your help. We hope you’ll take some time to look at our Kickstarter. There’s some cool rewards available and some great opportunities for individuals, consultants and large organizations. It’s a great way to support open source, help build the web and walk away with some excellent perks. What do you say? Will you help us make history?

Using LINQPad to query your Mongo Database

Posted by Derik Whittaker, Wednesday, December 18, 2013 (4,101 views)

Recently I started playing around w/ Mongo for a side project and so far it has been a cake walk.  While learning how to use Mongo I quickly realized that the ‘out of the box’ tool to query the database was the command line.  Now this works great, but is limited.  I am not able to easily save and reuse any scripts.  While doing some simple research about different Admin Consoles for Mongo I noticed that I could use LINQPad to do accomplish my needs.

In order to use LINQPad there are a few steps which need to be performed, the first of which is to download and install LINQPad.  Once you have this installed we can get down to the nuts and bolts.

How to reference the Mongo C# Library:
When ever I need to reference any assemblies I want to use NuGet when at all possible, fortunately I am in luck because LINQPad has native support for this.

  1. Create a new LinqPad C# Expression Query
  2. Right click the query editor and choose Query Properties
  3. Click the ‘Add NuGet’ button in the Query Properties dialog
  4. Search for the MongoCSharpProvider, click Add To Query
  5. Notice that the ‘Add to Query’ link changes to ‘Add Namespaces’, click this.  A dialog will popup, select all the items (I am lazy and this is easier) click OK
  6. When you are taken back to the Query Properties window you should see the following
    image

Now that we have Mongo Client referenced we can create the code needed to make our connection and do something useful

Connecting to Mongo in LinqPad

To do this you can add code as seen below.

image

 

Once you have added the above code you can do anything you want to your Mongo db and save the scripts for later.

Till next time,

Filed under:
Discuss (0)
More Posts Next page »

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)