Thursday, August 23, 2012

Bash script: Stay Out Of Trouble






String Comparison Result 
string1 = string2                                            True if the strings are equal. 
string1 != string2                                          True if the strings are not equal. 
-n string                                                            True if the string is not null. 
-z string                                                            True if the string is null (an empty string).


Arithmetic Comparison Result 
expression1 -eq expression2 True if the expressions are equal. 
expression1 -ne expression2 True if the expressions are not equal. 
expression1 -gt expression2 True if expression1is greater than expression2. 
expression1 -ge expression2 True if expression1is greater than or equal to 
expression2. 
expression1 -lt expression2 True if expression1is less than expression2. 
expression1 -le expression2 True if expression1is less than or equal to 
expression2. 
! expression True if the expression is false, and vice versa.



File Conditional Result 
-d file True if the file is a directory. 
-e file True if the file exists. Note that, historically, the -e option has not 
been portable, so -f is usually used. 
-f file True if the file is a regular file. 
-g file True if set-group-id is set on file. 
-r file True if the file is readable. 
-s file True if the file has nonzero size. 
-u file True if set-user-id is set on file. 
-w file True if the file is writable. 
-x file True if the file is executable. 






Debugging Scripts 


Command Line Option setOption Description 
sh -n

Wednesday, June 6, 2012

errno, perror, strerr




Diagrams
http://bramp.github.io/js-sequence-diagrams/


IDE one:
http://ideone.com
Ideone is an online compiler and debugging tool which allows you to compile source code and execute it online in more than 60 programming languages.



errno.h - C Error Codes in Linux


cat /usr/include/asm-generic/errno-base.h
#ifndef _ASM_GENERIC_ERRNO_BASE_H
#define _ASM_GENERIC_ERRNO_BASE_H

#define EPERM            1      /* Operation not permitted */
#define ENOENT           2      /* No such file or directory */
#define ESRCH            3      /* No such process */
#define EINTR            4      /* Interrupted system call */
#define EIO              5      /* I/O error */
#define ENXIO            6      /* No such device or address */
#define E2BIG            7      /* Argument list too long */
#define ENOEXEC          8      /* Exec format error */
#define EBADF            9      /* Bad file number */
#define ECHILD          10      /* No child processes */
#define EAGAIN          11      /* Try again */
#define ENOMEM          12      /* Out of memory */
#define EACCES          13      /* Permission denied */
#define EFAULT          14      /* Bad address */
#define ENOTBLK         15      /* Block device required */
#define EBUSY           16      /* Device or resource busy */
#define EEXIST          17      /* File exists */
#define EXDEV           18      /* Cross-device link */
#define ENODEV          19      /* No such device */
#define ENOTDIR         20      /* Not a directory */
#define EISDIR          21      /* Is a directory */
#define EINVAL          22      /* Invalid argument */
#define ENFILE          23      /* File table overflow */
#define EMFILE          24      /* Too many open files */
#define ENOTTY          25      /* Not a typewriter */
#define ETXTBSY         26      /* Text file busy */
#define EFBIG           27      /* File too large */
#define ENOSPC          28      /* No space left on device */
#define ESPIPE          29      /* Illegal seek */
#define EROFS           30      /* Read-only file system */
#define EMLINK          31      /* Too many links */
#define EPIPE           32      /* Broken pipe */
#define EDOM            33      /* Math argument out of domain of func */
#define ERANGE          34      /* Math result not representable */

#endif


cat /usr/include/asm-generic/errno.h
#ifndef _ASM_GENERIC_ERRNO_H
#define _ASM_GENERIC_ERRNO_H

#include 

