Posts

Showing posts from August, 2015

python - drop rows with errors for pandas data coercion -

i have dataframe, need convert columns floats , ints, has bad rows, ie., values in column should float or integer instead string values. if use df.bad.astype(float) , error, expected. if use df.bad.astype(float, errors='coerce') , or pd.to_numeric(df.bad, errors='coerce') , bad values replaced np.nan , according spec , reasonable. there errors='ignore' , option ignores errors , leaves erroring values alone. but actually, want not ignore errors, drop rows bad values. how can this? i can ignore errors , type checking, that's not ideal solution, , there might more idiomatic this. example test = pd.dataframe(["3", "4", "problem"], columns=["bad"]) test.bad.astype(float) ## valueerror: not convert string float: 'problem' i want this: pd.to_numeric(df.bad, errors='drop') and returns dataframe 2 rows. since bad values replaced np.nan not df.dropna() rid of bad rows now? edi...

When using Azure Batch Processing, what is the best way to create and use a configuration file which can change per instance? -

so i'm new azure , working on project in using azure batch processing run application in several instances different configurations. i wondering best practice doing this, reference how easy change configuration files, deploy, how interlink them source control etc. any thoughts/knowledge helpful can't seem find based azure batch , configuration files. you manage configuration in batch client normal application running on client outside of batch job. application creates pools, jobs , tasks i.e. sends them batch queue. can store configuration client in usual way used (app.config, json files etc.). scheduling job run in batch involves specifying job parameters pool id, task id, resource files etc. , command line executable run. pass required parameters task instance use.

javascript - How to use jquery plugins in nodejs and ES6 import? -

i'm using jquery plugin calendar http://kylestetz.github.io/clndr/ i'm using cdn want use nodejs module best way ? edit: i'm using babel transpiler , es6 syntax. if plugin has not been written es6 module need yourself. since jquery plugins attach existing jquery object don't export of note. can wrap plugin in invoked function , export that. remember either import jquery in plugin file or make available globally. import jquery 'jquery'; const calendar = (function ($) { ... jquery plugin code ... can live here }(jquery)); if feel inclined learn fork project , rewrite plugin code es6 class , make available on npm others.

ios - Swift closure in protocol extension -

i want decorate uiviewcontroller ability adjust it's interface when setinteractionenabled method called class (ex. network state manager). changes (if any) should provided in concrete controller overriding oninteractionchanged . here code: import foundation typealias interactionclosure = ((enabled: bool) -> void) protocol interaction: class { var oninteractionchanged: interactionclosure? { set } func setinteractionenabled(enabled: bool) } extension interaction self: uiviewcontroller { // default: nothing // throws: - extensions may not contain stored properties var oninteractionchanged: interactionclosure? = nil func setinteractionenabled(enabled: bool) { oninteractionchanged?(enabled: enabled) } } extension uiviewcontroller : interaction {} how add default implementation oninteractionchanged ? answering own question don't do, here solution: typealias interactionclosure = (enabled: bool) -> void protocol i...

Group By with aggregate Query is timing out MySQL -

when run query on table has 14k records select max(id) 'id' table_records search_counter='0' group record_date it executes in 0.016 sec returns 676 records the id column primary key , having unique index defined on it now when use above query subquery example select * table_records id in (select max(id) 'id' table_records search_counter='0' group record_date) this executes forever. on local dev machine takes 139.511 sec execute on server gets timed out i not sure what's wrong here. any appreciated instead of in run join query select t1.id, t1.record_date table_records t1 inner join (select max(id) 'id' table_records search_counter='0' group record_date) t2 on t1.id = t2.id;

java - Session does not get saved while doing Junit test in JavaPlay -

