Posts

Showing posts from February, 2015

javascript - JS do ... while -

it seems me misunderstand behavior of ... while loop in js. let's have code like: var = [1,2,3,4,5]; var b = []; var c; {c = a[math.floor(math.random()*a.length)]; b.push(c);} while(c===4); console.log(b); which intended roll out random item array a if item not 4 . if roll several times we'll see doesn't prevent 4 getting array b . why? thought work this: roll random item array a , store c , push c b ; check if (c===4) true ; if — go paragraph 1; if it's not — log b console. where mistaking , why code work in such way? others way 'ban' item array being rolled randomly (except filtering array) if approach can't me? do while runs , checks. random number a, store in c , push b, , if c 4, loop. so if c 4, still push b, won't continue after that. you this: var = [1,2,3,4,5]; var b = []; var c = a[math.floor(math.random()*a.length)]; while (c !== 4) { b.push(c); c = a[math.floor(math.random()*a.length)]; } consol

c# - .net trace listener for each switch -

currently in application have many trace switch , boolean switch. listener configured log text file. , works. code snippet below. <configuration> <system.diagnostics> <switches> <add name="booleanswitch1" value="true"/> <add name="booleanswitch2" value="true"/> <add name="traceswitch1" value="4"/> <add name="traceswitch2" value="1"/> </switches> <trace autoflush="true" indentsize="2"> <listeners> <add name="tracetestinglistner" type="system.diagnostics.textwritertracelistener" initializedata="d:\traces\tracetesting.log" traceoutputoptions="datetime"> </add> </listeners> </trace> i want each switch logs put different log file. how can achieve that. can add listener each switch , redirect log different log files? if how this? thank h

sql server 2008 - Insert record into SQL table based on values from another table -

i have sql database access front end. trying employeeid 1 table, , insert it, along other values table. can't figure out doing wrong. not getting errors, , when @ values, there. insert command not working. know getting employeeid other table working. ideas? in advance help! private sub command666_click() dim db dao.database dim rs dao.recordset dim strsql, strsql2, strsql3 string dim st date dim st2 date dim vempid, vworkcode integer dim vhours, vhours2 double dim vdtadd date strsql = "select * tblemployees" set db = currentdb() set rs = db.openrecordset(strsql, dbopendynaset, dbseechanges) rs.movefirst while not rs.eof vempid = rs!employeeid vhours = 40 vhours2 = 8 vdtadd = date vworkcode = 1 st = dateadd("m", 6, date) st2 = dateadd("m", 7, date) if rs!startdate >= st , rs!startdate < st2 strsql2 = "insert tbltimeavailable (employeeid, noofhours, dateadded, workcode) values (@v

scala - How to share state between Akka actors? -

i have balancesheetactor defined follows: class balancesheetactor extends actor { val tradables = mutable.set[contract] } and have simple depositcontract defined follows: case class depositcontract(facevalue: double) each contract in model asset 1 balancesheetactor , liability balancesheetactor , state of contract shared between actors (i.e., each contract member of @ least 2 sets of tradables ). suppose want increment facevalue of depositcontract amount . either need to... remove old contract both sets of tradables , replace new depositcontract(facevalue + amount) . model each contract akka.agent . model each contract akka.actor (and encapsulating state). option 1 seems needlessly complicated (additionally contracts highly out of sync), option 2 seems ok need create on order of millions of contract agents , concerned memory usage. have similar concerns option 3 well. have no idea if these memory usage concerns founded. thoughts? i hoping there

excel - Return array of all matches between two ranges -