#define EDEADLK         35      /* Resource deadlock would occur */
#define ENAMETOOLONG    36      /* File name too long */
#define ENOLCK          37      /* No record locks available */
#define ENOSYS          38      /* Function not implemented */
#define ENOTEMPTY       39      /* Directory not empty */
#define ELOOP           40      /* Too many symbolic links encountered */
#define EWOULDBLOCK     EAGAIN  /* Operation would block */
#define ENOMSG          42      /* No message of desired type */
#define EIDRM           43      /* Identifier removed */
#define ECHRNG          44      /* Channel number out of range */
#define EL2NSYNC        45      /* Level 2 not synchronized */
#define EL3HLT          46      /* Level 3 halted */
#define EL3RST          47      /* Level 3 reset */
#define ELNRNG          48      /* Link number out of range */
#define EUNATCH         49      /* Protocol driver not attached */
#define ENOCSI          50      /* No CSI structure available */
#define EL2HLT          51      /* Level 2 halted */
#define EBADE           52      /* Invalid exchange */
#define EBADR           53      /* Invalid request descriptor */
#define EXFULL          54      /* Exchange full */
#define ENOANO          55      /* No anode */
#define EBADRQC         56      /* Invalid request code */
#define EBADSLT         57      /* Invalid slot */

#define EDEADLOCK       EDEADLK

#define EBFONT          59      /* Bad font file format */
#define ENOSTR          60      /* Device not a stream */
#define ENODATA         61      /* No data available */
#define ETIME           62      /* Timer expired */
#define ENOSR           63      /* Out of streams resources */
#define ENONET          64      /* Machine is not on the network */
#define ENOPKG          65      /* Package not installed */
#define EREMOTE         66      /* Object is remote */
#define ENOLINK         67      /* Link has been severed */
#define EADV            68      /* Advertise error */
#define ESRMNT          69      /* Srmount error */
#define ECOMM           70      /* Communication error on send */
#define EPROTO          71      /* Protocol error */
#define EMULTIHOP       72      /* Multihop attempted */
#define EDOTDOT         73      /* RFS specific error */
#define EBADMSG         74      /* Not a data message */
#define EOVERFLOW       75      /* Value too large for defined data type */
#define ENOTUNIQ        76      /* Name not unique on network */
#define EBADFD          77      /* File descriptor in bad state */
#define EREMCHG         78      /* Remote address changed */
#define ELIBACC         79      /* Can not access a needed shared library */
#define ELIBBAD         80      /* Accessing a corrupted shared library */
#define ELIBSCN         81      /* .lib section in a.out corrupted */
#define ELIBMAX         82      /* Attempting to link in too many shared libraries */
#define ELIBEXEC        83      /* Cannot exec a shared library directly */
#define EILSEQ          84      /* Illegal byte sequence */
#define ERESTART        85      /* Interrupted system call should be restarted */
#define ESTRPIPE        86      /* Streams pipe error */
#define EUSERS          87      /* Too many users */
#define ENOTSOCK        88      /* Socket operation on non-socket */
#define EDESTADDRREQ    89      /* Destination address required */
#define EMSGSIZE        90      /* Message too long */
#define EPROTOTYPE      91      /* Protocol wrong type for socket */
#define ENOPROTOOPT     92      /* Protocol not available */
#define EPROTONOSUPPORT 93      /* Protocol not supported */
#define ESOCKTNOSUPPORT 94      /* Socket type not supported */
#define EOPNOTSUPP      95      /* Operation not supported on transport endpoint */
#define EPFNOSUPPORT    96      /* Protocol family not supported */
#define EAFNOSUPPORT    97      /* Address family not supported by protocol */
#define EADDRINUSE      98      /* Address already in use */
#define EADDRNOTAVAIL   99      /* Cannot assign requested address */
#define ENETDOWN        100     /* Network is down */
#define ENETUNREACH     101     /* Network is unreachable */
#define ENETRESET       102     /* Network dropped connection because of reset */
#define ECONNABORTED    103     /* Software caused connection abort */
#define ECONNRESET      104     /* Connection reset by peer */
#define ENOBUFS         105     /* No buffer space available */
#define EISCONN         106     /* Transport endpoint is already connected */
#define ENOTCONN        107     /* Transport endpoint is not connected */
#define ESHUTDOWN       108     /* Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS    109     /* Too many references: cannot splice */
#define ETIMEDOUT       110     /* Connection timed out */
#define ECONNREFUSED    111     /* Connection refused */
#define EHOSTDOWN       112     /* Host is down */
#define EHOSTUNREACH    113     /* No route to host */
#define EALREADY        114     /* Operation already in progress */
#define EINPROGRESS     115     /* Operation now in progress */
#define ESTALE          116     /* Stale NFS file handle */
#define EUCLEAN         117     /* Structure needs cleaning */
#define ENOTNAM         118     /* Not a XENIX named type file */
#define ENAVAIL         119     /* No XENIX semaphores available */
#define EISNAM          120     /* Is a named type file */
#define EREMOTEIO       121     /* Remote I/O error */
#define EDQUOT          122     /* Quota exceeded */

