Thursday, 12 June 2014

add hint to a criteria in hibernate

http://stackoverflow.com/questions/1327503/how-to-insert-an-optimizer-hint-to-hibernate-criteria-api-query

---

ProjectionList proList = Projections.projectionList();
proList.add(Projections.sqlProjection("/*+ index(this_ OUTGOING_ADAPTOR_MSG_IDX_6) */ 1 as MYHINT",    new String[]{},    new Type  []{}));

for (javax.persistence.metamodel.Attribute<. super OutgoingAdaptorMessageEntity, .> o : getManager().getMetamodel().managedType(OutgoingAdaptorMessageEntity.class).getAttributes()) {
    proList.add(Projections.property(o.getName()),o.getName());
}

criteria.setProjection(proList);

criteria.setResultTransformer(new AliasToBeanResultTransformer(OutgoingAdaptorMessageEntity.class));

Thursday, 29 December 2011

disable alps touchpad ubuntu 11.10

If you have an Alps touchpad and cannot use the "normal" settings for synaptics and the setup believes that your touchpad is a mouse. Install touchfreeze and replace synclient with

#!/bin/sh

if [ $# != 1 ]
then
echo nothing
else

if [ $1 = "TouchpadOff=0" ]
then
xinput --set-prop "ImPS/2 ALPS GlidePoint" "Device Enabled" 1
fi

if [ $1 = "TouchpadOff=2" ]
then
xinput --set-prop "ImPS/2 ALPS GlidePoint" "Device Enabled" 0
fi

fi

Change depening on what your xlist says

This works by touchfreeze calls synclient to disable touchpad. Synclient isn't working because you don't have a synaptics touchpad...

Friday, 28 January 2011

wget http://imgsrc.hubblesite.org/hu/db/images/hs-2010-13-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2003-28-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2005-37-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-41-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2004-27-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2006-23-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2006-01-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-19-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1999-12-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2005-12-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2005-12-b-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2006-10-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2003-22-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-16-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2003-24-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2003-11-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2006-14-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2003-01-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2002-15-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2001-15-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1996-01-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2002-11-b-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2009-14-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-17-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-09-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2000-10-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1995-01-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2000-15-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2008-22-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2009-25-f-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2002-11-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-36-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1998-35-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-16-h-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2009-25-i-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-16-f-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1995-45-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2001-10-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2005-15-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2009-25-x-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1999-20-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2001-12-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2003-09-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-35-b-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-16-e-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2008-37-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2006-07-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1999-14-b-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2000-14-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2008-34-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-34-b-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2005-30-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2002-05-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2009-25-q-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1998-39-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1998-12-b-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2002-11-c-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-37-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2006-13-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2009-10-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2005-25-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-30-d-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1998-21-b-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2002-11-d-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-1999-04-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2001-34-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-42-c-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2002-29-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2003-06-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2001-11-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2002-01-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2001-21-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2002-25-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-30-b-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-26-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2006-34-b-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2001-25-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2002-12-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-30-c-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2007-18-a-2560x1024_wallpaper.jpg;
wget http://imgsrc.hubblesite.org/hu/db/images/hs-2006-34-c-2560x1024_wallpaper.jpg;

Monday, 23 August 2010

query strings in LOBs

select * from TABLE where dbms_lob.instr(COLUMN, utl_raw.cast_to_raw('TEXT'),1,1) > 0

Thursday, 19 August 2010

iconify & pop windows for long running batch jobs

When I start long running jobs, I lose context and working with something else and start. Then I forget whatever I was doing.

sudo apt-get install xwit

in /usr/bin create 2 files

iconifyw
-------------------
tmpwinid=`env|grep WINDOWID | sed 's/WINDOWID=\([0-9]*\)/\1/'`
xwit -iconify -id $tmpwinid
-------------------

popbw
-------------------
tmpwinid=`env | grep WINDOWID | sed 's/WINDOWID=\([0-9]*\)/\1/'`
xwit -pop -id $tmpwinid
aplay -q /usr/share/sounds/beep-1.wav
-------------------

the wav file has to be found somewhere

chmod a+x popbw
chmod a+x iconifyw


test with

> iconifyw ;sleep 5 ;popbw

Tuesday, 27 July 2010

oracle audit

http://www.dba-oracle.com/security/application_users.html
from: http://miguelmoreno.net/post/Increase-your-VMWare-disk-size.aspx

Increase your VMWare disk size… Over the years I have used both Microsoft's Virtual PC and VMWare. As to which one I prefer and is better, that is a whole other post. In this post I wanted to write about increasing the size of a virtual hard drive of a VMWare machine.

When creating a new machine you are asked to define the size of your drive and when you choose 16Gb, you think you'll never use that much anyways, until, after a while, you realize you do need more. In that case, there are no options to increase the size of your C: drive. Ofcourse, you could always add a new drive (D or E), but that is just more files lingering around, as if VMware didn't create enough already....

With regards to your OS drive size, you are stuck with the size you chose. No menu options, dialogs, or wizards can increase it…

...unless you do this trick. Thanks to Paul Marshall for outlining these steps.

I have done this a couple of times and have found these steps work almost without fail. One observation, is that apparently the hard drive needs to be assigned a drive letter, or otherwise you cannot extend it. Here are the complete steps:

1: Create a new full clone of your VM machine you want to increase in size, ensuring it has no snapshots.
2: Open the folder containing your VM files and you should have only one vmdk file.
3: Open a Command Prompt and issue the following command, choosing your own size in Gigabytes, followed by the path to the vmdk file: vmware-vdiskmanager -x 20Gb vmdiskfile.vmdk
4: After several minutes, the process completes, however, the disk is not ready yet. 5: You have expanded it, but the newly added space has not been allocated yet and is thus unusable at this point. If the disk is the system volume you will need to mount the disk in a second VM and expand it from there. If its not a system volume do it within the virtual machine it belongs to.
6: Once you've mounted the disk in a different VM or booted up the VM it belongs to if its not the system volume, do the following: click on Start and then right-click on My Computer and select Manage
7: Click on Disk Management
8: Your second hard drive should show as available and the difference in space shows as unpartitioned.
9: Ensure this second hard drive has a drive letter, if not, assign it one.
10: Open a Command Prompt and type: diskpart
11: Then type list disk and ensure the disk you want to expand is indeed in the list.
12: Now type list volume
13: This will show you the drives, their volume number, capacity etc. You now need to select the volume you are about to expand, using the following command. Where n is equal to the number of the volume. select volume=n
14: Once selected, you can now expand it using the extend command. Type extend, and your hard drive is ready. Close your machine (without saving) and start up the VM that this drive is the system volume on and check the size.
by Miguel Moreno