Found 34494 Articles for Programming

Passing and Returning Objects in Java

Chandu yadav
Updated on 25-Jun-2020 14:08:38

4K+ Views

As we know it is core concept that in Java there is always pass by value and not by pass by reference.So in this post we will focus on that how this concept get validated in case of passing primitive and passing reference to a method.In case when a primitive type is passed to a method as argument then the value assigned to this primitive is get passed to the method and that value becomes local to that method, which means that any change to that value by the method would not change the value of primitive that you have ... Read More

Constructor Chaining In Java programming

Rudradev Das
Updated on 29-Dec-2023 18:36:32

655 Views

The constructor chaining is a particular sequence of injecting constructors when an user initialize an object in a particular method. This process can be used when we invoke a bulk number of constructors one by one only on the basis of the instance class. This process is an another method linked with the inheritance where the task of a sub-class constructor to call a super class constructor. Constructor chaining can be performed in two ways in Java − Within same class − The process can be done by the using of this() keyword for the constructors present in the same class. From base class − by using the ... Read More

Python Interface to UNIX syslog library routines

George John
Updated on 30-Jul-2019 22:30:23

221 Views

To get the UNIX syslog library information, we need to use the syslog module into our programs. This module has syslog has different modules for the syslog library. To use this module, we should import it using − import syslog The methods are like below − Method syslog.syslog(message) or syslog.syslog(priority, message) This method is used to send a string type message to the system logger. Each message has a priority. The priority argument can be used to set the priority of the given message. Method syslog.openlog([ident[, logoption[, facility]]]) This method is used to logging options of subsequent syslog ... Read More

Resource Usage Information using Python

Chandu yadav
Updated on 30-Jul-2019 22:30:23

699 Views

To measure the UNIX resource usage, we need to use the resource module into our programs. This module also can control the resource utilization. To use this module, we should import it using − import resource Resource Limits In this module we can use the setrlimit() to limit the resource utilization. There are two parameters to limit the resources. These parameters are soft limit and the hard limit. The soft limit is basically the current limit, it can be changed over process, but it cannot exceed the hard limit. The hard limit can be reduced to any value ... Read More

Python Interface to Shell Pipelines

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

235 Views

To use the UNIX command pipeline mechanism using python. In the command pipelining a sequence converts from one file to another file. This module uses /bin/sh command line. So we need os.system() and os.popen() methods. To use this module, we should import it using − import pipes The pipes holds Template class − class pipes.Template This class is basically an abstraction of a pipeline. It has different methods. These are as follows. Method Template.reset() This method is used to restore the pipeline template to its initial position. Method Template.clone() This method is used to create another new, ... Read More

The fcntl and ioctl System Calls in Python

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

2K+ Views

To control the files and the io, we should use the fcntl module. It is basically one interface to the fcntl() and ioctl() Unix routines. All methods in this module takes one integer or io.IOBase file-descriptor as their first argument. To use this module, we should import it using. import fcntl There are some modules of the fcntl module, these are − Method fcntl.fcntl(fd, op[, arg]) This method is used to perform the operation on the file using file descriptor. The operation is defined by op. The third argument is optional. It can be either integer type value ... Read More

Pseudo-terminal Utilities in Python

George John
Updated on 30-Jul-2019 22:30:23

1K+ Views

The Pseudo-terminal utility module pty is defined to handle pseudo-terminal concepts. Using this we can start another process, and also can read or write from controlling terminal using programs. This module is highly platform oriented. We should use UNIX systems to perform these operations. To use the pty module, we should import it using − import pty There are some modules of the pty module, these are − Method pty.fork() This method is used to connect the child controlling terminal to pseudo-terminal. This method returns the pid and the fd. The child process gets the pid 0, but ... Read More

Terminal Control Functions in Python

Chandu yadav
Updated on 30-Jul-2019 22:30:23

927 Views

To change the terminal controls in the Unix system, we can use the tty related methods in Python. Using the tty module, we can set two different modes of the terminal. The raw Mode and the cbreak mode. To use the tty module, we should import it using − import tty There are some modules of the tty module, these are − Method tty.setraw(fd, when = termios.TCSAFLUSH) This method is used to change the terminal mode to raw mode. In the raw mode, the cursor moves to new line but the carriage return operation is not performed. Also ... Read More

POSIX Style TTY control using Python

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

357 Views

The termios module provides an interface to the POSIX for tty I/O control. It is only available for Unix system. To use the termios module, we should import it using − import termios All methods in this module, takes the file descriptor as an argument. There are some modules of the termios module, these are − Method termios.tcgetattr(fd) This method returns a list of tty attributes for the given file descriptor. The attributes are iflag, oflag, cflag, lflag, ispeed, ospeed, cc. Method termios.tcsetattr(fd, when, attributes) This method is used to set the attribute from the list of attributes. ... Read More

Python Function to Check UNIX Passwords

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

525 Views

To verify UNIX password, we should use the crypt module. It has crypt(3) routine. It is basically one-way hash function based on the modified DES algorithm. To use the crypt module, we should import it using. import crypt Method crypt.crypt(word, salt) This method takes two arguments. The first one is the word and second one is salt. The word is basically the user password, which is given in the prompt. The salt is a random string. It is used to perturb the DES Algorithm in one of 4096 ways. The salt contains only Upper-case, Lower-case, Numeric values ... Read More

Advertisements