Tuesday, October 18, 2005
InstallSite: Windows Installer Merge Modules
Windows Installer Examples
The following sections present an example of authoring installation package for an application. An example of a minimal user interface for this sample is provided in the Platform SDK Components for Windows Installer Developers as the file Uisample.msi. If you have the SDK, you have access to all the tools and data necessary to reproduce this sample installation package and user interface.
For more information, see the following detailed examples:"
Tuesday, September 13, 2005
BhashaIndia.com :: Multilingual Application Development
.NET Data Access Architecture Guide :Drag-and-Drop Operations
Drag-and-Drop Operations and Clipboard Support
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbcondragdropclipboardsupport.asp
Architecture Guide is available at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daag.asp
Sunday, August 07, 2005
Thursday, August 04, 2005
HowTo: Drag and drop using VB .NET
Thursday, July 14, 2005
Tuesday, April 26, 2005
Saturday, February 26, 2005
Customizing RedHat Linux Kickstart Installation Cdrom
Friday, February 25, 2005
Linux Networking Configuration
Adding a network interface card (NIC):
Manual method: This does not alter the permanent configuration and will only configure support until the next reboot.
cd /lib/modules/2.2.5-15/net/ - Use kernel version for your system. This example uses 2.2.5-15 Here you will find the modules supported by your system. It can be permanently added to /etc/modules.conf (or for older systems: /etc/conf.modules) Example: alias eth0 3c59x
/sbin/insmod -v 3c59x (For a 3Com ethernet card)
ifconfig ...
The easy way: Red Hat versions 6.2 and later, ship with Kudzu, a device detection program which runs during system initialization. (/etc/rc.d/init.d/kudzu) This can detect a newly installed NIC and load the appropriate driver. Then use /usr/sbin/netconfig to configure the IP address and network settings. The configuration will be stored so that it will be utilized upon system boot.
Systems with two NIC cards: Typically two cards are used when connecting to two networks. In this case the device must be defined using one of three methods:
Use the GUI tool /usr/bin/netcfg
OR
Define network parameters in configuration files:
Define new device in file /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.10.12
NETMASK=255.255.255.0
GATEWAY=XXX.XXX.XXX.XXX
HOSTNAME=node-name.name-of-domain.com
DOMAIN=name-of-domain.com
Special routing information may be specified, if necessary, in the file: /etc/sysconfig/static-routes Example:
eth1 net XXX.XXX.XXX.0 netmask 255.255.255.0 gw XXX.XXX.XXX.XXX
OR
Define network parameters using Unix command line interface:
Define IP address: ifconfig eth0 XXX.XXX.XXX.XXX netmask 255.255.255.0 broadcast XXX.XXX.XXX.255
ifconfig eth1 192.168.10.12 netmask 255.255.255.0 broadcast 192.168.10.255
If necessary, define route with with the route command: Examples: route add default gw XXX.XXX.XXX.XXX dev eth0
route add -net XXX.XXX.XXX.0 netmask 255.255.255.0 gw XXX.XXX.XXX.XXX dev eth0
Where XXX.XXX.XXX.XXX is the gateway to the internet as defined by your ISP or network operator.
If a mistake is made just repeat the route command substituting "del" in place of "add".
Configuration files:
File: /etc/resolv.conf - resolver configuration file
search name-of-domain.com - Name of your domain or ISP's domain if using their name server
nameserver XXX.XXX.XXX.XXX - IP address of primary name server
nameserver XXX.XXX.XXX.XXX - IP address of secondary name server
This configures Linux so that it knows which DNS server will be resolving domain names into IP addresses. If using DHCP, this will automatically be sent to you by the ISP and loaded into this file as part of the DHCP protocol. If using a static IP address, ask the ISP or check another machine on your network.
File: /etc/hosts - locally resolve node names to IP addresses
127.0.0.1 your-node-name.your-domain.com localhost.localdomain localhost
XXX.XXX.XXX.XXX node-name
Note when adding hosts to this file, place the fully qualified name first. (It helps sendmail identify your server correctly) i.e.: XXX.XXX.XXX.XXX superserver.yolinux.com superserver
This informs Linux of local systems on the network which are not handled by the DNS server. (or for all systems in your LAN if you are not using DNS or NIS)
/etc/sysconfig/network
Red Hat network configuration file used by the system during the boot process.
/etc/nsswitch In the past this file has had the following names: /etc/nsswitch.conf, /etc/svc.conf, /etc/netsvc.conf, ... depending on the distribution.
File: /etc/nsswitch.conf - System Databases and Name Service Switch configuration file
hosts: files dns nisplus nis
This example tells Linux to first resolve a host name by looking at the local hosts file(/etc/hosts), then if the name is not found look to your DNS server as defined by /etc/resolv.conf and if not found there look to your NIS server.
File: /etc/sysconfig/network-scripts/ifcfg-eth0 Configuration settings for your first ethernet port (0). Your second port is eth1.
File: /etc/modules.conf (or for older systems: /etc/conf.modules)
Example statement for Intel ethernet card:
alias eth0 eepro100
Modules for other devices on the system will also be listed. This tells the kernel which device driver to use if configured as a loadable module. (default for Red Hat)
Network GUI Configuration Tools:
/usr/bin/redhat-config-network (/usr/bin/neat) (RH 7.2+)
/usr/bin/redhat-config-network-tui (text console RH 9.0)
/usr/sbin/netconfig (console. First interface only - eth0)
/usr/bin/netcfg (GUI) (no longer available with RH 7.2)
/usr/bin/redhat-control-network (Start/Stop network interfaces RH 9.0)
redhat-config-network-druid (Configure CIPE,Ethernet,modem,token Ring,Wireless or DSL)
/usr/bin/gnome-network-preferences Gnome Desktop Network Configuration (RH 9.0) - proxy configuration
The Red Hat configuration tools store the configuration information in the file /etc/sysconfig/network. They will also allow one to configure routing information.
File: /etc/sysconfig/network
Static IP address Configuration: (Configure gateway address)
NETWORKING=yes
HOSTNAME=my-hostname - Hostname is defined here and by command hostname
FORWARD_IPV4=true - True for NAT firewall gateways and linux routers. False for everyone else - desktops and servers.
GATEWAY="XXX.XXX.XXX.YYY" - Used if your network is connected to another network or the internet.
Static IP configuration. Gateway not defined here for DHCP.
OR for DHCP configuration:
NETWORKING=yes
HOSTNAME=my-hostname - Hostname is defined here and by command hostname
(Gateway is assigned by DHCP.)
File: /etc/sysconfig/network-scripts/ifcfg-eth0
Static IP address configuration:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=XXX.XXX.XXX.255
IPADDR=XXX.XXX.XXX.XXX
NETMASK=255.255.255.0
NETWORK=XXX.XXX.XXX.0
ONBOOT=yes
OR for DHCP configuration:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
(Used by script /etc/sysconfig/network-scripts/ifup to bring the various network interfaces on-line) To disable DHCP change BOOTPROTO=dhcp to BOOTPROTO=none
In order for updated information in any of these files to take effect, one must issue the command: service network restart
Changing the host name:
This is a three step process:
Issue the command: hostname new-host-name
Change network configuration file: /etc/sysconfig/network Edit entry: HOSTNAME=new-host-name
Restart systems which relied on the hostname (or reboot):
Restart network services: service network restart
Restart desktop:
Bring down system to console mode: init 3
Bring up X-Windows: init 5 One may also want to check the file /etc/hosts for an entry using the system name which allows the system to be self aware.
Usefull Linux networking commands:
/etc/rc.d/init.d/network start - command to start, restart or stop the network
netstat - Display connections, routing tables, stats etc
List externally connected processes: netstat -punta
List all connected processes: netstat -nap
Show network statistics: netstat -s
Kernel interface table info: netstat -a -i eth0
ping - send ICMP ECHO_REQUEST packets to network hosts. Use Cntl-C to stop ping.
traceroute - print the route packets take to network host
mtr - a network diagnostic tool - Like traceroute except it gives more network quality and network diagnostic info.
whois - Lookup a domain name in the internic whois database.
finger - Display information on a system user. i.e. finger user@host Uses $HOME/.plan and $HOME/.project user files. Often used by game developers. See http://finger.planetquake.com/
ipchains - IP firewall administration
tcpdump - dump traffic on a network
iptraf - Interactive Colorful IP LAN Monitor
socklist - Display list of open sockets, type, port, process id and the name of the process. Kill with fuser or kill.
nslookup - Give a host name and the command will return IP address. Also see Testing your DNS (YoLinux Tutorial) Note that nslookup does not use the /etc/hosts file.
host - Give a host name and the command will return IP address. Unlike nslookup, the host command will use both /etc/hosts as well as DNS.
nmap - Network exploration tool and security scanner
List pingable nodes on network: nmap -sP 192.168.0.0/24 Scans network for IP addresses 192.168.0.0 to 192.168.0.255 using ping.
Thursday, February 24, 2005
Using Grep - the Ultimate Filtering Tool
Command Syntax
grep [options] PATTERN [file....]
Grep searches the specified input FILE (or standard input is no files are specified, such as if you pipe something to grep) for lines that contain a match to the pattern. By default, the matches are printed to the screen. You can also encapsulate the pattern in quotes ("PATTERN").
Options
-a, --text : This option allows you to process a binary file as if it was a normal text file. This is equivalent to the --binary-files=text option.
-c, --count : Suppress the normal output. Instead print the number of matches found.
-h, --no-filename : Suppress the prefixing of filenames on output when multiple files are searched.
-i, --ignore-case : ignore case in the pattern and file names
-l, --files-with-matches : Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match.
Examples
Example: In this example we search the file called README.txt for lines that contain the word 'help'
grep "help" README.txt
Example: In this case, no file is specified. We will search the directory /etc for all files that contain the word "cron" in the filename.
ls /etc grep cron
Basically, what we just did is perform a directory listing, only displaying lines that contain "cron". Using the "" (pipe), the output from the ls command becomes the input for grep.
Advanced Grep Usage
Grep can also be piped multiple times. For example, the output of one grep command can be the input for the second one, and so on.
For example, we want to check the mail log for all emails that were sent from ernie@company.com. First we "cat" the maillog, which would output every line in the file to the screen. This is more information than we want, so we pass the output along to our first grep command. We search for all lines that contain "ernie". The -i option is used to ignore the case. So far, the syntax would be:
cat /var/log/maillog grep -i ernie
We are partially there. The result from this command outputs every line containing "ernie". But this also includes all places where ernie was the recipient as well as the sender. Next we filter out only the places where he was the sender:
cat /var/log/maillog grep -i ernie grep from
The output from this command lists all places in the mail log pertaining to ernie sending an email.
Josh's Example:
cat maillog grep "Dec 11" egrep "TO:<\w+@domain.com" -c
First I filtered out the maillog for entries of a certain day, then I filtered for entries:TO:ANYUSER@company.com
the -c command will only display the number of occurrences.
Linux Run-Levels
rc1.d - Single User Mode
rc2.d - Single User Mode with Networking
rc3.d - Multi-User Mode - boot up in text mode
rc4.d - Not yet Defined
rc5.d - Multi-User Mode - boot up in X Windows
rc6.d - Shutdown
Each mode has it's own list of settings for what services to start and what services to shutdown. Not only does this list contain what is supposed to be running, but also what order each service should be started in.
chkconfig - will list all the registered services and display thier status at each different run level.
Most of the time when your server boots up it will start in runlevel 3 or 5 depending on what it is set to. This setting can be found in the file /etc/inittab
If you ever want to change what mode your server defaults to on bootup, just edit that file, but NEVER change it to runlevel 6 or else you will set your server to shutdown on bootup.
RC.D Directory Explanation
In the folder: /etc/rc.d are all the run level folders starting from rc1.d to rc6.d and including init.d
It is in each of these rc#.d folders where the service run settings are kept. If you change directory into /etc/rc.d/rc3.d all the files that start with a capital S are the services that will start at this runlevel. All the files that start with a K are the services that will be killed at that runlevel.
The reason why services that are not supposed to run are still listed is because it is popular to switch a server from one run level to another instead of just booting into the needed run level. That way you can take your server offline (single user mode) and then apply a patch or do a file restore.
Let's take a closer look at these files that are inside the rc#.d folders. Notice that they are symbolic links to the script file located in /etc/rc.d/init.d This makes things very easy. All the commands to start, stop, or reload a service are handled by these scripts. So when a server is to go into a specific run level it can find the correct script and knows whether to start it based on its name and link path.
Switching Run Levels
init
Run levels are configured in /etc/inittab by lines like the following:
l2:2:wait:/etc/init.d/rc 2
The first field is an arbitrary label, the second one means that this applies for run level 2. The third field means that init should run the command in the fourth field once, when the run level is entered, and that init should wait for it to complete. The /etc/init.d/rc command runs whatever commands are necessary to start and stop services to enter run level 2.
The command in the fourth field does all the hard work of setting up a run level. It starts services that aren't already running, and stops services that shouldn't be running in the new run level any more. Exactly what the command is, and how run levels are configured, depends on the Linux distribution.
When init starts, it looks for a line in /etc/inittab that specifies the default run level:
id:2:initdefault:
You can ask init to go to a non-default run level at startup by giving the kernel a command line argument of single or emergency. Kernel command line arguments can be given via LILO, for example. This allows you to choose the single user mode (run level 1).
While the system is running, the telinit command can change the run level. When the run level is changed, init runs the relevant command from /etc/inittab.
The kernel, once it is loaded, finds init in sbin and executes it.
When init starts, it becomes the parent or grandparent of all of the processes that start up automatically on your Linux system. The first thing init does, is reading its initialization file, /etc/inittab. This instructs init to read an initial configuration script for the environment, which sets the path, starts swapping, checks the file systems, and so on. Basically, this step takes care of everything that your system needs to have done at system initialization: setting the clock, initializing serial ports and so forth.
Then init continues to read the /etc/inittab file, which describes how the system should be set up in each run level and sets the default run level. A run level is a configuration of processes. All UNIX-like systems can be run in different process configurations, such as the single user mode, which is referred to as run level 1 or run level S (or s). In this mode, only the system administrator can connect to the system. It is used to perform maintenance tasks without risks of damaging the system or user data. Naturally, in this configuration we don't need to offer user services, so they will all be disabled. Another run level is the reboot run level, or run level 6, which shuts down all running services according to the appropriate procedures and then restarts the system
Commonly, run level 3 is configured to be text mode on a Linux machine, and run level 5 initializes the graphical login and environment.
After having determined the default run level for your system, init starts all of the background processes necessary for the system to run by looking in the appropriate rc directory for that run level. init runs each of the kill scripts (their file names start with a K) with a stop parameter. It then runs all of the start scripts (their file names start with an S) in the appropriate run level directory so that all services and applications are started correctly. In fact, you can execute these same scripts manually after the system is finished booting with a command like /etc/rc.d/init.d/httpd stop or service httpd stop logged in as root, in this case stopping the web server.
None of the scripts that actually start and stop the services are located in /etc/rc.d/rc
Below a sample of /etc/rc5.d content, which lists the services started up in run level 5:
[jean@blub /etc/rc5.d] ls
K15httpd@ K45named@ S08ipchains@ S25netfs@ S85gpm@
K16rarpd@ K46radvd@ S08iptables@ S26apmd@ S90crond@
K20nfs@ K61ldap@ S09isdn@ S28autofs@ S90xfs@
K20rstatd@ K65identd@ S10network@ S30nscd@ S95anacron@
K20rusersd@ K74ntpd@ S12syslog@ S55sshd@ S95atd@
K20rwalld@ K74ypserv@ S13portmap@ S56rawdevices@ S97rhnsd@
K20rwhod@ K74ypxfrd@ S14nfslock@ S56xinetd@ S99local@
K25squid@ K89bcm5820@ S17keytable@ S60lpd@
K34yppasswdd@ S05kudzu@ S20random@ S80sendmail@
After init has progressed through the run levels to get to the default run level, the /etc/inittab script forks a getty process for each virtual console (login prompt in text mode). getty opens tty lines, sets their modes, prints the login prompt, gets the user's name, and then initiates a login process for that user. This allows users to authenticate themselves to the system and use it. By default, most systems offer 6 virtual consoles, but as you can see from the inittab file, this is configurable.
/etc/inittab can also tell init how it should handle a user pressing Ctrl+Alt+Delete at the console. As the system should be properly shut down and restarted rather than immediately power-cycled, init is told to execute the command /sbin/shutdown -t3 -r now, for instance, when a user hits those keys. In addition, /etc/inittab states what init should do in case of power failures, if your system has a UPS unit attached to it.
In run level 5, /etc/inittab runs a script called /etc/X11/prefdm. The prefdm script runs the preferred X display manager, based on the contents of the /etc/sysconfig/desktop directory. This is typically gdm if you run GNOME or kdm if you run KDE, but they can be mixed, and there's also the xdm that comes with a standard X installation.
The /etc/sysconfig directory contains entries for a range of functions and services, these are all read at boot time. This last part, however, might be somewhat different depending on your Linux distribution.
Besides the graphical user environment, a lot of other services may be started as well. But if all goes well, you should be looking at a login prompt or login screen when the boot process has finished.
Wednesday, February 16, 2005
Monday, February 14, 2005
Disable the close button on a Windows Form
CloseButtonRemove.vb
Option Explicit On
Option Strict On
Imports System.Runtime.InteropServices
Public Class CloseButtonRemove
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Integer, ByVal revert As Integer) As Integer
Private Declare Function GetMenuItemCount Lib "user32" (ByVal menu As Integer) As Integer
Private Declare Function RemoveMenu Lib "user32" (ByVal menu As Integer, ByVal position As Integer, ByVal flags As Integer) As Integer
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Integer) As Integer
Private Declare Function FormatMessageA Lib "kernel32" (ByVal flags As Integer, ByRef source As Object, ByVal messageID As Integer, ByVal languageID As Integer, ByVal buffer As String, ByVal size As Integer, ByRef arguments As Integer) As Integer
Private Const MF_BYPOSITION As Integer = &H400
Private Const MF_DISABLED As Integer = &H2
Private Sub New()
End Sub
Public Shared Sub Disable(ByVal form As System.Windows.Forms.Form)
' Get handle to system menu for the form provided.
Dim menu As Integer = GetSystemMenu(form.Handle.ToInt32, 0)
' Get number of items in this system menu.
Dim count As Integer = GetMenuItemCount(menu)
' Remove last item from system menu (last item should be ’Close’).
If RemoveMenu(menu, count - 1, MF_DISABLED Or MF_BYPOSITION) = 0 Then
Throw New Exception(FormatMessage(Err.LastDllError))
Else
' On success, force a redraw of the system menu.
If DrawMenuBar(form.Handle.ToInt32) = 0 Then
Throw New Exception(FormatMessage(Err.LastDllError))
End If
End If
End Sub
Public Shared Function FormatMessage(ByVal [error] As Integer) As String
Const FORMAT_MESSAGE_FROM_SYSTEM As Short = &H1000
Const LANG_NEUTRAL As Short = &H0
Dim buffer As String = Space(999)
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, [error], LANG_NEUTRAL, buffer, 999, 0)
buffer = Replace(Replace(buffer, Chr(13), ""), Chr(10), "")
Return buffer.Substring(0, buffer.IndexOf(Chr(0)))
End Function
End
Class
I've attempted to document the code fully so that it's easier to see what is going on. Also, bear in mind that most of the sample code floating around on the net doesn't take into account possible errors occuring doing this task in more of a brute force method. Based on the SDK documentation, I've added error checking where appropriate. Also, take note of the FormatMessage function that is included in this class. It may come in handy when your working with other Win32 Interop functions as it will (usually) return a string version of a numeric error value.
So, you might ask, what's the problem with this code? It does what was asked. Actually, it doesn't. The question was “How do I ***disable*** the close button?”; which would mean disabling the 'close' menu item as well... not deleting it from the menu.
The following code shows how to disable the close button according to the SDK documentation.
CloseButton.vb
Option Explicit On
Option Strict On
Public
Class CloseButton
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Integer, ByVal revert As Integer) As Integer
Private Declare Function EnableMenuItem Lib "user32" (ByVal menu As Integer, ByVal ideEnableItem As Integer, ByVal enable As Integer) As Integer
Private Const SC_CLOSE As Integer = &HF060
Private Const MF_BYCOMMAND As Integer = &H0
Private Const MF_GRAYED As Integer = &H1
Private Const MF_ENABLED As Integer = &H0
Private Sub New()
End Sub
Public Shared Sub Disable(ByVal form As System.Windows.Forms.Form)
' The return value specifies the previous state of the menu item (it is either
' MF_ENABLED or MF_GRAYED). 0xFFFFFFFF indicates that the menu item does not exist.
Select Case EnableMenuItem(GetSystemMenu(form.Handle.ToInt32, 0), SC_CLOSE, MF_BYCOMMAND Or MF_GRAYED)
Case MF_ENABLED
Case MF_GRAYED
Case &HFFFFFFFF
Throw New Exception("The Close menu item does not exist.")
Case Else
End Select
End Sub
End
Class
As you can see, we now only require two API declarations. Also, there are not LastDllError checks necessary in order to determine the error since our single call returns one of three values as described by the SDK documentation.
To use this code within your Windows Form application, just import one of the classes into your code and add the CloseButton.Disable(Me) line to your Form1_Load (as an example). For example:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CloseButton.Disable(Me)
End Sub
You will also need to add the following code to your form if you will be allowing the form to minimize or maximize:
Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
CloseButton.Disable(Me)
End Sub
.NET Streams Explained
.NET Streams Explained by Wei-Meng Lee -- On of the common challenges facing beginning .NET programmers is the large number of classes in the .NET Class Library. Looking for the correct class to use for file handling can be confusing. There are many classes in the System.IO namespace, each looking not much different from the others. Wei-Meng Lee explains the differences between the Stream classes.
Friday, February 11, 2005
NASA Brain Bites - Munchies For Your Mind
Thursday, February 10, 2005
Windows Forms FAQ
Here you can get all FAQs Regading Windows Forms, Controls and lot more stuff..Very useful contents for Developers
Wednesday, February 09, 2005
DataGrid: Tailor Your DataGrid Apps Using Table Style and Custom Column Style Objects -- MSDN Magazine, August 2003
Styling with the DataGridColumnStyle, Part 2
Demonstrates how to manipulate the appearance of the Windows Forms DataGrid control using custom column styles And some amazing thing.. Congrats to author
Customizing the Windows Forms DataGrid
This Link from MSDN demonstrates how easy it is to use the Windows Forms DataGrid in Microsoft Visual Studio .NET for basic display of tabular data on a form. In addition, a demonstration on how to customize the DataGrid's default behavior is included, allowing you more flexibility in how you can use the DataGrid.
Monday, February 07, 2005
Booting Linux using the Windows 2000 Boot Menu
First off, this tutorial is basically for people for whom GRUB/LILO don't work for some reason. Otherwise, GRUB/LILO are your best options for a dual boot system. Another situation where this info might be useful is if you've installed a UNIX that doesn't come with a boot loader and you need to boot it from hard disk (ie without a boot floppy).
Now, here are the steps you need to take:
1) When you install Linux, tell the installer to install LILO/GRUB into the first sector of the root partition and NOT the MBR. This is VERY important.
2) When you install the Linux system, be sure to make a boot floppy. Advanced users who know what they're doing can also use a rescue disk or any live distribution.
3) After you install Linux, boot your system using the boot floppy. You might have to change the boot sequence in the BIOS to get this to work.
4) Login to Linux as root and type in the following commands (Please note that the hash (#) is not part of the command. It's the bash prompt) :
i)# fdisk -l
This should bring up a list of partitions that looks something like this:
# fdisk -l
Disk /dev/hda: 255 heads, 63 sectors, 4865 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1436 11534638+ 7 HPFS/NTFS
/dev/hda2 1437 1956 4173435 c Win95 FAT32 (LBA)
/dev/hda3 1956 4865 23370007+ f Win95 Ext'd (LBA)
/dev/hda5 1956 3521 12574296 c Win95 FAT32 (LBA)
/dev/hda6 3522 4541 8193118+ 83 Linux
/dev/hda7 4542 4607 530113+ 82 Linux swap
/dev/hda8 4608 4865 2072353+ b Win95 FAT32
Now in my case, the Linux partition is /dev/hda6 . Take a note of which partition is your Linux partition and keep it in mind. Now, if you have one or more FAT32 partitions, follow the instructions immediately below. If you don't have a FAT32 partition, just NTFS ones, then you read the following section and look at the notes at the end of the tutorial for floppy users.
(ii) Now, I have a FAT32 partition at /dev/hda5 . Now, I'll mount the FAT32 partition so that I can transfer files from the Linux partition to the FAT32 one. For that, use the following commands, replacing /dev/hda5 with your FAT32 partition and /dev/hda7 with your linux partition.
quote:
# mkdir /mnt/hda5
# mount -t vfat /dev/hda5 /mnt/hda5
Now do an ls /mnt/hda5 to make sure that the partition has been mounted successfully. You should get a listing of all the files on that partition.
(iii) Now comes the interesting stuff. Type this in exactly as I've written here (substituting the appropriate drive names of course), otherwise you could mess up your system.
# dd if = /dev/hda7 of=/mnt/hda5/boot.lin bs=512 count=1
It should respond with
quote:
1+0 records in
1+0 records out
or something similar
(iv) Now, reboot your computer into Windows 2K/XP, log in as Administrator (or equivalent) , and open the run dialog and type in "notepad c:\boot.ini". If this doesn't work then you'll have to change the attributes of the boot.ini file to make it visible (not hidden). You should get a file that looks something like this:
quote:
[boot loader]
timeout=10
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOW
S
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
To the end of the file, add a line that says:
quote:
C:\boot.lin="Linux"
"Linux" can be replaced with anything you like (Mine says c:\boot.lnx="Slackware Linux 8.1"). Save the file and exit notepad.
Now, go to the FAT32 partition that has the boot.lin file and copy it to C:
That's it! Now reboot your computer and see the Win2K boot menu showing Linux as an option.
Note for people without a FAT32 partition:
Insert a DOS formatted floppy into your floppy drive and type in the following:
# mount /mnt/floppy
After you do this, just replace /dev/hda5/ with /mnt/floppy/ in all the commands.
Sunday, February 06, 2005
Basic Linux Commands
Type: pwd and press enter.
This program is "print working directory" which will print the full path to your current location in the shell.
Ex. /home/your account name
This is most likely the home directory of the user that you logged in as. Most of the things that you do will be here. Each user has a home directory which they own and have control over. Organize your files and directories here.
To see what is in your home directory type ls. This is the ls (list) program which lists the contents of the current directory.
You will probably see something like this:
Mail/ documents/ desktop/ etc.
The ls program accepts arguments which can give you more control over the display. By adding "arguments" you can specify certain behaviors. You can also call ls on a directory other then the one where you are currently located.
Some handy arguments are:
ls -a lists all files. Hidden files were previously unseen.
ls -l lists more information about all of the files.
ls -R lists files recursively which includes all subdirectories.
ls -X lists files alphabetically by their extension.
Type ls --help to find out more possibilities.
After you have messed around with your current directory for a while you probably want to venture off to somewhere else. This is easy, just use the cd (change directory) program. To move to a directory within your current directory simply type cd directory_name and you will move into it. To move back simply type cd ../ and you are back where you started. You can move directly to another directory by typing cd path_to_directory and you will go there.
Type: cd /usr/local/lib and you will move to that directory.
Type: cd ~ and you will move back into your home directory.
The tilde (~) character is your shortcut home.
Type cd --help and you will find that you have a lot of power with this simple program.
To look at the contents of a file you have several options. Two "quick and dirty" options are more and less. Type the program followed by the name of the file that you want to view. More lets you view the file from beginning to end. Less, allows you to scroll the file up and down. Both programs take q to quit.
The shell you are using is remembering the commands that you have been making. Use the up and down arrows to scroll through the commands that you have made. This is a real time saver. If you are trying to remember a command but have forgotten what it is called you can simply type the first few letters and press tab. You will get a listing of the available commands which start with those letters.
Wild cards are another great feature. "*" matches anything. If you are searching for a file which starts with the letter "t" you can type ls t* to get a listing of all files in the directory beginning with "t". Or, perhaps you want to list all .jpg files. Type ls *.jpg.
You can print the results to a file by typing ls *.jpg > mygraphics.txt. You can then append your .gif files to the list by typing ls *.gif >> mygraphics.txt
Note that > creates a file if it is not present, if the file is present it will over write it. >> appends an existing file or creates a new one if it does not exist.
Remember that you can type the full path for the file if you want to place it somewhere else.
Here are some other simple programs: (Take your time, learn one at a time and you will be proficient in no time.) If you find that a program creates a process that you want to stop press Ctrl-c to stop it.
touch filename - creates a new empty file with that filename.
rm filename - removes (deletes) filename.
mkdir dirname - creates a directory
rmdir dirname - removes a directory (must be empty or use "rm -rf dirname").
mv source destination - moves a file from source to destination
cp source destination - copys a file from source to destination
date - shows the current date and time.
Here are a few more complex programs which are extremely useful:
grep [options] pattern filename - this searches the file for the pattern and returns the results.
Ex grep -in date mydates.txt looks for "date" case insensitive and returns the line numbers and text of any matches.
find [path...] expression searches for files under the path which match the expression.
diff [options] file1 file2 reports the difference between two files.
ispell filename checks the spelling of the contents of a file and suggests replacements.
There are many programs included in most Linux distributions which can provide you with almost anything that you would ever need. You can scroll through the available commands by typing each letter and pressing tab. You will find hundreds of interesting commands. If you find something that seems to be interesting type command --help to find more information.
A few of special interest are:
tar a package and compression program
bzip2 another compression program
pico a simple text editor
vi a full blown text editor
pine an email client
free displays available system memory and usage
ping a tool for checking if a system is up and responding
netstat a tool for analyzing your network
telnet a program used for connecting to a remote host
And many others.
A great feature of Linux systems is that they contain their own manuals. Each command that you type into a shell is most likely a unique program. You do not have to wade through pages of a manual to find a specific feature, you can just ask each program directly. Although there is some variation, the following commands will likely help you find exactly what you are looking for.
To find help type: program_name --help
For example: ls --help will display the help file for the ls program.
To find more in depth information type: man program_name
For example: man ls will display the manual pages for the ls program.
To exit the man pages, type q (quit)
If TextInfo is installed you can type: info program_name
For example: info ls will give you comprehensive information.
Again, type q to quit TextInfo.
The vi (vim) Editor
Vim (Vi improved) is a very popular, full featured text editor for Linux/Unix systems. It is practically guaranteed to be installed on most systems. If you are using a Linux/Unix shell account, you will appreciate Vim's ability to open, edit, create, and save files. Unfortunately, Vim is not very intuitive. Most will remember the helpless feeling they had on their first encounter.
There are an astounding number of commands for Vim. Even advanced users only use a subset of the available commands. This tutorial will endeavor to teach you enough to be productive and point you in the right direction should you desire to learn more.
Vim operates from within a shell. All commands are made from the keyboard. There is no mouse support, no fancy GUI, and no hints appear on the screen.
To start Vim, simply type vi at the command line.
This will open Vim with a new document and give you some basic version information and a hint or two. As soon as you begin inserting text, the information will disappear.
A variation on this is to type vi filename which will open Vim with that file loaded.
This is where most people will get stuck. Right at the beginning with no idea of how to insert text, save a file, or even exit the program! It seems to be some sort of a cruel joke. Windows users may even resort to rebooting the system or crashing the shell. (Linux systems can run for years without rebooting, this is never a good option.)
Here are the most important commands that you need to know. Commands for saving, writing and exiting are available when you are not in insert mode and are in the form ":command". That is a colon followed by the command. To toggle from command mode to insert mode, press i to enter insert mode. Press the "Esc key" to get back to command mode..
To change to INSERT mode press i or "insert".
To change out of INSERT mode press "Esc".
To exit the program type: :q.
To exit without saving type: :q!.
To write your file type: :w.
To write a new file and name it, type: :w filename.
OK, that will get you started. You can now do the most important things that you would want to do with a text editor. You can now open, create, edit, and save files as well as start and exit the program. Whew...
Moving around within a document:
You will quickly notice that the arrow keys, and the "home" and "end" keys do just about what you would expect them to do. Some of the behavior, however, is not really what you are looking for. Notice that when you arrow up or down the cursor jumps to the carriage returns rather than the screen lines.
There are an over abundance of ways to move around a document. Most will require that you are not in insert mode. Get use to moving in and out of insert mode! Note that you can add a number before most commands to modify the command.
*Screen lines are different than lines terminated by a carriage return!
To move to the left type: h, Ctrl-H, "back space", or the left arrow key.
To move to the right type: l, "space key", or the right arrow key.
To move to the end of a line type: $ or "End".
To move to the beginning of a line type: 0 or ^.
To move to the first character in a screen line type: g0, or 0.
To move to the last character in a screen line type: g$, or $.
To move to the middle of a screen line type: gm.
To move to a character number (position) in a line type: num . (pipe symbol)
To move to the n-th occurrence of a character from the right type: num t char.
To move to the n-th occurrence of a character from the left type: num T char.
To move to the right a number of words type: num W.
To move to the left a number of words type: num B.
To move forward a number of sentences type: num ).
To move backward a number of sentences type: num (.
To move forward a number of paragraphs type: num }.
To move backward a number of paragraphs type: num {.
There are many more... This is a good start though.
To move down a line type: j.
To move up a line type: k.
To move down a screen line type: gj, or g[down_arrow].
To move up a screen line type: gk, or g[up_arrow].
To goto a specified line type: num G.
To goto a percentage of the document type: num %.
There are many more...
To scroll the screen down type: Ctrl-E.
To scroll the screen up type: Ctrl-Y.
Something More
n dd will delete n lines starting from the current cursor position.
n dw will delete n words at the right side of the cursor.
x will delete the character on which the cursor is positioned
:n moves to line n of the file.
:w will save (write) the file
:q will exit the editor.
:q! forces the exit when you want to quit a file containing unsaved changes.
:wq will save and exit
:w newfile will save the text to newfile.
:wq! overrides read-only permission (if you have the permission to override permissions, for instance when you are using the root account.
/astring will search the string in the file and position the cursor on the first match below its position.
/ will perform the same search again, moving the cursor to the next match.
:1, $s/word/anotherword/g will replace word with anotherword throughout the file.
yy will copy a block of text.
n p will paste it n times.
:recover will recover a file after an unexpected interruption
Linux Directory Structure
One of the best ways to come to terms with a new operating system is to get familiar with the way that the system organizes its files. Files are usually stored in directories which are arranged in a hierarchal tree structure. This is commonly called the directory structure.
Here is an example of a common Linux directory structure . This should look similar to what you would see with most other visual operating systems.
/
- bin
- boot
- dev
- etc
- home
- lib
- lost+found
- mnt
- opt
- proc
- root
- sbin
- tmp
- usr
- var
Linux uses "The Filesystem Hierarchy Standard". There will be slight variations but a lot of what you see here is common to many Unix-based systems. Most Linux distributions such as Red Hat, Mandrake, Suse, Debian, etc, use this file system, or at least something very close to it. It should be noted, you can build your own Linux system any way that you want (Free software by definition). There is no strict requirement that you use any particular structure, however, other users will have difficulty using your system and it could turn into a maintenance nightmare very quickly.
Some of the directories shown here will be of little interest to many Linux users. For most users, other then root, their primary concern will be their home directory which can be structured any way that is convenient.
Windows users will notice that there are no hard drive distinctions. The directory structure shown actually represents a system which has 3 hard drives. With Unix-based systems, drives are not shown. File systems are mounted to particular drives but for the user, the actual implementation is transparent. This approach allows files to be presented to the user in a more centralized view even though the files may actually be spread out among several hard drives and partitions. The result is better security and protection against system crashes and data loss.
Lets take a look at each directory and what it is used for:
"/" This is a mandatory directory. It is the beginning of the filesystem and includes all of the directories beneath it. If you type cd / and then ls you will see a listing of all directories on the system (That you have permission to see). This should be similar to the graphic above.
/bin This is a mandatory directory. This directory contains the binaries that are used in single-user systems. For multi-user systems these binaries are usually stored in the /usr/bin directory. When you type a command such as ls or chmod it is usually directed to one of these two directories where the program exists.
/boot This is a mandatory directory. This directory stores the files which are used for the system startup except for the configuration and map installer. Frequently the kernel is stored here especially if more then one kernel is installed.
/dev This is a mandatory directory. The device files, sockets, and named pipes are stored here.
/etc This is a mandatory directory. This directory, pronounced "et-see", holds the configuration files for the system. It is divided into many subdirectories.
/home This is an optional but widely used directory. The other variation on the /home directory is to use a subdirectory in the /var directory. This is where users will do most of their work. Each user is given their own directory in the /home directory which is theirs to organize and use as they choose. Frequently web server document roots are located in the /home directory. (ex. /home/public_html or /home/www/public_html) The /home directory is designed to host dynamically changing files and usually occupies one of the larger partitions on a hard disk.
/lib This is a mandatory directory. Shared libraries needed at bootup or which need to be run by top level commands are stored here. Libraries which support users are usually stored in the /usr/lib directory.
/mnt This is an optional but very popular directory. This directory contains mount points for external storage devices. To access a floppy disk drive you cd to mnt/floppy. Once an external drive is accessed, its file system is mounted to the host system in the /mnt directory.
/opt This is an optional directory. It is a directory intended to contain software packages which are added to the original system. On my system it is present, but empty.
/proc This is an optional but widely used directory. It contains a virtual filesystem which is created and used by the currently running kernel. It is deleted when the system is shut down. Frequently, monitoring programs use the /proc directory to obtain information on currently running processes and other environmental information.
/root This is an optional but widely used directory. It is often created to eliminate clutter from the "/" directory. It contains configuration files for the root user.
/sbin This is a mandatory directory. This directory was originally a place to store static binaries. It has been expanded to include administrative binaries which are used by the root user only.
/tmp This is a mandatory directory. This directory is used by programs to store temporary files. Files which are located here are often flushed on reboot or flushed periodically.
/usr This is a mandatory directory. The /usr directory is designed to store static, sharable, read-only data. Programs which are used by all users are frequently stored here. Data which results from these programs is usually stored elsewhere (often /var).
/var This is a mandatory directory. This directory stores variable data like logs, mail, and process specific files. Most, but not all, subdirectories and files in the /var directory are shared. This is another popular location for web server document roots.
Thursday, February 03, 2005
White Paper Library
This is exclusive site for white papers regardig data mining, ware housing , Data analysis, Knowledge Harvesting etc... Special site for theoretical geeks..
Tuesday, February 01, 2005
BIOS Beep Codes
Maintenance tips for Bike
2) Always use correct recommended grade of engine oil as recommended in OWNERS MANUAL.
3) Ensure that the oil is in sufficient quantity as recommended. Check with dipsitck or inspection window or bleed-plug nut.
4) Ensure correct air pressure in tyres as recommended in OWNERS MANUAL
5) Check cables regularly for kinks, bends and frayed ends. Especially check ends. If one or more strands appears broken, replace immediately. Don't try to save money by ignoring it till later time. If cable breaks during journey, OPPORTUNITY LOSS will be far greater than cost of new cable. Also lubricate annular space between cable inner and outer, by holding one end and letting cable hang vertically and letting lubricating oil drip into annular space.
6) Ensure chain tightening. There is a chain tensioner on both sides of the rear axle having graduations. Ensure that the matching marks are equal on both sides. You have to loosen the axle nut before tightening or loosening the chain. Keep chain play at @ 12 mm (you can do this by moving chain up & down with a long nosed pliers thru inspection window in chain cover), or as recommended in OWNERS MANUAL.
7) Check all bulbs. Replace fused ones.
8) Check wiring for worn insulation and loose connections.
9) Check brake liners. If the brake tightening nut has gone up to the maximum threads, or the brake makes a metallic sound then it means that the liners are worn out. Replace them.
10) Ensure that front fork is not leaking. If it is, replace oil seals.
11) Keep carburettor clean. Every 1500 km, clean out the carburettor float chamber and other parts. Clean jets by forcing compressed air thru them.Ensure that float is not punctured and float-pin is not jamming. There should be free play of the float around its hinge in the chamber.
12) Clean the drive chain from time to time. To do this remove the chain and soak it in a tin can full of kerosene oil. Then take an old used tooth-brush and clean the chain. Then wash it again with fresh kerosene (or diesel) and hang it to dry for a few hours (overnight). After dry, soak it for 10 minutes in the thickest oil you can find (fresh oil), such as SAE 50 or even more thick, and agitate it while immersed in the oil. Now again hang the chain again vertically for a few hours and then fit back.
13) Check whether spokes are tight. If loose, tighten. Also check if any of the spokes are bent. If bent, fit new spoke. Do not try to straighten old spoke. It does not work.
14) Check tyres for wear and tear and cracks. Replace if worn. Also replace if there are cracks. This is most important in rainy season. It can save your life.
15) A lot of people complain about "average". The most common reason for poor average is leaking fuel cock or cracked fuel pipe (plastic or rubber one). If cock is leaking, replace fibre washer in it (costs only a few paise). If pipe is cracked, fit new one. The thick black rubber pipe used in Indo-Jap bikes is best.
16) Check entire fuel line, right from where it comes out of the tank, the fitting of the fuel cock, fuel filter, the plastic or rubber pipes etc. touch each spot with your clean, dry fingers. If there is any leak, it will show on your fingers. Also smell your fingers. If you can get petrol smell, then there is a leak.
17) On the fuel tank cap there is a small hole called a breather hole. Make sure that hole is open always. If choked, it can be made open by poking with a needle.
18) Ensure that there is split pin always on the front and rear axle bolts.
19) Keep both brakes properly spaced. Keeping them too tight (too urgent), or too loose (too late) is dangerous. Each person has a distinct style of braking. Ensure that brakes are tightened as per YOUR personal style and requirement.
20) Always ensure that your tax is paid and Insurance cover (Insurance policy) is within validity period. Keep Tax Receipt and Insurance policy at home and keep xerox copy in bike.
Thursday, January 27, 2005
Getting Started Crystal Reports for Visual Studio .NET
Crystal Reports for Visual Studio .NET is the standard reporting tool for Visual Studio .NET; it brings the ability to create interactive, presentation-quality content — which has been the strength of Crystal Reports for years — to the .NET platform.
With Crystal Reports for Visual Studio .NET, you can host reports on Web and Windows platforms and publish Crystal reports as Report Web Services on a Web server.
Wednesday, January 26, 2005
Microsoft QuickStart Tutorials : Windows Forms
The Windows Forms QuickStart is a series of Windows Forms samples and supporting commentary designed to quickly acquaint you with the programming model, architecture, and power of Windows Forms. The QuickStart samples are designed to be short, easy-to-understand illustrations of many of the features of Windows Forms. By the time you have completed the QuickStart tutorial, you will be able to build fully-functioning Windows Forms applications
Tuesday, January 25, 2005
Monday, January 24, 2005
What Makes A Tubeless Tyre?
Hydrabadi Dum Biryani
Note: All ingredient quantities are ap prox.
Ingredients
For the Rice
2 cups of basmati rice
3.5 cup water
2-3 tsp. Ghee
3 cardamom
3 cloves
1’’ cinnamon
1 bay leaf
1 tsp shahjeera
For the Chicken:
500g chicken
3 Onion – finely sliced
2 Tomatoes – finely chopped
1/2 bunch coriander (clinatro) leaves –finely chopped
1/2 bunch mint leaves – finely chopped
Whole garam masala for the chicken:
3 cloves1’’ cinnamon3 cardamom
To be ground to a paste --- (1):
12 red chillies2 tsp. Fennel (saunf)2 tbsp. Coriander seeds2 tsp. Khus-khus1 pod garlic2’’ ginger
To be ground to a paste --- (2)
1/2 cup coconut1/2 cup curds3 tsp chopped cashew nut3 tsp raisinsA pinch of saffron
Method for Rice
Heat ghee, add bay leaf, followed by the whole garam masala.
Fry it. Add rice and stir it for a minute.
Add water and salt to taste.
Cook the rice till done.
Method for Chicken:
Heat oil, add whole garam masala. Fry it.
Add the sliced onion and fry till dark brown.
Add the ground paste (1) and fry for 2-3 min.
Add tomatoes and fry till oil separates.
Add chicken mix well. Add coriander and mint leaves.
Add salt and cook till done.
Add the ground paste (2) and cook for 2 minutes.
Divide the cooked rice into 3 parts and chicken into 2 parts.
Arrange in layers i.e. put rice at the bottom then a layer of chicken and so on.
Dissolve saffron in 1/4 cup milk. Pour over arranged biryani.
Garnish with raisins, cashew nuts.
Put a lid and pack it with aluminum foil.
Keep over low flame for 15-20 min before serving.
Sunday, January 23, 2005
Fedora: The Flexible Extensible Digital Object Repository Architecture
The Fedora™ Project (http://www.fedora.info), a collaboration between Cornell University and University of Virginia , has developed an open-source digital repository management system. This project is result of a significant research investment beginning at Cornell in 1998. Release 1.0 was made available to the public as open source to the public in May 2003.
Friday, January 21, 2005
E-Journals Consortium initiative in India
University Grants Commission (UGC) has initiated a programme to provide electronic access over the Internet to scholarly literature in all areas of learning to the university sector in India. The programme is wholly funded by the UGC
How To Use the Picture Box in a UserControl and in a DataRepeater Control
This article demonstrates how to display a picture from a database in a picture box in a UserControl and in the Microsoft DataRepeater control.
Drawing Your Own Controls Using GDI+
Details development of a data-bound, owner-drawn control using GDI+ as one of series of Microsoft Windows control development samples to be read in conjunction with an associated overview article.
VB.NET no longer supports VB 6 Control Arrays Here's what you can do about it
VB.NET no longer supports VB 6 Control Arrays
Here's what you can do about it.
DSpace Federation
DSpace is a groundbreaking digital library system that captures, stores, indexes, preserves and redistributes the intellectual output of a university’s research faculty in digital formats.
Developed jointly by MIT Libraries and Hewlett-Packard (HP), DSpace is now freely available to research institutions worldwide as an open source system that can be customized and extended.
SQL - Structured Query Language
A complete self paced tutorial which takes you through all the important elements of SQL up to and including sub-queries and correlation