Friday, July 25, 2014

Writting run time code in eclipse for debugging as in firebug console

While debugging an application/program in eclipse , go to the display screen in the side menu items with in the eclipse and type run time variables and execute the same like you would prefer to do in firebug, where you type commands and click on run.

 

Alternatively, to bring up the Display screen, you can go to

 

window->show view ->Display or Ctrl+Shift+D

 

I have simply heard about the same and have not tried it yet. So plz don’t blame me if it does not work for you.

 

Hope this works 0.0

 

Thursday, July 24, 2014

Customizing the UNIX User Environment - Part 1 - UNIX shell configuration files - Part 1

Customizing the UNIX User Environment

**********************************************************************************

UNIX shell configuration files

**********************************************************************************

Introducing shell configuration files

---------------------------------------

 

A shell is an interactive interface that you use to communicate with the UNIX kernel. It provides a way of executing commands and getting standard feedback in the UNIX environment.

 

Kernel is a software layer that enables interaction of the HLL with the hardware

 

The most commonly used UNIX shells unclude the

- Bourne shell - is the oriinal UNIX shell, developed by Stephen Bourne. It doesnot support some of the features of the more recent shells, such as command-line editing

- Korn shell - is similar to the Bourne Shell but incorprates features from the C shell - dev by David Korn

- Bash shell - is the GNU (operating system) implementation of the Bourne shell, and stands for Bourne Again Shell. It adds features such as command-line editing to the original Bourne shell.

- C shell - is a UNIX shell developed by Bill Joy. It is similar to the Bourne shell, but its command set has been adapted syntactically to match the C language.

 

Typically a shell runs in interactive mode, meaning that you can type commands into it and get results. It's also possible to run a shell non interactively. For example, while working in the Bash shell you might need to run a shell script that required the C shell. If properly configured, the script could invoke the C shell in a noninteractive mode long enough to complete the script's running.

 

When a shell starts up, it reads several different configuration files to learn how you want it to look and behave. Typically, a shell will begin by reading the /etc/profile file. This file contains global environment variables that the root user wants constant for all users, and only root can edit this file.

 

Once the shell has processed the /etc/profile file, it reads the .profile file located in the home direcotry of the user that started the shell. The initial period indicates that the file is hidden.

 

Because UNIX generally only reads the .profile file during login, specific shells have additional startup and configuration files. Both the Korn and Bash shells have an evironment variable called ENV that points to a script that is run whenever a new shell is started, not just at login.The name of the file that ENV poins to is arbitrary. However, by convention, on Bash it is called .bashrc, and on Korn .kshrc.

Customizing the UNIX User Environment - Part 1 - UNIX shell configuration files - Part 2

Customizing the UNIX User Environment

**********************************************************************************

UNIX shell configuration files

**********************************************************************************

 

Configuring user profiles

----------------------------------------

The file that most directly affects a user's experience of a shell is the .profile file located in a user'a home directory.

This file contains variables and commands that relate to how a user's shells will look and respond

 

Following is an example of a Bash shell .profile file.

 

bash-2.05a# cat .profile

#variables

SHELL=/bin/bash              #specifies path to the executable file for this shell

ENV=$HOME/.bashrc

PS1=$PWD

PATH=/usr/java/j2sdk_1_4_01/bin:$PATH

bash-2.05a#

 