#define ENOMEDIUM       123     /* No medium found */
#define EMEDIUMTYPE     124     /* Wrong medium type */
#define ECANCELED       125     /* Operation Canceled */
#define ENOKEY          126     /* Required key not available */
#define EKEYEXPIRED     127     /* Key has expired */
#define EKEYREVOKED     128     /* Key has been revoked */
#define EKEYREJECTED    129     /* Key was rejected by service */

/* for robust mutexes */
#define EOWNERDEAD      130     /* Owner died */
#define ENOTRECOVERABLE 131     /* State not recoverable */

#endif

Thursday, May 31, 2012

Job Ad






vav.info at yahoo com vn
Please let me know if you believe your experience and knowledge match the following:

       General
        Our products are based on the IS platform and mainly implemented using Erlang/OTP.
       Basic skills
        OTP/Erlang/IS competence
        Knowledge regarding the environment (Clearcase, Ericsson tools)
        Basic IMS
        SIP, H.248
        Agile/Scrum
        Written and spoken English
       Application specific skills:
        SBG specific knowledge (architecture, blocks)


       Included: 1 team (8 persons) for feature development
        Perform pre-studies, in selected cases support also the quick-study phase
        Design of the code for the assigned design objects.
        Design Documentation for the assigned design objects
        Coding (primarily Erlang)
        Unit Tests for the code.
        Function Test in a real SBG HW environment (where surrounding IMS nodes are simulated.), for feature development.
        Support to Ericsson concerning the developed parts (answering questions, etc.)
        Participation in task forces together with Ericsson if there are issues that require extra attention to handle.
        Later possibly also participation in early project phases (requirement analysis/definition, system level design, etc.).
        Working and tested software checked into the version handling system data store at Ericsson.
        Product/project documentation stored in the document archive at Ericsson.

Sunday, May 27, 2012

Mac OS X Shortcuts






Symbols seen on Mac menus and non-US Apple keyboards, with their common names


Shortcuts Common to Most Applications

hold option key with menu openshow additional menu options
spacebarsimulate a mouse click on focused object (i.e., the button or control that has a blue halo around it)
command-shift-?Search application help. As of 10.5, this also FAYT searches available menu items. It also activates the menu bar as keyboard navigable if the search string is empty.
command-shift-+increase font size
command--decrease font size
command-,preferences
command-?help
command-shift-:show spelling window
command-;check spelling
command-Aselect all
command-Ccopy
command-Dduplicate
command-shift-Cshow colors
command-Euse selection for find
command-Ffind
command-Gfind next
command-shift-Gfind previous
command-Hhide application windows
command-option-Hhide windows of other applications
command-Jscroll to selection
command-Mminimize (equivalent to double-clicking the title bar)
command-option-Mminimize all application windows (equivalent to option-double-clicking the title bar or option-clicking the minimize button)
command-Nnew
command-Oopen
command-Pprint
command-Qquit
command-Ssave
command-Ssave
command-shift-Ssave as
command-option-Ssave all
command-Tshow fonts
command-Vpaste
command-Wclose window
command-option-Wclose all application windows (equivalent to option-clicking the close button)
command-shift-Wclose a file and its associated windows
command-Xcut
command-Zundo
command-shift-Zredo



Shortcuts on laptops

