Tuesday, December 18, 2012

Force statistics computation

For the whole table:
analyze table unrated_usage.ft_unrated_usage_o compute statistics;
For one given partition:
analyze table unrated_usage.ft_unrated_usage_o partition(P0) compute statistics;

Saturday, December 15, 2012

Install a QNAP network HP C5280 printer on Mountain Lion

First of all, install the 3 packages to be found here: macosx/hpijs
This will install the HP Photosmart C5200 series drivers.
Then proceed as usual to add a printer: System Preferences, then Print & Scan, then (+) in the Printers list, and pick the correct model from the proposed list.

Friday, December 14, 2012

Count number of rows in partitions

SELECT table_name,
partition_name,
high_value,
num_rows
FROM SYS.ALL_TAB_PARTITIONS
where table_name = 'SMSC_CDR_MT'
and num_rows != 0
ORDER BY partition_name;

Thursday, December 6, 2012

Show a user's objects grants

SELECT * FROM DBA_TAB_PRIVS WHERE GRANTEE = 'my_user';

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;

Wednesday, May 9, 2012

Which Yum package provides this missing library?

yum whatprovides */libXext.so.6

Thursday, May 3, 2012

Install Cisco VPN 4.8.02 on Fedora 14 (2.6.35)

  1. tar xvfz vpnclient-linux-x86_64-4.8.02.0030-k9.tar.gz
  2. cd vpnclient
  3. sudo ./vpn_install
  4. You will probably get failures. If you get failures:
  5. wget http://projects.tuxx-home.at/ciscovpn/patches/vpnclient-linux-2.6.24-final.diff
  6. patch < ./vpnclient-linux-2.6.24-final.diff
  7. This step shows failures, but I don't care (*)
  8. wget http://lamnk.com/download/vpnclient-linux-4.8.02-64bit.patch
  9. patch < ./vpnclient-linux-4.8.02-64bit.patch
  10. sed -i 's/^CFLAGS/EXTRA_CFLAGS/' Makefile
  11. wget http://lamnk.com/download/vpnclient-linux-2.6.31-final.diff
  12. patch < ./vpnclient-linux-2.6.31-final.diff
  13. sudo sed -i 's/const\ struct\ net_device_ops\ \*netdev_ops;/struct\ net_device_ops\ \*netdev_ops;/' `find /usr/src -name netdevice.h`
  14. Update interceptor.c like explained in (**)
  15. sudo ./vpn_install
  16. sudo /sbin/service vpnclient_init start
  17. Create a profile like in (***) and substitute values
  18. cp *.pcf /etc/opt/cisco-vpnclient/Profiles directory
  19. vpnclient connect site-name (site-name is the same as site-name.pcf)
(*)
[jerome@monster] > patch < ./vpnclient-linux-2.6.24-final.diff
patching file GenDefs.h
Hunk #1 succeeded at 105 with fuzz 2.
Hunk #2 succeeded at 122 (offset 2 lines).
patching file interceptor.c
Hunk #3 FAILED at 111.
Hunk #4 succeeded at 142 (offset 5 lines).
Hunk #5 FAILED at 364.
Hunk #6 FAILED at 921.
Hunk #7 FAILED at 949.
4 out of 7 hunks FAILED -- saving rejects to file interceptor.c.rej
(**) Replace
static void interceptor_init(struct net_device *);
with
static
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
int
#else
int __init
#endif
interceptor_init(struct net_device *);
(***)
[main]
Description=sample user profile
Host=<x.x.x.x>
AuthType=1
GroupName=<GroupName>
GroupPwd=<GroupPwd>
EnableISPConnect=0
ISPConnectType=0
ISPConnect=
ISPCommand=
Username=<Username>
UserPassword=<UserPassword>
SaveUserPassword=1
EnableBackup=0
BackupServer=
EnableNat=1
CertStore=0
CertName=
CertPath=
CertSubjectName=
CertSerialHash=00000000000000000000000000000000
DHGroup=2
ForceKeepAlives=1

Friday, April 27, 2012

PL/SQL: loop on array

In package:
    TYPE varchar2_array_type IS TABLE OF VARCHAR2(100) INDEX BY PLS_INTEGER;
In package body:
ze_or_keys varchar2_array_type;
BEGIN
    FOR i in 1 .. ze_or_keys.count
    LOOP
        IF i != 1 THEN
            my_string := my_string || ' OR ';
        END IF;
        my_string := my_string || ze_or_keys(i) || '=''' || ze_or_values(i) || '''';
    END LOOP;
END;

PL/SQL: loop on associative array

In package:
TYPE hash_type IS TABLE OF VARCHAR2(100) INDEX BY VARCHAR2(100);
In package body:
ze_assoc hash_type;
BEGIN
    my_col_name := ze_assoc.first;
    LOOP
        EXIT WHEN my_col_name is null;
        my_string := my_string || ' OR ' || my_col_name || '=' || ze_assoc(my_col_name);
        my_col_name := ze_assoc.next(my_col_name);
    END LOOP;
END;

Thursday, April 26, 2012

Force resync of VirtualBox guest

E.g. To force time sync every 10 sec.:
VBoxService --timesync-set-threshold 10000

Wednesday, April 25, 2012

Log sqlplus output

SQL> spool /tmp/log.txt
SQL> @/tmp/toto.sql
SQL> spool off

Use ampersand (&) in strings with Oracle

set define off;

Remove invisible ^M from .csv

CTRL-x <RET> f iso-8859-1-unix <RET>
This matches the
M-x set-buffer-file-coding-system
function.

Friday, April 20, 2012

git diff same file between 2 commits

Say .git is in ~/src.
cd ~/src
git diff fc20f9f c52bb9c -- perl/file_manager/bin/fm_extract_cdr.pl

.htaccess ignored in public_html

Check that public_html has
AllowOverride All
in httpd.conf

Monday, April 9, 2012

Finding and Purging Big Files From Git History

The "Removing Objects" section from Pro Git chapter 9 explains how to do it.

Friday, April 6, 2012

Extend partition on CentOS

If you extend the size of a Virtual Machine (e.g. VMWare) hosting CentOS, you need to tell CentOS to use the additional space.
Check the existing partition table
[root@test ~]# fdisk -l /dev/sda

Disk /dev/sda: 322.1 GB, 322122547200 bytes
255 heads, 63 sectors/track, 39162 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d30cf

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       13055   104344576   8e  Linux LVM
/dev/sda3           13055       26109   104857600   83  Linux
Add a new partition
[root@test ~]# fdisk /dev/sda
  n {new partition}
  p {primary partition}
  4 {partition number}

  t {change partition id}
  8e {Linux LVM partition}
  w
Reboot
[root@test ~]# reboot
Check the new partition table
[root@test ~]# fdisk -l /dev/sda

Disk /dev/sda: 322.1 GB, 322122547200 bytes
255 heads, 63 sectors/track, 39162 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d30cf

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       13055   104344576   8e  Linux LVM
/dev/sda3           13055       26109   104857600   83  Linux
/dev/sda4           26109       39162   104853565   8e  Linux LVM
Create a new physical volume from the new partition
[root@test ~]# pvcreate /dev/sda4
Extend the existing volume group
[root@test ~]# vgextend vg_test /dev/sda4
NB: The volume group name is given by lvdisplay:
[root@test ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg_test/lv_root
  VG Name                vg_test
  LV UUID                wkJfwT-hJkJ-fQCL-HTqP-0ZrZ-i8vL-TrLTif
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                149.99 GiB
  Current LE             38398
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
...
Extend the logical volume
[root@test ~]# lvextend /dev/vg_test/lv_home /dev/sda4
Resize the filesystem in the logical volume
[root@test ~]# resize2fs /dev/vg_test/lv_home
Check that the new space has ben taken into account
[root@test ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_root
                      148G  6.4G  134G   5% /
tmpfs                1002M     0 1002M   0% /dev/shm
/dev/sda1             485M   68M  392M  15% /boot
/dev/mapper/vg_test-lv_home
                      144G  5.0G  132G   4% /home
[root@test ~]# 

Tuesday, April 3, 2012

Thursday, March 15, 2012

Compile lisp file

M-x emacs-lisp-byte-compile       create a .elc from a .el

Etags navigation

Only for declarations and definitions of symbols.

M-.       goes to the symbol definition
M-0 M-.   goes to the next matching definition
M-*       return to your starting point

For invocations (any symbol actually):

M-x tags-search        initiate a search
M-,       go to the next match

Etags: add symbols to TAGS

cd <my directory>
find . -name "*.[chCH]" -print | etags --output=/vob/signalware/Master/TAGS -a -

Etags a full tree

cd /vob/
find . -name "*.[chCH]" -print | etags --output=/vob/signalware/Master/TAGS  -

Or

cd /vob/signalware/Master
find tcap gsm2 -name "*.[chCH]" -print | etags --output=/vob/signalware/Master/TAGS  -

Visit a given TAGS table

M-x visit-tags-table

replace-regexp

In `replace-regexp’, the NEWSTRING need not be constant. It can refer to all or part of what is matched by the REGEXP. `\&’ in NEWSTRING stands for the entire text being replaced. `\D’ in NEWSTRING, where D is a digit, stands for whatever matched the D’th parenthesized grouping in REGEXP. For example,

M-x replace-regexp  c[ad]+r  \&-safe 

would replace (for example) `cadr’ with `cadr-safe’ and `cddr’ with `cddr-safe’.

M-x replace-regexp  \(c[ad]+r\)-safe  \1 

would perform exactly the opposite replacements. To include a `\’ in the text to replace with, you must give `\\’.

M-x -replace-regexp \([0-9]\)1, \1a,

would replace smth like SLK21, into SLK2a,

Set C indent style to 8 characters

;;; --- Add it to C mode Hook
(c-add-style "DAP" 
             '((c-basic-offset  . 8)
               (substatement-open . 0)
               (c-offsets-alist . (
                                   (namespace-open . 0)
                                   (namespace-close . 0)
                                   (innamespace . 0)
                                   ;;; -- brace that opens a substatement block
                                   (substatement-open . 0)
                                   ;;; -- brace that opens an in-class inline me
thod
                                   (inline-open . 0)
                   (case-label . +)
                   (access-label . -2)
                   (class-open . 0)
                                   )
                                )
               ))
(defun dap-hook ()
  (c-set-style "DAP"))
(add-hook 'c-mode-hook 'dap-hook)

ifdef mode

M-x hide-ifdef-mode             Load mode
M-x hide-ifdefs (C-c @ h)       Explicitly hide ifdefs
M-x show-ifdefs (C-c @ s)       Undo hide-ifdefs
M-x hide-ifdef-define (C-c @ d) To define a symbol.
M-x hide-ifdef-undef (C-c @ u)  To undefine a symbol.

Syntactic analysis (c-offsets-alist)

We can use the command

C-c C-s (bound to c-show-syntactic-information)

to simply report what the syntactic analysis is for the current line.

E.g.:

void swap( int& a, int& b )
{
    int tmp = a;
    a = b;
    b = tmp;
}

Running this command on line 4 of this example, we’d see in the echo area:

((statement 35))

Install XEmacs

http://www.xemacs.org/Install/index.html

Recuperer p. ex. xemacs-21.4.22.tar.gz et xemacs-sumo.tar.gz

Creer un repertoire d’install temporaire dont on deplacera le contenu ensuite.

optimal> mkdir ~/install

Installer tout le bordel.

optimal> gzip -dc xemacs-21.4.22.tar.gz | tar xvf -
optimal> cd xemacs-21.4.22
optimal> usegcc346
optimal> ./configure --prefix=/u/gallinar/install
optimal> make
optimal> make install

Ensuite installer les xemacs-packages:

optimal> cd ~/install/lib/xemacs
optimal> gzip -dc ~/xemacs-sumo.tar.gz | tar xvf -

Deplacer ensuite tout le contenu de ~/install vers /u/engineering/...

Copy Paste shit in Virtualbox

VirtualBox host =Windows 7
VirtualBox Guest = Fedora 14 with OpenBox and Eterm
Basically, no selection you make in Eterm can be copied with Ctrl-Ins the expected way into Windows.
Copy Paste Hell Between Windows Host and Linux Guest in VirtualBox gave me part of the solution:
Install xsel with:
> sudo yum -y install xsel
And use the following command to capture selection in Eterm:
> xsel | xsel -b
The problem is now to bind it to a key, let's say Ctrl-Ins ;), in OpenBox.
In ~/.config/openbox/rc.xml, add the following:
    <keybind key="C-Insert">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>xsel</name>
        </startupnotify>
        <command>sh -c '/usr/bin/xsel | /usr/bin/xsel -b'</command>
      </action>
    </keybind>
Do not forget the sh -c or it won't work.

Monday, February 27, 2012

Extract RPM without installing

Extract RPM file using rpm2cpio and cpio command:
> rpm2cpio php-5.1.4-1.esp1.x86_64.rpm | cpio -idmv

Output:

/etc/httpd/conf.d/php.conf
./etc/php.d
./etc/php.ini
./usr/bin/php
...
19188 blocks
Output of rpm2cpio piped to cpio command (see how to use cpio) with following options:
  • i: Restore archive
  • d: Create leading directories where needed
  • m: Retain previous file modification times when creating files
  • v: Verbose i.e. display progress

Sunday, February 26, 2012

Restarts apache on Ubuntu

> sudo /etc/init.d/apache2 restart
or
> sudo service apache2 restart
or
> sudo apachectl restart

Friday, February 24, 2012

Changelanguage to english in SQL Developer

In %SQL_DEVELOPER_PATH%\sqldeveloper\bin\sqldeveloper.conf, add
AddVMOption -Duser.language=en

No directory /home/jerome logging in with home=/

Solution:
> sudo touch /.autorelabel
> sudo reboot

Thursday, February 23, 2012

PL/SQL: format decimals like french

ALTER SESSION SET NLS_NUMERIC_CHARACTERS = ', ';

Tuesday, February 21, 2012

Resize a Fedora .vdi file in Oracle VM VirtualBox 4.1.8

The LVM system file used by Fedora is not supported by GParted.
In order to add the new volume to the existing partition, we need to use system-config-lvm.
sudo yum -y install system-config-lvm
French article describing how to proceed. NB: If meeting the following error:
process 702: D-Bus library appears to be incorrectly set up; failed to read 
machine uuid: Failed to open "/var/lib/dbus/machine-id": No such file or directory.
Then run the following command as root.
> dbus-uuidgen > /var/lib/dbus/machine-id

Sunday, February 19, 2012

Disable 3G on Android

  • Open dialer
  • Dial *#*#4636#*#*
  • Tap 'Phone Information'
  • Press Menu button
  • Tap on More
  • Tap Disable data connection
  • Tap Disable data on boot

Friday, February 17, 2012

List perl module dependencies

perl -MTime::Local -e 'print $_," => ",$INC{$_},"\n" for keys %INC'

Tuesday, February 14, 2012

Permanent hostname change on RedHat based systems

From MDLog:/sysadmin:
RedHat based system use the file /etc/sysconfig/network to read the saved hostname at system boot. This is set using the init script /etc/rc.d/rc.sysinit
/etc/sysconfig/network:
NETWORKING=yes
HOSTNAME="plain.domainname.com"
GATEWAY="192.168.0.1"
GATEWAYDEV="eth0"
FORWARD_IPV4="yes"
So in order to preserve your change on system reboot edit this file and enter the appropriate name using the HOSTNAME variable.

Permanent hostname change on Debian based systems

From MDLog:/sysadmin:
Debian based systems use the file /etc/hostname to read the hostname of the system at boot time and set it up using the init script /etc/init.d/hostname.sh
/etc/hostname:
server
So on a Debian based system we can edit the file /etc/hostname and change the name of the system and then run:
/etc/init.d/hostname.sh start
to make the change active. The hostname saved in this file (/etc/hostname) will be preserved on system reboot.

yum

YUM : Configuration du gestionnaire de paquets

Monday, February 13, 2012

Fedora: users managenent

Create user:
useradd --home /home/jerome jerome -g users
passwd jerome
Delete user:
userdel --remove jerome

Thursday, February 9, 2012

Make sure only one invocation of a script is active at a time

Neat solution implemented in Sys::RunAlone CPAN module.

Wednesday, February 8, 2012

Copy rectangle

C-x rr i       copy rectangle into register i
C-x rg i       paste rectangle from register i
C-x rk         cut rectangle region 
C-x ry         yank rectangle region 
C-x rc         clear rectangle region

CPAN install: do not have write permissions on

Installing DBIx::Class::Schema::Loader from CPAN results in some permissions error:
cpan[1]> install DBIx::Class::Schema::Loader
...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/usr/local/bin'
Do not have write permissions on '/usr/local/bin'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 at -e line 1
make: *** [pure_site_install] Error 13
  ANDK/CPAN-1.9800.tar.gz
  /usr/bin/make install  -- NOT OK
----
  You may have to su to root to install the package
  (Or you may want to run something like
    o conf make_install_make_command 'sudo make'
  to raise your permissions.Failed during this command:
 ANDK/CPAN-1.9800.tar.gz                      : install NO
Trying as suggested will do no good:
cpan[4]> o conf make_install_make_command 'sudo make'
    make_install_make_command [sudo make]
Please use 'o conf commit' to make the config permanent!

cpan[5]> install DBIx::Class::Schema::Loader
Running install for module 'DBIx::Class::Schema::Loader'
Running make for R/RK/RKITOVER/DBIx-Class-Schema-Loader-0.07017.tar.gz
  Has already been unwrapped into directory /home/jerome/.cpan/build/DBIx-Class-Schema-Loader-0.07017-_upIn_
  Has already been made
Running make test
  Has already been tested successfully
Running make install
  Already tried without success
So the solution is:
cpan[6]> force install DBIx::Class::Schema::Loader

Install perl modules locally - Best approach

local::lib is a Perl module that sets everything up so you can install distributions from CPAN into your home directory.
Download it from http://search.cpan.org/dist/local-lib.
tar xvfz local-lib-1.008004.tar.gz
cd local-lib-1.008004
We now need to tell local::lib we want it to 'bootstrap' itself. This creates a 'perl5' folder within your home directory, and instructs the toolchain to install local::lib there.
perl Makefile.PL --bootstrap
Then, build, test and install local::lib:
make
make test
make install
Now set some environment variables that tell Perl where your installed modules are kept.
echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >>~/.bashrc
Test it:
perl -MCPAN -eshell
At the CPAN prompt, enter:
cpan[1]> install DBIx::Class::Schema::Loader

Install a perl module locally

On Solaris, installing a Perl module can be done that way:
export PERL5LIB=/u/gallinar/perl5lib/tmp/lib/site_perl
perl Makefile.PL PREFIX=/u/gallinar/perl5lib/tmp CC=gcc LD=gcc CCCDLFLAGS=-fPIC OPTIMIZE=-O3 CCFLAGS=" "
make
make install

Tuesday, February 7, 2012

Use Java 7 with SQL Developer

If using Java 7 with Oracle SQL Developer 3.1 for Windows, one can get an error message about MSCVR100.dll missing.
Solution:
Simply copy MSCVCR100.dll from java bin directory into sqldeveloper directory.

Monday, February 6, 2012

Closures

In Perl or PHP 5.3+, closures are implemented as anonymous subroutines with lasting references to lexical variables outside their own scopes.
Perl example:
#!/usr/bin/perl

sub test_it {
    my ($count) = @_;
    return sub { ++$count; };
}

my $test1 = test_it(10);
my $test2 = test_it(50);
print $test1->(), "\n";         # 11
print $test2->(), "\n";         # 51
print $test1->(), "\n";         # 12
print $test2->(), "\n";         # 52

PHP distinguishes between read-only closures or read-write closures:
#!/usr/bin/php

<?php
function test_it_ro($count) {
    return function() use($count) {
        return ++$count;
    };
}
function test_it_rw($count) {
    return function() use(&$count) {
        return ++$count;
    };
}
$test1 = test_it_ro(10);
$test2 = test_it_ro(50);
print $test1()."\n";            // 11
print $test2()."\n";            // 51
print $test1()."\n";            // 11
print $test2()."\n";            // 51

$test1 = test_it_rw(10);
$test2 = test_it_rw(50);
print $test1()."\n";            // 11
print $test2()."\n";            // 51
print $test1()."\n";            // 12
print $test2()."\n";            // 52
?>

Thursday, February 2, 2012

How to use Git to test an idea

Setup git in your project directory:
git init
This will create a local .git repository for git. Run
git status
As we did not add any files to git, it will show you all files as untracked.
Suppose we want to exclude .svn folders from git, then in .git/info/exclude, add line
.svn*
From now on, git status won't show .svn folders anymore.
Add all project's files to git:
git add .
git status will show all files as ready to be commited. Proceed:
git commit -am "initial file import"
Run: git status - it will show everything is ok
Now, suppose we want to experiment a new idea without impacting other developers. For that, we will create a new branch.
git branch idea
git checkout idea
or
git checkout -b idea
Run git status, it will show you are in new branch.
Now you can make all you changes and commits.
If you want to switch back to the main branch:
git checkout master
and return to the new branch:
git checkout idea
If you want to merge the new branch into the master branch, you have to move all changes made in the idea branch.
git checkout master
git merge idea
To drop the idea branch, run:
git branch -d idea

Rapid s h a r e series

Series in french or VOSTFR.

PHP debugging

French article on how to debug PHP with the Xdebug extension.

Native PHP extension for enum

This is what the SplEnum class is all about.
Example use here.

Tuesday, January 31, 2012

Return no wildcard

From Effective Java, 2nd edition:

Do not use wildcard types as return types.

E.g.,
public static <E> Set<E> union(Set<E> s1, Set<E> s2)
should be re-written
public static <E> Set<E> union(Set<? extends E> s1, Set<? extends E> s2)

Java bounded wildcards

From Effective Java, 2nd edition

For maximum flexibility, use wildcard types on input parameters that represent producers or consumers.
Mnemonic:
PECS stands for producer-extends, consumer-super.

E.g., method that takes a sequence of elements and pushes them all onto the stack:
// pushAll method without wildcard type - deficient!
public void pushAll(Iterable<E> src) {
    for (E e : src) {
        push(e);
    }
}
should be re-written:
// Wildcard type for parameter that serves as an E producer
public void pushAll(Iterable<? extends E> src) {
    for (E e : src) {
        push(e);
    }
}
Similarly, a method that pops each element off the stack and adds the elements to the given collection:
// popAll method without wildcard type - deficient!
public void popAll(Collection<E> dst) {
    while (!isEmpty()) {
        dst.add(pop());
    }
}
should be re-written:
// Wildcard type for parameter that serves as an E consumer
public void popAll(Collection<? super E> dst) {
    while (!isEmpty()) {
        dst.add(pop());
    }
}

Java unbounded wildcards

From Effective Java, 2nd edition:

If a type parameter appears only once in a method declaration, replace it with a wildcard.

For example, given a static method swapping 2 items in a list, prefer
public static void swap(List<?> list, int i, int j);
over
public static <E> void swap(List<E> list, int i, int j);
However, this implementation won't compile:
public static void swap(List<?> list, int i, int j) {
    list.set(i, list.set(j, list.get(i)));
}
because you can’t put any value except null into a List<?>. Instead, we will have to use:
public static void swap(List<?> list, int i, int j) {
    swapHelper(list, i, j);
}
// Private helper method for wildcard capture
private static <E> void swapHelper(List<E> list, int i, int j) {
    list.set(i, list.set(j, list.get(i)));
}

Wednesday, January 25, 2012

SyntaxHighLighter with java and generics

In order to use SyntaxHighLighter with java code containing generics, you first need to have all < and > being replaced with &lt; and &gt;
This can be done automatically by this online HTML encoder.

Use composition in place of inheritance

From Effective java, 2nd edition:
// Wrapper class - uses composition in place of inheritance
public class InstrumentedSet<E> extends ForwardingSet<E> {
    private int addCount = 0;
    public InstrumentedSet(Set<E> s) {
        super(s);
    }
    @Override public boolean add(E e) {
        addCount++;
        return super.add(e);
    }
    @Override public boolean addAll(Collection<? extends E> c) {
        addCount += c.size();
        return super.addAll(c);
    }
    public int getAddCount() {
        return addCount;
    }
}
// Reusable forwarding class
public class ForwardingSet<E> implements Set<E> {
    private final Set<E> s;

    public ForwardingSet(Set<E> s) { this.s = s; }
    public void clear() { s.clear(); }
    public boolean contains(Object o) { return s.contains(o); }
    public boolean isEmpty() { return s.isEmpty(); }
    public int size() { return s.size(); }
    public Iterator<E> iterator() { return s.iterator(); }
    public boolean add(E e) { return s.add(e); }
    public boolean remove(Object o) { return s.remove(o); }
    public boolean containsAll(Collection<?> c)
    { return s.containsAll(c); }
    public boolean addAll(Collection<? extends E> c)
    { return s.addAll(c); }
    public boolean removeAll(Collection<?> c)
    { return s.removeAll(c); }
    public boolean retainAll(Collection<?> c)
    { return s.retainAll(c); }
    public Object[] toArray() { return s.toArray(); }
    public <T> T[] toArray(T[] a) { return s.toArray(a); }
    @Override public boolean equals(Object o)
    { return s.equals(o); }
    @Override public int hashCode() { return s.hashCode(); }
    @Override public String toString() { return s.toString(); }
}
// Example use
Set<Date> s = new InstrumentedSet<Date>(new TreeSet<Date>(comparator));

Tuesday, January 24, 2012

Adove Reader: save last page

Edit -> Preferences -> Documents
[x] Restore last view settings when reopening documents

Exposing class fields

From Effective Java, 2nd edition:

In summary, public classes should never expose mutable fields. It is less harmful, though still questionable, for public classes to expose immutable fields. It is, however, sometimes desirable for package-private or private nested classes to expose fields, whether mutable or immutable.

Beware of public static final array fields

From Effective Java, 2nd edition:

Note that a nonzero-length array is always mutable, so it is wrong for a class to have a public static final array field, or an accessor that returns such a field. If a class has such a field or accessor, clients will be able to modify the contents of the array.
// Potential security hole!
public static final Thing[] VALUES = { ... };
Solution:
Either:
private static final Thing[] PRIVATE_VALUES = { ... };
public static final List<Thing> VALUES =
    Collections.unmodifiableList(Arrays.asList(PRIVATE_VALUES));
Or:
private static final Thing[] PRIVATE_VALUES = { ... };
public static final Thing[] values() {
    return PRIVATE_VALUES.clone();
}

The Bridge pattern

Problem: Draw rectangles and circles with either of two drawing programs without causing an explosion in the number of classes.
Solution: Decoupling implementation from the objects that use them.
public abstract class AbstractShape {
    private DrawingProgram dp;
    public abstract void draw();
    public AbstractShape(DrawingProgram dp) {
        this.dp = dp;
    }
    public void drawLine() {
        this.dp.drawLine();
    }
    public void drawCircle() {
        this.dp.drawCircle();
    }
}
public class Rectangle extends AbstractShape {
    public Rectangle(DrawingProgram dp) {
        super(dp);
    }
    @Override public void draw() {
        drawLine(); drawLine(); drawLine(); drawLine();
    }
}
public class Circle extends AbstractShape {
    public Circle(DrawingProgram dp) {
        super(dp);
    }
    @Override public void draw() {
        drawCircle();
    }
}
public interface DrawingProgram {
    void drawLine(); // implicitly public
    void drawCircle();
}
public class DrawingProgram1 implements DrawingProgram {
    @Override public void drawLine() { ... }
    @Override public void drawCircle() { ... }
}
public class DrawingProgram2 implements DrawingProgram {
    @Override public void drawLine() { ... }
    @Override public void drawCircle() { ... }
}
public class client {
    public static void main(String[] args) {
        Drawing dp1 = new DrawingProgram1();
        Rectangle rectangle = new Rectangle(dp1);
        Drawing dp2 = new DrawingProgram2();
        Circle circle = new Circle(dp2);

        circle.draw();
        rectangle.draw();
    }
}

The Abstract Factory pattern

Problem: Instantiate families of objects.
Solution: The Abstract Factory pattern defines the interface for how to create each member of the family.
public interface WindowFactory {
    Window createWindow(); // implicitly public
}
public MsWindowFactory implements WindowFactory {
    @Override public Window createWindow() {
        return new MsWindow();
    }
}
public AppleWindowFactory implements WindowFactory {
    @Override public Window createWindow() {
        return new AppleWindow();
    }
}
public Client {
    public static void main(String[] args) {

        WindowFactory  factory;
        String osName = System.getProperty("os.name");
        if ((osName != null) && (osName.indexOf("Windows") != -1)) {
            factory = new MsWindowFactory();
        } else {
            factory = new AppleWindowFactory();
        }

        Window window = factory.createWindow();
    }
}

SwingWorker

Problem: Perform a time-consuming task, likely to freeze the GUI.
Solution: Use the SwingWorker class, part of java 6.
Example:
private Document doc;
...
JButton button = new JButton("Load");
button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        SwingWorker<Document, Void> worker = 
            new SwingWorker<Document, Void>() {
                @Override public Document doInBackground() {
                    return load();
                }
                @Override public void done() {
                    try {
                        doc = get();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            };
        worker.execute();
   }
});

invokeLater vs. invokeAndWait

SwingUtilities.invokeLater(Runnable):
Asynchronous call used to update the GUI from the AWT Event Dispatching Thread.
SwingUtilities.invokeAndWait(Runnable):
Synchronous call used to update the GUI from the application thread.

Password strength validation with regex

Checking passwords with regex by using positive lookahead assertions.

Monday, January 23, 2012

Update VirtualBox to 4.1.8

  • Download VirtualBox-4.1.8-75467-Win.exe
  • Download VBoxGuestAdditions_4.1.8.iso
  • Unmount the VBoxGuestAdditions.iso under "Parameters | Storage | IDE Controller"
  • Do the update of VirtualBox
  • Restart VirtualBox
  • Copy the new VBoxGuestAdditions ISO into c:\program files\oracle\virtualbox
  • Mount the new VBoxGuestAdditions ISO under "IDE Controller"
  • Start the new VM
  • Re-install VBoxLinuxAdditions like previously done:
  • sudo mount /dev/cdrom /media/cdrom
    cd /media/cdrom
    sudo ./VBoxLinuxAdditions.run
    sudo reboot
  • Unmount the VBoxGuestAdditions ISO
In case of problems with VirtualBox Guest Additions:
http://www.if-not-true-then-false.com/2010/install-virtualbox-guest-additions-on-fedora-centos-red-hat-rhel/

The Factory Method pattern

Problem: A class needs to instantiate a derivation of another class, but doesn't know which one.
Solution: The Factory Method defines an interface for creating objects, but lets subclasses decide which classes to instantiate.
public interface Logger {
    void debug(String message); // implicitly public
}
public class FileLogger implements Logger {
    @Override public void debug(String message) { ... }
}
public abstract class AbstractLoggerFactory {
    public abstract Logger createLogger(); // factory method

    public Logger getLogger() {
        Logger logger = createLogger();
        ...
        return logger;
    }
}
public class FileLoggerFactory extends AbstractLoggerFactory {
    @Override
    public Logger createLogger() {
        return new FileLogger();
    }
}
public class Client {
    private AbstractLoggerFactory factory = new FileLoggerFactory();
    public doSomething(AbstractLoggerFactory factory) {
        Logger logger = factory.getLogger();
        logger.debug("debug message");
    }
}

The Singleton pattern

Problem: Several clients need to refer to the same thing.
Solution: The Singleton pattern guarantees a class has only one instance.
// Enum singleton - the preferred approach: concise + serializable
public enum Singleton { // implicitly final
    INSTANCE; // implicitly public static final
    public void doSomething() { ... }
}

Saturday, January 21, 2012

Online tool for Visio like UML modelling

You can try gliffy for free.

The Visitor pattern

Problem: Determine the postage for the items in a shopping cart.
Solution: The Visitor pattern creates an external class that will use the data of the cart items to compute the postage.
public interface Visitable {
    void accept(Visitor visitor); // implicitly public
}
public class Book implements Visitable {
    @Override public void accept(Visitor visitor) {
        if (...) visitor.visit(this);
    }
}
public interface Visitor {
    void visit(Book book); // implicitly public
    void visit(CD cd);
}
public class PostageVisitor implements Visitor {
    @Override public void visit(Book book) {
        this.totalPostage += ...;
    }
    @Override public void visit(CD cd) {
        this.totalPostage += ...;
    }
    public void getTotalPostage() {
        return this.totalPostage;
    }
}
public class Client {
    public double calculatePostage() {
        PostageVisitor visitor = new PostageVisitor();
        for (Visitable item : this.items) {
            item.accept(visitor);
        }
        return visitor.getTotalPostage();
    }
}

The Adapter pattern

Problem: A system has the right data and behavior but the wrong interface.
Solution: The Adapter provides a wrapper with the desired interface.

The Facade pattern

Problem: Use a subset of a complex system.
Solution: The Facade presents a new interface of the system.

SyntaxHighlighter splits my source code

My first install of SyntaxHighlighter in Blogger was splitting my source code like this:

This was due to my using some Blogger CSS customization for the <code> tag:
code {
    ...
    display: block;
}

Superfluous vertical scrollbars in SyntaxHighlighter

Add this to the Blogger CSS:
.syntaxhighlighter {
    padding: 1px !important;
}

SyntaxHighlighter in Blogger

This article says it all. The site also generates the lines to add in Blogger template.

Friday, January 20, 2012

Push a bunch of files over SSH to a remote location

Example given:
  1. TAR + GZIP some files (including directories)
  2. SSH them onto mamlan.com remote host using me as a user and www/ectasea as a target directory
  3. UnGZIP + unTAR everything
tar czf - 3rdparty common ectasea extensions global.inc index.php login 
| ssh me@mamlan.com "tar xzf - -C www/ectasea"

Thursday, January 19, 2012

GWT debugging on Windows in a VirtualBox Linux VM

This post shows how to use a browser on a host (Windows 7) with Eclipse running a GWT project on the VirtualBox guest (Ubuntu server).

Below, my Ubuntu guest has been named "fart".

Close frame programmatically

If we assume we are in a MyJFrame sub-class:

MyJFrame.this.processWindowEvent(
    new WindowEvent(MyJFrame.this,WindowEvent.WINDOW_CLOSED));

Java SE is deprecated!

[Charles Humble]:

"JavaFX 2 is something that completely replaces AWT, Java2D, Swing, Java Sound, Applets, ImageIO, Accessibility - in short, the entire Client layer of the JavaSE platform."

Recording events

Recording events in a suitable format will be supported in a later version of this product, once the replay side has stabilised. In the meantime, you can get event information in an undocumented way. The Java home directory has a subdirectory lib containing a file awt.properties. If you add the line
AWT.EventQueueClass=jnewmarch.replay.TracedEventQueue
to this, then all events that enter the event queue will be printed to standard output.

Where does this beep come from?

I was recently given the task of figuring out why our client application kept beeping all the time. It sounds funny but the continued noise was getting on my nerves. I searched our application for all calls to beep() on the toolkit and found nothing. Apparently, it was coming from one of our commercially purchased components that we do not have the source code for ... great. What to do now? Well I thought about trying to use AOP in some fashion to find the source of the problem but we don't have AOP currently in our application. I finally decided to do the following:
  1. Subclass MToolkit
  2. Call System.setProperty("awt.toolkit", "com.MyToolkit") to install it at startup.
  3. Set a breakpoint in my toolkit's beep() method. View the stacktrace when the beep is invoked.

equals()

Because the default hashCode() gives an answer based on the instance's identity, it is incorrect to implement equals() without implementing a corresponding hashCode() method. e.g.
public class Person {
    private String name;
    private Date birth;
    public boolean equals(Object other) {
        if (other == this) return true;
        if (other == null) return false;
        if (getClass() != other.getClass()) return false;
        Person person = (Person)other;
        return (
            (name == person.name ||
             (name != null && name.equals(person.name))) &&
            (birth == person.birth ||
             (birth != null && birth.equals(person.birth)))
            );
    }
}

instanceof

Toujours privilegier getClass() sur instanceof() car instanceof n'est pas symetrique.

Update a jar

jar uvf jgui-2.0.jar -C src/

Print stack trace in normal situation

Thread.currentThread().dumpStack();

Swing tips

  • Keep all your UI/view code in a separate package like blackmamba.ui.
  • Create a package for the control, such as blackmamba.ui.control. This is where you write all your UI logic. I like to name my control classes as verbs (Start, Login, Configure, etc.) and my view classes as nouns.

Find the frame or desktop pane which the specified component is in.

static Frame JOptionPane.getFrameForComponent(Component)

Center dialog relatively to frame

            // Always pack before using setLocationRelativeTo
            myDialog.dialog.pack();
            myDialog.dialog.setLocationRelativeTo(frame);

applet AccessControlException java.net.SocketPermission denied

Look in:
C:\Program Files\j2sdk1.4.2\jre\lib\security\java.policy
and
C:\Documents and Settings\gallinari\.java.policy

How detecting whether a JTable cell has the focus?

boolean rowIsAnchor = (getSelectionModel().getAnchorSelectionIndex() == row);
boolean colIsAnchor =
    (getColumnModel().getSelectionModel().getAnchorSelectionIndex() == column);

How can I simulate a double click from a single click in a JTable?

javax.swing.DefaultCellEditor dce =
          (javax.swing.DefaultCellEditor)table.getDefaultEditor(Object.class);
      dce.setClickCountToStart(1);

Add a black border

import javax.swing.BorderFactory;
import java.awt.Color;

setBorder(BorderFactory.createLineBorder(Color.black);

How can I access text entered in a JComboBox, when the user does not hit enter?

Location: http://www.jguru.com/faq/view.jsp?EID=53753 Author: Sandip Chitale Question originally asked by tracey marsh The easiest way to do this is to watch for changes in focus. WHen the user leaves the combo box (to press a button or work with another component, for example) you can catch a focusLost event from the JComboBox's editor. The following code assumes you haven't changed the editor for the combo box (which is probably the case).
if (comboBox.getEditor().getEditorComponent()
    instanceof JTextField) {
  JTextField tf = 
    (JTextField)comboBox.getEditor().getEditorComponent();

  tf.addFocusListener(new FocusAdapter() {
    public void focusLost(FocusEvent fe) {
      // get the text using getText() method
    }});
}

How can I set the minimum size of a Window/Frame?

Derived from A question posed by David Jones Topics Java:API:AWT:Widgets Author Sandip Chitale Answer Subclass and override -
public Dimension getMinimumSize() {
  return new Dimension(
    MINIMUM_WIDTH, MINIMUM_HEIGHT);
}
Note that the native implementation of Frame does not allow minimum size below certain size.

JTable size policy

Here's the deal. During layout, the viewport is queried for its preferred size. The viewport returns one of the following:
  1. zero width, zero height
  2. its single child's preferred size if the child's not a Scrollable
  3. its single child's preferredScrollableViewportSize if the child's a Scrollable
Since JTable is a Scrollable(i.e., it implements the Scrollable interface), the viewport returns 3) above. JTable's initial preferredScrollableViewportSize's height is 400. Thus, you get a height of 400 even if you set the table's preferred size's height to 17. Call setPreferredScrollableViewportSize() to change the preferred viewport size.

Reads next token from stream tokenizer

    /**
     * Reads the next token from the given stream tokenizer.
     *
     * @param aScanner  Stream tokenizer to read from.
     * @return          Read string token or null.
     *
     * @ulcm.msg 403 getString()
     * @ulcm.msg 410 EOF
     * @ulcm.msg 411 EOL
     */
    private String getString(StreamTokenizer aScanner) {

        String rtnString = null;
        try {
            aScanner.nextToken();
            switch (aScanner.ttype) {
                case StreamTokenizer.TT_EOF:
                    rtnString = CommItlBundle.getString(410);
                    break;
                case StreamTokenizer.TT_EOL:
                    rtnString = CommItlBundle.getString(411);
                    break;
                case StreamTokenizer.TT_WORD:
                    rtnString = aScanner.sval;
                    break;
                case StreamTokenizer.TT_NUMBER:
                    rtnString = String.valueOf((int) aScanner.nval);
                    break;
                case '"':
                    rtnString = aScanner.sval;
                    break;
                default:
                    rtnString = String.valueOf((char) aScanner.ttype);
            }
        } catch (IOException e) {

            if (this.LOGGER.isLoggable(Level.FINER)) {

                this.LOGGER.throwing(getClass().getName(),
                                     CommItlBundle.getString(403),
                                     e);
            }
        }
        return rtnString;
    }

Testing your css or javascript code

  1. Go to JSFiddle.
  2. Put the HTML in the HTML area, the CSS in the CSS area, and the JavaScript in the JavaScript area
  3. Press Run and see if the result is demonstrating the problem, adjust as needed to make the problem very clear.
  4. Press Save to get a public URL.
  5. Share that URL where you are trying to get the troubleshooting help.

Git worflow

Git training

A Git training by Ralf Ebert.

Monday, January 16, 2012

Installing ant 1.8.2 onto ubuntu 11.10

Download ant and copy it under /usr/lib:
cd /usr/lib
sudo tar xvfz /media/host/apache-ant-1.8.2-bin.tar.gz
sudo ln -s apache-ant-1.8.2 apache-ant
sudo update-alternatives --install /usr/bin/ant ant /usr/lib/apache-ant/bin/ant 1

Install JDK 7 onto Ubuntu 11.10

Download the latest Oracle JDK 7 from here.
sudo mkdir -p /usr/lib/jvm/
cd /usr/lib/jvm/
tar xvfz /media/host/jdk-7u2-linux-x64.tar.gz
ln -s jdk1.7.0_02 jdk
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install update-java
sudo update-java
and select /usr/lib/jvm/jdk