Image
ok trying take common tutorial array formula step further cannot figure out how. essentially have set of sheets values below: | sheet 1 || sheet 2 | | products(1) | product group || products(2) | data | | | || | | | 100 | 1 || 100 | abc | | 200 | 2 || 200 | def | | 300 | 3 || 200 | ghi | | 400 | 3 || 500 | jkl | | 500 | 2 || 400 | mno | sheet 1 lists parameters classify each product , uses assign each product group. products unique index key. sheet 2 tracking list of every time product run, how did. therefore product numbers may show multiple times or not @ all. i have third sheet in product number entered, group number calculated, , sheet 1 searched products group number , list returned using array formula (using tutorial ht

Editing a Python function in real-time -

i'm new python user. i've been trying setup script work -- unsuccessfully. have found that, while importing script returns fatal error, can rewrite line line in real-time. every time make error or typo, python kicks me out of continuing '...' edit mode , '>>>' mode which, limited knowledge means have start over. problem 1 function passes more 100 lines of code. if error in middle, @ stage of knowledge, have begin again. is there way pick function writing left off, before typo? if use python idle (or other ide...there tons of them listed here ), have what's called repl (read-evaluate-print-loop) make life easier! can select small part of code, run it, see effects, make edits, re-run it, run next part, etc.

sql server - Database Difference on publisher and subscriber -

i have sql server transactional replication running. server (publisher & distributor) server b (subscriber). working great. need know whether can add table subscriber in database? affect replication? must databases exact same in terms of schema etc? i need add table that's not part of publishers published articles on server b(subscriber). i need know whether can add table subscriber in database? yes, can. won't affect replication, but, example, if create table dbo.a on subscriber database first , later you'll create table same name , schema on publisher database can lost data in table dbo.a on subscriber because default new articles on subscriber drop if exists within initialize process. you can change behavior in publication properties. must databases exact same in terms of schema etc? no, must not. in transaction replication can replicate either whole tables or columns of tables.

c++ - Does libfreenect2 support Kinect v2 -

i have work kinect v2 in linux project , searching compatible libraries. unclear whether open kinect project has cracked kinect v2 yet. yes, library kinect v2. library (libfreenect2) not work older kinect (360) use libfreenect read project page here: https://github.com/openkinect/libfreenect2

c++ - Vector iterator not incremental -

Image
i'm trying implement simple menu application in qt , got point have make filter button. qt giving error , don't know how interpret it. come these 2 functions. i'll post photo of error well. code filter operation: vector<car> controller::filterbycategory(string category) { vector<car> fin; vector<car> all(repo->getall()); copy_if(all.begin(), all.end(),fin.begin(), [&](car& cc) { return (cc.getcategory()==category); }); return fin; } qt function calling filter function: void ownerwindow::filtercategory() { qstring scategory = lcategory->text(); string category = scategory.tostdstring(); vector<car> cars = ctrl->getallcars(); vector<car> fin; try { fin = ctrl->filterbycategory(category); } catch(warehouseexception& ex) { qmessagebox::information(this, "error!", qstring::fromstdstring(ex.getmsg())); } catch(...) {

ios - Is there a way to change one of parameters in OCMock and continue running the stubbed function -

hello i'm trying change parameter of function have stubbed. see in logs stub called successfully, , want change 1 of paramters , run original function. can ocmock? here's i'm doing: .... id testmgrmock = [ocmockobject partialmockforobject:testclassinstance]; ocmstub([testmgrmock addrequestwithmethod:ocmock_any path:ocmock_any parameters:ocmock_any headers:ocmock_any body:ocmock_any delegate:ocmock_any successblock:ocmock_any failureblock:ocmock_any]). anddo(^(nsinvocation* invocation){ nsstring* path = @"http://addressnotexi.st"; [invocation setargument:&path atindex:2]; // here want call "addrequestwithmethod:path:parameters:header (etc)" // on real object parameter "path" changed stri

sql - Access, Use a linked table to update a local table -

i have 2 tables , tbl2 update tbl1. tbl1 lives on end database on our network drive. contains project information, regularly updated half dozen users. tbl2 lives on remote users laptop. copy of tbl1 updates throughout day. when tries access tbl1 on vpn unusably slow. the information on remote users laptop not terribly time sensitive. i'm going have him export table network drive @ end of each day. i've trained user import tbl1 each morning , export tbl2 network drive each night. so coding part comes in @ end of day. need pull updates tbl2 tbl1. i'm trying accomplish sql query using this post guide. keep getting weird results. select tbl1.thing1, tbl2.thing1, tbl1.thing2, tbl2.thing2, tbl1.thing3, tbl2.thing3, tbl1.thing4, tbl2.thing4, tbl1.thing5, tbl2.thing5 tbl1 full outer join tbl2 on (tbl1.thing1= tbl2.thing1) , ( tbl1.thing2 = tbl2.thing2) , (tbl1.thing3 = tbl2.thing3) , (tbl1.thing4 = tbl2.thing4) , (tbl1.thing5 = tbl2.thing5) ; is possible? goi

php - SQLite3 Unable to write to database file on Amazon AWS but only in certain instances -

Image
i have setup , ec2 instance on aws , part of instance using sqlite3 database handle data. of database operations routed through single php file, single connection: function dataquery($query) { // establish database connection try { $dbh = new pdo(dbw); // try windows first $dbh->setattribute(pdo::attr_errmode, pdo::errmode_exception); } catch(pdoexception $e) { echo $e->getmessage(); $errorcode = $e->getcode(); // windows not available, try linux if('14' == $errorcode) { try { $dbh = new pdo(dbl); // try linux $dbh->setattribute(pdo::attr_errmode, pdo::errmode_exception); } catch(pdoexception $e) { echo $e->getmessage(); $errorcode = $e->getcode(); } } } // try run query try { $queryresults = $dbh->query($

hdl - Accessing wire/reg dimensions in Verilog -

in vhdl there many predefined attributes can in making code more generic, e.g.: signal sig : std_logic_vector(7 downto 0); -- ... in sig'range loop ... is there similar way access dimensions of verilog wire or reg ? of course it's possible define boundaries of each wire or reg parameter in: parameter w_upper = 7; parameter w_lower = 0; wire [w_upper:w_lower] w; but seems lot of overhead , far less elegant vhdl. i have seen systemverilog has things $bits , $size , $high , $low , verilog-2005 or earlier? verilog-2005 doesn't have equivalents vhdl attributes ( 'size , 'left , 'right , 'high , 'low , etc.). as mentioned in question, feature introduced in systemverilog, have following attributes: $dimensions , $unpacked_dimensions , $left , $right , $low , $high , $increment , $size .

javascript - D3 Arc Diagram: Tooltip on Circle Mouseover Not Displaying -

Image
i'm stuck on problem , looking pair of eyes maybe spot i'm missing. i have arc diagram i'm building , tooltip event when mouse on circles/nodes. you can see sample bl.ock here . thought work each circle needed in it's own g element, i've done. have function handles creation of tooltip: function tooltiptext(d) { return "<h5>information " + d.token + "</h5>" + "<table>" + "<tr>" + "<td class='field'>token: </td>" + "<td>" + d.token + "</td>" + "</tr>" + "<tr>" + "<td class='field'>dialect: </td>" + "<td>" + d.dialect + "</td>" + "</tr>" + "<tr>" + "<td class='field'>ime: </td>" + "<td>" + d.input_method + "</td>"

javascript - No idea why I get: Uncaught TypeError: Cannot read property '0' of undefined -

so want check spot in two-dimensional array, have no idea why chrome returns: "uncaught typeerror: cannot read property '0' of undefined". in function put() check if fieldspaces[column][row] equal empty this js-code: var empty = 0; var fieldspaces = new array(7); (var column = 0; column < 7; column++) fieldspaces[column] = new array(6); (var column = 0; column < 7; column++) (var row = 0; row < 6; row++) fieldspaces[column][row] = empty; function checkempty(c){ var top = 5; var column = c; var isempty = false; if(fieldspaces[column][0] == empty){ console.log("it empty"); } }

html - CSS background is less than div hight -

Image
help me please, can't understand result of code: <div id="wrapper-top"> <div class="wrapper"> <div id="logo">logo</div> <div id="menu">menu</div> <div id="content"> <div class="block-1-1">text</div> <div class="block-3-1">text</div> <div class="block-3-2">text</div> <div class="block-3-3">text</div> </div> </div> </div> and css file: #wrapper-top { width: 100%; background-color: gray; } .wrapper { margin: 0 150px 0 150px; } #logo { width: 100%; height: 50px; } #menu { width: 100%; height: 50px; background-color: navajowhite; } #content { width: 100%; background-color: white; } .block-1-1 { width: 100%; text-align:center; background-color: p

w3c - ConvertApi Web2Pdf missint content when mulitiple pages are concatenated -

i using convertapi web2pdf wordpress site. when use tool web2pdf api tool single url, page converts content , styling, when concatenate several %20 lose of content. i have checked pages @ validator.w3.org , removed errors, yet didn't help. has else run similar issue? problem in api, had switch apis.

powershell - Settings $_ in a script block invocation -

in complex script, have bunch calls repeat same pattern: prepare,execute,clean . only execute part different, want define once prepare , clean calls. to achieve this, i'd wrap in function, having execute part passed parameter. i tried this: function somefunc{ param( [scriptblock]$action, [int]$x, [int]$y ) write-host "before" invoke-command -scriptblock $action -pipelinevariable ($x*$y) write-host "after" } somefunc -x 2 -y 4 -action { write-host -foregroundcolor yellow "result $_" } but not works. $_ empty. how can reach goal? you can pass arguments scriptblock not through pipeline arguments in array argumentlist parameter invoke-command cmdlet. able access arguments $args variable inside 'process' scriptblock. function somefunc { param ($x, $y, $sb) write-host "before"; invoke-command -scriptblock $sb -argumentlist @("some stri

osx - Android developing from pc to Mac -

i developed apps android on pc using eclipse, installed android studio on macbook pro , done work on updating app, problem is, when tried upload google play market got 'wrong keystore' message, saying i've used different key/certificate. copied keystore pc onto mac , used same one. has had problem before? oh , did update version number etc of app.

python - Dict with same keys names -

i need dictionary has 2 keys same name, different values. 1 way tried creating class put each key name of dictionary, different objects: names = ["1", "1"] values = [[1, 2, 3], [4, 5, 6]] dict = {} class sets(object): def __init__(self,name): self.name = name in range(len(names)): dict[sets(names[i])] = values[i] print dict the result expecting was: {"1": [1, 2, 3], "1": [4, 5, 6]} but instead was: {"1": [4, 5, 6]} [edit] discovered keys in dictionary meant unique, having 2 keys same name incorrect use of dictionary. need rethink problem , use other methods avaliable in python. what trying not possible dictionaries. in fact, contrary whole idea behind dictionaries. also, sets class won't you, gives each name new (sort of random) hash code, making difficult retrieve items dictionary, other checking all items, defeats purpose of dict. can not dict.get(sets(some_name)) , create new sets

php - PHPExcel more than one image in a cell -

i need create excel document 2 col. first 1 contain multiple images 150px large , seconde 1 contain web code. reason 1 image added , file appears currupted. not sure doing wrong ... <?php include("../../init.php"); if (is_numeric($_get[groupe])){ define( 'pclzip_temporary_dir', $_config['upload']['root'].'/cache' ); // filename download $groupe = mysql_query("select * photographe_groupe id='$_get[groupe]'"); $records = "groupe - $groupe[nom].xlsx"; header('content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('content-disposition:inline;filename='.$records); $workbook = new phpexcel; $sheet = $workbook->getactivesheet(); $i=0; $select = mysql_query("select * photographe_images sid='$_get[groupe]' group `paire`"); while($photo = mysql_fetch_array($select)){ // table header if ($i=="1"){

python - RESTful API Returning Proper Errors -

i building restful api first time class project, confusing me error handling scenarios. when client request: https://localhost:8080/api/v1/user/<username> i check username variable numerous things such as: if username empty or "blank" if username alphanumerical if length of username short or long so, code looks @ moment, (it's in python, irrelevant): # grabbed username variable # if username blank, return 404 if not username: abort(404) # if username not alphanumerical, return 404 if not alias.isalnum(): abort(404) # if username length less 4 or greater 25, return 404 if len(alias) < 4 or len(alias) > 25: abort(404) returning 404 errors no means of error "identification" seems wrong me. should returning 404 error codes displaying went wrong (e.g. "the username given not alphanumerical")? should returning different http status code other 404? i incredibly confused! there many types of http

r - Difficultly filling NAs with imputed values by loop but not one-by-one -

so have matrix in r that's subset of dataframe holding little more id, grouping variable, , series of 1100 readings. i'm wanting run these readings through procedure requires spacing of values - each row (of approx 100) has 2 or 3 'missing values' day messing sensor various reasons. i'm wanting throw in loess imputation these values - 3-5% of each row generally, no more, i'm not terribly worried effect of few values other they're missing. the code i'm using below. forgive inelegance in using loop lifting, , recognize yval not necessary i'm doing, makes easier track. #take out matrix loess imputation df3mat <- as.matrix(cccsdf3[,c(3:1102)]) #generate list of time values loess generation timelist <- c(1:timevals) #use loess imputation fill values each row in df3mat matrix. (i in nrow(df3mat)){ #take each row @ time yval vector yval <- df3mat[i,] #get vector of values in yval missing missinglist <- which(is.na(yval)) #u

knockout.js - which function will be consider as view model in knockout js -

i new in knockout js. please see below code , tell me function consider view model ? there 2 function 1 cartline , other 1 cart.............which function consider view model ? see code ko.applybindings(new cart()); apply binding pointing cart function.......so mean cart() consider view model ? if yes should cartline() ? child or nested view model ? looking guidance. code taken jsfiddle http://jsfiddle.net/3bu6nybk/15/ var cartline = function () { var self = this; self.products = ko.observablearray(_products); self.product = ko.observable(1); self.price = ko.observable(1); self.quantity = ko.observable(1); self.product.subscribe(function(item){ if(!item) { self.price(0); self.quantity(0); return; } self.price(item.price); self.quantity(item.quantity); }); self.subtotal

apache - Vagrant share producing a 400 bad request -

i'm using vagrant apache2 , command vagrant share --https 443 it starts fine , provides url. when access url i'm presented 400 error: bad request your browser sent request server not understand. apache/2.4.12 (ubuntu) server @ *.vagrantshare.com port 443 i have been accessing vagrant machine using https fine, doesn't seem work vagrant share. this known vagrant share bug: https://github.com/webdevops/vagrant-docker-vm/issues/51 the workarounds i've seen discussed use custom domain or use product entirely (e.g. ngrok) create share. see bug discussion here: https://github.com/mitchellh/vagrant/issues/5493#issuecomment-159792794 vagrant share docs custom domains here: https://atlas.hashicorp.com/help/vagrant/shares/custom-domains

tsql - SQL Server - Return rows based on user role -

we developing access application sql server backend. have table has records belong division a, b or c. users belong role a, b or c. want each user see corresponding division records, columns. i've thought of 2 ways, 1 making different queries each role , then, based on user's role, change source object of form. don't know if possible retrieve sql server vba (all vba documentation i've found far quite lacking). the other solution thought implement on server, don't know how t-sql query or view fetch information needed based on user's role any ideas? ps: can't use functions or stored procedures. reason sql server have been provided has them disabled , ops won't enable them (don't know logic behind that). okay, it's been while since posted i'll post solution came in end. vba not quite necessary in case. can done views. to retrieve users roles, (inner) join table database_role_members twice database_principals one. join id (

FlywayDB ignore sub-folder in migration -

i have situation ignore specific folders inside of flyway looking migration files. example /db/migration 2.0-newbase.sql /oldscripts 1.1-base.sql 1.2-foo.sql i want ignore inside of 'oldscripts' sub folder. there flag can set in flyway configs ignorefolder=some_folder or scanrecursive=false? an example why say, have 1000 scripts in migration folder. if onboard new member, instead of having them run migration on 1000 files, run 1 script (the new base) , proceed there. alternative never sync files in first place, people need remember check source control prior migrations instead of looking on local drive. this not supported directly. put both directories @ same level in hierarchy (without nesting them) , selectively configure flyway.locations achieve same thing.

vb.net - how do I control the order of child controls when adding to my parent control? -

i have panel (call main_box) , add 20 more panels inside of it. each of child panels placed right under 1 above it. when resize form, child panels change size (like want them to), don't reposition inside parent box, need manually. i trying: dim vert_pos integer = 0 each o object in main_box.controls o.location = new point(0, vert_pos) vert_pos += o.height next but child boxes positioned out of order. not appear in same order added them parent box. how can ensure repositioned in order? what ended doing creating array; , each time added child panel main_box, added array. iterate through array instead of main_box.controls , order stays correct.

sorting - How to sort over TimeUUID field in Solr? -

accordingly mapping solr types article uuidfield type can used represent cassandra's timeuuid fields. works fine until try sort on field in solr. seems solr sorts such fields ordinary uuid. right? how sort on timeuuid columns in solr in case?

sql server - I want to dynamically change the lookup columns in look up transformer in SSIS -

Image
i want map dynamically lookup column in lookup transform ssis in task column ways change example: tablea ``````` col1 | col2 | col3 --------+-----------+--------- 1 | 2 | 3 2 | 1 | 4 3 | 2 | 1 this time lookup columns col1+col2 next day change col2+col3 i want map dynamic input column ssn depending on how lookup columns defined 1 day next, may easier make query in lookup transformation dynamic instead. check out following link: https://suneethasdiary.wordpress.com/2011/12/28/creating-a-dynamic-query-in-lookup-transformation-in-ssis/

c# - Using Auto reset event is not working as expected -

i quite new c# programming, trying achieve following result failing so. what expect -: on click event of button, want open applciation via api, run analysis , exit application. while running application have progress bar on form should keep going 0 - 100 till runanalysis() method called through api gets executed, when gets executed progress bar should show 100% , application called through should exit what happening -: the runanalysis() being executed , application exits, click event of button gets executed , progress bar moves 0 - 100 should not happen what attempt namespace trialapp { public partial class form1 : form { autoresetevent obj = new autoresetevent(false); public form1() { initializecomponent(); } etabs2015.csapmodel sapmodel; system.reflection.assembly etabsassembly; etabs2015.coapi etabsobject; int result = -1; delegate int mydelegate(); mydelegate poin

c# - Getting a pixel's color from an image in a picturebox is not working -

i trying make windows form application. in application there picture box, , user can choose color clicking on color within picture. so googled , tried things, not working correctly, so have code checking on point user clicks within picture box , setting r , g , b : private void picturebox1_click(object sender, eventargs e) { x = mouseposition.x; y = mouseposition.y; messagebox.show(string.format("x: {0} y: {1}", x, y)); coloratpoint = properties.resources.kleuren_rondje.getpixel(x, y); r = coloratpoint.r; g = coloratpoint.g; b = coloratpoint.b; } and have check color private void colorchecker() { graphics e = picturebox2.creategraphics(); solidbrush mybrush = new solidbrush(color.fromargb(r, g, b)); e.fillrectangle(mybrush, 1, 1, 100, 100); } and checking if color found en add in other picture box (for testing) private void button1

ios - How to prevent style-change on login-button -

Image
i using facebook's own api give users alternative login-method in app. i'm using own fbsdkloginbutton so. when user enters login-view in app, looks this: when user clicks button, open facebook-app (or browser, if app isn't available), , prompt user log in. after successful login, should return app. does. problem is, facebook-button looks this: i don't know why or how prevent it.. it's not end of world me, view disappear right after this, kinda annoying. i have not done button. dragged uibutton storyboard , , set subclass of fbsdkloginbutton . in code, have set btnfacebooklogin.delegate = self , implementing delegates in loginviewcontroller.h . i tried adding btnfacebooklogin.clipstobounds = yes no avail. backgroundcolor of entire button nothing. believe has button's layer, i'm reluctant search through layers , find change something. there has reason this? to clear, want style same, instead of changing transparent text and.. 'discol

Searching for sub-strings in mysql -

i know if search substring in mysql cell, can following select * table_name column_name '%search_string%'; how perform search if cell values search strings? example, if have following table, id string 1 abc 2 def 3 ghi and have string "123abc567", want able search table result id = 1. mysql statement should use, or have read row row , strstr() in program? you pretty similarly: select * table_name '123abc456' concat('%', column_name, '%'); see example: http://sqlfiddle.com/#!9/e0fce/1/0 ps. remove c++ tag because it's unrelated...

javascript - Sails JS - How to Work With Specific Model Attributes from the Associated Controller -

i'm learning javascript, node , sails, , have basic newb (i think) question couldn't find answer elsewhere. in controller, i'm trying access specific model attribute , create array includes each separate entry use in view. while can access records in model in menu/index view, can't seem work specific attribute directly in model. here's controller code in question: var menucontroller = module.exports = { manager: function(req, res) { var userid = req.session.user.id; sails.log("searching foods user: "+ userid); menu.find({ where: { userid: { equals: userid }}}).exec(function(err, records) { if(records && records.length == 0) { sails.log("no foods found user: " + userid); sails.log(err); return res.view("menu/index"); } else { var foodcategories = records.food_category; sails.log(foodcategories); var array = foodcategories.split(','); var foodcat

c++ - Lifetime of temporary objects -

i encountered following code (roughly): struct stringbuffer { stringbuffer(const char* string) {strcpy(m_buffer, string);} const char* c_str() const {return m_buffer;} char m_buffer[128]; }; std::string foobar() { const char* buffer = stringbuffer("hello world").c_str(); return std::string(buffer); } am correct in assuming after line: const char* buffer = stringbuffer("hello world").c_str(); buffer pointing pointer in deconstructed stringbuffer object? to answer question @ end, yes, buffer stray pointer. to answer more general question lifetime of temporary values, suggest read this reference says: ... temporaries destroyed last step in evaluating full-expression (lexically) contains point created... which case means once assignment buffer done, temporary object destructed.

how to import excel file to sqlite database and show the database in table view in android? -

i have been searched many question import excel file sqlite database , still not understand how create code, want show database in android table view after imported excel file .. please? before there no method available import excel file sql or sqlite db.

jquery - JavaScript incorrect time showing between two time -

i have tried show time between 2 time while page load. please check below code - var start = document.getelementbyid("start").value; var end = document.getelementbyid("end").value; function hourdiff(start, end) { start = start.split(":"); end = end.split(":"); var startdate = new date(0, 0, 0, start[0], start[1], 0); var enddate = new date(0, 0, 0, end[0], end[1], 0); var diff = enddate.gettime() - startdate.gettime(); var hours = math.floor(diff / 1000 / 60 / 60); diff -= hours * 1000 * 60 * 60; var minutes = math.floor(diff / 1000 / 60); return (hours < 9 ? "0" : "") + hours + ":" + (minutes < 9 ? "0" : "") + minutes; //settimeout(function(){hourdiff(start, end)},500); } document.getelementbyid("diff").value = hourdiff(start, end); <input id="start" value="20:00"> <!-- 08.00

Solr dataimport - pass variable to query -

i trying pass variable solr (4.10.0) server when calling dataimport full import command. i have searched around net , found several examples none of them seem working me. the url call looks likes this: " http://xx.xx.xx.xx:xxxx/solr/mycore/dataimport?command=full-import &maxid=1234 &clean=false" my query looks this: select * blah lastmod >= '2014-04-30' , ('${dataimporter.request.clean}' != 'false' or myid > '${dataimporter.request.maxid}') when call url import starts imports everything. do need use dih.request.maxid instead of dataimporter?

web - How do i link domain from one.com to digitalOcean.com? -

i have domain name bought @ one.com cant seem dns settup correctly. followed turorial digital ocean ( https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean ) instructed use dns one.com site. in tutorial ( http://www.one.com/en/support/guide/manage-your-dns-settings ) explain how set dns, dont know witch option choose. should select web forward, record, aaaa record, cname or txt records? in advance the record 1 should use. rfc 1035 address record returns 32-bit ipv4 address, commonly used map hostnames ip address of host, used dnsbls, storing subnet masks in rfc 1101, etc.

javascript - how to disable tooltip when button is disabled on click -

i've button this <asp:button class="ico-back" title="back" id="btnattritionback" runat="server" disabled="disabled"></asp:button> when focus on button shows tooltip, otherwise doesn't show. here on click event of button in javascript i'm disabling it. after losing focus doesn't hide tooltip. $("input[id$='btnattritionback']").on("click", function (e) { loadhrdata("all"); //$("#" + btnattritionback).removeattr("title"); $("#" + btnattritionback).prop("disabled", true); e.preventdefault(); }); i've tried disabling doesn't work. you need set clientidmode static in aspx markup. default, id rendered browser gets stuff put before it.

ruby on rails - StaticModel::Base undefined method column_names -

i have class region extended staticmodel::base. set data function set_data_file 'db/static/regions.yml' yes, want - have static model. , have access data region.find(1) it work. but need register class. activeadmin.register region ... end and have error - 'undefined method column_names'. add method column_names, source code activerecord's, not resolve problem because have errors (undefined method reorder , on) added methods activerecord until have error (undefined method ransack). but when call normal objects activerecord have: city(id: integer, name: string ...) and when call class region have region and can use find method - , work. and when call region.first have: <region:0x007fc6e35028d0 @attributes={"active"=>true ... }, @id=1> thanks

perl - Can't locate SOAP/Lite.pm in @INC -

i trying build ldv project following this instructions, , know nothing perl. i getting following error while running test ldv-task: normal: calling ldv-core. can't locate soap/lite.pm in @inc (@inc contains: /home/acsia/perl5/perlbrew/perls/perl-5.10.0/lib/5.10.0/x86_64-linux /home/acsia/perl5/perlbrew/perls/perl-5.10.0/lib/5.10.0 /home/acsia/perl5/perlbrew/perls/perl-5.10.0/lib/site_perl/5.10.0/x86_64-linux /home/acsia/perl5/perlbrew/perls/perl-5.10.0/lib/site_perl/5.10.0 .) @ /home/acsia/desktop/ldv/consol-tools/ldv-core/ldv-core line 7. begin failed--compilation aborted @ /home/acsia/desktop/ldv/consol-tools/ldv-core/ldv-core line 7. output of perlbrew use is :edited: currently using perl-5.22.0 output of locate soap/lite.pm is /usr/local/lib/perl5/site_perl/5.22.0/soap/lite.pm output of which perl is /usr/local/bin/perl and ldv-core file starting default #!/usr/bin/perl -w # $instrumnet = 'ldv-core'; use findbin; # prevent meaningle

date format - Oracle: group by month -

i have such problem, working oracle database. in 1 of tables there column in timestamp format 06.01.14 08:54:35 must select data grouping column month. result of query column if 06.01.14 must jan.2014 in mm.yyyy format, tried such query select to_char(ctime,'mm.yyyy') table_name but result not in date format, string format. not to_date function can me of course variation on to_char result in string format. that's does. are, think, confusing how value displayed , data type behind it. now if have date field can use trunc(ctime,'mon') which truncate first of month , leave in date format. how display you. if expecting date value not have day/hour/minute/second component - i'm afraid don't understand data type.