Tuesday, September 28, 2010

Calculation of forces acting on an object on an inclined plane

Key:
N = Normal force that is perpendicular to the plane
m = Mass of object
g = Acceleration due to gravity
θ (theta) = Angle of elevation of the plane, measured from the horizontal
f = frictional force of the inclined plane
To calculate the forces on an object placed on an inclined plane, consider the three forces acting on it. Air resistance may be neglected for most calculations, except at high speeds.
  1. The normal force (N) exerted by the plane onto the body,
  2. the force due to gravity (mg - acting vertically downwards) and
  3. the frictional force (f) acting parallel to the plane.
We can decompose the gravitational force into two vectors, one perpendicular to the plane and one parallel to the plane. Since there is no movement perpendicular to the plane, the component of the gravitational force in this direction (mgcosθ) must be equal and opposite to normal force exerted by the plane, N. If the remaining component of the gravitational force parallel to the surface (mgsinθ) is greater than the static frictional force fs - then the body will slide down the inclined plane with acceleration (gsinθ - fk/m), where fk is the kinetic friction force - otherwise it will remain stationary.
When the slope angle (θ) is zero, sinθ is also zero so the body does not move.

External links

Sunday, September 12, 2010

Lumped Vs Distributed Systems

For example, consider the following two systems:
\epsfbox{eps/mech.eps}
  • The first system is a distributed system, consisting of an infinitely thin string, supported at both ends; the dependent variable, the vertical position of the string $ y(x,t)$ is indexed continuously in both space and time.
  • The second system, a series of ``beads'' connected by massless string segments, constrained to move vertically, can be thought of as a lumped system, perhaps an approximation to the continuous string.
  • For electrical systems, consider the difference between a lumped RLC network and a transmission line
    \epsfig{file=eps/elec.eps,width=6.5in}
  • The importance of lumped approximations to distributed systems will become obvious later, especially for waveguide-based physical modeling, because it enables one to cut computational costs by solving ODEs at a few points, rather than a full PDE (generally much more costly)

Wednesday, September 8, 2010

How do I find out if my Lan (NIC) card working at full or halt duplex mode / speed under Linux?

LAN card or NIC is use to send and receive data. Technically, we use word Duplex for this functionality. Full duplex means you are able to send and receive data (files) simultaneously. In half duplex, you can either send or receive data at a time (i.e. you cannot send receive data (files) simultaneously). Obviously, full duplex gives you best user experience. However, how can I find out whether I am using full duplex/half duplex speed/mode?
Here full duplex, half duplex and auto-negotiation have the following meanings.
Full Duplex - Logic that enables concurrent sending and receiving. This is usually desirable and enabled when your computer is connected to a switch.

Half Duplex - This logic requires a card to only send or receive at a single point of time. When your machine is connected to a Hub, it auto-negotiates itself and uses half duplex to avoid collisions.

Auto-negotiation - This is the process of deciding whether to work in full duplex mode or half duplex mode. An Ethernet card supporting autonegotiation will decide for itself which mode is the optimal one depending on the network it is attached to.

Task: Find full or half duplex speed

You can use dmesg command to find out your duplex mode:

# dmesg | grep -i duplex

Output:
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

ethtool command

Uss ethtool to display or change Ethernet card settings. To display duplex speed, enter:

# ethtool eth1

Output:
Settings for eth1:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 10Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: umbg
        Wake-on: g
        Current message level: 0x00000007 (7)
        Link detected: yes

mii-tool command

You can also use mii-tool to find out your duplex mode. Type following command at shell prompt:
# mii-tool

Output:
eth0: negotiated 100baseTx-FD flow-control, link ok

Remember,
  1. 100baseTx-FD: 100Mbps full duplex (FD)
  2. 100baseTx-HD: 100Mbps half duplex (HD)
  3. 10baseT-FD: 10Mbps full duplex (FD)
  4. 10baseT-HD: 10Mbps half duplex (HD)
mii-tool utility checks or sets the status of a network interface’s Media Independent Interface (MII) unit. Most fast ethernet adapters use an MII to autonegotiate link speed and duplex setting. If you are using old card then this utility may not work (use dmesg command).
This utility is useful for forcing specific Ethernet speed and duplex settings too, setup 100Mbps full duplex speed under Linux:
# mii-tool -F 100baseTx-FD

