Category Archives: Coding

C++11: Implementation of list comprehension in SQL-like form

list comprehension

List comprehension in functional languages is the name of list constructor syntax, which is similar to set-builder notation from math.

What are the benefits of using list comprehension? One is readability, and the other one is the fact of decoupling iteration from actual construction. We could even hide parallel execution under the hood of list comprehension. Also by adding additional options to such declaration we could make the list construction a lot shorter.

If we look closer at list comprehension’s syntax, it will remind of one another very familiar thing – SQL select! Output expression, input set, predicates are equivalent to select, from, where sequence (of course not exactly, but they are very alike). Ok, let’s implement such syntax sugar using C++11 (without boost and LINQ-like libs).

Continue reading

C++11 functional decomposition – easy way to do AOP

This post is about making functional decomposition from perspective of Aspect Oriented Programming using C++11. If you are not familiar with ideas of AOP don’t be afraid – it’s rather simple concept, and by the end of this post you will understand the benefits of it.

You also can treat this post just as example how to use high-order functions in C++11.

In short – AOP tries to perform decomposition of every business function into orthogonal parts called aspects such as security, logging, error handling, etc. The separation of crosscutting concerns. It looks like:
Continue reading

Small presentation of my cross-platform engine for mobile and desktop applications

I made small presentation about my cross-platform engine for mobile and desktop applications. Codename Kobald. Click on image to play it in new window (use arrows and space to move through):

Screenshot 2015-01-21 21.53.14

This is not-so-technical presentation and main info about engine will come later as separate post.

Easy way to auto upload modifications to server under osX (live development)

Here is very simple way to setup immediate automatic upload of source code modifications to server via ssh. This gives you ability to perform live development and testing of your solutions. There are a lot of utilities to achieve this and you even can write some not-so-comlicated script doing recurrent compare of file modification times yourself – but there is very easy solution from Facebook, called watchman. To install it under OsX use Brew

Watchman will call upload script for each modified file – lets write this script and call it uploadauto.sh. It will be really short!

I assume you have ssh keys on server and don’t do manual password entry. Put this script into the folder you want to synchronise. And finally we need to say to watchman to look over this folder and call our script when something changes:

Replace here /Users/me/project1 with your folder name. upload is the name of the trigger. ‘*.*’ is the mask for files to be monitored. More information about trigger syntax can be found here.

And thats all!

Continue reading

Is 4K TV effective for software development?

Until recent time i thought that developer who tried 2x 24 inch fullhd monitors will stay with this setup as must have option for more productive work. (If you still below this setup you must be located at the beach, drink some cocktails and just cant bring monitors with you.) But now is the time to move further upgrading your workplace – now i use 4K 42-inch TV for development.

4K tv for software dev

Why now? In 2014 manufacturers released new cheap UHD devices in range between 39-42 inches. And by cheap i mean less than 1000 USD (I bought some LG 42UB820V model as it had IPS lcd and HDMI 2.0). Only 4K UHD resolution makes 72dpi and can be used as “normal” computer monitor when you sit close to it.

Continue reading

Small guide: how to support immersive mode under Android 4.4+

In Android 4.4 version we have new Immersive mode which allows to make system bars translucent and extend application area to fit all screen. This looks great as it gives more space to application in terms of usability and it creates more stylish look if application design is done accordingly.

Immersive mode for TripBudget

I added support of immersive mode to TripBudget. And there were some unexpected troubles on the way so i decided to write some kind of guide here.

Note: I talk here about immersive mode where bottom navigation bar is hidden – using SYSTEM_UI_FLAG_IMMERSIVE_STICKY flag. This guide is aimed to gather and solve all problems which prevent sticky mode to work properly.

Continue reading

Perfomance of complex GL ES 2.0 shaders on mobile devices

There is very nice site http://glsl.heroku.com/, where you can find the gallery of complex GLSL shaders (from very simple gradients to very complex rendering systems). You can modify their code at real-time using provided editor:

heroku

Current implementation of WebGL is using GL ES 2.0 – the same as all mordern android / iOS phones/tablets. So i decided to test if i can use these shaders at mobile applications – and tested their performance on Sumsung Galaxy Note II. Of course i tested only relatively simple shaders expecting them to run slow…

Continue reading

Новогодний скринсейвер-открытка 2012

screen400

Давно я не писал в блог – но есть хороший повод! Чтобы качественно поздравить всех с новым годом, я написал новогодний скринсейвер-открытку (QT OpenGl). Для запуска необходима не древняя видеокарта и монитор побольше. Happy new year 2012!

Скачать ~4Mb

Курсы доллара и евро: гаджет для висты

Давненько хотел написать какой нить гаджет для висты. Изначально хотел сделать это на WPF, но выяснилось что к гаджетам у микрософта другой подход. Посути гаджет – это html веб страница со всеми вытекающим. Поэтому только xbap или silverlight можно засунуть в гаджет (причем стало это можно сделать относительно недавно).

Посмотрев в каталоге гаджетов, гаджеты, которые показывают курс валют, и не найдя там ничего интересного, я решил написать свой монитор курсов. У нашего центрабанка есть прекрасный веб сервис, который предоставляет всю информацию о курсах валют за любой период.

Попытка использовать сильверлайт закончилась неудачно. Во первых, под 64-битной вистой сильверлайт не работает в 64-битном сайдбаре. Это можно обойти, запуская 32-ух битную версию сайдбара, но это уже извращение. Во вторых, из сильверлайта в гаджете нельзя нормально обратиться к вебсервису. Это связано с тем, что сильверлайт в гаджете не видит конфигурационных xml файлов и не может получить доступ. Есть workaround, который передает данные в сильверлайт контрол через скрипт AJAX, но я считаю это не очень красивым. 

В итоге я сделал проще – гаджет просто показывает картинку с вебсервера, обновляя ее раз в час. А на сервере работает php скрипт по крону, который запрашивает данные у центробанка. Гаджет показывает текущий курс бакса и евро, на сколько он изменился за день и за неделю и график динамики курсов за 3 недели. 

Гаджет курса валют ЦБ для висты

Скачать гаджет

Просто запустите скаченный файл, и гаджет установится. Если этого не произойдет и он откроется как зип архив, то можно на гаджете нажaть Open with… Sidebar. Если и это не поможет, то можно создать папку C:\Users\Ваше имя\AppData\Local\Microsoft\Windows Sidebar\Gadgets\CurrencyRates.gadget\ и в нее скопировать содержимое архива. 

Релиз .NET Framework 3.5SP1 и VS2008 SP1

Состоялся релиз сервис пака .NET Framework 3.5SP1 и VS2008 SP1.

Доступны они тут.

The .NET Framework 3.5 SP1 delivers:
* Performance increases between 20-45% for WPF-based applications – without having to change any code
* WCF improvements that give developers more control over the way they access data and services
* Streamlined installation experience for client applications
* Improvements in the area of data platform, such as the ADO.NET Entity Framework, ADO.NET Data Services and support for SQL Server 2008’s new features