Search My Techie Guy

Tuesday, September 21, 2010

How to import data from a text file into Excel format

Sometimes you have data in a text file, and you wish to import it into Excel.
To confirm if your file is a text file, go to File > Properties... and click on the General tab. Make sure that the file type is Simple text file.
Next, you will need to see how Excel will figure out how to divide the data up into different cells (i.e., how the fields are delimited). Typically, each row of data is separated by a line return. Less standard is how the individual cells within a row (the column divisions) are separated. Ideally, there will be a standard character dividing the cells. For example, it might be a comma:
Another common division is a hidden character, such as a space or a tab:
0 0.000112 43.469381 -4.974215 -1.745804e-005 695.510095
1 0.000241 50.561808 -4.974215 -2.109513e-005 808.988924
2 0.000368 55.053678 -4.974215 -8.729019e-006 880.858848   
3 0.000491 57.304753 -4.974215 -5.819346e-006 916.876042
4 0.000614 61.313516 -4.974215 2.909673e-006 981.016249
Do not be concerned if all of the numbers that belong in the column do not line up vertically. Excel will be looking for the identified character to separate the cells.
Now that you know the characteristics of your text file, you can import it into Excel. Go to Excel and choose File>Open... and pick your text file. Excel will automatically recognize it as a text file and start the Import Wizard:

·         The option Delimited indicates a character, such as a comma or a tab, is used to separate the data fields. If there is no common delimiter, you can try and use the fixed width option.
·         If you do not want to start importing with the first row of the text file, you can indicate this under Start import at row: Note that it is all right to have your column headers as the first row you import.
·         Finally, you would typically want to indicate that the File origin is Windows (ANSI). This will help it decide what type of character is used to divide each row of data fields.
·         The Preview window will show you how your data is looking with these settings. Further windows in the Wizard will show the data in more finalized form.
Now click Next to go to the next window in the Wizard:

·         If you chose Delimited as an option on the previous window, you now get to choose what that delimiter is.
·         Here, a few standard Delimiters can be chosen from. If your file uses a different character, you can specify it under Other:.
·         If you have double commas, triple spaces, etc. delimiting your data fields, you can click on Treat consecutive delimiters as one.
·         Now the Preview window will show vertical lines replacing your delimiter and separating the data into columns. Scroll up and down your file to make sure it is properly separating the fields throughout the file.
Click Next when you are ready to go to the next window:

Here, you can choose how to format each column of data. If it is numeric data, you leave it in the General format. Later in Excel, you can fine tune this format, adjusting things such as the number of decimals to display or whether to show it in scientific notation. The format for each column is given at the top of the preview window. Notice the default it General for all columns.
Now choose Finish:

You'll now see the data placed in cells in an Excel spreadsheet. If you are happy with the result, save the file now in an Excel workbook with File>Save as....
If you are not happy with the result, close the file and start the process again. Things to remember to check for:
·         Is your file a raw text file and not a MS Word file?
·         Is the same character being used to separate all fields?
·         Have you successfully determined whether a blank space is a 'space' or a 'tab'? You can display the hidden characters by going to Tools>Preferences and choosing the View tab and clicking on All under Non-printing Characters. Tabs show in gray as right-pointing arrows.

Saturday, September 4, 2010

How to Edit the Environment PATH–Windows7

How to Edit the Environment PATH – Windows 7
Most of the time you find yourself in a situation where you have to add a PATH for your newly installed program to be able to run globally on your dos prompt. Take an example of the Erlang OTP installation, before you add the path to its binary directory “bin” you can’t run it from anywhere on the dos prompt:
To be able to achieve this, you need to add the PATH to your erlang binary onto your environment PATH so that the command “erl” can be visible from anywhere:
Step 1:
Find out the PATH to your erlang binary folder: C:\Program Files\erl5.6.5\bin\ and copy this path.
Step 2:
Start > Computer (right click) > Properties > Advanced System Settings >
Click - Environment Variables (bottom tab)

Step 3:
Select PATH and click edit,
In the “Variable Value”, append the PATH to erlang. Note that the PATHs are separated by a semicolon. Then click OK.
C:\Program Files\OpenVPN\bin;C:\Program Files\Google\google_appengine\;C:\Program Files\erl5.6.5\bin\

Click ok to close the open windows. You are now ready to run your erlang shell from any directory in your dos prompt.
Eshell V5.6.5 (abort with ^G)

Network Interface configuration-Unix (Solaris )

Configuring unix network interfaces often becomes challenging for the new sysadmins and new owners of unix systems . This post details the steps involved in setting up of Solaris network interfaces and can be used as a check list if you are already familiar with Solaris network configuration .#ifconfig command is used in Solaris to configure the network interfaces .