i implementing login authentication in app using this tutorial. here authentication function : public result authenticate() { form<login> loginform = formfactory.form(login.class).bindfromrequest(); if(loginform.haserrors()){ return badrequest(login.render(loginform)); }else{ session().clear(); session(str_email, loginform.get().email); return redirect( routes.application.index() ); } } i storing e-mail of user in session. while doing tests not able session in result. here code test : @test public void authenticatesuccess() throws ioexception { //setup map<string,string> objectnode = new hashmap<>(); objectnode.put("email",configuration.getstring(config_login_email)); objectnode.put("password",configuration.getstring(config_login_pd)); //test result result = invokewithcontext(fakerequest("post","login").bodyform(object...

C++: callback function with state -

i'm using function of external library written in c ( library_function ) takes callback function argument. parameters library calls callback function don't matter me. thing i'm interested in order of calls callback function. want callback function return next element of list every time it's called. consider example: #include <iostream> int x; bool *booleans; void library_function(bool(*callback_fn)()){ (int i=0; < 5; i++) { std::cout << callback_fn() << std::endl; } } bool my_callback_fn(){ return booleans[x++]; } void my_function(bool b[]){ x = 0; booleans = b; library_function(my_callback_fn); } int main() { bool booleans[] {true, false, true, true, false}; my_function(booleans); } this code works, had use global variables think isn't style. in python example, use inner function achieve this: def library_function(callback_fn): _ in range(5): print(callback_fn()) def my_f...

javascript - Need clarification on insert API call in Zoho crm -

i got below error while trying store contact form value zoho. my xml code: ------------ when give name , email address hard coded works fine: var xmldoc = '<contacts><row no="1"><fl val="first name">peter</fl><fl val="last name">jhon</fl><fl val="email">peter.r@gmail.com</fl></row></contacts>'; while concatenating throw error error: <message>unable parse xml data</message> var xml = '<contacts><row no="1"><fl val="first name">' + contact.firstname + '</fl><fl val="last name">' + contact.lastname + '</row></contacts>'; field label close tag lastname missing var xml = '<contacts><row no="1"><fl val="first name">' + contact.firstname + '</fl><fl val="last name">' + contact.lastname ...

What is the mapping between the number of thread and csv_data_config in Jmeter? -

i doing jmeter testing. setup is: thread group: 1 threads in group: 10 loop count: 5 i have csv data config file contains: usr1, passwd1 usr2, passwd2 usr3, passwd3 usr4, passwd4 usr5, passwd5 'recycle on eof' set true, 'stop thread on eof' set false. then read article online ( jmeter csv dataset config: how move through variables in same thread? ) a couple of doubts: i think setting 'recycle on eof' set true, thread 1-5 use username/passwd 1-5, thread 6-10 should reuse username/passwd 1-5. wrong, thread 6-10 eof username/passwd , fail test obviously, article suggest. but why? then set 'threads in group' 5, problem in 1) gone, thread 1-5 use username/passwd 1-5 loop 1. because loop count>1, not know when thread 1-5 finish 1st round, username/passwd pick loop 2? should thread 1-5 still use username/passwd 1-5 in order always? observation it's first come, first serve thing, whichever thread finish loop 1 first username/passwd 1. ...

android - Google Place API get latitude & longitude of places -

how can latitude & longitude google place api of android ? code looks below.. autocompletefilter mautocompletefilter = new autocompletefilter.builder().settypefilter(autocompletefilter.type_filter_cities).build(); pendingresult<autocompletepredictionbuffer> results = places.geodataapi .getautocompletepredictions(mgoogleapiclient, constraint.tostring(), mbounds, mautocompletefilter); i facing trouble getting results more 5 results . i'm using this link references. grateful. you should that: places.geodataapi.getplacebyid(mgoogleapiclient, placeid) .setresultcallback(new resultcallback<placebuffer>() { @override public void onresult(placebuffer p) { if (p.getstatus().issuccess()) { final place mplace = p.get(0); latlng qloc = mplace.getlatlng(); //you can use lat qloc.latitude; //and long qloc.longitude; } p.release(); ...

javascript - Sort table rows based on background-color using jquery -

