digiKam – Facebook export

I use digiKam as my primary photo manager, it’s a great professional tool for those work with media. Maybe you are one of these and you didn’t even noticed, look at your mobile phone probably you have hundreds (maybe even thousands) of pictures on it. If you sum the ones you take with your camera it will be even more, so after a few years some of us may have more than 100.000 pictures.

digiKam5.0.0-beta3-Lut3Dtool

This is why you need a photo manager and I would strongly recommend digiKam. I’ve been using it for years and I love it.

One part of taking pictures is be able to share them, digiKam supports exports to several social media web sites; Facebook, Igmur, Twitter, Flickr, etc.

Nevertheless the integration with Facebook is not working properly, and I doubt that the digiKam developers can do something here as it looks more of a Facebook issue. I’ve came out with a workaround that may help go around this issue if want to use the Facebook export function. Just follow these easy steps (I’ve done this with digiKam v5, but it will also work on v4):

  1. With your default browser log in to Facebook.
  2. Open digiKam from a console, just type digiKam on the command line.
  3. Inside digiKam go to menu export, choose export to Facebook.
  4. On the export dialog press change account.
  5. You’ll see that in the browser it just states success, nevertheless you don’t see the authentication link that you need to use to paste into the plugin dialogue.
  6. On the console where you started digiKam you have some of the debugging info of what is happening
    1. digiKam uses OAuth to authenticate with Facebook so look for a line like:
      • OAuth URL: QUrl(“https://www.facebook.com/dialog/oauth?xxxxxxxxxxxxx
  7. Copy the content of that line starting on “https://…token” (without the quotes)
  8. Enable debug mode on your browser (I use Firefox CTRL+SHIFT+C or F12)
  9. On the debug window select network and persistent, see selected options on image bellow:Spectacle.V19137
  10. Paste the URL that you got on this list step 7 on the browser
  11. On the debug window you should be able to see an entry like the one bellow, with a right click choose copy locationSpectacle.V19190
  12. Go to the digiKam Facebook export plugin window and just paste.
  13. YOU’RE DONE

Now you can share all those pictures to world 🙂

Just select the pictures you want, use the export plugin, choose your Facebook album (or create a new one within digiKam), choose to resize (or not the images). If you create a new album be careful with the the permissions you wish for the album, on the Add Album option you’ll be able to select who do you wish to share your pictures. By default all your friends will be able too see it, but this may not be right for all the albums so just choose careful your options, usually I choose only me and then on Facebook page I add who I want to share it with.

More about digiKam

  • A professional digital photo management application for KDE (it will work on Linux, Windows and MacOS), which makes importing and organizing digital photos a “snap”. The photos are organized in albums which can be sorted chronologically, by folder layout or by custom collections
  • Powerful, fast and automated tagging
  • An easy-to-use interface is provided that enables you to connect your camera directly and preview, download and/or delete your images
  • A Light Table function is provided. This tool assists artists and photographers with reviewing their work ensuring the highest quality only
  • Common filters are available out of the box, with side by side previews
  • Extensible by the use of plugins and recipes

Hope you enjoy this tool as much as I do.

Have fun,

Pedro Oliveira

 

Linux – Reset SATA device/bus

Sometimes a software/hardware error will lock your SATA device/controller. You may just reboot your OS and wish for the best, but you may also only reset the affected device, not the full system, bellow is how you can achieve this.

Before you apply the following commands make sure you are not using the SATA/SCSI  devices (ex. mounted filesystem, part of a RAID, LVM, BTRFS or ZFS volume). If the device is still in use please take action to stop it before you delete the device node or reset the SATA bus.

Pedro Oliveira

udev – Change network card label

udev

Several time I’ve been asked how to rename a network card label on a Linux system, this can be achieve by following the steps mentioned bellow.

Stop networking

service networking stop

The network kernel module needs to be removed, but first you need to identify the right kernel module

sudo lspci -k | grep -i -A4

ethernet 04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07) Subsystem: Sony Corporation Device 9099
Kernel driver in use: r8169
Kernel modules: r8169

Reload rules

udevadm control –reload-rules

Edit udev rules by editing the /etc/udev/rules.d/*persistent-net.rules, in the example bellow we will set previous eth0 to eth5

# PCI device 0x10ec:0x8168 (r8169)

SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”d4:3d:7e:xx:xx:xx”, ATTR{dev_id}==”0x0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth5″

 

Remove the module in question

rmmod r8169

I’m using an realtek chip on my Vaio laptop, you should replace r8169 with the module in your system
Request device events from the kernel

udevadm trigger

Start network

service network restart

Et voila! You should have now a network card named eth5 on your system.
If you want to learn more about udev and udevadm check the info here or just type man udevadm on the command line.

Have fun,

Pedro Oliveira

pv – Concatenate files, or stdin, to stdout, with monitoring

PV - botleneck

Few days ago I had the need to debug the output of a stream, the problem was that the output is bandwidth is not always constant and that seamed to affect the input application didn’t behave the same with different workloads.

A colleague told me to check pv. As I have never used it before I checked the man page first and it seamed promising. Bellow there are some details about it.

pv can be used to:

progress show progress bar
timer show elapsed time
eta show estimated time of arrival (completion)
rate show data transfer rate counter
average-rate show data transfer average rate counter
bytes show number of bytes transferred
format FORMAT set output format to FORMAT
numeric output percentages, not visual information

you can also change the standard behaviour of a pipe (and probably this is the most interesting part), you’ll be able to:

rate-limit RATE limit transfer to RATE bytes per second
buffer-size BYTES use a buffer size of BYTES
skip-errors skip read errors in input
stop-at-size stop after –size bytes have been transferred

Here are 3 pv usage examples:

Limit bw available within a pipe:

In this case I’ll limit the write of a file to 1024MB/s, while writing a 10MB file (please note that the limits on both dd and pv are in bytes)

dd count=10 bs=1048576 if=/dev/zero | pv -L 1048576 | dd of=to_delete.file
10+0 records in [1021kiB/s] [ <=> ]
10+0 records out
10485760 bytes (10 MB) copied, 9.84052 s, 1.1 MB/s
10MiB 0:00:09 [1.01MiB/s] [ <=> ]
20400+100 records in
20480+0 records out
10485760 bytes (10 MB) copied, 9.93452 s, 1.1 MB/s

Write only a 5 MB file from the pipe:

dd count=10 bs=1048576 if=/dev/zero | pv -S -s 5242880 | dd of=to_delete.file
5MiB 0:00:00 [92.4MiB/s] [===========================================>] 100%
10240+0 records in
10240+0 records out
5242880 bytes (5.2 MB) copied, 0.073623 s, 71.2 MB/s

Increase the buffer size for faster transfers

With default buffers (512KB):

dd count=500 bs=1048576  if=/dev/zero | pv | dd of=/dev/null
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 0.684948 s, 765 MB/s
500MiB 0:00:00 [ 731MiB/s] [ <=>                                                                       ]
1024000+0 records in
1024000+0 records out
524288000 bytes (524 MB) copied, 0.683847 s, 767 MB/s

With a bigger buffer (5MB):

dd count=500 bs=1048576  if=/dev/zero | pv -B 5242880 | dd of=/dev/null
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 0.667252 s, 786 MB/s
500MiB 0:00:00 [ 750MiB/s] [ <=>                                                                       ]
1024000+0 records in
1024000+0 records out
524288000 bytes (524 MB) copied, 0.667482 s, 785 MB/s

If you want to have more information or check some other use cases you may check this post on cyberciti.

See you next time,

Pedro Oliveira