29 August, 2017
Philips Hue API
Experiments with the Philips Hue API. It's possible to control the lights in multiple ways. The json body is easy to understand. The color system is a challenge. How do you get a color picker for it? We'll see.
26 August, 2017
Koala GUI won't run on Ubuntu
Here is the recipe. And the solution is:
32bit:
cd /lib/i386-linux-gnu/ or cd /usr/lib/
64bit:
cd /lib/x86_64-linux-gnu/ or cd /usr/lib64/
sudo ln -s libudev.so.1 libudev.so.0
09 August, 2017
Appjar Evening Coding Session
During this evening's coding session I created a primitive GUI in Python with Appjar. I just wanted to try out Appjar. Using it is a charm compared to the GLADE GUI builder or Tkinter.
For the code: click here.
08 August, 2017
Appjar
![]() |
| radioAppjar.py - stream running |
![]() |
| appJar GUI (very primitive, but WTH) |
Notes from my first fumbling with appjar. I'm looking for something that's more intuitive than Tkinter or Glade. Appjar is promising, at least for those of us with web programming experience. The code is somehow akin to JavaScript or even CSS.
The images above is my first GUI made in appJar. The files are available on Github.
Appjar is not standard Python, so the first task is:
Install appjar
# pip install appjar
The First File
# import the library
from appJar import gui
# create a GUI variable called app
app = gui()
# add & configure widgets - widgets get a name, to help referencing them later
app.addLabel("title", "My first Apphar")
app.setLabelBg("title", "green")
# start the GUI
app.go()
Get a value from a widget
.getEntry(title)
This will return the contents of the specified entry box.
NB. numericEntries always return a float..getAllEntries()
This will return the contents of all entries in the app, as a dictionary.
NB. numericEntries always return a float.
01 August, 2017
Libre Office - stop writing I when I want i
28 July, 2017
Reset Facebook Cache
Problem: Facebook won't show the correct social media tile.
Solution: You can reset the FB cache here:
https://developers.facebook.com/tools/debug/?hc_location=ufi
Related: http://ogp.me/
Error: App Id Missing
developers.facebook.com is a valuable tool. I got the error, that the app id was missing. The solution is to create an app in the Facebook Developer. Use the id from the app in the markup, e.g.
Solution: You can reset the FB cache here:
https://developers.facebook.com/tools/debug/?hc_location=ufi
Related: http://ogp.me/
Error: App Id Missing
developers.facebook.com is a valuable tool. I got the error, that the app id was missing. The solution is to create an app in the Facebook Developer. Use the id from the app in the markup, e.g.
<meta property="fb:app_id" content="123456789012345">
16 July, 2017
Lens Sweet Spot
| Aaarhus seen from my kitchen window today. |
During the hollidays I'd like my DSLR pictures to be sharp from the foreground to infinity. Most lenses has a sweet spot, where pictures are better. When you've found that it's a matter of point and shoot.
Some rules of thumb if you want a sharp picture from foreground to infinity.
When in doubt, try F8 - else try:
- 24mm ~ >= f11 <= f16.
- 35mm ~ f16 (street photo, 2m -> infinity sharp).
- 50mm ~ >= f22 (2m -> infinity sharp).
- > 80mm (no sharp foreground) f5.6 (from 100 m. -> infinity).
For most lenses the general rule is low f-stop + 2.
- e.g. 1.8/50 ~ f4.
If you want to find the real sweet spot for a lens, try settings as above. Shoot several pictures, and compare the sharpness on the PC. For every new picture add an f-stop.
Source, see this article.
A nice calculator is found here. Here is the result of the hyperfocal calculator:
Hyperfocal Distance
On Wikipedia you can see the formula for hyperfocal distance:
Sony a58
Change the autofocus area to 1/3 (probably it's in the center). Then you should have the correct focus, provided that the f-stop is on the sweet spot. Set aperture between >= 8 and <= 11, and set ISO to auto. Then it's a matter of "point-and-shoot". That would be a good street or landscape setting.
Tamron B018S
Look at this site for specifications.
There's a video with a german photographer using apertures ranging from 5 - 11, but more than often 5 or 8.
Tip:
Source, see this article.
A nice calculator is found here. Here is the result of the hyperfocal calculator:
![]() |
| From: http://www.cambridgeincolour.com/tutorials/hyperfocal-distance.htm |
Hyperfocal Distance
On Wikipedia you can see the formula for hyperfocal distance:
"In optics and photography, hyperfocal distance is a distance beyond which all objects can be brought into an "acceptable" focus." (from: Wikipedia)In theory we could create an app for the calculations, but ... in the field you just need something that works. I guess the rules of thumb will do the trick.
Sony a58
Change the autofocus area to 1/3 (probably it's in the center). Then you should have the correct focus, provided that the f-stop is on the sweet spot. Set aperture between >= 8 and <= 11, and set ISO to auto. Then it's a matter of "point-and-shoot". That would be a good street or landscape setting.
Tamron B018S
Look at this site for specifications.
There's a video with a german photographer using apertures ranging from 5 - 11, but more than often 5 or 8.
Tip:
- Try manual focus.
- Use A on your camera's settings ring.
14 July, 2017
High CPU speed reduced via BIOS
![]() |
| Low CPU usage after new BIOS settings (htop). |
On Ubuntu the average CPU speed was around 30%, which seemed a bit over the top. After some research I found a thread, arguing that the reason might be the power management. In the BIOS I set the low power management to off.
![]() |
| Ubuntu's system monitor. Browser open, listening to Spotify. |
- Motherboard: Gigabyte H170N-WIFI-CF.
01 July, 2017
Swappiness
![]() |
| Swappiness: note that swap = 0 (htop). |
Noted that the swap disk often was active. But the system had sufficient RAM. Research suggested, that the swappiness should change to 10. Tried it, and now the system seems to behave as I want i to.
Swappiness values:
- 0 => only use swap if all RAM is used.
- 10 => use swap if needed if around 80 - 90% of the RAM is used.
- 100 => swap is on always.
100 may be a solution on old systems, if you cannot upgrade RAM the swap can save the day. Whether this is heathy for the harddisk, I don't know.
27 June, 2017
Linux: Where are the Applications? How can I launch my own hacks?
Q: So where are the Applications in Linux?
A: /usr/share/applications/
Create a shortcut to this folder in your file manager, and you've got something like the Mac Applications folder.
Q: That's fine - but how about my own homemade hacks.
A: Yeah, create a hidden folder in your home directory. Add a launcher there.
Q: Launcher?
A: A file with the extension .desktop - like this:
[Desktop Entry]
Name=YourHack
Exec=/pathTo/yourHack
Icon=tux.png
Type=Application
Categories=GTK;GNOME;Utility;
A: Save your hack as, say myHack.desktop. Make the file executable:
# chmod a+x myHack.desktop
A: Now you should be able to see the icon in the folder. The last step is simple - in say Ubuntu just drag the file to the panel. Other windows managers may add the app launcher in other ways.
A: /usr/share/applications/
Create a shortcut to this folder in your file manager, and you've got something like the Mac Applications folder.
![]() |
| /usr/share/applications |
A: Yeah, create a hidden folder in your home directory. Add a launcher there.
Q: Launcher?
A: A file with the extension .desktop - like this:
[Desktop Entry]
Name=YourHack
Exec=/pathTo/yourHack
Icon=tux.png
Type=Application
Categories=GTK;GNOME;Utility;
A: Save your hack as, say myHack.desktop. Make the file executable:
# chmod a+x myHack.desktop
A: Now you should be able to see the icon in the folder. The last step is simple - in say Ubuntu just drag the file to the panel. Other windows managers may add the app launcher in other ways.
26 June, 2017
MySQL Workbench
MySQL Workbench is a GUI for database development. Perhaps it's a better tool when teaching databases than the PhpMyAdmin.
MySQL Workbench
The workflow could be:
MySQL Workbench
The workflow could be:
- Pen & paper for the first drafts (alternative: Dia, if you want something on a screen).
- ER-D and database development in MySQL Workbench
- Implement the database in PHP via MySQLi.
- Visualize the data in creative UX solutions ...
20 June, 2017
Experiments in C
So i had a holliday. I've programmed for years, but strangely enough never in C. Why not try it out? I used:
- gcc as a compiler
- nano as the editor
So much for the software architecture. I followed these tutorials, and found that the learning curve to C is akin to PHP and JavaScript. The variables are defined in a different way. But loops are pretty much the same thing. Here's a sample from one of the tutorials.
#include
int main () {
int a;
/* for loop execution */
for( a = 10; a < 20; a = a + 1 ){
printf("value of a: %d\n", a);
}
return 0;
}
The main difference is compiling. So save the code above in say myForLoop.c. Then compile the file, like this:
# gcc -o myForLoop myForLoop.c
Now you can execute the file in a Linux terminal:
# ./myForLoop
Virtualbox: shared folders and Linux
![]() |
| Linux Mint in Virtualbox: shared folder with a dummy file (# touch x) |
- Add a shared folder via Virtualbox / Settings / Shared folders
- The folder will mount in /media/yourSharedFolder
If you then try to mount the folder, there will be a message like "missing permissions". So the folder is there, but only the root user will have access to this paradise. The solution is this shell command:
# sudo usermod -G vboxsf -a YourUserNameHere
You'll have to reboot the system. Then lo and behold, you can try this in a terminal window:
# touch /media/yourSharedFolder/x.txt
If the file is created the hidden entrance to the palace of the king is open. Of course you could just open the folder, and add a file. But that solution is so last century.
18 June, 2017
Ubuntu: failed to connect fo lvmetad
![]() |
| Phew ... all's well that ends well. |
Had this error: "Ubuntu: failed to connect fo lvmetad". Ubuntu booted into a shell. The /home partition was not mounted. I tried to edit the fstab, but the /home share would not mount on boot.
However it was possible to mount the drive, like:
# mount -a
In the failsafe Ubuntu version I cound boot into a menu, with several options. If a fsck was run, the /home would mount, and the boot process could continue.
An error message stated, that there was an error on the /dev/sda5 - and Ubuntu recommended a "manual fsck".
So I booted into the shell, and ran fsck. There were tons of errors, Basicly the prompt asked "shall I repair this or that error". I answered "y" every time. Fsck found some 30 - 40 errors. Then fsck stated, that the system was clean.
I booted ... and ...
to my great surprise everything worked. As in: OK!
During the failsafe mode the CPU ran like hell: 50% or more all the time. The temperature was not a problem. But of course the fans ran like hell. Now everything is back to normal. The CPUs run around 20% when I use a browser, Spotify and what not.
So we're back to normal after a weird trip to shell-land.
13 June, 2017
27 May, 2017
Shotwell - well?
I just can't figure out how to import pictures ... so I googled. Just to find out: I'm not alone.
27 April, 2017
Mobile and Web - use the USB!
It's faster, and possibly more secure to use the USB rather than the WiFi-option. You'll need a cord. So what. The upside is the speed.
29 March, 2017
mplayer and .pls
![]() |
| A SomaFM stream in the shell. |
Here's a how to play SomaFM's playlist "Groove Salad":
# mplayer -cache 1000 -cache-min 80 \ # -playlist http://somafm.com/groovesalad256.pls
NB: In the terminal it's just one line of code. The "\" marks the linebreak.
25 March, 2017
OGP test
My link on Blogger:
http://multimusen.dk/
Compared to pasting my link on Twitter:
For some reason the image isn't visible on Facebook.
Unfortunately Blogger doesn't use the OGP. Or at least so it seems.
http://multimusen.dk/
Compared to pasting my link on Twitter:
For some reason the image isn't visible on Facebook.
Unfortunately Blogger doesn't use the OGP. Or at least so it seems.
01 March, 2017
Strange Pandoc Error Message
Got the error message: "Reference book not found" from citeproc. However the problem was not the reference. The problem was a code section. By mistake I had only three tildes. So I looked for the error, where the error was not.
26 February, 2017
g180 Orion Spectrum
Got this Logitech keyboard. Looking for Linux drivers for the keys. A workaround used by many: configure the keys via Windows. Perhaps wine? So far I'm looking for a better solution than Redmond's.
Installation on Ubuntu
Install this library: https://github.com/MatMoul/g810-led
Make sure, that dependencies are met. I had to:
# sudo apt install libhidapi-dev
# make
# sudo make install
Then g810-led ran by:
# g810-led
Load a profile
#g810-led -pp < /etc/g810-led/profile
This will load a profile. You can write your own. Here's a bash file:
# Profil: 20170227
# Tastatur G810 Orion Spectrum
#
g810-led -g logo 330033
g810-led -g indicators 4c9900
g810-led -g fkeys 990000
g810-led -g modifiers 990000
g810-led -g multimedia 4c9900
g810-led -g arrows 003300
g810-led -g functions ffffff
g810-led -g keys 4c0099
g810-led -g numeric ffffff
#
# save settings
g810-led -c
But it's more elegant to load a profile, the format is:
# Vars
var brun 993300
var groen 009933
var blaa 330099
# All green
a 006600
# Groups
# Set key groups
g logo $brun
g indicators $groen
g mute $brun
g multimedia $brun
g fkeys $blaa
g arrows $brun
# Keys
k space $brun
k win_left $brun
k alt_right $brun
k num5 $brun
# commit
c
The last c is important. It will execute the orders. Note the usage of variables. It's quite handy.
Load the g810-led keyboard on boot
This can be done in sevearal ways. It may be deprecated, but creating:
/etc/rc.local
With this content does the trick:
g810-led -pp < /etc/g810-led/profile
You can even restart the file as a service:
sudo service g810-led restart
So basicly this is all you need in order to have a cool layout at the boot time.
Issues
The library works .. that is sort of. Sometimes a key or two will miss. Restarting the service helps. So the library is still in a process of development.
Solution
I started the programs by rc.local. But that's a bad idea. Using the same code in the Ubuntu menu for upstart programs work like a charm!
g810-led -pp < /etc/g810-led/profile
Using the keyboard
It's high quality. You'll get addicted pretty fast. I really like this keyboard.
Installation on Ubuntu
Install this library: https://github.com/MatMoul/g810-led
Make sure, that dependencies are met. I had to:
# sudo apt install libhidapi-dev
# make
# sudo make install
Then g810-led ran by:
# g810-led
Load a profile
#g810-led -pp < /etc/g810-led/profile
This will load a profile. You can write your own. Here's a bash file:
# Profil: 20170227
# Tastatur G810 Orion Spectrum
#
g810-led -g logo 330033
g810-led -g indicators 4c9900
g810-led -g fkeys 990000
g810-led -g modifiers 990000
g810-led -g multimedia 4c9900
g810-led -g arrows 003300
g810-led -g functions ffffff
g810-led -g keys 4c0099
g810-led -g numeric ffffff
#
# save settings
g810-led -c
But it's more elegant to load a profile, the format is:
# Vars
var brun 993300
var groen 009933
var blaa 330099
# All green
a 006600
# Groups
# Set key groups
g logo $brun
g indicators $groen
g mute $brun
g multimedia $brun
g fkeys $blaa
g arrows $brun
# Keys
k space $brun
k win_left $brun
k alt_right $brun
k num5 $brun
# commit
c
The last c is important. It will execute the orders. Note the usage of variables. It's quite handy.
Load the g810-led keyboard on boot
This can be done in sevearal ways. It may be deprecated, but creating:
/etc/rc.local
With this content does the trick:
g810-led -pp < /etc/g810-led/profile
You can even restart the file as a service:
sudo service g810-led restart
So basicly this is all you need in order to have a cool layout at the boot time.
Issues
The library works .. that is sort of. Sometimes a key or two will miss. Restarting the service helps. So the library is still in a process of development.
Solution
I started the programs by rc.local. But that's a bad idea. Using the same code in the Ubuntu menu for upstart programs work like a charm!
g810-led -pp < /etc/g810-led/profile
![]() |
| Ubuntu's Startup Application. |
Using the keyboard
It's high quality. You'll get addicted pretty fast. I really like this keyboard.
25 January, 2017
Write access to folders /var/www/html
If you want to edit files in a folder try:
# chmod -R username:www-data yourDirectory
# chmod -R username:www-data yourDirectory
14 January, 2017
Could not mount shared folder on VirtualBox
Workaround: created a ssh connection with the host in Ubuntu's file manager:
ssh://192.168.0.xxx
There were many complex solutions. This is easy. The result is the same: you'll get files in and out of the box.
ssh://192.168.0.xxx
There were many complex solutions. This is easy. The result is the same: you'll get files in and out of the box.
Subscribe to:
Posts (Atom)
