this fiddle <table> <tr> <td> <div style="background:blue;color:white">hello</div> </td> </tr> <tr> <td> <div style="background:pink;color:white">hello</div> </td> </tr> <tr> <td> <div style="background:blue;color:white">hello</div> </td> </tr> <tr> <td> <div style="background:green;color:white">hello</div> </td> </tr> <tr> <td> <div style="background:pink;color:white">hello</div> </td> </tr> <tr> <td> <div style="background:green;color:white">hello</div> </td> </tr> </table> how re...

asp.net - How to substract 2 sub groups sum in rdlc report -

i using rdlc report display report. in using groups , sub groups; want substract sub groups sum , display in text box. how it. in image : sub group 'expenses' sum 86 sub group 'income' sum 400 i want 86-400. the image

laravel 5 - issue in update controller -

i got issue while updateing notfoundhttpexception in routecollection.php line 161: in routecollection.php line 161 @ routecollection->match(object(request)) in router.php line 821 @ router->findroute(object(request)) in router.php line 691 @ router->dispatchtoroute(object(request)) in router.php line 675 @ router->dispatch(object(request)) in kernel.php line 246 @ kernel->illuminate\foundation\http{closure}(object(request)) @ call_user_func(object(closure), object(request)) in pipeline.php line 52 @ pipeline->illuminate\routing{closure}(object(request)) in checkformaintenancemode.php line 44 @ checkformaintenancemode->handle(object(request), object(closure)) @ call_user_func_array(array(object(checkformaintenancemode), 'handle'), array(object(request), object(closure))) in pipeline.php line 136 @ pipeline->illuminate\pipe...

javascript - Show table generation as it generates? -

i'm generating table using jquery appending rows etc table , returning it. there way show table generates? populating goes , using way of showing progress. ui.generate_tabs('content-tabs', content_container, domain_list, function(domain_id) { var table = jquery('<table><thead><th>backbone</th><th>sequence</th></thead></table>'); var tbody = jquery('<tbody/>'); table.append(tbody); var show_table = function(table) { console.log(table); return table; } (let aacid of utils.map_iterkeys(aacid_str)) { var tr = jquery('<tr/>'); tbody.append(tr); tr.append(jquery('<td/>').text(aacid)); tr.append(jquery('<td class="single-line-td"...

c# - Using Automapper static API in the latest release? -

i've upgraded automapper 4.2.1 5.0.0. i'm using static api in webapi2 project , i'm trying mapping work, tried following this answer . so changed code following: public static class automapping { public static void config() { mapper.initialize(main => { var config = new mapperconfiguration(cfg => { cfg.createmissingtypemaps = true; cfg.createmap<mymodel, mydto>().reversemap(); }); config.assertconfigurationisvalid(); }); } } the above called global.asax . however, exception: mapper not initialized. call initialize appropriate configuration. what correct way initialize automapper , , need change controllers mapping? edit1 firstly, code above must be: mapper.initialize(cfg => { cfg.createmissingtypemaps = true; cfg.createmap<mymodel, mydto>().reversemap(); }); mapper.configuration.assertconfigurationisvali...

javascript - Customizing tooltip on Google Timeline Chart -

Image
i created google timeline chart see musical listening history. looks this: i want remove duration part tooltip, couldn't find option it. tried adding these lines: datatable.addcolumn({type: 'string', role:'tooltip'}); and row in datatable.addrows([]) function looks this: ['25 august', 'kasabian - la fee verte', new date(2016,01,01, 13,37,32), new date(2016,01,01, 13,43,19), 'tooltip example'], but still shows same tooltip in image. want show kasabian - la fee verte , 25 august: 1:37 pm - 1:43 pm in image, want remove duration. according data format timeline chart, tooltip should in 3rd column. see following, working snippet... google.charts.load('current', { callback: function () { var container = document.getelementbyid('chart_div'); var chart = new google.visualization.timeline(container); var datatable = new google.visualization.datatable(); datatable.addcolumn(...

