Archive

Archive for October, 2012

eBook Giveaway

October 29, 2012 Leave a comment

Congratulations to Thomas Griffin and Chris Bordeman for winning a free copy of MVVM Survival Guide for Enterprise Architectures in Silverlight and WPF.

Hope enjoy the book!

Advertisements
Categories: English Tags: , , , , , ,

7 tips to Make building Win 8 apps in HTML/Javascript a Breeze

October 27, 2012 Leave a comment

I am excited to be speaking at the RDU Codecamp event this coming November 10, 2012!

Here is my presentation summary:

Windows 8 development is still fairly new to the scene and sometimes it can be frustrating when you run into an issue that seems like you are doing everything right only to find out that there is this one thing you must do to get your code working.  Come out to this session and we will walk you through some gems discovered while building Windows 8 applications in HTML and hopefully you won’t need to run into the same pitfalls.

Looking forward to seeing you there!

Categories: English Tags: , , ,

Build Your Own Dashboard

October 27, 2012 Leave a comment

I had a great time presenting on Build Your Own Dashboards at the SQL Saturday #174 Charlotte BI Edition.  Thank you to everyone who came to my session and participated in my talk.

Here is a link to the sample dashboard site I presented on:

Dashboards

Be advised that this site and the sample code is only optimized for IE 9.  You need to provide CSS3 vendor specific entries for WebKit and Mozilla if you want this to work perfectly in Chrome, Safari, and Firefox.

Here are the slides and sample code:

Slides and Sample code

Thanks again for the opportunity…

koFiddle

October 26, 2012 Leave a comment

I am proud to announce that my first Windows 8 application has been certified and added to the store.  Here is a screenshot of my application:

koFiddle

You can get my application using the following link:  koFiddle

Here is a short description of my application:

koFiddle is a simple HTML and JavaScript editor that focuses on Knockout. A developer can type in their HTML and define their data-bind statements. Then the developer can provide a view model in their JavaScript. Finally, the editor will automatically render the output of the HTML and JavaScript in the Result’s pane.

It has been a learning experience and I am very excited to get my next applications submitted to the app store.

 

Categories: English Tags: , , , ,

Developing Windows 8 – Encoding

October 22, 2012 3 comments

Just wanted to address an issue I received when submitting an application for the Windows 8 application store.  Hopefully, if you follow this, you will not receive an error during your submission.

If you are using any third party JavaScript libraries or libraries that include HTML or CSS, you will more than likely run into issues where encoding of those files does not match the requirement for Windows 8 applications.  If you run the Windows 8 application validation tool, you will run into the following exception:

File encoding

FAILED

UTF-8 file encoding
  • Error Found: The UTF-8 file encoding test detected the following errors:
    • File …\codemirror.js is not properly UTF-8 encoded. Re-save the file as UTF-8 (including Byte Order Mark).
    • File …\css.css is not properly UTF-8 encoded. Re-save the file as UTF-8 (including Byte Order Mark).
    • File …\index.html is not properly UTF-8 encoded. Re-save the file as UTF-8 (including Byte Order Mark).
  • Impact if not fixed: HTML, CSS, and JavaScript files must be encoded in UTF-8 form with a corresponding byte-order mark (BOM) in order to benefit from bytecode caching and to avoid other runtime error conditions.
  • How to fix: Open the affected file, and select “Save As…” option from the File menu in Visual Studio. Select the drop-down control next to the Save button and select “Save with Encoding”… option. From the Advanced save options dialog, choose the “Unicode (UTF-8 with signature)” option and click the OK button.

As stated above, this can easily be mitigated by changing the encoding the file at question using the following steps:

  1. On the File menu select the Advanced Save Options…
  2. In the dialog window you will see the current Encoding as well as Line Endings.
  3. Click on the Encoding drop-down and select Unicode (UTF-8 with Signature) – Codepage 65001.
  4. Finally, save your file.

