Saturday 30 June 2012

Creating new Profile in WAS





Creating and configuring Profile in WAS server with SCA Support


  1.  First go to windows -> preferences

  2.  

  3.  Then Click on Server -> WebSphere Application Server


  4.  Click on Run Profile Management Tool and select yes in the pop up box.You will get this window(If they above process doesn’t work,then go to C:\Program Files(x86)\IBM\SDP\runtimes\base_v7\bin\ProfileManagement and click on pmt.bat)


  5.  Click on Launch Profile Management Tool. You will get the window shown below.


  6.  Click on Create and Select Application Server and click on next.Again click on next.
  7.  Uncheck the Enable Administrative Security(IF U DON'T WANT LOGIN USERNAME AND PASSWORD) and click on next.


  8.  Click on create -> Finish and the new profile with AppSrv02 is created.
  9.  Select the newly created profile and click on Augment 


  10.  Add one by one all augments (Application Server with Feature Pack SCA must be included otherwise it won’t support SCA)


If you have any other problem in configuring WAS,feel free to ask or mail me @ adiadidas9000[at]gmail.com



Sunday 3 June 2012

DOS Tricks in JAVA

One of the most important DOS command is tasklist command.We can perceive this command in many ways.

"tasklist" is a DOS command that displays the running processes in the Windows OS.It displays all the applications and services running with their PID(process ID).


Syntax

tasklist[.exe] [/s computer] [/u domain\user [/p password]] [/fo {TABLE|LIST|CSV}] [/nh] [/fi FilterName [/fi FilterName2 [ ... ]]] [/m [ModuleName] | /svc | /v]

ParametersUses
/S systemSpecifies the remote system to connect to.
/U [domain\]userSpecifies the user context under which the command should execute.
/P [password]Specifies the password for the given user context. Prompts for input if omitted.
/M [module]Lists all tasks currently using the given exe/dll name. If the module name is not specified all loaded modules are displayed.
/SVCDisplays services hosted in each process.
/VDisplays verbose task information.
/FI filterDisplays a set of tasks that match a given criteria specified by the filter.
/FO formatSpecifies the output format. Valid values: "TABLE", "LIST", "CSV".
/NHSpecifies that the "Column Header" should not be displayed in the output. Valid only for "TABLE" and "CSV" formats.


Filters
Filter NameValid OperatorsValid values
STATUSeq, neRUNNING | NOT RESPONDING | UNKNOWN
IMAGENAMEeq, neImage name
PIDeq, ne, gt, lt, ge, lePID value
SESSIONeq, ne, gt, lt, ge, leSession number
SESSIONNAMEeq, neSession name
CPUTIMEeq, ne, gt, lt, ge, leCPU time in the format of hh:mm:ss.hh - hours,mm - minutesss - seconds
MEMUSAGEeq, ne, gt, lt, ge, leMemory usage in KB
USERNAMEeq, neUser name in [domain\]user format
SERVICESeq, neService name
WINDOWTITLEeq, neWindow title

MODULES

eq, ne

DLL name

 


Now let us see how we can make utilization of this command with the help of some examples:-

  •  tasklist /s Computer
tasklist /s
Process info of local/remote System
  • tasklist -v
  • tasklist -fi
tasklist -fi
Filter Result of tasklist
  • tasklist -v -fi "ImageName eq VLC.exe" /fo csv
To get VLC Windows Title


CODE SNIPPET to get current sound Track name in VLC


public String CallMe()
{
  Runtime runtime = Runtime.getRuntime();
           String cmds[] = {"cmd", "/c", "tasklist","/v","/fi","ImageName eq VLC.exe","/fo","CSV"};
           Process proc;
           String val = null;
try {
proc = runtime.exec(cmds);
           InputStream inputstream = proc.getInputStream();
           InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
           BufferedReader bufferedreader = new BufferedReader(inputstreamreader);
           String line;
           int count = 0;
while ((line = bufferedreader.readLine()) != null) {
   if(count==1)
   {
   String[] a = line.split(",");
val = a[9];
   }
   count++;
   }
} catch (IOException e) {
e.printStackTrace();
}
return val;
}


This can be used to set curent soundtrack as your GTalk status by using SMACK api to communicate with GOOGLE.
This will be explained in more depth in my next Blog.