Posts

c++ - Showing txt file details -

i have .txt file these contents: good bad hi i want next button cycle through these words, code word "good". when click next, doesn't show next word. here code qt 5.4 . void mainwindow::on_next_clicked() { ui->showen->clear(); ifstream sfile("e:\\en.txt"); getdata(sfile); sfile.close(); } void mainwindow::getdata(std::ifstream& myfile) { if(!myfile.eof()) { std::string str; getline(myfile, str); ui->showen->settext(qstring::fromstdstring(str)); } } every time method executed: void mainwindow::on_next_clicked() { ui->showen->clear(); ifstream sfile("e:\\en.txt"); getdata(sfile); sfile.close(); } the file opened anew , first bit read getdata. file closed. every time file opened, reading starts on beginning, why see same string every time. you want open file somewhere else (the window's constructor, perhaps?), read on each button c...

java - 2-line list view not appearing -

Image
i'm trying create 2-line list view in activity i've come across 1 error don't know how fix. how can achieve appcompat way? want achieve in screenshot attached. error on line 52. public class wclineactivity extends actionbaractivity { private class sample { private charsequence title; private charsequence summary; private class<? extends activity> activityclass; public sample(int titleresid, int summaryresid, class<? extends activity> activityclass) { this.activityclass = activityclass; this.title = getresources().getstring(titleresid); this.summary = getresources().getstring(summaryresid); } @override public string tostring() { return title.tostring(); } public string getsummary(){ return summary.tostring(); } } private static sample[] msamples; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(sa...

cakephp 3.0 - Avoid ORM to return Cake\I18n\Time instance -

i have following data on db date date time +--------------+------------+----------------+ | initial_date | final_date | expected_hours | +--------------+------------+----------------+ | 2015-04-20 | 2015-05-24 | 13:00:00 | | 2015-04-13 | 2015-05-17 | 13:00:00 | +--------------+------------+----------------+ but when call $this->set('weeks', $this->paginate($this->weeks)); it returns me cake\i18n\time instance on 3 columns, says here how can avoid instance? edit: the reason want because when have 44:00:00 on expected_hours fails with datetime::modify(): failed parse time string (44:00:00) @ position 0 (4): un expected character this accepts 24:00:00 or less... any ideas welcome in weekstable class add this: use cake\database\schema\table schema; ... protected function _initializeschema(schema $schema) { $schema->columntype('initial_date', 'string'); $schema->columnt...

google apps script - ListBox will not populate with new API -

Image
for reason when run app runs except listbox not populate. tried change while looking thinking interator reason listbox not populate folders have in drive. appreciated, thanks! //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* template generator by: andre fecteau - klutch2013@gmail.com original code from: kiszal@gmail.com (found in template gallery searching "templates" first one. major from: serge insas on stack overflow (he did of work.) link 1: http://stackoverflow.com/questions/18147798/e-undefined-google-script-error link 2: http://stackoverflow.com/questions/18132837/have-a-listbox-populate-with-every-folder-in-mydrive how use: first: each column designated in template {column letter} example column {a} second: can change this, template must in folder called "templates." folder can anywhere in drive. third: click "generate documents here!" click "export row document...

sql server - Measure network time in SQL query -

question raised out of curiosity while working on sql query on vpn connection. vpn slow hence query performing slow. don't have direct access database server, test queries need run them through vpn :( is there way eliminate time taken network lag due vpn , know actual time taken query? without making copy of database , bringing local system/network. you network performance totally dependent on infrastructure. for identifying execution time can use time statistics. run below query set on set statistics time on; now run query. if switch "messages" table of results see below. execution time. sql server execution times: cpu time = 0 ms, elapsed time = 0 ms.

How to read/validate files from web address folder in c# -

i have read files web address folder ...so have used below code ...i not getting list of files... string pathuser = "http:/mentpc.blob.core.windows.net/cents/201503"; string pathdownload = path.combine(pathuser, @"20150302110215315197/20150401100536436792"); webclient client = new webclient(); stream stream = client.openread(pathdownload); streamreader reader = new streamreader(stream); but getting exception saying ===>the remote server returned error: (404) not found. please me what error means, url not found. should pretty easy debug , check combined path in debugger. firstly don't think path.combine correct function use url's. path.combine used physical file paths. should using uri this. uri baseuri = new uri("http:/mentpc.blob.core.windows.net/cents/201503"); uri downloaduri = new uri(baseuri, "20150302110215315197/20150401100536436792"); also, looks trying access 2 files in same url. if case, need change ...

class - Puppet access parameters of module through other module -

i'm trying deal following situation: class profile:mq { include rabbitmq } class rabbitmq ( $user, $pass, $host ) { ...logic... } i use hiera auto lookup fill in parameters in rabbitmq through profile::mq class (eg profile::mq:rabbitmq::user: "value", not rabbitmq::user: "value") guess encapsulate rabbitmq not sure how in puppet. automated data binding: plan. it doesn't work way propose, however. hiera keys given class looks parameter values depend on class , parameter names. independent of locus of , declarations of class. cannot otherwise, because multiple declarations of same class may evaluated same target node, , -- because classes singletons -- declare same class (instance). you may able achieve you're after putting rabbitmq parameter values in profile-specific level of hiera hierarchy. doesn't feel quite right me, may serve enough purposes.