Server side pagination in Azure ( MS SQL ) -

how implement pagination in sql query in azure specific , how specify limit , offset .... i supposed show 50 records per page , there 4000 records in database i writing api same fetch records using sql query .... how specify in ms sql query select * yourtable order someuniquecolumn offset 0 rows fetch next 50 rows ; you can use variables below: declare @pagenum int = 1, @pagesize int = 10; select * yourtable order someuniquecolumns offset (@pagenum - 1) * @pagesize rows fetch next @pagesize rows only; references: http://sqlmag.com/blog/sql-server-2012-t-sql-glance-offsetfetch

android - How to apply a transformation to View? -

i have custom view overridden ondraw : protected void ondraw(canvas canvas) { canvas.drawpath(m_path, m_paint); } i want make possible pan/scale/rotate view. , not want redraw every time user moves finger. idea apply transformation matrix view in response user gestures. i know there method imageview.setimagematrix seems need, have not imageview , custom view . in ios, used calayer , mylayer.affinetransform = cgaffinetransformmake... . how suggest handle in android? if drawing path , can apply matrix (as android calls affine transform) path: on user interaction, update matrix, view call: m_path.transform(m_matrix, m_path_draw); see path#transform | android developers and in ondraw() , call: canvas.drawpath(m_path_draw, m_paint); alternatively, canvas has setmatrix() method: canvas.save(); canvas.setmatrix(m_matrix); canvas.drawpath(m_path, m_paint); canvas.restore(); whichever method use, re...

Admob problems in intel xdk -

