Most Popular Posts

Jan 14, 2014

OneSql Client – World’s First SQL Server Provider for Windows Store Apps

If you work on a SQL Server client apps, you may have noticed that it’s not possible to connect directly to SQL Server from a Windows Store app. Instead, you have to develop a web service, you have to deploy it somewhere in the cloud, you (or your customers) have to pay for running it, and lastly, you have to support it. And all that is because there is no SQL Server provider for Windows Store apps.
Today, I am excited to announce OneSql Client – world’s first SQL Server provider for Windows Store apps!
Overview
OneSql Client is a Windows Runtime component that can be used from any Windows Store app regardless of its language. I wrote a demo app in JavaScript to prove that concept (see link below.)
OneSql Client is freely available as a NuGet package at http://www.nuget.org/packages/OneSql.Client/ or in a raw form from its home location http://onesql.michailov.org/.
Please be advised that this is an early alpha release and it may not behave correctly in many cases. At this point, it is only intended for experimental and learning purposes.
OneSql Client implements the [MS-TDS] protocol from scratch. Well, it doesn’t implement the whole protocol yet. The purpose of this alpha release is to prioritize the remaining work.
API
OneSql exposes API from two namespaces:
  • OneSql.Client.Sql – this namespace contains the actual SQL Server provider, SqlClient, that is ready for consumption by apps. It returns rows as JSON arrays.
  • OneSql.Client.Tds – this namespace contains low-level primitives that could be used to implement your own provider. However, if you need a feature that SqlClient doesn’t offer, I strongly recommend that you first request that feature from SqlClient before trying to implement your own provider.
Limitations
  • Supports SQL Server 2012 or higher. It might be possible to work against SQL Server 2008 and 2008 R2, but that hasn’t been tested.
  • Doesn’t support the following data types:
    • image, text, ntext – these types have been superseded by varbinary(max), varchar(max), and nvarchar(max) respectively.
    • decimal/numeric – these types are too big for JavaScript.
    • UDT – I don’t think there is a base support for these in Windows Runtime.
    • sql_variant – I’ve never needed this type. Hopefully not too many people will be crying for it.
    The above types can still be used in the storage schema or in server-side code. They just can’t be retrieved directly. You’ll have to CONVERT/CAST the respective column to a supported type.
  • Only SQL batches are supported, i.e. parameterized queries are not yet supported. They are on the plan, just not yet.
Getting Started
Download and open the SampleWindowsStoreApp project. Play with it. You’ll most certainly find bugs. Please describe your repro clearly, zip any prerequisite SQL and send it to zlatko+onesql@michailov.org.
You may also see how connections are established, how rows are being fetched, and how to move to the next result set. The documentation is very Spartan at the moment. It is on my plan to provide samples.
Known Issues
Errors encountered by OneSql get lost somewhere among the awaits and the JavaScript promises. I know it is annoying. I’m working on that too.
Support
The best place to get the latest news, updates, and references to resources is https://twitter.com/@OneSql
Articles will continue being published at http://zlatko.michailov.org/.
New releases and other executable artifacts will be published at https://onesql.michailov.org/.
For everything else, send me an email at zlatko+onesql@michailov.org.

Aug 23, 2013

Systems of Linear Equations

Systems of Linear Equations is an app that teaches kids how to solve systems of linear equations that also generates practice problems. The app comes in two editions – Free and Standard.

Features

Free Edition
  • Unlimited number of problems with 2 and 3 unknowns.
  • Answers.
  • A description of the Gaussian Elimination method.
  • Free of charge.
Standard Edition
  • Unlimited number of problems with 2, 3, 4, and 5 unknowns.
  • Answers.
  • Complete solutions.
  • A description of the Gaussian Elimination method.
  • Costs $2.49.

Screenshots

Standard_1_Navigation
Standard_2_Problem
Standard_3_Answer
Standard_4_Solution
All_Method

How to Obtain

The app is available for Windows 8 and Windows RT from the Windows App Store. It is in the Education category.
(Tip: To search the Windows App Store, launch the Store app, then sweep the screen from the right and tap on the Search icon.)
The Free edition is available worldwide while the Standard edition is only available in the United States.

Support

Go to http://zlatko.michailov.org?Label=Equations.
If you don’t find the answer you are looking for, post your question under an appropriate article.

Oct 20, 2012

Heroes, Time Bombs, and Refactoring

When an organization embarks on the development of a new software product, it has two questions to answer:

  1. What base technologies should the new product use/depend on?
  2. How the new product will grow over time?

The first question is religious which makes it easy to answer – an organization is either a “Microsoft shop”, or an “OpenSource shop”, or “Some-other-religion shop”. Within that shop, developers may have to choose between managed or native in case that is not part of the religion, and that’s it for question #1.

