I think I don’t want to continue, God give me strength to overcome that. I know life is a purpose.
I forget to trust on myself, why is that happening, I don’t have curosity to find the reason.
Give me strength, Lord Vishnu.
kuchhai / something is there
I think I don’t want to continue, God give me strength to overcome that. I know life is a purpose.
I forget to trust on myself, why is that happening, I don’t have curosity to find the reason.
Give me strength, Lord Vishnu.
A program is a static object, exist in a file(space), contains instructions(algo).
A Process is a dyamic object, exist in a time, contains instructions too(in execution)
main()
{
int i, prod = 1;
for (i =0;i<100;++i)
prod = prod * i;
}
The program contains single multiplication i.e prod = prod * i,
but the process will execute 100 multiplications, one each time thru loop.
Points to Remeber are:
Static object : Program
Dyanmic Object : Process
Space Bound : Program
Time Bound : Process
————————————————————————————————————————-
WinCe Architecture:
.gif)
Kernel Independent Transport Layer (KITL): is a communication link between your development computer & wince enabled device for debugging purpose.
The Platform Builder debugger and remote tools such as Remote File Viewer, Remote Registry Editor, and Remote Kernel Tracker use KITL. KITL exposes the device hardware to the kernel debugger and works independently of the board and transport (such as Ethernet, serial, or USB) to send and receive data between the computer and the device.
.gif)
OAL OEM Adaptation Layer: An OEM adaptation layer (OAL) is a layer of code that resides between the Windows Embedded CE kernel and the hardware of your target device. It facilitates communication between your operating system (OS) and your target device and includes code to handle interrupts, timers, generic I/O control codes (IOCTLs), and so on.
Kernel :
.gif)
The MAC address is a unique value associated with a network adapter. MAC addresses are also known as hardware addresses or physical addresses. They uniquely identify an adapter on a LAN. MAC addresses are 12-digit hexadecimal numbers (48 bits in length).
MM:MM:MM:SS:SS:SS 48 bits.
Whereas MAC addressing works at the data link layer, IP addressing functions at the network layer (layer 3). It’s a slight oversimplification, but one can think of IP addressing as supporting the software implementation and MAC addresses as supporting the hardware implementation of the network stack. The MAC address generally remains fixed and follows the network device, but the IP address changes as the network device moves from one network to another.
Finding a Mac address in UNIX/LINUX
ifconfig -a will return the MAC address of the device.
Changing the MAC ADDRESS
1) ISPs ensure each customer receives only one dynamic address using several methods. Dial-up and many DSL services typically require the customer to log in with a username and password. Cable modem services, on the other hand, do this by registering and tracking the MAC address of the device that connects to the ISP.
2) The device whose MAC address is monitored by an ISP can be either the cable modem, a broadband router, or the PC that hosts the Internet connection. The customer is free to build a network behind this equipment, but the ISP expects the MAC address to match the registered value at all times.
3) Whenever a customer replaces that device, however, or changes the network adapter inside it, the MAC address of this new equipment will no longer match the one registered at the ISP. The ISP will often disable the customer’s Internet connection for security (and billing) reasons.
1) Some people contact their ISP to request they update the MAC address associated with their subscription. This process works but takes time, and Internet service will be unavailable while waiting for the provider to take action.
2) A better way to quickly workaround this problem is to change the MAC address on the new device so that it matches the address of the original device. While an actual physical MAC address cannot be changed in hardware, the address can be emulated in software. This process is called cloning.
3) Many broadband routers today support MAC address cloning as an advanced configuration option. The emulated MAC address appears to the service provider identical to the original hardware address.
How to change Mac address in UNIX
1) ifconfig eth0 down
2) ifconfig eth0 hw ether <MM:MM:MM:SS:SS:SS>(New address)
3) ifconfig eth0 up.
Creating a Varible in UNIX shell Script
var=value
NO space as
var = value
var= value
var =value
They are errors.
You can define NULL variable as follows (NULL variable is variable which has no value at the time of definition) For e.g.
$ vech=
$ vech=”"
To print or access UDV use following syntax
Syntax:
$variablename
How to print sum of two numbers, let’s say 6 and 3
$ echo 6 + 3
This will print 6 + 3, not the sum 9, To do sum or math operations in shell use expr, syntax is as follows
Syntax: expr op1 operator op2
Where, op1 and op2 are any Integer Number (Number without decimal point) and operator can be
+ Addition
- Subtraction
/ Division
% Modular, to find remainder For e.g. 20 / 3 = 6 , to find remainder 20 % 3 = 2, (Remember its integer calculation)
\* Multiplication
$ expr 6 + 3
Now It will print sum as 9 , But
$ expr 6+3
The read Statement
Use to get input (data from user) from keyboard and store (data) to variable.
Syntax:
read variable1, variable2,…variableN
will not work because space is required between number and operator
In shell if we wish to refer this command line argument we refer above as follows
myshell it is $0
foo it is $1
bar it is $2
Here $# (built in shell variable ) will be 2 (Since foo and bar only two Arguments), Please note at a time such 9 arguments can be used from $1..$9, You can also refer all of them by using $* (which expand to `$1,$2…$9`). Note that $1..$9 i.e command line arguments to shell script is know as “positional parameters”.
REDIRECTION
$ ls > filename
It means put output of ls command to filename.
There are three main redirection symbols >,>>,<
(1) > Redirector Symbol
Syntax:
Linux-command > filename
To output Linux-commands result (output of command or shell script) to file. Note that if file already exist, it will be overwritten else new file is created. For e.g. To send output of ls command give
$ ls > myfiles
Now if ‘myfiles’ file exist in your current directory it will be overwritten without any type of warning.
(2) >> Redirector Symbol
Syntax:
Linux-command >> filename
To output Linux-commands result (output of command or shell script) to END of file. Note that if file exist , it will be opened and new information/data will be written to END of file, without losing previous information/data, And if file is not exist, then new file is created. For e.g. To send output of date command to already exist file give command
$ date >> myfiles
(3) < Redirector Symbol
Syntax:
Linux-command < filename
To take input to Linux-command from file instead of key-board. For e.g. To take input for cat command give
$ cat < myfiles
Pipes
A pipe is a way to connect the output of one program to the input of another program without any temporary file.
Pipe – Redirecting output of 1st command to 2nd without creating temporary file
Pipe Defined as:
“A pipe is nothing but a temporary storage place where the output of one command is stored and then passed as the input for second command. Pipes are used to run more than two commands ( Multiple commands) from same command line.”
Syntax:
command1 | command2
Filter
If a Linux command accepts its input from the standard input and produces its output on standard output is know as a filter. A filter performs some kind of process on the input and gives output. For e.g.. Suppose you have file called ‘hotel.txt’ with 100 lines data, And from ‘hotel.txt’ you would like to print contains from line number 20 to line number 30 and store this result to file called ‘hlist’ then give command:
$ tail +20 < hotel.txt | head -n30 >hlist
Here head command is filter which takes its input from tail command (tail command start selecting from line number 20 of given file i.e. hotel.txt) and passes this lines as input to head, whose output is redirected to ‘hlist’ file.
Process defined as:
“A process is program (command given by user) to perform specific Job. In Linux when you start process, it gives a number to process (called PID or process-id), PID starts from 0 to 65535.”
Let us go deeper & deeper in C
1)When u write this
int k = 45;
In C we refer to a variable such as the integer k as an “object”.
On seeing this, Compiler sets 4 bytes of Memory to hold the value of variable.
the lvalue is the value permitted on the left side of the assignment operator ‘=’ (i.e. the address where the result of evaluation of the right side ends up).
The rvalue is that which is on the right side of the assignment statement
lvalue :value of variable address
rvalue: value stored in that address
lvalue = rvalue
Rvalues cannot be used on the left side of the assignment statement.
for eg :
45 = k is illegal.
2)
suppose we have
int *ptr;
int k;
ptr = &k
Just think what is the role of & (unary) operator.
From the above ie 1st point that right hand side of the assignment is the rvalue which is the value stored in the address.
here we used & operator this copies the lvaue of k to the ptr.
The “dereferencing operator” is the asterisk and it is used as follows:
*ptr = 7;
will copy 7 to the address pointed to by ptr. Which also implies 7 is copied to the k also.
3) int *ptr = 2
printf(“value is %d”,*ptr);
it will give an error Segmentation Fault. Because we are
When your program runs, it has access to certain portions of memory. First, you have local variables in each of your functions; these are stored in the stack. Second, you may have some memory, allocated during runtime (using either malloc, in C, or new, in C++), stored on the heap (you may also hear it called the “free store”). Your program is only allowed to touch memory that belongs to it — the memory previously mentioned. Any access outside that area will cause a segmentation fault. Segmentation faults are commonly refered to as segfaults.
There are four common mistakes that lead to segmentation faults: dereferencing NULL, dereferencing an uninitialized pointer, dereferencing a pointer that has been freed (or deleted, in C++) or that has gone out of scope (in the case of arrays declared in functions), and writing off the end of an array.
A fifth way of causing a segfault is a recursive function that uses all of the stack space. On some systems, this will cause a “stack overflow” report, and on others, it will merely appear as another type of segmentation fault.
The strategy for debugging all of these problems is the same: load the core file into GDB, do a backtrace, move into the scope of your code, and list the lines of code that caused the segmentation fault.
4) int my_array[5]={some values}
int *ptr
we can write ptr = &my_array[0];
or
ptr = my_array
and from point 1 we know that right hand side of the assignment is the rvalue.
But in array case,
array is recognized by unmodifiable lvaue or constant address.
my_array itself reflects the address of the first element but to be noted it is used as unmodifiable lvalue. or constant value.
Input Output in RUBY The whole IO related methods are implemented in KERNEL module- gets, open, print, printf, putc, puts, readline, readlines, & test.
Second way is to used IO objects. Ruby defines a single base class IO , to handle input & output. This base class is subclassed by classes File & BasicSocket to provide more specialized behaviour.
An IO object is a bidirectional channel b/w a Ruby program & some external resource. An IO object can read & write.
IO Class
|
File BasicSocket
Opening & closing a file file = File.new (”test.txt”, mode) mode : r, r+, w, a
for eg:
File.open(“1.txt”) do |file|
while line=file.gets
puts line
end
end
1.txt the name of the file is passed to the block variable file. a special binding is there when u pass values to block.
Another way of reading from file is by Iterator. method used is each_byte which invokes a block with the next 8 bit byte from the IO object.
for eg:
File.open(“test.file”)do |file|
file.each_byte{|ch| putc ch;print “.”}
end
another method used is each_line which invokes a block when a line encounters.
for eg:
File.open(“test.file”) do |file|
file.each_line {|line| puts “Got #{line}”}
end
Doing IO with Strings
require ‘stringio’
ip = StringIO.new(“Akshat Srivastava\n Bangalore \n Mathikere!”)
op= StringIO.new(“”,”w”)
ip.each_line do |line|
op.puts line.reverse
end
Block in Ruby
A block is a set of ruby statements & expressions b/w braces {} or do-end pair.
for eg:
1) block{|a, b, c,d|}
2) block do |a,b,c,d|
end
The control is passed to block by the ‘yield’ statement. The perfect example is
def calculate
i=3
j=5
yield(i,j)
end
calculate{|x,y| puts x+y} // The is a block
when u run this code you will get 8.
The above is very basic & fundamental about Block in Ruby.
Secondly, Block can be passed to method as parameter.
def method(p1,p2,&block)
end
The fact to remember is use & sign ie ampersand sign to pass block as parameter.
Another important point is,
A block is a closure, it remembers the context in which it was defined & it uses that context whenever it is called.
Ruby Blocks are not object they are just scripplets/ chunk of codes. but they can convert in to Objects.
i.e Proc Object
The block passed in a method is an Object of Proc type.
We can create like
block = Proc.new{‘a block’}
block=lambda{“a block”} they are called lambdas object.
def method
p = Proc.new {return 99}
p.call
puts “Never get here”
end
on executing it prints 99 only.
Because it return to the operating system.
but if u use
p = lambda{return 99}
p.call
puts “Would be here”
Around 9 PM I was dining with my friend Rajesh, I met a person who I often saw in places he was an M.A in Yoga.
I talked to him asked a few questions regarding how to think about starting the Yoga, what is the best time to start the Yoga? what is the first step for the beginers? & many questions
Although he is a professional yoga guru he taught us an important knowledge in a very short time & short meeting.
That I want to share & express………….
He says the best time for practising yoga is 5 AM to 7 AM, the first step is breathing while doing it mind inhaling & exhaling, start with doing for 2 minutes. Increase at slow rate.
Mind that your full heed on breathing, your full concentrate should point on the two thread of a process, the former is inhaling thread & then exhaling thread.
so what to think start doing now……………..:)
Hoping to meet him again to learn this divine treasure.
Cheers
Akshat.