• Home
  • About
  • Resume

Posts tagged: solution

SSRS and HTML rendering of ordered list

By , 11/14/2016 2:02 PM

Microsoft’s SQL Server Reporting Services supports rendering of HTML tags, but for some reason that support stuck in 1990s – only very limited set is supported. And even using that set is problematic.

Case in point – ordered list. While officially supported – the way it is rendered is the stuff nightmares are made off. Jumble of original tags generously intermixed with DIVs and SPANs – it’s a wonder it renders at all.

And sometimes it doesn’t. If you try to view a report in Internet Explorer (especially from older, but still actively used versions of SSRS like 2008) numbering get screwed.
Continue reading 'SSRS and HTML rendering of ordered list'»

Full control of your Limitless LED/Milight bulbs from Amazon Echo

By , 05/12/2016 11:34 AM

Limitless LED Limitless LED offers full color RGBW light bulbs that you can control over Wi-Fi/4G from your computer, phone or smartwatch. They’re an inexpensive alternative to Philips Hue and they look really cool.
But I, being lazy ass that I am, was wondering if you can control the lights from Amazon Echo by voice commands alone. Out of the box Echo and Limitless LED don’t recognize each other. Amazon can see and control Hue, but not Limitless LED. Fortunately geniuses of BWS Systems came up with a really cool piece of software – home automation bridge “HA-Bridge”. It’s free and written in Java so it can run pretty much in any environment under any OS. What it does – it emulates Philips Hue API so other devices on your network – like Echo – can see and interact with it. Continue reading 'Full control of your Limitless LED/Milight bulbs from Amazon Echo'»

Flicker-Free IFRAME refresh

By , 05/05/2016 3:05 PM

One of our projects consists of single parent page and “widgets” that display secondary (classic ASPX webform) pages. A recent feature request was to auto-refresh widget information at given intervals. On the surface it was pretty straghtforward:

<iframe id="xIfrWidget0"></iframe>
var ifr = document.getElementById('xIfrWidget');

setInterval(function () {
   ifr.src = 'widget.aspx';
}, 2000)

The problem with this approach – there’s an ugly flicker of white between page refresh and the goal was to keep displaying current IFRAME content up until refreshed content is ready. Yes, there’re various AJAX-ified methods (including ASP.NET UpdatePanel) – but they add unnecessary overhead and may cause other issues.

The solution was suggested by this Stack Overflow post. The idea is to have secondary, hidden IFRAME into which perform actual load. Once load complete – switch IFRAMES – currently visible with old content becomes hidden, and hidden one with new content becomes visible. It goes something like this: Continue reading 'Flicker-Free IFRAME refresh'»

Pebbles, rectangles and stack overflow

By , 04/20/2016 2:17 PM

UntitledWhile working on my Pebble watchface “Future Time” I have encountered persistent annoying problem – watchface would run for a while and then crash – and not only crash, but actually restart the watch. What made this even more frustrating – after 3 restarts in a row Pebble would revert to recovery mode and complete firmware reinstall was required (did I accidentally write a Pebble virus?).
When I dug into device logs I found out that every restart was given reason: “Dangerous Stack Overflow”. Which is kinda strange – I don’t have any recursions nor deeply nested function calls nor large local variables. I tried lots of things – including extreme ones like declaring all local function variables as global or static – nothing helped.
Finally Christian form Pebble developers forum shed a light. He pointed out that I use a lot of GRect constructs which is basic rectangle building block for pretty much anything from defining layers to graphics functions. I used GRect inline directly inside function calls, which I thought wasn’t a big deal, after all “everybody does that” – including Pebble in its examples. Well, as Christian pointed out those GRects are kind of local variables, and either memory is not reclaimed fast enough when they go out of scope or they spring memory leak.
Keeping this in mind I created a global GRect variable and when needed to use a GRect in local function, first I’d assign it’s value to the variable and then use variable in the function.
So something like this:

