събота, 5 април 2014 г.

Canonical will shutting down the Ubuntu One file services.

I really like the operating system Ubuntu. I'm very sorry that I got this email today. Maybe Canonical have any financial problems.

From: Ubuntu One noreply@one.ubuntu.com
Subject: Ubuntu One file services

Hi,

We are writing to you to notify you that we will be shutting down the
Ubuntu One file services, effective 1 June 2014. This email gives
information about the closure and what you should expect during the
shutdown process.

As of today, it will no longer be possible to purchase storage or music
from the Ubuntu One store. The Ubuntu One file services apps in the Ubuntu,
Google, and Apple stores will be updated appropriately.

As always, your content belongs to you.  You can simply download your files
onto your PC or an external hard drive.  While the service will stop as of
1 June, you will have an additional two months (until 31 July 2014) to
collect all of your content. After that date, all remaining content will
be deleted.

If you have an active annual subscription, the unused portion of your fees
will be refunded. The refund amount will be calculated from today's
announcement.

We know you have come to rely on Ubuntu One, and we apologise for the
inconvenience this closure may cause.  We've always been inspired by the
support, feedback and enthusiasm of our users and want to thank you for
the support you've shown for Ubuntu One. We hope that you'll continue to
support us as together we bring a revolutionary experience to new devices.

The Ubuntu One team

събота, 15 февруари 2014 г.

Incorrect chess sold in the shop Jumbo.

I like to play chess. In my work I along with my colleagues wanted to buy a nice chess set package including the pieces and a board and play chess sometimes after working time. Today I went to a nearby shop Jumbo located at Sofia Drujba-2 11, Obikolna str. and find chess set that is sold at a good price. This shop is owned by Jumbo Group. Chess set is nice, but the board is wrong. I viewed the set, but did not buy it. Below can be seen a picture of the set.
As can be seen here, when you sit at your side of the board, on your right corner there is always a white square.
My conclusion from this case is that users need to be careful and check chess sets in the shop before buy them. It seems that the manufacturer of these chess sets never played chess.

AngularJS $http, CORS and http authentication

Some time ago I had a task for the company where I work. The task had to use CORS. I am writing this article to share lesson learned.
You want to send POST request to different domain with AngularJS $http service? There is several tricky thing into AngularJS and server setup.
First: In your application config you must to allow cross domain call

    /**
     *  Cors usage example. 
     *  @author Georgi Naumov
     *  gonaumov@gmail.com for contacts and 
     *  suggestions. 
     **/ 
    app.config(function($httpProvider) {
        //Enable cross domain calls
        $httpProvider.defaults.useXDomain = true;
    });

Second: You must specify withCredentials: true and username and password into request.


     /**
      *  Cors usage example. 
      *  @author Georgi Naumov
      *  gonaumov@gmail.com for contacts and 
      *  suggestions. 
      **/ 
       $http({
      url: 'url of remote service',
      method: "POST",
      data: JSON.stringify(requestData),
      withCredentials: true,
      headers: {
       'Authorization': 'Basic bashe64usename:password'
      }
     });

Тhird: Server setup. You must provide:

    /**
     *  Cors usage example. 
     *  @author Georgi Naumov
     *  gonaumov@gmail.com for contacts and 
     *  suggestions. 
     **/ 
    header("Access-Control-Allow-Credentials: true");
    header("Access-Control-Allow-Origin: http://url.com:8080");
    header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");

For every request. When you receive OPTION you must pass:


    /**
     *  Cors usage example. 
     *  @author Georgi Naumov
     *  gonaumov@gmail.com for contacts and 
     *  suggestions. 
     **/ 
    if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
       header( "HTTP/1.1 200 OK" );
       exit();
    }


