Installing a Firewall
sudo cp /usr/share/doc/shorewall-common/myfwconfig/one-interface/* /etc/shorewall/
Note: sudo - super user do
Now, open the “rules” file:
sudo nano /etc/shorewall/rules
etc - directory for maintain lots of files.
text editor in linux
1. nano
2. vi or vim
3. emacs
4. pico
5. gedit
6. bluefish
Add these lines above where it says “#LAST LINE”
HTTP/ACCEPT net $FW
SSH/ACCEPT net $FW
Adding Web Site to Web Server
sudo usermod -g www-data [YOUR USERNAME]
sudo chown -R www-data:www-data /var/www
sudo chmod -R 775 /var/www
Note
775 - is equal to rwx rwx -rx
r - read
w - write
x - execute
other permissions
400 r-------- files
444 r--r--r-- files (read only)
600 rw------- files (file invisile to all)
666 rw-rw-rw- files
700 rwx------ allow permission to programs and directories
750 rwxr-x--- allow permission to programs and directories
755 rwxr-xr-x allow permission to programs and directories
777 rwxrwxrwx allow permission to programs and directories
Note: 777 dangerouse to use as permission
JOHN PAUL Python + MYSQL, Symbian C++, Java, DOJO, ORACLE, PYGUI Tutorial
Tuesday, September 6, 2011
Redhat and Cent OS Web Traffic Monitoring
Do the Following:
1. Go to Terminal and Login as super user.
Command : su (super user)
2. see display connection by using the command
netstat -netstat
3. Install tcptrack package via Terminal.
yum install tcptrack
Installing in Ubuntu
sudo apt-get install tcptrack
Installing in Open Suse
zypper install tcptrack or go to YaST -> Software Management -> Search the Package tcptrack and Install the Package.
4. Track Ethernet traffic
tcptrack -i eth0
tcptrack -i eth1
Show web traffic on port 80.
5. tcptrack -i eth1 port 80
1. Go to Terminal and Login as super user.
Command : su (super user)
2. see display connection by using the command
netstat -netstat
3. Install tcptrack package via Terminal.
yum install tcptrack
Installing in Ubuntu
sudo apt-get install tcptrack
Installing in Open Suse
zypper install tcptrack or go to YaST -> Software Management -> Search the Package tcptrack and Install the Package.
4. Track Ethernet traffic
tcptrack -i eth0
tcptrack -i eth1
Show web traffic on port 80.
5. tcptrack -i eth1 port 80
Sunday, November 28, 2010
My simple floating point arithmetic program via Assembly language using C language
#include stdio.h
#define p printf
#define s scanf
int main() {
float var1, var2, sum, diff, product, dividend;
p( "Enter two numbers : " );
s( "%f%f", &num1, &num2 );
/* Perform floating point */
__asm__ ( "fld %1;"
"fld %2;"
"fadd;"
"fstp %0;" : "=g" (sum) : "g" (num1), "g" (num2) ) ;
__asm__ ( "fld %2;"
"fld %1;"
"fsub;"
"fstp %0;" : "=g" (diff) : "g" (num1), "g" (num2) ) ;
__asm__ ( "fld %1;"
"fld %2;"
"fmul;"
"fstp %0;" : "=g" (product) : "g" (num1), "g" (num2) ) ;
__asm__ ( "fld %2;"
"fld %1;"
"fdiv;"
"fstp %0;" : "=g" (dividend) : "g" (num1), "g" (num2) ) ;
p( "%f + %f = %f\n", num1, num2, sum);
p( "%f - %f = %f\n", num1, num2, diff);
p( "%f * %f = %f\n", num1, num2, product);
p( "%f / %f = %f\n", num1, num2, dividend);
return 0 ;
}
#define p printf
#define s scanf
int main() {
float var1, var2, sum, diff, product, dividend;
p( "Enter two numbers : " );
s( "%f%f", &num1, &num2 );
/* Perform floating point */
__asm__ ( "fld %1;"
"fld %2;"
"fadd;"
"fstp %0;" : "=g" (sum) : "g" (num1), "g" (num2) ) ;
__asm__ ( "fld %2;"
"fld %1;"
"fsub;"
"fstp %0;" : "=g" (diff) : "g" (num1), "g" (num2) ) ;
__asm__ ( "fld %1;"
"fld %2;"
"fmul;"
"fstp %0;" : "=g" (product) : "g" (num1), "g" (num2) ) ;
__asm__ ( "fld %2;"
"fld %1;"
"fdiv;"
"fstp %0;" : "=g" (dividend) : "g" (num1), "g" (num2) ) ;
p( "%f + %f = %f\n", num1, num2, sum);
p( "%f - %f = %f\n", num1, num2, diff);
p( "%f * %f = %f\n", num1, num2, product);
p( "%f / %f = %f\n", num1, num2, dividend);
return 0 ;
}
Tuesday, November 23, 2010
My IF Else Loop Sample in COBOL Programming in LINUX ^_^
PROCEDURE Decimal
Begin.
PERFORM DecimalValue THRU DecimalValueExit
STOP RUN.
DecimalValue.
Statements
Statements
IF ErrorFound GO TO DecimalValueExit
END-IF
Statements
Statements
IF ErrorFound GO TO DecimalValueExit
END-IF
Statements
Statements
Statements
IF ErrorFound GO TO DecimalValueExit
END-IF
Statements
Statements
Statements
Statements
DecimalValueExit
EXIT.
Begin.
PERFORM DecimalValue THRU DecimalValueExit
STOP RUN.
DecimalValue.
Statements
Statements
IF ErrorFound GO TO DecimalValueExit
END-IF
Statements
Statements
IF ErrorFound GO TO DecimalValueExit
END-IF
Statements
Statements
Statements
IF ErrorFound GO TO DecimalValueExit
END-IF
Statements
Statements
Statements
Statements
DecimalValueExit
EXIT.
Wednesday, November 17, 2010
My Sample ABAP Program ALV Grid Control
My Sample ABAP Program ALV Grid Control
create a screen 100 for call it and Element list of screen supploy OK and type Ok inthe output
Then activate modules STATUS_0100 and USER_COMMAND_0100 in the flow logic .
CALL SCREEN 100.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
IF C_CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT C_CUSTOM_CONTAINER EXPORTING CONTAINER_NAME = C_CONTAINER
CREATE OBJECT ALV_GRID EXPORTING I_PARENT = C_CUSTOM_CONTAINER.
CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
I_STRUCTURE_NAME = 'bin1'
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
* IS_LAYOUT =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
CHANGING
IT_OUTTAB = TAB_DISPLAY
* IT_FIELDCATALOG =
* IT_SORT =
* IT_FILTER =
* EXCEPTIONS
* INVALID_PARAMETER_COMBINATION = 4
* PROGRAM_ERROR = 2
* others = 1
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDMODULE.
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
END MODULE.
create a screen 100 for call it and Element list of screen supploy OK and type Ok inthe output
Then activate modules STATUS_0100 and USER_COMMAND_0100 in the flow logic .
CALL SCREEN 100.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
IF C_CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT C_CUSTOM_CONTAINER EXPORTING CONTAINER_NAME = C_CONTAINER
CREATE OBJECT ALV_GRID EXPORTING I_PARENT = C_CUSTOM_CONTAINER.
CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
I_STRUCTURE_NAME = 'bin1'
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
* IS_LAYOUT =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
CHANGING
IT_OUTTAB = TAB_DISPLAY
* IT_FIELDCATALOG =
* IT_SORT =
* IT_FILTER =
* EXCEPTIONS
* INVALID_PARAMETER_COMBINATION = 4
* PROGRAM_ERROR = 2
* others = 1
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDMODULE.
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
END MODULE.
Friday, November 5, 2010
My Sample Embedded C++ program using EC++ compiler
#include
using namespace std;
extern "C" void exit(int);
void johnpaul(const char *msg, int n)
{
cout << msg << n << endl;
exit(1);
}
// The integer array class
class Shit{
private:
// array elements
int *arry;
// array size
int array_counter; public:
// construct a array
Array(int n) : array_counter(n) {
if (n > 0)
elements = new int[array_counter];
else
die("Bad Array size, dumbass try again!!!! ", array_counter);
}
int &operator [](int index_list) const {
// overloaded operator
if (index_list < 0 || index_list >= array_counter)
die("Bad Array index ", index_list);
return arry[index_list];
}
int size() { return array_counter; } // return the size of the array
};
main()
{
Array m(6);
for (int i=0; i a[i] = i;
for (int i=0; i cout << i << ". " << m[i] << endl;
}
using namespace std;
extern "C" void exit(int);
void johnpaul(const char *msg, int n)
{
cout << msg << n << endl;
exit(1);
}
// The integer array class
class Shit{
private:
// array elements
int *arry;
// array size
int array_counter; public:
// construct a array
Array(int n) : array_counter(n) {
if (n > 0)
elements = new int[array_counter];
else
die("Bad Array size, dumbass try again!!!! ", array_counter);
}
int &operator [](int index_list) const {
// overloaded operator
if (index_list < 0 || index_list >= array_counter)
die("Bad Array index ", index_list);
return arry[index_list];
}
int size() { return array_counter; } // return the size of the array
};
main()
{
Array m(6);
for (int i=0; i
for (int i=0; i
}
Monday, October 18, 2010
How to create and run COBOL Program in Linux ^_^
1. Write a Hello World Cobol Program
Create the JohnPaulSample program using the Vim editor as shown below.
$ sudo gedit JohnPaulSample
Note:
Types of Editor in Linux
1. Gedit
2. Kedit
3. Emacs
4. Anjuta
5. Nano
6. Vim
7. JEdit (Open Source Java Code Editor)
My Sample Program in Cobol
IDENTIFICATION DIVISION.
PROGRAM-ID. JohnPaulSampleProgram.
PROCEDURE DIVISION.
DISPLAY 'Hello John Paul!'.
STOP RUN.
Note: Comment in Cobol starts with *.
2. Make sure Cobol Compiler is installed on your system
Make sure Cobol compiler is installed on your system as shown below.
$ whereis cobc
cobc: /usr/bin/cobc /usr/share/man/man1/cobc.1.gz
Note:
whereis - command in linux for looking faster for a specific path or directory of file or package.
$ which cobc
/usr/bin/cobc
Installing COBC compiler
If you don’t have cobol compiler, install it as shown below.
$ sudo apt-get install open-cobol
Note
sudo - super user do. (Admin privileges)
3. Compile the cobol program trought Terminal
Compile the JohnPaulSample which will create the JohnPaulSample executable.
$ cobc -free -x -o JohnPaulSample-exe JohnPaulSample
$ ls
JohnPaulSample JohnPaulSample-exe*
* -free – use free source format. Without this option cobol program requires certain format.
* -x – build executable program.
* -o FILE – place the output file into the specified FILE.
4. Execute the cobol Program
Execute by mentioning the program name.
$./JohnPaulSample-exe
Hello John Paul!
Create the JohnPaulSample program using the Vim editor as shown below.
$ sudo gedit JohnPaulSample
Note:
Types of Editor in Linux
1. Gedit
2. Kedit
3. Emacs
4. Anjuta
5. Nano
6. Vim
7. JEdit (Open Source Java Code Editor)
My Sample Program in Cobol
IDENTIFICATION DIVISION.
PROGRAM-ID. JohnPaulSampleProgram.
PROCEDURE DIVISION.
DISPLAY 'Hello John Paul!'.
STOP RUN.
Note: Comment in Cobol starts with *.
2. Make sure Cobol Compiler is installed on your system
Make sure Cobol compiler is installed on your system as shown below.
$ whereis cobc
cobc: /usr/bin/cobc /usr/share/man/man1/cobc.1.gz
Note:
whereis - command in linux for looking faster for a specific path or directory of file or package.
$ which cobc
/usr/bin/cobc
Installing COBC compiler
If you don’t have cobol compiler, install it as shown below.
$ sudo apt-get install open-cobol
Note
sudo - super user do. (Admin privileges)
3. Compile the cobol program trought Terminal
Compile the JohnPaulSample which will create the JohnPaulSample executable.
$ cobc -free -x -o JohnPaulSample-exe JohnPaulSample
$ ls
JohnPaulSample JohnPaulSample-exe*
* -free – use free source format. Without this option cobol program requires certain format.
* -x – build executable program.
* -o FILE – place the output file into the specified FILE.
4. Execute the cobol Program
Execute by mentioning the program name.
$./JohnPaulSample-exe
Hello John Paul!
Subscribe to:
Comments (Atom)