flanaras' adventures

Anything that I might come along :)

Install Slack on openSUSE Leap 42.1

If you are trying to install slack from their fedora x64 package on openSUSE Leap 42.1 and you find that libXScrnSaver is missing and you can’t find it anywhere to install in, don’t worry! You actually don’t need this package. The package you need is libxss1.

Tested on: Leap 42.1, tumbleweed and Leap 42.2


Slack 2.0.2 working on openSUSE Leap 42.1

The first step is to be sure that you have libXss1 package. You can do this using the “1 Click Install” or simply type in a terminal:

 > sudo zypper in libXss1

Next step is to install slack. In my case I achieved this by typing: /* Note that you need to have in the same folder as the working folder in terminal */

 > sudo zypper in slack-2.0.2-0.1.fc21.x86_64.rpm

When you do so, you will get prompt to cancel the installation or to break slack by not providing a missing dependency. /* What actually happened with this is is that the package got renamed from libXScrnSaver to libXss1 but slack is still searching for the old name for some reason. I don’t know if it is available through repositories in fedora but it’s definitely not here on openSUSE.*/ Choose to break the installation and you’re done. You successfully installed slack on your openSUSE box!

To enable the auto-update function (as @Stane1983 said) you need to do one more step.

“While Slack installs it’s repository into system for update checking, it does not import GPG key of it’s repository which breaks software updates. To fix that issue, simply import GPG key by opening terminal and typing:

 > sudo rpm --import

“, as stated on his post [].

This is not only bound to Leap 42.1, it’s going to work with the rest of openSUSE’s versions. Probably it’s going to work for other rpm based distributions.

Until next time enjoy yourselves! 🙂

— flanaras

— update [19/03/2017]: Add instructions for auto-update.



Install Spotify on openSUSE Leap 42.1


If you want to install Spotify on openSUSE and you see that Spotify doesn’t provide rpm binaries don’t worry, you can still do it!

Image with Spotify working on openSUSE Leap 42.1


It seems that there are two possibilities, on my installation of openSUSE I can use the script and download and package Spotify, although on a fresh installation the script will fail. You can try method (1) and check if it works, if it doesn’t the method (2) is for you.

Method (1):

Start by cloning the repository [opensuse-spotify-installer (master)]

After that, run: (at some point you will be asked to enter your root password)

 > ./

It will take some time to download and install. In order to run it type:

 > spotify


Method (2):

In this method clone the repository [opensuse-spotify-installer (old-but-working)]

Edit the version names and to the ones given at Spotify’s repository into and spotify-client.spec, then comment out {line #103} from file spotify-client.spec [%suse_update_desktop_file $desktop] and run:

 > ./


wait until it installs and launch it as in method (1).


— You can uninstall it by:

 > rpm -e spotify-client


 > ./ -u


Enjoy your music! 😀


— edit: changed the link of the repository to my fork, the repository I forked doesn’t work on leap after he updated his version.

— update [27/05/2016]: The repository that I cloned, got updated and now works with openSUSE Leap by default. Instructions got updated.

— update [20/06/2016]: Changes from the last update don’t work on a fresh installation.

** Now the original repository may work but I redirect to mine in the case he does any changes and doesn’t work any more on Leap.

Connecting PHP with the Mongo Driver

Hello again,

Another challenge that I came over was to connect my PHP installation 5.5 with a MongoDB 3.2.

The mongodb-php-library isn’t well documented in my opinion. They don’t tell you how to do it or where to get the dll extension and what you need to do.

This is the new driver (mongodb) or php library as they call it. The old one is mongo, look this it doesn’t have the db in the end.

First of all you need to download and install composer. During the installation you will have to point to your php installation, if it doesn’t locate it by itself.

Then you need to download the mongodb extension which is appropriate for your version. Note, in order to get the correct file you need to press the DLL next to the windows logo. After that you will need to choose your php version, architecture 32 vs 64 bit and thread safe or not libraries. I would suggest to get the thread safe. In my case I got the version 1.1.1 => php 5.5, 32 bit and thread safe.

Next thing to do is to go to your php folder. You will need to copy your dll file to <path-to-php>/ext and edit <path-to-php>/php.ini and add the following line:


Restart your Apache server and go to the folder/project that you need to install the mongo driver, i.e. htdocs/mongoTest.

Open a command prompt there, a simple way is to right to do that is to right click on the folder that you want to open it while pressing shift, you shouldn’t have selected any files when you press the right click, and then would be a hidden option that will show <open command window here> and will open a cmd at that path 😀


> composer require "mongodb/mongodb=^1.0.0@beta"

This will make composer to download this library, mongodb, and the current folder. Notice that a new composer.json file was creating, which contains all the libraries and other restrictions in order to make your project run, for example mongodb lib and php >= 5.5.

To test that everything is set up correctly, make a new php file with the following code and replace your values, host/port, dbname and collection


//This line is to include the dependencies 
require 'vendor/autoload.php';

$serverName = "localhost";
$port = 12345;
$manager = new MongoDB\Driver\Manager("mongodb://$serverName:$port");
$collection = new MongoDB\Collection($manager, "database.someCollection");

//get all items
$result = $collection->find();

foreach ($result as $entry) {
    //print element _id and time
    echo $entry->_id, ': ', $entry->time, "</br>";

echo "IT works!";

Run it and if you have done everything correct it will work!

The way to access your values in the this driver is to directly access the $result-> members!




MongoDB: The toJson() problem

Currently I’m using MongoDB on a project and I’m accessing it through the Java driver 3.x.

The problem that I had, and some other people on stackoverflow but there were no answers, comes when you try to retrieve a document that you inserted in the JSON format, it returns it in JSON extended format or in JSON but in an altered structure.

Using this piece of code I get a wrong result:

Document document;
String json = document.toString();

I’m get this and this isn’t what I inserted in the database.

"source_status_id" : { "$numberLong" : "68578585501732352" }

This is what I inserted and want:

"source_status_id" : 68578585501732352

The way to overpass this problem is to create a JSONObject from an other library ie twitter4j and then use the toString() method from that object…

Document document = document;
String json = new twitter4j.JSONObject(document).toString();

Which works as a charm and returns it in the original JSON format! 😀

Twitter4j: Status object from/to String JSON

Have you ever worked with Twitter and twittter4j and wondered how to parse a Status object to a String in JSON format and the other way around??

Here is the solution!!

To convert it to the JSON string you just need to do this:

Status tweet;
String tweetJson = StriTwitterObjectFactory.getRawJSON(tweet);

And from the JSON string to Status:

String json; //a valid json string
Status status = null;
try {
    status = TwitterObjectFactory.createStatus(json);
} catch (TwitterException e) {

The exceptions it throws is in the case that the string you provide is not a JSON valid String.

Simple as that!

I’m Back

Hello world, I’m back on-line!

New snf

snf that is in use now:

Hello There 😀

Create a free website or blog at

Up ↑