Monday 15 September 2014

Nginx service failover to 1x1 gif with timeout

That's what I love nginx for. Really simple and declarative. At 8086 we have a service that is non-stable, at 8091 there is virtual gif substitutor. On 300ms timeout there will be 1x1 gif as a response. Nginx resides on 8090 for presentation.

http {
  include mime.types;
  default_type application/octet-stream;
  upstream backend {
    server localhost:8086;
    server localhost:8091 backup;
  }
  server {
    listen 8090;
    server_name localhost:8090;
    location /sf.gif { empty_gif; }
    location / {
      proxy_pass http://backend;
      proxy_next_upstream error timeout
        invalid_header http_500 http_502 http_503
        http_504 http_403 http_404;
      proxy_connect_timeout 300ms;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For
        $proxy_add_x_forwarded_for;
      proxy_redirect off;
    }
  }
  server {
    listen 8091;
    server_name localhost:8091;
    location / {
      rewrite ^ http://localhost:8090/sf.gif redirect; }
    location ^ {
      rewrite ^ http://localhost:8090/sf.gif redirect; }
  }
}

Saturday 17 May 2014

Efficient RAW processing

Don't struggle with RAW any more, there is a solution:
  1. Superfast view and choose best RAW shots by ranking: http://www.fastrawviewer.com/. Just download and use all the time. Released 3 days ago, I'm really happy. Very fast.
  2. Extract JPEG previews from your RAW: http://www.picurl.org/blog/2009/07/18/ultra-fast-raw-to-jpeg-conversion-with-exiv2/. In short, if you are a Nikon-guy, then get exiv2 and typically run exiv2 -ep3 *.NEF on your folder.

Friday 2 May 2014

Monday 28 April 2014

Priority-based project management

So here we have Project 2013, but what do we see:


Exactly, "Hello Windows 3.1"! But why? I remind the same case with having only 16 colors available to style background of a cell until Excel 2007. But, as Joel Spolsky has described, it's intentional. It's a priority-based development: they had this "issue" on the list for years, but got it to be fixed only recently. I suppose that for Project there is the same case.

Is it good or bad? Well, I hope that Microsoft will be capable of finding additional people to fix that minor but disappointing stuff. Certainly, 95% won't notice a problem, but others 5% will, and that can make sense, because those guys/gals are usually early adopters, evangelists and IT decision makers. It's like a debt, but not technical, rather a task-based debt. Sometimes everyone needs to make a cleanup, at least each year before Easter, right? :)

Monday 24 March 2014

Узнать код бронирования PNR в Аэрофлот

При покупке билетов на рейсы Аэрофлот у лоукостеров (обычно всё же выходит дешевле :) посредник стандартно выдаст вам номер брони, номер заказа, но не внутренний код бронирования Аэрофлота PNR, что надо вводить на сайте http://www.aeroflot.ru/cms/online_registration. Так вот, извлечь этот номер можно на одном из этих сайтов систем резервирования:
Так, когда заказ идёт через supersaver.ru, то помогает поискать свою бронь по его номеру брони на первом и втором сайте из списка. Если вы покупаете в долларах, также рекомендую попробовать expedia.com, места в нём можно забронировать сразу, даже на Аэрофлот!

Wednesday 19 March 2014

Network Folders work slow in Windows 7

These steps helped in my case.
  1. Rename registry folder HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace to something else, like -NameSpace.
  2. Run netsh interface tcp set global autotuninglevel=disabled.
  3. Restart.

Sunday 16 March 2014

Can't read 32 Gb SD Card with Ricoh Reader on Lenovo ThinkPad W520, T430s, and others

I had lots of trials and errors with this, but here is the solution for Windows 7 x64. Please do all the experiments with clean SD-card, or you might loose your data on it! Just believe, if you fail at one of the steps, then you'll loose your data.

  1. Google for Ricoh_Card_Reader_2.25.17.01, install and reboot. Official Lenovo's http://support.lenovo.com/en_US/downloads/detail.page?DocID=DS028931 simply don't fit, and even drivers for T431s http://support.lenovo.com/en_US/downloads/detail.page?DocID=DS034692 won't fit, they are 2.14 only, very obsolete.
  2. After insertion of your SD-card, go to Device Manager, locate your "Disk drive" and set "Better performance" instead of "Quick removal". Otherwise you will have terrible lags and fails while opening the card. If you still have lags, try deactivating your security software, especially Microsoft Security Essentials.
  3. Also check that you have "Integrated Smart Card Reader" in "Smart card readers" , but not some default device. If not, please update the corresponding driver online just from Device Manager. Otherwise you may find your data on the SD-card damaged!

Friday 7 February 2014

Overlay icons limit

Installed some new stuff like SkyDrive and lost your overlay icons for TortoiseSVN? That's because of the overlay icons limit in Windows 7 — no more than 24. You can fix this only by removing some of the registered overlays from here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers
0Ynd is for Yandex.Disk overlays.

Tuesday 4 February 2014

String as a template parameter in C++03

So you want to instantiate your template with a string literal, but you can do this only by defining it as a constant. This code should work:

#include <iostream>
template <const char* p> Foo () { std::cout << p; }
extern const char s[] = "Hello world!";
void main () { Foo <s> (); }

The tricky part here is extern for s. C++03 requires template arguments to have external linkage. I can't remember any other reasons for using extern const in production code. The reason is that the C++ specs in that point are simply over-restrictive. Fortunately, C++11 doesn't have such a mess.

"Director of technologies propagation"

There is a guy in Yandex who's name is Grigory Bakunov, and he is somewhat legendary person among the Russian developers community, more on him here:
He is a person of broad expertise, so there was a problem with a title of his position after he had turned his career into Yandex. Therefore they have invented the title "Director of technologies propagation". It means that he is responsible for revealing the value of technologies being invented inside Yandex to make them a) usable and available across different teams in Yandex, b) known and popular outside Yandex (through API's, competitions, etc).

What I want to notice here is that such a role is strictly important in science-intense working environments. Each IT-person in the company should be aware of what his/her colleagues are working on, and what technologies does the company already have to be reused. That is an essential part of the overall company's efficiency and the key to elaboration of the company's "school".

Monday 13 January 2014

gcc and -ldl

Whenever you want to use POSIX functions like dlopen and dlsyn, should you put -ldl at the very end of the linking command, like:
g++ -rdynamic -Wl,-rpath,. -L. -o Progr ./Progr.o -ldl
but not like:
g++ -rdynamic  -ldl -Wl,-rpath,. -L. -o Progr ./Progr.o
Yet don't know why, accept as a fact.

Saturday 4 January 2014

Make process run with high priority

Dirty but works. For Windows certainly :)
system ("wmic process where name=\"MyExe.exe\" CALL setpriority 128 > dummy.txt");

Thursday 2 January 2014

CPU whine hotfix for Ivy Bridge

Even on the modern Ivy Bridge Intel CPU's we have coal whine frequently.
There were plenty of solutions during the last, hm, 5 years. But here is the simplest workaround:
1) To activate: reg add HKLM\System\CurrentControlSet\Control\Processor /v Capabilities /t REG_DWORD /d 0x0007e066
2) To deactivate: reg delete HKLM\System\CurrentControlSet\Control\Processor /v Capabilities /f
Restart PC.
It really works on my new Lenovo T430s with i5-3230, on all the default power schemes, no fancy tweaking for them. Together with TPFanControl and SSD inside, I have the most silent powerhouse laptop I have ever had. But I didn't test how it drowns the battery. Will surely test it and post results here.

UPD Haven't noticed any significant difference in heat and power consumption by now (Jan 13). Highly recommend to use.

Wednesday 1 January 2014

Highlight current line

Always look for this while tuning new Windows setups. NB.


Here is the preferable color: