Tuesday, February 24, 2015

Radius: run time variables

http://wiki.freeradius.org/config/Run%20time%20variables

xemacs: Unable to load any usable fontset

If running XEmacs causes these warnings about fonts:
[jerome@mathusalem] > xemacs
Warning: Missing charsets in String to FontSet conversion
Warning: Cannot convert string "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso10646-1,                               -*-helvetica-bold-r-*-*-
*-120-*-*-*-*-iso8859-*,                                *" to type FontSet
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
Then, try running it this way:
[jerome@mathusalem] > LANG=C xemacs

Monday, February 23, 2015

Windows Virtualbox: increase CentOS 6 VDI size

  1. Create a new VDI disk under Controller: SATA, sized appropriately

  2. Clone existing VDI into new one
  3. C:\Program Files\Oracle\VirtualBox> VBoxManage.exe clonehd "c:\Users\jerome\VirtualBox VMs\Mathusalem\Mathusalem.vdi" --existing "c:\Users\jerome\VirtualBox VMs\Mathusalem\Mathusalem 2.vdi"
    
    0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
    Clone hard disk created in format 'VDI'. UUID: 48da07eb-3395-4fad-95e3-c0615b185da2
  4. Remove legacy VDI

  5. Download GParted ISO from GParted Live CD
  6. Mount GParted ISO under Controller: IDE

  7. Start the VM, which will boot on the GParted live CD
  8. Extend the existing LVM2 partition (/dev/sda2) with the new unallocated space
  9. Stop the VM, detach the GParted ISO, and reboot the VM
  10. Extend the logical volume into the resized partition
  11. By default, CentOS uses LVM (Logical Volume Manager), which requires an extra step.
    Identify the name of the logical volume via df:
    df -h

    Then force the LVM volume to take 100% of the available space on the partition:
    lvextend -l +100%FREE /dev/mapper/vg_mathusalem-lv_root
  12. Resize file system
  13. resize2fs /dev/mapper/vg_mathusalem-lv_root

    After this step, we are now good to go.

Tuesday, February 10, 2015

Oracle: split / join

See http://stackoverflow.com/questions/381231/hidden-features-in-oracle
SQL> declare
  2    v_array apex_application_global.vc_arr2;
  3    v_string varchar2(2000);
  4  begin
  5  
  6    -- Convert delimited string to array
  7    v_array := apex_util.string_to_table('alpha,beta,gamma,delta', ',');
  8    for i in 1..v_array.count
  9    loop
 10      dbms_output.put_line(v_array(i));
 11    end loop;
 12  
 13    -- Convert array to delimited string
 14    v_string := apex_util.table_to_string(v_array,'|');
 15    dbms_output.put_line(v_string);
 16  end;
 17  /
alpha
beta
gamma
delta
alpha|beta|gamma|delta

Thursday, February 5, 2015

Oracle: return a row even if select returns no rows

SELECT nvl(data_name, 'nothing') FROM (  
    SELECT data_name
    FROM data_table
    WHERE data_table.type = v_t_id

    UNION ALL

    SELECT NULL AS data_name
    FROM dual
  ) WHERE data_name is not null or ROWNUM = 1;