Pages

Tuesday, October 25, 2016

To compile casample of OIT in linux


Step by step to compile casample in linux

1  . Go to /sdk/samplecode/unix

/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/unix

So that casample.c is accessible like this

[sterin@sterin-lap unix]$ ls -l ../casample/unix/casample.c
-rwxr-xr-x. 1 sterin sterin 51753 May 26  2012 ../casample/unix/casample.c


It contains below files :


-rwxr-xr-x. 1 sterin sterin 6820 Jul 17  2012 configure
-rwxr-xr-x. 1 sterin sterin 1760 Mar 26 12:21 makefile
-rwxr-xr-x. 1 sterin sterin 4354 Jul  1  2010 README


2. Now export

export TECHINCLUDE=/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/common/
export TECHLIB=/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo/
 export SOURCE_APP_MAKE=/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/unix/
 export PATH=$PATH:/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/unix/:.
 make exsimple _plat=x86-64

Make sure that all the path end with "/"


3. make casample



Error I had :

A.   [sterin@sterin-lap unix]$ make casample
make: /bin/ksh: Command not found
make: *** [casample] Error 127

it is due to it is using /ksh , that was not available . After editing makefile . Error resolved



B.
make casample
/bin/sh: line 2: /opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/unixconfigure: No such file or directory
make: *** [casample] Error 127
[sterin@sterin-lap unix]$ export PATH=$PATH:/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/unix/:.
[sterin@sterin-lap unix]$ export SOURCE_APP_MAKE=/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/unix/


C.

[sterin@sterin-lap unix]$ make casample
Building for OS: Linux 3.6.7-4.fc16.x86_64
make[1]: Entering directory `/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/unix'
rm -f ../casample/unix/Linux3.6.7-4.fc16.x86_64/casample /opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo/casample
gcc -o ../casample/unix/Linux3.6.7-4.fc16.x86_64/casample ../casample/unix/casample.c   -I/usr/local/include -I/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/common   -m64 -w -D_LINUX64_SOURCE -DUNIX_64  -L/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo  -L/usr/local/lib -lm -lsc_da -lsc_ca -DUNIX   -Wl,-rpath-link,/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo,-rpath,'$ORIGIN'
/usr/bin/ld: warning: libstdc++.so.5, needed by /opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo/libsc_da.so, not found (try using -rpath or -rpath-link)




cp /opt/app/oit/lib/libstdc++.so.5  /opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo/

make casample
Building for OS: Linux 3.6.7-4.fc16.x86_64
make[1]: Entering directory `/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/unix'
rm -f ../casample/unix/Linux3.6.7-4.fc16.x86_64/casample /opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo/casample
gcc -o ../casample/unix/Linux3.6.7-4.fc16.x86_64/casample ../casample/unix/casample.c   -I/usr/local/include -I/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/common   -m64 -w -D_LINUX64_SOURCE -DUNIX_64  -L/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo  -L/usr/local/lib -lm -lsc_da -lsc_ca -DUNIX   -Wl,-rpath-link,/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo,-rpath,'$ORIGIN'
cp -f ../casample/unix/Linux3.6.7-4.fc16.x86_64/casample /opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo/casample

Binary 'casample' has been placed in /opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/demo and ../casample/unix/Linux3.6.7-4.fc16.x86_64/

make[1]: Leaving directory `/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/unix'


After the compilation



[sterin@sterin-lap unix]$ ls -l /opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/unix
total 28
-rwxr-xr-x. 1 sterin sterin 6820 Jul 17  2012 configure
drwxrwxr-x. 2 sterin sterin 4096 Mar 26 12:20 Linux3.6.7-4.fc16.x86_64
-rwxr-xr-x. 1 sterin sterin 1760 Mar 26 12:21 makefile
-rw-rw-r--. 1 sterin sterin  802 Mar 26 12:24 makefile.Linux3.6.7-4.fc16.x86_64
-rwxr-xr-x. 1 sterin sterin 4354 Jul  1  2010 README





sterin@sterin-lap unix]$ cd ../casample/unix/Linux3.6.7-4.fc16.x86_64/
[sterin@sterin-lap Linux3.6.7-4.fc16.x86_64]$ pwd
/opt/app/oit/840/ca-8-4-0-linux-x86-64/sdk/samplecode/casample/unix/Linux3.6.7-4.fc16.x86_64
[sterin@sterin-lap Linux3.6.7-4.fc16.x86_64]$ ls -l
total 20
-rwxrwxr-x. 1 sterin sterin 16878 Mar 26 12:24 casample



Copy other files from sdk/demo folder to work 

Friday, September 2, 2016

How to get my portfolio details from moneycontrol.com using python?



How to get my portfolio details from 

moneycontrol.com ?


Python web scraping from moneycontrol.com

Source code : 



Main Tasks


1. Getting login URL and parameters

2. Getting Portofolio details after login

3. Getting required data using BeautifulSoup 

module








2.




Code Snipet :
LOGIN_URL = "https://accounts.moneycontrol.com/login/index"

URL= 

"http://www.moneycontrol.com/bestportfolio/wealth-

management-tool/investments#port_top"


session_requests = requests.session()

# Create payload
payload = {
          'email' : USERNAME,
          'pwd' : PASSWORD ,
    }

result = session_requests.post(LOGIN_URL, data = payload)
newresult = session_requests.get("http://www.moneycontrol.com/bestportfolio/wealth-management-tool/investments#port_top")




3.
soup = bs4.BeautifulSoup(newresult.content,"lxml")

table = soup.find_all("div", "rightCont")


#print table
commodittTableRows = table[0].find_all("div")

cl = commodittTableRows[0].find_all("p")


for Bull
    ./newMoney.py
Net Worth is 118,445 ▲+72 (+0.06%)


For Bear


Net Worth is 118,212 ▼-161 (-0.14%)


Source code : 

https://github.com/sterin501/PythonScripts/blob/master/moneycontrol/moneyControlPortfolio.py

Friday, August 26, 2016

Installing Oracle VM server on Lenovo Thinkcentre


Installing Oracle VM server on Lenovo Thickcentre


if you are using ThickCentre M900 , Oracle VM server 8.4.2 should be installed .


Main Tasks


1. Creating Bootable USB
2. Copying extracted ISO file in Web server
3. Make MotherBoard Ready for Legacy Boot .






1. Creating Bootable USB
a.Download the Latest Oracle VM server ISO file .


b . Create Bootable USB by unetbootin.




2. Copying extracted ISO file in Web server




a.Extract the ISO file using standard tools

b. Copy the the extracted files to any webserver and 

patch should be accessible

Example : URL to access





































3. Make MotherBoard Ready for Legacy Boot .

a.Changing settings from UEFI to legacy

Example from Lenovo Thickcenter M900































4. Boot with USB


Select the Network drive ,during installation and 


provide the web server details which mention in the 


step 2  


























5 . Run like VM server 2.2





a. Edit /etc/xen/xend-config.sxp


    vi /etc/xen/xend-config.sxp


a.Uncomment
(network-script network-bridge)


b. make sure that below line is uncommented
(vif-script vif-bridge)


c. After Reboot brctl show  should show brigde network


  1. brctl show 




bridge name bridge id STP enabled interfaces

bond0 8000.4ccc6a3c3e52 no pbond0