static void layer_update(Layer *layer, GContext *ctx) {
   graphics_draw_rect(ctx, GRect(10, 10, 30, 30));
   graphics_draw_bitmap_in_rect(ctx, bitmap, GRect(20, 20, 40, 40));

Becomes thus:

GRect temp_rect;

static void layer_update(Layer *layer, GContext *ctx) {
   temp_rect = GRect(10, 10, 30, 30);
   graphics_draw_rect(ctx, temp_rect);
   temp_rect = GRect(20, 20, 40, 40);
   graphics_draw_bitmap_in_rect(ctx, bitmap, temp_rect);

That’s it. This simple change cured the plague, no more crashes, restarts or recovery – just smooth sailing.

TSQL ISNUMERIC and “String or binary data would be truncated” error

By , 02/17/2016 12:34 PM

If you’re using TSQL ISNUMERIC function in a query, e.g.


You may receive unexpected error:

String or binary data would be truncated.

ISNUMERIC must truncate string data, and if you experienced the above error, some of your data is over the limit. But you can augment the above query:


But cutting only 8000 chars you will avoid the error, and I seriously doubt you will have number over 8000 digits long so it’s a safe bet as well

Restore natural picture look on Samsung smart TV

By , 02/02/2016 10:04 PM

I really like my new smart TV from Samsung it has tons of bells and whistles. But one thing I noticed – no matter what I watch – series or movies, streaming or broadcast – picture has a “teleplay” feeling – like the action is happening on stage in the theater. If you recall what later Twilight Zone episodes look like you’d know what I am talking about. Maybe it’s supposed to look like this, but I like “film” feeling more. So I found a setting that restores natural picture look:

Go to your TV menu, then select Picture -> Picture Options -> Auto Motion Plus and turn it off.

Fixing problem with Yahoo geolocation service

By , 01/25/2016 5:04 PM

Recently two Pebble watchfaces I’ve developed based on Paul Joel designes: Clean&Smart and Cobblestyle began to experience weather update issues – as in “weather was not updated at all”. Looking into the issue I found a weird thing: If you set your location manually – weather worked. But automatic weather based on phone location did not.

The way automatic location works is pretty straighforward. First this function is called to determine location:

function getLocation() {
    {timeout: 15000, maximumAge: 60000}

It uses phone location services (GPS, if its available, otherwise network-based location). In case of success it calls locationSuccess function. And in my tests it always called it, so location was determined successfully. Continue reading 'Fixing problem with Yahoo geolocation service'»

Solved: Issue with Pebble framebuffer after notification is dismissed

By , 01/08/2016 1:15 PM

Effect Layer Issue I’ve encountered a weird issue while working with EffectLayer Library (a visual effect library for Pebble smartwatch). In this particular watchface called Clean & Smart I used “invert” effect which inverts colors of the watchface should the user choose that option in settings. It was working fine when option changed when watchface was loaded/unload and behaved weirdly only in one particular scenario: when you would receive a notification (email, text etc.) and then dismiss it. Upon coming back from notification to watchface invert effect would only partially cover the watchface (as seen on the screenshot).
I don’t know exactly what was happening, but had a theory. Continue reading 'Solved: Issue with Pebble framebuffer after notification is dismissed'»

Detect IFRAME click from parent page

By , 12/22/2015 3:04 PM

If you need to detect a click on a Web Page, that’s trivial: just catch Document or Body onclick event and any element on the page you click will bubble the event to your handler.

But if one of those elements is an IFRAME – that won’t work. IFRAMEs contain other pages and their events a contained within their content and don’t bubble up. Luckily there’s a way. Take a look this snippet of jQuery code:

$('IFRAME').on('load', function () {
   $(this).contents().on('click', function () {
      alert('Click Detected!');

It attaches handler to IFRAME’s content’s onclick event, but only after IFRAME has already been loaded. Place this code in parent page that contains IFRAMEs and it will work universally across all browsers to detect when IFRAME was clicked.

NOTE: As usual in these scenarios, this works only if parent page and children pages comply with Same Origin Policy.

Restore bricked HTC One M8

By , 10/27/2015 12:05 PM

Today my trusty HTC One M8 informed me that OTA (over the air) update of system software is available. Android security updates. Naturally I let the system download and install the update. Unfortunately after install phone refused to boot – it was getting stuck on HTC logo on white screen. Bummer.

Now I researched “stuck on logo” topic in depth and tried different methods to unstick it. No dice. Moreover, after chat with HTC Support and following their advice phone would simple go to blank screen. Double bummer. Continue reading 'Restore bricked HTC One M8'»

Panorama Theme by Themocracy