i hava app want show ads not on index.html on index1.html everything works great on index.html admob script below, banner , interstitial shows up, dont whant them on index.html, want them on index1.html. delete code index.html , put in index1.html no ads showing up? why that? whay want them index1 not user friendly hav interstitial pop 1sec after appstart. i thinking call interstitial on first button click cant working either. iam using admob plugin pro (cordova-plugin-admobpro) in intel xdk this admobpro script use in html file: <script type="text/javascript" src="cordova.js"></script> <script>var admobid = {}; if( /(android)/i.test(navigator.useragent) ) { admobid = { // android banner: 'ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', interstitial: 'ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }; } else if(/(ipod|iphone|ipad)/i.test(navigator.useragent)) { admobid = { /...

javascript - Delete only the particular Div Id -

<div id="@("bottomgrid)" class="dgd2"></div> var element = document.getelementbyid("#bottomgrid"); element.empty(); $('.dgd2').empty() instead of deleting bottom grid removing other div present in screen. if have html structure this: <div class="holder"> <div id="item1">hey</div> </div> you can use pure javascript code remove "item1" element: var element = document.getelementbyid("item1"); element.parentnode.removechild(element);

json - 405 http status code clarification for delete rest api in spring mvc -

i have rest api delete requestmethod.delete. i have @pathvariable("mediaid") string mediaid. when invoke api out path paramert value below, 405 method not allowed. http://localhost:8080/myservice/deleteme/mediaid/ the definition of 405 in wiki below, 405 method not allowed request method not supported requested resource; example, request on form requires data presented via post, or put request on read-only resource. since use correct http method delete invoke delete api, why getting 405? in opinion, 400 more valid?

java - Can't append/ add text to a jTextArea -

i'm trying build application has console text-area, can't text either appended or added text inside jtextarea. wondering if me work out why code showing no errors? code follows: form 1: package com.company; public class form1 extends javax.swing.jframe { private javax.swing.jbutton btncombobox; private javax.swing.jcombobox<string> comboone; private javax.swing.jlabel jlabel2; private javax.swing.jlabel jlabel3; public form1() { initcomponents(); } @suppresswarnings("unchecked") private void initcomponents() { jlabel2 = new javax.swing.jlabel(); comboone = new javax.swing.jcombobox<>(); jlabel3 = new javax.swing.jlabel(); btncombobox = new javax.swing.jbutton(); setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close); jlabel2.sethorizontalalignment(javax.swing.swingconstants.center); jlabel2.settext("select printer:"); comboone.setmodel(new javax.swing.defaultcomboboxmodel<>(...

jquery - TypeError: f.browser is undefined fancybox -

i facing error in app/assets/javascripts/jquery/jquery.fancybox.pack.js file @ line: 5: (f.browser.msie?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">the requested content cannot loaded.<br/> at top of file version mentioned as: /*! fancybox v2.1.0 fancyapps.com | fancyapps.com/fancybox/#license */ i using jquery-rails-3.1.4 , jquery-ui-rails-5.0.5 versions. please how can out of error. import fancybox script that, <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.pack.js"></script> please see question may you

tfs2015 - TFS 2015 Build vNext: Upload Files via WebDAV? -

we want upload files webdav-folder , tried use " windows machine file copy "-task (this uses robocopy inside). don´t see possibility enter destination folder in right form. 1. tried \\our.website.de@ssl\davwwwroot\remote.php\webdav\ , 2. mounted location network drive first , tried use drive letter, none of these attempts succeeded. is "windows machine file copy" right type of task or there custom task out there accomplishes need? thx... you should separate specified machines , folder path. not use together. machines: example: dbserver.fabrikam.com, dbserver_int.fabrikam.com:5986,192.168.34:5986 folder path: the folder on windows machine(s) files copied. example: c:\fabrikamfibre\web more detail info please refer link: deploy: windows machine file copy

android - How to generate DaggerComponent class in the test/java folder? -

i'm new dagger 2 , i'm working on using dagger 2 unit tests. test presenter , mock of datasources(server connection, sharedpreferences). sharedpreferences have sharedpreferencescomponent in main folder , sharedpreferencescomponentfake in test/java folder. problem dagger can't generate daggersharedpreferencescomponentfake therefore can't inject sharedpreferencesfake instead sharedpreferences. how can set dagger generate daggersharedpreferencesfake class , or using dagger 2 in wrong way why not use mockito , mock sharedpreferencescomponent mockito.when(sharedpreferencescomponent.yourmethod(any(string.class))) .thenreturn(yourwanteroutput); this make faking classes unnecessary , code cleaner.

scala - Flink: Syncronize/connect two streams -

i have 2 streams, first, cep library, it´s used detect patterns on-off. in second stream values have add. i'm looking way connect 2 streams, when receive off frame, return device status change, ultimate value of sum of second type of frames: device 311 state change:ignition off value:35.91 my code: // ignition pattern val ig = timedvalue.filter(_._2 == "ignition").keyby(_._4) val patternig_on: pattern[(long,string,string,long), _] = pattern.begin[(long,string,string,long)]("start").where(_._3 == "off").next("end").where(_._3 == "on") val patternstream: patternstream[(long,string,string,long)] = cep.pattern(ig, patternig_on) val patternig_off: pattern[(long,string,string,long), _] = pattern.begin[(long,string,string,long)]("start").where(_._3 == "on").next("end").where(_._3 == "off") val patternstreamig_off: patternstream[(long,string,string,long)] = cep.pattern(timedvalue, patternig...

php - Requires extended permission on facebook for send notification -

i new in developing facebook app. when trying send user notification , test sent notification on graph api explorer ,i getting error (#200) requires extended permission: manage_notifications . you need add ' manage_notifications ' scope in facebook link connection launch. if not, may required review of app facebook use scope ( manage_notifications ) without issues.

io - How to achieve "unformatted" format specifier in write/read statements? -

i'd able switch between formatted , unformatted output. write , read statements, there no format-specifier unformatted output, far know --- option remove specifier. must use if -statement on every read , write achieve flexibility, or there better way around this? unformatted , formatted i/o different can have 2 versions of subroutines or 1 big if . if have many read , write statements. if use c preprocessor, define macro write , use include file avoid code duplication, wouldn't introduce this. if meant mix formatted , unformatted in single file, use unformatted stream access , store character strings there in "formatted" portions. or close, re-open position="append" , change form= .

jquery - javascript delay is not working -

this table row requirement first time displaying background color of row in yellow color after 4 seconds color become fade using following code $('#lock').prepend('<tr><td>hello</td><td>cool</td><td>dad</td></tr>'); i using following code $("#lock tr").css('background-color','yellow').delay(4000).css('background-color','fade'); problem delay not working let css render background-color transition (quicker js): #lock { background-color: yellow; transition: background-color 0.3s; } #lock.red { background-color: red; } now once dom loaded, add following javascript right before closing <body> tag: // js solution settimeout(function() { var element = document.getelementbyid('lock'); element.classlist.add('red'); }, 4000); // jquery solution $('#lock').delay(4000).addclass('red'); // no go...

.htaccess - Regex rule for URL redirect case and directories -

i looking following url redirect configuration regex: current url: http://support.olddomain.com/en-us/company/help_files/ab012345 new url: http://support.newdomain.com/articles/cde678910 the problem have case issues , other directories: support.olddomain.com/ en-us /company/help_files/ab012345 - lowercase en_us support.olddomain.com/en-us/ c ompany/help_files/ab012345 - capitalized company support.olddomain.com/en-us/company/help_files/ab012345?title=article+title - additional parameters support.olddomain.com/en-us/company/all_files/ab012345 - on all_files, not hel_files thus, want redirect url path ab###### proper page on newdomain.com following conditions: works http , https ignores capitalization ignores parameters works both all_files , help_files directories. any welcome. thank you! i've done in notepad++ ctrl+h find: ^([\w+\.]+)\/(?=.*ab.*) replace: newdomain.com/

php - Integration header, content, footer in html2pdf -

i made html page , converted pdf format through library html2pdf. code : <?php require('../admin/html2pdf/html2pdf.class.php'); ob_start(); ?> <page> <page_header> <br> <table> <tr class="headings" style="background-color: #ffffff;"> <th class="column-title">home</th> <th class="column-title"><h3>web site</h3></div></th> <th class="column-title">home</th> </tr> </table> </page_header> <page_footer> <div> <table border = "1" id="table2"> <tr style="background-color: #f2f2f2;"> <th colspan=3 style="width: %;text-align: center;">footer</th> <th colspan=3 style="width: %;text-align: center">copyright </th...

How to read a linux background process stream through java? -

on linux machine have 1 process running in background.i have process id of process.i want read stream output of process through java. command: nohup sar -a 1 >/dev/null 2>&1 & i redirecting output /dev/null i.e. nohup.out not created. you can't use nohup , have output stream. from nohup --help : if standard output terminal, append output 'nohup.out' if possible, '$home/nohup.out' otherwise. so either drop use of nohup , can use process 's outputstream, or have read file. obviously in both cases have stop redirecting output of command /dev/null , can either redirect file of choice or let nohup use default output file.

sql - How to insert into a table from a CTE -

i have table selects 11 players out of 20 (based on positions) each match. i’ve done created new table know ‘fixtureplayer’ store in playerid , fixtureid table. i not sure on how can insert pl.playerid , pl.fixtureid 'playerfixture' table calling select. should do? with pl (select distinct p.playerid ,p.position ,case when p.teamid = 0 0 else p.playerweighting end playerweighting ,abs(checksum(newid())) % 10 + 1 form ,t.teamid dbo.fixture f inner join dbo.league l on f.leagueid = l.leagueid inner join dbo.team t on l.leagueid = t.leagueid inner join dbo.player p on t.teamid = p.teamid f.weeknumber = 1) ,po (select *, row_number() over(partition pl.teamid, pl.position order newid()) rnk pl) ,total (select teamid ,sum(playerweighting) teamweight ,su...

xpath - Selenium not able to find elements -

selenium not able find elements. trying find id pageheader_logourl it's throwing unable locate element xpath expression. am doing wrong here html code <div id="page" class="page"> <div id="wrapper" class="wrapper"> <div id="header" class="header"> <table width="100%" height="40" cellspacing="0" cellpadding="0" border="0" id="table2"> <tr> <td> <table height="40" cellspacing="0" cellpadding="0" border="0" id="table3"> <tr> <td><a href="http://www.scania.com" id="pageheader_logourl" tabindex="-1" target="_blank"><span id="headerlogoimage"></span></a></td> ...

mysql - Migrating data from an Access database to an SQL database with a different structure and different table names -

Image
i have been trying migrate data access database(2016) sql database different structure , different table names. this structure access database, in phpmyadmin :- i use phpmyadmin create databases. structure of tables of database in phpmyadmin :- i wondering if possible migrate data , if why getting error while trying migrate data. jun 28, 2016 2:29:13 pm com.intellisoftkenya.onetooner.gui.mainframe$migrationworker doinbackground info: process started. jun 28, 2016 2:29:13 pm com.intellisoftkenya.onetooner.gui.mainframe$migrationworker doinbackground severe: error occured while migrating data 'tblcurrentstatus' 'patient_status'. jun 28, 2016 2:29:13 pm com.intellisoftkenya.onetooner.gui.mainframe$migrationworker doinbackground info: attempting delete inconsistent data 'patient_status'. jun 28, 2016 2:29:13 pm com.intellisoftkenya.onetooner.gui.mainframe$migrationworker doinbackground info: deleted 0 records 'patient_status...

how can i group php array by certain key value -

i array this array ( [0] => array ( [cat] => cat [2] => 1 ) [1] => array ( [dog] => dog [3] => 1 ) [2] => array ( [cat] => cat [4] => 1 ) ) but want soemthing this array ( [0] => array ( [cat] => cat [2] => 1 [4] => 1 ) [1] => array ( [dog] => dog [3] => 1 ) ) i've created in way save keys , everything. let me know if works out :) <?php $start = [ ["cat" => "cat", "2" => 1], ["dog" => "dog", "3" => 1], ["cat" => "cat", "4" => 1] ]; $end = []; foreach($start $key => $array) { if(!isset($end[current($array)])) { ...

Mpandroidchart scroll when zoom -

i using mpandroidchart's linechart , i'm trying find way know , in situation when chart zoomed, when scroll reaches end in each direction. noticed when scroll ended on bottom side or left side , respectively methods chart.getviewporthandler().gettransx() , getviewporthandler().gettransy() return 0, in case know need know. what not finding way know when scroll ends on right side , top side, in cases value returned methods numbers cannot interpretate (eg: not equals viewport size, not equal chart's size multiplied scale factor). is there way this? thank help edit: i'll try explain better: zoom chart , start navigating scrolling. let's want see right part of zoomed chart, have scroll left untill reach end of chart. when right part of chart shown , if continue scrolling left, chart not scroll anymore in direction. how can know when happens?

scala - SBT build structure for a mono repository -

i'd use sbt build structured around single git repository tens of projects. i'd have following possibilities build: one-click build/test/release of projects in build. define , apply common settings projects in build. define project-specific settings in project sub-directories, keeping root of build clean. project should able depend on each other, but... most of projects not depend on each other in classpath sense. some of projects sbt plugins should included other projects (but not of them). now these requirements in mind, should structure of build? because of requirement 3, can't go single build.sbt in root of build, because don't want put projects settings there, since lot of text, , every change in single project reflected on top level. i've heard usage of *.sbt files both root project , sub-projects error-prone , not recommended ( producing no artifact root project package under multi-project build in sbt , or how can use sbt plugin dependency...

javascript - Focus on input field -

template 'tabs' 2 tabs. on first tab, have input field want put focus on. working when app starts input field being focused, when switch second tab , first tab, input loses focus. i focused when go tab 2 1 too. when click outside element, loses focus well. want input field focused. i tried mentioned solutions: .directive('focusme', function($timeout) { return { scope: { trigger: '=focusme' }, link: function(scope, element) { scope.$watch('trigger', function(value) { if(value === true) { //console.log('trigger',value); //$timeout(function() { element[0].focus(); scope.trigger = true; //}); } }); } }; }); <label class="item item-input" focus-me> <input type="number" class="somett" ng-model="code" ng-model-options="{ debounce: 100 }" placeholder="ready" ng-change=...

cordova - Android studio Error:Configuration with name 'debug' not found -

i have problem. when want gradle project sync in project, write: error:configuration name 'debug' not found. only 1 line, nothing more. don't know want me. here build.gradle : buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' } } apply plugin: 'android-library' ext { apply from: 'cordova.gradle' cdvcompilesdkversion = privatehelpers.getprojecttarget() cdvbuildtoolsversion = privatehelpers.findlatestinstalledbuildtools() } android { compilesdkversion 21 buildtoolsversion '21.1.2' defaultconfig { targetsdkversion 24 multidexenabled true } compileoptions { sourcecompatibility javaversion.version_1_6 targetcompatibility javaversion.version_1_6 } sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = [...

c# - iTextSharp produces invalid PDF -

using itextsharp 4.2.0, have made following function generate dummy pdf in memory , send client: internal override byte[] generatepdfdocument(pdfcontent content) { document document = new document(pagesize.a4, 30f, 30f, 30f, 30f); memorystream output = new memorystream(); pdfwriter writer = pdfwriter.getinstance(document, output); document.open(); document.add(new paragraph("hello world")); byte[] response = output.toarray(); document.close(); return response; } which called static function: public static byte[] print(string jsondata) { pdfgeneratorbase generator; generator = new itextsharpgenerator(); return generator.generatepdfdocument(view.getviewdata()); } which called webapi controller: public httpresponsemessage printpdf(httprequestmessage req) { httpresponsemessage result = new httpresponsemessage(httpstatuscode.ok); byte[] pdfdata = printreport.print(printjobstring); result.content = new bytearray...

javascript - use multiple live slider on html with jquery -

i new javascript , want solve following problem. html code below shows 2 live slider inputs in 1 form. 1 working. ( source: live output in jquery html5 range slider ) so how can use multiple sliders different values on same web page? $("#rangevalue").mousemove(function () { $("#text").text($("#rangevalue").val()) }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!doctype html> <html> <head><title>timing:</title></head> <body> <h1>timing:</h1> <form action="/cgi-bin/can/test.cgi" method="post"> <table style="width:300px" border="1"> <th>time</th> <tr> <td> <input type="range" name="p" value=16.08 min=0.01 max=32.08 id="rangevalue" step ="0.01"><label id=...

Import excel sheet header in r -

i have series of data sets stored in excel templates combining using r. have been using xlconnect package import data, works fine, template used store data has been through several revisions , data need extract in different places in different revisions. ideally revision number , there can tell r cells / named regions @ data. problem revision number in excel sheet header (i.e. part visible in page layout view). there way of accessing header r, ideally using xlconnect that's i'm using rest of import? thanks, graham

linux - to grep specific set of strings occuring multiple times in a single line -

my system generate lengthy lines in logs of want grep few fields values. tried grep , sed , i'm close. here, single log line contains multiple channel fields , analysis. how specific channel (occurring more once) single log line contains many such channel information. e.g. here need video channel analysis , it's occurring twice in line. .......{"channel":{"type": "video","protocol": "dynamic_96","rate": "1999102","packets":{"forwarded":{"total": "570495","rtpandrtcp": "570495","keepalives": "0","unknown": "0"},"keepalives":{"total": "0","assent": "0","h460": "0","stun": "0"},"errors":{"total": "0","media":{"nodestination": "0","invalidtype...