01 paź

How to fix Magic Keyboard (w/o Numeric pad) to work correctly with Ubuntu 20.04 LTS

If you would like to enjoy typing your favourite keyboard on Ubuntu as well, you need to change mapping on keys like:

  1. Left Control to Left Win
  2. Left Win to Left Control
  3. Right Option to Right Command

First two steps we will achieve using gnome-tweak-tool (how to install, check here). If you have installed successfully, open it, go to Keyboard & Mouse section -> Additional layout options -> Ctrl postion and check as shown on the picture below:

The 3rd step doesn’t work for me while I set up it through tool above. But it is quite simple to use it by one-liner in /etc/rc.local. I had to created it manually and configure permissions to chmod 755

#!/bin/bash
# switch opt with command key
echo 1 | tee /sys/module/hid_apple/parameters/swap_opt_cmd

And that’s all, now you can use commands and diacritics like on your mac 🙂

03 mar

Digital thermometer based on Arduino with 4 digit 7 segment display

DSC01199

1 x Arduino (in my case it was Arduino Mega 2560 rev2)
1 x PCF8574 expander
1 x 4 digit display with common anode (my was FJ-5461BH)
1 x temperature sensor MCP9700AE
8 x 220 Ohm resistors
some connectors

If you want to build your own simple digital thermometer just for fun, this tutorial is for you. All the „ingredients” you can buy on ebay, aliexpress or in your local electronic shop. The temperature sensor can be replaced with other one, but you need to discover how to connect it to the rest (especially check the operating voltage and pins). Different will be also way to calculate temperature basing on the output voltage. Read More

09 wrz

Android: MapFragment nested in parent fragment

Would you like to show map in your smart Android app? It is very easy, but after successfully passed some steps. In this tutorial I would like to make these steps with you to make the process faster and in a specific case – we will show our map in nested fragment.

Before funny work with the Android code we need to go through basic checkpoint list:

  1. Check if you have installed a Google Play Services in your Android SDK Manager. If no of course please install it! Second part of this point is to import the google-play-services-lib project into your workspace.
  2. Find your debug.keystore (or other) to list some details about it (like SHA-1 hash which is extremly important to accomplish next step.
  3. Create Google Maps API Key basing on SHA-1 from 2nd step and your application package name.

Read More

09 kwi

Fixing CVE-2014-0160 openssl critical bug on Debian in Apache with mod_ssl enabled

debian-logoIf you found this article, probably you would like to quickly upgrade openssl on your Debian instance. Bug CVE-2014-0160 is very dangerous – more about this bug you can read here.

  1. First of all, please check on this site, if your site needs to be fixed.
  2. if the result is positive(red) you need to perform actions below:
    apt-get update
    apt-get install libssl-dev libssl1.0.0 openssl
    service apache2 reload
  3. Perform test (1) once again. Now test should be negative (green).
19 mar

Android: Not enough memory for apps? Move non-moveable apps to sd card!

Insufficient storage for Android apps? Move apps which you think are non-movable to your SD card (like Google Drive, YouTube, Maps, some keyboards like Swype + Dragon) and save space on your internal storage. To do this, you will need to download Android SDK Tools and execute only two commands in Command Line / Shell console. Read More

20 lut

Android with Eclipse: Conversion to Dalvik format failed with error 1 [solved]

During compiling some Android projects using Eclipse I had regular problems with exporting signed apk file. It is a known problem and everyone has his own solution to fix the issue. For my projects where I included many apk libs or jar files (Actionbarsherlock, gson, etc…) every export was finished with result:

Eclipse Android dalvik format failed with error

Conversion to Dalvik format failed with error 1

or my Eclipse crashed or the package was corrupted 🙂 It was very frustrating. It was not problem with Proguard. The solution is very simple. Before you start to create signed apk file you should:

  • go to Project menu -> disable Build Automatically…
  • after that Project -> Clean.. and clean all yours projects you use to create your apk ( uncheck Start a build immediately)

eclipse.clean_.android.without.recompile

  • and now right click on the project -> Android tools -> Export signed application package…

Works for me on my workstations with Windows. And you still have problems with that?

13 lut

Piwik Real-time map: There is no data for this report – tutorial

If you also have a problem with real-time map in your piwik portal, here is a short description how to make it available in a few points. Let’s do it!

sudo apt-get install php5-geoip php5-dev libgeoip-dev
sudo pecl install geoip

add to php.ini

extension=geoip.so
geoip.custom_directory=/path/to/piwik/misc

Then restart webserver andgo to  Piwik > Settings > Geolocation, then choose the GeoIP PHP

If you want to know locationsof your visits before you have installed GeoIP feature run this script in /path/to/piwik/misc/others

php ./geoipUpdateRows.php
25 sty

Drag and drop rows to reorder your DataTable in Primefaces

primefaces

In Primefaces you can drag&drop your columns using widget Datatable to change order of them, but there is no out-of-the-box action to reorder rows. Code snippets attached below will help you implement such custom functionality.

  1. We need to add some JavaScript (JQuery) in your JSF page to make Datatable sortable and to disable selection mode. Listed below doReorder() method gets the new order of the rows and save to order_q variable: Read More