Thursday, April 8, 2010

srcCp




#!/usr/bin/sh


#DIRs="/uvobs"

echo Start searching files with patterns .............

echo "Starting time: `date`"

SROOT="/uvobs/1btsptf/core"

DIRs="$SROOT/rmt_app $SROOT/oam $SROOT/hdr $SROOT/usl"

for dir in $DIRs

do

echo Searching in $dir ...

find $dir \( -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.hpp' -o -name '*.cc' -o -name '*.lh' \) -type f -exec cp -f --parents {} . \;

echo `date`

done

echo "Ending time: `date`"

echo Creating tarball ...

tar czf uvobs.tgz uvobs

echo Done! uvobs.tgz created.
 
 
 
Tags: source, Copy, bash, patterns

Wednesday, April 7, 2010

Clearcase useful commands




File: $HOME/.bashrc


alias ct=/usr/atria/bin/cleartool
alias sv='/usr/atria/bin/cleartool setview'
umask 022

See more
Tags: clearcase, setview, cleartool, bashrc


Bash useful command





1. /etc/profile.       Executed automatically at login. 
2. The first file found from this list:  ̃/.bash_profile,  ̃/.bash_login, or ̃/.pro- 
file. Executed automatically at login. 
3.  ̃/.bashrc is read by every nonlogin shell. However, if invoked assh, Bash instead 
reads $ENV,for POSIX compatibility.

Filename Metacharacters 
* Match any string of zero or more characters. 
? Match any single character. 
[abc...] Match any one of the enclosed characters; a hyphen can specify a range (e.g.,a-z,A-Z,0–9).  
[!abc...] Match any character not enclosed as above. 

 ̃           Home directory of the current user. 
 ̃name Home directory of user 'name'. 
 ̃+        Current working directory ($PWD). 
 ̃-         Previous working directory ($OLDPWD).




Redirection using file descriptors 
cmd>&n         Send cmd output to file descriptor n. 
cmd m>&n     Same as previous, except that output that would normally go to file descriptor  
                         m is sent to file descriptor n instead. 
cmd>&-           Close standard output. 
cmd<&n          Take input for cmd from file descriptor n. 
cmd m<&n       Same as previous, except that input that would normally come from file
                          descriptor m comes from file descriptor n instead. 
cmd<&-            Close standard input. 
cmd<&n-         Move input file descriptor n instead of duplicating it. 
cmd>&n-        Move output file descriptor n instead of duplicating it. 
Multiple redirection 
cmd2>file       Send standard error to file standard output remains the same 
                       (e.g., the screen). 
cmd>file2>&1      Send both standard error and standard output to file. 
cmd&>file       Same as previous. Preferred form. 
cmd>&file       Same as previous. 
cmd>f1 2>f2    Send standard output to file f1 and standard error to file f2. 
cmd | tee files    Send output of cmd to standard output (usually the terminal) and 
                            to files.  
cmd 2>&1 | tee files Send standard output and error output of cmd to standard output 
                                     (usually the terminal) and to files. 


stty -a | grep erase

Create a file, /etc/inputrc for system wide use or ~/.inputrc for personal use. Actually, this is the readline initialization file, readline is a library that some programs (bash, kvt) use to read input (try bind -v to see a list of readline key and function bindings). Cut and paste the following in the file to make the Delete key delete characters under the cursor, and make Home and End work as well:


"\e[3~": delete-char
# this is actually equivalent to "\C-?": delete-char
# VT
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# kvt
"\e[H":beginning-of-line
"\e[F":end-of-line
# rxvt and konsole (i.e. the KDE-app...)
"\e[7~":beginning-of-line
"\e[8~":end-of-line

Remove tab and spaces
sed 's/[\t]//g' test.txt > out.txt
sed 's/[\x09]//g' test.txt > out.txt

Zip and Unzip
tar cvf - filenames

gzip > file.tar.gz
gtar cvzf file.tar.gz filenames
tar -pczf uvobs.tar.gz /uvobs/1btsptf/core
gzip -cd mc-4.7.0.4.tar.gz | tar xfv -

Tags: Tab, Delete. Home, End



puTTY multiple sessions




E:\Downloads\putty.exe -load "session_name"
E:\Downloads\pageant.exe E:\fullpath\private.ppk

See more (http://www.unixwiz.net/techtips/putty-openssh.html)

putty with timestamp:
E:\x86tool\utilities\putty-dekt1-&h-&y-&m-&d-&t.log
E:\x86tool\utilities\puttylog-&h-&y&m&d-&t.log

TimeStamp Format

specifierReplaced byExample
%aAbbreviated weekday name *Thu
%AFull weekday name *Thursday
%bAbbreviated month name *Aug
%BFull month name *August
%cDate and time representation *Thu Aug 23 14:55:02 2001
%dDay of the month (01-31)23
%HHour in 24h format (00-23)14
%IHour in 12h format (01-12)02
%jDay of the year (001-366)235
%mMonth as a decimal number (01-12)08
%MMinute (00-59)55
%pAM or PM designationPM
%SSecond (00-61)02
_MILMilliseconds (000-999)678
%UWeek number with the first Sunday as the first day of week one (00-53)33
%wWeekday as a decimal number with Sunday as 0 (0-6)4
%WWeek number with the first Monday as the first day of week one (00-53)34
%xDate representation *08/23/01
%XTime representation *14:55:02
%yYear, last two digits (00-99)01
%YYear2001
%ZTimezone name or abbreviationCDT
%%% sign%

Tags: putty, secure, ssh, OpenSSH, Unix access

Monday, April 5, 2010

back up a Karaoke cd+g disk




Karaoke disks are not like your normal audio cd's. It is the graphic part that is the hardest to copy. The first thing you need is a reader and or writer that likes Karaoke discs. Alot do not.


Very few cd roms read Karaoke cd's. I have not yet found one that does. I have to use my writer to READ and write the karaoke disks. Tested models are sony CRX120/140/160 series. Most Yamaha writers plus most lite-on writers will.

Next is the sofware you need. CDRWIN is excellent software (shouldn't be saying that on a clone cd forum). However, CloneCD will do it.

Friday, April 2, 2010

PLEX and AXE system




PLEX (Programming Language for EXchanges) is a special-purpose, pseudo-parallel and event-driven real-time programming language. Dedicated for AXE telephone exchanges, it was developed by Göran Hemdahl at Ericsson. Originally designed in the 1970s, it has been continuously evolving since then. The language has two variants: Plex-C used for AXE Central Processors (CP) and Plex-M used for Extension Module Regional Processors (EMRP).

Clearcase Client Commands





Configure user aliases:
File: $HOME/.bashrc

alias ct=/usr/atria/bin/cleartool
alias sv='/usr/atria/bin/cleartool setview'
umask 022

File: $HOME/.cshrc

alias ct /usr/atria/bin/cleartool
alias sv '/usr/atria/bin/cleartool setview'
umask 022


alias .. 'cd ..'
alias ... 'cd ../..'

alias shw 'ct lsco -rec -me -cview /vobs/HW'
alias sst 'ct lsco -rec -me -cview /vobs/HWStage'

alias ll 'ls -alt --color=auto'
alias ct 'cleartool'
alias ctll 'ct ls'
alias ctsv '/home/xviengu/bin/ctsv.sh'
alias ctrv 'ct rmview -tag'
alias sv 'ct setview'
alias ev 'ct endview'
alias scs 'ct setcs'
alias ccs 'ct catcs'
alias edcs 'ct edcs'
alias pwv 'ct pwv'
alias myview 'cleartool lsview | grep $USER'

cleartool lsview -long xviengu_apz15_dummy
[xviengu@seasx031 /home/xviengu]# cleartool lsview -long xviengu_apz15_dummy
Tag: xviengu_apz15_dummy
  Global path: /cc/seasna06_view11/xviengu_apz15_dummy.vws
  Server host: seasx012.rnd.as.sw.ericsson.se
  Region: ASUAB
  Active: NO
  View tag uuid:0e8a50d0.d4f111df.96e5.00:01:84:85:db:c4
View on host: seasx012.rnd.as.sw.ericsson.se
View server access path: /cc/seasna06_view11/xviengu_apz15_dummy.vws
View uuid: 0e8a50d0.d4f111df.96e5.00:01:84:85:db:c4
View owner: rnd.as.sw.ericsson.se/xviengu


cleartool rmview -vob /cc/seasna06_view11/ -uuid 0e8a50d0.d4f111df.96e5.00:01:84:85:db:c4


cleartool rmtag -view xviengu_apz15_dummy  <========== good
ct unregister -view /cc/seasna06_view11/xviengu_apz15_dummy.vws





See more: http://www.yolinux.com/TUTORIALS/ClearcaseCommands.html
https://publib.boulder.ibm.com/infocenter/cchelp/v7r1m2/index.jsp?topic=/com.ibm.rational.clearcase.ccrc.help.doc/topics/u_ccchangeset.htm

Tags: Clearcase commands, cmd, alias, cleartool, setview


Thursday, April 1, 2010

Disposable email services




Guerrilla Mail: disposable e-mail addresses which expire after 15 Minutes.


http://10minutemail.com/

http://www.mailinator.com/

http://www.mintemail.com/

https://addons.mozilla.org/vi/firefox/tag/disposable%20email
 
 
Tags: disposable, e-mail addresses, disposable e-mail addresses, Guerrilla Mail, 10minutemail, mailinator, mintemail
 
 

PLEX-C programming language




PLEX is an acronym for Programming Language for EXchanges and is a highlevel language developed by Ericsson in the 1970s, and extended in 1983. Programs in the AXE central processors use the Plex version Plex-C. The EMRP, which controls the subscriber stage, runs programs in Plex-M, a different dialect of Plex.

Plex is a high-level, real-time, language with very strict requirements regarding execution time.

Monday, March 29, 2010

DeviceIoControl





DeviceIoControl Function: Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.

Serial: CRT debug report




Report type: _CRT_WARN, _CRT_ERROR, _CRT_ASSERT

Required Header: crtdbg.h

_CRT_WARN: Warnings, messages, and information that does not need immediate attention.
_CRT_ERROR: Errors, unrecoverable problems, and issues that require immediate attention.
_CRT_ASSERT: Assertion failures (asserted expressions that evaluate to FALSE).

Serial: DCB structure




DCB sructure detects the management settings for the serial port of the connection device.

The most critical phase in serial communications programming is configuring the port settings with the DCB structure.

Thursday, March 25, 2010

Do not apply pointer arithmetic to pointers





Pointer arithmetic shall only be applied to pointers that address an array or array element (misra2004_17_1_PointerArithmeticOnNotPointers.rule)


Description:

"Pointer arithmetic shall only be applied to pointers that address an array or array element. Addition and subtraction of integers (including increment and decrement) from pointers that do not point to an array or array element results in undefined behaviour."

Benefits:

Rule makes the code more readable and less confusing.

Example:

void foo( int a[] ) {
   int* p1 = 0;
   int* p2;
   int* p3 = a;

   a++;     // OK
   p1++;    // Violation
   p2 = a;
   p2++;    // OK
   p3++;    // OK
}

Repair:

Do not apply pointer arithmetic to pointers.

References:
MISRA-C:2004 Guidelines for the use of the C language in critical systems

Chapter 6, Section 17
Author
ParaSoft


Tags: Pointer arithmetic, less confusing, more readable
 

switch shall have at least one case




Every switch statement shall have at least one case clause (misra2004_15_5_AvoidSwitchWithNoCase.rule)


Description

Every switch statement shall have at least one case.

Benefits:

Provides maintainability of 'switch' statement.

Example:

void foo(int i)
{

   switch(i)      /* Violation */
   {

       default:
           ;
   }

}

Repair:

void foo(int i)
{
   switch(i)      /* OK */
   {
     case 1:
     {

     }
     default:
           ;

   }

}

References:

MISRA-C:2004 Guidelines for the use of the C language in critical systems
Chapter 6, Section 15

Author
ParaSoft
 
 
 
Tags: switch, case, maintainability, Guidelines, critical systems
 
 

Do not convert pointer to pointer




A cast should not be performed between a pointer to object type and a different pointer to object type (misra2004_11_4_DoNotConvertPointerToPointer.rule)


Description:

"A cast should not be performed between a pointer to object type and a different pointer to object type. Conversions of this type may be invalid if the new pointer type requires a stricter alignment."

Note: This rule skips casting of void type.

Benefits:

Prevents incorrect pointer alignment.

Example:

void foo( ) {
   int* pi;
   char* i;

   i = (char*) pi; // Violation
   i = (char*) &i; // Violation
}

Repair:

Do not convert pointer to different pointer.

References:
MISRA-C:2004 Guidelines for the use of the C language in critical systems
Chapter 6, Section 11

Author
ParaSoft


Tags: cast, pointer, void, pointer alignment, MISRA, critical systems


Avoid using unsafe string functions




Avoid using unsafe string functions (UsageOfStringFunctions.rule)


Description

This rule detects code that uses unsafe string functions from C library.

Benefits:

Prevents the use of functions which may cause buffer overflows.

According to David A. Wheeler (see reference below), "C functions users must avoid using dangerous functions that do not check bounds unless they've ensured that the bounds will never get exceed.

Functions to avoid in most cases (or ensure protection) include the functions strcpy(), strcat(), sprintf() (with cousin vsprintf()), and gets().

These should be replaced with functions such as strncpy(), strncat(), snprintf(), fgets(), respectively."

Example:

#include
void main( void )
{
char* str1 = "testcase";
char* str2 = "testcase";
char* str3=0;

str3 = strcat( str1, str2 ); // Violation
}

Repair:

#include
void main( void )
{
char* str1 = "testcase";
char* str2 = "testcase";
char* str3=0;

str3 = strncat( str1, str2, 16 ); // OK
}

References:
http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/dangers-c.html

Author
ParaSoft


Tags: Avoid, unsafe, string, function, unsafe string, C library, buffer overflows, dangerous functions, strncpy, strncat, snprintf, fgets


Wednesday, March 24, 2010

Modular programming in C




What is Modular programming ?

- A programming technique to break down program functions into separate modules/parts/layers.
- Module, have to accomplishes one function by containing the source codes and input/output variables needed to accomplish that function.

Tuesday, March 23, 2010

Do NOT check floats for equality




Don't check floats for equality; check for greater than or less than (EqualityFloatLeft.rule)


Description:
This rule checks whether you check floats for equality instead of checking for greater than or less than.

Benefits:

If you check floats for equality, you make your code more susceptible to rounding errors.

Example:

void func(float a, int b)
{
   if (a==b) { }     // Violation

   while (a!=b) { }  // Violation
}



Repair:

void func(float a, int b)
{
   if (a>=b) { }     // OK

   while (a<=b) { }  // OK
}

Author
ParaSoft


My comment for repairing:

void func(const float a, const int b)
{
    if ( a > b ) { }
    else if ( a < b ) {}
    else {}
    // while (a > b) { };
    // while (a < b) { };
}

Ref: http://www.c-faq.com/fp/fpequal.html
Tags: vav.vn, vav, float, float equality, check float values equality, floating point, absolute, epsilon






domain co.cc




http://www.zebrazone.co.cc/,
http://www.fansipan.co.cc/,
http://www.zebrazoo.co.cc/

altonjuve_shift_2_yahoo_dot_com



Avoid Directly Access Globals




Do not directly access global data from a constructor (AvoidDirectlyAccessGlobals.rule)


Description:

Directly accessing global data from a constructor is risky because the global object may not yet exist when the "other" static object is initialized. This rule detects if you directly access global data from a constructor.

Labels