Posts

php - ROW wise SUM VS COLUMN wise SUM in MySQL -

Image
i have tablea contains following structure i modified structure tableb below reduce number of rows , category fixed length assume have 21 lakh data in tablea after modified new structure tableb contains 70k rows only in case want sum values table, query1: select sum(val) total tablea; vs query2: select sum(cate1+cate2+cate3) total tableb; query1 executing faster while comparing query2. tableb contains less rows while comparing tablea as of expectation query2 faster query1 fastest one. help me understand why performance reduced in query2? mysql optimized speed relational operations. there not effort @ speeding other kinds of operations mysql can perform. cate1+cate2+cate3 legitimate operation, there's nothing particularly relational it. table1 simpler in terms of relational model of data table2, though table1 has more rows. it's worth noting in passing table1 conforms first normal form table2 not. 3 columns repeating group though it's...

linux - Run sudo command with password -

sudo command can used in following way sudo -u <user_name> <command/script> but want know how include password want avoid user interactivity. also, admin, don't want disable password prompt sudo commands. how can achieve this. tried man sudo , not of help. you can use -s switch reads password stdin , example: ~$ echo "yourpassword" | sudo -s <command> anyway, @thrustmaster said, not right way use sudo .

C# NULL VALUES BEING INSERTED IN DB -

i reading xml file , saving extracted data according elements of xml file. using xmlreader. when running program ... runs fine but, null values being sent db. codes follows : using system; using system.xml; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.data.sqlclient; using system.configuration; using system.data; public partial class _default : system.web.ui.page { string org_id; string org_desig; string org_name; string add_1; string add_2; string add_3; string cityname; string countrycode; string countryname; string postalcode; protected void page_load(object sender, eventargs e) { } protected void button1_click(object sender, eventargs e) { // load xml file xmltextreader reader = new xmltextreader("pxmlf-8612013050420130606105906.xml"); // loop on xml file while (reader.rea...

c++ - How to Run a whole QApplication Asynchronously? -

i'm trying run modified qt-programm library. need not not block main execution. so want run qapplication , commence execution of main application. how achive this? my first thought run in seperate thread. void myclass::execute() { someclass = someclass::instance(); std::thread t1(&myclass::startapp, this); someclass->somefunction(); someclass->domorestuff(); } void myclass::startapp() { qapplication app(argc, argv); app.exec(); qcoreapplication::quit(); } but results in call '__invoke' ambiguous error. though don't know why/where __invoke overwritten , how handle error. :( so how can accomplish qapplication doesn't block main execution? design pattern totally wrong, qapplication qcoreapplication not supposed multiplied inside 1 application. should example make own class like: class librarycore: public qobject { } and substitute qapplication class inside future library sources. should implement needed...

join - Does Core Data support VIEW in SQLite? -

would know if core data support creating view in sqlite3 database? if not, join way can select data 2 tables (each of them has different table structure) ? directly api can't. core data object storage, not database - if it's sqlite behind. anyway, can open coredata database standard sqlite , make direct queries on stored data. db structure easy understand.

servlets - Downloading a CSV File in Browser by using Java -

i'm trying add button on web application when clicked, downloads csv file (which tiny, 4kb in size). i have button made , listener attached it. file ready. thing need create actual event downloads csv file when button clicked. assuming "file" (which of type file) name of csv file i'm using, , it's ready go, method have far: public void downloadcsv(httpservletrequest _request, httpservletresponse _response, logfiledetailcommand cmd) throws exception { servletoutputstream outstream = _response.getoutputstream(); _response.setcontenttype("text/csv"); _response.setheader("content-disposition", "attachment; filename=data.csv"); } i realise i'm missing part writes file servletoutputstream part i'm stuck on. know class servletoutputstream extends class outputstream ( http://docs.oracle.com/javaee/5/api/javax/servlet/servletoutputstream.html ), , therefore has inherited "write" methods, in ideal...

javascript - Set predefined subject and text for contact form on button click -

i trying following think dont have clue how work properly: on page products.html have products buttons order. buttons redirect contact form , set defualt subject , text. e.g: if click on "order computer" redirected contact page form , form contain filled datas. subject: "computer order" text: "i make order..." this how button looks like <a class="dc_c3b_large dc_c3b_orange dc_button" href="/contact.html?subject="computer"><span style="font-size:25px !important">objednaj!</span></a> and form <form action="contact.php" method="post" id="contactform_main"> ... <label for="subject">predmet*</label> <input id="subject" name="subject" class="text"/> <input type="submit" name="imagefield" value="submit" class="send" /> <...