On most Mac laptops, some of the function keys (F1 - F12) are used to control hardware features:
F1decrease brightness
F2increase brightness
F3mute on G4s, decrease volume on G3s
F4decrease volume on G4s, increase volume on G3s
F5increase volume on G4s, numlock on G3s
F6Num lock on G4s, mute on G3s
F7Display mode (mirror or extend external display)
F8disable backlit keyboards (Aluminum PowerBooks)
F9decrease keyboard brightness for backlit keyboards
F10increase keyboard brightness for backlit keyboards
F12eject (some Macs, namely all MacBooks, MacBook Pros, and newer PowerBooks, place a dedicated eject key next to the F12 key)
Newer Mac laptops (MacBook Pros made after February 2008, MacBooks after November(?) 2007, MacBook Airs), and the Aluminum keyboard, have a different layout for fn keys. Some keys have been added, while the numlock key has been removed and the display mode key has been integrated into the brightness key (see combinations in parenthesis)
F1decrease brightness (command+F1 changes display mode, option+F1 brings up display prefs)
F2increase brightness (option+F2 brings up display prefs)
F3exposé (F3 shows all windows, control+F3 shows app windows, option+F3 brings up exposé prefs, command+F3 shows desktop)
F4dashboard (option+F4 brings up exposé prefs)
F5decrease keyboard brightness for backlit keyboards (option+F5 brings up keyboard prefs)
F6increase keyboard brightness for backlit keyboards (option+F6 brings up keyboard prefs)
F7media navigation backwards (like hitting back on Apple Remote)
F8media play/pause (like hitting play/pause on Apple Remote)
F9media navigation forwards (like hitting next on Apple Remote)
F10mute volume (option+F10 brings up sound prefs)
F11decrease volume (option+shift+F11 for incremental decrease, option+F11 brings up sound prefs)
F12increase volume (option+shift+F12 for incremental increase, option+F12 brings up sound prefs)



Shortcuts With Global Scope

More shortcuts with global scope can be found on the Universal Access page.
command-option-escforce quit
hold command-shift-option-escape for 4 secForce quit front-most application (without confirmation)
control-ejectshow shutdown dialog
command-option-ejectsleep now
command-shift-Qlog out
command-shift-option-Qlog out without confirmation
command-control-ejectrestart
control-shift-ejectsleep displays
command-option-control-ejectshut down
command-tabcycle between open applications
command-`*after* having pressed command-tab, it will cycle between open applications in reverse
command-shift-tabcycle between open applications in reverse direction
command-`cycle between open windows in the selected application
command-shift-`cycle between open windows in the selected application in reverse direction
control-F4cycle between open windows in all applications
control-shift-F4cycle between open windows in all applications in reverse direction
F8Spaces (Leopard only)
F9Exposé for all windows (Panther and newer)
F10Exposé for all windows in selected application
F11Exposé to reveal desktop
F12Dashboard (Tiger and newer)
control-#Jump to a space (10.5+)
control-arrowCycle through spaces (10.5+)
command-spaceactivate Spotlight (Tiger) or switch between keyboard layouts (pre-Tiger systems)
command-option-spaceopen a Spotlight search in a finder "Find" window
shift-volumeChange volume without sound effect
option-shift-volumeFine-grained volume control (10.5+ ?)
option-volumeSound Preference Pane
option-brightnessDisplay Preference Pane
command-decrease-brightnessChange display mode (only on revised fn keyboard layout on Alu. keyboards, newer MBP/MBs?)
opt-"Empty Trash"Empty trash, including locked items, without any alerts
command-escapeopen front row (Press any F key (except F2) or Escape to exit)
hold shift while performing actionslow down any animation (exposé, time machine, minimize, etc)
option-drag scrollbarsmooth scrolling
option-ejectEject secondary optical media drive (if one exists)
option-click dock icon or windowSwitch to application and hide previous application
command-option-click dock icon or windowSwitch to application and hide all others
command-drag menuletre-order icon
command-drag menulet off the menu barremove icon from menu bar
[edit]

Command-Tab Box

Press command-tab and hold the command key to keep the box open. Release the command key to switch to the selected application.
escapeexit command-tab box (equivalent to pressing the period key (.))
Hhide application
Qquit application
left/right arrow keys or home/end or `(grave accent)/tabselect an application (you can also aim with the mouse)
up/down arrow keysview windows of selected application (use arrow keys to navigate, then press enter to select window)

