Posts

Showing posts from February, 2014

Enable HTTP2 with maven-jetty-plugin -

i've enabled http/2 connector on ssl jetty. when try connect browser 'err_ssl_protocol_error' error. if switch http/1.1 connector works fine. here jetty configuration files: <!-- ============================================================= --> <!-- configure jetty server instance id "server" --> <!-- adding http connector. --> <!-- configuration must used in conjunction jetty.xml --> <!-- ============================================================= --> <configure id="server" class="org.eclipse.jetty.server.server"> <new id="httpconfig" class="org.eclipse.jetty.server.httpconfiguration"> <set name="securescheme">https</set> <set name="secureport"><property name="jetty.secure.port" default="8443" /></set> <set name="outputbuffer

windows phone 8 - How to prevent rotating of a single element on page in WP8.1 universall app? -

i need disable auto rotation (when device orientation changed) 1 single element on page. can disable in app by: windows.graphics.display.displayinformation.autorotationpreferences = displayorientations.portrait; but not want. how can that? cannot disable rotate individual item. if application changes screen orientation rotated elements. if track event screen rotation, , resize element in opposite direction. don't think it's solution.

objective c - Unable to show child view (iOS view container) -

Image
in ios application, have main view controller 3 buttons, work tab bar: when click 1 of buttons, new view controller invoked. tried implement via container view containers, tried following guide ( http://www.thinkandbuild.it/working-with-custom-container-view-controllers/ ) , invoke presentdetailcontroller method in viewdidload of main controller. actually, no views showed: can me figuring out why? thanks. viewcontroller.h #import <uikit/uikit.h> @interface viewcontroller : uiviewcontroller @property (weak, nonatomic) iboutlet uibutton *btnone; @property (weak, nonatomic) iboutlet uibutton *btntwo; @property (weak, nonatomic) iboutlet uibutton *btnthree; @property (weak, nonatomic) iboutlet uiview *detailview; - (ibaction)click:(id)sender; @end viewcontroller.m #import "viewcontroller.h" #import "firstviewcontroller.h" @interface viewcontroller () @property uiviewcontroller *currentdetailviewcontroller; @end @implementation viewcontroller

javascript - json format of countries data to hierarchal data -

i have json data data:[ {'country':'uk','district':'whitefield','ward':'eastward','county':'eastcounty1','company':'privatecompany'}, {'country':'uk','district':'whitefield','ward':'eastward','county':'eastcounty1','company':'privatecompany2'}, {'country':'uk','district':'whitefield','ward':'eastward','county':'eastcounty2','company':'privatecompany3'}, {'country':'uk','district':'whitefield','ward':'westward','county':'westcounty1','company':'privatecompany'}, {'country':'uk','district':'blackfield','ward':'westward','county':'eastcounty1','company':'privatecompany'}, {'country':&

php - try to develop a own Extension , it can not running on xampp. the own dll was complied vs2012 -

when start xampp apache server shows warning: php starup: myext : unable initialize module module compiled build id=api20131226 ,ts php compiled build id=api20131226 ,ts,vc11 these options need match but compiled project vs2012 my xampp version xampp-win32-5.6.3 my php src code 5.6.3 vc11 my english bad. add '#define php_compiler_if "vc11"' @ cpp beginning

java - delete persisted object in one to one relation -

i'm using openjpa mapping layer , have 2 models : user : @entity @table(name = "users") public class user { @id @generatedvalue(strategy = generationtype.sequence,generator = "user_id_gen") @sequencegenerator(name = "user_id_gen", sequencename = "manage.users_id", allocationsize=1) @column(name = "id", nullable = false) private int _id; @onetoone (cascade=cascadetype.all, fetch = fetchtype.eager) @joincolumn(name="fk_image_id", insertable=true, updatable=true, nullable = true) private image _image; and image @entity @table(name = "images") public class image { @id @generatedvalue(strategy = generationtype.sequence,generator = "images_id_gen") @sequencegenerator(name = "images_id_gen", sequencename = "manage.image_id", allocationsize=1) @column(name = "id") private int _id; it's unidirectional 1 one relatio

SQL CASE WHEN STATEMENt into PHP VARIABLE -

i have problem: i have sql statement: select amount cicmpy inner join (select dealercode, sum(amount) amount (select dealercode, log logtlimit,temporarycreditlimit temporarycreditlimit, case when temporarycreditlimit>0 temporarycreditlimit else log end amount log_data status = 1 group dealercode) x on x.dealercode=debcode debnr not null , ltrim(debcode) = '21021287'` and want statement php $query variable. try this,it solve error. $sql = "put query"; //put query in php variable $result = mysql_query($sql) or die(mysql_error()); while($row=mysql_fetch_array($result)) { stuff... } for more reference

java - Multiple @RequestMapping (value, method pairs) in Spring MVC -

i achieve spring mvc @requestmapping(value = "/user/{userid}", method = requestmethod.delete) @requestmapping(value = "/user/{userid}/delete", method = requestmethod.post) public void deleteuser(@pathvariable string userid) { ... } this give me common endpoint rest calls , standard html form posts. possible spring mvc? can come is @requestmapping(value = { "/user/{userid}", "/user/{userid}/delete"}, method = {requestmethod.delete, requestmethod.post}) public void deleteuser(@pathvariable string userid) { ... } but result different because post "/user/{userid}" delete user. one thing make 2 separate methods own requestmapping annotation, , pass parameters on different method, actual stuff: @requestmapping(value = "/user/{userid}/delete", method = requestmethod.post) public void deleteuserpost(@pathvariable string userid) { deleteuser(userid); } @requestmapping(value = "/user/{userid}&

sql server - What TSQL gives rights to create functions on a schema -

i have program runs following sql: create function [foo\bar].something ( the sql looks fine, error the specified schema name "foo\bar" either not exist or not have permission use it. what sql can run on database schema access create function? think want keep default schema dbo , have access other [foo\bar] schema. the sql server books online states in create function topic ( https://msdn.microsoft.com/en-us/library/ms186755.aspx ): requires create function permission in database , alter permission on schema in function being created

ios - How to invoke an object after some particular time? -

rate sprite should displayed after 24 hours , counting when first time app launched . how can achieve ? a few things have take care of. when first time app launched, current time , save object nsuserdefaults. whenever user opens application again, saved object in nsuserdefaults , see if it's been 24 hours. if so, show rateus, else set timer remaining time. better yet, use open source solutions irate .

plugins - Looking for an Eclipse Code Formatter -

i know built in codeformatter in eclipse there 1 problem it. i work in team of 20 developers , confirmed codeformatting not like. e.g. wrap lines after 80 characters or opening braces on same line, etc. so want formatter formats code in 2 ways: when work on class, want formatter make me happy , when push svn should format other wont bothered. i hope have settings done in machine. if so, can export preference via file -> export -> general/preferences , ask colleagues import it. if not, try this... https://code.google.com/p/google-styleguide/source/browse/trunk/eclipse-java-google-style.xml moreover not idea format while checking svn might bother fellow developers might not feel comfortable when lots of formatting changes minor 1 line bug fix.

java - Can i get value of local variable dynamically from array of local variable name -

can value of local variable array of it's name iterating array.below code sample same. public class testlocalvar { public static void main(string[] args) { string[] arrlocalvar = {"vara", "varb", "varc", "vard"}; string vara = "i a"; string varb = "i b"; string varc = ""; string vard = ""; for(string localvarname : arrlocalvar){ system.out.println("localvarvalue -->"+localvarname); //here can value of local variable? } system.out.println("## loop end ##"); //printing values out side of loop system.out.println("vara :"+vara+" ,varb :"+varb+ ", varc :"+varc+ " ,vard :"+vard); }} this doing validating local variables dynamically iterating it's string type name array. thanks in advance. local variables not accessible through reflecti

How to generate non-negative random numbers(integer) using RNGCryptoServiceProvider C# -

i need generate non-negative random integers in code. example below generates integers; using (rngcryptoserviceprovider rng = new rngcryptoserviceprovider()) { // buffer storage. byte[] data = new byte[4]; // ten iterations. (int = 0; < 10; i++) { // fill buffer. rng.getbytes(data); // convert int 32. int value = bitconverter.toint32(data, 0); console.writeline(value); } } ref: http://www.dotnetperls.com/rngcryptoserviceprovider gives both positive , negative values. how generate non-negative random integers? earlier using random.next() giving me positive integers. pseudocode: repeat temp <- rng.nextinteger(); until temp >= 0; return temp;

HTML5 multi video screen -

i have multiple video tags in single screen absolute position , want longer video multiple , when longer video ends want execute code. <div style="width:1320px;height:1080px;position:absolute;left:0px;top:0px;z-index:0;"> <video preload="auto" autoplay> <source src="1.mp4" type="video/mp4"> <source src="1.ogv" type="video/ogg"> </video> </div> <div style="width:600px;height:1080px;position:absolute;left:1321px;top:0px;z-index:0;"> <video preload="auto" autoplay> <source src="2.mp4" type="video/mp4"> <source src="2.ogv" type="video/ogg"> </video> </div> <div style="width:1000px;height:600px;position:absolute;left:200px;top:200px;z-index:5;"> <video preload="auto" autoplay> <sourc

How to remove attribute directives from element directive in AngularJS? -

i have element directive , attribute directive: <my-element my-attribute="value"></my-element> my-attribute directive require ngmodel: app.directive('myattribute', [ function() { var definition = { restrict: 'a', require: 'ngmodel', link: function ($scope, $element, $attrs, ctrl) {...} } return definition; my-element can used without ng-model template of my-element contains input has ng-model. my-attribute should removed my-element , added input inside my-element. in compile function in my-element directive have: var value = element.attr('my-attribute'); element.remove('my-attribute'); element.find('input').attr('my-attribute', value); it works ok when attribute directive doesn't have require: 'ngmodel'. if have ngmodel required get: error: [$compile:ctreq] controller 'ngmodel', required directive 'myattribute&#

objective c - NSURLConnection returning error instead of response for 401 -

i have web api that, specific request returns status code 200 if went ok, , 401 if user not logged in based on authorization token. works fine if response status 200, doesn't seem work if response status 401, returning connection error code -1012, while response nil. so, following code: [nsurlconnection sendasynchronousrequest:request queue:queue completionhandler:^(nsurlresponse *response, nsdata *data, nserror *connectionerror) { nslog(@"%@", response); nslog(@"%@", connectionerror); nshttpurlresponse *httpresponse = (nshttpurlresponse *) response; int statuscode = (int)[httpresponse statuscode]; nslog(@"response status code: %d", statuscode); will display 2015-04-01 15:58:18.511 myproject[3618:694604] <nshttpurlresponse: 0x155facc0> { url: *some_url* } { status code: 200, headers { "access-control-allow-headers" = "content-type, accept, x-requested-with"; "access-control-allow-m

date - javascript getDate getMonth returns wrong month -

this question has answer here: unexpected javascript date behavior 3 answers i know there have been other posts can't see figure out doing wrong here. below code: var d = new date(); var month = d.getmonth(); system.log(d); system.log(month); my output looks this: [2015-04-01 09:24:53.012] [i] wed apr 01 2015 09:24:53 gmt-0400 (edt) [2015-04-01 09:24:53.012] [i] 3 shouldn't bottom output 4? thanks in advance it array. month starts 0, should plus 1 yourself. you can take @ :) http://www.w3schools.com/jsref/jsref_getmonth.asp

jsf 2 - Reusing JSF2 View Scoped Bean on facelets templating -

i have common task choose 1 or more 'localizacaoto' before doing else on page. currently logic of data retrieval/process/ajax events , on maintained on viewscoped bean called "seletorlocalizacaomb" , i’d use multiple instances of same bean on same page. firstly used composite component when chose node, stored on last bean on page. if had 3 instances declared on testeseletormb: @named @viewscoped public class testeseletormb implements serializable { @inject @getter @setter private seletorlocalizacaomb instanceone; @inject @getter @setter private seletorlocalizacaomb instancetwo; @inject @getter @setter private seletorlocalizacaomb instancethree; } no matter component on page used, instancethree hold values. based on research understood composite component not ideal solution problem. so changed ui implementation , used facelets create 'template' named seletor.xhtml. <ui:composition xmlns:ui="htt

javascript - How to replaceByImage() instead of drawImage() on html canvas (ignore opacity)? -

i draw image (which can have transparent parts) on canvas, totally replacing canvas content sourve image (unlike in source-over composition operation). the resulting canvas have exact same values source image. can't find composition operation perform this. i can clear canvas before calling drawimage() wondering if there faster/better way. you can use copy mode if want replace (as seem text in question): ctx.globalcompositeoperation = "copy"; if want remove parts of canvas, ie. area content drawn to, clearrect can used: ctx.clearrect(x, y, width, height); // replace values

android - implement onClickListener for Horizontal ScrollView -

i'm populating horizontal scrollview using picasso , problem can't implement onclicklistener because item views of list doesn't have index. xml : <horizontalscrollview android:layout_width="match_parent" android:layout_height="120dp" android:id="@+id/mygallery"> <linearlayout android:id="@+id/channelsscrollview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" /> </horizontalscrollview> and code : private void populateimages() { final list<string> urls = new arraylist<>(); //getting list of urls (int = 0; < activityloading.datachannelsarraylist.get(0).getchannelarraylist().size(); i++) { urls.add(getstring(r.string.get_channels_img_host) + activityloading.datachannelsarraylist.get(0).getchannelarraylist().get(i).getid()); }

scripting - How do I create a user scenario that includes multiple pages on my website and emulates realistic user behaviour? -

we’ve come across question @ load impact, thought i’d add stack overflow community make easier find: i want load test realistic. how create load impact user scenario emulates realistic user behaviour, accessing different pages , accessing pages more (for example home page), real users would? if have 3 pages on site users can visit, , know how many times each page visited users, can calculate “weight” of each page, , create user scenario simulates same kind of visitor pattern on site real users exhibit. example of how that. first, have find out how popular each of 3 pages are. can done looking @ statistics e.g. google analytics see how many times each page visited last month or so. let’s have these figures: ==== page ==== ==== visits/day ==== / 8453 /news.php 1843 /contacts.php 277 the total number of page visits 10573 (8453+1843+277). if divide each individual number total, “weight” (percentage) particular page – i.e. how big chance r

html - stuck with positioning images using css -

Image
im making website, , need include page actress meryl streep. im trying postion image of beside awards. picture below shows page looks right now. wondering how make picture aligns right of text instead of below it? thanks. this html code: <div class="info"> <a id="awards"><h2>awards: </h2></a> <h3>academy awards</h3> <h4>won</h4> <ol> <li>best supporting actress (kramer vs. kramer) - 1979</li> <li>best actress (sophie's choice) - 1982</li> <li>best actress (the iron lady) - 2011</li> </ol> <h4>nominated</h4> <ol> <li>best supporting actress (the deer hunter) - 1978</li> <li>best actress (the french lieutenant's woman) - 1981</li> <li>best actress (silkwood) - 1983</li> <li>best actress (out of africa) - 1985</li> <li>best actress (ironweed) - 1987</li> <li>best actr

html - Why I can't see this immages using img tag in FireFox? -

i not confident html , css , have following problem. into table have this: <td style="border-bottom: 1px solid #76818a !important; width: 10px; text-align: center; padding: 0 !important;"> <div style="width: 90px;"> <img alt="su" src="img\freccia_up.gif" onclick="javascript: spostasu();"> <br> <img alt="giu" src="img\freccia_down.gif" onclick="javascript: spostagiu();"> <br> <br> <br> <img alt="nascondi" src="img\freccia_dx.gif" onclick="javascript: eliminacolonna()"> <br> <img alt="visualizza" src="img\freccia_sn.gif" onclick="javascript: aggiungicolonna()"> </div> </td> as can see show .gif immages stored img path of project. the problem using

java - Javax Swing JTable::getModel vs JTable::getColumnModel -

hello have been working javax swing , came across weird problem , got me questioning. can example: jtable table = new jtable(); // indeed, 2 different objects: // tablemodel (which, think supposed contain rows , columns? defaulttablemodel dtm = (defaulttablemodel) table.getmodel(); // , column model, supposed define columns of table? tablecolumnmodel tcm = table.getcolumnmodel(); // can add columns table in 2 different manners dtm.addcolumn("a column"); // or tablecolumn column = new tablecolumn(); column.setheadervalue("another column"); column.setwidth(120); column.setminwidth(120); column.setmaxwidth(120); tcm.addcolumn(column); // , notice both commands add column in table // our table model should have 2 columns. // it? system.out.println(dtm.getcolumncount()); // outputs 1; system.out.println(tcm.getcolumncount()); // outputs 2; system.out.println(table.getcolumncount()); // outputs 2; // visual shows 2 columns, model has 1. from can tell jtable us

What does !(function()) mean in JavaScript/jQuery? -

Image
this question has answer here: javascript function leading bang ! syntax 6 answers i saw in parsleyjs library folowing: what expression !(function(f){...}) mean? negation? edit: after explanations, observed code looks !( f(y){}( f(x){} ) ); or can written !( f(z) ); or !(z); where z = f(z) , z = f(y){} , , y = f(x){} ... not clear function executes expression !(z); usually use either !function(f){...}() or (function(f){...})() or +function(f){...}() the developers here combined first two, redundant.

mysql - SQL Query in PHP date -

i'have problem in sql query in php: if : $result = mssql_query("select xx x join x on x x = '".$var1."' , x between '20150401 00:00:00' , '20150401 23:59:59' ") that's work but if : $day=date("d/m/y",time()); $explodate = explode("/", $day); $datestart = $explodate[2].$explodate[1].$explodate[0]." 00:00:00"; $dateend = $explodate[2].$explodate[1].$explodate[0]." 23:59:59"; $result = mssql_query("select xx x join x on x x = '".$var1."' , x between '".$datestart."' , '".$dateend."' ") that's doesn't work ! i don't understand why have idea ? thanks kiss principle . date('y-m-d 00:00:00')."' , '". date('y-m-d 23:59:59') or $today = date('y-m-d'); // ... ... "between '" . $today . " 00:00:00' , '" . $today . "

winapi - How to eat MDIChild Minimize messages -

i have code intercepts , eats wm_exitsizemove messages because want prevent users maximizing mdichild forms. prevent them minimizing mdichild forms can't figure out message intercept, know? i think you're trying lot easier you're making it. change windowstate property on mdichild forms fixedsingle. prevent resizing of form, , rid of max , min buttons. if want resizing without maximizing or minimizing, have go through api. can use enumchildwindows rid of max , min buttons.

version control - Is there a way to format code in Eclipse's compare tool? Ignoring whitespace isn't enough -

when using compare tool, eclipse shows this void foo() { //... } as different this void foo() { //... } which while technically correct annoying when comparing 2 versions of files have different formatting. is there way apply current formatting compare view? if it's different style either of 2 things being compared @ least give nice base finding "actual" differences in code. the plugin have found this doesn't work eclipse (luna), because made older version. as aside, useful thing , perhaps easier ignore new line characters , tabs, of course show foobar and foo bar as same it's better nothing.

ios - SWIFT - Property not seen outside viewdidload -

i try pass string vc1 vc2, value of tex passed property detailitem loaded viewdidload, , not in function viewcontroller 1: @iboutlet var tex: uitextfield! // prepare fore segue pass value of txt override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if segue.identifier? == "todo" { let navvc = segue.destinationviewcontroller uinavigationcontroller let itemvc: checklistviewcontroller = navvc.topviewcontroller checklistviewcontroller itemvc.detailitem! = tex.text } } viewcontroller 2: var detailitem : string! // can see value of tex in viewdidload override func viewdidload() { super.viewdidload() println("viewdidload \(detailitem)") tableview.rowheight = 44 } // here , in function below result nil. required init(coder adecoder: nscoder) { println("print init \(detailitem)") items = [checklistitem]() super.init(coder: adecoder) loadchecklistitems() } func documentsdirectory() -> stri

Android: What’s the best way to implement the BaseAdapter if item content in ListView is dynamic? -

Image
in case, need implement baseadapter’s getitemviewtype() , getviewtypecount() dynamic item content of listview, this post says. think solution suitable finite number , knowing beforehand, such listview item sending layout , receving layout. what case listview item content impossible knowing beforehand? example, need show contact list server, contact list size several thousand. each item, need show, example, hobby “list”. small range of 0 tens of string. in case: the item types relatively bigger normal case using “getitemviewtype” though each item may different, similar degree: item content different in number of views, common in view type. item different item b because have more textviews. for each time in getview, convertview hard reuse because different, if create new textview , added convertview, impact scrolling of listview. don't think it's appropriate such way. should in such case? unfortunately cannot change number of item view types on fly. getv

c - How to move data from an array to the buffer when a program starts? -

is there way have data in array of characters or integers placed in buffer when programs starts if user has entered data? for example: int main() { int run = 1; char a[] = "4\nasdfg\0"; char in = null; datatobuffer(a);//is there command in c? while (run){ in = getchar(); if (in == '\0') run = 0; } //loop stopped, user didn't } alternatively, there way in debugger of vs? this testing several functions rely on user input want automate process of entering data. edit: not optimal guess i'll different macro program, although isn't practical solution more few dozen of characters since it's slow.

php - Trying to use WP shortcode in HTML -

i'm trying make shortcode outside post/page in wordpress. the problem is, when i'm placing do_shortcode() function, html automatically document php code (e.g <!--*php code* --> ). what can cause problem? you don't place do_shortcode() in pages. somewhere in functions.php or shortcodes.php file set function , assign shortcode function. function myfunction($params = array()) { //function code here } add_shortcode('shortcodename', 'myfunction'); then once done can put [shortcodename] pages, inside square brackets that. there plugins allow run php , enter right on page, default shortcode functionality requires add shortcode first.

renaming files in windows...perhaps dos command prompt (For) -

this kind of question has been asked few times before on here , have tried use answers in previous posts problem i'm still struggling. i have in directory 100's of files along lines of ab00123456.stp ab00123457.stp ab00123458.stp ...and on i rename these adding pre , post text file name. so end result be... cde_ab00123456_a.stp cde_ab00123457_a.stp cde_ab00123458_a.stp ...and on (note upper , lowercase text change also......as if wasn't difficult enough already!) any clues appreciated.....along lines of dos command perhaps.... andy for /? extremely helpful. in particular, contains following substitutions: %~ni - expands %i file name only %~xi - expands %i file extension only thus, create for loop iterates through files iteration variable %i , renames %i cde_%~ni_a%~xi . ready-to-use example: for %i in (*) echo rename %i cde_%~ni_a%~xi try in directory of choice, fine-tune , remove echo once sati

c# - Keep Sum column at bottom when Header is clicked on DataGrid in Windows Application -

i have datagridview takes datasource datatable. have added in new row datatable adds total values of columns , displays fine until header clicked , data sorted , totals row appears half way grid! i have been looking solution hours , can't seem find concrete. i've seen people overriding sortcompare method, doesn't used when there datasource. i've seen mentions of footer, seems asp, have seen bits , pieces of broken code windows applications. basically want have count column @ bottom of grid , stays there when click on headers! thought straight forward bit of work it's proving tricky. my grid made of 4 or 5 main columns of data, name, position etc , rest of columns dates based on filter, dynamic. your appreciated. what want handle sorted event, pinning desired row bottom when sort occurs. note new empty row must last row, that's trivial. first, you'll want add tag desired row when create it. datagridviewrow row = new datagridviewro

Running Javascript in Android WebView - onPageFinished Loop -

i having bit of trouble getting application correctly run js on page using onpagefinished method. the code below contained within class i've created extends asynctask fetch , parse json file held elsewhere. i able fetch json file correctly, parse data , url webview obtained , set. works loads should until attempt run js onpagefinished method. //onpostexecute method runs when doinbackground method completed @suppresslint("setjavascriptenabled") @override protected void onpostexecute(boolean aboolean) { super.onpostexecute(aboolean); //casting webview findviewbyid doesnt explicity return value type. webview = (webview) findviewbyid(r.id.webview); //obtaining websettings of webview websettings webviewsettings = webview.getsettings(); //setting javascript enabled webviewsettings.setjavascriptenabled(true); webview.setwebviewclient(new webviewclient(){ @override

Combining Cassandra and Hibernate in Grails -

i want combine both cassandra , hibernate data sources in grails domain classes; domain classes have mapped hibernate , others have mapped cassandra. i used (static mapwith = "cassandra") in domain classes still cassandra maps domain classes in project. that limitation cassandra gorm implementation. if won't used cassandra domains needs mapped table. mean add support using of domains in cassandra isn't yet done. so need create whole schema in cassandra mysql.

html - Javascript dynamic array window with multiple answer options -

i'm working on multiple arrays , occured 1 problem. when have 1 question div generated can add additional questions without problem, if add question div, can't add additional questions neither of both windows(same applies other number too), error newdiv[counterq] undefined. can me issue? thanks! also, how can move div addoption below created new 1 option input? i'm new @ programming sorry if won't explain in correct terms. thanks! edit: updated new problem. didn't wanted create seperate topic. html : var counterq = 0; var limitq = 3; var countero = 0; var limito = 5; function addcontent(divname) { countero = 0; if (counterq == limitq) { alert("you have reached limit of adding " + counterq + " inputs"); } else { var newdiv = new array() newdiv[counterq] = document.createelement('div'); newdiv[counterq].classname = "contentwindow[" + counterq + "]"; newdiv[co

c++ - ZigBee Arduino, Incorrect parsed datas -

i've got trouble make communication between 2 arduinos uno work. arduino1<>zigbee >---------- < zigbee < > arduino2 i'm trying make them understand each other. message going between 1st arduino zigbee second zigbee. arduino1<>zigbee>----------< zigbee--x-- arduino2 the problem is: when try parse, on arduino2 payload of incoming packet arduino1, messages differents. since i'm using zigbee api2, there's crc on message while travelling between zigbees (after investigations) i'm sure packet correct arriving on zigbee2 (if not, packet dropped). so main event now: memmove(received,xbee_rx.getdata(),24); when receive packet xbee.readpacket(); if (xbee.getresponse().isavailable()) { if (xbee.getresponse().getapiid() == zb_rx_response) { xbee.getresponse().getzbrxresponse(xbee_rx); memmove(received,xbee_rx.getdata(),24); (int = 0; < 24; i++) { serial.print(received[i],hex);

FireMonkey Component Execution Error -

i tried create simple component(tgraph) using firemonkey platform (xe7). first of create 2 new classes: 1) tgraph (anchestor type tlayout); 2) tmyplot1d(anchestor type tpanel); saved 2 units , created package called 'mypackage'. compiled , installed in "samples" page. opened new firemonkey project , drag , drop tgraph instance in form. works well. @ designtime,i can see component defined, , relevant units visible main unit. relevant code in following: first class unit umyplot; interface uses system.sysutils, system.classes, fmx.types, fmx.controls, fmx.stdctrls; type tmyplot1d = class(tpanel) private { private declarations } protected { protected declarations } public { public declarations } published { published declarations } end; procedure register; implementation procedure register; begin registercomponents('samples', [tmyplot1d]); end; end. second class unit umygraph; interface uses system.sysutils, system

Java: embeddable Object-Oriented-Database -

i looking simple-to-use embeddable open-source object-oriented database java desktop application. i working on small portable java app embedded database. thinking of using sqlite or h2 jpa. not 100% sure data scheme not change on time , working objects might save trouble using odbms right away. maven repository , gui appreciated. take at: http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html as gui can use: http://www.dbvis.com/

regex - Replacing just the match of regular expression in Eclipse find and replace -

Image
so have ton of files need changed. this string example=/abc/def/pattern/ghi and want change pattern else, let's fix what is: string example=/abc/def/fix/ghi what i'm getting is: fix (the whole line gets changed, want match changed) this regular expression i'm using, trying avoid commented lines ^(?!\s*(//|\*)).*/pattern/ you may wrap part of pattern need keep after replacement capturing parentheses , use backreference in replacement string: search for : ^(?!\s*(?://|\*))(.*/)pattern/ replace :    $1fix/ now, pattern matches: ^ - start of line (?!\s*(?://|\*)) - if not followed 0+ whitespaces , // or * (note non-capturing grop (?:...) used simplify backreference usage) (.*/) - group 1 capturing 0+ chars other linebreak symbols last / pattern/ - literal substring pattern/ . in replacement pattern, $1 re-inserts whole line start / before pattern/ , , fix/ literal replacement part.

swing - Java: Add 2 animated objects (paintComponent) on the same JPanel -

i have class creates animated object (an wormlike animation) repainting through timer. , class have frame , panel. when create 2 (mov , mov2) instances of object , add panel, appear in separeted panels (or seems like). heres code. public class movimento extends jcomponent{ int t; int a; int[][] matriz; public movimento(int tamanho, int area){ t = tamanho; = area; gerarmatriz(); gerarpanel(); actionlistener counter = new actionlistener() { public void actionperformed(actionevent ev){ movimentarmatriz(); repaint(); } }; new timer(1, counter).start(); } public void gerarpanel(){ this.setpreferredsize(new dimension(a, a)); } public void gerarmatriz(){ /* *generates array[][] initial coordinates */ } public void movimentarmatriz(){ /* * add new coordinate las

buildpath - Change java build path for multiple projects in Eclipse -

Image
in eclipse, have libs project. project has test.jar file. i have 15 other projects in eclipse use test.jar under java build path/libraries. new versions of test.jar made every month, , name change (test1.jar, test2.jar) once new version available, remove old 1 libs project , add new one. question is, how can modify 15 projects use jar file reference new one? know how 1 project @ time configuring build path each project. there way make mass change 15 projects @ same time? to achieve same follow below steps. 1) open eclipse go windows->preferences->java->build path->user library 2) click on new button , give name test_jar , add after add jar test.jar or test.jar. see below screen shot. 3) 1 time task delete entry 15 project build classpath set in global path. 4) whenever build other project bundle user libraries.

php - How to display data from tables and queries for each line of data from another table in Yii2 -

i have 2 tables - animals , animals_type. columns in animals_type: id , type columns in animals: id , name , animals_type i want render list of animals type , exists animals on same page. for render animals type create model animals_type, controller animals_typecontroller <?php namespace frontend\controllers; use yii\web\controller; use yii\data\pagination; use app\models\animals_type; class animals_typecontroller extends controller { public function actionindex() { $query = animals_type::find(); $pagination = new pagination([ 'defaultpagesize' => 10, 'totalcount' => $query->count(), ]); $animals_type = $query->orderby('id') ->offset($pagination->offset) ->limit($pagination->limit) ->all(); return $this->render('index', [ 'animals_type' => $animals_type, 'p