If you use C3PO you can make it do it when it checks the connection out.
As properties:
c3p0.preferredTestQuery=alter session set current_schema=animals
c3p0.testConnectionOnCheckout=true
As Java code:
ComboPooledDataSource dataSource = new ComboPooledDataSource();
dataSource.setPreferredTestQuery("alter session set current_schema=animals");
dataSource.setTestConnectionOnCheckout(true);
Downside is this will happen every time the connection is taken out of the pool
If you are using a JDBC connection yourself you could just do:
Lets show the same things written in Java with TotallyLazy (Disclaimer: I wrote it) :
range(1).map(squared).take(25);
You could write the same thing with most functional libraries for Java, as pretty much all of them have lazy Lists or lazy Sequences. In fact the clojure example is doing exactly the same thing: integers returns Seq. If you tried to make it return a PersistentList you would have exactly the same OutOfMemoryError exception.
So one of the last things that wasn’t perfectly working was coming out of suspend when I opened the lid. First thing you need to so is find the name of the LID switch:
ls /proc/acpi/button/lid/
LID0
Mine seems to be LID0 or LID1. You can then check it’s current state by doing:
cat /proc/acpi/button/lid/LID0/state
state: open
Now all you need to do is add this to the wake up list
Ubuntu 12.10 works pretty well out of the box (for me it was just power management and keybindings that needed work), see Ubuntu wiki if you have any other issues . Using powertop I was able to understand what needed doing. What follows are my settings:
/etc/rc.local
#!/bin/sh -e
# Temp disable ethernet port
modprobe -r r8169
# Disable wake up on lan if I do use ethernet port
ethtool -s eth2 wol d;
# Temp disable bluetooth
modprobe -r btusb
# Adjust backlight to start much lower
echo 11 > /sys/class/backlight/acpi_video0/brightness
# - NMI Watchdog (turned off)
echo 0 > '/proc/sys/kernel/nmi_watchdog';
# - SATA Active Link Powermanagement
echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy';
# - USB Autosuspend (after 2 secs of inactivity)
for i in `find /sys/bus/usb/devices/*/power/control`; do echo auto > $i; done;
for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo 2 > $i; done;
# - Device Power Management
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null;
echo auto | tee /sys/bus/pci/devices/*/power/control > /dev/null;
# - CPU Scaling (on demand scaling governor for all CPU's
for i in `find /sys/devices/system/cpu/*/cpufreq/scaling_governor`; do echo ondemand > $i; done;
exit 0
On the keybingings the only keys that didn’t work were some of the Fn Keys
Previous to Gnome 3 I had a nice simple flat file for my keyboard settings, that I just unzipped into .gconf and all was good. Now Gnome is copying the very bad idea of a registry from Windows, you have go through the gsettings API or tool.
Locate the keyboard shortcut schema “org.gnome.desktop.wm.keybindings”
Now unfortunately there does not appear to be a way to import that file, so I just hacked the file. Adding “gsettings set” to the front and quoting the values.
So
By default Meld’s 3 way merge combined with Mercurial merges into the left panel. To make it merge into the middle panel add the following to .hgrc file