That is all there is to it!  By doing this you will prevent getting any validation errors that deals with encoding.  So far, every JavaScript library that I have found has given me this issue.  I really want to give the validation tool provided by Microsoft kudos as it really helps troubleshoot your issues.

One last thing to point out, you may also receive an error under the Performance test that is actually related to the encoding issue.  I would first correct the Encoding issue and the re-run the validation test to see if the Performance test failure is accurate.

Hope this helps…

Categories: English Tags: , , , ,

Developing Windows 8 – Most Recently Used List

October 16, 2012 3 comments

In the last post of the series, we discussed some of the challenges that I ran into using the Documents Library.  It turns out, unless I want to actually programmatically modify files in the file system, I really didn’t need the added security and license constraints of using the Documents Library.  All Windows 8 applications come with the feature of remember the last 25 most recently used files.  In the application I developed, I wanted to have the ability to keep track of two separate files and always get the most recent of each.

This is where the sample documentation and I diverged in paths.  I believe that this feature is very cool when you are only dealing with a single file but can become a little more difficult when you need to manage multiple files and have them open when your application starts.  The following code snippet demonstrates responding to a user initiated event to load a load a file:

var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.thumbnail;
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
openPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]);

// Open the picker for the user to pick a file
openPicker.pickSingleFileAsync().done(function (pickedFile) {
    if (pickedFile) {
        // Process picked file
    } else {
        // Canceled; no file was picked
    }
});

The code is fairly straightforward in that it just waits for the user to pick a file asynchronously and then it fires the “done” function to process the file selected. Now let’s look at what it takes to add support for the most recently used (MRU) feature of Windows 8:

var mruToken = Windows.Storage.AccessCache.StorageApplicationPermissions.mostRecentlyUsedList.add(pickedFile, pickedFile.name);

As you can see, this one line of code is all that we need to add our recently selected file. The value returned from the add function is a unique string token that will allow you to retrieve the selected file at a later time. Let’s now look at how we can grab a file from the most recently used list.

var mruFirstToken = Windows.Storage.AccessCache.StorageApplicationPermissions.mostRecentlyUsedList.entries.first.token;
Windows.Storage.AccessCache.StorageApplicationPermissions.mostRecentlyUsedList.getFileAsync(mruFirstToken).done(
    function (retrievedFile) {
        // Process retrieved file
    },
    function (error) {
        // Handle errors
    }
);

This example grabs the first item in the most recently used list and uses the AccessCache to return the file from the file system.

The same feature that allows you to access a file system will also allow you to access folders.

If you read the documentation, you will also notice that the second argument to the add is metadata. We can use this to our advantage in that we can keep track of the file types. It is this convention that allows us to have multiple panes and get the latest one for each.

Now that we know that we can pass in metadata, we can then use this metadata as a filter against the entries list.

With the metadata value we can use the following method to pull the actual entry from the list:

function getFirstToken(metadata) {
    var mruToken;
    var mruEntries = Windows.Storage.AccessCache.StorageApplicationPermissions.mostRecentlyUsedList.entries;
    if (mruEntries.size > 0) {
        mruEntries.forEach(function (entry) {
            if (entry.metadata === metadata) {
                mruToken = entry.token;
            }
            // Continue processing the MRU entry
        });
    } else {
        // Handle empty MRU
    }

    return mruToken;
};

Now that we have our token, we can then read the file.

function readToken(metadata, token) {
    Windows.Storage.AccessCache.StorageApplicationPermissions.mostRecentlyUsedList.getFileAsync(token).done(
        function (retrievedFile) {
            // Process retrieved file
            // ...
        },
        function (error) {
            // Handle errors
            // ...
        }
    );
}

It is with this method that we are finally able to get the correct file from the most recently used list. Because I am loading multiple files in my application, I need to store the metadata for each file type. I typically store my file type information into the roamingSettings object. It is then when a user launches the application at a later time that we can reference the value stored in the roamSettings object and then get the getFirstToken method.

