Posts

Showing posts from September, 2012

java - Trouble verifying incorrect input in program -

i've written infix postfix calculator. works fine long infix equations valid, can't figure out how handle invalid equations. my program reads infix equations text file separated line breaks. prints results of converted postfix problems new text file. trying have if 1 equation invalid, instead of breaking program prints "invalid" on output page. i'm not sure do! my idea create case in list of switches mentioned "all other chars" somehow, since char isn't operator or operand, can't work @ all, , suspicious it's impossible. public class expressiontools extends consolecalculator { //for infix postfix static stack s; static string in; private string out = ""; /** * expression tools * @param input */ public expressiontools(string input) { in = input; // input = inputed string s = new stack<character>(); // stack = stack of chars } /** * determines string precedence * @throws postfixexception * @throws ioex

Fortran end of file error when input file is not in src folder -

i have small fortran program: integer :: ok real :: x character(len=80) :: name name="test.txt" open(1,file=name,status='old',iostat=ok) print *,ok read(1,*) x close(1) print *,x and works now. when (of course put file in dir) name="/data/test.txt" or name = "../data/input.txt" i error: at line 8 of file test.f90 (unit = 1, file = 'fort.1') fortran runtime error: end of file i use gfortran compiler. update: absolute path "/users/name/documents/fortran/data/input.txt" works too!

c# - How to get what's in datatable where exist in another datatable by LINQ -

if have 2 datatables : dt1 emp_num name status 1 aa 1 2 bb 1 3 cc 2 dt2 emp_num name dep_code 1 aa 536 2 bb 782 4 yuw 21 5 rr 892 how in dt1 , must exist in dt2 , put result in datatable the result : emp_num name status 1 aa 1 2 bb 1 you use linq var result = (from in dt1.rows join b in dt2.rows on dt1.rows["emp_num"]==dt2.rows["emp_num"] select a).copytodatatable<datarow>();

How can I define touch area for pin (Skobbler iOS) -

after updating latest skobbler version noticed touchable area around pin increased. before when touched pin, didselectannotation method triggered well. if touch map nearby pin, didselectannotation triggered. want make clickable pin picture, not area around. i've tried custom pin , standard. same result. may there settings property? looked through documentation didn't find anything. currently touch area not configurable. in 2.3 indeed increased (to make clicking annotations easier) - we'll revisit decision in later update, time being you'll have work around implementation.

c++ - Refreshing of image upon OnVScroll -

i trying display large data set graph. unfortunately causes flickering onpaint() called multiple times during update. , @ same time not need graph updated constantly; once upon loading program sufficient. i found way solve overriding onerasebkgnd() return 1 everytime updates. however, side effect of when vertical scrolling, graph "cut off" if scroll far. bringing scroll end cut-off graph, not repaint (because not redraw graph in onpaint() anymore). in essence, looking for, method repaint graph, if , if gets "cut off", due scrolling view. thanks! the mfc sample in msdn named drawcli example program includes image scrolling , using off-screen bitmap eliminate flicker. works well.

c++ - modify typedef declaration within if..else -

the problem trying solve: read binary file , write contents text file. format of contents within binary file specified user using option, e.g. bin2txt.exe [filename] [/f] , /f denotes contents in binary file of float type. my current algorithm: declare: typedef int datatype; use if...else or switch...case modify datatype float, unsigned int short etc. within main code. the problem: datatype modified within if...else , switches default (here, int) outside if...else/switch...case . means, read binary vector write vector text file within if...else statements. way, code becomes repetitive (every if block have vector declaration, initialization, reading vector , writing text file.). better avoid such repetition. could please guide me write direction. ? thanks. if find writing identical code except types involved, it's candidate template. a simple (untested) variant no error checking or input verification: template<typename t> void convert(std::

python - Order of syntax for using 'not' and 'in' keywords -

when testing membership, can use: x not in y or alternatively: not y in x there can many possible contexts expression depending on x , y . substring check, list membership, dict key existence, example. are 2 forms equivalent? is there preferred syntax? they give same result. in fact, not 'ham' in 'spam , eggs' appears special cased perform single "not in" operation, rather "in" operation , negating result: >>> import dis >>> def notin(): 'ham' not in 'spam , eggs' >>> dis.dis(notin) 2 0 load_const 1 ('ham') 3 load_const 2 ('spam , eggs') 6 compare_op 7 (not in) 9 pop_top 10 load_const 0 (none) 13 return_value >>> def not_in(): not 'ham' in 'spam , eggs' >>> dis.dis(

vba - Why is my recordset result accessed repeatedly and not cached? -

i have dao.recordest called products assign this set products = db.openrecordset("product urls sitemap") "product urls sitemap" query when ran makes use of custom vba function populate 1 of it's columns. what expecting happen products contain contents of query after has ran, table. not seem case. once have products recordset looping on , creating xml it do while not products.eof dim prdurl string dim prdupdated string prdurl = products!url prdupdated = products!updated xml = xml & createurlxml(products!url, products!updated) products.movenext loop however during loop calling function used in "product urls sitemap" during each loop. should need done once - @ time populate products calling set products = db.openrecordset("product urls sitemap") why getting called every time loop through products recordset , how stop this? thanks how use getrows(), simple example: dim querytext st

url - Proxy Check in Java -

i try check if proxy online or not. everytime exception thrown. tried system.setproperty (), doesn't work either... my method: public static boolean isonline(string host, int port) { string url = "http://www.google.com"; try { proxy proxy = new proxy(proxy.type.http, new inetsocketaddress(host, port)); httpurlconnection connection = (httpurlconnection) new url(url).openconnection(proxy); connection.connect(); return true; } catch (exception e) { return false; } } the exception: java.net.connectexception: connection refused: connect @ java.net.dualstackplainsocketimpl.connect0(native method) @ java.net.dualstackplainsocketimpl.socketconnect(dualstackplainsocketimpl.java:79) @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:345) @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:206) @ java.net.abstractplainsocketimpl.connect(abstractplainsocket

java - Maxindex in FixedWindowrollingpolicy -

i want know if maxindex reached in case of fixedwindowrollingpolicy. writes logs. i using , given maxindex 10. once reaches 10. not able find logs writing? please help.... according documentation of class org.apache.log4j.rolling.fixedwindowrollingpolicy , files deleted. not written anywhere else. let max , min represent values of respectively maxindex , minindex options. let "foo.log" value of activefile option , "foo.%i.log" value of filenamepattern . then, when rolling over, file foo.max.log deleted, file foo.max-1.log renamed foo.max.log , file foo.max-2.log renamed foo.max-1.log , , on, file foo.min+1.log renamed foo.min+2.log . lastly, active file foo.log renamed foo.min.log , new active file name foo.log created.

sql - drop user ORA-00604 and ORA-00054 -

i execute impdp, not finish because there isnt space in tablespace. i stop impdb , need drop new schema , use command: sql> drop user test cascade; drop user tgk_exor_ifil_008_432 cascade * error @ line 1: ora-00604: error occurred @ recursive sql level 1 ora-00054: resource busy , acquire nowait specified or timeout expired i dont find lock on database schema: sql> select * v$session username = 'test'; no rows selected i use oracle 11g the impdp either still running or rolling import itself. can try , wait finish or kill manually. find this: select o.object_name "object_name", s.sid "sid", s.serial# "serial#", s.username "username", sq.sql_fulltext "sql_fulltext" v$locked_object l, dba_objects o, v$session s, v$process p, v$sql sq l.object_id = o.object_id , l.session_id = s.sid , s.paddr = p.addr , s.sql_address = sq.address; credit after findin

ServiceStack new API for v3 -

is possible write var request = new orderrequest { id = 1 }; var response = client.get(request); with servicestack v3.9.71? according https://github.com/servicestackv3/servicestackv3/wiki/new-api is, can't find ireturn<tresponse> interface in version. yes you're looking @ new api in v3 wiki documentation. the api you're looking exists in v3 branch part of serviceclientbase api: tresponse get<tresponse>(ireturn<tresponse> request) the ireturn interface markers you're looking in iservice.cs class in servicestack.servicehost namespace. using productivity tool resharper make easier find , add missing references, otherwise can search servicestack's github v3 branch online.

database - Adding prefix to value in sql row values -

i have 10000 rows in sql table, , need add prefix before each value of user column. example: have value names john, smith, , on , need set qa-john, qa-smith , on. is there sql function can automatically or can done 1 one? thanks if haven't misunderstood, you're asking.. update table set name="qa-"+name

css - font awesome icon not showing in cake php -

i have download font-awesome-4.2.0 , load cake php project. corresponding font-awesome files , stored below folders: css files: \app\webroot\css\font-awesome.min.css \app\webroot\css\font-awesome.css font files: app\webroot\fonts\ less files: app\webroot\less\ scss files: app\webroot\scss i have call font awesome css files in ctp file like: echo $this->html->css('font-awesome.min'); echo $this->html->css('font-awesome'); now want show icon ctp file like: <div class="input-group"> <span class="input-group-addon"><i class="fa fa-user"></i></span> </div> but icon not showing. help? use cdn in default file of cakephp using link tag https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css

.net - Any benefits in using TCP for desktop, when server already using WebSockets for web -

we're developing system consists of server written in .net , web client. connected via websockets. in future, i'd add desktop client system. there point use tcp connection between desktop client , server, when have websocket implementation web , can use desktop too? not really. websockets connections starts http request, go through firewalls easier socket connnection. websockets starts http behave regular tcp connection. also, of times same tcp port http used websockets, since despite of being different protocol, negotiation starts http. the websocket protocol defines way framing data little overhead. websockets supports transport security tls websockets supports gzip message compression, although not browsers do. but, if want implement own super compression algorithm use desktop clients, can. configure websocket extension, standard browsers never ask extension. i don't see point of enabling raw tcp connection if have websocket support.

symfony - Twig Loader prependPath not working -

i'm trying use theme in symfony 2.5.6 following tutorial : http://www.ahmed-samy.com/symofny2-twig-multiple-domains-templating/ so tried in templatelistener (declared service) $path = dirname(__dir__) . '/resources/themes/' . $theme . '/views'; $this->twig->getloader()->prependpath($path, 'mywebsitefront'); but not work, template "mywebsitefront:index:index.html.twig" not found (but exists @ c:\www\mywebsitefront\src\mywebsitefront\resources\themes\mytheme\views\index\index.html.twig, path generated $path) any ideas ? according the docs , when render template need reference namespace aliased path e.g. @mywebsitefront/index/index.html.twig when using setpaths(), addpath(), , prependpath() methods, specify namespace second argument (when not specified, these methods act on "main" namespace): $loader->addpath($templatedir, 'admin'); namespaced templates can accessed via special @nam

Packing Pixel Data in OpenCV -

whenever read colored image 3 channels via cv::imread; data alignment bit awkward (neither byte nor integer) , slows me down when read single pixel data on gpu memory. , seems cv::mat class's logic behind alignment bit different had thought. not add byte between 2 pixels in single row in order have each pixel in row started @ every 4 bytes; rather pads bytes @ end of each row row may start @ every 4 bytes boundary. what should pack each pixel data single unsigned integer? there built-in method in opencv not have use logical or operation packing each pixel data 1 one? kind regards. you can convert pixel format bgr bgra see this example.

ios - How to set a weak reference to a closure/function in Swift? -

in hmsegmentedcontrol , i'd set segmentedcontrol.indexchangeblock instance method handle action. official example is: https://github.com/heshammegid/hmsegmentedcontrol/blob/master/hmsegmentedcontrolexample/hmsegmentedcontrolexample/viewcontroller.m (line 63 ~ 68), that's objective-c. in swift, functions first class citizens. wanna set instance method block property. code lead circular reference, seems should define weak reference: class examplevc: uiviewcontroller { var segmentedcontrolindex: int = 0 override func viewdidload() { let segmentedcontrol3 = hmsegmentedcontrol(sectionimages: ... , sectionselectedimages: ... ) segmentedcontrol3.frame = ... segmentedcontrol3.indexchangeblock = someinstancemethod } func someinstancemethod(index: int) { segmentedcontrolindex = index } } however, cannot define weak reference non-class type. can do? legal this? instead of defining weak reference closure, should use "

xcode - Link Binary with libraries VS Embed Frameworks -

what's difference in build phases between putting framework in "link binary libraries" or in "embed frameworks"? link binary libraries link frameworks , libraries project’s object files produce binary file. can link target’s source files against libraries in target’s active sdk or against external libraries. embed frameworks can create embedded framework share code between app extension , containing app. - timeline (look @ sentence) - "if containing app target links embedded framework , must include arm64 architecture or rejected app store."

Android 4.3 WebView will not load url with mp4 -

i trying load webpage has mp4 video on it. displays blank screen android 4.3 (jellybean) works versions after that. idea why is? below code public class videosample extends actionbaractivity { private webview mwebviewplayer; private string msamplemp4 = "http://techslides.com/demos/sample-videos/small.mp4"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_lime_light); mwebviewplayer = (webview) findviewbyid(r.id.limewebview); mwebviewplayer.getsettings().setjavascriptenabled(true); mwebviewplayer.getsettings().setloadwithoverviewmode(true); try { mwebviewplayer.loadurl(msamplemp4); } catch (exception e) { e.printstacktrace(); } } } i not getting errors either. have searched teh forum similar problem im not having luck. what if use setwebviewclient(new webviewclie

tsql - Improving recursive SQL looping -

i trying solve performance issue on inherited system appears when have significant amount of data. we have table contains 2 fields "itemid" , "parentitemid". "parentitemid" field relates row in same talbe "itemid" field matches row's "parentitemid" field. this relationship can many, many rows deep in places. the following query being run , looks cause of slowdown: while 1=1 begin select @parentid = parentitemid items itemid = @lastparentid if @parentid null begin break end else begin set @lastparentid = @parentid end end is there better way of doing sort of recursive search? note: not allowed make table changes @ point, adding "rootitemid" column not possible (i've asked, solve problem outright!) you use common table expression this: with antecedents (itemid, parentitemid, level) ( -- anchor member definition select itemid, parentitemid, 0 l

javascript - How to change selected option value when button is clicked -

change option value when button click <button class="btn1">clickme1</button> <button class="btn2">clickme2</button> <select> <option value="1">changevalue1</option> <option value="2">changevalue2</option> </select> demo check updated jsfiddle :- jsfiddle $('#dynamicchange').val('1').trigger('change'); $('#dynamicchange').val('2').trigger('change');

php - No Data & No Error when using function inside IF Statement -

i having trouble getting php script work when using function in if statements. the code runs, doesn't give me information, nor errors, if remove if's works fine, project working on, essential. here code - have took out sql save space.. if ($var === 'pk%') { cdb::usedb('blah', 'blah', 'blah', 'blah'); $sql = "blah blah "; $lrs = cdb::executequery($sql); if ($lrs) { $jsondata = convert($lrs); function convert($lrs) { // re-get variable can't outside of function $var = $_get['variable']; $intermediate = array(); while ($vals = cdb::getassoc($lrs)) { $key = $vals['var']; $y = $vals['measure_1']; if (!isset($intermediate[$key])) $intermediate[$key] = array(); $intermediate[$key][] = array('x' => count($intermediate[$ke

php - Assign variable to array values and populate <td> -

i have following code inside while loop following mysql query: $values=array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30); echo "<tr> <td class='results'>$values</td> <td class='results'>working query</td> </tr>" i need $values variable populate , increase 1 each row obtained query. desired result: 1 | data 2 | data 3 | data you didn't post while loop, assume how looks like. can add simple counter variable , increase every row returned db: $i = 1; while ($row = mysqli_fetch_assoc($res)) { echo "<tr> <td class='results'>$i</td> <td class='results'>working query</td> </tr>"; $i++; }

c++ - efficient copy of data from boost::asio::streambuf to std::string -

i need copy content of (boost::asio::)streambuf std::string. the following code works, think there's unnecessary copy between _msg , temporary std::string: msg (boost::asio::streambuf & sb, size_t bytes_transferred) : _nbytesinmsg (bytes_transferred) { boost::asio::streambuf::const_buffers_type buf = sb.data(); _msg = std::string( boost::asio::buffers_begin(buf), boost::asio::buffers_begin(buf) + _nbytesinmsg); } i tried replacing following: _msg.reserve(_nbytesinmsg); std::copy( boost::asio::buffers_begin(buf), boost::asio::buffers_begin(buf) + _nbytesinmsg, _msg.begin() ); while compiles, doesn't copy _msg string. will compiler (gcc4.4.7) optimize case - e.g. copy streambuf straight _msg without using temporary? is there perhaps iterator can use boost::asio::streambuf::const_buffers_type in order make std::copy work instead? reserve doesn't mean think means. can work ou

javascript - ng-repeat not pushing data -

i'm using ng-repeat directive list set of json data of format $scope.result=[ { "id": 84, "resource": { "id": 3, "name": "resource planning", "description": "test" }, "activity": { "id": 6, "name": "activity planning", "description": "test" } } ] my usage of ng-repeat this.. <div ng-repet="data in result">{{data.resource.name}} {{data.activity.name}}</div> i'm able display name ie., "resouce planning" , "activity planning". can't push data if i'm doing $scope.result.push({resource.name:result.resource.name,activity.name:result.activity.name}) from controller. there way push name inside object. , display/list same using ng-repeat? thanks i don't understa

Can't get the "fade in" to work with tabs in bootstrap -

so have simple tabs panel in html page , have applied "fade in" class active tab , "fade" others. far can see, have scripts installed ok, markup looks should according bootstrap website , other articles i've seen on web including here. yet still doesn't fade in or fade between tabs. can see doing wrong please. <div class="tab-wrapper"> <div role="tabpanel"> <!-- nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">about us</a></li> <li><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">what do</a></li> <li><a href="#messages" aria-controls="messag

business objects sdk - How to get the raw data from particular document's schedule instance? -

i able data document usign restful web services sdk as per how obtain report data bo use of restful web services? and need data not current version of document schedule executed time ago older data current data. any hints ? i learnt possible ids of schedules particular document. then possible export of schedule's content requesting export instaed of providing documents id, necessary provide schedule id. this way obtained schedule/instance export. i have noticed limitation pagind not seem work when export requested schedule's id instead of document's id.

xml - Reddit search api - searching by subbreddit -

i've been following reddit api documentation think i'm doing wrong. when try searching 1 particular subreddit query, brings results all subreddits. in example want return posts in /r/volvo relating wagons, query returns corresponding posts numerous subbreddits. http://www.reddit.com/r/volvo/search.xml?q=wagon so missing glaringly obvious? (i guess am!) thanks in advance. the default behavior returns results subreddits. to restrict results subreddit, multireddit, or domain-listing in url, use restrict_sr query parameter, so: http://www.reddit.com/r/volvo/search.xml?q=wagon&restrict_sr=on see https://www.reddit.com/dev/api#get_search

skipping ":" in ansible with strings already having ""(quotation) -

i trying use lineinfile: replace whole line when executing complains : (colon) tried using " (quotation) think ansible not able differentiate between existing "" , added "" tried \ escape colon still not working lineinfile: dest='/etc/sysconfig/network-scripts/ifcfg-team0' state=present regexp=^team_config=.* line=team_config='{"runner": {"name": "{{item.bondmode}}"}, "link_watch": {"name": "ethtool"}}' with_items: - "{{ teaming }}" this issue space after colon: line="team_config={'runner':{'name':'{{item.bondmode}}'}, 'link_watch':{'name':'ethtool'}}" will work (it not still valid json), see here

c# - TextRenderer: How to measure text as if it was on machine with different Dpi? -

i have c# winforms application consists of server , client side. use textrenderer.measuretext(string text, font font) method measure text. at moment need measure text on server side, if on client. send graphics.dpix , graphics.dpiy values client server. based on values, how can measure text on server side? key point client , server dpi might different. i guess, can create graphics object dpi values somehow , use textrenderer.measuretext(idevicecontext dc, string text, font font) overload measure text. how create graphics dpix , dpiy values? you can try hack: apply transform font size you're using measure: drawing 12pt font on 120dpi take same number of pixels drawing 12*120/96=15 on 96 dpi.

scala - Gatling2: How can I read from the virtual user's session -

i realise can save response body in virtual user's session: val session: session = session("myscn", "123") val scn = scenario("myscn") .exec(http("my_request") .post(serverurl) .headers(headers) .body(inputstreambody(helper.getbytearrayinputstream)) .check(status.is(200), bodybytes.saveas("responsebody"))) //key not found... session("responsebody").as[bytearray] how can read responsebody (implicit?) sesssion? created explicit session well... edit: based on answer have clarified scenario. in answer not know how function transformbytes works. either pass function gatling dsl method: .body(bytearraybody(session => session("responsebody").validate[array[byte]].map(transformbytes))) or in exec block , store transformation result in new attribute exec { session => session("responsebody").validate[array[byte]] .map(transformbytes) .ma

php - Mysql inner join doesn't work on Mysql 5.1 -

it works correctly on local server (mysql 5.5) doesn't work on remote server (mysql 5.1) $dati = mysql_query(" select * $tb_liguria join $tb_piemonte on $tb_piemonte.piemonte_data = $tb_liguria.liguria_data join $tb_paca on $tb_paca.paca_data = $tb_liguria.liguria_data join $tb_rhonealpes on $tb_rhonealpes.rhonealpes_data = $tb_liguria.liguria_data $tb_liguria.liguria_data >= '$datainizio' , $tb_liguria.liguria_data <= '$datafine' order $tb_liguria.liguria_data "); i tried nothing has changed $dati = mysql_query(" select * $tb_liguria join ($tb_piemonte, $tb_paca, $tb_rhonealpes) on ($tb_liguria.liguria_data=$tb_piemonte.piemonte_data , $tb_liguria.liguria_data=$tb_paca.paca_data , $tb_liguria.liguria_data=$tb_rhonealpes.rhonealpes_data) ($tb_liguria.liguria_data >= '$datainizio' , $tb_liguria

String to object in Javascript -

i have function working fine: function sendleaddata(form) { return trk(form, { firstname: "pan", }); } {firstname : "pan"} = object. if set var , pass var in function works fine. need use string building map , pass that. getting string perfect .code below not working: function sendleaddata(form) { //code str alert("str "+str);------->prints str perfect,also giving result below var obj = json.parse(str);//if except str put json.parse(json.stringify({firstname:"pan"})) work fine alert("obj "+obj); return trk(form, obj ); } str prints "{firstname:"pan"}". error syntax error thrown. please help. json has more strict object representation. keys need quoted: '{"firstname": "pan"}'

javascript - Meteor kadira no such package -

we developing our meteor application in windows environment using unsupported windows version of meteor. latest release 0.8.3. ok in windows environment used meteor add packages. if write meteor add meteorhacks:kadira meteor add kadira i no such package message. mrt command doesnt work. ideas?thanks i think question duplicated. please refer here meteor add meteorhacks:kadira available in meteor 0.9 , above. for meteor below 0.9 have use meteorite not supported windows.

css3 - Text getting pushed our of a div when using a border CSS -

im using div have gradient background on tittle on weppage. when using "border" property in css text pushed out of div. i have tried changue size, take out radius-border etc... #textkeyboard { height: 26px; width: 330px; text-transform: uppercase; text-align: left; background: -webkit-linear-gradient(#615bff, #262544); /* safari 5.1 6.0 */ background: -o-linear-gradient(#615bff, #262544); /* opera 11.1 12.0 */ background: -moz-linear-gradient(#615bff, #262544); /* firefox 3.6 15 */ background: linear-gradient(#615bff, #262544); margin-top: 20px; margin-left: 20px; padding-left: 10px; border-radius: 12px; border: 1px solid; } h3 { color: #f6b824; text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; } http://jsfiddle.net/t5w7wuay/ here jsfiddle of code. thanks. there predefined styling on elements, h3. to fix button add yout h3 rule: margin: 0; padding: 0; edit:

javascript - Node.js async.series() don't wait callback to complete -

my code works when mongoose.disconnect() never called , node program has time execute callbacks. when mongoose.disconnect() called @ end of program , connection lost inserts mongo naturally don't happen. this async not waiting inserts complete. why, , how can fix it? mobjectlist = array of objects ready insert insertmongoobj: function(mobjectlist, callback) { var tasks = []; (i in mobjectlist) { tasks.push(mobjectlist[i].save()); } async.parallel(tasks, function(err) { if (err) { callback(err, 0); } }); callback(null, tasks.length); } thank fast reply! changed function advised same thing. working when connection never closed , program never exiting. mongoose.disconnect() still closing connection before inserts. insertmongoobj : function(mobjectlist, callback){ var tasks = []; (i in mobjectlist) { tasks.push(mobjectlist[i].save.bind(mobjectlist[i])); } async.parallel(tasks, function(err) { if(err) retur

javascript - Saving inputs to db after auto sum -

im trying save values input fields db after ive used js sum them up. want save both inputs , total sum , theres when code breaks down. inputs empty after autosum has run , sum of fields saved db. i'm not sure how fix this, im hoping out there have solution. here's code. if stupid way of doing please show me right path! <td> <div class="form-group"> {{ form::text('report_mon_time', input::old('report_mon_time'), array('name' => 'time', 'class' => 'form-control-s', 'onblur' => 'findtotaltime()')) }} </div> </td> <td> <div class="form-group"> {{ form::text('report_tue_time', input::old('report_tue_time'), array('name' => 'time', 'class' => 'form-control-s', 'onblur' => 'findtotaltime()')) }} </div> </td> <div class="form-group&qu

c++ - Why are these default arguments allowed? -

i've found this question, , i'm baffled. the answer says b invalid, "non-static members can not used default arguments.". makes perfect sense. what don't understand why other 2 okay. in fact, i'm struggling understand semantics if default not constant expression... what's going on here? default parameters evaluated @ compile time. compiler pick current value? #include <iostream> int g_x = 44; struct foo { int m_x; static int s_x; foo(int x) : m_x(x) {} int a(int x = g_x) { return x + 1; } int b(int x = m_x) { return x + 1; } int c(int x = s_x) { return x + 1; } }; int foo::s_x = 22; int main(int argc, char** argv) { foo f(6); std::cout << f.a() << std::endl; std::cout << f.b() << std::endl; std::cout << f.c() << std::endl; return 0; } actually, default arguments evaluated when function called, why okay. draft c++ standard section 8.3.6 default ar

java - SecurityException when uploading a file to aws s3 with UploadObjectSingleOperation example -

i catch exception when trying run example here: http://docs.aws.amazon.com/amazons3/latest/dev/uploadobjsingleopjava.html can help? exception in thread "main" java.lang.exceptionininitializererror @ javax.crypto.mac.getinstance(mac.java:171) @ com.amazonaws.auth.abstractawssigner.sign(abstractawssigner.java:87) @ com.amazonaws.auth.abstractawssigner.signandbase64encode(abstractawssigner.java:69) @ com.amazonaws.auth.abstractawssigner.signandbase64encode(abstractawssigner.java:58) @ com.amazonaws.services.s3.internal.s3signer.sign(s3signer.java:127) @ com.amazonaws.http.amazonhttpclient.executeonerequest(amazonhttpclient.java:652) @ com.amazonaws.http.amazonhttpclient.executehelper(amazonhttpclient.java:460) @ com.amazonaws.http.amazonhttpclient.execute(amazonhttpclient.java:295) @ com.amazonaws.services.s3.amazons3client.invoke(amazons3client.java:3697) @ com.amazonaws.services.s3.amazons3client.putobject(amazons3client.java:1434) @ com.bartoff.s3utils.uploadobject.ma

android - How can I get a JSONOBject of a Web Service? -

i'm trying jsonobject of web service. i'm using httpclient httpresponse. when web service return json change return string , try create jsonobject still doesn´t work , return null. how can ? import java.io.ioexception; import java.io.serializable; import java.util.list; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.namevaluepair; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.entity.urlencodedformentity; import org.apache.http.client.methods.httpget; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.util.entityutils; import org.json.jsonexception; import org.json.jsonobject; public static jsonobject get(string url){ jsonobject jsonobj = null; try { defaulthttpclient httpclient = new defaulthttpclient(); httpresponse httpresponse = httpclient.execute(new httpget

SharePoint 2013 Discussion board forms authetication -

i want have discussion forum, forms based authentication mode , registration module. (it done in webpart) forum includes topics, questions, answers... i started trying configure fba sp2013, doing activate fba mode hole sitecollection, not specific discussion board want use. to more clear, want have discussion board that, if somone wants add or answer question, need autheticate using forms (fba) how can achieve please ? easiest way so if understand correctly, want discussion board available anonymously, users have login/register add or answer question? in case turn on anonymous access site collection , give anonymous users read permissions forums. whenever user accessed requires permissions (such posting forums), prompted login if hadn't already. now, i'm not sure sharepoint discussion boards support level of permissions, have not done myself, how done in general sharepoint. also, if using sharepoint discussion forums, better off discussion board web ap

When i import war file to Jdeveloper, iam seeing all the files two times -

i have war file. iam importing war file jdeveloper cutomization. when import war file (file -> new -> projects -> project war file). when import war, iam seeing file (java classes, roperties classess ...) appering 2 times. can 1 please me why iam facing issue. thanks it might application navigator in jdev shows files based on context of rather actual location. check if files same file on file system.

ios - Swift segue from CollectionViewCell failing to display new view -

i'm trying load new view when cell in collectionview selected. everywhere online says it's simple registering new view , navigation controller in storyboard, , ctrl + click dragging collectionviewcell new view. having done this, code compiles , runs, no new view appears when click on cells. have missed? the storyboard says there segue collectionview next view (identified correct name , all), i'm bit confused... edit: here collectionview controller code, in case i've done in here that's causing problem. it's calendar page (as can tell code): iboutlet weak var calendarcollection: uicollectionview! var collectionview: uicollectionview? let calendarcellidentifier: string = "calendarcell" override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. let layout: uicollectionviewflowlayout = uicollectionviewflowlayout() layout.sectioninset = uiedgeinsets(top: 50, left: 10, bottom:

c++ - Using char as array index after using map -

i trying use character index array of integers after mapping it. problem whenever try access array using variable of type char(as array[char]), instead of using array["], getting error compiler. wonder if necessary use constant types after mapping. here code. int count=0; int length=strlen(word); std::map<std::string, int, std::less<std::string> > alpha; alpha["x"]=1; alpha["y"]=2; alpha["z"]=3; char temp; for(int i=0;i<length;i++) { temp=word[i]; count=alpha[temp]; } error(s) : error: invalid user-defined conversion 'char' 'std::map, int, std::less > >::key_type&& {aka std::basic_string&&}' [-fpermissive] count=alpha[temp]; error: initializing argument 1 of 'std::basic_string<_chart, _traits, _alloc>::basic_string(const _chart*, const _alloc&) [with _chart = char; _traits = s

What is a "type" as mentioned in the Java tutorial? -

source: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html you may see term "member" used well. type's fields, methods, , nested types collectively called members." while defining member tutorial uses term type , in context doesn't mean data type. can't find correct definition on google. maybe obvious i'm missing? in context "type" means "class". in other contexts may mean "a class or primitive type", since talk types having members, mean classes. same goes nested types: classes can nested inside other classes; primitive types built language, , cannot nested.

Insert a text value in listview at 0 index in vb.net -

i have listview bind datasource. in listview have insert hardcode value (add new..) , button @ 0 index of listview. can how can insert value , button @ 0 index of listview. thanks in advance. you cannot insert values while control bound data source. have find way include value in data source @ zeroth position , rebind control, or abandon idea of using data source , instead populate control's items manually.

jquery - Partial view modal popup is not working at first postback -

i have pop in partial view not working when post back. using jquery ajax , partial view calling when click on user record in table. here code on click partial view called. <td><a href="#" class="details" data-id="@item.teamid" data-dialogmodalbind=".dialog_content3"> @html.displayfor(modelitem => item.description)</a> </td> here code calling partial view <div id="detailsplace" class="dialog_content3" style="display:none"> </div> here jquery code <script type="text/javascript"> $(function () { $('.details').click(function () { var $buttonclicked = $(this); var id = $buttonclicked.attr('data-id'); $.ajax( { url: '@url.action("details","team")', type: "post",

node.js - Is there a way to run a .net exe on heroku? -

i've wondered if there way run .net executable file in heroku.i know heroku linux based there way? here test code works on computer (windows). exe file writes in "writetext.txt" , read it. var http = require("http"); var express = require("express"); var app = express(); var port = process.env.port || 1234; var exec = require('child_process').execfile; var fs = require('fs'); app.use(express.static(__dirname + "/")) var server = http.createserver(app) server.listen(port); app.get('/exec', function(req, res){ exec('test.exe', function(err, data) { console.log(err) console.log(data.tostring() + "data"); }); fs.readfile(__dirname + '/writetext.txt', 'utf8', function (err,data) { if (err) { return console.log(err); } console.log(data); res.end(data.tostring()); }); }); app.get('/*

xml - spring MapFactoryBean return map of map instead of creating map -

i map inside map using spring beans in xml doing next : goal have map> mobilemap wrapper when use mobilemap.get("mobilemap") requested without wrapper xml : <bean class="org.springframework.beans.factory.config.mapfactorybean" id="mobilemap1111"> <property name="targetmapclass"> <value>java.util.hashmap</value> </property> <property name="sourcemap"> <map> <entry key="cfnetwork/221.5"> <bean class="org.springframework.beans.factory.config.mapfactorybean"> <property name="targetmapclass"> <value>java.util.hashmap</value> </property> <property name="sourcemap"> <map>

spring mvc - org.codehaus.jackson.map.JsonMappingException: Direct self-reference leading to cycle -

i working on angularjs java web app, , refactoring existing parent pom use java 8. towards end changed spring references use spring bill of materials 4.1.2.release, , our jetty application server 9.2.5.v20141112, java 8 compatability. almost working fine until call url initial blast of data. url getting called, , delegated (via springmvc) correct code, returns json. for debugging purposes calling testapp.do returning simple json string [{"system":"test"}]" that method getting called, , returning expected string. however somewhere along way (not sure if spring, or jetty, or jackson, seeing following exception in stack, , return value never assigned. any advice appreciated 2014-11-19 09:57:04.371:warn:oejs.servlethandler:qtp1601800698-18: /mycontext/testapp.do @ org.codehaus.jackson.map.ser.beanpropertywriter._reportselfreference(beanpropertywriter.java:491) @ org.codehaus.jackson.map.ser.beanpropertywriter.serializeasfield(beanpropertywrit

How to add X-Frame-Options to just some responses in Spring Security 3.2 -

i add x-frame-options header pages in spring application. spring security 3.2 offers nice capability add header responses via <headers> <frame-options /> </headers> configuration. but possible exclude header paths? considered subclassing xframeoptionsheaderwriter , path regexp matching inside, seems bit ugly. maybe there more convenient way accomplish this? i found out how xml configuration: <http> <headers> <header ref="xframeoptionsheaderwriter" /> </headers> </http> <beans:bean id="xframeoptionsheaderwriter" class="org.springframework.security.web.header.writers.delegatingrequestmatcherheaderwriter"> <!-- argument 1: requestmatcher. matcher match paths. --> <beans:constructor-arg> <beans:bean class="org.springframework.security.web.util.matcher.negatedrequestmatcher"> <beans:constructor-arg>