QFakturat – program do zarządzania fakturami, produktami i danymi klientów na Linux

Kilka lat temu, żeby zdobyć trochę doświadczenia poza Java i Ruby, zabrałem się za naukę Qt4.8 i C++. W ramach tego ćwiczenia zacząłem pracować nad aplikacją, która nie istniała wtedy na Linuxa i pewnie do dziś jest tego typu unikalnym programem na pingwina i diabełka.
Aplikacja była pisana na wymogi prowadzenia firmy taty, gdzie z względu kosztów licencyjnych zrezygnowaliśmy ze środowiska Windowsa. W firmie od 6 lat używane są tylko systemy Linuxowe (KUbuntu i openSUSE).

QFakturat był pisany początkowo w Qt4.8 na Linux, jednak z czasem części kodu zostały przepisane na Qt5 oraz dodana została kompatybilność dla systemów *BSD. Nigdy nie próbowałem portować aplikacji na Windowsa ani OS Xa, więc nie jestem w stanie powiedzieć, czy działa.

Screenshot_20160509_150456

Obecna funkcjonalność programu:

  • wystawianie faktur w PDF (i tylko PDF)
  • obsługa kilku sprzedawców
  • zapisywanie/edytowanie/usuwanie klientów
  • zarządzanie produktami
  • automatyczne konwertowanie kwot brutto<->netto<->podatek przy zmianie jednej z wartości
  • spersonalizowane faktury – pozwalają na ustawienie własnego tekstu w stopce faktury i na lewym boku
  • 3 skórki programu
  • walidacja i opcjonalne formatowanie NIPu
  • wysoka elastyczność programu (sam możesz ustawić rodzaje faktu, listę stawek VAT, metody zapłaty, czas na zapłatę czy obsługiwane waluty)
  • zarządzanie produktami i filtrowanie sprzedanych/dostępnych produktów/usług.

Continue reading

Timelapse using Raspberry Pi from my sea-front flat

I made a timelapse video using Raspberry Pi from my sea-front flat in Aberystwyth where I studied for 4 years.

Bash script was called every 30 seconds to take a picture for 4 days. To prevent running out of space on a SD card there was another cron job setup to move all existing images to my laptop using scp. After some selection (removed some first and some last images) I got 17.4GB of pictures which were composed into this timelapse without any scaling.

Timelapse from sea-front in Aberystwyth

XXX loves opensource…

…that’s why we published our product on OSI-compatible license! We <3 open-source!

Well, does Microsoft/Google/Apple/Netflix/XXX really love open-source?

No, they don’t. In fact they do more to extinguish open source by fighting them with patent wars, you don’t hear about, developing DRM, you hear about when it’s too late and dropping support for some key-products on open source platforms. Skype on Linux, anyone? Google Drive client on Linux? DRM enabled by default in browsers, anyone?

Continue reading

Setting up SonarQube for Android Gradle project to improve code quality

I’m working on a new Android project which I inherited. Well, I forked it because I didn’t feel welcomed to contribute to the project and I see a lot of places where improvements are needed.

