Posts

Showing posts with the label samples

How to convert SVG data to a Png Image file Using InkScape

Image
Introduction The project required the need to put the visual pie chart on a web page on the client and in a Pdf file created on the server. I eventually choose to use a Telerik Kendo DataViz Chart control on the client, and use a PNG file on the server for the Pdf file. This blog post will explain the process and code to convert the client-side pie chart Svg data to a Png file, and provide a download to the working code. Prerequisites You need to have a trial version of the Telerik Kendo library installed in order to make the sample code work. You also need InkScape installed. InkScape is the application that does the actual conversion. You will need to change the Web.config appSetting of “ExeDirectoryForInkscape” to represent your own installation location. Any SVG Data Will Work The pie chart was created using the Telerik Kendo DataViz chart control. While I name a specific control, as long as you have access to the SVG data, the same conversion process on the server will...

Restyling an Html <SELECT> Element from a Telerik Kendo Panel Bar

Image
Introduction Recently, I needed to restyle an HTML <SELECT> box so that the selected element had a different background color. In all other ways, the element could be exactly like an HTML <SELECT>. Below are both the original element, and the restyled element.     This type of style change allows the novice user to immediately identify the control’s implied usage while allowing for some coordination with the site and page’s overall style.   Technology Platform The project is an Asp.net MVC site with jQuery, and Knockout.js on the front-end requesting json content on the backend. For the purposes of this blog post, I’ve stripped down the functionality so that just the required elements are visible. The project was already using Telerik Kendo controls so morphing the Kendo Panel Bar into a <SELECT> element was suggested. The main work is in the css file but the entire working sample project is available for download.   Telerik ...

Steps for Consuming XML data in .Net

Image
Introduction While consuming third-party RSS feeds, I found I had to relearn how to deal with XML data. This post is meant to prepare any developer who needs to consume XML which they do not control. While I used RSS feeds, any XML will apply. I wanted to change the meta data and data of the XML file into a model of data that I could control with .Net classes and conventional data storage.   This post is organized to take you from an xml file to .Net classes able to consume, serialize, and test the xml. Generating an XSD file from an XML file using Xsd.exe The first step is to make sure you have the XML Schema Definition tool, xsd.exe , installed. It is part of the .Net Framework tools . Make sure the executable location is part of the system path , user path, or command prompt path. On my computer the path is “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin” and I added it to the system path so it is available at any command prompt, regardless of the user.   Se...

Post-Ruby High with BDD in .Net

I mentioned in my last post how much I enjoyed Ruby and wanted to continue to use it in my project. That is easier said than done.   In order to leverage all the great Ruby ( RoR ) tools and methodologies I learned, I’m attempting to find .Net equivalents. This started with finding a Behavior Driven Development ( BDD ) tool. There are several that come up but they are a hybrid to a BDD (I picked SpecFlow ) tool siting on top of a TDD tool ( NUnit or MSTest).  I also needed a web driver to make calls to a browser and verify results. I looked at WatiN but went with Selenium .   The next two tools I need to add are a mocking tool ( Moq ) and an injection tool (probably NInject ).   Since the class used GitHub and Heroku , I’ll also stick with that. My GitHub account is DFBerry .  All my example code is posted up their in public repositories.

Combining Multiple Azure Worker Roles into an Azure Web Role

Image
Introduction While working on apps.berryintl.com ’s web service, it appeared from the Windows Azure project templates that I might need several worker roles because they cycle at different times. One worker needed to cycle every day. The other needed to cycle every five minutes. Since the work and the cycle rate were very different, it felt “right” to isolate each role. In this post, I’ll show you how I combined multiple worker roles into a single, underutilized Azure web role thereby keeping the concept and design of worker roles while not having to pay extra for them. In order to verify the solution, the project uses Azure Diagnostics Trace statements. The solution file is available for download . Combining Multiple Azure Worker Roles into an Azure Web Role Currently, I use a small Azure instance and there isn’t enough traffic to justify a separate worker role. I implemented Wayne ’s process for combining one worker role with a web role a while back. Now I needed to add anot...

Simple Azure Web and Worker Roles–Running the code

Image
This is a continuation of the simple series. Links for other posts in the series are at the bottom of this post. Download Visual Studio Solution here .   This series explains the Windows Phone 7 requesting data from a Windows Azure web service. The phone tile and toast are supported by a background agent on the phone while the web service is supported by a continuous worker role on Windows Azure. The phone calls the WebRole REST API from both the phone app and the phone app’s background agent. Each request is different though. The App’s request is fetching a list of items to show in the app while the background agent is fetching the count of items since the last fetch and the very last item. This information will be displayed in the popup toast and the app’s start screen pinned tile.   Azure Only This post will cover the Azure web  and worker roles only. The Windows Phone 7 app-to-Azure communication will be covered in a separate post. Grab the Visual Studi...

Simple WP7 Mango App for Background Tasks, Toast, and Tiles: Code Explanation

Image
This is a continuation of this post , explaining how the sample app works. Caution : This sample isn’t meant as an example of best patterns and practices. If you see something in the code you would never do, then don’t. Solution File Organization The app has three Visual Studio Projects: the app, the agent, and the shared code library between them. One of the great things about Mango is that now the built-in Visual Studio Unit test functionality is available. By separating out the meat of the work into the SampleShared project, I can also focus my unit testing there. SampleApp1 The app has a MainPage, a ViewModel, and the WMAppManifest.xml file modified to note my ExtendedTask of BackgroundServiceAgent. The Agent is extremely simple with a call to the shared library, an update to the Tile, and a call to pop up Toast. The meat of the work is in the SampleShared library. The AgentMgr manages the background agent : add, remove, find, run now. It is only called f...