HFS – Send large file P2P

Hi folks

Sometimes I need to send a large file to someone. There are many services but all of them have some limitations such as file limit
Normally you just want to send your stuff to one person, so using any cloud-based services would be an unnecessary overkill.

So we are looking for a free P2P service supporting files of any size.

1. uTorrent Remote – FAIL!

In the past that was the easiest solution. Just drag&drop your file into uTorrent. It will create a private tracker and gives you an url you can share with your coworker and he downloads your stuff via torrents.

This stuff seems to be broken now. It keeps saying that your computer is turned off, which is not true.
The shared link leads you to https://remote.utorrent.com/send?… but most of the links on that page are broken. Magnet link is working but still the download is not starting.
I tried advanced settings such as bt.enable_tracker but it made no difference.

Result – FAIL!

2. JustBeamIt – FAIL!


This is the only free P2P service with unlimited file size support I could find. I used it in the past and it used to be very helpful.
But now I tried to send my 14Gb file and it broke two times.

Result – FAIL!


I installed the tool, showed which file I would like it to share for me.

Then I found an open port checking with http://www.canyouseeme.org/

Then I gave a direct link and my coworker could download my big file!

HFS supports download resumes in case of failures. So I think this approach is the way to go!

Result – SUCCESS!


Posted in Uncategorized | Leave a comment

My new favorite SQL toy – ApexSQL Refactor

Hi folks

A while ago I’ve had a blogpost about how I suffer working with unformatted SQLs.

Sometimes ago I found the tool the suits me the most – ApexSQL Refactor . It has a lot of settings, much more than all competitors I’ve tried before. I’ve managed to configure it to produce results that annoy me as little as possible. My settings can be downloaded and imported. It still has some shortcomings and hopefully they will add more features in future versions.

There are a few gotchas here though. On my current project I have to use SQL Server 2008 R2 and I kept installing this exactly version just to ensure we’re not using features from neweer versions. Actually we a lucky, as before we had to support SQL Server 2005 which had even more limitations.

But recently ApexSQL Refactor dropped support for the SQL Server Mangement Studio older than 2012, and I was not able to download the latest version that still supports SSMS 2008. I’ve written to the tech support team and they were kind enough to send me the link for the version that works with SSMS 2008

Recently I’ve scripted and reformatted every single object from the database. Then we discovered some strange behavior in the system we are working on. After some investigation I found that actually the formatter caused it! Reformatter broke the logic.

So the problem is the following

Let’s reformat the following script

If you do that you’ll see that

IF (@@ROWCOUNT = 0) -- Username not found

SELECT p.PageSettings FROM dbo.aspnet_PersonalizationPerUser p WHERE p.PathId = @PathId AND p.UserId = @UserId

is formatted as

IF (@@ROWCOUNT = 0) -- Username not found
    RETURN SELECT p.PageSettings FROM dbo.aspnet_PersonalizationPerUser p WHERE p.PathId = @PathId AND p.UserId = @UserId;

So SELECT moved from outside IF block inside it, which actually causes the problem.

But the code itself is very easy to fix, just move SELECTs out of IFs. It won’t break it again on the next reformatting because of the BEGIN/END blocks.

I’ve already written an email tech support team and they said they will reply to me shortly.

But even with this bug, I am in love with the tool!

Stay tuned!

Posted in Uncategorized | Leave a comment

Nightmare on Skype street, or Skype on old computer

Hi folks

We often install Skype on our relatives’ computers and educate them how to call us and respond to our calls.

One of my 80 years old relative had Skype configured and it suddenly stopped to work a while ago.

The PC is 15 years old and has Windows XP on it.

If only I had TeamViewer running there, I might look at the problem, but it is extremely difficult to explain someone 80 years old how to run TeamViewer by phone even if its shortcut is on the desktop already. I regret I didn’t configure unattended mode in TeamViewer before…

Once I get someone to run TeamViewer for me, I started working on that issue.

1. I installed latest version of Skype 7.22 but it fails on startup with Runtime error 216, which I could not fix.
2. Then I decided to install some older version and found Skype 6.11. Installed and ran successfully but could not login. After a while I found that Microsoft deprecated Skype versions below 6.14
3. Then I found another Skype version 6.21, and could login successfully. But I could not make video calls, Skype was saying that my CPU does not have SSE2 feature and they don’t support video calls on such CPUs anymore.
4. The same issue with Skype 6.14
5. I found some link http://www.skype.com/go/getskype-sse, where some special version for SSE CPUs used to live. But the installer seemed to be the same as on step 1
6. Then I gave up and decided to install something else. I tried Jitsi but it fails on run. ooVoo and VSee fails on installer run with Runtime error 005.

