wtorek, 13 czerwca 2017

Watermark for LibreOffice Writer

Recently I was working on Watermark feature for LibreOffice Writer. In case of TSCP Classification it was possible to add "Confidential" watermark in the document background. I extended that with possibility to add custom text, font family, color, transparency level and angle. Additional dialog was introduced in the menubar under "Insert" > "Watermark...".


I improved also export and import for that kind of shapes from .dotx files. Now font-family is correctly loaded:


RTF import also was improved, before Watermark was visible as a plain text:

czwartek, 4 maja 2017

AutoText import from .dotx and .dotm files

In the LibreOffice Writer user can prepare some pieces of documents which can be reused later. That feature is called AutoText and is accessible using menubar (Tools - AutoText). In the AutoText dialog it is possible to manage existing entries and also import new ones from files.
So far only *.dot and *.doc file formats were supported for importing AutoText. Here was my first task at Collabora: to add .dotx and .dotm format support.

One template document can contain multiple AutoText entires. Each entry has own name and can consist of formatted text, text with graphics, tables or fields. To import new templates user need to open AutoText dialog (Tools - AutoText), select according category and from the "AutoText" menubutton choose "Import". File explorer will appear. In the file format listbox new entries were introduced: "Microsoft Word 2007-2013 XML" and "Microsoft Word 2007-2013 XML Template" for *.docx and *.dotx or *.dotm.

AutoText has own long name and shortcut. It is possible to insert AutoText after typing shortcut name into document and pressing F3.

Following GIF shows *.dotx import with complex content (table, shape, formatted text and fields):

niedziela, 16 kwietnia 2017

Linux rescue after Windows 10 Creators Update

Last night I've updated my Windows 10. That was big update called "Creators Update". I don't know details what was changed (I noticed only new privacy settings and mail client) but one thing was significant for me as a linux user. When I wanted to switch to my openSUSE it opened rescue mode. It happend after I entered password to my encrypted home partition. My first thought: update modified my partition! Fortunately it was possible to open and mount it using cryptsetup. I checked also /etc/crypttable and I realized what is the root cause of my problems.
In my config I found /dev/sda7 but my current encrypted partition number is 6! Fast research and I found empty space on my disk between two partitions. Possibly the update removed one of partitions existing before (created during Windows 10 installation) and now all my linux partitions have decreased numbers.
I created new partition in the empty space. Reboot. Linux works.

poniedziałek, 10 kwietnia 2017

SeniorITy Code powered by Sii - Embedded

Two weeks ago I participated in meeting where shortly were preseted different security aspects of the embedded systems.

First talk was a introducion into C++11 for beginners. Next two were about safety and security of embeddes systems. Part about safety was focused on developing standards for increase of a quality of the final system (eg. restrictions in memory management).

Last part was the most interesting in my opinion. Many methods of systems analysis were metioned - including copying of the architecture techniques. It is a real problem when it is that simple to reconstruct the net list from photos of a circuit using tools like degate. To watch how the device is working there are methods called side channel attacks. Attacker can observe properties such as power usage, processing time, temperature or electro magnetic emissions to get knowledge about computations inside a chip. Other kind of attacks are state modifications. Using laser beam it is possible to change memory registers (but not single bit) which can be used to introduce changes in the code execution. Other methods are: overheating what leads to skiping instructions in some processors or changing voltage level to change signal interpretation (high/low state).

Links:
Sri Parameswaran, Tilman Wolf - Embedded systems security—an overview

wtorek, 4 kwietnia 2017

How to run JHipster on openSUSE 42.2

JHipster is a tool to generate full web app template using Spring Boot and Angular frameworks. When I've tried to run it for a first time on my openSUSE 42.2 I've got:
/usr/local/lib/node_modules/generator-jhipster/generators/app/index.js:15
    constructor: function (...args) { // eslint-disable-line object-shorthand
                           ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.defineProperty.get [as jhipster:app] (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/store.js:40:23)
    at Store.get (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/store.js:64:35)
    at Environment.get (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:261:21)

Unfortunately JHipster needs node.js with version 6, not 4 which I installed from my default repositories. After node.js 6 installation it was working.

After successful generation I wanted to start my web app, but I've met second problem. H2 database which I wanted to use for developing was throwing java.net.UnknownHostException:
java.net.UnknownHostException: HOSTNAME.suse

Solution is simple: add new entry in the /etc/hosts
127.0.0.1       HOSTNAME.suse

poniedziałek, 27 marca 2017

Neural networks on drugs

AI can be used just for fun. Great example is DeepDream project which generates new images based on provided ones.
Results: :D



Way how it is possible is described in the following video (lectures, Stanford):



Another interesting video briefly showing how AI is used today:


niedziela, 5 marca 2017

0patch

I've just read about very interesting product - 0patch. Occasionaly, we got to know that some companies didn't fixed the bug which is causing serious vulnerability. When it becomes public sometimes we have to wait months for an official patch and 0patch want to provide own unofficial fixes.
The idea is simple: they prepare small patches which are applied by 0patch agent in the runtime. That solution uses technique called function hooking to modify existing code. They also shared manual for developers which shows how to prepare own patches.

Links:
0patch blog

sobota, 4 lutego 2017

Nixie clock #1 - boost converter and my first PCB

Some time ago I bought couple of nixie tubes. Nixie tubes look nice especially in the dark. When I've seen them for the first time I decided to build something on my own (I'm going to build a clock).

First I had to build boost converter because tubes are working with high voltage (170-190V). I used this one which converts input voltage in range 9-12V to needed values. Output can be modified with potentiometer. After I bought all parts and assembled circuit I tested it with tube:


Today I've created my first PCB using thermal transfer of a circuit printed (using laser printer) on the special glossy paper. It was also etched in a Sodium Persulfate solution. Results:


It is not perfect but pretty good considering that it was my first time :) I will put on that board my boost converter.

EDIT:

Board after soldering.

Project files:
https://github.com/eszkadev/nixie-clock/tree/master/boost-converter

poniedziałek, 2 stycznia 2017

LSTM - recurrent neural networks

Since september, I was focused on my graduation project. I was working with my two friends and one of the topics was classification of data. We have to recognize gestures from data which was comming from gloves equiped with accelerometer and magnetometer sensors.

There are several methods to handle that kind of problem: Dynamic Time Warping, Hidden Markov Models and neural networks. We decided to use LSTMs (Long Short Time Memory) - special type of recurent neural networks which is current "state of the art" for classification problems. That solution was introduced in 1997 by Sepp Hochreiter and Jürgen Schmidhuber (paper) and thanks to many succesful applications in that field becomes very popular.

Our application was written in C#. We was looking for framework which can be easily integrated, supports training on GPUs and of course allows to create LSTM networks. We found CNTK which is deep learning, open source framework developed by Microsoft. It is written in C++ and provides wrapping library for evaluation models in C#. It allows to build generic network model using SimpleNetworkBuilder, which is good entry point for beginners.

Some links related to LSTMs, classification:
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
https://colah.github.io/posts/2015-08-Understanding-LSTMs/
http://people.idsia.ch/~juergen/tpami_2008.pdf
http://www.cs.ucr.edu/~eamonn/DTW_myths.pdf