ref: 1 2

Saturday, May 19, 2012

ParaSoft C++Test --help


C++test Version 6.7.7.2 (Jan 16 2007)

Copyright (C) 1998-2007 by ParaSoft Corporation

usage: cpptest [cpptest_options] [compiler_options] file...

cpptest_options:

-Zicpf , --Zinput_cpf_project

file: C++test project for testing

(ignores all additional files and

options)

-Zocpf , --Zoutput_cpf_project

file: output C++test project

-Zdsp , --Zdsp_project file: DSP/DSW project file for

testing (ignores all additional

files and options)

-Zvcproj , --Zvcproj_project file: VC++ .NET project file for

testing (ignores all additional

files and options)

-Zdc , --Zdsp_config name: name of active configuration

for specified DSP/VCPROJ file

-Zgpj , --Zghs_project file: GHS project file for

testing (ignores all additional

files and options)

-Zmcl , --Zmake_command_line

param: command line to be used to

extract files and options,

compiler/linker executables should be

replaced with ${CPPTEST_SCAN} variable

(ie: "make CXX=\${CPPTEST_SCAN} all");

creates a new project based on

extracted files and options;

-Ztf , --Ztest_file name: file or test unit name

to test

-Zeh , --Zexport_harness name: file or test unit name

to export harness for, if empty

then harness is exported for

all files from the project

-Zrl , --Zread_logs name: file or test unit name

to read logs for, if empty

then logs are read for

all files from the project

-Ztc , --Ztest_config name: test configuration

to be used for current run

-Zpc , --Zproject_config name: project configuration

to be used in current project

-Zso , --Zsave_options file: C++test project;

adds the source file(s) and options

specified in the command-line

to the project;

creates the project if it does not

exist,else updates the existing one

-Zitc , --Zimport_test_cases

allows specifying external test

cases file to use during unit

testing

file: test cases file or location

where .tcr files are stored

-Zito , --Zimport_test_objects

allows specifying external test

objects file to use during unit

testing

file: test objects file or location

where .tor files are stored

-Zis , --Zimport_suppressions

import Coding Standards

Suppressions into project,

file: suppressions file

-Zrf , --Zreport_file file: file for test result output

-Zgh , --Zgenerate_html name: template file name for HTML

report generation

-Zhrd

, --Zhtml_report_directory

dir: location of HTML report

-Zgx, --Zgenerate_xml generate XML report

-Zxrd
, --Zxml_report_directory

dir: location of XML report

-Zpr, --Zpublish_results publish Coding Standards results

on TCM

-Zf, --Zforce force output project overwriting

if exist

-Zow {on
off}, --Zoverwrite {on
off} turning on/off report_file over-

writing (default is on)

-Zoe [quiet], --Zonly_errors [quiet] report only errors

(quiet - suppresses success

message on no errors/violations)

-Zq, --Zquiet do not generate test results

-Zvm, --Zverbosity_mode level: verbosity level 0 - 2

(0 disables verbose messages)

(default is 0)

-Zgrs {on
off}, --Zgrs {on
off} enable/disable GRS reporting

-Zga , --Zgrs_attribute allows specifying GRS attribute

name: must have form key=value

-Zcs, --Zcompile_source compile original user source

-Zrs, --Zreread_symbols enforce symbols re-reading

(for Unit Testing only)

-Zlc , --Zlist_config lists available configurations

param: PROJECT, TEST, HTML

-Zecf, --Zexpand_command_files Expand all options contained in

supplied command files

(aka response files)

into the command line.

This option is recommended

with -Zso.

-Znt --Zno_tests do not perform any tests

-h, --help this help

-V, --version version information

Labels