#include<stdio.h>int main(void){int input1,input2;int ret;printf("enter two numbers please\n");scanf("%d %d",&input1, &input2);printf("Hey,You've entered two numbers input1=%d and input2=%d\n",input1,input2);input2=(input1+input2)-(input1=input2);printf("and swapped values of inputs are input1=%d and input2=%d\n",input1,input2);return 0;}
[MATLAB]Error: The input character is not valid
If you got this error near to double quotes (""), then answer is you are using older version of matlab . hence change to single quote. example : readtable("a.txt") to readtable('a.txt')
[Uboot][Linux-OS]How to boot zImage (os image) using uboot
There are two ways to boot zImage using uboot 1. Using mkImage command, convert zImage to uImage 2. Enable bootz feature in the uboot board config file Add "#define CONFIG_CMD_BOOTZ "in the corresponding board config file and build the new uImage
[Linux-Admin]what is the maximum number of threads and processes possible
Maximum number of threads and processes possible on system wide , are stored in /proc/sys/kernel/threads-max /proc/sys/kernel/pid_max
[Linux]How to find device’s offset in linux ?
subtract KERNELBASE from the device's kernel address
[Linux]How determine a physical address from a virtual address ?
There are two ways to determine a physical address from a virtual one: va = pa + PAGE_OFFSET - MEMORY_START va = pa + KERNELBASE - PHYSICAL_START
[Linux][Memory Mapping]Linear mapping equation among Kernel base , page offset, physical start and memory start
For the linear mapping the following equation should be true:KERNELBASE - PAGE_OFFSET = PHYSICAL_START - MEMORY_STARTAlso, KERNELBASE >= PAGE_OFFSET and PHYSICAL_START >= MEMORY_STARTwhereKERNELBASE ->the virtual address of the start of the kernelPAGE_OFFSET->the virtual address of the start of lowmemPHYSICAL_START-> the physical address of the start of the kernelMEMORY_START -> the physical address of the startContinue reading "[Linux][Memory Mapping]Linear mapping equation among Kernel base , page offset, physical start and memory start"
[Linux driver]Example situation for tasklet usage
The tasklet mechanism is useful in interrupt handling situation , where the hardware interrupt must be managed as quickly as possible and most of the data management can be safely delayed to a later time.
[Linx driver]Differences between tasklet and workqueue
Tasklet run in software interrupt context with the result that all tasklet code must be atomic. Instead, workqueue functions run in the context of a special kernel process; as a result, they have more flexibility. In particular, work queue functions can sleep.Tasklets always run on the processor from which they were originally submitted, Workqueues workContinue reading "[Linx driver]Differences between tasklet and workqueue"
[Linux]A glance at data types used by kernel data
Data types used by kernel data divided into three main classes . Those arestandard C types. eg:- intexplicitly sized types . eg:- u32Interface specific types => types used for specific kernel objects . eg:- pid_t
[Linux][C]How to specify a process as the owner of the file ?
When a process invokes F_SETOWN command using fnctl system call, the process ID of the owner process is saved in filp->f_owner which can be used to address the file .Usage eg:- fd = open("/dev/filename", O_RDONLY); if (fd < 0) { fprintf(stderr, " failed to open /dev/filename \n"); return; } if ((fcntl(fd, F_SETOWN, getpid()) == 1)Continue reading "[Linux][C]How to specify a process as the owner of the file ?"
[Linux]What is Thundering herd problem in Linux point of view ?
We studied about the forms of wait_event and wake_up macros in Linux device driver text book. These macros are used to sleep the process while waiting for an event and wake up from the sleep state when even occurs .So when a process calls wake_up on a wait queue, all processes waiting on that waitContinue reading "[Linux]What is Thundering herd problem in Linux point of view ?"
[Linux][C]Which are all the file operations affected by the nonblocking flag (O_NONBLOCK) ?
The file operations affected by the non blocking flag areopenreadwrite
[Linux]A little about Timer Wheel
The original kernel timer system is known as Timer wheel.It is based on incrementing kernel- internal value (jiffie) on every timer interrupt.This timer interrupt becomes the default scheduling quantum.All the other timers are based on jiffies.
[Linux driver]A Little about put_user & __put_user
put_user and __put_user used to write the datum to user spaceFunction Declaration of put_user => put_user(datum, ptr) Function Declaration of __put_user => __put_user(datum, ptr)When single values are to be transferred, put_user/ __put_user should be called instead copy_to_user . Reason behind this is these functions(put_user/__put_user ) are relatively fast. Difference between put_user and __put_user ?put_user checks toContinue reading "[Linux driver]A Little about put_user & __put_user"
[Linux]Significance of rc.local
This script will be executed *after* all the other init scripts. We can put the customized script here, which needed to be run after system up.Also depending upon run level , there will be a local file.Like if System's runlevel is 5/etc/rc5.d/S99local is the file . There you can put the script which is to beContinue reading "[Linux]Significance of rc.local"
[Linux driver]Demonstrate Race condition in driver point of view
Lets think that the following code segment is there in the character driver code if( ! dev_ptr->data[index] ) { /*Allocate memory */ dev_ptr->data[index] = kmalloc(BUF_SIZE, GFP_KERNEL); if( ! dev_ptr->data[index] ) { goto out; } } Suppose for a moment that two processes, A and B , are independently trying to write to the same offsetContinue reading "[Linux driver]Demonstrate Race condition in driver point of view"
[Linux][Driver][C]Can we override the file operation functions in driver ?
Answer is Yes , We can override the file operation functions in driver . I wrote a character driver(hello.c) to explain the same . Also a Makefile is given to compile the hello.c file in Linux OS. An application program to test the driver also given here . Please go through it -------------------------------------------------------------------- Hello_character_driver ----------------------------------------------------------------Continue reading "[Linux][Driver][C]Can we override the file operation functions in driver ?"
[Linux driver]How to have multiple file_operations in a character driver
In the Init function of the character driver , follow the following steps Register a character driver with the file_operations structure with only open function defined . This is the selector for real open . Now create class for the module , using class_create Now create devices under this class , using device_create . EachContinue reading "[Linux driver]How to have multiple file_operations in a character driver"
[gcc]*** stack smashing detected ***
Stack Smashing is actually a protection mechanism used by gcc to detect buffer overflow attacks. An input of string greater than size defined causes corruption of gcc inbuilt protection canary variable followed by SIGABRT to terminate the program. Disabling of this gcc protection option can be done by using compiler option -fno-stack-protector
[C]Program to find whether the given machine is Little Endian or not
/*This program is to test whether the machine Little Endian or not */#include<stdio.h> #include <netinet/in.h>int main (void) {unsigned short n=0xABCD; printf (“%X %X \n”, n , ntohs(n));return 0; }compile the program .Run the program on the machine which is to be checkedIf the output isABCD CDAB then the machine is Little EndianIf the output isABCDContinue reading "[C]Program to find whether the given machine is Little Endian or not"
[Linux driver]Module insertion error – “version magic ‘2.6.35 SMP mod_unload ‘ should be ‘2.6.35 SMP preempt mod_unload”
If you are getting the module insertion error in kernel , "version magic '2.6.35 SMP mod_unload ' should be '2.6.35 SMP preempt mod_unload", while loading even a simple character driver , then rebuild your kernel by enabling preempt option , then build the driver module and try inserting . Set following option in kernel configContinue reading "[Linux driver]Module insertion error – “version magic ‘2.6.35 SMP mod_unload ‘ should be ‘2.6.35 SMP preempt mod_unload”"
[Linux]How to compile 32-bit kernel on 64- bit machine
Include -m32 to CFLAGS variable in the Makefile eg: if there is already CFLAGS variable then CFLAGS += -m32 otherwise CFLAGS = -m32
[C]How to compile a c program for a 32 bit machine on a 64 bit machine
gcc -m32 hello.c -o hello will give 32 bit binary In order to verify the result, you can run the command file hello , which will output 32-bit LSB executable
[Shell Script]How to execute multiple shell commands using a single shell variable ?
To execute multiple shell commands using a single shell variable,Assign the multiple shell commands to a variable.execute the shell variable using echo eg:Find a.txt in the present directory Let the multiple commands are ls and grep Let the shell variable is cmd .cmd=$(ls | grep a.txt )To execute the commands ,echo $cmd cmd=$(ls | grep test.txt)
[Java]Steps to run java program in Windows
Install JDK set path environment variable for Java right click on my computer -> Advanced->Environment Variables->path Add the following in the variable value of path after putting a semicolon C:\Program Files\Java\jdk1.7.0_10\bin (or the location where JDK installed) Compiling java program compiler used for compiling java program is javac javac AbsolutePathToFile This command will create aContinue reading "[Java]Steps to run java program in Windows"
[Linux]How to change the the back ground color and writing color of the message on the Linux console
For changing background color of the message on the Linux console , please read https://ranjiniloveslinux.wordpress.com/2013/01/03/how-to-set-back-ground-color-for-the-message-on-console/For changing the writing color , please read https://ranjiniloveslinux.wordpress.com/2013/01/03/how-to-print-colorful-message-on-console/You can combine both commands to create a colorful message eg: - green writing on blue background echo -e "33[44m 33[32m Hello world"blue writing on grey background echo -e "33[47m 33[34m Hello world"
[Linux]Which process is the parent of all processes on the linux system
answer is init process. Please find the information below init is the parent of all processes on the system, it is executed by the kernel and is responsible for starting all other processes; it is the parent of all processes whose natural parents have died and it is responsible for reaping those when they die. ProcessesContinue reading "[Linux]Which process is the parent of all processes on the linux system"
[Linux][Shell script] print fibonacci series of 12 numbers
#!/bin/sh# Fibonacci series - eg:- "0 1 1 2 3 5 8 13 21 34 55 ..."a=0 #First value of the seriesb=1 #Second value of the series#print the first value of the series.echo $a#print the second value of the series.echo $b#Now a small mathmatics for finding other numbers in the series .for I in 0Continue reading "[Linux][Shell script] print fibonacci series of 12 numbers"
[Shell Script][bash]Finding factorial of a given number using shell script
#!/bin/bash #This script will print the factorial of the number passed as arguement . eg:- ./factorial.sh 4 will print 4! value number=$1 factorial=1 i=$number while [[ $i != 1 && $i != 0 ]] do factorial=`expr $factorial \* $i` i=` expr $i - 1 ` done echo "Factorial of $number is $factorial"
[Linux]how to find physical memory of an Linux system
The physical memory is represented in /proc/kcore. The size of /proc/kcore is the same as System's physical memory, plus four bytes .
[Linux]how to see the new hardware detected in linux
You can see hardware detected by kudzu in /etc/sysconfig/hwconf.Kudzu is software from Red Hat for automatic discovery and configuration of hardware.
[Linux]How to run Red Hat Setup Agent on next boot
remove the file , /etc/sysconfig/firstbootrun chkconfig --level 5 firstboot on
[Linux]Distribution version file for Fedora, Red-Hat, Debian & Ubuntu systems
Distribution version file for Fedora -> /etc/fedora-release Red-Hat -> /etc/redhat-release Debian & Ubuntu -> /etc/debian-version In Ubuntu , distribution release details can be seen in the file , /etc/lsb-release Other distributions's version file Slackware ->/etc/slackware-version SuSe -> /etc/SuSE-release Gentoo -> /etc/gentoo-releaseContinue reading "[Linux]Distribution version file for Fedora, Red-Hat, Debian & Ubuntu systems"
[Linux][Fedora][Ubuntu] Fix for the issue “ssh connection refused “
Fedora - Install openssh-server as below sudo yum install openssh-server or if you are not in sudoer list , become root user and install openssh-server (yum install openssh-server) Ubuntu - Install openssh-server - sudo apt-get install openssh-server or if you are not in sudoer list , become root user and install openssh-server (apt-get install openssh-server)
[Linux]How to know UUID and file type of a device
UUID (Universally Unique Identifier) and file type can get from blkid(print block device attributes like filesystem type , UUID ) . You should be root user . UUID (Universally Unique Identifier) also can get from ls -l /dev/disk/by-uuid (root user)
[Linux]How to edit fstab for auto mounting hard disk partition
become root user Back up fstab (cp /etc/fstab /etc/fstab.old)fstab requires UUID (Universally Unique Identifier) of the partition , mount point and file type .UUID and file type will get by executing the command blkid (root user ) Now edit the /etc/fstab (root user) -. eg - UUID=0ABB /media/disk ntfs defaults 0 2 save the /etc/fstabReboot the system to testContinue reading "[Linux]How to edit fstab for auto mounting hard disk partition"
[Linux][C]How to add user defined include directory during compilation
User defined include directories can be added during compilation . eg: Write a simple c program #include <hello.h> int main(void) { printf("Hello world \n"); return 0; } Save the program as hello.c Now create a directory named include in your working directory . Create an hello.h inside include directory . The content of hello.h isContinue reading "[Linux][C]How to add user defined include directory during compilation"
[Linux]how to use terminal (ttyS0, ttyS1)
install minicom if minicom is not installed login as root open minicom with minicom -s select "serial port setup"change the Serial device to /dev/ttyS0 or /dev/ttyS1change baudrate to required value save setup as default and exit (not exit from minicom )
[Linux]Info about halt command
halt command in the system alias to run level 0 when you run halt command , actually “init 0″ command is executing . run level 0 is halt . halt -p -> poweroff
[Linux]how to find the commandline parameters passed to vmlinuz from linux
cat /proc/cmdline - > will show the command line arguments passed while booting linux
[Linux]mounting floppy disc on linux
check whether floppy driver module inserted in the OS by executing the following command "lsmod | grep floppy " If user is a sudoer , then follow the below steps If module is not present , insert the module by "sudo modprobe floppy " sudo udisks --mount /dev/fd0 /media/floppy0 now floppy content will be shown atContinue reading "[Linux]mounting floppy disc on linux"
[Linux]what is DAEMONS ? example for daemons
Daemons are server processes that run continuously in background, which often starts at boot time . Typically daemon names end with the letter d .Main tasks for daemon - Serve the function of responding to network requests, hardware activity, or other programs by performing some task. - Configure hardware (like udevd on linux system) - Run scheduled tasks (like cronContinue reading "[Linux]what is DAEMONS ? example for daemons"
[Fedora][Linux]How to set up static ip address on fedora
This is for fedora OS System->network->network configuration->devices->eth0->Ethernet Device->General tick the following controlled by Network manager Activate device when computer starts statically set IP addresses - update address, subnet mask , default gateway address, primary DNS and secondary DNS Also make sure that you updated ifcfg-eth0 (adding ip , net mask, gateway) in the directory (/etc/sysconfig/network-scripts)Continue reading "[Fedora][Linux]How to set up static ip address on fedora"
Did you hear about sha-bang ?
The Sha-bang (#!) at the head of a script tells Linux system that this file is a set of commands to be fed to the command interpreter indicated. Immediate following the sha-bang is a path-name eg:- #!/bin/bash Is it worth reading ? Please like the post if its helpful. Please give your suggestions too
[Linux][Shell Script]Create shortcut in bash
You can create shortcut in a bash shell Go to home directory (cd ~) Edit .bashrc file At the end of the file , you can see "User specific aliases and functions" write shortcuts there in the following format "alias t='cd /home/username/test' " (test is just a directory name. You can give any directory nameContinue reading "[Linux][Shell Script]Create shortcut in bash"
[Fedora][Ubuntu][Linux admin]How to configure yum (in fedora) and apt-get (in ubuntu) with proxy
Steps to configure yum in fedora Edit yum.conf in /etc folder . Update proxy (eg: proxy=http://ipaddress:port) Comment baseurl in fedora.repo file in the directory, /etc/yum.repos.d Export http_proxy from terminal (export http_proxy=http://ipaddress:port). eg: http_proxy=http://192.168.100.100:80. Steps to configure apt-get in Ubuntu Create the file /etc/apt/apt.conf if not present Add the following line Acquire::http::proxy “http://ipaddress:port”; Note that ipaddressContinue reading "[Fedora][Ubuntu][Linux admin]How to configure yum (in fedora) and apt-get (in ubuntu) with proxy"
[Linux]How to compile a new kernel (2.6)
Download new kernel source code Go to the directory Do a make menuconfig if you want to build a customized kernel by enabling/disabling the modules you need make make modules make modules_install (should be root user) make install After completing this command execution, menu.lst is getting updated . Then reboot the system The system will bootContinue reading "[Linux]How to compile a new kernel (2.6)"
{German Learning -10 }
die Schlösser -> castles die Wälder -> forests die Berge -> mountains die Seen -> lakes das Erfolgserlebnis - the feeling of success
Happy Christmas ♥️🎉😍
The changer
Influence !!! This word present everywhere. Whether it gives positive or negative impact is second part. But it is a far-reaching topic . You influence close-by people positively. Aren't you ? Well , that is what matters. Instead of checking who influences us ,Let's us check how are our actions influencing others . If itContinue reading "The changer"
(German leaning)Das flugzeug
Dass flugzeug wurde von meinem sohn gebaut? Gefällt es dir? Schreiben Sie in den kommentar ..
{German Learning via daily prompt’s question -9 }
Können Sie den Charakter gut einschätzen? Ich bevorzuge es, den Charakter anderer nicht zu beurteilen bevorzuge means to prefer something . beurteilen - to assess something To know the verbs I read till now . The list is becoming humongous 🙂 https://ranjiniloveslinux.wordpress.com/2024/11/26/my-german-learning-german-verbs/ Do you want to know the new English word I learned today ?Continue reading "{German Learning via daily prompt’s question -9 }"
{German Learning via daily prompt’s question -8 }
Wenn bist du am glücklichsten ? Ich bin glücklich, wenn ich bei meiner Familie bin. Was macht dich glücklich? Schreib es in den Kommentar. Stay blessed .
{German Learning via daily prompt’s question -7 }
Was war das letzte, was du zum Spaß gemacht hast? ich spiele viel mit mein sohn. Chillax 🙂 Have a nice day ahead ..
{German Learning via daily prompt’s question -6 }
Listen Sie Ihren oben fünf Lebensmittel im Supermarkt Artikel? Gut, Meine oben fünf Lebensmittel im Supermarkt Artikel sind Tomaten, Zwiebeln, Bohnen, Blattgemüse und Brinjal. Und du ? Was möchten Sie im Supermarkt kaufen? Schreiben Sie bitte in die commentary. Happy learning with me 🙂 Do you have Amotivation for learning ? Come on.. We shouldContinue reading "{German Learning via daily prompt’s question -6 }"
{German Learning via daily prompt’s question -5 }
Beschreiben ein Mann wer hat Ihnem Leben positiv beeinflussen ? Mein Vater 🙂
{German Learning via daily prompt’s question -4 }
Ist dein Leben heute so, wie du es dir vor einem Jahr vorgestellt hast ? Ja, Nicht vor einem jahr, aber mehr als das. awesomesauce ! isn't it ? Well , for me awesomesauce is a new word 🙂 When something is extremely good, feel free to call it awesomesauce 🙂