Tuesday, November 13, 2012

PL/SQL SELECT into array

DECLARE
    TYPE ARRAY_TYPE IS TABLE OF VARCHAR2(20);
    mno_array ARRAY_TYPE;
    mno_id VARCHAR2(20);
BEGIN
     SELECT *
        BULK COLLECT
        INTO mno_array
        FROM (SELECT DT_PARTY.HOST_MNO_ID FROM RESOURCE_DB.HT_SIM_PARTY, RESOURCE_DB.DT_PARTY
                    WHERE HT_SIM_PARTY.PARTY_ID = DT_PARTY.PARTY_ID
                        AND HT_SIM_PARTY.SIM_ID = 'SIM_0000000000000184');
    DBMS_OUTPUT.PUT_LINE('count='||mno_array.COUNT);
    FOR i in 1 .. mno_array.COUNT
    LOOP
        DBMS_OUTPUT.PUT_LINE(mno_array(i));
    END LOOP;
END;

PL/SQL SELECT into hash array

DECLARE
    TYPE HASH_TYPE IS TABLE OF NUMBER INDEX BY VARCHAR2(20);
    mno_array HASH_TYPE;
    mno_id VARCHAR2(20);
BEGIN
    FOR r IN (SELECT DT_PARTY.HOST_MNO_ID FROM RESOURCE_DB.HT_SIM_PARTY, RESOURCE_DB.DT_PARTY
              WHERE HT_SIM_PARTY.PARTY_ID = DT_PARTY.PARTY_ID
              AND HT_SIM_PARTY.SIM_ID = 'SIM_0000000000000184') LOOP
        MNO_ARRAY(R.HOST_MNO_ID) := 1;
    END LOOP;

    IF mno_array.EXISTS('BT') THEN
        DBMS_OUTPUT.PUT_LINE('BT=YES');
    END IF;
END;

Monday, November 12, 2012

Install Mountain Lion

Conf.: Asus P8Z68V LX + Intel Core i5 2500K + RAM Patriot PC3-12800 1600MHz 8GB (2x4GB) + nVidia GT240 512MB GDDR5
  1. Install patched ASUS BIOS v4003 so as to allow for Sleep to work
  2. Create a bootable USB flash drive with Mountain Lion like explained here: UniBeast: Install OS X Mountain Lion on Any Supported Intel-based PC
  3. Boot on USB flash drive: <TAB>, then PCIRootUID=0
  4. Format disk as Mac OS Extended (journaled), options: GUID Partition Table
  5. Install ML
  6. Upgrade to 10.8.2
  7. Download tonymacx86 MultiBeast 5.1.3
  8. Check options as shown:
  9. Reboot, no option
  10. Et voila: a fully working hackintosh with sleep capability on and no DSDT
  11. Keyboard: In order to map my Dell keyboard w/ GB layout, used the wonderful Ukelele w/ Logitech GB layout

Sunday, November 11, 2012

Install a QNAP network HP C5280 printer on Windows 8

Thank you Mr MS for not including the HP C52xx driver into W8.
Download the mostly useless HP software for this printer (362MB!): you will find it easily with Google on the HP website.
Open the HP .exe in WinRAR, and uncompress it.

Goto Panneau de configuration
Then goto Materiel et audio, then "Peripheriques et imprimantes"
Then click on "Ajouter une imprimante"
Then don't let the search finish and click the "L'imprimante que je veux n'est pas repertoriee" link
Enter the name of the QNAP printer:
http://192.168.1.102:631/printers/qnapPR3
then click on "Suivant"


Then select the driver from disk. For this, in HP directory, go into prn_x86 (prn_x64) and select prnhp003.inf
Throw away all the HP bloatware.

Monday, November 5, 2012

List RPM

> rpm -qa

Sunday, November 4, 2012

Install Mountain Lion from InstallESD.dmg

You won't be able to use UniBeast directly with InstallESD.dmg:
Open dmg, and move "Install OS X Mountain Lion" into Applications folder:
Then right click on "Install OS X Mountain Lion", and select "Show Package Contents".
Go into Contents folder, and create a new folder named "SharedSupport":
Then drag InstallESD.dmg into SharedFolder:
You will then be able to proceed through UniBeast: Install OS X Mountain Lion on Any Supported Intel-based PC

Saturday, November 3, 2012

FCPX: Use Disk Images to archive your work

Managing Your FCP X Events & Projects using Disk Images
Then you can move your projects to your Disk Image in order to archive them:

Monday, September 24, 2012

Discard all unstaged files in git

> git checkout -- .

Wednesday, September 12, 2012

Restoring a directory from history

> git checkout a44d627 -- .metadata/

Friday, August 31, 2012

Oracle views vs. materialized views

  • Materialized views are disk based and updated periodically base upon the query definition.
  • Views are virtual only and run the query definition each time they are accessed.

Thursday, August 23, 2012

Count rows in partition

SELECT table_name,
partition_name,
high_value,
num_rows
FROM all_tab_partitions
ORDER BY table_name, partition_name;

Monday, July 2, 2012

Git label

 git tag  EXTRANET_v2.1 04b7f86

VirtualBox Guest additions upgrade: install_x11_startup_app: no script given

Here's what we get after trying to upgrade the Guest Additions from 4.1.12 to 4.1.14:
Installing the Window System drivers
Installing X.Org Server 1.11 modules ...done.
Setting up the Window System to use the Guest Additions ...done.
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services components ...fail!
(See the log file /var/log/vboxadd-install-x11.log for more information.)
Press Return to close this window...

install_x11_startup_app: no script given
Before installing the new guest additions version, you need to remove manually 2 symlinks:
 rm /usr/lib64/VBoxGuestAdditions
 rm /usr/share/VBoxGuestAdditions

Monday, June 18, 2012

Have ALC887 work on Lion 10.7.4

Follow the instructions on https://tonymacx86.com/viewtopic.php?f=16&t=59061 for installing 887_v100302

Using my NAS with Final Cut Pro X

  1. Create a local disk image with Disk utility, whatever the size
  2. Unmount it
  3. Move it to a given directory on the NAS
  4. Resize it to the size you want to give it
  5. Mount it

Tuesday, June 12, 2012

Sending POST with cURL

curl -d "param1=value1&param2=value2" http://example.com/resource.cgi

Wednesday, June 6, 2012

NO DATA FOUND error

Trap the NO_DATA_FOUND exception, and handle it.
BEGIN 
    SELECT ... INTO   x_data
    FROM   ...
    WHERE  ...;
EXCEPTION
    WHEN NO_DATA_FOUND THEN
        x_data := NULL;
END;

Monday, June 4, 2012

Get time elapsed of an SQL query

In SQL plus, use:
SQL> set timing on;

Monday, May 14, 2012

Oracle select N latest entries

select * from (select * from monitor.at_process_log order by log_id desc) 
where ROWNUM <=10;
To accomplish the equivalent to MySql:
select * from sometable order by name limit 20,10
AskTom proposes:
select * from (select a.*, ROWNUM rnum from 
(select * from monitor.at_process_log order by log_id desc) a where rownum <= 20)
 where rnum >= 10;