If you are interested in reading more on most recently used lists in Windows 8 applications, just read the following link.  I am very impressed with the power and capabilities  inherent with developing Windows 8 applications.

Hope this helps…

Categories: English Tags: , , , ,

Windows 8 – Resolving package upload errors

October 15, 2012 Leave a comment

Over the weekend, I uploaded my first application the app store.  I ran into some issues and I wanted to share a link that will make understanding what the error means when you encounter it.

Here is a sample of the page:

A single app can’t include both architecture-neutral and architecture-specific packages.

For more info, see Building the app package manually.

All packages for this app must use the package identity name: [package identity name]

For more info, see Building the app package manually.

A package is not a main package. Only a main package, which defines an app tile, can be uploaded.

The app manifest must contain a valid Application element.

For more info, see Building the app package manually.

At least one language doesn’t have a default store logo image.

The app is missing a required image.

For the list of images that must be included in your app’s package, see App images. The Store logo topic also has additional details about the Store logo image.

At least one language doesn’t have a default small logo image.

The app is missing a required image.

For the list of images that must be included in your app’s package, see App images. The Small logo topic also has additional details about the small logo image.

At least one language doesn’t have a default logo image.

The app is missing a required image.

For the list of images that must be included in your app’s package, see App images. The Logo topic also has additional details about the logo image.

Declared applications must have the same details between packages

If your app has more than one package, the Package/Capabilities and Package/Resourceselements must be the same in each package.

For more info, see Building the app package manually.

Declared dependencies must be the same for all packages.

If your app has more than one dependency, the Package/Dependencies elements must be the same in each package.

For more info, see Building the app package manually.

The supported languages are not the same for all packages. All packages must support the same languages.

For more info, see Building the app package manually.

Declared dependencies must be the same for all packages.

If your app has more than one dependency, the Package/Dependencies elements must be the same in each package.

For more info, see Building the app package manually.

The declared capabilities are not the same in all packages. All packages must declare the same capabilities.

The Package/Capabilities element must be the same in all main packages.

For more info, see Building the app package manually.

The declared device interfaces are not the same for all packages. All packages must declare the same device interfaces.

For more info, see Building the app package manually.

Your app can declare dependencies only on versions of Windows component libraries that are available from the Windows Store. Check your app’s dependencies and make sure that the MinVersion of each is less than or equal to a version that is available from the Windows Store.

For more info, see Building the app package manually.

This is a Windows component library package, which can’t be uploaded.

The Package/Properties/Framework element must be False or undefined.

For more info, see Building the app package manually.

A package supports a language that the Windows Store doesn’t support. A package can declare only languages that the Windows Store supports.

For more info about the languages that the Windows Store supports, see Choosing your languages.

All packages for this app must use the package identity name: [developer namespace]

The Name attribute of the Package/Identity element in the app manifest must match the app’s package identity name assigned by the Windows Store.

For more info, see Building the app package manually.

The Publisher attribute of the Identity element in the app manifest doesn’t match your publisher ID, which is: [developer publisher string]

The Publisher attribute of the Package/Identity element in the app manifest must match your Publisher ID in the Windows Store.

For more info, see Building the app package manually.

Packages must use SHA2-256 as the hash algorithm

For more info, see Package format requirements.

A package is not named correctly. All packages must have the same app name.

For more info, see Building the app package manually.

The PublisherDisplayName element in the app manifest doesn’t match your publisher display name.

For more info, see Building the app package manually.

The package defines a ResourceID, which isn’t allowed.

For more info, see Building the app package manually.

The supported languages are not the same for all packages. All packages must support the same languages.

For more info, see Building the app package manually and Choosing your languages.

The package declares more apps than the Windows Store allows.

For more info, see Building the app package manually.

The following display name does not match any of your reserved names: [displayName]

The Package/Properties/DisplayName element must contain a value that matches a name you reserved for this app.

For more info, see Building the app package manually and Naming your app.

 

Hope this helps…

Categories: English Tags: ,