Posts

Showing posts from August, 2011

java - Replacing Main Fragment from its Child Fragment -

enter image description here i'm trying replace mainfragment other fragment childfragment of mainfragment . using part of code: android.support.v4.app.fragmentmanager fragmentmanager = getfragmentmanager(); fragment fragment = null; fragment = mainfragment2.class.newinstance(); fragmentmanager.begintransaction().replace(r.id.flcontent, fragment).commit(); fragmentmanager.executependingtransactions(); problem is, mainfragment get's destroyed , replacing successful, problem child of mainfragment never gets destroyed , child methods(destroy, pause, stop..) never called(i need methods). remain in memory , when getting between activities in app onresume() method of child fragment gets called. strange. i'm doing wrong here? create interface : interface mainnavigaton { void replacefragment(); } on main activity class activity exteds... implements mainnavigation

javascript - bootstrap carousel not displaying images -

my carousel not displaying images .i have 3 images stored in folder name images.i using bootstrap 4 ,let me know wrong.i wanted know if suppose insert images below 900*500 resolution. 1-ronald.jpg of 634 * 424 then 2-messi.jpg of 594 *432 , last 3-pogba.jpg of 620 * 348 resolution <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxazxuh4hwsyylfb+j125mxis6mr5fohampbg064zb+afewh94ndvacbm8qnd" crossorigin="anonymous"> <style type="text/css"> .carousel-inner > .carousel-item > img { padding-top:35px; margin: 0 auto; border-radius: 10px 10px 10px 10px; max-height: 500px; width: 750px; } .carousel-control.left, .carousel-control.right { background-image: none; } #carousel { margin-bottom: 50px; } </style> <div id="carousel-example" c

selenium - URL not typing in firefox -

i facing problem when executing selenium in eclipse. i using eclipse luna, mozilla firefox 41 , selenium 2.48.2. when try run below code, url not typing in firefox. import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxdriver; public class first { public static void main(string args[]) { webdriver driver = new firefoxdriver(); driver.get("http://www.google.com"); } }

reporting services - SSRS Include a sub report into a main report -

i have main report , sub report have common id between them , different data sets . steps used not able see preview of report 1) drag sub report main report.right click on sub report properties , select sub report , in parameters giving parameter used sub report on left side , value main report data set, page keeps on loading , not lead anything can tell me how solve

python - List of lists changes reflected across sublists unexpectedly -

i needed create list of lists in python, typed following: mylist = [[1] * 4] * 3 the list looked this: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]] then changed 1 of innermost values: mylist[0][0] = 5 now list looks this: [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]] which not wanted or expected. can please explain what's going on, , how around it? when write [x]*3 get, essentially, list [x, x, x] . is, list 3 references same x . when modify single x visible via 3 references it. to fix it, need make sure create new list @ each position. 1 way is [[1]*4 n in range(3)] which reevaluate [1]*4 each time instead of evaluating once , making 3 references 1 list. you might wonder why * can't make independent objects way list comprehension does. that's because multiplication operator * operates on objects, without seeing expressions. when use * multiply [[1] * 4] 3, * sees 1-element list [[1] * 4] evaluates to, not [[1] * 4 express

php - dynamically loading javascript fails, but innerHTML does -

i've wrote script in javascript file , innerhtml refreshes time time setinterval(activeload,1000); function activeload() { activediv.innerhtml=""; scriptsrc.src="http://localhost/mypro/pro/activeuser.php"; for(i=0;i<=activeuser.length;i++) { if(activeuser[i]!=null) activediv.innerhtml+="<p onclick='dial(' " + activeuser[i] +" ' )'> " + activeuser[i] +"</p><br>"; } scriptsrc.src=''; } in above script, innerhtml modifying, src attribute of script not changing... js file loaded is <script src="http://localhost/mypro/pro/activeuser.php" id="scriptsrc" type="application/javascript"></script> this php file refreshes every 5 secs , accurate in information. need in loading javascript perfectly although it's not clear me want array comes activeuser.php , seems ajax best bet bring in

Java IF statements not working properly -

there problem if statements. error shows problem me figure out what's wrong ? main task motor insurance company has 4 categories of insurance based on age , gender of applicant. this code : string gender, age; char group; int genderint, ageint; gender = joptionpane.showinputdialog("please specify gender(1 male, 0 female)"); age = joptionpane.showinputdialog("please enter age"); genderint = integer.parseint(gender); ageint = integer.parseint(age); if (gender = 0 || 1 && age = > 18 && < 26) { group = "category a"; } else if (gender = 0 && age = > 27 && < 60) { group = "category b"; } else if (gender = 1 && age = > 27 && < 60) { group = "category c"; } else if (gender = 0 || 1 && age = > 60) { group = "category d"; } else if (gender = 0 || 1 && age = < 18) { joptionpane.showmessagedialog(null, "sorry, you

