Monday, August 26, 2013

Oracle: show indexes status

select index_name, status from all_indexes where status != 'VALID';

Wednesday, July 31, 2013

Oracle: explain plan how to

SELECT * FROM TABLE(dbms_xplan.display);
EXPLAIN PLAN FOR SELECT ...

Saturday, July 27, 2013

How to print an MP3 CD insert

Front cover: use iTunes print CD insert functionality
Back cover: use MACCC + cdlabelgen

MACCC does not work under OSX 10.8 or Linux (no GUI), so you need to use Windows.
NB: Use it fullscreen or tables remain empty (don't know why).
The options to be selected are as follows:


Then you can use the txt output file into cdlabelgen, as shown below:

And the PS output file can directly be printed on OSX.

OSX iTunes 11: How to burn a MP3 CD with folders

If you want to use an iTunes playlist composed of multiple albums and create a folder for each of these albums onto the disk to burn, you can do it by clicking on the Album column header.

If you don’t click on the Album column then the MP3 CD will be created with all of the songs in one folder.
Beware to not select Album by artist while clicking on the Album column header, or you might get some crap, e.g. folder 1 Will.i.am , folder 2 Will.i.am Featuring Britney Spears, etc. for the same album.

OSX: use TAB to switch between buttons in dialogs

  • System Preferences
  • Keyboards
  • In the bottom of the dialog, in Full Keyboard Access section, check the All controls radio button

OSX screen capture

Shift + Command + 4

Thursday, July 18, 2013

Oracle Enterprise Linux: add oracle user to sudoers

su - root
oracle
/usr/sbin/visudo
Add
oracle ALL=(ALL) ALL
or if no password prompt wanted
oracle ALL=(ALL) NOPASSWD:ALL

Change to UK keyboard on X86 Linux

setxkbmap gb

Wednesday, July 10, 2013

Show Oracle current jobs which name starts with

SELECT COUNT(*) FROM DBA_SCHEDULER_JOBS WHERE JOB_NAME LIKE 'MBQT_DEQ%';

Sunday, May 19, 2013

How to find id of enclosing tr

var myId = $(this).closest('tr').attr('id');

How to post without redirecting / reloading the page

$.post(action, $('#MY_FORM').serialize());

How to deal with dots in HTML id

/* "." and ":" are problematic within the context of a jQuery selector
 * because they indicate a pseudo-class and class, respectively */
myId = myId.replace(/(:|\.)/g, "\\$1");

Thursday, May 2, 2013

PL/SQL: sum per month

SELECT TO_CHAR(CDR_DATE, 'mm/yyyy') MONTH, SUM(CHARGED_VOL) CHARGED_VOL FROM...GROUP BY TO_CHAR(CDR_DATE, 'mm/yyyy')

PL/SQL: date to epoch

SELECT (TO_DATE('26/10/2012 12:34:14', 'dd/mm/yyyy hh24:mi:ss') - TO_DATE('01/01/1970', 'dd/mm/yyyy')) * 86400 FROM DUAL;

Diff 2 XML files

Let's say we have XML files stripped on 1 line and we want to compare them.
We just need to re-format them, then use whatever tool to compare them (e.g. diff or p4merge)
xmllint --format /tmp/GET_SUB_INFO.log > /tmp/13.xml

Perl: Date to epoch

perl -MDate::Parse -e 'print str2time("01/25/2013 19:23:22 UTC"), "\n"'

Tuesday, April 30, 2013

PL/SQL: epoch to date

SELECT TO_CHAR(TO_DATE('19700101','YYYYMMDD') + (1364986608/(60*60*24)),'DD:MM:YYYY HH24:MI:SS') my_date FROM dual;

Monday, April 15, 2013

Git: How to retrieve a single file from specific revision?

> git show $REV:$FILE
E.g.
> git show 4b286e8:./src/com/mobiquithings/gprstrial/ConnectivityService.java
NB: use a ./ syntax or an absolute path

Friday, April 12, 2013

PL / SQL UPDATE + JOIN

MERGE INTO T1
USING T2
ON (T1.PK = T2.PK)
WHEN MATCHED THEN 
UPDATE SET T1.VAL = T2.VAL;