Most Popular Posts

Sep 28, 2011

SQL# - First Draft

I recently drafted a specification of a new database language - SQL# (pronounced "es-kju-el sharp"). It is available on http://sqlsharp.zlatko.michailov.org where I plan to publish future updates as well as samples and tools.

As far as the name is concerned - I really like it despite of the problems the # sign creates for file names and URLs. This name doesn't seem to be used yet - neither Google nor Bing find any literal matches. So until someone claims ownership of the name, SQL# it is.

Where did this come from? The programmability of Transact-SQL has been a pin in my eye for more than 10 years. My previous creature, Z-SQL, was a modest attempt to make T-SQL look and feel more like PL/SQL, but at the end of the day it was still SQL. I've grown to realize that the SQL legacy, in whatever flavor it comes, is what repells application developers. Even I started catching myself staring at seemingly valid SQL code that SQL Server was rejecting. When I realized I was writing in C# inside SQL Server Management Studio, I decided to take a more radical approach - to replace all the awkward SQL constructs with something that comes naturally - C#.

Of course, there are constructs like the data manipulation statements, SELECT/INSERT/UPDATE/DELETE, that only exist in SQL and cannot be replaced. We'll have to live with those for now, but for a large set of commonly used constructs like object definitions, variable declarations, loops, cursor traversals, etc. there is no reason why we should continue suffering. On top of this I add one of my favorite C/C++ features that is unfortunately missing in C# - preprocessor directives. While I only provision a limited preprocessor functionality, I believe I have captured the key use cases.

The most common question people have asked me is: Why SQL# when there is already LINQ? LINQ and SQL target two completely different classes of applications. I don't want to spark yet another discussion on which one is better. I would only say one doesn't exclude the other - LINQ did not (and will not) obsolete SQL especially in these times when the volumes of data organizations deal with grow faster than ever. Just like SQL made its way up to C# in the form of LINQ, I push C# down to SQL. I hope to find a similar reception from the SQL developer community.

What are the next steps? At this point I am seeking feedback on the overall usefulness of SQL# as well as on individual features - either proposed or missing. I am in no rush to start implementing any tooling that translates SQL# to Transact-SQL at least not until I am confident I've captured the right feature set. Even then, I will be looking for volunteers to write a compiler, a language service, and other tools. My goal is to continue driving the specification forward and to create an ecosystem of tool vendors.

So, if you are a SQL developer and you are interested in shifting your development experience in this direction, please read the spec and log your feedback here. It will be greatly appreciated.

Feb 13, 2011

Free Chess Clock 0.2

I found and fixed some awkward behavior in Chess Clock 0.1.

Symptom

It is possible to accidentally reset the clock. In fact, it was too easy to do that - by hitting Enter instead of right Shift while the focus was still on the Reset button.

Solution

Do not reset the clock if a game is in progress. In order to reset the clock once a game has started, the page has to be reloaded. As a side effect, the clock could be paused (while the alert is being displayed.)

Availability

  1. A new standalone version is available for download.
  2. The online page has also been updated.

Enjoy!

Feb 8, 2011

Free Chess Clock 0.1

If you have shopped around for chess clocks, you may have noticed those things are not cheap - starting from $30 and going up to $150. This inspired me to write a simple program that acts as a chess clock.

Software Chess Clock

My objective was to make the program available on as many platforms as possible - PC, tablet, phone, etc. - running various operating systems. I chose to implement it as a single, static, HTML page with JavaScript. As long as you have a web browser with JavaScript enabled, you can enjoy my free software chess clock. And yes, it is completely free (within the limits of the BSD license).

How to Use It

Enter the names of the players as well as the number of minutes per player. Click the Start/Reset button. The clock will start ticking the first time you press the Shift key on your keyboard.

For best experience, launch the page under Internet Explorer since that is the only browser out of the ones I tested with that distinguishes between the left Shift key and the right Shift key. When the page is launched under any other web browser, pressing either Shift key switches the side.

Where to Find It

  1. Since this is a standalone HTML page, you can download it once and then use it locally from your computer/device.
  2. Alternatively, you can browse it directly from my website.

Enjoy my free chess clock, and enjoy playing chess!

Feb 3, 2011

US Patent No. 7,818,311

This idea came to me while I was writing the original version of my popular eSqlBlast tool. (Special thanks to my buddy Jarek Kowalski for maintaining it after I left the Entity Framework team.) I needed to parse batches of Entity SQL statements and I didn’t want to spend too much time on that. I figured regular expressions would suffice, but I needed a gigantic regex that I couldn’t write correctly. So I came up with this simple preprocessor that can build gigantic regexes out of many simple ones.

The full details are publically available at the US Patent and Trade Office web site.

Jan 21, 2011

How to Make Your Linux Desktop Look Better than a Mac - Update

