Full disclosure: DYMO has their own javascript based label printing module but there are two problems with it: 1) It does not work with Node.js and 2) it is minified and obfuscated.

So, I wrote my own library.  https://github.com/dsandor/dymojs

I searched for a suitable module and found something on npm but to my dismay it just wrapped the .NET SDK.  A little poking around and some network inspection I found that the folks at DYMO simply wrote a REST service that wraps their C# library and run it via mono on Mac and .NET on Windows.  I captured some calls to figure out how it worked and determined there are really only two calls that matter: GetPrinters and PrintLabel.

Both functions are exposed in the dymojs module.

Check out the tests directory in the repo for an example of printing a test label.

Enjoy!

This post pertains to React Native v0.12.0-rc.

I am attempting to port my iOS app in react-native to Android. I am experiencing a bunch of issues surrounding colors and default styles. I am getting TypeError: expected dynamic type ‘string’, but had type ‘int64’.

Attached the debugger to the processes and I am seeing calls to the following code in CatalystStylesDiffMap.class:

Examining the values I see the color property is an int64.

As it turns out the Android project and the node-module for react-native were out of sync and this caused lots of problem with regard to style color properties.

It looks like my application (even when initing a fresh app) was importing java libraries for 0.11 dependencies:

I verified my installed version of react-native

init’ed a new project and looked at the build.gradle file to see it is 0.11+.

Checked the node_modules/react-native/Libraries/StyleSheet to see 0.11 files (0.12+ has a new processColor.js file in it as seen by recent commits.)

So to make this work I changed the build.gradle to 0.12+, and ran npm i react-native@0.12.0-rc to force the correct android libraries and the correct react-native module. Now the app works.

Is this my machine or npm cache that is horked up or is it an npm install problem with the 0.12.0-rc? I also noticed that none of the files in the $PROJECTDIR$/android folder get updated when doing an npm i or npm update which leaves the native app setting behind in version.

Give it a try here: dsandor.github.io

image

It’s no secret that I use BlogEngine.net for my blog.  I have been too busy to rewrite the whole thing but I did have time to test out writing a WebApi to expose my blog data and buid out a tiny AngularJs version of my blog. 

Basically the HTML for the site becomes very small.  Angular provides all the data binding framework.  I even tested out building a jQuery component.

Next, I am going to build out a cleaner version with a more out of the box Bootstrap design and use Backbone for the data binding framework.  I am just working through which I like better so I am using my blog as the test bed.

This is pretty easy.  Basically you can send any property values to the Window object that is being created to hold your root view.  Simply create a Dictionary<string, object> with the property name as the key.  Pass that dictionary to the DisplayRootViewFor<>() method and viola!

I have an application that uses the WPF frame for navigation.  The frame markup looks like this:

This Frame tag is located in my ShellView.xaml file and this takes the place of a ContentPlaceholder.  In order to navigate to another page I simply call ActivateItem( viewModelInstance ) from my ShellViewModel.  Because the ShellViewModel orchestrates the page loads I created a simple ChangeViewMessage class to throw via the EventAggregator.  My ShellViewModel handles this message and passes the viewModel instance to the ActivateItem method.  Caliburn Micro takes care of everything else.

Here is an example of the ShellViewModel loading my initial page/view in the constructor.

You can see that my first view (SelectServersView via the ViewModel) is loaded there.

In order to make Caliburn Micro work you have to patch one method to be ‘Frame Aware’.

In the View.cs class of the Caliburn Micro source in the Caliburn.Micro.WPF project change the SetContentPropertyCore method to look like the one below.  This allows you to use a Frame.

 

 

 

Just posted the code that I am using for an iOS project of mine that handles all the Web Api calls.  

https://github.com/dsandor/WebApiClient/tree/master/src/Monotouch

Example of use:

WebApiClient.Post<ServiceResponse<User>>(string.Format ({0}Auth/Login?emailAddress={1}&password={2}
  , AppDelegate.Current.ApiBase, email.Value, password.Value), , )
.ContinueWith ( (t) =>

         {
            this.InvokeOnMainThread(() => { loadingView.Hide (); });
                            
            var result = t.Result;
                            
            if (result != null && result.IsSuccess && result.Payload != null)
            {
               this.InvokeOnMainThread(() => 
                {
                  AppDelegate.Current.UserInfo = result.Payload;
                  MoveToHomeView();
                                        
                 });
             }
             else
             {
                this.InvokeOnMainThread(() => {
                    new UIAlertView(Invalid login, Invalid username or password., null, OK).Show();
                    });
             }
     });

I wrote a simple generic method for making POST calls to MVC4 WebApi for use on Windows Phone 8 (But you can use it elsewhere).  The idea is simple: Create one set of generic methods that will take a generic TResultType, an Api Uri, and optionally some data to post and return back a strongly typed response object.

Usage is simple:

This allows you to simply use await to make your MVC4 WebApi calls and get back strongly typed objects.  The Post code uses Newtonsoft Json library to deserialize the response string as an object.

I will package this up as a simple GIT project when I have time and create a nuget package so that everyone can use this simply.

While building a small application for viewing passwords (basically pwsafe for Windows Phone 8) I realized that because of the restrictions of WP8 with regard to the file system I needed a way to pull password files from a remote storage.  As it turns out, the SkyDrive API is comprehensive but did not have a concise Windows Phone 8 API so I started building one.

https://github.com/dsandor/SkydriveHelper

The code is very basic at this point but I do intend on improving it.

With the API helper you can:

These commands will allow you to do the majority of what you need (except upload).

To use it, simply place a SignInButton found in the Microsoft.Live.Controls assembly for Windows Phone 8.  On the OnSessionChanged event simply pass the Session to the helper and it is ready to go.

There is a very simple sample application included in the source tree that will let you get the directories from the skydrive and download a file.

This is a pretty rookie mistake with .NET 4.5 and the new async / await operators.  While searching for the answer I found a lot of noise and no valuable answers so I thought I would notate the solution on my blog.

The short answer is that any method that uses await must itself be marked with async.

Take this code for example:

Error    2    The ‘await’ operator can only be used within an async method. Consider marking this method with the ‘async’ modifier and changing its return type to ‘Task’.