Friday, June 15, 2012

How to read PDF file in black background and green or white text

Most of the windows users use Adobe reader to read PDF files. But if you read a PDF file long time. your eyes may blur and pain because of the white colour background and the because of the high contrast and brightness. To get rid of this you can use Adobe Reader colour replace facilities to change the colour of the PDF File.


1. Go to Edit 

2. Go to Preferences.., Then Accessibility 

3. Change the Page Background and Document Text Colors

4. Press OK, close PDF and open again. Then It looks like this.

5. This may help to keep your eye cool when you are reading :)

Thursday, June 14, 2012

Market Orders (MKT)

Market Orders are the most basic order type of the share trading. If you need to buy or sell typical shares at the market, what you should do is submit a Market Order.

Market Order Flow

But if you expected to execute your order, Need to consider the current market price before you submit the market order. If your order successfully executed, then it call as "Order Filled". If your is related to buy some shares, after order filled these shares updated to your account and relevant amount of money reduce from your trading account. If your order is related to sell some shares, then after order filled reduce this number of shares from your account and update your account with relevant amount of money you received  by specific trading.

Most of the time submitted market orders valid within the whole day. After market closed for the specific day, all the so far not executed orders will be cancel and and notice to the order submitted users. If you think  share may goes up for some particulate counter,  you can submit sell orders with higher price that existing price of the market. If price goes up and reach to your submitted price, then there mat be possibility to fill your order. If you willing to buy shares and also you think market price goes down for some specific counter then you can submit buy order with less price then current existing price. If market reached your conditions, then your order may fill.

Partially Filled:
Some time market orders may reached to the price expectation but the numbers of shares not enough to full-fill the order. In this kind of situations, order execute for the existing number of shares and it call "Partially filled"

As example:

Kevin submit sell order with 2000 shares for $225 price for counter AAA
Jhon submit buy order with 900 shares for $225 price for counter AAA

So here buy order and sell orders are matching by price and quantities are not same. then order executed for 900 shares.
Kevin get notice "Order Partially filled for 900 shares at $225"
Jhon get notice "Order filled for $225"

Risk Management:
If you use brokerage to submit order to the share market, then they are doing some risk check before submit your orders the the market. This checks can be vary for country by county, market by market or brokerage by brokerage. fallowing are the some factors they are checking.

1. Trader having enough money to buy the shares.
2. Order quantity is less than to min quantity or higher than the max quantity  that can trade for specific counter.
3. Is this order accept the government regulations.
4. Is this market trading hours.

How to kill process running in a remote computer using command prompt

Windows servers maintaining is not a simple task and most of the time need to log in to servers and kill some running process and some time need to start the processes or applications. So this is a method to kill a process running on a remote computer using dos command in windows environment. You can use this method to kill a process in you local PC too. You can directly run this command in command prompt or also can run as saved bat file.

TASKKILL /S system /U username /P password /FI filter /PID processid or /IM imagename /F /T

Parameter List:
/S system Specifies the remote system to connect to.

/U [domain\]user Specifies the user context under which
the command should execute.

/P [password] Specifies the password for the given
user context. Prompts for input if omitted.

/F Specifies to forcefully terminate

/FI filter Displays a set of tasks that match a
given criteria specified by the filter.

/PID process id Specifies the PID of the process that
has to be terminated.

/IM image name Specifies the image name of the process
that has to be terminated. Wildcard '*'
can be used to specify all image names.

/T Tree kill: terminates the specified process
and any child processes which were started by it.

/? Displays this help/usage.

IMAGENAME eq, ne Image name
PID eq, ne, gt, lt, ge, le PID value
SESSION eq, ne, gt, lt, ge, le Session number.
CPUTIME eq, ne, gt, lt, ge, le CPU time in the format
of hh:mm:ss.
hh - hours,
mm - minutes, ss - seconds
MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB
USERNAME eq, ne User name in [domain\]user
MODULES eq, ne DLL name
SERVICES eq, ne Service name
WINDOWTITLE eq, ne Window title

NOTE: Wildcard '*' for the /IM switch is accepted only with filters.

NOTE: Termination of remote processes will always be done forcefully
irrespective of whether /F option is specified or not.

TASKKILL /S system /F /IM notepad.exe /T
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM notepad.exe /IM mspaint.exe
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"

Tuesday, June 12, 2012

Rounding floating point numbers

If you are an experienced programmer definitely you faced to issues with floating point rounding. Actually this is due to the values keeping format of the floating point data types. In simply float and double like data types storing the numbers in memory as powers. So the value return back may not be the exact value you stored at  the variable.

As example if you store 444.25 555.25 and  in float variable it the return back value may be

444.24999999999999 or 555.25000000000001