Here I stuck. I couldn’t find anything for a good Skype replacement. It appeared to be a pretty difficult task. A wasted a lot of time and didn’t make any progress. Such a shame!

7. Eventually I found a special hacked version of Skype 4.2 which works everywhere, http://rutracker.org/forum/viewtopic.php?t=4950556

This version worked including video calls!!! Hurrah!!

Finally! Microsoft, why did you do that to me?! Why are you dropping support for old versions?! Do you realize that many of us have old relatives that cannot just go and buy new computers whenever you decide to drop support for old computers? Why can’t you check the requirements during installation? Why can’t you keep some version which would work on old computers?

Jitsi, ooVoo, VSee guys, if you state that you support Windows XP, do you bother to ensure they really work?!


Stay tuned

Posted in Uncategorized | Tagged , | Leave a comment

JavaScript propertyChanging, propertyChanged, propertyGetting events

Hi folks

A while ago I described how to debug native DOM element changes.

I needed to use it more often and that became too annoying to write all that boilerplate code over and over.

I decided to implement an event-driven helper. For setter I create propertyChanging, propertyChanged and propertyGetting events. You can just subscribe to an appropriate one and put any conditional logic in the event handler. This should be much neater than the previous approach.

This helper must work in all modern browsers and IE9+

function injectPropertyEvents(element, propertyName) {
    if (!(propertyName in element))
        throw new Error("Element does not have property " + propertyName);

    var propertyHolder = element;
    var descriptor;
    while (propertyHolder !== null) {
        descriptor = Object.getOwnPropertyDescriptor(propertyHolder, propertyName);
        if (descriptor)
        propertyHolder = Object.getPrototypeOf(propertyHolder);

    if (!descriptor)
        throw new Error("Could not find property desciptor " + propertyName);

    if (propertyHolder.propertyEventsInjected)

    function raiseEvent(element, eventName, eventDetails) {
        var event;
        var bubbles = true;
        var cancelable = false;
        try {
            event = new CustomEvent(eventName, {
                bubbles: bubbles,
                cancelable: cancelable,
                detail: eventDetails
        } catch (e) {
            event = document.createEvent("CustomEvent");
            event.initCustomEvent(eventName, bubbles, cancelable, eventDetails);

    Object.defineProperty(propertyHolder, propertyName, {
        configurable: true,
        get: function get() {
            var eventDetails = {
                value: descriptor.get.call(this)
            raiseEvent(this, propertyName + "Getting", eventDetails);
            return eventDetails.value;
        set: function set(value) {
            var eventDetails = {
                oldValue: descriptor.get.call(this),
                newValue: value
            raiseEvent(this, propertyName + "Changing", eventDetails);
            descriptor.set.call(this, eventDetails.newValue);
            raiseEvent(this, propertyName + "Changed", eventDetails);

    propertyHolder.propertyEventsInjected = true;

Besides being able to set breakpoints, this approach allows you many nice tricks. You can, for example, override the newValue event argument within propertyChanging event

document.getElementById("myTextBox").addEventListener("valueChanging", function valueChangingHandler(e) {
    if (e.detail.newValue === "something bad")
        e.detail.newValue = "making it better";

You can play with the examples in https://jsfiddle.net/mnaoumov/69ejdj1p/1/

Stay tuned

UPD: With slight modifications and polyfills, added support for IE8: http://output.jsbin.com/gesajo/3/

UPD2: I modified bubbles to true as I found it much more useful to real usage purposes, especially for writing an event handler for elements that not exist yet.

$(document).on("valueChanged", "input", function valueChangedHandler(e) {
    var newValue = e.originalEvent.detail.newValue;
    // ...
Posted in Uncategorized | Tagged | Leave a comment

WTF! MicrosoftAjax.js vs ‘use strict’ vs Firefox vs IE

Hi folks

I fixed a very weird bug today.

Initially the bug was raised that some actions causes JavaScript error in Firefox:

TypeError: access to strict mode caller function is censored

This was not happening in IE or Chrome.

I started to debug and found that the problem is within MicrosoftAjax framework. I am working on a legacy ASP.NET WebForms project which uses and relies on it heavily.

For the blogging purposes I looked for a debug/unminified version of the problematic script and found it here: http://ajax.aspnetcdn.com/ajax/4.5.2/1/MicrosoftAjaxWebForms.Debug.js

I would like to refer to some lines so I uploaded the same file to gist.

The problematic line was https://gist.github.com/mnaoumov/55be04ca588ff22f851f#file-microsoftajaxwebforms-debug-js-L738

while (caller.arguments.callee.caller && --recursionLimit) {

where at some stage caller.arguments.callee variable equals to the function that is defined in some script with

"use strict";


and therefore it prohibited to call its caller

And the reason why this issue occurred in Firefox only is the line https://gist.github.com/mnaoumov/55be04ca588ff22f851f#file-microsoftajaxwebforms-debug-js-L733

var event = window.event;

window.event is undefined in Firefox. This event variable is not really needed. The only place it is used https://gist.github.com/mnaoumov/55be04ca588ff22f851f#file-microsoftajaxwebforms-debug-js-L785 would be called under pretty rare condition according to the code flow.

activeElement = event ? (event.target || event.srcElement) : null;

So in order to fix the problem I think it is pretty safe to fake **window.event** for this function.

So I’ve written a hack

 * This is required to fix a bug in MicrosoftAjaxWebForms.js
 * in Firefox where if window.event is not initialized, it loops stack
 * via arguments.callee.caller chain and breaks because of the
 * "use strict" mode
function hackEventWithinDoPostBack() {
    var originalDoPostBack = window.__doPostBack;

    window.__doPostBack = function hackedDoPostBack() {
        if (!window.event)
            window.event = {};
        return originalDoPostBack.apply(this, arguments);

And this worked fine in Firefox. I thought it would work fine in IE and Chrome as well because I am checking for window.event before overriding but it was not!

IE11 started to fail in other places with the following error

Assignment to read-only properties is not allowed in strict mode

That was caused by the

window.event = {};

line written above. I found that window.event still can be undefined but you are not allowed to set it explicitly.

That appeared to be a bit tricky to overcome and eventually I came up with a pretty sophisticated solution

 * This is required to fix a bug in MicrosoftAjaxWebForms.js
 * in Firefox where if window.event is not initialized, it loops stack
 * via arguments.callee.caller chain and breaks because of the
 * "use strict" mode
 * Hacking window.event property is required because it is
 * not settable in Internet Explorer
function hackEventWithinDoPostBack() {
    var originalEventDescriptor = Object.getOwnPropertyDescriptor(Window.prototype, "event");
    var hackEventVariable = false;
    var eventPropertyHolder;
    Object.defineProperty(window, "event", {
        configurable: true,
        get: function get() {
            var result = originalEventDescriptor ? originalEventDescriptor.get.apply(this, arguments) : eventPropertyHolder;
            if (result || !hackEventVariable)
                return result;
            return {};
        set: function set(value) {
            if (originalEventDescriptor)
                originalEventDescriptor.set.apply(this, arguments);
                eventPropertyHolder = value;

    var originalDoPostBack = window.__doPostBack;

    window.__doPostBack = function hackedDoPostBack() {
        hackEventVariable = true;
        originalDoPostBack.apply(this, arguments);
        hackEventVariable = false;

This works in IE, Chrome and Firefox.

Such a workaround, isn’t it?!

Stay tuned

Posted in Uncategorized | Tagged , | 2 Comments

‘Broken phone screen’ or ‘99% success = fail’

Hi folks

I’d like to share my fail story I’ve got yesterday.

Preamble (you may skip it)

I am using Nexus 5 smartphone for 2 years already and I like it very much.


I’ve already replaced its screen three times.

First time, I replaced it in 1.5 years ago after my first 1.5 years old son dropped it on tiles in bathroom and the screen cracked.

Second time, I replaced it 4 months ago after my second 6 months old son sucked it so my touch screen stopped to work in some areas.

Then 3 days ago I replaced it again because my second son sucked it again and broke touch screen again.

His saliva is poisonous, he also sucked my wife’s iPhone 4S and after that its Home button stopped to work.

So now we are strictly prohibit him to take any sensitive gadgets 🙂

Main story

Yesterday, my phone’s screen suddenly stopped to work. Half of it blacked out and other half got color bars on it

Unfortunately the photo of that screen is lost due to a stupid iPhone’s Horizon app which I used as a Camera and it pretended the photo was shot, but it was not.

Similar but not exact look was like


Initially touchscreen worked (at least on the visible half) but quickly it stopped to work as well.

I needed to make it working at least somehow, because I didn’t have a spare phone to put my SIM in.

I wanted to install some software to see my phone screen remotely, so I could see what happens on my screen, who called me, read SMS etc. It’s like a TeamViewer’s access PC from phone  but I needed a reversed scenario.

Fortunately, I can install programs on my phone via Google Play from computer without touching phone. I found and installed AirDroid

But I still needed to unlock my phone to configure app’s requirements.

My screen was not working so that’s a tricky part.

And I’ve managed to do that. I have USB OTG cable

And I connected my USB hub for wireless mouse and keyboard to the cable and could use mouse to access my phone’s screen.

So I unlocked it and tried to launch the app. But remember I could see only right half of the phone so it’s tricky to get something from the invisible left half of it.

Unfortunately, my phone had a setting to disable auto-rotate so I could not see more by rotating my phone to 90°

I remember that this auto-rotate was on quick settings panel (on the very top) but this button was hidden.

I googled default quick settings screenshot for Android 6.0 and found



So I found that my button should be left to the flashlight button and I moved my mouse to the left and blindly clicked. And… Hurrah… I turned auto-rotate on. WIN!

Then I’ve managed to run the installed AirDroid app and enter credentials. Here wireless keyboard helped a lot. On-screen keyboard would be challenging. WIN!

After that I could see in this app on my PC a list of missed calls and SMS

But I wanted to see a full screen and control it. The app told me that in order to use that functionality I have to go to the settings and enable USB Debugging Mode. It was pretty challenging, because I could not see settings names often (the mostly on the left half screen). But after some (very long!!!) time I’ve managed to enable the USB Debugging Mode. Remember, I was using USB mouse all the time. WIN!

Now I needed to connect my phone to PC via USB so I did and it showed me a screen where I needed to confirm that I allow to debug from that computer. But wait a minute, I can’t do that!!! I connected phone to PC so my mouse is disconnected. If I connect mouse, I disconnect it from PC. So I am nearly there, I just need to confirm the USB debugging mode and I can’t. FAIL!!!


I gave up on the idea to use the phone remotely and started to wait for the repairer who changed my screen 3 days ago.

He took my phone but couldn’t find any reasons for the issue. He said he waits for some reply from the screen shipper and this may take some time, and also there are public holidays coming, so potentially I can wait for more than a week.

I needed a temporary phone. My internet banking is linked to my mobile number. So in order to login and perform any operations, I need to receive and type my bank SMS.

He didn’t have a spare phone to give me temporarily. And I don’t have any mobile phone shops in a walking distance from home. So I gave up. I took a taxi and ask the driver to bring me to the closest mobile phone shop. So he did. And I bought used Nokia 1100

I paid ~ $12 for it. But now I can at least receive calls and SMS.

I came home and came back to work and soon I received a call from the repairer who said that he’ve managed to order, receive the spare screen and fixed it for me. I came and took it! Problem is gone!

BTW. I enabled the USB debugging mode and can see my phone screen on PC after connecting to USB once (I may disconnect phone then)


Always have a spare phone to be able to take calls and SMS in case if your main phone dies suddenly.

Stay tuned

Posted in Uncategorized | 1 Comment

Best programming font – Source Code Pro

Hi folks

Recently, I reinstalled my Windows and started to reconfigure my environment to use font I am using for last 5 years – Consolas

I decided to search what is the most popular font nowadays and found http://www.slant.co/topics/67/~programming-fonts where Consolas is quite popular – 249 upvotes. But I found another winner Source Code Pro with 362 upvotes.

So I decided to give it a chance.

I installed it via Chocolatey – https://chocolatey.org/packages/SourceCodePro

And started using it. And initially I did not like it – https://twitter.com/mnaoumov/status/673887576097468416?lang=en

Then I used to it in Visual Studio but I still looked ugly in Sublime Text and ConEmu

Then I found how to configure it to look nice in Sublime Text – https://github.com/Maximus5/ConEmu/issues/74#issuecomment-166576653

But it dependent on DirectWrite support which many apps don’t have.

I raised an issue for the font itself – https://github.com/adobe-fonts/source-code-pro/issues/116 and they advised to use TTF font instead of OTF.

I checked and found that Chocolatey installed only OTF version. So I removed it and installed TTF manually from https://github.com/adobe-fonts/source-code-pro/releases/latest

And now it is nice and charming everywhere

Stay tuned

Posted in Uncategorized | Leave a comment