They're RADICALLY different.
<memory.h> includes <mem.h>, while
<memory> includes <memory.stl> and covers STL allocators
My main blog
Labels
_fuxi
(75)
_IV
(146)
_misc
(5)
{610610
(30)
algo
(1)
automatedTrading
(8)
banking/economy
(3)
book
(14)
c++misc
(125)
c++real
(15)
c++STL/java_container
(7)
cppTemplate
(1)
db
(13)
DB_tuning
(4)
deepUnder
(1)
dotnet
(69)
eTip
(17)
excelVBA
(12)
finance+sys
(34)
financeMisc
(24)
financeRisk
(2)
financeTechMisc
(4)
financeVol
(21)
finmath
(17)
fixedIncome
(25)
forex
(16)
IDE
(24)
invest
(1)
java
(43)
latency
(4)
LinearAlgebra
(3)
math
(30)
matlab
(24)
memoryMgmt
(11)
metaPrograming
(2)
MOM
(15)
msfm
(1)
murex
(4)
nofx
(11)
nosql
(3)
OO_Design
(1)
original_content
(4)
scriptUnixAutosys
(19)
SOA
(7)
socket/stream
(15)
sticky
(1)
subquery+join
(2)
swing
(32)
sybase
(6)
tech_orphan
(12)
tech+fin_career
(30)
telco
(11)
thread
(21)
timeSaver
(13)
tune
(10)
US_imm
(2)
US_misc
(2)
windoz
(20)
z_algo+dataStructure
(4)
z_arch
(2)
z_c#GUI
(30)
z_career
(10)
z_career]US^Asia
(2)
z_careerBig20
(1)
z_careerFinanceTech
(11)
z_FIX
(6)
z_forex
(31)
z_hib
(2)
z_ikm
(7)
z_inMemDB
(3)
z_j2ee
(10)
z_oq
(14)
z_php
(1)
z_py
(26)
z_quant
(4)
z_skillist
(3)
z_spr
(5)
Showing posts with label nofx. Show all posts
Showing posts with label nofx. Show all posts
Saturday, January 22, 2011
Saturday, November 27, 2010
## boost thread tutorials
http://flylib.com/books/en/2.131.1.186/1/ -- [[c++ cookbook]]
http://blog.emptycrate.com/node/277
boost class documentations are no tutorials
http://blog.emptycrate.com/node/277
boost class documentations are no tutorials
Thursday, November 25, 2010
c# / c++ client-server
In some hedge funds, people actually use c# front-end with c++ backend. What communication protocol? TCP/IP.
I think there’s no need for java in front or backend. C# developers are often more familiar with c++ than java.
In another c++ backend, tibrv was the access protocol. I’d guess any client can access it via tibrv.
Sunday, October 24, 2010
sybase c++ driver used on wall street
http://manuals.sybase.com/onlinebooks/group-cnarc/cng1110e/dblib/@Generic__BookView
- An application can call a stored procedure in two ways: by executing a command buffer containing a Transact-SQL execute statement or by making a remote procedure call (RPC).
- Remote procedure calls have a few advantages over execute statements:
- An RPC passes the stored procedure's parameters in their native datatypes, in contrast to the execute statement, which passes parameters as ASCII characters. Therefore, the RPC method is faster and usually more compact than the execute statement, because it does not require either the application program or the server to convert between native datatypes and their ASCII equivalents.
- It is simpler and faster to accommodate stored procedure return parameters with an RPC, instead of an execute statement. With an RPC, the return parameters are automatically available to the application. (Note, however, that a return parameter must be specified as such when it is originally added to the RPC via the dbrpcparam routine.) If, on the other hand, a stored procedure is called with an execute statement, the return parameter values are available only if the command batch containing the execute statement uses local variables, not constants, as the return parameters. This involves additional parsing each time the command batch is executed.
- To make a remote procedure call, first call dbrpcinit to specify the stored procedure that is to be invoked. Then call dbrpcparam once for each of the stored procedure's parameters. Finally, call dbrpcsend to signify the end of the parameter list. This causes the server to begin executing the specified procedure. You can then call dbsqlok, dbresults, and dbnextrow to process the stored procedure's results. (Note that you will need to call dbresults multiple times if the stored procedure contains more than one select statement.) After all of the stored procedure's results have been processed, you can call the routines that process return parameters and status numbers, such as dbretdata and dbretstatus.
- If the procedure being executed resides on a server other than the one to which the application is directly connected, commands executed within the procedure cannot be rolled back.
- For an example of a remote procedure call, see Example 8 in the online sample programs.
Friday, September 24, 2010
Compile a boost regex-based or thread-based project -- minGW
You configure the -L under project -> properties --> CCG -> LibraryPath
You configure the -l under project -> properties -> CCB -> settings -> toolSettings tab -> MingwC++Linker -> library
-- regex
cd C:\0x\0bak\ideWorkspace\ec_boost1\Debug\
g++ -IC:\boost_1_44_0 -O0 -g3 -Wall -c -fmessage-length=0 -osrc\ec_boost1.o ..\src\ec_boost1.cpp
g++ -LC:\boost_1_44_0\stage\lib -oec_boost1.exe src\ec_boost1.o -lboost_regex-mgw44-1_44
-- boost::thread is more complicated cos the lib file(s) you built with bjam seem to be a hybrid of static and dynamic lib. Perhaps a static import library used to pull in the dll file (yes there is a dll produced). In that case, at runtime the dll must be available on PATH.
cd C:\0x\0bak\ideWorkspace\ec_boost1\Debug\
g++ -IC:\boost_1_44_0 -O0 -g3 -Wall -c -fmessage-length=0 -osrc\ec_boost1.o ..\src\ec_boost1.cpp
g++ -LC:\boost_1_44_0\stage\lib -Bstatic -oec_boost1.exe src\ec_boost1.o -lboost_thread-mgw44-mt-1_44
C:\0x\0bak\ideWorkspace\ec_boost1\Debug\ec_boost1.exe
If you see error about missing dll, then copy the named dll to the location of your exe, or a %PATH% dir. Why the error? Dependency Walker shows LIBBOOST_THREAD-MGW44-MT-1_44.DLL is a dependency of your new born exe. Apparently, there's no real static linking of the boost thread lib.
You configure the -l under project -> properties -> CCB -> settings -> toolSettings tab -> MingwC++Linker -> library
-- regex
cd C:\0x\0bak\ideWorkspace\ec_boost1\Debug\
g++ -IC:\boost_1_44_0 -O0 -g3 -Wall -c -fmessage-length=0 -osrc\ec_boost1.o ..\src\ec_boost1.cpp
g++ -LC:\boost_1_44_0\stage\lib -oec_boost1.exe src\ec_boost1.o -lboost_regex-mgw44-1_44
-- boost::thread is more complicated cos the lib file(s) you built with bjam seem to be a hybrid of static and dynamic lib. Perhaps a static import library used to pull in the dll file (yes there is a dll produced). In that case, at runtime the dll must be available on PATH.
cd C:\0x\0bak\ideWorkspace\ec_boost1\Debug\
g++ -IC:\boost_1_44_0 -O0 -g3 -Wall -c -fmessage-length=0 -osrc\ec_boost1.o ..\src\ec_boost1.cpp
g++ -LC:\boost_1_44_0\stage\lib -Bstatic -oec_boost1.exe src\ec_boost1.o -lboost_thread-mgw44-mt-1_44
C:\0x\0bak\ideWorkspace\ec_boost1\Debug\ec_boost1.exe
If you see error about missing dll, then copy the named dll to the location of your exe, or a %PATH% dir. Why the error? Dependency Walker shows LIBBOOST_THREAD-MGW44-MT-1_44.DLL is a dependency of your new born exe. Apparently, there's no real static linking of the boost thread lib.
Saturday, September 18, 2010
initializer in copier -- bypass no-arg ctor
Say your copy ctor is invoked (often implicitly;-), and you need to clone a field of type T. If you don't use the field initializer syntax, then the copier first calls T's no-arg ctor to "make room" for the field, then calls T's operator= to modify its state.
If you choose the initializer syntax, then T's no-arg ctor is not needed. T's copier is used instead. Chain reaction -- Host copier invoking field copier
#include <iostream>
using namespace std;
template<class T> class Safe{
public:
Safe(const T& obj){ // T aObj will instantiate
cout<<"Safe copier called"<<endl;
cout<<"before assignment, "<<&aObj<<endl;
aObj = obj;
cout<<"after assignment, "<<&aObj<<endl;
}
// Safe(const T& obj):aObj(obj){} // T aObj won't instantiate
~Safe(){ }
T aObj;
};
struct Date{
Date(){
cout<<"Date no-arg called with this = "<<this<<endl;
}
Date(int y, int m, int d){}
Date(const Date& rhs){
cout<<"Date copier called with this = "<<this<<endl;
}
};
int main() {
Date d(1,2,3);
cout<<"& d = "<<&d<<endl;
Safe<Date> dSafe (d);
cout<<"dSafe.aObj address = "<<&(dSafe.aObj)<<endl;
return 0;
}
If you choose the initializer syntax, then T's no-arg ctor is not needed. T's copier is used instead. Chain reaction -- Host copier invoking field copier
#include <iostream>
using namespace std;
template<class T> class Safe{
public:
Safe(const T& obj){ // T aObj will instantiate
cout<<"Safe copier called"<<endl;
cout<<"before assignment, "<<&aObj<<endl;
aObj = obj;
cout<<"after assignment, "<<&aObj<<endl;
}
// Safe(const T& obj):aObj(obj){} // T aObj won't instantiate
~Safe(){ }
T aObj;
};
struct Date{
Date(){
cout<<"Date no-arg called with this = "<<this<<endl;
}
Date(int y, int m, int d){}
Date(const Date& rhs){
cout<<"Date copier called with this = "<<this<<endl;
}
};
int main() {
Date d(1,2,3);
cout<<"& d = "<<&d<<endl;
Safe<Date> dSafe (d);
cout<<"dSafe.aObj address = "<<&(dSafe.aObj)<<endl;
return 0;
}
simple boost thread program
#include <iostream>
#include <boost/thread.hpp>
#include <boost/date_time.hpp>
void workerFunc() {
boost::posix_time::seconds workTime(3);
std::cout << "Worker: starting up then going to sleep" << std::endl;
boost::this_thread::sleep(workTime); // Thread.sleep
std::cout << "Worker: finished" << std::endl;
}
int main(int argc, char* argv[]) {
std::cout << "main: startup" << std::endl;
boost::thread workerThread(workerFunc); // pass a func ptr to thread ctor
boost::posix_time::seconds workTime(1);
std::cout << "main: sleeping" << std::endl;
boost::this_thread::sleep(workTime); // Thread.sleep
std::cout << "main: waking up and waiting for thread" << std::endl;
workerThread.join();
std::cout << "main: done" << std::endl;
return 0;
}
#include <boost/thread.hpp>
#include <boost/date_time.hpp>
void workerFunc() {
boost::posix_time::seconds workTime(3);
std::cout << "Worker: starting up then going to sleep" << std::endl;
boost::this_thread::sleep(workTime); // Thread.sleep
std::cout << "Worker: finished" << std::endl;
}
int main(int argc, char* argv[]) {
std::cout << "main: startup" << std::endl;
boost::thread workerThread(workerFunc); // pass a func ptr to thread ctor
boost::posix_time::seconds workTime(1);
std::cout << "main: sleeping" << std::endl;
boost::this_thread::sleep(workTime); // Thread.sleep
std::cout << "main: waking up and waiting for thread" << std::endl;
workerThread.join();
std::cout << "main: done" << std::endl;
return 0;
}
Building a simple boost-based project in EclipseCDT ^ codeBlocks
http://www.boost.org/doc/libs/1_44_0/more/getting_started/windows.html has a simple program using Boost Lamda.
1) immediately clean the project. Eclipse will rebuild and fail due to include path
2) Project -> Properties -> CCG -> pathsAndSymbols -> Includes -> GNU_C++ -> Add -> file system ...
...I took the laziest route and simply put in "C:\boost_1_44_0" to ignore all checkboxes, and it worked. I used a forward slash and it worked too. However, I removed it and put in "C:\boost_1_44_0" and checked all 3 checkboxes -> compiler can't resolve "#include <boost/lambda/lambda.hpp>"
(msvc procedure is well-documented.)
codeblocks is easier with include path -- Project -> BuildOptions -> SearchDirectories -> Compiler -> Add
1) immediately clean the project. Eclipse will rebuild and fail due to include path
2) Project -> Properties -> CCG -> pathsAndSymbols -> Includes -> GNU_C++ -> Add -> file system ...
...I took the laziest route and simply put in "C:\boost_1_44_0" to ignore all checkboxes, and it worked. I used a forward slash and it worked too. However, I removed it and put in "C:\boost_1_44_0" and checked all 3 checkboxes -> compiler can't resolve "#include <boost/lambda/lambda.hpp>"
(msvc procedure is well-documented.)
codeblocks is easier with include path -- Project -> BuildOptions -> SearchDirectories -> Compiler -> Add
compile boost source to get linkable library
To compile only the thread lib and the regex lib (slower) and skip the other libs,
cd C:\boost_1_44_0
bjam --build-type=complete --with-thread toolset=gcc-4.4.1 stage
cd C:\boost_1_44_0
bjam --build-type=complete --with-thread toolset=gcc-4.4.1 stage
Tuesday, August 17, 2010
func define -- remember prefix classname
In c++, always specify if your func is a method or a free func. No ambiguity allowed.
Since a method can be defined outside[1] the class body, it can look like a free func. Always always prefix the classname!
[1] unlike java
Since a method can be defined outside[1] the class body, it can look like a free func. Always always prefix the classname!
[1] unlike java
Subscribe to:
Posts (Atom)