onsdag den 31. maj 2017

Podcasts in UE Smart Radio

I upgraded my Squeezebox radio to UE Smart Radio.
By doing that I thought I lost the ability to access podcasts from the Squeezebox.
Browsing the logitech forums it turned out that with the TuneIn radio application it was still possible to play podcasts on the Squeezebox radio.

Here is the procedure:

1. Create a user on tunein.com
2. Go to "Favorites" on tunein.com and add a "Custom URL"
3. Add the URL to the podcast you want to access from your Squeezebox
4. Go to uesmartradio.com and log in
5. Add the TuneIn Radio service to your Squeezebox Radio with the user created in step 1.
6. Now go to the TuneIn Radio application on the Squeezebox and go to Radio > My Presets > Shows

Kubuntu 16.04 on Lenovo P50

I have been running openSUSE for years.

When I got the Lenovo P50 laptop with a HiDPI screen I was not able to get the Nvidia proprietary driver to run with the resolution I wanted.

It turns out that there is more to HiDPI than just the driver. And the fact that I have an external monitor that is not HiDPI probably makes it even harder.

Nevertheless I have colleagues who were able to get the same hardware to work with the proprietary Nvidia driver. They were running Linux Mint Cinnamon Edition. I'm not sure which version actually.

I ended up trying out Kubuntu to figure out if that would help. It did not. I got the exact same issue as I had with openSUSE.
But not only that. I had issues with things that worked in openSUSE Leap 42.2. Sound wouldn't always play through headphones. The only workaround I have found is to restart the OS.
My music streaming service that is based on the browser sometimes don't play any songs when I click play. The browser I use is Google Chrome but the web application is not as stable as in the same browser in openSUSE.
Adding the smb based network printer at work is not possible through the printer configuration interface. YaST on openSUSE was able to do this.

I am considering multiple things to do from here:
  1. Go back to openSUSE Leap (maybe wait until 42.3 at the end of July)
  2. Try Linux Mints KDE version.
On top of that it would probably also help if I got a HiDPI monitor to connect to my laptop.
The Wayland display server protocol should also be much better at handling the combination of HiDPI and non-HiDPI monitors. It does not seem like Wayland is ready for primetime yet though. Fedora has Wayland as default display server. So that could be a possibility.

fredag den 16. oktober 2015

FreeOTP icon fix on Android

This guide is a workaround for:
https://fedorahosted.org/freeotp/ticket/51

How to backup your FreeOTP tokens is described in this ticket.
To backup your tokens run:
adb backup -f freeotp.bak org.fedorahosted.freeotp

Next we need to extract the backup to edit it. (How to extract the backup)

First run this command:
dd if=freeotp.bak bs=24 skip=1 | openssl zlib -d > freeotp.tar
OR
java -jar abe.jar unpack freeotp.bak freeotp.tar <password>

Then extract the tar archive and the list of files in the tar archive:
tar -tf freeotp.tar > freeotp.list
tar -xvf freeotp.tar

Now edit apps/org.fedorahosted.freeotp/sp/tokens.xml
Look for a string like this:
content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F<unique number>/ACTUAL/<SOME NUMBER>

Change it to:
content://media/external/images/media/<unique number>
The number <unique number> should be replaced with the actual number in your string.

Now pack the updated file:
cat freeotp.list | pax -wd > freeotp.tar
java -jar abe.jar pack freeotp.tar freeotp2.bak

Then restore the backup
adb restore freeotp2.bak

torsdag den 13. november 2014

Connect to postgresql 9.2 server in openSUSE 13.2

I tried to connect to my postgresql server after upgrading to openSUSE 13.2 from 13.1 using the guide from opensuse.org
That resulted in this error message:

psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


There was no files in /var/run/postgresql/. So that explained why it could not connect to that Unix domain socket.
So where was the socket? Reading this answer I found that I could run this command to figure out where the socket was:
~> netstat -nlp | grep 5432
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      12827/postgres     
tcp        0      0 :::5432                 :::*                    LISTEN      12827/postgres     
unix  2      [ ACC ]     STREAM     LISTENING     10994605 12827/postgres      /tmp/.s.PGSQL.543


That indicated that the socket was located at /tmp/ instead of /var/run/postgresql/ I was then able to find an explanation here

