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.

/usr/share/applications
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.

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:

  1. Pen & paper for the first drafts (alternative: Dia, if you want something on a screen).
  2. ER-D and database development in MySQL Workbench
  3. Implement the database in PHP via MySQLi.
  4. 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)

  1. Add a shared folder via Virtualbox / Settings / Shared folders
  2. 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.