This happens because of the value storing format of the memory you can look in more information about value keeping structure here.

The Problem comes when you try to round the value you store in the float variable
As our example
If value store as 444.24999999999999 then round value will be 444.2 for one decimal point
If value store as 555.2500000000001 then round value will be the 555.3 for one decimal point.

So same kind of values get different kind of result when you round. If you like you can read more about this here

Ok, what we can do to avoid this rounding issue when you do programming with C++. fallowing is my proposed method to avoid the issue. Don't use the standers rounding functions and  use a own rounding function

#include <iostream>
#include <math.h>

using namespace std;

double flaotRound( double dblNumber,int intNoOfDecPoint  ){
 double dblTemp = pow(10.0,intNoOfDecPoint);
 return int(dblNumber*dblTemp + (dblNumber<0? -0.5 : 0.5))/dblTemp;

void main(){
 //char array for input (to pause programe)
 char chrTempInput[100];
 double dblValue;

 for(int i = 0; i <1000 ; i++){
  dblValue = (double)rand()/rand();
  cout << dblValue << " - " << flaotRound(dblValue,2) << endl;

 cin >> chrTempInput;

Monday, June 04, 2012

How to send a email using VB Script.

Some times requirements occurs to send email from Windows environment. it may be due to server monitoring or application monitoring purpose or may be some other need. Lot of third-party applications in the internet and you can try those your own. But most light weight and slandered way to send email from windows environment is the VB script. Using VB Script is very easy and simple. following is the way to send a email using VB Script. this can be help to your script development and system monitoring purpose.

Dim objMail

Set objMail = CreateObject("CDO.Message")

'sender email address
objMail.From = "Sender <>"

'Receiver email address
objMail.To = "Receiver <>"

'Email subject
objMail.Subject = "This is the testing email subject"

'Email Body
objMail.Textbody = "This is the my first email send by vb script"

'If you need to attache a file,can do in this way.
objMail.AddAttachment "C:\myphoto.jpg"

'Configure SMTP server
objMail.Configuration.Fields.Item _
    ("") = 2

'Here you should configure name or IP of the SMTP server
objMail.Configuration.Fields.Item _
    ("") = _

' SMTP port need to configure here (Default 25)
objMail.Configuration.Fields.Item _
    ("") = 25

'update the field in message object 

'sending email

'clear mail object
Set objMail=Nothing

'exit the script
Some times we need to check if a process is running in a remote server. For this purpose it can be log in using remote desktop or ant other third-party tool like team-viewer. but here problem is need to wast some time on this method. How if you can check the process status of the remote server from your PC? This is the way to achieve that.

windows provide a command "tasklist" to achieve this requirement. So fallowing is the technical description about this.

tasklist /s IPAddress /u username /p password /fi "USERNAME eq processUsername" 

  • IPAddress - IP Address of the remote computer
  • username - User name of the remote computer
  • password - password of the remote computer
  • processUsername - The process you need to monitor should under this user name (you can get user name from Task Manager of the remote computer) . If you no need to filter process by username, you can ignore  "/fi "USERNAME eq processUsername" part from the command

Full bat file

@echo off
echo processing, please wait...
tasklist /s IPAddress /u username /p password /fi "USERNAME eq processUsername"
echo ----------------------------------------------------------------------------

For more information you can go to this page

GTC Orderd (Good Till Cancelled)

IF you submit a order to today's typical market, It will expire after market closed (means after trading hours). But Some time traders need to continue this order from the next day market open. For this matter trader need to manually submit a new order with same information at next trading day and have to continue this until order execute. This is a time consuming and resource wasting matter.
After considering above requirement and to get rid of the effort that need to spend on the matter the GTC Order purposed.

GTC simply means Good Till Cancelled.

This order would not cancelled until the trader manually cancelled it. So as typical trading order, this doesn't expire after market closed. But most of the exchanges legally not support this kind of orders. But Trading brokers having some tricky methodology to implement this concept to there clients.
Most of the brokers allow clients to submit GTC orders to the brokerage and every day morning there systems take the responsibility to submit a dally order to exchange with same information. But client cannot trace the internal behaviour of the brokerage and the brokerage stem show it as a not-cancelled order to outside until client candled it. Every functionality encapsulate inside the brokerage systems, but actually everyday when market start brokerage systems submit a new order to represent clients GTC order.

Now you may think GTC orders never expired if trader would not cancelled it. But in actual case brokerage decide a expire time for the order. If trader wouldn't cancelled GTC order until the expire time, It will automatically expire and not submit to the market at next trading day. This expire time can be vary for brokerage to brokerage. Some brokerages pre decide expire date as seven days, fourteen days, thirty days from the order submit day. If order executed before expire or candled by the trader, It will process like normal order executed.