HTTP authentication and everything else comes after that. Here is complete example of usage of server side with php.

   /**
     *  Cors usage example. 
     *  @author Georgi Naumov
     *  gonaumov@gmail.com for contacts and 
     *  suggestions. 
     **/ 
    header("Access-Control-Allow-Credentials: true");
    header("Access-Control-Allow-Origin: http://url:8080");
    header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
    
    if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
       header( "HTTP/1.1 200 OK" );
       exit();
    }
    
    
    $realm = 'Restricted area';
    
    $password = 'somepassword';
    
    $users = array('someusername' => $password);
    
    
    if (isset($_SERVER['PHP_AUTH_USER']) == false ||  isset($_SERVER['PHP_AUTH_PW']) == false) {
        header('WWW-Authenticate: Basic realm="My Realm"');
    
        die('Not authorised');
    }
    
    if (isset($users[$_SERVER['PHP_AUTH_USER']]) && $users[$_SERVER['PHP_AUTH_USER']] == $password) 
    {
        header( "HTTP/1.1 200 OK" );
        echo 'You are logged in!' ;
        exit();
    }
    ?>

Here can be found me question in stackoverflow.

събота, 8 февруари 2014 г.

Arrows in GIMP.

I like GIMP. Gimp is very useful for people that don't like commercial software. When you get accustomed to it GIMP is very pleasant for using software. In my work I often have to annotate screen shots. For this I was slightly unpleasantly surprised when I learned that GIMP has  no arrows. I found this very good plugin that adds this feature in GIMP.  You must put the script under gimp/2.0/scripts directory. Under Ubuntu 12.04 (my current working box) you can install it using this one liner:

 sudo wget -O /usr/share/gimp/2.0/scripts/arrow.scm http://registry.gimp.org/files/arrow.scm

The above shell command works correctly also under Ubuntu 13.10.

How to use it: 
1.You must make a path with  Path tool. 

 2. From Tools select Arrows ..

 3. Settings dialog appears. 

4. After playing with settings and press OK you can see finished arrow.
Have fun.

петък, 3 януари 2014 г.

Disable notifications on skype only for particular contact under Linux.

Sometimes we need to switch off skype notifications but for particular contact only. In windows there is easy solution «Conversation» -> «Notification settings ...» -> «Do not notify me» unfortunately this option is missing under Linux version. I googled for solutions but there is no results. All articles shows that this is possible under Windows and Mac versions of skype. Once I thought I noticed that some of the commands for group chat is available for personal.
I did some experiments and came to a solution. When you want to disable notifications on skype only for particular contact under Linux you can use this command in chat window:
/alertsoff
. If you want to activate notifications you can use:
/alertson
. Hope this helps someone with a similar problem.

неделя, 10 ноември 2013 г.

«ТОР: Светът на мрака » - един мега тъп филм.

Вчера ходихме с жена ми да гледаме този филм. Нечие голямо въображение е създало някаква странна смес от междузвездни войни, митология и комикси. Локи е единственият, притежаващ нормална интелигентност и дори е до някъде симпатичен. Тор, богът на гръмотевиците е просто смешен и прилича на гей или метросексуален нищо, че има някакви мъжкарски залитания. Липсата на въображение в сценария е компенсирана с много специални ефекти. Хеймдал/Хеймдалур, който е известен в нордическите предания като буквално "най-белият от асите" и "белият бог" тук е негър. Като цяло филма е добър за да убиете един час, но да отидете на кино, заради него е грешка.

петък, 1 ноември 2013 г.

Детектване на операционнате система с JavaScript.

Тия дни получих един много забавен лог по скайп от един приятел. Прилагам го по-долу. Репликите са, както са ми били изпратени като само никовете на хората са сменени. Ето го да се посмеете малко:
[09:29:55] с какъв виндовс си?
[09:29:55] Иван: хр, 7 или 8?
[09:31:29] Music: как да разбера?
[09:31:43] Иван: бррррр
[09:32:27] Music: един ромб и свети
[09:32:31] Music: излиза сияние от него
[09:32:32] Иван: копче с байраче и надпис старт - значи си   със ХР или 7
  кръгче с байраче - 7
  нямаш старт бутон - 8
[09:32:45] Иван: ромба е байраче
[09:32:48] Music: кръгче с байряче и свети!
 
По този случай надрасках едно малко скрипте, с което може да се детектва версията на Windows. Детектва и линукс, но само, че е линукс не версията му. Кликнете върху бутона по-долу и ще се покаже каква операционна система ползвате. Забавлявайте се.