Pages

Thursday, July 24, 2014

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