The following lines describes the activities needed to configure a freshly installed network card from the root prompt. 

1. Enable the network card
#ifconfig hme0 plumb

#ifconfig -a should now show the following output which means device is enabled and is ready to configure ip address and netmask :

hme0: flags=842<BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask 0
ether 3:22:11:6d:2e:1f

2. Configure ipaddress and netmask and bring the interface up
#ifconfig hme0 netmask up
#ifconfig -a will now show the ip address , netmask and UP status as follows :hme0: flags=843<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask ffffff00 broadcast
ether 3:22:11:6d:2e:1f

The file /etc/netmasks is used to define netmasks for ip addresses ., is the standard loop back  route and is the default loopback ipaddress used by the kernel  when no interface is configured this will be the only entry dispalyed by the system on invoking ifconfig -a command.

3. Configuring Virtual interface
A virtual interface can be configured to enable hme0  reply to more than one ip addresses. This is possible by using hme0 alias which can be configured by ifconfig command only . The new  alias device name now becomes hme0:1  hme:2 etc.

#ifconfig hme0:1 netmask up

#ifconfig -a will now show the original hme0 and alias interface :

hme0: flags=843<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask ffffff00 broadcast
ether 3:22:11:6d:2e:1f
hme0:1: flags=842<BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask ffff0000 broadcast
4. Ip-forwarding

IP forwarding allows you to forward all requests coming for a certain port or  URL to be redirected to a specified IP address.
ip forwarding becomes enabled automatically when the system detects more than one interface at boot time. The file involed is /etc/rc2.d/S69inet
ipforwarding is on by default but can be turned off by following command :

#ndd -set /dev/ip ip_forwarding 0
5. Default router Configuration
After interfaces and ipaddresses have been configured the system needs a default router to be able to talk to the world outside its local network .
You can specify a particular route for a particular address using the following command:

#route add -net -netmask 1

6. Speed of the NIC (Half/Full duplex)

Command to check the speed of your interfaces (Solaris 5.10)

# dladm show-dev

The ndd utility is used to examine and set kernel parameters, namely the TCP/IP drivers.
Most kernel parameters accessible through ndd can be adjusted without rebooting the system. To see which parameters are available for a particular driver, use the following ndd command:

#ndd /dev/ce \?

Here /dev/ce is the name of the driver and  command lists the parameters for this particular driver.  Use of backslash in front of "?"  prevents the shell from interpreting the question mark as a special character.
Using \? will list all parameters for the driver and indicate whether the parameter is read only or read and write. The current parameter value or status information can be read by specifying the driver and parameter names. Only the parameters marked as read and write can be changed.

#ndd -set /dev/ce adv_autoneg_cap 0

  configurable parameters include:

        adv_1000fdx_cap         1000Mbps full duplex
        adv_100fdx_cap          100Mpbs full duplex
        adv_100hdx_cap          100Mbps half duplex
        adv_10fdx_cap           10Mpbs full duplex
        adv_10hdx_cap           10Mpbs half duplex

For example, to prevent the device 'ce' from advertising gigabit capabilities, enter (as super-user):

# ndd -set /dev/ce adv_1000hdx_cap 0
# ndd -set /dev/ce adv_1000fdx_cap 0

All capabilities default to enabled. Note that changing any capability parameter causes the link to go down while the link partners renegotiate the link speed/duplex using the newly changed capabilities.
You can obtain the current parameters settings using 'ndd -get'. In addition, the driver exports the current state, speed, duplex setting, and working mode of the link via ndd parameters (which are read only and may not be changed).

For example, to check link state of device nge0:

# ndd -get /dev/nge0 link_status
# ndd -get /dev/nge0 link_speed
# ndd -get /dev/nge0 link_duplex
# ndd -get /dev/nge0 link_rx_pause
# ndd -get /dev/nge0 link_tx_pause
The output above indicates that the link is up and running at 100Mbps full-duplex with rx/tx direction pause capability turned on.

for more information on Solaris NIC speeds and duplex settings, and how to apply these changes and make them persistent - i really recommend this article, has nice and easy to read stuff;

Have fun :-)

Thursday, September 2, 2010

How to Enable Telnet on Windows 7

1. Go To Start Menu and select Control Panel

2. Click on Programs in control panel

3. Now click on “Turn Windows Features On or Off” under Programs and Features

4. Scroll down in displayed list and check Telnet Client and click on OK

That’s’ it, Once windows has completed installation process to you can start using Telnet client.