Tuesday, June 19, 2012

spring-data document mongodb does not recreate your indexes after a mongoTemplate.getDb().dropDatabase()

I'm using spring-data mongodb and I wanted to do well so I've made some unit tests to verify my queries their performances against indexes. Instead of doing a removeAll form each collections, I though it will be quicker to do a mongoTemplate.getDb().dropDatabase(). Big mistakes !! Dropping the database remove everything and indexes of courses. I though they were recreate by spring-data, and it is not. So, removeAll on collection repository will do it.

Saturday, June 2, 2012

Linux Mint 13, enabled stamina on your sony vaio : how to deactivate one of the hybrid video card !

On my new computer, which is a Sony VAIO VPC-SE1A9E on Linux Mint 13 64 bits, I wanted to use the stamina feature and discovered that it deactivate/switch the video card used in an hybrid system. This works easily on Windows. Not in the mood to use windows so I browsed the web and found this to disable one of the video card.
Copy this in your '/etc/rc.local' before 'exit 0'
# deactivate ATI video card on startup in order to save battery life

# change right and owner of vgaswitcheroo
# http://ubuntuforums.org/showthread.php?p=11696293#post11696293
sudo chmod -R 705 /sys/kernel/debug
sudo chown -R USERNAME:USERNAME /sys/kernel/debug/vgaswitcheroo

# remove radeon module from kernel 
modprobe radeon

# http://doc.ubuntu-fr.org/vga_switcheroo
# http://asusm51ta-with-linux.blogspot.fr/
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
DO NOT 'blacklist radeon' at the end of /etc/modprobe.d/blacklist.conf because vga_switcheroo requires it to be enabled

To control if the device is disable type the command :
lspci -vnnn | grep VGA
The controller which is active should end with : [VGA controller] !! EDIT : laptops featuring hybrid graphics show a huge raise in power drain after a suspend/resume cycle
This is because the X server doesn't currently support GPU hot-pluggin.
A workaround is to move the code from '/etc/rc.local' to your '~/.profile' and first force to switch ON then to switch OFF.
references :
ubuntu-gnulinux-1204-precise-on-sony
radeon-module-boot-problems
vga_switcheroo
vgaswitcheroo -- permission denied
ASUSM51Ta & Linux: Enjoy Hybrid Graphics with switcheroo
Thanks you guys !