Any line of text in a .profile file that begins with a hash (#) is a comment and the system ignores it.

Note: There are no mandatory .profile variables. Each variable shown here is an example, and is not strictly required to run a functional system.

 

ENV vairable specifies the path to the script that will be run for every subsequent instance of this shell-such as non interactive subshells launched by other scripts. It references the path value stored in the shell variable HOME - set elsewhere - by placing a dollar symbol ($) in front of the variable name.

 

The PS1 variable specifies the text that should be displayed as a prompt. In this case, it references the value stored in the PWS global variable, which is the path to the current working directory

 

The PATH variable specifies paths for the system to search for executables binaries. The PATH variable is normally set in the /etc/profile file. In this case, the value of the PATH variable is appended with additional information specifically for this user.

 

Followin gis a sample .bashrc file. which would normally be referenced by the EBV variable in a user's .profile file.

 

bash-2.05a# cat .bashrc

#Aliases

alias f=finger

alias fun=/usr/games

bash-2.05a#

 

Note : There are no mandatory .bashrc commands. Each command shown here is an example, and is not stricly required to run a functional system.

 

This .bashrc file contains alias commands that allow you to assign a shortcut name to a command or path, to minimize typing.

The first command assigns an alias of "f" to the finger command, which means you could now execute the finger command simply by typing f.

If the target of an alias consists of more than a single word, you should enclose it in single quotes.

 

The next alias command assigns an alias of "fun" to the path /usr/games. This means you could now navigate to that path by typing cd fun.

 

Alias commands can be executed from the shell prompt.

When the target of an alias is longer than a single word, you need to remember to enclose it in single quotes. In this case, the full statement reads as folloes:

alias list = 'ls -l|more'

 

Summary

--------------

A shell provides an interface for users to interact with the kernel. You configure shells using the /etc/profile and .profile files.

The .profile file contains variables and commands that configure a specific user's shell, but the file is usualy only referenced at login. Any commands that should be executed for every script should be placed in a separate file and referenced using the ENV variable.

Customizing the UNIX User Environment - Part 1 - Working with UNIX environment - Part 3

Customizing the UNIX User Environment

**********************************************************************************

Working with UNIX environment

**********************************************************************************

Global and local variables

-----------------------------

 

You use variables to customize how a shell looks, behaves, and responds to user input.

There are two kinds of variables: global or environment variables and local or shell variables

 

The root user sets global variables and stores them in the /etc/profiles file. Global variables affect all users' shells, providing standard parameters for any shell environment.

Programs running in the system have access to global variables, and use them to make behavior decisions.

 

Users can set theor own local variables, storing them in .profile files in their home directories.

Local variables affect a particular user's shell session only.

 

Some common global variables include

-EDITOR  - specifies default editor to use for general text edits. Default value is the vi text editor

-PATH  - specified one or more paths that the system will search for executable files when you enter a command at the shell prompt. The default setting is /usr/bin.

-PRINTER - specifies the default pronter. By default this is not set

-PS1 - specifies the prompt displayed in the shell. Default is $

-SHELL - specifies the path to the default shell program. on most systens this would be /bin/sh.

-TERM - specifies the default terminal used to access the system. The default value is vt100.

 

Some common local variables include

-HOME - specifies the path to the user's home directory

-LOGNAME - specifies the name that the user uses to log in with

-MAIL - specifies the path to the user's mailbox

 

When you set a global variable in a local context, the global variable gets overrided. Local variables are for customizing an individual user's experience of the system, so they override global variable values - for that user only.

 

You can view all of the currently set variables in your shell using the env command. Please type env in the console and hit enter to see the currently set variables

 

You can view the value of an individual variable using the echo command.

bash-2.05a$ echo $PATH

 

You need to prefix the variable name with a $ symbol in order to reference its contents rather than just typing it's name

 

In Bourne shell derivatives, you can set individual variables from the shell prompt by simply declaring them using the form variable=value.

The code shown here sets the value of the PS1 variable - the text that the shell displays as a prompt - to the current working directory, followed by a $.

 

The PS1 variable supports several switches to make it easier to configure, including

-\h - systems hostname

-\s - reference the name of the current shell

-\t - reference the current time in 24 hour format (HH:MM:SS)

-\u - reference your current username

-\w - reference the name of the current working directory

 

Once you've set the value of a variable you can force any subshells you launch to use the same value, using the export command, as shown here.

 

bash-2.05a$ PS1='\w$'

/home/ak$ export PS1

/home/ak$

 

Setting variables in the C shell is similar to Bourne variants, but requires the use of the setenv command.

The code shown here sets the value of the ld_library_path variable to /usr/lib.

 

easynomad2$ setenv ld_library_path variable to /usr/lib

easynomad2$

 

The C shell uses a different set of variables from the Bourne derivative shells. Because some of the variable names are the same, all C shell variables are expressed in lowercase.

 

Customizing the UNIX User Environment - Part 1 - Working with UNIX environment - Part 4

Customizing the UNIX User Environment

**********************************************************************************

Working with UNIX environment

**********************************************************************************

 

User environment commands

------------------------------------------------------------

UNIX comes with many standard command programs, stored in directories such as /bin, /usr/bin, and /sbin.

Shell programs have additional commands built into them. These commands are known as user environment - or built-in - commands.

 

One of the most useful built-in commands is the su command. Executed without arguments, it allows you to become the root user while logged into any other account, as shown here.

This is extremely convenient if you find yourself in need of admin privileges while logged in as another user, as it saves you having to logout and in again as root. If you use su, you will be required to supply the root password.

 

bash-2.05a$ su

Password:

su-2.05a#

 

When you've finished your admin task, you end your su session with the exit command, which returns you to your normal shell.

 

su-2.05a# exit

exit

bash-2.05a$

 

One of the functions of groups in UNIX is to allow members of groups to share files with each other, or to access resources that belong to the group.

If you need to move a fils, directory or other resource to a different group, you can do so using the built-in command chgrp.

 

Syntax: chgrp [-R] new _groupt object

It takes atleast two arguments: the destination group and the name of the object being moved. And you can specify the -R option if you're moving a directory and you want its subdirectories and all their contents to be moved as well.

 

You can get a lost of all users currently logged into the system using who command.

You can find out more about a currently logged in user using the finger command with their username as an argument

 

The finger command produces info abt a currently logged in user, including their fullname, the path to theor home directory, and which shell they're currently using.

 

Customizing the UNIX User Environment - Part 2 - Customizing X - Part 1

Customizing the UNIX User Environment

**********************************************************************************

Customizing X

**********************************************************************************

 

In UNIX systems, the X Window System - also called X - controls the interaction between the GUI display and the programs and applications that use it. The most popular and widespread of the X window System is XFree86

 

X architecture

------------------------

The X Window System uses a client-server architecture. The X server process runs on the computer that is displaying the GUI. This is usually a terminal or workstation.

 

The X client process runs on the computer that runs the application that suppies data to the GUI. This can be the same computer that displays the GUI, but it can also be a remote computer such as a network server.

 

Because X client applications can run on central network servers, you can implement networks where the terminal computers are very simple. X terminals need to have enough RAM and disk space to run the UNIX kernel and the X server procecss, but they dont need disk space for applications. They need a network card to communicate with servers, but they dont necessarily need a modem

 

Simple terminals that run only the kernel and X are called as X terminals. They function only as display terminals, with all application processing taking place on the server.

 

Although X hanfles the interaction between the GUI and the programs that display in it, X doesn't control the way windows look and behave.

The function is taken care of by window managers. These are programs that run on X servers. They rely on X for their interaction with the Kernel

 

The window manager determines the way window look on screen and the kind of controls - such as close and maximize buttons - that they have.

The window manager also controls the way users can move windows and alternate the focus between them.

 

There are many window managers for X, including Sawfish and Blackbox. Each window manager imarts its own look and feel to the GUI

 

The look and feel of a window manager depends on the set of GUI controls - or widgets - that it includes. Widgets are elements like buttons and drop-down lists. Each window manager has a different set of widgets

 

Because the UNIX GUI is made up of the X server process, a window manager, and usually a desktop environment, it requires much more processing and system resources than a command-line shell.

 

X is well suited to end-user computers like home PCs and office workstations. It shouldn't be used on busy servers like database and web servers because it uses system resources and slows down the server's vital operations.

 

A UNIX GUI can be comprised of an X server process, a window manager, and a desktop environment.

 

The X Window System also called X running on a computer are resource intensive, so you shouldn't use them on busy servers.

 

Customizing the UNIX User Environment - Part 2 - Customizing X - Part 2

Customizing the UNIX User Environment

**********************************************************************************

Customizing X

**********************************************************************************

 

Setting up an XFree86 server

-----------------------------------

XFree86 is the most widespread version of the X Window System. The latest version of XFree86 is version 4.x. Before you set up a computer to be an XFree 86 4.x server, you need to gather information about its display hardware. You need to find out about its

 

- monitor refresh rate - the horizontal scan rate and the vertical synchronization rate of the monitor

- display adapter chipset

- display adapter memory - determines the max resoulution and color depth that X can use.

 

To set up a computer as an XFree85 4.x server, you need to generate an initial X configuration file. To do this, you log in as the superuser and type the following at the shell prompt. Which inturn checks the computer's display hardware and generates a matching configuration file called XF86Config.new

 

bash-2.05a$ XFree86 - configure

bash-2.05a$ ls -l | grep 'XF86'

-rw-r--r-- 1 root wheel 2383 Oct 31 17:08 XF86Config.new

bash-2.05a$

 

You need to test whether the configuration file is set up correctly. To do this, you type the command statement shown here.

 

bash-2.05a$ XFree86 -xf86config XF86Config.new

 

XFree86 runs a test to determine whether X works with the configuration file. If it works, you should see a gray grid background with a black X-shaped cursor in the center.

 

To exit the test, you press Ctrl+Alt+Backspace.

 

Once you've generated and tested the XFree86 configuration file, you open the file using a text editor such as vi and tune it for the hardware and display configuration that you want.

The XFree86Config file consists of several sections, each of which deals with a specific area of X configuration.

The following sections specify basic XFree86 configuration settings

-Module - specifies optional modules that X can load when it start up. Eg font modules and double buffer extension (DBE) module

-Files - allows you to specify path to RGB color code db as well as paths to font directories

-Server flags - enable/disable various X server settings including detailed error messages

 

The following section of the XFree86Config file deal with the X server's input and output devices:

-Input devices - protocols & settings for i/p devices & specify props like keyboard layout, keystrike autorepeat speed, three-button mouse emulation etc..

-Monitor - horz scan rate and vert synchronization rate for monitor

-Graphics device - disp adapter and video memory

-Screen - color depth & resolution

-ServerLayout - configuring X for multiple monitors

 

You need to configure the refresh rate, color depth, and screen resolution before you can run X reliably

 

To specify the refresh rate of your monito, you open the XFb6Config file and go to the Monitor section.

You specify the horizontal refresh rate by assigning a value in KHz to the HorizSync parameter and you specify the vertical refresh rate by assigning a value in Hz to the VertRefresh parameter.

 

Note: You can find out your monito's refresh rates from the monitor's user manual or from the plaguw at the rear of the monitor.

 

To specify color depth and screen resolution, you go to the Screen section of the XF86Config file.

The Screen section contains multiple Display subsections, each of which applies to a particular color depth. You can set different screen resoluitons for each color depth.

 

To set the screen resolution for a particular color depth, you add a line to the relevant subsection and specify the resolution using the Modes parameter

 

You set the default color depth using the DefaultColorDepth parameter at the beginning of the Screen section.

When you start X, it displays at the default color depth and uses the screen resolution that you've specified in the Display subsection corresponding to that color depth.

 

Once you've finished editing the XF86Config file, you copy it to the /etc/X11 directory. X will then use this configuration fole each time you start X.

 

bash-2.05a$ cp XF86Config.new /etc/X11/XF86Config

 

Unless a computer has been configured to load X automatically at startup, you need to start X manually from the command prompt. You type the following command to do it

 

bash-2.05a$ startx

 

When X starts up, it also loads the window manager and desktop environment that are currently configured as defaults.

 

To shut down X, you choose Logout from the desktop's main menu or press cntrl+Alt+Backspace to kill X.

Customizing the UNIX User Environment - Part 2 - Customizing X - Part 3

Customizing the UNIX User Environment

**********************************************************************************

Customizing X

**********************************************************************************

 

Installing fonts

----------------------------

X can use a variety of fonts to display text in windows and on widgets. Before you can use these fonts, however, you need to install them and configure X so that it knows where to find the font files.

XFree86 4.x supports three types of fonts:

-Type 1 fonts - use an Adobe postsscript standard. They store the character glyphs and font metrics in two separate files

-TrueType fonts - use an Apple standard. They've also been widely adopted by Microsoft. They are highly scalable and store all their font info in a single file

-antialiased fonts - new feature of XFree86 4.x. They are rendered more smoothly than other types of fonts.

 

UNIX stores Type 1 fonts in several font directories that branch from /usr/ports/x11-fonts/.

These include the urwfonts directory and the free fonts directory.

 

To install donts from a font directory, you navigate to the directory and type

make install clean.

 

bash-2.05a$ cd urwfonts

bash-2.05a$ make install clean

 

when you install a set of fonts, UNIX creates font directories in /usr/X11R6/lib/X11/fonts/

 

To configure X so that it can access these fonts, you need to edit the Files section of the XF86Config file.

 

You add a FontPath row to the Files section, specifying the location of the font directory. In this case, you specify the path to the URW font directory.

 

XFree86 4.x supports TrueType fonts using an extension module called freetype. You need to enable this module so that X can access TrueType fonts.

 

To enable the freetype module, you edit the XF86Config file, adding the following row to the Modules section:

Load "freetype"

 

XFree86 4.02 and later versions support antialiasing for all scalable font types. However, many desktop toolkits don't support antialiasing. The Qr toolkit for the KDE desktop is one of those that do.

 

To enable antialising with Qt, you need to edit the /usr/X11R6/lib/X11/XftConfig file using a text editor such as vi. You add lines defining each of the font directories for which you want to enable antialiasing

 

Because antialiasing smooths out the edges of screen fonts, it makes small fonts more readable and large fonts more attractive. However, it causes eyestrain when applied to medium-size fonts.

 

To disable antialiasing for medium-size fonts, you add a section to the XftConfig file that matches a range of font sizes - in this case 10 to 14 points - and disables antialiasing for it.

 

On a large network, it may be better to set up a font server and configure X to look for fonts on the font server.

 

To configure X to use a font server, you need to edit the XF86Config file and add a FontPath line to the Files section that specifies the port number of the font server. If font server is on port 3 you would see something line

 

FontPath "unix:/3"

 

Note: this procedure sets up a system-wide font server. To add a user-specific font server, you need to edit the .xinitrc file in the user's home directory

 

 

 

Customizing the UNIX User Environment - Part 3 - UNIX X window managers and desktops - Part 1

Customizing the UNIX User Environment

**********************************************************************************

UNIX X window managers and desktops

**********************************************************************************

XDM

-----------

The X Display Manager (XDM) is a program that manages login sessions for the X Window System.

 

XDM prompts users for theor username and password. Then it authorizes them and opens a session on an X server for them.

When a user exits the X interface. XDM closes the session and prompts the next user for their username and password.

 

XDM is particularly useful in large network implementations that have more than one X dispay server. In such cases, XDM allows users to choose which server they want to connect to.

 

To start XDM, you run the XDM binary, which in this case is located in the /usr/X11R6/bin directory. You need to be logged in as root to do this.

 

You can configure a system so that XDM runs automatically when the system starts up. The procedure for doing this varies from one flavor of UNIX to another.

 

If you're using a system with virtual terminals - such as FreeBSD - you can add a line to the /etc/ttys file that automatically runs XDM in one of the virtual terminals. In this example, XDM uses the ninth virtual terminal.

 

Once you've started XDM, it display a graphical login window whenever a user needs to login.

You can customize the appearance of this window. This example shows a common default.

 

You can configure XDM by editiong the following files, all of which are located in /usr/X11R6/lib/X11/xdm:

- xdm-config - file contains flobal default settings that apply to all of the displays to which users can connect

- xdm-errors - file contains a record of error messages generated by the X sessions that XDM runs. It's useful for troubleshooting

- xdm-pid - file allows you to specify the process ID of the XDM process.

- Xaccess - file contains a set of rules for controlling access to XDM. You can use it to determine how remote X client connections are authorized.

- Xresources - file contains default settings for the appearance of the login screen, and specifies the default display server.

- Xservers - file lists all the remote display servers to which users of XDM can connect. They can choose any of these servers when they log in.

- Xsession - file is the default session script that runs when users log in and start a session.

 

Note : The directory in which these files are located may differ depending on the UNIX implementation you're using.

 

In addition to the XDM configuration files, the /usr/X11R6/lib/X11/xdm directory contains a set of display setup scripts.

These scripts are named Xsetup_0, Xsetup_1, and soon. You can use them to specify background processes that run automatically when XDM starts an X session on a particular display.

Customizing the UNIX User Environment - Part 3 - UNIX X window managers and desktops - Part 2

Customizing the UNIX User Environment

**********************************************************************************

UNIX X window managers and desktops

**********************************************************************************

Integrated desktop environments

-----------------------------------------------------------------------------------

Integrated desktop environments provide an attractive and user-friendly interface to UNIX systems. It is a preconfigured session of a window manager.

 

Integrated desktop environemnts commonly contain

- default settings for window appearance and behavior

- a set of defautl widgets

- a set of desktop backgrounds

- default desktop icons such as a recycle bin

- a panel for managing tasks and workspaces

 

There are three common integrated desktop envionments for UNIX

- Common Desktop Environment (CDE)

- Gnome

- Kool Desktop Environment (KDE)

 

All of the above mentioned evnironment have at the minimum, A trash icon, easy access drip-down menus and workspace buttons in common

 

KDE is bundled with its own window manager, while Gnome i most commonly used with Sawfish. Desktop environments and window managers are distinct GUI components - you are not obliged to have a window manager but, when you do, it sits on top of your desktop.

 

Summary

---------

The X Display Manager (XDM) is a program that manages login sessions for the X Window System. XDM prompts users for their username and password. Then it authorizes them and opens a session on an X server for them. When a user exits the X interface, XDM closes the session and prompts the next user for their username and password.

 

Window managers are programs that run on an X server and determine the appearance and behavior of windows in the GUI environment. For example, window managers determine window colors and borders, button size and style, and focus policy.

 

Integrated desktop environemnts are preconfigured sessions of a window manager, providing default widgets, icons, and backgrounds. Most of them include a panel that allows you to manage tasks and workspaces. The three most popular desktop environments are the Common Desktop Environment(CDE), Gnome, and the Kool Desktop Environment (KDE).

Customizing the UNIX User Environment - Part 3 - UNIX X window managers and desktops - Part 3

Customizing the UNIX User Environment

**********************************************************************************

UNIX X window managers and desktops

**********************************************************************************

Integrated desktop environments

-----------------------------------------------------------------------------------

Integrated desktop environments provide an attractive and user-friendly interface to UNIX systems. It is a preconfigured session of a window manager.

 

Integrated desktop environemnts commonly contain

- default settings for window appearance and behavior

- a set of defautl widgets

- a set of desktop backgrounds

- default desktop icons such as a recycle bin

- a panel for managing tasks and workspaces

 

There are three common integrated desktop envionments for UNIX

- Common Desktop Environment (CDE)

- Gnome

- Kool Desktop Environment (KDE)

 

All of the above mentioned evnironment have at the minimum, A trash icon, easy access drip-down menus and workspace buttons in common

 

KDE is bundled with its own window manager, while Gnome i most commonly used with Sawfish. Desktop environments and window managers are distinct GUI components - you are not obliged to have a window manager but, when you do, it sits on top of your desktop.

 

Summary

---------

The X Display Manager (XDM) is a program that manages login sessions for the X Window System. XDM prompts users for their username and password. Then it authorizes them and opens a session on an X server for them. When a user exits the X interface, XDM closes the session and prompts the next user for their username and password.

 

Window managers are programs that run on an X server and determine the appearance and behavior of windows in the GUI environment. For example, window managers determine window colors and borders, button size and style, and focus policy.

 

Integrated desktop environemnts are preconfigured sessions of a window manager, providing default widgets, icons, and backgrounds. Most of them include a panel that allows you to manage tasks and workspaces. The three most popular desktop environments are the Common Desktop Environment(CDE), Gnome, and the Kool Desktop Environment (KDE).

Customizing the UNIX User Environment - Part 4 - UNIX documentation - Part 1

Customizing the UNIX User Environment

**********************************************************************************

UNIX documentation

**********************************************************************************

UNIX system documentation refers to reference material, which is in the form of both online and hard copy tutorial documents and manuals. The system documentation enables a user to access help information on how to install UNIX and use UNIX commands and utilities.

The system documentation may include the online manual, commonly referred to as "the man pages," info pages, and instructions in "readme" files, which are sometimes provided with applications. Although documentation is usually available in an electronic format, hardcopy documentation is sometimes provided with a system.

 

Overview of the online manual

-------------------

The UNIX online manual - known as the man pages - contains explanations of all the UNIX commands.

You can use these explanations as a handy reference to find out what a particular command does

You can also use it to search for a task you want to perform

 

The online manual includes the following sections

commands - The user commands section contains help information on UNIX commands that ordinary users can access

systemcalls - contains help info on functions that only the kernel provides

subroutines - contains help information on library functions

special files - contains help info on devices listed in the dev directory

file formats - contains help info on file format descriptions for example /etc/passwd

macro packages and conventions - contains info on miscellaneous apps

games - contains info on games installed on a computer system

system maintenance - contains help info about system administration tools executable by the root

 

Subroutines (add info) - Third party library APIs are supplied to perform tasks which are not included in the default installations. You can program against these libraries using an appropriate language, such as C++. The suppliers of the livraries include their own man pages that descrine each function and how to use it.

 

System Calls (add info) - By virtue of the kernel UNIX allows many programs to run simultaneously by giving each one the illusion that it exists on its own private virtual-machine. Calls from your applications to the kernel are known as system calls. You can use the trace command to see the system calls that a particular application generates.

 

System Maintenance (add info) - Administration function allows you to maintain a UNIX system. For example, they allow you to gather details on a specific user(finger), determine who is currently logged on (who is), and remove a specific process(kill).

 

 

 

 

 

 

 

 

Customizing the UNIX User Environment - Part 4 - UNIX documentation - Part 2

Customizing the UNIX User Environment

**********************************************************************************

UNIX documentation

**********************************************************************************

Navigation Options

-------------------

Let's say you want to find out what the ps command does. To invoke the ps man page (also called manual page), at the shell prompt, you type

man ps (hit enter)

 

The man page opes, giving a description of the command. In this case, you see that the ps command is used to list the status of processes

 

Manual (man page) description for ps starts like the following

 

----------------

PS(1)                     FreeBSD General Commands Manual

                PS(1)

 

Name

                ps - process statis

SYNIPSIS

                ps [-aCcefhjlmrSTuvwx] [-M core] [-N.......

-----------

 

the 1 in PS(1) indicates that this belongs to the first of the eight sections of the manuals

 

Man pages generally contain more information than can fit on one screen , so a pager displays the pages for navigation purposes

 

Usually, man pages are fusplayed using the pager specified in the $PAGER environment variable.

 

If you dont want to use your environment;s default pager, you can specify a pager with the -p option. For example, the command man -P less ps changes the pager environment from the default ps pager evironment, which you navigate by using keystrokes to a pager environment where you can execute search commands.

 

On Most systems, you can use the following key to navigate man pages:

 

- space and b

  space - allows user to move one page down from a current man page

  b - one page up from current man page

- down or j and up or k arrows - allows users to move one line down or up in man page

- G and g - allows users to move to end and start of document respectively

- q - allows users to exit a current man page environment

 

Headings of a typical man page format

 

-NAME  - you will find the name of the command or program and a short description of it

-SYNOPSIS  - you will find a description of the synatax

-DESCRIPTION  - provides explanation of the command or utility

-OPTIONS  - provides explanation of command -line options

-ENVIRONMENT - you will find definitions of relecant environment variables

-EXAMPLES - will have usages and short explanation of the commands

-SEE ALSO - provides reference to other relevant man pages

-FILES - the FILES heading is found in the man pages of programs that use configuration files. The heading contains information on the location and function of these configuration files

 

Different man pages may have different formats. As a result, some man pages may have only some of the typical headings discussed here.

For example, there are no configuration files for the cat command, so that heading is not on the man page.

 

The format of a man page includes sections to indicate an exiting program, returning program and errors.

It also includes section for listing the system files that a command uses and for linking the user to related man pages.

The format of a man page may also include a section for notes and bugs related to a command.

Customizing the UNIX User Environment - Part 4 - UNIX documentation - Part 3

Customizing the UNIX User Environment

**********************************************************************************

UNIX documentation

**********************************************************************************

Apropos and man -k

------------------------------

You dont have to know the name of a particular command to use its man pages.

You can also search by using keywords. This search, which you incoke using the apropos keyword, returns a set of commands containing the keyword in their hearder lines.

You can then use this list to select the correct command for your task.

 

Lets say that you want to perform a task that involves copying data, but you dont know the best command to use.

In this case, you use the keyword "copy", and you type the following at the shell prompt:

apropos copy

 

Apropos searches header lines and return a list of all the man pages containing the word "copy" in their headers.

 

The list that apropos returns contains relecant commands with a number in parentheses - for example, cpio(1).

The number in parantheses represents the section number of the main page, in which you can find each returned command.

 

Apropos may not work on some computers. In this case, you can use the

man-k

command as an alternative.

Tor example, to access help information on how to copy data, you type the following at the shell prompt:

man -k copy

 

The out put is similar to that of apropos

 

The whatis command provides more restricted searches than man -k and apropos commands.

The man -k and apropos commands search for short descriptions and manual page names, whereas the whatis command searches for exact matches only.

For example, typing whatis copy returns the exact matches for copy as shown here.

 

You can send a man page, for example the copy man page, to a local printer using the lpr command.

However, you may need to format a man page, for example add a header containing the filename and page number, before sending it to the printer.

You may also need to convert it to an appropriate outpit format for a specified printer.

 

To print a man page for copy to a PostScript printer, for example, you use the -toption.

You can then pipe the output to lpr or save it to a file, which you convert for a specific printer.

 

man -t copy | lpr

 

You can save a man page to a file and print it when ever you need to. eg

man -t copy > copy.ps

will copu the man page to the file copy.ps

 

Summary

****************************

The UNIX online manual - also called the man pages - is an electronic collection of information about UNIX commands. Man pages are digital versions of the UNIX programmer's manual and are used to provide a quick reference to users on how to find help with UNIX commands.

Inless otherwise specified, you  navigate man pages using the default pager specified in the user's environment.

The apropos program enables users who don't know the name of the command they want to access to obtain help information on that command.The command searches for information by keywords and returns a list of relevant matches. In the absence of an apropos program, the man -k command performs a similar function. If you want to check whether a man page for a particular command is on the system, you can use the whatis command, which provides a narrower search.

Customizing the UNIX User Environment - Part 5 - Using the GNU info system - Part 1

Customizing the UNIX User Environment

**********************************************************************************

Using the GNU info system

********************************

Info system structure

------------------------

The info reader program allows you to read help documentation formatted using the texinfo system.

The info reader program is one of several open source system tools developed by the GNU project to replace proprietary UNIX software.

Most of the software developed as part of the GNU project is documented by using the texinfo system in texinfo files.

 

Texinfo files provide a single source from which to generate both online and print documentation

 

For programs produced by the GNU project, info pages may provide more complete documentation than man pages

To invoke the info system, you type info at the shell prompt and press Enter.

 

Each info page provides information in the form of nodes - or topics. Each node may have several child nodes, which describe subtopics of the node.

 

The titles of child nodes are listed in a menu with in the parent node, and you need to issue specific info commands to move to one of the child nodes.

 

If you want to move to the binary utilities node, for example, you press M to invoke the menu prompt.

Then you type binutils and you press Enter.

The binary utilities node opens. The info page contains a chain of Next and Previous pointers that provide a link between all the children of a parent node.

 

Any child node links to its parent node using the Up pointer.

Customizing the UNIX User Environment - Part 5 - Using the GNU info system - Part 2

Customizing the UNIX User Environment

**********************************************************************************

Using the GNU info system

********************************

Page layout and node navigation

---------------------------------------

The info program is a reader for documentation created using the texinfo system.

Info structures text into a hierarchical tree of nodes, with each node containing a description of a specific topic to a specific level of detail.

If you doct specify a node, the info page opens to the top menu of nides as shown here.

 

You can move around the info page using the SPacebar or Delete keys.

Depending on the type of terminal you're using, the Delete or Backspace keys allow you to move down the current page to view text that comes after the currently displayed screen.

 

The Spacebar key allows you to move up to viw text that comes before the currently displayed screen.

In this case, there's np text before the currently displayed screen, because this is the first and topmost screen.

 

The top line of a node acts as its header. The header consists of the following sections

-File

-Node

-Next

-Prev

-Up

 

The tile of the current topic is underlined and located below the header.

The title identifies the topic that's being descrbed in the node.

 

In addition to the title, a node contains a mode line, which identifies the node. The node line indicates how many lines the node contains and where you are within the node.

 

To move from one node to the next, you type n.

The header changes to reflect a differnt node.

In this case, the header has changed from the ar node to the nm node.

Of you are at the end of a node, you can also use the Spacebar key to move to the next node.

 

To return to a previous node, you type p.

The header changes to display the previos node. For example, whn you type p while in the nm node, the header changes from the nm node back to the ar node. You can also do this by using the Delete or Backspace key if you're at the beginning of a node.

If your keyboard has Page Up and Page Down keys, you can use them within a node instead of the Spacebar and Delete keys, but they won't open the next or previous node.

 

Let's say that you want to move up a level from the current node by pressing u.

You can also go back to the beginning of a code by pressing b.

 

The info page layout contains menus, which allow you to access other nodes. TO move to other nodes using a menu, you use the m option.

For example, to move to the objcopy node, you press M to invoke the minu prompt. Then you type objcopy and you press the Enter key.

Alternatively, you can place the cursor at the befinning of a menu item, in this case objcopy, and then press Enter.

 

The result shows the objcopy node open

 

The menu of a particular node is nirmally visible on the page.If there's no visible menu, that node does not have a menu and you may not issue the m option.

 

The info page may include cross nodes, which you reach through a cross-reference. A cross-reference is a footnote that points at nodes that belong to an isolated section within the structure.

As a result, these footnotes don't have leads to previous, next, or up topics. In this case, you need to use a specific command, such as f, to follow a specific reference, for example nodes associated with topics starting with the letter b.

 

The result in this case returns the BFD node.

 

The mode line - you can see how many lines a particular node contains and where you are within a node from the mode line.

The command line - is where you issue navigational commands to traverse the info system documentation. Note that not all commands may be available on all systems.

The Status line generally reflects the state of various keys - whether the numloclk, scroll lock, or insert mode is on or off, The status line is used for information only - you cannot write to it or update it.

 

You can invoke and use the info system from within an emacs text editor, which interprets the LISP programming language that supports text editing.

Emacs is a real-time display editor that allows you to edit file types, such as plain text, source code, and HTML files

 

Emacs includes complete online documentation. including a tutorial for new users. It can be customized and extended, and has self-documenting capabilities

 

Summary

---------------

The UNIX info reader program enables you to read help documentation formatted using the texinfo system. The info reader is designed to read texinfo fies, which contain documentation on most software developed as part of the GNU project.

When you invoke the Info system, it takes you to a pager environment where text is structured into a hierarhical tree of nodes. Each node contains a description of a specific topic to a specific level of detail. The info page opens to the top menu of nodes if you dont specify a node. You can use the Spacebar and Delete keys to navigare an info page.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Wednesday, July 23, 2014

Get all property names of javascript object

This is a tricky business and I believe I had tried this multiple times and ended using a work around. I had a javascript object in json notation and it had a lot of values encapsulated in it. To be specific it looked like the following

 

>> window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US")

{
       HSI B MAKATI PHILIPPINES : [object Object],
       HSI B HEREDIA COSTA RICA : [object Object],
       FSC-HEREDIA, COSTA RICA : [object Object],
       HSI QUEZON CITY PHILIPPINES : [object Object],
       CSSC-VENDOR-TELETECH, NOVA, PH : [object Object],
       HSI C HYDERABAD INDIA : [object Object],
       HSI C NOVALICHES PHILIPPINES : [object Object],
       EVRC . PASIG, PHILIPPINES : [object Object],
       HSI B TIJUANA MEXICO : [object Object],
       FSC-HYDERABAD,INDIA : [object Object]
}

All I wanted to do was get an array of the property names. Following attempts were futile. They either gave empty values or errors

>> x=window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US");x[0]

>> x=window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US");x(0)

>> x=window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US");x["0"]

>> window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US").properties

>> x=window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US");x[0]

>> x=window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US");x.length

>> x=window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US");x.size

>> x=window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US");x.size()

"Object doesn't support property or method 'size'"

 

Only Specific calls like the following with the property names worked. But this is no good to me as I cant always no all the properties present inside the object

>> x=window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US");x["FSC-HYDERABAD,INDIA"]

{
       Name : "FSC-Hyderabad,India",
       Description : "Refers to the Center corresponding to the code FSC-Hyderabad,India",
       Value : "AR",
       Type : "AGENT_CENTER_OUTSIDE_US"
}

 

At last the following attempts helped me

>> x=window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US"); for(y in x){y}

"FSC-HYDERABAD,INDIA"

>> x=window.top.getGlobalParamData("AGENT_CENTER_OUTSIDE_US"); for(y in x){console.log(y)}

LOG: HSI B MAKATI PHILIPPINES

LOG: HSI B HEREDIA COSTA RICA

LOG: FSC-HEREDIA, COSTA RICA

LOG: HSI QUEZON CITY PHILIPPINES

LOG: CSSC-VENDOR-TELETECH, NOVA, PH

LOG: HSI C HYDERABAD INDIA

LOG: HSI C NOVALICHES PHILIPPINES

LOG: EVRC . PASIG, PHILIPPINES

LOG: HSI B TIJUANA MEXICO

LOG: FSC-HYDERABAD,INDIA

 

Now I can construct my required array J

 

Hope this helps some one J