My post on How to Make Your Linux Desktop Look Better than a Mac has been maintaining the highest hit count on my blog ever since I published it. So I feel obliged to keep the information up-to-date.
I've updated my Linux distribution to openSUSE 11.3 - the latest openSUSE distribution as of today (I see openSUSE 11.4 is coming soon.) As I did that, I noticed a breaking change to the procedure I outlined in my original post. Fortunately, there is a workaround, and I dare say things are getting better. 

Breaking Change

The most significant change between openSUSE 11.0 and openSUSE 11.3 with regard to the desktop view is that Emerald is no longer distributed. That is the component that renders the window decorations, the Mac-like decorations in particular. The discontinuation of Emerald leaves a ton of themes out there useless, but I don't really miss it. There used to be bugs that I no longer see. For instance, my task bar would disappear, or my windows would leave decorations. So, move on.

Workaround

Step 1 of the original procedure remains virtually unchanged - install Compiz, enable desktop effects, make Compiz your window manager. The only caveat in this step is that there are now three competing tools for configuring desktop effects. I stick with the CompizConfig Settings Manager and try not use the other two.

Step 2 changes since it was relying on Emerald, but not too much. Where you were setting Emerald to be your window decorator in CompizConfig Settings Manager's Window Decoration plug-in, now you have to set 'kde4-window-decorator --replace' as shown below:
CCSM_WindowDecoration
 
Now you have to enable a decoration engine supported by KDE4. Open your Configure Desktop tool and enable the Aurorae Theme Decoration Engine as shown below:
AuroraeDecorationThemeEngine
 
Now you can click on the Get New Themes... button and install the window decoration theme of your choice. The number of the Aurorae themes is a tiny fraction of the number of Emerald themes, but I was able to find two Mac-like themes. I use Auromac. I like it even better than the Emerald theme I was using previously.

Finally

Remember to log out and log back in in order for the GUI components to load properly.
Enjoy your desktop view!

Jan 6, 2011

Integrals Tutorial

I hadn’t seen an integral for nearly 20 years until last week when my niece called for help. Here I am posting my solutions to the problems she sent me. The integrals seem quite typical. That’s why I hope these solutions show the methodology to solve such integrals. I kept the transitions very simple, so although the  explanations (wherever I’ve added any) are in Bulgarian, you can still figure out what I’ve had in mind.

Problems

Integrals-01Integrals-02

Solutions

zlatko0101zlatko0102zlatko0103zlatko0104zlatko0105zlatko0106zlatko0107zlatko0108

Dec 7, 2010

Free Google Apps Mail Notifier (version 0.1)

If you have a Google Apps mail account, you may need a desktop tool that periodically checks your mailbox and notifies you when there are new messages. Keeping a browser window open at all times and manually refreshing it is really annoying.

Google has a such a tool, Gmail Notifier, but unfortunately it only works for regular Gmail accounts (@gmail.com) and not for Google Apps accounts (@yourdomain.com). Search engines find several independent implementations of such tools, but I have two main problems with all the tools I have seen:

  • None of those tools is free. (I don’t pay for the mail service itself. It’s ridiculous to have to pay for the notifications.)
  • None of those tools has its source code available, i.e. I cannot be sure what the tool does with my credentials

Therefore, I decided to write a Google Apps mail notification tool that is free of any charge and that is distributed as source code, so you can see what it does before you start using it. Feel free to adjust the source code (within the limits of the BSD license) to suit your needs better. Here is how to build the tool:

  1. Make sure you have .NET 4 installed.
  2. Download the source file. Review the code to make sure it doesn’t do something you don’t like.
  3. The tool needs two icon (.ico) files – your_alarm_icon.ico and your_quiet_icon.ico. The former icon is shown when you have unread messages and the latter one is shown when there are no unread messages. You have to provide these two files yourself. That is not as scary as it sounds – just search your system drive for ‘.ico’ and you’ll find plenty. Copy the two you like best and name them as required above. You will be able to replace them later if you want to without having to recompile the .exe, because they are loaded dynamically. Note: These two .ico files must reside in the same folder with the .exe. 
  4. To compile the source code, run the following command in a plain cmd window from the same directory where you saved the source file. (The entire command and arguments must be on one line):

%windir%\microsoft.net\framework\v4.0.30319\csc /t:winexe /o
/r:mscorlib.dll /r:System.dll /r:System.Drawing.dll /r:System.Windows.Forms.dll /r:System.Xml.dll 
FreeGoogleAppsMailNotifier-0.1.cs

Now you may run FreeGoogleAppsMailNotifier-0.1.exe. If you decide to copy it somewhere, remember either to copy the two .ico files along with it or to supply alternative ones.

Since this is the very first version of the tool, it is possible that there are some bugs. If you find one, please report it here as a comment. Thanks.