android - align a text view below a scroll view -

i using following layout hierarchy: linearlayout ....linearlayout ....... textview ....relativelayout ..........textview ....scrollview ....place want fixed bottom text view i read on - needed enter following attribute scrollview: android:layout_weight="1" this ensured bottom text view ( intended fixed ) shown. so while works - problem - if have less content in scroll view ( content populated dynamically ) - bottom text view climbs leaving making real ugly. what want have bottom view fixed - irrrespective of content of scroll view. here layout : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <linearlayout style="@style/examtitlebar" > <imagebutton

c# - Sum method extension for IEnumerable<TimeSpan> -

edit: sorry confusion concerning names of variables. totalhours , hours indeed timespans , i'm trying sum timespans, not hours property of timespan. i'm using sum hours column(of type timespan) in table: totalhours = maingridtable.select(x => x.hours).aggregate((x,y) => x.add(y)); i've tried making sum extension ienumerable doesn't work: public static timespan sum<tsource>(this ienumerable<tsource> source, func<tsource, timespan> selector) { return source.aggregate(((t1, t2) => t1.add(t2)); } i've searched .net source code , found existing sum methods returned as: return enumerable.sum(enumerable.select(source, selector)); i tried making non-generic sum extension enumerable this, not getting recognized above return statement , keeps asking decimal argument. public static timespan sum(this ienumerable<timespan> source) { timespan sum = new timespan(0, 0, 0); foreach (ti

javascript - Confirm before delete -

below want confirm before deleting record, problem here whether select ok or cancel confirmation box record gets deleted on both, secondly not getting redirected required page after deletion. <script type="text/javascript"> function confirmdelete(){ if (confirm("delete account?")){ window.location='mains.php'; } else { // nothing } } </script> if(isset($_post['submit'])){ $que=$db->prepare("delete blogs id = :id"); $que->execute(array(':id'=>$postid)); } <form method="post"> <input type="submit" name="submit" value="delete" onclick="confirmdelete()" /> </form> so delete button submit form can change html code of form to <form action="mains.php" method="post" onsubmit="return confirmdelete()"> <input type="submit" name="submit" value="delete"

vb.net - How to redirect to full image view page by clicking a thumbnail in asp.net -

i have asp page home.aspx have many thumbnails . each thumbnail in image button. want if user clicks thumbnail user should redirected details.aspx has full size image , description item. my approach when user click thumbnail, click event stores image name in session , redirects details.aspx now details.aspx sets image control's url taking name session... plz tell me approach .. if not... suggest me anyother... if yes plz tell me how can store image name in session.. image url "~thumbnails/image1.jpg" how can image name "image1.jpg" url string , store seasion.. thanks

Google Sheets/Regex - How to pull all numbers that start with # -

Image
i have google sheet cell reads: ticket no. #3223 ticket no. #2334 ticket no. #4005 is there way pull numbers starting #, not include #? results example: 3223 2334 4005 thank assistance yes can use this: =regexreplace(a1,"(\d+)(\d+)","$2"&char(10)) the parenthesis capture group doing saying replace non-digits \d+ in first capture group, digits \d+ in second capture group. char(10) @ end gives new line. if want them in separate cells can change &char(10) ; , use split , transpose stack them: =transpose(split(regexreplace(a1,"(\d+)(\d+)","$2;"),";"))

C#-Error 26- Locating Server/Instance Specified -

i attempting run program gets data remote sql server, when run program debugger says "error locating server/instance specified" i searched web , stack overflow , tried many things, nothing worked! what doing wrong here? private void txtsearch_click(object sender, eventargs e) { sqlconnection conn = new sqlconnection("server=.\\mssqlserver;attachdbfilename = c:\\program files\\microsoft sql server\\mssql11.mssqlserver\\mssql\\data\\education.mdf; database= education;trusted_connection=yes;"); datatable dt = new datatable(); sqldataadapter sda = new sqldataadapter("select * education nationalkey "+ txtnationalkey.text, conn); sda.fill(dt); datagridview1.datasource = dt; } i tried mssql11,sql express , many other format of string. opened udp port 1434,tcp port 1433 , 7200 too. .\\ in connection string refer local machine. set ip or machine name of sqlserver machine.

javascript - Rendr how to pass model to subview in RendrJS isomorphic framework -

assume i'm building blog home page renders list of blog posts. question how pass model each child post view? i have index.hbs iterating through collection {{#foreach models}} {{view "post_view" model=value model_name="story"}} {{/foreach}} i have post_view.js var baseview = require('./base'); module.exports = baseview.extend({ classname: 'post_view', initialize: function() { console.log(this.model); //undefined console.log(this.options.model); //undefined on client, logs model attributes on server } }); module.exports.id = 'post_view'; but appears model isn't set inside post_view.js. if {{json value}} inside {{foreach}} loop can see jsonified output printed. need pass model, need manually construct inside view? thanks! i don't have reputation comment, isn't answer. when subview initialized model isn't there yet. it'll there postrender() , should there ge

php - Serial port access denied -

i running apache web server on raspberry pi. have python code executes in index.php file follows: <?php system("python /home/pi/python/foobar.py") ?> the python script opens serial port, so: ser = serial.serial() ser.port = "/dev/ttyusb0" when run python script command line on raspberry pi, works perfectly. however, when browse site on computer, error message: [errno 13] permission denied: '/dev/ttyusb0' i have done research , found people run error because user doesn't belong dialout group. when using raspberry pi, belong it, , assume on computer, don't. in summary, how permission access serial port on raspberry pi server?

php - Separating the non-numeric part of an alphanumeric string -

i have set of alphanumeric strings, each beginning non-numeric characters , ending numbers, want able separate non-numeric parts numeric parts, assuming number of characters constant each string, have been easy have strings abc123, abcd456, etc. i this: <?php $strarray = array(); $strarray[] = '123abc'; $strarray[] = 'abc123'; $strarray[] = 'abcd456'; $strarray[] = 'abc4567'; $strarray[] = 'abcd4567'; foreach ($strarray $str){ preg_match('/^([a-za-z]+)([0-9]+)$/', $str, $matches); if (count($matches)===3){ $alphapart = $matches[1]; $numericpart = $matches[2]; var_dump($alphapart); var_dump($numericpart); } else{ echo 'no match: ' . $str; } } ?> i prefer more specific definition of pattern for. , suspect preg_split worse approach, performance wise. @ least, consider overkill if there 2 parts split string int0.

css - google map z-index issue -

i know posting links site considered bad , should explain issue dont know issue is. have never experienced before. page: http://chefs2call.co.uk.gridhosted.co.uk/ scroll bottom, find google map, inside div #wpgmza_map there overlay div creating blue tint map, div (.details-box inside .container) should sit ontop of map , overlay. currently overlay working, details box doing odd, background underneth google map content ontop (still under overlay). as far can tell z-index correct not playing ball. ideas why? or how might fix it? according w3school : note: z-index works on positioned elements (position:absolute, position:relative, or position:fixed). so give position relative .contact-us .container .contact-us .container { z-index: 10; position: relative; }

ruby on rails - Uniq method active record ordering -

when use .uniq (active record query method), way ordening result in array. need remove ordering when use uniq. i need keep order using .uniq method, how can solve this? without .uniq : [#<coupon:0x0000001cadced0 id: 838882461, name: "how_to_code_50", token_type: "manual", value: 50, quantity: 5, available_until: sat, 15 jul 2017 18:01:24 utc +00:00, percentual: true, school_id: 1, created_at: fri, 15 jul 2016 18:01:25 utc +00:00, updated_at: fri, 15 jul 2016 18:01:25 utc +00:00>, #<coupon:0x0000001cadc408 id: 922059944, name: "how_to_code_70", token_type: "manual", value: 70, quantity: 5, available_until: sat, 15 jul 2017 18:01:24 utc +00:00, percentual: true, school_id: 1, created_at: fri, 15 jul 2016 18:01:25 utc +00:00, updated_at: fri, 15 jul 2016 18:01:25 utc +00:00>, #<coupon:0x0000001cae3bb8 id: 469697148, name: "learn_ruby_20", token_type: "manual&qu

reCAPTCHA : Grey out Submit button until backend interaction is finished -

i've integrated recaptcha , working fine, except when users quick click submit button right after checking "i'm not robot" checkbox. takes quite time recaptcha register user action via ajax, , if click on submit quickly, g-recaptcha-response missing, , validation fails. hence question: how grey out submit button until g-recaptcha-response value available? <form id="capform" action="/captchaverify" method="post"> <div class="g-recaptcha" data-sitekey="..."></div> <p> <input id="capsubmit" type="submit" value="submit"> </form> i ended using data-callback attribute described in documentation : <form action="/captchaverify" method="post"> <div class="g-recaptcha" data-sitekey="..." data-callback="capenable" data-expired-callback="capdisable

php - How can I get the Plain text AND the HTML of a DOM element created from XML? -

we have thousands of closed caption xml files have import database plain text, preserve html markup conversion cc format. have been able extract plain text quite easily, can't seem find correct way of extracting raw html well. is there way accomplish " ->htmlcontent " in same way ->textcontent works below? $ctx = stream_context_create(array('http' => array('timeout' => 60))); $xml = @file_get_contents('http://blah-blah-blah/16th.xml', 0, $ctx); $dom = new domdocument; $dom->loadxml($xml); $ptags = $dom->getelementsbytagname( "p" ); foreach( $ptags $p ) { $text = $p->textcontent; } typical <p> being processed: <p begin="00:00:14.83" end="00:00:18.83" tts:textalign="left"> <metadata ccrow="12" cccol="8"/> (male narrator)<br></br> 16th , 17th centuries<br></br> formative 200 years </p> success

javascript - How to get pixel position -

Image
i feel dumb asking this, bear me. know formula pixel position in linear array: pos = (y * width + x) * 4 which works fine. jsfiddle . before image/table linearized, same formula doesn't work. need use (let's discard rgba simplicity) pos = (y-1) * width + x why that? i'm missing simple. update: knew simple. silly me. in javascript pixel coordinates start @ 0, same coordinate system. pixel referenced top left corner, first pixel @ (0,0) , next going right (1,0) (2,0) , on. pixel below @ (0,1) give coordinates relative origin (0,0). we give sizes counts. when using width , height pixel counts , start @ 1 when count. 100th pixel on row 99. same 21th century in year 2015. so no need subtract 1 pixel coordinates.

ruby - Query Mongoid for all circle areas that include a given point -

let have 2 classes: class cirle include mongoid::document field :lat, type: float field :lon, type: float field :radius, type: integer end class point include mongoid::document field :lat, type: float field :lon, type: float end how can find circles include given point? i'm not familiar mongoid , perhaps following help. suppose: circles = [ { x: 1, y: 2, radius: 3 }, { x: 3, y: 1, radius: 2 }, { x: 2, y: 2, radius: 4 }, ] and point = { x: 4.5, y: 1 } then circles containing point obtained of math::hypot : circles.select { |c| math.hypot((c[:x]-point[:x]).abs, (c[:y]-point[:y]).abs) <= c[:radius] } #=> [{ x: 3, y: 1, radius: 2 }, { x: 2, y: 2, radius: 4 }] edit: improve efficiency @drenmi suggests: x, y = point.values_at(:x, :y) circles.select |c| d0, d1, r = (c[:x]-x).abs, (c[:y]-y).abs, c[:radius] d0*d0 + d1*d1 <= r*r end

How to generate random IPv6 in C#? -

i'm new coding. need know how generate random ipv6 in c sharp. found code generated random ipv4, how can alter ipv6? static string generateip() { // generate ip in range [50-220].[10-100].[1-255].[1-255] return rng.next(50, 220).tostring() + "." + rng.next(10, 100).tostring() + "." + rng.next(1, 255).tostring() + "." + rng.next(1, 255).tostring(); } } class rng { private static random _rng = new random(); public static int next(int min, int max) { return _rng.next(min, max); } what constraints around generated address? if none, it's pretty simple. should work: byte[] bytes = new byte[16]; new random().nextbytes(bytes); ipaddress ipv6address = new ipaddress(bytes); string addressstring = ipv6address.tostring();

WSO2 API Manager - Error changing admin password -

i have 2 stores, 2 publihser, 2 gateway workers, 1 gateway manager working svn synchronizer. when i'm using default user , passaword (admin:admin) everething works weel. when change using [1], , try publish api, receve error: tid[-1234] [am] [2016-07-15 15:45:29,735] info {org.apache.synapse.mediators.builtin.logmediator} - status = message dispatched main sequence. invalid url., resource = / at publisher node shows "sample api deploying" forever.

Combine multidimensional array in PHP -

this question has answer here: concatenate values of n arrays in php 4 answers any tips on how this? have array this: array ( [a] => array(1,2) [b] => array(4,5) [c] => array(y,z) ) and want multiply keys result this: array ( [0]=> array ( [a]=1 [b]=4 [c]=y ) [1]=> array ( [a]=1 [b]=4 [c]=z ) [2]=> array ( [a]=1 [b]=5 [c]=y ) [3]=> array ( [a]=1 [b]=5 [c]=z ) [4]=> array ( [a]=2 [b]=4 [c]=y ) [5]=> array ( [a]=2 [b]=4 [c]=z ) . . . where combinations of keys present. number of keys , elements variable, , it's important preserve keys.

swift - PromsieKit + Alamofire for loading paged HTTP Data -

i migrating code restkit alamofire. use magicalrecord + alamofireobjectmapper map json coredata objects. i faced following situation: my data lives @ url: http://domain.com/api/resources?start=xx&limit=yy now have this: download first page of data given url using page-size of 50 if number of loaded objects equal page-size increment start parameter page size if number less page size combine loaded objects , return them callee. in previous non-alamofire example did use recursion promisekit guess have additional chaining of promises rather recursion of method calls. so far have done simple chaining of promises conditional looped chaining , how implement using promisekit bit of mystery me. i did come approach seems work fine. however, have feeling more concise better answers or comments welcome. i decided combine recursion , promises (due lack of better solutions). passing along currentpromise chained further more pages need loaded. the first method

Elki plot cluster points directly from java -

is possible plot elki's cluster results graph directly using elki? don't see test cases http://elki.dbs.ifi.lmu.de/browser/elki/elki/src/test/java#de/lmu/ifi/dbs/elki this. know it's possible plot points using java wanted using elki. please see class exportvisualizations generate svg plots. http://elki.dbs.ifi.lmu.de/browser/elki/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/exportvisualizations.java visualizations in "addon/batikvis" module, because of apache batik dependency. to display svg file, use apache batik.

java - How to make a timepicker pop up when edittexts is clicked? -

heloo guys have been searching stackoverflow many days haven't found out solution. either question asked contents out of date can't implemented. want make timepicker pop when edit text clicked. please me in doing this. thanking you simple implementation - use edittext.setonclicklistener(new onclicklistener) button since method on view 's. make launch timepicker , after hours selected when finished declare in primary activity onactivityresult and `edittext.settext("whatever like"). it's simple.

Should I use Android tab layout for long lists? -

i have display long lists of job names each letter of alphabet. each list come database. tab layout appropriate? thanks patrick! going use viewpagerindicator swipe across alphabet, , use recyclerview show long lists.

ruby on rails - ActiveRecord where query on grandchildren's attributes -

user has_many plans plan has_many plandates plandates has attr :ddate date week = [array of dates in given week] given that, i'd constructing query finds unique user_ids of users have plan has plandate in given week. so far have this: week_users = user.joins(plans: :plan_dates).where.not(id: 246).where("plans.plan_dates.ddate >= ?", week.first).where("plans.plan_dates.ddate <= ?", week.last).uniq => pg::undefinedtable: error: invalid reference from-clause entry table "plan_dates" line 1: ..." = "plans"."id" ("users"."id" != 246) , (plans.plan... ^ hint: there entry table "plan_dates", cannot referenced part of query. : select distinct "users".* "users" inner join "plans" on "plans"."user_id" = "users"."id" inner join "plan_dates" on "pl

html - In Bootstrap 3, how can I turn a row of columns into a dropdown in mobile view? -

i have row of 5 graphics text on them. in mobile view, want set media query 5 graphics turn dropdown text. example, image 1 says "personal capability", image 2 says "leading change", etc. on mobile view, want graphics go away , dropdown have options "personal capability", "leading change", etc. my html: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" /> <div class="row" style="margin:1%"> <div class="col-xs-1"> </div> <!--end col-sm-1--> <div class="col-xs-2"> <a href="#"> <img src="http://placehold.it/150x150" class="img-responsive" title="personal capability" style="border:0"> </a> </div> <!--end col-sm-2--> <div class="col-xs-2"> <a href="#&

loops - JavaScript: Perform a chain of promises synchronously -

i have request promises need perform on loop, like: var ids = [1,2,3]; dopromise(1).then(function(){ dopromise(2).then(function(){ dopromise(3); } }) the problem never know how many elements in array, need dynamic pattern. possible mix sync , async worlds, 1 request active @ moment (sequence being not important)? a classic way iterate on array sequentually, calling async operation on each array element using .reduce() , chaining initial promise shown below: the problem never know how many elements in array, need dynamic pattern. you can use chaining of promises sequence them 1 after. this, useful use .reduce() iterate array since offers right type of iteration keeps track of accumulated value (a promise in case) 1 iterates array. make array iteration scheme work using variables, lines .reduce() : var ids = [1,2,3,4,5,6,7]; ids.reduce(function(p, item) { return p.then(function() { return dopromise(item); }); }, promise.resolve()).

How do I get the Average response time in Jmeter 3.0 Dashboard -

in jmeter 3.0 report dashboard statistics table appears missing average response time column. min, max, 90th pct, 95 pct , 99 pct response times along label, #samples, ko(?), error%, throughput , kb/sec columns present, average not. the statistics table in documentation @ http://jmeter.apache.org/usermanual/generating-dashboard.html shows average missing. how generate average response time in report dashboard statistics table? average response time not available in report misleading metric. of 3.0 not here, may added in future if many people ask it, see: https://jmeter.apache.org/issues.html

Mark node_modules as excluded by default in webstorm 10 -

every time download project github run npm install, triggers reindex on to-be-created node_modules folder. indexing slows computer way down. ugly workaround create empty node_modules folder, exclude it, run npm install. how can disable indexing node_modules folder in every project default? webstorm meteor projects .meteor/local , assume it's possible. we suggest excluding folder if it's used auxiliary purposes (running grunt/gulp/karma, etc.). can't exclude default, users developing node.js applications need have completion/types resolving working node_modules. if need being excluded projects default, add node_modules ' ignore files , folders ' list in settings/editor/file types update: since 2016.x, node_modules auto-excluded default. direct dependencies listed in package.json set javascript library completion

windows php exec apache -

windows 10, php 5.6 mod, apache 2 service in browser dont see exec() return value <?php exec("python c:\script.py", $output); var_dump($output); if change command using "python" smth "dir" works , return results <?php exec("dir", $output); var_dump($output); if run python script command line works expected > python c:\script.py if run php script command line works expected , exec return required results python script > php -r "exec('python c:\script.py', $output); var_dump($output);" i suppose problem related apache permissions or php permissions python.exe ? may smth. else ? advise me pls , explain how change permissions im not familiar windows not user friendly :d kidding :)

javascript - Save data values from an input into an multidimensional array -

var dataarray = []; dataarray.push({ items: [] }); var items = $('#services_hidden').val(); var itemsarray = items.split(","); console.log("itemsarray: " + itemsarray); $.each( itemsarray, function( index, value ){ dataarray[0].items.push(value); }); console.log("dataarray " + json.stringify(dataarray)); this way want save data in array reading input value this: <input id="services_hidden" value="item1,value1,item2,value2,item3,value3" /> so there can multiple items assigned specific value. @ moment looks wrong because it's saved items not seperated each other: dataarray [{"items":["item1","value1","item2,"value2"]}] but want (i hope show correctly): dataarray [{"items":{"item1:value1"},{"item2:value2"}}] so parent items , every 2 values in #services_hidden.val() seperated comma should create key:value pair. what have c

java - How to generate a multidimensional array with unknown amount of dimensions -

i want define array n dimensions. should matrix n dimensions. possible in java define such variable? example can use method(int[]...) to give multiple arrays method, can like int[]... variable; to generate n-dimensional array? it isn't possible create dynamic-dimensional array in java. however, can accomplish kind of task using nested objects!

c++ - gdb: interrupt running process without killing child processes -

i have process (call process a) kicks off several instances of process b. when debugging process in gdb, if use ctrl+c pause process sigint, child b processes killed, have restart whole thing once i'm done debugging process a. there way prevent gdb sending sigint child processes, killing them (at least assume that's what's happening)? if so, it? note not have source code process b (so cannot add code handle sigint). process interfaces in c++. try signal(sigint, sig_ign); in a. according man signal (emphasis mine), a child created via fork(2) inherits copy of parent's signal dispositions. during execve(2), dispositions of handled signals reset default; the dispositions of ignored signals left unchanged .

python 2.7 - pandas: multi-x-axis to multi-y-axis plot using chart -

Image
i've data-frame below period backed closed failed successful total 0 2015_november 1 0 0 7 8 1 2015_december 0 0 0 30 30 2 2016_january 0 1 0 46 47 3 2016_february 0 0 2 72 74 4 2016_march 0 1 0 56 57 5 2016_april 1 0 0 52 53 6 2016_may 2 4 1 50 57 7 2016_june 2 2 2 102 108 8 2016_july 0 0 0 10 10 10 grand_total 6 8 5 425 444 i can plot fine using period x-axis , backed , closed , failed , successful y axis using following code. # create chart object. chart = workbook.add_chart({'type': 'column'}) # configure series of chart dataframe data. col_num in range(2, len(df3.columns) ): chart.add_series({ 'name': ['modified_data', 0, col_num], 'categories': ['modified_data', 1, 1, (len(df3.index) - 1 ), 1], # rows , columns 'values': [

php - Laravel routing form with method get -

i'm using laravel 5.1 , have problem routing. currently, have on routes.php route::get('/', 'articlesitecontroller@index'); route::get('article/search/{text}', 'articlecontroller@search'); route::get('article/{url}', 'articlecontroller@show'); route::get('/{url}', 'pagecontroller@index'); routes being redirected except search wherein use articlecontroller@show route. on homepage, have search form. <form class="form-horizontal" action="http://example.com/article/search/" method="get"> <input type="text" name="txtsearch" class="form-control" placeholder="search for..."> <span class="input-group-btn"> <button class="btn btn-primary" type="submit">go!</button> </span> </form> it redirects url: http://example.com/article/search/?txtsearch=test (whic

is method overloading is possible in this case -

i assume function overloading since has diff type of parameter .my question is two functions, has diff type of parameter, diff return type considered function overloading? public class header { public int addtwonumbers(int a, int b){ return a+b; } public double addtwonumbers(double a, double b){ return a+b; } independently of programming language, method overload occurs when 2 or more methods have same identifier while parameters different either in number, order , type. for example: // overloading public void x(int a, double b) { } public void x(double a, int b) { } in case, addtwonumbers overloaded because 2 methods share same identifier while parameters have different types.

numpy - FFT iOS double the values? -

hi running fft function in simulator on ios platform like -(matrix*) spectraldensitywithvec:(matrix*) vector { nslog(@"vector:%@",vector); int samplesize = [vector rows]; double *r = [vector array]; // arc handle memory float * f = (float*) malloc(samplesize * sizeof(float)); (int = 0;i< samplesize;i++) { f[i] = r[i]; } // working 128 samples 2^7 // 7 vdsp_length log2n = log2([self nextpowerof2withnumber:samplesize]); fftsetup fftsetup = vdsp_create_fftsetup(log2n,fft_radix2); int nover2 = samplesize/2; complex_split a; a.realp = (float *) malloc(nover2*sizeof(float)); a.imagp = (float *) malloc(nover2*sizeof(float)); vdsp_ctoz((complex*)f, 2, &a, 1, nover2); vdsp_fft_zrip(fftsetup, &a,1 ,log2n, fft_forward); matrix* psd = [matrix matrixofrows:samplesize/2 columns:1]; matrix* fftresult = [matrix matrixofrows:samplesize columns:1]; // obtain imaginary / real pa

sql - Access 2013: Pivot multiple columns -

i have strange access database table need pivot before using tableau. i'm using access 2013. data totally fake structure right. there 200 files, 1500 runs each. have 50 years of metrics. have 10 metrics per file/run. +--------------------------------------------------------+ | datatable | +-------------+--------------+------+------+------+------+ | fileidrunid | metric | 1999 | 2000 | 2001 | 2002 | +-------------+--------------+------+------+------+------+ | 00000100001 | breakfast | 45 | 47 | 48 | 49 | | 00000100001 | lunch | 27 | 37 | 50 | 99 | | 00000100002 | breakfast | 45 | 47 | 48 | 49 | | 00000100002 | lunch | 27 | 37 | 50 | 99 | | 00000200001 | breakfast | 45 | 47 | 48 | 49 | | 00000200001 | lunch | 27 | 37 | 50 | 99 | | 00000200002 | breakfast | 45 | 47 | 48 | 49 | | 00000200002 | lunch | 27 | 37 | 50 | 99 | +---

c++ - glCreateShader causes EXC_BAD_ACCESS -

i have project in opengl , i'm trying load shaders. use gluint shader=glcreateshader(shadertype); that. problem is, when tries run line exc_bad_access (code=1, address=0x0) error (in xcode). i found answers might not have initialized glfw, or glew. seems works fine. initialization code: if (!glfwinit()) { fprintf(stderr, "couldn't initialize glfw.\n"); exit(exit_failure); } glfwwindowhint(glfw_context_version_major, 3); glfwwindowhint(glfw_context_version_minor, 3); glfwwindowhint(glfw_opengl_profile, glfw_opengl_core_profile); glfwwindowhint(glfw_opengl_forward_compat, gl_true); glfwseterrorcallback(errorcallback); glfwwindow* window = glfwcreatewindow(width, height, "opengl test", nullptr, nullptr); if (!window) { fprintf(stderr, "couldn't create window.\n"); glfwterminate(); exit(exit_failure); } glfwmakecontextcurrent(window); glfwswapinterval(1

Changing IBOutlet UIObject in ViewController from another class using Objective C (iOS) -

i'm beginner in ios development , cannot part working. objective simple: have class named tcpcomm connects server , sends data periodically. in storyboard have view containing buttons , textfield. idea change state of iboutlet uibuttons , uitextfield based on received data server (from class). i have tried using properties in different ways none of them worked. any on best way please? the best way achieve using delegates. in tcpcomm header file declare protocol @protocol tcpcommdelegate <nsobject> -(void)callbackmethod; @end in interface declare public property @property (nonatomic, weak) id<tcpcommdelegate> delegate; now, call method declared in protocol whenever received data in tcpcomm class below if(delegate && [delegate respondstoselector:@selector(callbackmethod)]) [delegate performselector:@selector(callbackmethod)]; now, in viewcontroller class make sure imported tcpcomm class , accepts tcpcommdelegate protocol

java - "Bad class file magic" from setting up Android Studio for NDK -

i'm setting project work androids ndk . have use experimental gradle plugin. gradle syncs without errors , make without errors. when try 'run app' gradle gives error message: unexpected top-level exception: error:com.android.dx.cf.iface.parseexception: bad class file magic (cafebabe) or version (0034.0000) @ com.android.dx.cf.direct.directclassfile.parse0(directclassfile.java:472) @ com.android.dx.cf.direct.directclassfile.parse(directclassfile.java:406) @ com.android.dx.cf.direct.directclassfile.parsetointerfacesifnecessary(directclassfile.java:388) @ com.android.dx.cf.direct.directclassfile.getmagic(directclassfile.java:251) @ com.android.dx.command.dexer.main.parseclass(main.java:764) @ com.android.dx.command.dexer.main.access$1500(main.java:85) @ com.android.dx.command.dexer.main$classparsertask.call(main.java:1684) @ com.android.dx.command.dexer.main.processclass(main.java:749) ... 19 more from previous ques

Jquery calling function to parent element -

i have got html <div class='aname'> <div class='cllt'> <img src='../img/close.png' class='cl' /> <div class='drag'> <img src='../img/dr.png' class='dr' /></div> </div> </div> and jquery function function handle_mousedown(e){ window.my_dragging = {}; my_dragging.pagex0 = e.pagex; my_dragging.pagey0 = e.pagey; my_dragging.elem = this; my_dragging.offset0 = $(this).offset(); function handle_dragging(e){ var left = my_dragging.offset0.left + (e.pagex - my_dragging.pagex0); var top = my_dragging.offset0.top + (e.pagey - my_dragging.pagey0); $(my_dragging.elem) .offset({top: top, left: left}); } function handle_mouseup(e){ $('body') .off('mousemove', handle_dragging) .off('mouseup', handle_mouseup); } $('body')

eloquent - How to select one column clumn from table and all records from relation table [Laravel 5] -

i have eloquent query this: project::with('tasks')->get([]); i need take projects table 1 coulmn 'name' , tasks wana all... anyone know how acomplish it? in order able load tasks, need load project's id: $projects = project::with('tasks')->get(['id', 'name']);

php - How to setup an efficient way to save volatile information to a database -

i working on web service following output (which partially works) result api request. request i built api accepts following request: post http://server.com/v1/requests/" parameters send on in message body. response status-code: 200 ok { "transaction_id": "12345", "status": "processing" } table: requests this creates new request on server in table called requests . table consists of fields (simplified): transaction_id -> string status -> int i have table users in system table: users this table holds info users in system registered. user_id -> string latlng -> float search users nearby request location the algorithm have follow: when send request server, starting search nearest 3 users in range of request made. search being performed on users table , returns array of users near location searching (code not being displayed, works fine). this array of users sorted distance (nearest farest

ruby on rails - Completed Active Record -

i recieved task: add method user model class called completed count, which: • accepts user parameter • determines number of todoitems user has completed using aggregate query function – (hint: looking count of todoitems associated specific user completed:true) • returns count class user < activerecord::base has_one :profile, dependent: :destroy has_many :todo_lists, dependent: :destroy has_many :todo_items, through: :todo_lists, source: :todo_items, dependent: :destroy validates :username, presence: true def get_completed_count todo_items.length end end does can explain complete method does? thanks, michael. so wrote "accepts user parameter" should following: def self.get_completed_count(user) user.todo_items.where(completed: true).count end and can call it: user.get_completed_count(user) but above code doesn't make sense because better instance method: def get_completed_count self.to

asp.net mvc - Saving the value from dropdown to entity framework MVC -

i trying save values dropdownlist database using mvc 5 + entity framework. values dropdownlist taken db (and displayed), when saving web entry value of ordersourcelist null , ordersourceid = 0 model public class orderfullmodel { [display(name = "ordersource")] public ilist<selectlistitem> ordersourcelist {get;set;} public int ordersourceid { get; set; } } controller public actionresult create() //this returning right dropdownlist { var ordersources = _repository.all<ordersource>().orderby(m => m.nameru).tolist(); viewbag.myordersources = new selectlist(ordersources, "id", "nameru", 0); return view(); } view @html.labelfor(m => m.ordersourcelist) @html.dropdownlistfor(m => m.ordersourcelist, (selectlist)viewbag.myordersources) the dropdownlistfor helper expects expression value in list want display/set, so: @html.dropdownlistfor(m => m.ordersourceid, (selectlist)viewbag.myorder