Before Joomla! 3.5, the below code worked well in order to display reCAPTCHA in a view/layout of a custom component without using JForm and recaptcha form field:

<?php

    JPluginHelper::importPlugin('captcha');
    $dispatcher = JDispatcher::getInstance();
    $dispatcher->trigger('onInit', 'dynamic_recaptcha_1');

?>

<div id="dynamic_recaptcha_1"></div>

But in Joomla 3.5, things are change, you need to do something like this:

<?php

    JPluginHelper::importPlugin('captcha');
    $dispatcher = JDispatcher::getInstance();

    // This will put the code to load reCAPTCHA's JavaScript file into your <head>
    $dispatcher->trigger('onInit', 'dynamic_recaptcha_1');

    // This will return the array of HTML code.
    $recaptcha = $dispatcher->trigger('onDisplay', array(null, 'dynamic_recaptcha_1', 'class=""'));

?>

<?php

// Echo this where you want to display reCAPTCHA.

// I have only 1 recaptcha plugin enabled so the HTML is at 0 index.

echo (isset($recaptcha[0])) ? $recaptcha[0] : '';

?>

Check onInit and onDisplay function in plugins/captcha/recaptcha/recaptcha.php for more info.

After installing CentOS, I decided to install "Server with GUI" group to have a ability to use a graphical user interface together with command line interface. However I still needed to log into command line interface, then run "startx" command to bring the GUI interface.

To start the graphical login by default (GNOME display manager - gdm package), I needed to run 2 commands:

sudo systemctl enable gdm.service
sudo systemctl set-default graphical.target

then reboot. Now I can login with the graphical login form of GDM.

If I change my mind and want to switch back to command line mode, I need to run

sudo systemctl disable gdm.service
sudo systemctl set-default multi-user.target

then reboot.

Don't ask me why I need GUI on a CentOS which is often used as a server. This is just local server for testing/having fun.

 

 

After I switched to Antergos Linux (based on Arch Linux), I couldn't connect SSH to SiteGround any more. I got error "Permission denied (publickey)".

I tried to re-create public keys many times but no help, I also tried to contact SiteGround but their support staff couldn't find a solution.

I took a look at the logs in verbose mode (add "-vvv" params to ssh command) once again carefully and I noticed this:

debug1: Skipping ssh-dss key .ssh/id_dsa for not in PubkeyAcceptedKeyTypes

I made some searches for "PubkeyAcceptedKeyTypes" and finally I found a solution.

Antergos provides openSSH 7 in the repository, with openSSH 7, to connect with DSA key we need to the host to PubkeyAcceptedKeyTypes. To do this we create a new file /home/username/.ssh/config with these 2 lines:

Host host.com
     PubkeyAcceptedKeyTypes +ssh-dss

With "host.com" is the host we connect. For example this is for a SiteGround server:

Host sgp10.siteground.asia
     PubkeyAcceptedKeyTypes +ssh-dss

Never thought that openSSH could be the reason. Learned something new!

 

Just tried Copy on my elementoryOS and got this error when running CopyConsole:

Starting copy...Please increase the ulimit level for open handles in order to detect file changes properly
Error: The open file ulimit level is too low, please increase it otherwise changes will not be detected properly

To fix this problem I run these commands in terminal:

sudo sysctl -w fs.inotify.max_user_watches=80000
sudo sysctl -p

Tried many numbers and finally 80000 worked.

Thanks to solutions at https://copy.zendesk.com/entries/24923136-Ulimit-is-too-low-in-Ubuntu-

Update:

After uploading files to Copy for a while, the same error happened again and I needed to increase max_user_watches to 100000, although Copy worked again but the computer was very slow, sometimes freezed. So I decided to stop using Copy and looked for another service.

String could not be parsed as XML

If one day you log into your Joomla! back-end and see the error "An error has occurred. String could not be parsed as XML" everywhere and you can't do anything to manage the site, then this problem could come from a third party Joomla! plugin (a system plugin).

To fix this problem you need to find and disable this plugin.

Access your database by using the tool your hosting provider gives you, it is often phpMyAdmin. Go to XYZ_extensions table (*) and run the below query to list only enabled plugins and sort them by ID, so the most installed plugins will be listed first.

SELECT * FROM `XYZ_extensions` WHERE `type`='plugin' AND `enabled`='1' ORDER BY `extension_id` DESC;

If you only want to check system plugins, you can use this query instead

SELECT * FROM `XYZ_extensions` WHERE `type`='plugin' AND `enabled`='1' AND `folder`='system' ORDER BY `extension_id` DESC

Edit the first plugin in the list, change "enabled" column from "1" to "0" to disable the plugin, save the plugin and go back to your Joomla! back-end to see if the error disappears. If this plugin is not the one we are looking for, you edit it again and change "enabled" back to "1", and continue modifying the next plugin in the list. If you find the plugin causing this error, disable it (set "enabled" to "0") to be able to access your back-end, contact the author of that plugin for support.

In my case "System - Jomsocial Facebook Connect" plugin was the reason of this error.

(*) Replace "XYZ" with your database's prefix.

How to make ibus work in elementaryOS Linux distribution

I spent a whole night to make ibus work on my elementaryOS. Tried everything but it didn't appear on the top right corner (system tray). Pressed the shortcut didn't show the input method popup.

I checked the homepage of ibus and found the solution here: https://code.google.com/p/ibus/wiki/FAQ. We need to start ibus with the command

ibus-daemon -drx

It doesn't show ibus on the system tray, but it does bring up the input method popup and let us choose what input method we want to use.

To not run this command in terminal everything I turn the computer on, I put it in the Startup application list. (System Settings -> Applications -> Startup).

 

 

The database names are put in "databases" variable.

The sql files are put into the folder which its name is the current date.

 

#!/bin/bash
host="host"
username="username"
password="password"
today=`date +'%Y-%m-%d'`
databases=( database1 database2 database3 )

if [ -d $today ]; then
  echo "$today directory exists. Delete it."
 
  if rm -rf $today; then
    echo "$today directory was deleted successfully."
  else
    echo "$today directory couldn't be deleted. Exit..."
    exit 1
  fi
fi

if mkdir $today; then
  echo "$today directory was created successfully."
else
  echo "$today directory could't be created. Exit..."
  exit 1
fi

for database in "${databases[@]}"
do
  echo "Start exporting database $database"
  mysqldump --add-drop-table -h ${host} -u ${username} -p"${password}" ${database} > ${today}/${database}.sql
  echo "Finished exporting database $database"
done

echo "Done. Exit..."

If you get the error "tools.jar is not in android studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE." when run Android Studio on openSUSE, ensure you have already installed there 2 packages:

  • java-1_7_0-openjdk 
  • java-1_7_0-openjdk-devel

and you have this line in your .bashrc

export JAVA_HOME=/usr/lib64/jvm/java-1.7.0-openjdk

 

sdX is the USB device.

umount /dev/sdX
dd if=/path/to/downloaded.iso of=/dev/sdX bs=4M

Commands to change server’s files and folders to 664 and 775 permissions (sometimes I'm lazy, so I just copy-paste)

find /path/to/folder/ -type f -exec chmod 664 {} \;
find /path/to/folder/ -type d -exec chmod 775 {} \;