With that in mind i tried to connect with /tmp/ as host:
~> psql -h /tmp/
psql (9.3.5, server 9.2.7)
Type "help" for help.


That worked and as you can see the server and the client versions does not match. That could explain why the client was compiled with a different default host. Next thing could be to try to update the server from 9.2 to 9.3.

mandag den 6. januar 2014

Get Notes 9.0.1 to run on openSUSE 13.1

I installed openSUSE 13.1 just a week after its release. Unfortunately IBM Notes 9.0.1 crashed so I had to revert back to 12.3 since I wasn't able to fix the issue on my own.

By now the community have done what they do best and come up with a solution that makes it possible to run Notes 9 on openSUSE 13.1.

The issue was reported on the lotus forum.

In the response from Ben Kevan there was a link to a workaround that could get notes to run on openSUSE.

Apparently there is a bug that might be related to KDE. It has been filed on the KDE Bugtracking System as bug 329445.

Btw I am using the 64 bit version of openSUSE.

mandag den 26. august 2013

Cisco UCS XML API Event from java

I've been working professionally on an integration with the Cisco UCS Manager. Their API is non-standard. It isn't SOAP or REST or any other well known protocol. But it seems that there are actually good reasons for this. It is easy to write scripts that uses the XML API.

I did not need to write scripts though. I had to implement a java client. There were limited resources available on the subject so I wanted to post what I came up with for subscribing for events.



    public void subscribe(String host, String port) throws InterruptedException, IOException, HttpException {
String subscribeRequest = "<eventSubscribe cookie=\"\"><inFilter></inFilter></eventSubscribe>";
        HttpClient httpclient = new DefaultHttpClient();

        try {
            HttpPost httpPost = new HttpPost(MessageFormat.format("http://{1}:{2}/nuova", host, port));

            httpPost.setEntity(new StringEntity(subscribeRequest));

            // Execute HTTP request
            HttpResponse response = httpclient.execute(httpPost);

            // Get hold of the response entity
            HttpEntity entity = response.getEntity();

            // If the response does not enclose an entity, there is no need
            // to bother about connection release
            if (entity != null) {
                InputStream instream = new BufferedInputStream(entity.getContent());
                try {
                    generateEventsFromStream(instream, new EventCallBackHandler());
                } catch (RuntimeException ex) {
                    // In case of an unexpected exception you may want to abort
                    // the HTTP request in order to shut down the underlying
                    // connection immediately.
                    httpPost.abort();
                    throw ex;
                } finally {
                    // Closing the input stream will trigger connection release
                    try {
                        instream.close();
                    } catch (Exception ignore) {
                    }
                }
            }

        } finally {
            // When HttpClient instance is no longer needed,
            // shut down the connection manager to ensure
            // immediate deallocation of all system resources
            httpclient.getConnectionManager().shutdown();
        }
    }


    public void generateEventsFromStream(InputStream is, EventCallBackHandler callBack) throws IOException {
        if (is != null) {
            // Writer writer = new StringWriter();

            StringBuilder builder = new StringBuilder();
            char[] buffer = new char[1024];
            int inEid = -1;
            try {
                Reader reader = new BufferedReader(new InputStreamReader(is));
                int n;
                while ((n = reader.read(buffer)) != -1 && !stopRequested) {
                    builder.append(new String(buffer, 0, n));
                    int indexOfDelimiter = builder.indexOf(delimiter);
                    if (indexOfDelimiter != -1) {
                        String event = builder.substring(0, indexOfDelimiter + delimiter.length());
                        int indexOfStart = event.indexOf("<methodVessel"); //$NON-NLS-1$
                        event = event.substring(indexOfStart);
                        callBack.eventOccured(event);
                        builder = new StringBuilder(builder.substring(indexOfDelimiter + delimiter.length()));
                    }
                }
            } finally {
                is.close();
            }
        }
    }

When the Android device appears offline while trying to debug

I struggled a bit with my Android device appearing offline while trying to deploy an app I was working on to my phone. I was trying running adb devices to figure out if the system could communicate with the phone.

./adb devices
List of devices attached
<serial_number> offline 

At least since version 4.2.2, there is a security question that appears on the phone requesting RSA verification with the computer. Be sure your tools are updated AND you allow the PC access by verifying the security question on the devices in question. This fixed it for me. And as always, verify you have debugging enabled in the developer options ;)