Posts

database - MySQL IN Clause in SQL query with User Defined Function -

i using following query update children of particular topic. update topics set reuse = 0 topic_id in (select getchildtopics(187)); where select getchildtopics(187); returns "188,190,189" update query updating first row topic_id = 188, instead of updating first topic only, should update 3 topics. when put values manually works fine. update topics set reuse = 0 topic_id in (188,190,189); can suggest what's wrong doing here? here code getchildtopics mysql function create definer=`root`@`localhost` function `getancestry`(givenid int) returns varchar(1024) charset latin1 deterministic begin declare rv varchar(1024); declare cm char(1); declare ch int; set rv = ''; set cm = ''; set ch = givenid; while ch > 0 select ifnull(parent_topic_id,-1) ch (select parent_topic_id topic_list id = ch) a; if ch > 0 set rv = concat(rv,cm,ch); set cm = ','; ...

Java - executing external exe file -

i have executable program made on c++ (cf.exe) takes parameters few text files (.txt), performs calculations, , creates file results (results.txt). program needs no interaction. once executed, when calculations done, it's automatically closed. then, have other program made on java, contains button executes cf.exe. when button pressed following method called: public void executeexternalprogram(){ string filepath = "c++" + file.separator + "cf.exe"; try { system.out.println("executing c++ exe..."); process p = runtime.getruntime().exec(filepath);; } catch (exception e) { e.printstacktrace(); } } i don't error, cf.exe not being executed when press button. when execute manually cf.exe, results file correctly created. furthermore, i've tried copy other programs, such notepad.exe, same folder , execute through java without problem...

c++ - Boost.Asio: Segmentation fault when sending too big message -

my program saves internal logs .txt file. if connect via tcp (ssl encrypted), program send contents of log file. this code sending data: void niusersession::write(std::string message) { std::cout << "writing message" << std::endl; message.append("<eof>"); boost::system::error_code ec; boost::asio::async_write(this->socket_, boost::asio::buffer(message), boost::asio::transfer_all(), boost::bind(&niusersession::writehandler, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred())); } void niusersession::writehandler(const boost::system::error_code &error, std::size_t bytes_transferred) { std::cout << "write handler" << std::endl; if(error) { std::cout << "write handler error: "...

mysql - Monitoring : Centreon - How to connect centreon user to database? -

i'm running centreon entreprise server (ces) 3.3 , added nagvis (1.8.x). on virtual machine (virtualbox). when suceeded in giving rights nagvis reach centreon data, centreon started displaying : "database error: not connect database", though the centreon user has privileges on "centreon" , "centreon_storage" . here's central-broker-master.log : [1467987167] error: storage: rebuilder: not connect centreon storage database: not open database: access denied user 'centreon'@'localhost' (using password: yes) qmysql: unable connect [1467988484] error: tcp: error while sending data peer 'localhost:5670': remote host closed connection [1467988492] config: module applier: loading directory '/usr/share/centreon/lib/centreon-broker' [1467988492] config: correlation: invalid correlation configuration, correlation engine not loaded [1467988492] config: applier: 14 modules loaded [1467988492] error: not open database: ac...

php - MySql what's the best way to insert bookings -

Image
i have database looks this i wondering separate tables , such, insert 1 table @ time, insert row in booking, insert row in customers, , last insert row in booking_has_customers? there easier way this? halls unchanging in case have more rooms hire. and when retrieving data database, best use join on foreign keys full overview incase need data? thanks in advance! no there no easier way, need insert data each table individually. however, exact situation asks transactions . transactions ensure either required insertions happen, or none of them. this question pretty broad , cannot answered. if makes sense retrieve data multiple tables, joins answer , foreign keys starting points join condition. join condition may have contain expressions beyond foreign keys. depends actual use case. i rather ask specific questions specific use cases reports / queries in separate questions. way can answers tailored exact question.

ios - How to record landscape video in a portrait application? (Swift 2, iPhone) -

i need record landscape video inside portrait iphone application. is possible or blocked hardware limitation? using avcapturevideopreviewlayer able change preview orientation, video still recorded in portrait. any idea welcomed! you should able set orientation landscape video recording. , set preview layer portrait achieve landscape video previewed in portrait. if understand question correctly. can show code tried already? if capturesession.canaddoutput(videooutput) { capturesession.addoutput(videooutput) let connection = videooutput.connectionwithmediatype(avmediatypevideo) if connection.supportsvideoorientation { connection.videoorientation = avcapturevideoorientation.landscaperight } print("adding output") } else { print("could not add front video output") return } ... func setuppreviewlayer() { ...et...

php - Cakephp 2.X doesn't support postgresql ltree operator '?' likes "ltree ? lquery[]" -

i use postgresql ltree in cakephp 2.x controller , found when use query below: $this->userinfo->query( 'select * user_infos path ? \'{'test1.1','test2.1'}\'' ); it can execute through psql. format due ltree ? lquery[] it throw error: error: sqlstate[42601]: syntax error: 7 error: syntax error @ or near "[" line 1: ...t * user_infos where path $1 \'{'test1.1 ... ^ it seems pdo treats ? $1 argument? anyone has idea prevent problem?