Setup 10Mbps half duplex:
# mii-tool -F 10baseT-HD       

Determine / Find ethernet connection speed

You need to use ethtool command todisplay or change Ethernet card settings. It is used for querying settings of an Ethernet device such as
=> Link speed
=> Autonegotiation
=> Coalescing settings
=> Change the rx/tx ring parameters
=> Setup new speed and much more
Most intelligent network devices use an autonegotiation protocol to communicate what media technologies they support, and then select the
fastest mutually supported media technology.

How do I determine Ethernet connection speed?

Type the following command to get speed for eth0:

$ ethtool eth0 | less

OR
 
$ ethtool eth0 | grep -i speed

Saturday, August 28, 2010

Windows XP Command Line Hacking Tricks Guide

Windows XP Command Line Hacks is a guide for advanced hacks and tricks for Windows XP operating system. This guide contains all basic to advanced hacing tricks and tips for favourite Windows XP based computers. With the help of this useful guide you can learn how to do work around the command line interface of Windows XP which also may very helpful when you having any critical error of issue with your Windows system and you can easily handler the situation with it. The author of this great guide is Carolyn Z. Gillay and it publisher in Franklin Beedle & Associates. This book contains 908 pages with all information you need.

Free Download Windows XP Command Line Hacks Guide:

Windows XP Command Line Hacks (5.3 MB)

Tuesday, August 24, 2010

How Do I Switch Users Under Linux?


Even if you have no schizophrenic tendencies, sometimes you'll want to become someone else while using Linux. For example, if you're logged in as hermie and you need to do something quickly that requires superuser authority, just enter the command
su - root
In response to the su (switch user) command, you'll be prompted for the root account password ($ sudo passwd root ). If you enter the password correctly, your prompt will change from a dollar sign to a pound sign (to reflect your status as root), and you will assume the powers of the root user. Issue the command
exit
to return to your previous identity. You can also use su to become any user on the system, not just root. For example, to become sigmund, you would enter this command:
su - sigmund
Don't forget the minus sign when you use su to temporarily become another user. Without it, the login profilefor that user is not executed--so it's not really the same as logging in, because your environment variables, and aliaseswould not change.
This would be like starting DOS without running the autoexec.bat file--things wouldn't work the same, because your personal setup commands (PATH and so on) would not run.
But why would you want to use su when you can have multiple log-ins via virtual consoles (see "Living in a Shell")? Because it's sometimes quicker or more convenient to switch between users using su, and because you may have no virtual consoles available--you may be using all of them or, if you're logged in to the machine via a modem, virtual consoles may not be available to you.

Tuesday, August 17, 2010

Line Control (#line)

A preprocessor line control directive supplies line numbers for compiler messages. It causes the compiler to view the line number of the next source line as the specified number.

A preprocessor #line directive has the form:

>>-#--line--+-decimal_constant--+-----------------+-+----------><
| '-"--file_name--"-' |
'-characters----------------------------'

In order for the compiler to produce meaningful references to line numbers in preprocessed source, the preprocessor inserts #line directives where necessary (for example, at the beginning and after the end of included text).

A file name specification enclosed in double quotation marks can follow the line number. If you specify a file name, the compiler views the next line as part of the specified file. If you do not specify a file name, the compiler views the next line as part of the current source file.

In all C and C++ implementations, the token sequence on a #line directive is subject to macro replacement. After macro replacement, the resulting character sequence must consist of a decimal constant, optionally followed by a file name enclosed in double quotation marks.

Example of the #line Directive

You can use #line control directives to make the compiler provide more meaningful error messages. The following program uses #line control directives to give each function an easily recognizable line number:

/**
** This example illustrates #line directives.
**/

#include
#define LINE200 200


int main(void)
{
func_1();
func_2();
getch();
return 0;
}

#line 100
func_1()
{
printf("Func_1 - the current line number is %d\n",__LINE__);
}

#line LINE200
func_2()
{
printf("Func_2 - the current line number is %d\n",__LINE__);
}

This program produces the following output:

Func_1 - the current line number is 102
Func_2 - the current line number is 202