First, I need to improve the codebase. Previous developers didn’t care about any Java coding guidelines from Oracle, Google, CERT or even Android. Some of the problems I have to solve now are:

  • inconsistent style
  • catch (Exception e){}
  • catch(Throwable e){}
  • ArrayList<Object> list = new ArrayList<String>()
  • complex methods – if {switch {for {if {else {}}}}
  • new Thread().start()

To quickly start clean-up and identify those problems, different static code analysis tools can be used; one of them is SonarQube.

Continue reading

What the hell, something broke my packageManager on Android.

Because I work on a laptop, I was experimenting with different wireless adb apks for Android, having a cable under my hand isn’t too handy. After a few tests I started getting that error:

com.android.ddmlib.InstallException: Unknown failure (/system/bin/sh: pm: can't execute: Permission denied)

Didn’t tell me much. I started Googling… No results. Ok, one result… taking me to Gitlab-CI of my project. So I had this before. I didn’t solve it, don’t know why. Probably because it was when I was experimenting with different ROMs on my another device. So I “fixed” it by reinstalling ROM, and it came back.

Not many things where helpful online so I had to find solution myself and here I present it to you, and to future me, when I have this again.

Continue reading

Content-Security-Policy for WordPress with Disqus…

…that works in nginx:

add_header Content-Security-Policy
    "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' agilob.disqus.com disqus.com a.disquscdn.com referrer.disqus.com;
      img-src 'self' agilob.disqus.com disqus.com a.disquscdn.com referrer.disqus.com;
      style-src 'self' 'unsafe-inline' agilob.disqus.com disqus.com a.disquscdn.com referrer.disqus.com;
      font-src 'self';
      frame-src 'self' 'unsafe-inline' agilob.disqus.com disqus.com a.disquscdn.com referrer.disqus.com;
      object-src 'none'";

Qt5 on FreeBSD

For a reason FreeBSD doesn’t support Qt5 build tools out of box. There are a few problems that have to be solved before you can run qmake && make to build a project. Firstly, my default setup didn’t have QMAKESPEC specified, add this line to your .bashrc/.zshrc:

export QMAKESPEC=freebsd-g++

Also add this line to specify Qt5 theme:

export QT_QPA_PLATFORMTHEME=qt5ct

Continue reading

FreeBSD on netbook – Acer Aspire

I recently acquired “new” netbook, it’s so old that most people would call it ancient. Its CPU is only 32 bit architecture, it’s not capable of playing 2k videos in 30fps, its computing power is lesser than my ARM tablet, but it still works, so why not use it for something.

I got it from a friend who was using Fedora. It was slow, even with openbox. dnf update was taking from a few to several minutes, I had to install something faster. At first, Debian with LXDE. First installation attempt failed with some problem with GRUB, it wasn’t a good sign, I didn’t investigate the problem to get it working asap. I restarted bootloader installation with LILO which succeeded. Debian was still slow. Package installation was taking long, deb processing was taking long and I was sitting there and waiting for it to finish. Launching Firefox was taking even 30 seconds, videos on youtube were lagging even on 30fps. I really expected more from this 10 years old hardware. I decided to use it for my experiments and try something new. I decided to look at BSDs. OpenBSD would work here, it’s fast, secure and it like ideology behind it, but I don’t think it would work on semi-destkop netbook for me. I read about DragonFlyBSD and was impressed what creators did with kernel and distribution, wanted to give it a try, but they don’t support i386. There are two BSD distributions dedicated for desktop computers, DesktopBSD and PC-BSD, I didn’t know with which one to go, so I took FreeBSD, they provide i386 memstick installer, so it was easy since beginning, or at least it was specific which image should be used.

Continue reading

Choose GitLab for your next open source project

GitLab.com is a competitor of Github. It’s a service provider for git-based source code repositories that offers much more than it’s bigger brother. In this post I will try to convince you to try it out for your next project.

GitLab is not only a simple git hosting; its features impact the whole development process, the way of contributing to a project, executing and running tests, protecting source code from changes, more and more.

gitlab-logo-square Continue reading

Boosting speed of OpenVPN connections

This year (2016) and last year, a few new laws were introduced by Cameron’s government, so I decided to get myself VPN. First, I tried a lifetime TigerVPN for 30$, nice deal. Unfortunately, TigerVPN doesn’t fully support Linux OpenVPN implementation. Connection is dropped when reaching ~900kb/s upload+download; network-manager tells that server time outed and it never reconnects due to… an authentication problem.

So I started looking for other affordable solutions. Two biggest competitors are PIA and TorGuard. I started reading discussions on reddit about those two, and it seems, there are very little differences. I was given a rolling promotion code for TorGuard, a 50% discount code that can be used after my 2 years long service comes to an end. It’s good.

Continue reading

JHLabs for Android

My major project in Java (Android) involved image manipulation where I used JHLabs. I found there was no easy way to add JHLabs support for Android without extracting sources and manually adding them to the project. So there it is now:
https://gitlab.com/agilob/JHLabs_android

It’s compatible with gradle build system, so you can easily add it to your gradle project.

To use it in your project:

  1. Go to the main folder of your application
  2. mkdir third_party
  3. Edit settings.gradle and add this line
    include 'third_party:jhlabs2'
  4. Add this line to your dependencies:
    compile project(':third_party:jhlabs2')
  5. It should be done now!

You can see it working in my project!

Lifetime VPN subscription from TigerVPN!

A friend notified me today about an offer on stacksocial where you can get lifetime TigerVPN for only 29$!

TigerVPN is one of the most respected companies that care about your privacy. According to this table, they are one of the best VPN providers, based on TorrentFreak survey from 2014. What’s most important, they claim not to keep logs, don’t yhgmm… respect DMCA, don’t block P2P and don’t try to identify users.

[Java] – Regular expression to match IPv4 address

I saw such question on SO. There was no solution with RegEx so… I was bored I think.

public static boolean isValid(String ip) {
    boolean isvalid;
 
    isvalid = ip.matches(
            "(([0-9]|[0-9]{0,2}|1[0-9]*{0,2}|2[0-5][0-5]|0{0,3}).){3}" +
             "([0-9]|[0-9]{0,2}|1[0-9]*{0,2}|2[0-5][0-5]|0{0,3})"
    );
 
    return isvalid;
}

Continue reading

Browsers addons reference

which every user should have to improve their privacy, security, save RAM and CPU

 

Also check out configuration guide for µBlock.

[Qt, C++, SQL] – How to work with SQL in C++ and Qt

You can work with SQL queries in Qt and SQL in many different ways, here I will show you how I came up with a working method. To keep things simple, I am not going to use any UI to print or edit queries. It will be just source code and stdout, as a database engine I will use SQLite3.

After you created your project, edit project.pro and locate line:

QT       += core

Modify this line by adding `sql`:

QT       += core sql

Since now, when you compile your project, QtSql module will be linked to the project:

g++ -Wl,-O1 -Wl,-O1,--sort-common,--as-needed,-z,relro -o QtSql main.o   -lQt5Sql -lQt5Core -lpthread

Continue reading