Question #2 is a business question. In all fairness managers and architects typically spend the necessary time and effort to come up with a solid vision for future growth. Only after upper management is satisfied with that vision, will it let development commence.

So far so good – that is the correct process. Um, there must be a caveat, right? Right. The caveat is that the base technologies the organization has religiously chosen also have similar growth plans. That means there is a chance that a base technology may offer the same functionality as this product. That chance is low by default, but it can jump significantly if developers try to be...smart. This is religion, remember? Religion demands faith, not smartness. Every platform’s goal is to make common use cases simple. As long as application developers stick to such simple patterns, their product will leverage the platform’s enhancements. However, often times the platform is lacking certain features, and developers plug those wholes rather than wait for the platform to improve.

A very typical example of such a fix is implementing a data cache to save hard disk hits, or network roundtrips. While such a fix works perfectly short term, it is a time bomb in the long run, because performance is a fundamental problem, and sooner or later the platform will address it. Furthermore different technologies develop at different paces. For instance, 10-15 years ago the main problems were slow network communications and slow disk access. So it was tempting to bake a data cache right into the frontend box. Today, however, the main problem is to scale out the frontends in order to serve the necessary number of hits, which further trails the requirement of driving the cost of those frontends low. Now a data cache on each frontend box would consume unnecessary memory as well as CPU cycles for cache entry lookups while a single dedicated cache box per rack or per farm would be cheaper and more effective .

That is how a big win can expire over time. It becomes cancer – it is an extra code that has both a development/maintenance cost as well as production cost. And it can only get worse, because it falls into an area where the platform is obviously making improvements.

The only treatment I can think of is to surgically remove the tumorous code, i.e. to refactor. Unfortunately, refactoring has been over-promoted by the Agile community to the point where saying the R-word in front of management is politically incorrect which makes the disease really difficult to cure once it has developed.

That leads to the question: Is this disease preventable? Theoretically speaking – yes. Since time bombs are explicitly checked in by developers, if developers don’t do it, there won’t be a problem, right? Well, that’s easier said than done. Whenever a performance benchmark misses its target, a hero will jump in to fix it, for which he/she will be properly rewarded. What makes such a time bomb difficult to remove is that one it has been proclaimed successful, no one will be willing to admit that its value has expired (sometimes even too quickly.) In general, we don’t understand that success in the software industry is something very temporary.

There is a way, however, to be a hero now and to remain a hero even when a heroic fix turns bad. What’s even better is that you can be a hero (twice!) without infecting your product. When you do your original heroic fix, start with asking yourself: Is this part of my product’s value, or am I compensating for a platform’s deficiency? If you end up on the latter part, then code it in a way that makes it easily removable – avoid introducing public API at any cost; make the source file easily removable from the build; don’t let other code take dependencies on your fix that you haven’t envisioned; and most importantly - encode a switch that bypasses the new functionality.

If you stop here, there will still be a problem when your fix becomes obsolete, but then you’ll be able to either flip the switch or remove the whole thing. Either way you’ll be a hero for a second time on the same problem!

If you further make that switch a configuration setting so that flipping it doesn’t require a product change, a problem with your heroic fix may never occur. The only down side is you’ll miss being a hero for a second time on the same problem.

In conclusion, I continue to promote “timeless” development among developers as well as necessary refactoring among management. Hopefully this article has made my points clear.

Feb 3, 2012

Free Chess Clock 0.4

This update introduces support for extra time per move – typically 5 seconds for recording the opponent’s move.

DOWNLOAD the new version, and run it locally for best experience. Alternatively, you may use it online.

Jan 17, 2012

Interview about TPL Dataflow

When Jonathan Allen of InfoQ contacted me for an e-interview about TPL Dataflow, I immediately searched InfoQ to see what content it had about TPL and TPL Dataflow. Not only did I find content, but I found an article Jonathan had written about my Guide to Implementing Custom TPL Dataflow Blocks.

So I did the THE INTERVIEW. Hopefully you find my insights on TPL Dataflow useful.

Dec 30, 2011

About Me @ Microsoft (part III)

At the beginning of this month, December 2011, I joined SharePoint and more specifically its Developer Platform team. Our charter is the third-party application model in SharePoint. This is a very interesting domain. I am trying to get up-to-speed as fast as possible.

I admit I was plain lucky to get this job. It happened after a series of accidents and involved several great managers to whom I am deeply indebted.

I am eager to start contributing to SharePoint as a modern web development platform.  I am also planning to engage with the SharePoint developer community. I am already getting some rough ideas. Hopefully they will start taking shape soon [and I will not be embarrassed to  share them].

Dec 18, 2011

Free Chess Clock 0.3

This update adds mouse support to my HTML-based Free Chess Clock to make it suitable for keyboard-less devices like phones and tablets.

You can try the new version online, but you’ll have a better experience if you DOWNLOAD the HTML page and run it locally.