Category Archives: Tips, Tricks and Tutorials

Handy how to snippets grabbed from the computing world.

Appcelerator and Android Bug: Invalid “–device-id” value “XYZ” Tips, Tricks and Tutorials 10 JAN 2017

Working in Appcelerator Studio, I was trying to compile and run the Android app that I’m developing on a Lenovo A7600-H tablet hooked up to my Windows 10 laptop via USB.

Developer Options’ USB debugging checkbox was turned on (remember, if it isn’t already showing – and it shouldn’t be – you can open up Developer Options as a Settings menu option by clicking 7 times on the Build Number item tucked away behind the About Phone/Tablet settings menu option), and the USB computer connection was set to MTP media device/files option.

However, the run process kept aborting with the following error message: Invalid “–device-id” value “XYZ” where XYZ was a label associated with the hooked up device.

As it turns out, the problem is actually one of authentication or rather authorization – essentially the device doesn’t trust the PC that it is currently plugged into. So to resolve, I turned off the “USB debugging” setting, clicked on the “Revoke USB debugging authorizations” menu option below that, and then turned USB debugging back on. The tablet asked me if it was okay to allow the computer connection, and after confirming on the device and then returning to Appcelerator Studio to compile and run, the Invalid –device-id issue was gone.

So, worth jotting down for future reference then.

Solved: Appcelerator Build Error: “EPERM, operation not permitted” Tips, Tricks and Tutorials 27 MAY 2016

Sigh, I really do not enjoy building Apps. Anyway, the latest roadblock to hit me after being asked to quickly unlock the previously locked orientation on one of our Appcelerator-built mobile apps, required me to boot up Appcelerator Studio, make the code tweak and then run an Android build – only to be stopped in my tracks by a glaring compiler error that read:

“EPERM, operation not permitted”.

After a bit of tearing my hair out, Googling, and just general despair, the solution to this problem revealed itself… the damn antivirus was interfering here!

So a quick trip to the Avast! antivirus control panel in order to turn off all the active monitoring, a restart of the build process, and voilà… my app change was done.

So just jotting this down here in case I run into this issue again. (Also, don’t forget to turn you Antivirus back on again when you are done!)

Avast Active Protection settings window above appcelerator studio

Related Link: Appcelerator | Avast!

Simple way to Backup Files from an Ubuntu Server to Amazon S3 Cloud Tips, Tricks and Tutorials 17 MAY 2016

You can never have too many backups, and this is a simple way of backing up files from an Ubuntu server to the Amazon S3 cloud storage system.

Backup-three-laptops-plugged-into-word

For this, you will obviously need an Ubuntu server, an Internet connection, and of course, an Amazon AWS account.

First things first, you’ll need to generate Amazon AWS access keys, which you do from the AWS Security Credentials page (Access Keys section) in the AWS console.

Write these (both the Access Key ID and Secret Access Key) down somewhere safe, because you definitely don’t want to be losing them unnecessarily. (Maybe a Google Doc might be a good idea here?)

Now head over to the S3 Management page in the AWS console, where you will need to create the new bucket (or folder in an existing bucket) where you want to store your backed up files in.

With your bucket created, and your access details at hand, head into your Ubuntu server and install the super useful Amazon S3 targeted s3cmd package:

sudo apt-get install s3cmd

Next configure it by entering the requested information (your Access Key details will be needed here). Note, you do have the option to encrypt the files in transit, and if you choose to do so, it is probably worth your while to jot down the password in that previously mentioned Google Docs file of yours!

s3cmd --configure

Run the connection test and if everything passes, you should be good to go. You can check your current buckets by doing a directory listing with s3cmd:

s3cmd ls

You are pretty much just about there now. To do the file backup, we’ll use s3cmd’s built in sync command. To push files to Amazon S3, we declare the parameters in the order of local files then target directory. So for example, if we have a S3 bucket called server-backup, and want to back up our user account’s home directory to S3, the sync call would look like this:

s3cmd sync ~/* s3://server-backup

You can of course get all clever and target specific folders, exclude or include files and folders using wildcard characters, etc. (See the documentation for more). For example, here I exclude .svn folder files using:

s3cmd sync --exclude '*.svn' ~/* s3://server-backup

If you are happy with the sync result, then all that is left is to throw the command into a short bash file, give it execute rights and add it to the cron scheduled tasks system. So for example, create the file cron_s3_backup.sh:

nano /home/craiglotter/cron_s3_backup.sh

Add this text:

#!/bin/bash
s3cmd sync /home/craiglotter/* s3://server-backup/craiglotter/

Save, and make the file executable:

chmod +x ~/cron_s3_backup.sh

Finally, add it to the cron in the usual manner. Open the crontab for editing:

crontab -e

Add the following line for a daily backup at 07:00 in the morning.

0 7 * * * bash /home/craiglotter/cron_s3_backup.sh >/dev/null 2>&1

Done.

Facebook (Android): How to Cancel Stuck, Failed Uploads Tips, Tricks and Tutorials 02 MAY 2016

I wanted to upload a quick pic of the indoor braai that I had started to ring in the end of the long weekend to Facebook, but for some or other reason, the image upload failed, or rather got stuck in its attempt to upload to the social network’s servers. This means now that every time you open the Facebook app, you watch as it futilely tries to reassure you that your post is STILL being created, even though deep down inside you know that it is a lost cause.

Actually, this happens relatively frequently, and with seemingly no method for cancelling the infinitely in progress upload, it is quite a frustrating problem to sit with.

IMG_20160502_174345 country mews indoor braai fire

As I mentioned, opening and closing the app won’t solve the problem. You could go extreme of course, and uninstall, but that’s a little bit on the overkill side. Instead, probably the easiest way to resolve the stuck upload issue is to simply log out of the app via the menu. Log back in, and by magic, your stuck upload should be nowhere in sight.

I have no idea why this works. It shouldn’t, but it does.

Maybe one day Facebook will fix their Android app and allow us to cancel stuck in progress uploads in a more natural fashion!

How to Solve the “linux-server : Depends: linux-image-server” apt-get upgrade Error Tips, Tricks and Tutorials 19 FEB 2016

After cleaning out an unexpected /boot full fault on one of the Ubuntu servers that I maintain, I next encountered an equally frustrating problem whereby apt-get stopped working thanks to a mismatched kernel version issue (introduced because of the upgrade that had failed halfway thanks to the earlier running out of disk space in /boot!).

Essentially, any apt-get operation like say “apt-get upgrade” or “apt-get install -f” would result in the operation breaking with the following string appearing in the error message:

dpkg: dependency problems prevent configuration of linux-server:
 linux-server depends on linux-image-server (= 3.2.0.92.106); however:
  Version of linux-image-server on system is 3.2.0.92.114.
 linux-server depends on linux-headers-server (= 3.2.0.92.106); however:
  Version of linux-headers-server on system is 3.2.0.92.114.
dpkg: error processing linux-server (--configure):
 dependency problems - leaving unconfigured

I spent a lot of time bashing away at this, trying to remove and install specific kernel versions, etc. (a lot of information on the issue can be found here), but in the end stumbled across this silly little fix that worked brilliantly efficiently:

sudo apt-get remove linux-server && sudo apt-get install linux-server

Yeah. Classics still work. When in doubt, uninstall and then reinstall!

dog fixing computer issues

How to Solve Ubuntu Server /boot full Issue Tips, Tricks and Tutorials 19 FEB 2016

If you manage an older Ubuntu server and do a lot of updates/upgrades, inevitably you’ll hit the annoying /boot full issue, which is essentially what happens when the ridiculously tiny /boot folder gets filled up with older kernel version as a result of all your upgrading.

To spot if this is in fact what currently plagues you, simply run the following command to get a quick snapshot of disk space usage:

sudo df -h

If your /boot directory is indeed full or close to 100%, you can run the following command that automatically locates and removes older kernels and headers from the system:

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

With those gone, you can now clean up a bit further by removing packages that aren’t necessarily needed any more (because they were automatically installed to satisfy dependencies for the newly removed packages):

sudo apt-get autoremove
sudo apt-get --purge remove && sudo apt-get autoclean

This should solve your issue.

cat using laptop

Note: If you can’t use apt-get at all because of this problem, you can try to manually delete the kernels yourself. Run the following to get an idea of what can be removed:

dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')"

With that list now in your possession, craft a remove operation using those version numbers listed above, followed by an attempt to solve the new dependency issue with apt-get e.g.

sudo rm -rf /boot/*-3.2.0-{101,102,103}-*
sudo apt-get -f install

(As always though, tread with care though when it comes to messing with this part of your server install…)

Kodi: Eminence Skin: How to Clean the Movie Library Tips, Tricks and Tutorials 20 NOV 2015

The excellent Kodi (formerly known as XBMC) is my preferred media server at home, on top of which I run the gorgeous Eminence skin.

kodi eminence skin screenshot

At first it is not very apparent how to clean up your video library (i.e. remove duplicates are deleted items), despite the Update Library button being so visible. (Hint, standard settings mean that the Update Library action doesn’t actually clean the library).

No, to clean your library you will need to go to Settings via the main menu options, and from there head over to the Videos section, and finally the Library option.

The trick here is to then spot the label reading either Basic Settings or Standard Settings, and click on it until it reads either Advanced Settings or Expert Settings.

Once this is done, you can now scroll down the main menu item list and you should spot a item marked Clean library… which wasn’t there before.

Needless to say, clicking it will result in a shiny clean library, free of duplicates and missing items!

Related Links: Kodi | Eminence

Kore: How to Solve Can’t Find Kodi Media Center on Windows 10 Tips, Tricks and Tutorials 19 AUG 2015

I’ve mentioned the official Kore Android remote control for Kodi media centers before, and it remains my favourite Kodi/XBMC remote by far!

I did however encounter a small problem.

I’ve moved things around a little, shifting the Kodibuntu linux box away from the TV and closer to the router so that a) it’s out of the way, and b) it gains from the better Ethernet connection. This simple old PC box hosts all of our media content, which is then shared via UPnP and Samba shares. I’ve installed Kodi on both Chantelle and my laptops (both are Windows 10), and set their movie and TV sources to the SMB shares. (Works a charm!)

Also, the two laptops and one desktop all have static IPs assigned through my ancient Mega 105WR Telkom router (you know, I really should get that upgraded some day…).

Anyway, the problem is that Kore can see the Kodibuntu box with no hassle, but not a chance can it spot either of the Windows 10 laptops on the network – which is exactly what this post is all about solving then!

eminence theme on kodi xbmc media center

Kodi and Kore require Zeroconf (aka Bonjour), a group of technologies to “automagically” discover systems and services on a local area network, to communicate with one another, and naturally (because Bonjour is an Apple implementation) Windows doesn’t have Zeroconf support out of the box.

Now some popular applications ship with it slipped in for their own purposes, and installing them should technically grant you access to Zeroconf on your system (like Skype, iTunes and Photoshop), but if you’re just looking for a basic, older version without the need to install yet another unused full application on your system, your best bet would be to download the small Bonjour Print Services for Windows v2.0.2 package from Apple.

Install that, ensure that the Zeroconf option is enabled under Kodi’s services/network menu option, and you should be good to go: Kore will now quite helpfully pick up your Kodi instances in its search!

Related Link: Kore | Kodi | Zeroconf | Bonjour Print Services