• Home
  • About
  • Resume

Visual Basic FTW!

By , 01/23/2012 3:56 PM

I knew modern VB was a powerful language, but had no idea it could do this:

Create GUI to track IP in real-time email… what would they think of next?

@@ROWCOUNT is affected by IF statement

By , 01/19/2012 3:03 PM

Let’s say you’re writing T-SQL code and need to make sure that your query returns one and only row. If no records returned – an error message needs to be shown. If more than one record is returned – another error message needs to be show. The code goes something like this:

-- ... query runs here and returns row

IF @@ROWCOUNT = 0 RAISERROR('No records found', 18, 1)
ELSE IF @@ROWCOUNT > 0 RAISERROR('More than one record found', 18, 1)

-- ... continue when exactly one row is returned

Now if your query returns 3 records you’d expect it to trip the second IF statement and raise error with correct message. Unfortunately this doesn’t happen. The reason being – the first IF statement resets @@ROWCOUNT to 0. So, to avoid this we need to preserve the @@ROWCOUNT value in a local variable:

DECLARE @iRowCount int

-- ... query runs here and returns row

SET @iRowCount = @@ROWCOUNT

IF @iRowCount = 0 RAISERROR('No records found', 18, 1)
ELSE IF @iRowCount > 0 RAISERROR('More than one record found', 18, 1)

-- ... continue when exactly one row is returned

This way count of rows returned by the query is saved and is not affected by any following statements.

UltraWebGrid TopItemSpacing=”Auto”: Solution for FireFox

By , 01/12/2012 4:46 PM

If you’re still using classic Infragistics Controls and want to make them work in modern browsers, sometimes a little additional work is required. Hopefully this little trick will save you some time.

UltraWebGrid has a neat property TopItemSpacing, when set to Auto it automatically spreads top level menu items across the menu control, giving them nice spacing in between. Unfortunately this property seems to work in Internet Explorer only, in Firefox (and Chrome and etc.) it is ignored, rendering menu in Compact mode giving top level items crowded “too-close-for-comfort” look.

The solution is to take spacing in our own hands. Set TopItemSpacing to Compact and instead add right padding to TopLevelParentItemStyle and TopLevelLeafItemStyle elements of the menu. For example (from the markup point of view):

<TopLevelLeafItemStyle Cursor="Hand" Height="18px" BorderWidth="1px" Font-Size="8pt">
   <Padding Right="6px" />
</TopLevelLeafItemStyle>

Actual pixel value of the padding is up to your particular scenario, but the final result is top level menu items will be nicely spaced both in IE and in Firefox.

ICS: Android 4 on Kindle Fire

By , 01/11/2012 9:34 PM

Ice Cream Sandwitch on Kindle Fire

Another day, another experiment on my new favorite toy business instrument – Kindle Fire. Today I went ahead and installed latest (as of this date) incarnation of Android OS – version 4 aka Ice Cream Sandwich (ICS). Again, like in case with CyanogenMod 7 (which is essentially Android 2.3.7) installation is extremally easy thanks to TWRP recovery. Just download Kindle Zone ICS ROM put it on your Fire, reboot into TWRP recovery, *backup your existing rom* and flash the ICS.

It boots nicely and looks pretty good. Connects to WiFi with Internet and LAN access (ES File Explorer comes preinstalled and accessed SMB shares on my home network with no problems).

Being a very early version it has it share of problems. Video doesn’t work correctly (MP4 files for example play in fast-forward mode, YouTube can’t connect). Sounds work sporadically and overall moving around the interface has a jerky feeling. But it looks like a very good start and I am looking forward to a more stable release. Meanwhile I am back to CM7


UPDATE 02/18/2012. Now this is what the doctor ordered. The new update from the same XDA forum thread as above breathed new life into my Kindle. Basically, everything works. And it looks awesome! Here is direct link to the ROM. So now this is my OS of choice for my Fire. Did I mention it’s Cyanogen Mod 9? Did I also mention that there’s Google Chrome now available on Android Marked for Ice Cream Sandwich?

Ice Cream Sandwich on Kindle Fire

How to add threshold line to MSChart in ASP.NET

By , 01/10/2012 3:35 PM

Often, when drawing a chart, there’s a need to show a threshold – basically a line that indicates whether your values are going above or below it. Take for example this ColumnChart:

Chart Without Threshold

Let’s say we need to show a threshold for the value of 7. Here’s how. Continue reading 'How to add threshold line to MSChart in ASP.NET'»

WebDataGrid: Prevent scrolling on row selection

By , 01/09/2012 3:39 PM

If you working with Infragistics Aikido controls and your WebDataGrid or WHDG is too long – a common approach to make content scrollable is to place grid control inside of a DIV with fixed dimensions and overflow set to auto:

WHDG scrollable inside of parent DIV

It works fine, but there’s one drawback: if you scroll your grid horizontally and then select a row – grid’s scroll position snaps back to the leftmost position. Infragistics says that it’s a browser bug and we need to talk to browser vendor about it. Wanting to solve the problem in this century I looked for alternatives and this is what I found. Continue reading 'WebDataGrid: Prevent scrolling on row selection'»

CyanogenMod on Kindle Fire

By , 01/06/2012 9:51 PM

CyanogenMod on Kindle Fire Lately I’ve been posting a lot about Kindle Fire and no wonder – I love this tablet and tweaking with it.

Today I went to tweaking extreme – installed a custom ROM, namely CyanogenMod. CyanogenMod is famous for being a better replacement ROM for a wide multitude of Android devices from Droid phones to Nook tablets. And finally it made its way to Kindle Fire. Installing it turned out to be surprisingly easy – first, using Kindle Fire Utility root your Fire and install TWRP Recovery – very useful instrument not only for installing new ROMs but also for backing up and restoring your existing one in case something goes wrong. Second, download latest CyanogenMod in form of “update.zip” and place into temp/download folder of your Fire. And lastly reboot into TWRP recovery, browse for the ZIP and install it.

CyanogenMod didn’t let down, it was perfect as usual – fast, highly customizable, this one specifically build for Fire with its lack of hardware buttons. It has many wonderful features (for example picture in this post is, unlike previous posts, is a direct screenshot from my Fire, “take a screenshot” is one of the options appearing in menu when you press and hold power button).

It has everything. The only drawback for me is, for the love of it, I couldn’t make Amazon Instant Video app work in this mod. The issue is widely discussed on the Interwebs, multiple possible solutions are offered, but none worked for me. And since Prime Instant Videos is the only original Fire feature that I use – I had to return back to rooted stock Amazon ROM with ADW launcher (thanks TWRP for making ROM backup and recovery a very simple experience). Until working version of Amazon Instant Video is bundled with Cyanogen – I am keeping the stock.
Continue reading 'CyanogenMod on Kindle Fire'»

Russian Keyboard on Kindle Fire

By , 01/05/2012 10:54 PM

Russian Keyboard on Kindle Fire

It used to be a bit of a pain to install a 3rd party keyboard on Kindle Fire – you had to work with SQL Lite and ADB Shell and there were a few other requirements. But thanks to Tivan from samsung-tablets.com it’s down to 3 easy steps (one requirement remains: Your Kindle Fire has to be rooted with Android Market app installed). Continue reading 'Russian Keyboard on Kindle Fire'»

Panorama Theme by Themocracy