Posts

Quoting strings in C++ -

in pascal lazarus/delphi, have function quotedstr() wraps string within single quotes. here's example of current c++ code: //i need quote tblcustomers pqxx::result r = txn.exec( "select * \"tblcustomers\" "); another one: //i need quote ccustomername std::cout << "name: " << r[a]["\"ccustomername\""]; similar above, have double-quote strings. typing in kind of slowing me down. there standard function can use this? btw, develop using ubuntu/windows code::blocks. technique used must compatible across both platforms. if there's no function, means must write one. string str = "tblcustomers"; str = "'" + str + "'"; see more options here

predict.svm function R text mining? -

i have training set contains sentences , labels(1 et -1 ). after creating svm model. want predict label , score of new data. code : library(tm); require(rcmdrplugin.temis); library(rtexttools); require(e1071) news=read.csv("c:..polarity.csv",header=f,sep=';') # training data traindata <- as.data.frame(news[1:196,]); trainvector <- as.vector(traindata[,1]); # choose sentences without labels trainsource <- vectorsource(trainvector); traincorpus <- corpus(trainsource) # create training corpus #cleaning training corpus traincorpus <- tm_map(traincorpus,stripwhitespace) traincorpus <- tm_map(traincorpus,tolower) traincorpus <- tm_map(traincorpus, removewords,stopwords("french")) traincorpus <- tm_map(traincorpus,removenumbers) traincorpus <- tm_map(traincorpus, function(x) gsub("(['’\n??]|[[:punct:]]|[[:space:]]|[[:cntrl:]])+", " ", x)) corpus1 <- corpus(dirsource("c.../file", encoding="ut...

c++ - gsoap returns error 12 and "No user identifier provided" stream error -

i trying build simple gsoap client stuck. code, wrote. currencyratessoapproxy currproxy; std::string login = "kav120@aubg.bg"; std::string password = "mypass"; std::string = "usd"; std::string = "eur"; _ns1__getlatestrate* getrate = new _ns1__getlatestrate; getrate->singlecurrencyfrom = &from; getrate->singlecurrencyto = &to; getrate->password = &password; getrate->userid = &login; _ns1__getlatestrateresponse* resp = new _ns1__getlatestrateresponse; if (currproxy.getlatestrate(getrate, resp) == soap_ok) std::cout << "works"; else { currproxy.soap_stream_fault(std::cout); std::cout << currproxy.error; } currencyratesoapproxy: class soap_cmac currencyratessoapproxy : public soap { public: /// endpoint url of service 'currencyratessoapproxy' (change needed) const char *soap_endpoint; ...

Organize and relate class in PHP -

well, trying adapt old code more object oriented model find difficulties in doing it. structure of classes this: // config.php class config { const setting1 = 'value'; const setting2 = 'value'; } // main.php include 'config.php' class main { var $config; var $info; var $db; function _construct() { $this->config = &new config; $this->info = &new info; $this->db = &new db($this); } } class info { function getsetting($a, $config) { if ($a>0) return $config::setting1; return $config::setting2; } } class db { function _construct($main) { $setting1 = $main->config::setting1; } } // index.php $main = new main; echo $main->info->getsetting(1, $main->config); so, see, there incorrect things in code. want have inside main class, create $main object , there access other object. db need constant config yet don't want create ne...

printing - What does "%%" mean in Java? -

i've inherited code i'm trying modify, , i've see following syntax in number pf places. int titlerecend = inputline.indexof("%%headerend"); ... int filenamestart = inputline.indexof("%%file: ")+8; int filenameend = inputline.indexof("%%filenameend"); i've reviewed this related link can;t find exact match dual % either answer or in javadoc associated answer. understand has print formattimg, can't seem find syntactical information %% instead of, % . what these veriable declarations do--or supposed do? %% means % character java.util.formatter pattern. since % denotes beginning of format specifier %% used escape % char. system.out.println("%%"); prints % for string.indexof % or %% have no special meaning.

driver - Realtek network adaptor 8168E transmit/receive using loopback -

i trying transmit , receive realtek 8168e using loopback(for windows 7 platform) ( writing tx buffer , reading rx buffer) reading rx buffer gives 0. on checking interrupt status register, tdu , rdu bit set 1 (tx/rx descriptor unavailable) network adaptor : realtek 8168e data sheet referred : realtek 8168b transmitter side configuration - allocated memory tx descriptor per specification given in data sheet (page no:55). aligned descriptor 256 byte alignment. also allocated separate buffer (txbuffer) store data transmitted. placed address of txbuffer specified field in tx descriptor. enabled mac loopback bit in tx config register (40h). then have enabled npq bit in txpoll register (38h). after that, have done nic reset offset 37h. then have enabled loopback bit in bmcr register. enabled tx ok, , tx descriptor unavailable interrupts in interrupt mask register (3ch). placed tx descriptor address mac register tnpds (20h). then @ last enabled te bit in ...

.net - In Windows Vista and later, is it possible to obtain the partial result of desktop compositing? -

it doesn't have latest version, totally fine if few frames old. what i'm trying display screen inside window, don't want window show in miniature screen. can think few possible hacks accomplish this. first 1 hiding (in way) window, taking screenshot , making visible again, there chance cause flicker: how can capture screen under own window excluding own window another option through magnification api, still feels little bit of hack. excluding windows screen capture i'm speculating in compositing desktop environment should possible access compositing engine , request version of compositing doesn't include 1 or more layers. result of "extra" composition made available requesting application asynchronously, maybe few frame laters. is there way using win32 api? some other relevant resources c++ - how screen-capture, except windows