Configuring IP address in Windows through command line

IP address can be configured through command line using following command

Static IP

netsh interface ip set address <interface name> static <IP address> <Netmask> <Gateway> <Metric>

The name of the interface may be “Local Area Connection” ; an example

netsh interface ip set address “Local Area Connection” static 172.16.1.10 255.255.255.0 172.16.1.1 1

List of interface can be get using command

netsh interface ip show interface

Dynamic IP through DHCP

netsh interface ip set address <interface name> dhcp

DNS

netsh int ip set dns <interface name> static <IP address> primary 

Advertisements
Posted in Uncategorized, Windows | Leave a comment

Some Oracle Errors & their simple solutions

Encountered some of oracle errors which were too trivial to solve though the error message does not elaborate. Please note that these are not the only solution, but I faced the problem and the solution was too trivial and not well understood by the error message

  • ORA-01747: invalid user.table.column, table.column, or column specification

Solution : The error is raised when by mistake an extra ‘,’ (comma) is left in update or insert query like

insert into table1 (f1, f2, f3 ,) values (val1, val2, val3);   — Note an extra ‘,’ at the end of f3

update table1 f1 = val1, f2 = val2, f3 = val3,;   — Note an extra ‘,’ at the end of f3

  •  ORA-00907: missing right parenthesis

When using distinct with more than one field if you put the fields in bracket the error may come

select distinct (field1) from table1;           — No Error

select distinct (field1, field2) from table1;   — Error as above

select distinct field1, field2 from table1;   — No Error

  • Expdp failing with error open failed

Check that permission are in place for the user who is exporting / importing

grant create session, create table, create procedure exp_full_database, imp_full_database to <user>

Posted in Database, Oracle | Leave a comment

Enabling Fill and Drag in MS Excel 2007+

MS Excel has feature where one can drag a cell and fill the series/formula to other cell. The feature I found to be quite useful. For example you can put a date 01/01/2013 in a cell and drag it to fill the rest of the days as in the year.

However I observed that on installing MS Excel 2007 the option was not present and was disabled by default. Its not clear why such an useful functionality is disabled by default. Anyway if one needs to enable it follow the following step

Select the Customize option from the Quick-Access bar which is normally located above the ribbon alongside the Excel Button on the left hand-top of  Excel (Normally you will have shortcut for save-undo-redo in the Quick Access Bar).

Select Customize -> More Commands -> Advanced -> Check “Enable fill handle and cell-drag and drop”

That’s all you need to do to enable this useful feature. Previous option of MS-Excel have this option under Tools -> Option

 

Posted in Compu, Excel, Office, Windows | Tagged | Leave a comment

How to change Cache location for Java on windows 7

One would like to change the cache location of Java, which has a default size limit of 1000MB, to save space on system drive.  By default the setting is per user, so it can take quite a lot of space on the system drive, depending upon the java usage and number of users.

On windows XP, Java cache location can be changed though java control panel which can be accessed

    control panel >> Java >> General >> Setting >> Location

But this setting change is missing in Wind0ws 7 through the control panel, in which the above mentioned location is greyed out. To get the desired any of the following method can be used.

Method 1 : Locate javacpl.exe in the java installation directory, and in the

   properties >> compatibility >> Choose run this program in compatibility mode for “Windows XP SP3”

The above change would enable the location change setting in the Java control panel, and then you can change the cache location.

Method 2: Java configuration properties can be changed by making changes in file “deployment.properties” which is normally located at

%SYSTEMDRIVE%\Users\%USERNAME%\AppData\LocalLow\Sun\Java\Deployment

Change(or add if not there) the property  “deployment.user.cachedir” and set it to the desired cache location. Make sure that you escape all the ‘\’ and ‘:’ with ‘\’ in the directory name of the cache location. For Ex if you would like to set the cache to E:\Temp\Java\Cache set the value as

deployment.user.cachedir=E\:\\Temp\\Java\\Cache

Also make sure that java control panel is not open while you are making changes as it would over-write the setting to the one with which its started.

The change needs to be done per user. There are more properties which can be changed by making changes in the “deployment.properties” file, for the list of same please refer to the following url

http://download.oracle.com/javase/6/docs/technotes/guides/deployment/deployment-guide/properties.html

Note : By default the “AppData” folder is hidden and would not be visible when you are opening using explorer. One way is to select  on explorer

 Tool >> View >> Show hidden files…

or else you can open the file directory by using open on your editor and giving following path

%SYSTEMDRIVE%\Users\%USERNAME%\AppData\LocalLow\Sun\Java\Deployment\deployment.properties

Thats all.

Posted in Compu | Tagged | 7 Comments

Auto-login in SSH and SCP

SSH is secured alternative to telnet. Unlike telnet, ssh packets are transmitted encrypted.  On the same line SCP, copies files from one destination to another, securely. Source(Destination) can be over network also.

Auto-login for the telnet can be done using ‘expect’, which require expect package also a little bit knowledge of shell scripting. On the other hand, SSH provides a more cleaner approach for auto-login. Keys are exchanged(stored) between the hosts enabling auto-login.

To elaborate the steps, consider user(user1) on machine1  wants to do auto login as a user(user2) on machine2. Perform following step on the respective machine. On machine1, give the following commands

  • user1@machine1>> ssh-keygen -t rsa

The above command would generate id_rsa and id_rsa.pub in $HOME/.ssh directory(default). Transfer the generated id_rsa.pub file to machine2 , using ftp or scp.

  • user2@machine2>> cat id_rsa.pub >> .ssh/authorized_keys
  • user2@machine2>> chmod 600 .ssh/authorized_keys

Thats all, you are done.

Note : Please make sure that the home directory of the user2 is not writable by any one else (permission of 755)

now when you do a ssh to user2@machine2 from user1@machine1, you would not be asked any password. Even “SCP” would work with out any password.  As an shortcut you can define alias for the ssh for machine2 in .profile, like

alias machine2=”user2@<machine2 ip >”

and when you give machine2 on the shell, you would directly ssh to the machine2.  As an description of what is going on under the hood, private key of user1@machine1 is stored as authorized in user2@machine2. So for authorization; keys are used instead of password.

Posted in Compu | Tagged | Leave a comment

Hello world!

Created blog to put my thoughts on random issues. And as the name suggest the view are the way i see things.

For a brief introduction, i am a YASW (Yet-Another-Software Engineer). The name was used by one of my friends and i liked it instantly.

That’s all for a first post.

Posted in Uncategorized | Leave a comment