Friday, April 17, 2015

Missing embedded player when sharing Youtube video on Facebook

When I shared a youtube URL, there is thumbnail image instead of an embedded player. Hence, every time you click on the thumbnail, you're redirected to youtube website. You can't play it directly on Facebook. The URL shared might look like following:


What I want it to be is:


The reason is the video owner disabled embedding. We can't do anything about that if we're not the owner. You can see whether the embedding is enabled or not by clicking on the Share icon then Embed and you'll see as in the image below if embedding is disabled.


If embedding is enabled, you'll see as following:


You might have to look for another video that embedding is enabled.


Monday, March 30, 2015

Failed to open or import Maven project in IntelliJ IDEA

I'm using IntelliJ IDEA 14 on Mac OSX Lion and I hadn't had any problems with opening or importing Maven projects before I updated Java from 1.6 to 1.8. The IDE started successfully but every time I opened or imported an existing Maven project, a popup appeared to display the progress of opening or importing process for a short time but after that nothing happened. Then, I opened the Console application and I see the log message below:
3/31/15 1:05:18.637 AM [0x0-0x8d38d3].com.jetbrains.intellij.ce:   Referenced from: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
3/31/15 1:05:18.637 AM [0x0-0x8d38d3].com.jetbrains.intellij.ce:   Reason: image not found
It means that IDEA was still using JDK 1.6 and it no longer existed on my machine after the update. I solved the problem by telling it to use the JDK 1.8 instead when starting and building projects. To do it, I did as followings:

1). Open the IDEA's configuration file:
open -e /Applications/IntelliJ\ IDEA\ 14\ CE.app/Contents/Info.plist 

2). Update the following key
<key>JVMVersion</key>
<string>1.7+</string>
I have both JDK 1.7 and 1.8 on my machine.

3). Restart the IDE



Reference

https://devnet.jetbrains.com/docs/DOC-197


Sunday, February 8, 2015

Lenovo ThinkPad: The labtop does not wake up after suspending

I'm using Ubuntu 14.04 with Lenovo ThinkPad E440 and I'm having the issue that my labtop does not wake up after a suspend. I have to restart the machine. It's a bug of that model, reported here https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1340376. I fixed the issue by disabling USB 3.0 in BIOS (note that disabling USB 3.0 in BIOS will make the USB ports work as 2.0). This is not the real solution but it worked.



Reference
http://askubuntu.com/questions/489912/thinkpad-does-not-wake-from-sleep-14-04

Ubuntu: Enabling Hibernate

Hibernate is disabled by default on Ubuntu. To enable Hibernate in System Tray menu, please do as following:

1). Modify the permission of the directory below.
sudo chmod 755 -R /var/lib/polkit-1/

2). Open the file com.ubuntu.enable-hibernate.pkla or create it if it does not exist.
sudo nano /var/lib/polkit-1/var/lib/polkit-1/com.ubuntu.enable-hibernate.pkla
Add the following lines:
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes

3). Restart your computer



Reference
http://ubuntuhandbook.org/index.php/2014/04/enable-hibernate-ubuntu-14-04/

Saturday, February 7, 2015

Ubuntu: Disabling mouse movement while typing

I'm using Ubuntu 14.04 on my labtop Lenovo ThinkPad E440. The problem is mouse is moving while I'm typing. I already disabled it in the Mousepad setting but it didn't work.

Here are the steps to solve it:

1). Kill syndamon processes
killall syndaemon
2). Disable touchpad while typing
syndaemon -i 0.6 -KRd
-i : How many seconds to wait after the last key press before enabling the touchpad. (default is 2.0s).
-K : Ignore modifier keys and Modifier+Key combos when monitoring keyboard activity.
-R : Use the XRecord extension for detecting keyboard activity instead of polling the keyboard state.
-d : Start as a daemon, ie in the background to avoid the command open your terminal.

3). Add the command to /etc/profile file
/usr/bin/syndaemon -i 0.6 -d -K -R

4). Uncheck the option to disable touchpad while typing in System Settings so they don't interfere with each other which may make your mouse not work sometimes.















Reference
http://askubuntu.com/questions/327166/disabling-trackpad-while-typing-does-not-work

Lenovo ThinkPad: Swapping action of the function keys

My labtop is Lenovo ThinkPad E440 and I'm using Ubuntu 14.04. To adjust the screen brightness or volume, I use F5/F6 or F2/F3, respectively. And if I want to refresh page in browser, I need to press Fn+F5. I want to remap the function key by just pressing F5 to refresh a page in browser and Fn+F5/F6 to adjust screen brightness instead.

To do that, I just press Fn key and tap Esc key and that's it. It invokes function lock. You'll see LED light up on the Fn key as indicator.



Reference
http://forums.lenovo.com/t5/11e-Windows-E-and-Edge-series/E540-Fn-Fx-remapping/m-p/1628646#U1628646

Ubuntu and Levono: Brightness is reset to maximum on every restart

I'm using Ubuntu 14.04 and my labtop is Lenovo ThinkPad. The brightness is reset to maximum every time I reboot my machine. I have fixed the problem by:

1. Adjust the brightness to the level you want (by pressing the brightness key, Fn and F5/F6 in my case).

2. Note the output value of the following command.
cat /sys/class/backlight/intel_backlight/actual_brightness
In my case, it's 1700. It's the current level of brightness. If you want to know the maximum value, you can adjust the brightness to maximum and then run the command.

3. Add the following line to the file /etc/rc.local
echo 1700 > /sys/class/backlight/intel_backlight/brightness
So the content of my file would be:
GNU nano 2.2.6                                  File: /etc/rc.local                                                                            

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
chmod 666 /sys/class/backlight/intel_backlight/brightness
echo 1600 > /sys/class/backlight/intel_backlight/brightness

exit 0

I also added the command to modify the permission of the file to be writable by all users. I experienced the problem that even though I already modified the file's permission to be writable by all users, it was reset back to not writable even if for root user after reboot.

4. Add acpi_osi=Linux acpi_backlight=vendor to the value of the GRUB_CMDLINE_LINUX_DEFAULT variable inside /etc/default/grub file. Below is the file's content snippet after I've updated.
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux acpi_backlight=vendor"
...

5. Run the following command:
sudo update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-24-generic
Found initrd image: /boot/initrd.img-3.13.0-24-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
Found Windows 8 (loader) on /dev/sda1
done


Please note that step 1, 2 and 3 keep the screen brightness level remain the same after reboot but it will be reset to maximum if the machine is suspended or the screen is lock. Step 4 and 5 will fix this.



Reference
http://askubuntu.com/questions/151651/brightness-is-reset-to-maximum-on-every-restart
http://askubuntu.com/questions/138386/the-brightness-gets-reset-after-unlocking