Posts

Showing posts from July, 2015

ajaxcontroltoolkit - Ajax Toolkit modal popup -

i have built application uses ajax toolkit modal popups. application tests fine on browsers run local iis on visual studio. when deployed iis 8.5 application works fine on chrome, ff , edge - (modal popup showing) on ie 11 , ie 10 modal popup not show. does have hint why is? kai i have solution. 1) donwload html5-dataset.js ( https://gist.github.com/brettz9/4093766 ) , save on folder /scripts 2) add code on page <asp:scriptreference path="~/scripts/html5-dataset.js" />

php - Multidimensional array Converting inside arrays to strings -

array ( [0] => array ( [0] => array ( [masteryid] => 6111 [rank] => 5 ) [1] => array ( [masteryid] => 6122 [rank] => 1 ) [2] => array ( [masteryid] => 6131 [rank] => 5 ) [3] => array ( [masteryid] => 6142 [rank] => 1 ) [4] => array ( [masteryid] => 6151 [rank] => 5 ) [5] => array ( [masteryid] => 6162 [rank] => 1 ) [6] => array ( [masteryid] => 6211

appcelerator - Image caching on Android 6.0 -

i having problems appcelerator titanium caching on android 6.0 devices. i've tried using 5.2.2 , 5.3.0 no avail. steps reproduce: create image view , set image url want cache. open app on android 6.0 device internet connectivity. image loads up. close application turn off wifi open app on 5.0 devices, image loaded without issue cache. on 6.0, it's loading default image. thought going solved fix included on 5.3.0, https://jira.appcelerator.org/browse/timob-20470 , apparently it's separate issue. is happening else? there workaround 6.0 devices? it looks same issue described in linked ticket. image not saved in temp directory not cached. issue fixed in sdk 5.4.0 not officially released yet. can try continuous build. installing sdk run following command in cli. appc ti sdk install --branch 5_4_x 5.4.0.v20160608165242

cakephp 2 validation error messages do not display -

here model contacts.php <?php app::uses('appmodel', 'model'); app::uses('validation', 'utility'); /** * base application model * * @package croogo * @link http://www.croogo.org */ //$validate = new validator(); // 'alphanumeric' => array( // 'required' => true, // 'allowempty' => false, class contacts extends appmodel { var $name = 'contacts'; var $usetable = false; var $validate = array( 'contactsaddress' => array( 'rule' => 'notempty', 'required' => true, 'message' => 'the address required'), 'contactsemail' => array( 'rule' => array('email', true), 'required' => true, 'message' => 'a valid email required'

c# - WPF - ItemControl DataBinding in a WrapPanel/Grid -

i read out images own datatype , sync list grid/wrappanel via itemcontrol binding. my xaml: <wrappanel > <itemscontrol name="images"> <itemscontrol.itemtemplate> <datatemplate> <image source="{binding link}" stretch="none" ></image> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </wrappanel> c# code: public mainwindow() { initializecomponent(); list<movie> items = new list<movie>(); items.add(new movie() { name = "movie1", link = "http://www.airvana.com/default/cache/file/1601d22d-9266-de31-d6b8d178db2933dc_small.png", column =0 }); items.add(new movie() { name = "movie2", link = "http://www.airvana.com/default/cache/file/1601d22d-9266-de31-d6b8d178db2933dc_small.png"}); items.add(new movie() { name = "m

go - Parsing integer from exec.Command output -

i'm trying run command inside go program , parse integer response. command returns output this: 6 fyb_src/ex1.fyb (1) wins! splitting lines , removing whitespace strings.split , strings.trimspaces works fine. however, while trying parse number integer following error: panic: strconv.parseint: parsing "0 \r1 \r2 \r3 \r4 \r5 \r6": invalid syntax but printing string i'm trying parse terminal yields following result: 6 i'm not sure go here. number looks integer me. error message isn't useful either (at least me). have idea? edit: code i'm running out, _ := exec.command(pwd+"/osx_fukyobrane_amd64", "fyb_src/"+filename, "fyb_src/salty.fyb", "t").combinedoutput() parts := strings.split(string(out), "\n") fmt.println(parts[0]) rounds, err := strconv.atoi(strings.trimspace(parts[0])) if err != nil {

delphi - ClientDataSet: Automatically apply the reconciled delta? -

in onreconcileerror event clientdataset, can tell ramerge , saves changes delta, ready apply updates without errors. there way tell dataset apply delta in onreconcileerror event? can think of convoluted way check if errors reconciled in afterapplyupdates event. so did have centralized code applying updates, , realized best place check if user requested merge. may still need clean bit, might solution others running problem. if(cds.changecount > 0)then begin fismerged := false; errors := cds.applyupdates(0); if(errors = 0)then begin cds.refresh; end //if there conflict, user might try merge. //if do, need reapply update. else if(fismerged)then begin errors := cds.applyupdates(0); if(errors = 0)then begin cds.refresh; end; end; end; fismerged class variable set in on reconciled handler. action := handlereconcileerror(dataset, updatekind, e); if(action = ramerge)then begin fismerged := true; end;

networking - Control development boards from web interface -

i have multiple raspberry pi/ beagle board/ panda boards connects web server (clouding). want clients control board's gpio web interface. have read many examples on internet in example web server inside every boards. so, me use 1 web server(clouding) outside of boards control board's gpio? thanks! you use nexusdatalink boards connected. data communication framework allows 1 link several devices or systems - server process may run anywhere. optionally rest interface generated per linked device based on xml file.

python 3.x - How to get certain text from a url links -

so im trying statistics in statistics box page on url page each team. example of page looks on hyperlink put below. im trying have if prints out; month : win % month : win % time: win% but not sure how write code, since last piece of code wrote in main giving me error. http://www.gosugamers.net/counterstrike/teams/16448-nasty-gravy-runners import time import requests bs4 import beautifulsoup def get_all(url, base): # called print team links r = requests.get(url) page = r.text soup = beautifulsoup(page, 'html.parser') team_links in soup.select('div.details h3 a'): members = int(team_links.find_next('th', text='members:').find_next_sibling('td').text.strip().split()[0]) if members < 5: continue yield base + team_links['href'] next_page = soup.find('div', {'class': 'pages'}).find('spa

getting & setting spark.driver/executor.extraClassPath on EMR -

as far can tell, when setting / using spark.driver.extraclasspath , spark.executor.extraclasspath on aws emr within spark-defaults.conf or elsewhere flag, have first existing value [...].extraclasspath set to, append :/my/additional/classpath in order work. is there function in spark allows me to append additional class path retains/respects existing paths set emr in /etc/spark/conf/spark-defaults.conf ? no such "function" in spark but: on emr ami's can write bootstrap append/set whatever want in spark-defaults, of course affect spark jobs. when emr moved newer "release-label" stopped working bootstrap-steps replaced configuration jsons , manual bootstraps run before applications installed ( @ least when tried )

javascript - How to run script after jQuery.getScript is called? -

i have use case checking if code on page, if not use $.getscript fetch script. in done trying call function in script gives error uncaught referenceerror: listinit not defined . have set interval check function, not finding it. way call function in external calling in? here script call, , function in external: get script: jquery.getscript(scripturl) .done(function() { listinit(listoptions); }); function in external called in: var listinit = function(options) { console.log(options) } i can see in network tab call , response shows minified code. have tried see if function available: jquery(document).ready(function(){ var findlistfunction = setinterval(function(){ if (typeof listinit !== 'undefined' && $.isfunction(listinit)) { console.log('its available') }else{ console.log('no such function') } },1000); }); edit: i put console log in external file outside of function. console log exe

java - Eclipse folder structure changed -

i've searched web information. created maven project in eclipse. has been working well. when @ project hierarchy had source folders looked like: src/main/java , src/main/resources. within src/main/java had com.common.core , com.common.game i deleted game directory , src folder flattened out top level src. how fix in eclipse. project not compile because import com.common.core.file how folder src/main/java project -> properties -> build path add , remove source folders follow new structure.

FMXBroadcastReceiver (Android) is broken in Delphi 10 Seattle? What changed since XE7? -

to work usb-devices (on android-devices having usb-host) 1 has use broadcastreceiver . have found demo ( https://github.com/freeonterminate/delphi/tree/master/broadcastreceiver ). have tested on delphi xe10. wasted lot of time make work until discovered demo works on xe7 not on xe10. "interface not supported" error occured during jfmxbroadcastreceiver creation (or near). to demonstrate problem have created brand new simple project https://github.com/ashumkin/delphi-android-broadcastsample . works in xe7 (press "register" button create broadcast receiver catches , logs (see adb logcat) screen locking/unlocking. not work in xe10 - "interface not supported" occurs. in logcat can see w/dalvikvm(31735): dvmfindclassbyname rejecting 'com/embarcadero/firemonkey/broadcast/fmxbroadcastreceiverlistener' w/dalvikvm(31735): dvmfindclassbyname rejecting 'com/embarcadero/firemonkey/broadcast/fmxbroadcastreceiver' (but present in logcat of xe7

angularjs - Directive isn't properly updating controller variable -

Image
i'm new angular, , i'm trying update 1 of controller's variables directive, won't seem work. variable populated in directive, , when log there it's fine. when try log variable controller; logs fine @ first, it's "undefined". i have no idea why happening. :( directive app.directive('reportfilter', function() { return { restrict: 'e', scope: {}, controller: 'maincontroller', templateurl: 'js/directives/reportfilter.html', link: function(scope, element, attrs) { scope.updatetable = function(selectedoffer,startdate,enddate) { var offer='offer:'+selectedoffer.offer_id; $.ajax({ type: 'post', url: 'daily_summary.php', data: { 'offer': selectedoffer.offer_id }, datatype: 'json', cache: false, success: function(response) { scope.myvariable=response; scope.getd

How to delete data in gun DB? -

i have been developing things , know during prototyping types , tables change quickly... nice cleanup old data , start again in meshes. for using example http server deleted data.json; forgot localstorage in browser needs cleared. one might suppose put(null) i asked on gitter , got https://github.com/amark/gun/wiki/delete except deletes , lol, our excuse "it works os, when delete >something gets tossed in trash/recycle bin. that's all." better safe sorry though if trying "delete" stuff because messed while developing >something, follow 3 step process: 1) localstorage.clear() in every >browser tab have up, 2) crash server , rm data.json, 3) restart >everything. should have clean slate. times while i'm >devleoping put localstorage.clear() @ top of code >have worry clearing server. welcome gun community! asking questions. yes, deleting data done gun.put(null) . take: var gun = gun(); var users = gun.g

python - Deleted rows from reflected table with SQLAlchemy -

i have table i'm trying delete data from. have been using session() object query data, , works fine. when go delete list of data, fails. # load engine , reflect. engine = create_engine("...") metadata = metadata() session = sessionmaker(autoflush=true, autocommit=true) session.configure(bind=engine) session = session() metadata.reflect(bind=engine) # queries work. table = table("some_table", metadata, autoload_with=engine) session.query(table).filter(table.c.column.between(dobj1,dobj2)).all() # deletes not. session.query(table).filter(table.c.column.in_([1,2,3,4,5])).delete() when try delete bunch of rows, this: file "/virtualenv/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 1180, in _do_pre_synchronize target_cls = query._mapper_zero().class_ attributeerror: 'table' object has no attribute 'class_' i tried this question's method, gives me error: file "/virtualenv/lib/python2.7/site-packa

mysql - SQL select the only rows with only a certain values in them -

i have same problem here : sql select rows value in them but solution have found work 1 value given, mean want work number of values {2 or +}, example : col 1 col 2 col 3 1 1 2 2 3 b 1 4 c 1 5 c 2 6 d 1 7 c 3 i want rows contain cols3 = 1 , cols3 =2 , (just values 1 , 2) , output : "a" table given, dont want have c because has values of cols 3 != of 1 or 2, solution in link allows doing 1 value , want extend 2 value or plus , can me please :d you can use conditional aggregation this: select col2 yourtable group col2 having sum(col3=1) > 0 , sum(col3=2) > 0 , sum(col3 not in (1,2)) = 0 sql fiddle demo

python - Beautiful Soup Returning Unwanted Characters -

i'm using beautiful soup scrape pages trying height of athletes: req = requests.get(url) soup = beautifulsoup(req.text, "html.parser") height = soup.find_all("strong") height = height[2].contents print height unfortunately, gets returned: [u'6\'0"'] i've tried: height = str(height[2].contents) and height = unicode(height[2].contents) but still [u'6\'0"'] result. how can have 6'0" returned without characters? help! those aren't "extra characters". .contents returns list , element chose has 1 child, , you're getting list containing 1 element. python prints list pseudo python code, can see , what's in it. perhaps want .string ?

How to download all data in a Google BigQuery dataset? -

is there easy way directly download data contained in dataset on google bigquery? i'm downloading "as csv", making 1 query after another, doesn't allow me more 15k rows, , rows need download on 5m. thank you you can run bigquery extraction jobs using web ui, command line tool, or bigquery api. data can extracted for example, using command line tool: first install , auth using these instructions: https://developers.google.com/bigquery/bq-command-line-tool-quickstart then make sure have available google cloud storage bucket (see google cloud console purpose). then, run following command: bq extract my_dataset.my_table gs://mybucket/myfilename.csv more on extracting data via api here: https://developers.google.com/bigquery/exporting-data-from-bigquery

angularjs - How to start express server in grunt? -

i generated angular 1.0 app yeoman. gruntfile not contain express server config: connect: { options: { port: 9000, // change '0.0.0.0' access server outside. hostname: 'localhost', livereload: 35729 }, livereload: { options: { open: true, middleware: function (connect) { return [ connect.static('.tmp'), connect().use( '/bower_components', connect.static('./bower_components') ), connect().use( '/app/styles', connect.static('./app/styles') ), connect.static(appconfig.app) ]; } } }, how can add express server configuration it? can grunt-contrib-connect? you can use "grunt-express-server" https://www.npmjs.com/package/grunt-express-server

c# - Incompatiable Project VIsual Studio -

Image
so have project using xna framework develop 2d game. went work on after working on @ university , whenever open error i have worked on @ uni before , never has problem once home. running .net version 4.0 , xna version 4.0 <targetframeworkversion>v4.0</targetframeworkversion> <targetframeworkprofile>client</targetframeworkprofile> <xnaframeworkversion>v4.0</xnaframeworkversion> <xnaplatform>windows</xnaplatform> so see no reason why should saying incompatible. there thing can try? xna supported in visual studio 2010. not supported in later vs versions.

json - Go: How do I turn response body into request body? -

i have handler makes request elasticsearch. cat json response request: resp, err := http.get(geturl) defer resp.body.close() bodystring := "" if resp.statuscode == 200{ bodybytes, err := ioutil.readall(resp.body) checkforerror(err) bodystring = string(bodybytes) fmt.fprintf(w, bodystring) } how turn bodystring can pass http.post of sort: http.post("https://httpbin.org/post", "application/json; charset=utf-8", jsondata) i not sure trying achive, may help. bodybytes, err := ioutil.readall(resp.body) reader := bytes.newreader(bodybytes) http.post("https://httpbin.org/post", "application/json; charset=utf-8", reader) //or can directly //http.post("https://httpbin.org/post", "application/json; charset=utf-8", resp.body)

javascript - What's the '@' (at symbol) in the Redux @connect decorator? -

i learning redux react , stumbled upon code. not sure if redux specific or not, have seen following code snippet in 1 of examples. @connect((state) => { return { key: state.a.b }; }) while functionality of connect pretty straightforward, don't understand @ before connect . isn't javascript operator if not wrong. can explain please , why used? update: it in fact part of react-redux used connects react component redux store. the @ symbol in fact javascript expression currently proposed signify decorators : decorators make possible annotate , modify classes , properties @ design time. here's example of setting redux without , decorator: without decorator import react 'react'; import * actioncreators './actioncreators'; import { bindactioncreators } 'redux'; import { connect } 'react-redux'; function mapstatetoprops(state) { return { todos: state.todos }; } function mapdispatchtoprops(dispatc

java - How to use xls csv files as source in javafx charts -

Image
i newbie in java, looking code build charts , tables in javafx using local xls , csv files source. csv file first 3 lines : n° tournée";"secteur géographique";"n° contrat";"libellé catégorie facturation";"libellé code relève";"ann trn";"per trn";"n° facture";"mois actif - montant ttc de la facture ";"montant restant dû";"montant ttc facture avoir";"volume facturé";"libellé type origine";"libellé traité principal";"libellé type abonnement";"libellé type utilisation";"code état abonnement";"mois precendent - montant facturé";"mois precendent - vol facturé";"anne precedente - montant ttc de la facture";"anne precedente - vol cso facturé";"type sect";"règlement";"mode de facturation";"ecart m-actif vs m-precedent (mnt)";"ecart m-actif

javascript - Rails Ajax dropdown menu - no response -

so i've solved problems little program i'm writing: the 1 left, i'm beating head against, goes this. it's standard 2 dropdown menus, select item on 1 populate other. in view: <%= select_tag( :contractor_id, options_from_collection_for_select(contractor.all, "id", "appointment_record"), :'data-remote' => 'true', :'data-url' => url_for(:controller => 'contractors', :action => 'getdata'), :'data-type' => 'json') %> <%= select_tag( :company_id, # name of selectbox ) %> in controller: def getdata @data_from_select1 = params[:contractor_id] @data_for_select2 = company.where(:id => @data_from_select1).all # render array in json containing arrays like: # [[:id1, :name1], [:id2, :name2]] render :json => @data_for_select2.map{|c| [c.id, c.name]} end in application.js:

Meteor email all recipients were rejected -

this meteor server code uses email 1.0.12 package send email. meteor.startup(function() { smtp = { username: 'some@gmail.com', password: 'mypassword', incomingserver: 'pop.somecompany.com', incomingport: '110', outgoingserver: 'smtp.somecompany.com', outgoingport: '587' }; process.env.mail_url = 'smtp://' + encodeuricomponent(smtp.username) + ':' + encodeuricomponent(smtp.password) + '@' + encodeuricomponent(smtp.outgoingserver) + ':' + smtp.outgoingport; }); but terminal error shows recipienterror: can't send mail - recipients rejected what steps take find cause of problem in order fix it? thanks. edit instructions web hosting company are: incoming email server: pop.companyname.com outgoing email server: smtp.companyname.com username: full mailbox name. password: mailbox password. incoming mail port: port 110. outgoing mail port: port 25 or

php - Access another module's entity -

i using 2 module in zend project. 1 administration , client. have created 1 entity in administration module. now, want access file. should need copy file client module's entity? or can access giving it's path. if so, path? going software-design-perspective, should not need entity itself, rather should create service let's other modules access db / entities. other tho, use othermodule\entity\newsentity; and... new newsentity(); . basic php 5 namespace stuff. see namespaces in under 120 seconds .

Neo4j database size grows -

im using neo4j 3.0.1 community, , have few gbs of data. data become outdated (like 2,3 times per day) , have create new data first, , delete old stuff (so @ point in time data available). the problem neo4j doesnt reuse space deleted nodes/relationships. im using match (n) condition deteach delete n i can see nodes beeing deleted (their number constant ~30m) size growing (after 12 updates, size 12x bigger should be). i found previous posts neo4j database size / shrinking store-utils find better solution. i found old question (from version 1.x) neostore.* file size after deleting millions node doesnt work in answer @ least in case. there advices delete database files , create new one, require service stopped shouldn't happen. i found information in order reuse space need restart db first, tried , didn't work. is there way free/reuse space deleted nodes/relationships ? maybe miss configuration, or available in enterprise version? edit: finally had time te

osx - Time to install minitab using Wine -

i installing minitab16 using winebottler 1.4.1.6. installation has been going on 2 hours now. dialog box says "creating minitab.app". has done before? idea how long takes? it has errored out. nothing besides resource depriving game applications should use enough memory take 2 hours, or kind of relentless scan. suggest running directly, still save information next use.

haskell - Typeclass instance turned Int into Num a? -

i tried create variadic function returns repa shape: class indexable r idx :: [int] -> r instance indexable int idx [x] = x instance (indexable b) => indexable (int :. b) idx (x:xx) = x :. (idx xx) instance (indexable a) => indexable (z :. a) idx xs = z :. (idx xs) instance (indexable r) => indexable (int -> r) idx xs = \x -> idx (x:xs) it works: > fromlistunboxed (idx [] (3 :: int)) [1..3] :: array u dim1 int aunboxed (z :. 3) [1,2,3] but have explicitly use 3 :: int instead of 3 , despite instances explicitly using int . following confused me: > :t idx [] 3 idx [] 3 :: (num a, indexable (a -> t)) => t i thought type signatures in instances force number int , turned num a . why? , how compiler recognize numbers going int s? type classes open : later on, possibly in module, define instance. compiler can't rely on not doing that, can not commit instances have defined far. you try function instance, instead: i

javascript - How can I appendChild to a text field? -

i trying create text field takes user input , creates tag if valid email id. i using appendchild() method append tags after creating them unable so. below code append <span> field: html <textarea id="customfield" class="mdl-textfield__input" type="text" rows="1"></textarea> js document.getelementbyid("customfield").appendchild(spanparent); i not sure right way this, great if can help. you cannot use appendchild() input field, instead, use container of input field, see live action here: https://jsfiddle.net/37b2fa2e/2/ . you should consider using insertbefore() method, helps inserting specified node before reference node child of current node.

javascript - How to preselect a option - Dropdown -

my html static variant, not solution builded ng-repeat or existing json/angular controler. i need select custom option , used alreay ng-select without success. my html looks like: <div class="btn-group" dropdown> <button type="button" class="pull-right btn btn-block btn-dropdown" dropdown-toggle> <div class="pull-left"> <i class="flag-{{my.filter.flag}} left vcenter"></i> <span class="vcenter">{{my.filter}}</span> </div> <div class="pull-right"><span class="caret"></span></div> </button> <ul class="dropdown-menu" dropdown-menu ng-init="options[0]"> <li ng-class="{active: my.filter == 'germany'}"> <a ng-click="my.filter = 'germany'

Package-private scope in Scala visible from Java -

i found out pretty weird behaviour of scala scoping when bytecode generated scala code used java code. consider following snippet using spark (spark 1.4, hadoop 2.6): import java.util.arrays; import java.util.list; import org.apache.spark.sparkconf; import org.apache.spark.api.java.javasparkcontext; import org.apache.spark.broadcast.broadcast; public class test { public static void main(string[] args) { javasparkcontext sc = new javasparkcontext(new sparkconf() .setmaster("local[*]") .setappname("test")); broadcast<list<integer>> broadcast = sc.broadcast(arrays.aslist(1, 2, 3)); broadcast.destroy(true); // fails java.io.ioexception: org.apache.spark.sparkexception: // attempted use broadcast(0) after destroyed sc.parallelize(arrays.aslist("task1", "task2"), 2) .foreach(x -> system.ou

c# - Image control not shown in Pivot Item -

i trying put controls inside grid , situated in pivot item. have added far shown, picture control default picture not visible. i can see picture control loaded default pic in design editor, not when application run. when application launched, button , ellipse visible. here xaml code: <phone:pivot horizontalalignment="left" height="768" grid.row="1" title="pivot" verticalalignment="top" width="480"> <phone:pivotitem cachemode="{x:null}" header="home" margin="10,10,-235,-578"> <grid horizontalalignment="left" height="576" margin="10,10,0,0" verticalalignment="top" width="438"> <image source="images/defaultprofilepic.jpg" horizontalalignment="left" height="100" margin="32,35,0,0" verticalalignment="top" width="100"/>

regex - How to extract the year out of a string in R -

i have dataframe entries looking like: "wittmann 2014 100 hills dry riesling (rheinhessen)" , "hazlitt 1852 vineyards 2013 riesling (finger lakes)" i need extract years (vintage of wine) out of string, years 2012 till 2015... would nice if can me find right code/regex in r. maybe regex work you: /(\b201[2-5]\b)/g try online

file - Endless while loop - C programming -

i tried create program compares between 2 files , checks if second file exist in first file. function r_scan gets endless loop. know why doesn't work? this code: /** function scan file , check if there virus in file. input: virus_address - address of virus file. scaned_address - adress of file scan. output: end - if the file infected. 0 - infected, 1 - not infected. **/ int r_scan(char* virus_address, char* scaned_address) { //init char v = ' ', s = ' '; int end = 1, = 0; long seek = 0; file* vp = null; file* sp = null; //open th5e files. vp = fopen(virus_address, "rb"); sp = fopen(scaned_address, "rb"); fseek(vp, 0, seek_set); fseek(sp, 0, seek_set); //pre scanning seek = 0; //check if file infected. while (!(feof(sp)) && end) { fread(&s

objective c - WebKit WebView paste: fails for dynamic UTIs -

when copying url chrome on osx , pasting editable webkit webview, nothing gets pasted. i verified there items on nspasteboard , nspasteboarditem has following types: "dyn.ah62d4rv4gu8zs3pcnzme2641rf4guzdmsv0gn64uqm10c6xenv61a3k", "dyn.ah62d4rv4gu8yc6durvwwaznwmuuha2pxsvw0e55bsmwca7d3sbwu", "public.utf8-plain-text", "dyn.ah62d4rv4gu8yg55wqzkgc65yqzvg82pwqvdg22p0r73fk8puqyuda8b1gy5xerwdgk2a", "dyn.ah62d4rv4gu8yg55wqzkgc65yqzvg82pwqvdg22p0r73fk8puqyuda8b1gy5xerwdg3cu" i understand these auto-generated , map weburlswithtitlespboardtype. on performing same operation safari webview, works since contains "public.utf8-plain-text" is there known workaround handling these utis better? webkit webviews don't seem support paste operations dynamic utis. worked around recreating pasteboard items without utis when paste: intercepted in webview:docommandbyselector: - (void)cleanuppasteboard:(nspasteboard *)pasteb

Different outputs for the same thing in python -

sr = [12,13,4] thre = 1 kaju = [] p in range(len(sr)): sr[p] -= thre kaju.append(sr) print sr print kaju result came out as : [11, 13, 4] [11, 12, 4] [11, 12, 3] [[11, 12, 3], [11, 12, 3], [11, 12, 3] i don't know why sr , kaju not same lists passed reference in python. when appending sr kaju , appending reference same list. print statements reflect changes sr upon each iteration, kaju contains bunch of references same list. if want elements of kaju reflect changes on each iteration, must copy sr 's value on each iteration, can done built-in list() function for p in range(len(sr)): sr[p] -= thre kaju.append(list(sr)) print sr print kaju outputs : [11, 13, 4] [11, 12, 4] [11, 12, 3] [[11, 13, 4], [11, 12, 4], [11, 12, 3]]

VBA Excel calculating slowly -

i have macro taking long time process. main reason loop populating range formula. to speed things used autofill function on range in order populate formula faster. works, when run macro need press shift+f9 in order update formula. for excel process calculations taking 20 minutes, while takes 20 seconds populate range formula. is there workaround make excel update formulas faster? i have tried breaking down range , using activesheet.calculation function slows down. sheets("sheet").range(cl1 & i.row).formula = "=round(if(trim(left(" & cl1 & "$2,4))="""",""missing value"",if($b" & i.row & "=""sheet1"",sumifs(indirect(""'""&$b" & i.row & "&""'!""&substitute(address(1,match(trim(left(" & cl1 & "$2,4))&"" - total"",sheet2!$1:$1,0),4),""1

java regex double-backslash in character class -

this question has answer here: java regex pattern unclosed character class 2 answers i need following regex in java: split string @ each comma that's not preceded backslash (ie. escaped) , followed 0 or more whitespaces. i've been trying this: string str = "name=doe\, jane, hobby=skiing, height=1.70"; string[] parts = str.split("[^\\],\s*"); which correct syntax in perl , works there. not in java. the above throws exception during compilation: error: illegal escape character string[] parts = str.split("[^\\],\s*"); adding third , fourth backslash in character class doesn't help str.split("[^\\\\],\s*"); adding second backslash whitespace allows compile, string[] parts = str.split("[^\\],\\s*"); but runtime regex.patternsyntaxexception occurs, stating unclosed character class :

c++ - rapidjson: How can I split a Document object to a smaller Document object? -

i working on c++ project , use rapidjson json parsing. have json: { "a": "vala", "b": { "ba": "valba", "bb": "valbb", "bc": "valbc" }, "c": "valc" } i parse whole json , document object containing values. want somehow process document object , extract b part. if parsing json: { "b": { "ba": "valba", "bb": "valbb", "bc": "valbc" } } i thought of parsing document object myself wondering if there easier/faster way of doing that. ideas? "b" element can extracted , put new document way: #include <iostream> #include <rapidjson/document.h> #include <rapidjson/stringbuffer.h> #include <rapidjson/writer.h> using namespace rapidjson; int main(void) { const char* json = "{\"a\": \"vala\",\&quo

javascript - Refresh page when script is triggered -

i use url remove products outside cart. use following html: <button type="button" class="btn btn-link btn-xs btn-remove-from-cart" onclick="removeitem('p','{$num}')"><i class="fa fa-times"></i></button> when clicking on button, following script triggered: <script> {literal} function removeitem(type,num) { var response = confirm("{/literal}{$lang.cartremoveitemconfirm}{literal}"); if (response) { window.location = 'cart.php?a=remove&r='+type+'&i='+num; } } {/literal} </script> the problem work, results not visable. because page need refreshed see product removed. is there way change script, page reloaded? or better, product removed using ajax, without refreshing page? for reload page ajax use location.reload(); all code looks <script> {literal} function removeitem(type,num) { var response = confirm("{/litera

How to parse JSON from the Invoke-WebRequest in PowerShell? -

when sending request server, uses self-signed certificate: add-type @" using system.net; using system.security.cryptography.x509certificates; public class trustallcertspolicy : icertificatepolicy { public bool checkvalidationresult( servicepoint srvpoint, x509certificate certificate, webrequest request, int certificateproblem) { return true; } } "@ [system.net.servicepointmanager]::certificatepolicy = new-object trustallcertspolicy $response=invoke-webrequest -uri https://yadayada:8080/bla -method echo $response i'm getting following response: statuscode : 200 statusdescription : ok content : {123, 10, 108, 111...} rawcontent : http/1.1 200 ok content-length: 21 date: sat, 11 jun 2016 10:11:03 gmt { flag:false } headers : {[content-length, 21], [date, sat, 11

java - Android RecyclerView pass and display Item data depending on condition -

i have recyclerviewactivity , data recyclerview: // reference recyclerview recyclerview recyclerview = (recyclerview) findviewbyid(r.id.recyclerview); // data recyclerview carddata carddata[] = { new carddata("bread", r.drawable.bread), new carddata("dairy", r.drawable.dairy), new carddata("meat", r.drawable.meat) ...} each carddata connected different activity simple listview. now used shared preferences , boolean variable check if there items in every listview. after check completes - pass true/ false value recyclerviewactivity: sharedpreferences pref = getsharedpreferences("filename", mode_private); boolean = pref.getboolean("key1", false); boolean b = pref.getboolean("key2", false); boolean c = pref.getboolean("key3", false); now need - to display carddata depending on a/b/c values . if receive a: true - need display addi

jsf - Can't get filtering to work on PrimeFaces DataTable -

Image
i trying use filtering on datatable. whenever table first loads, looks this: if enter text filter of user name, table looks this: i expect show dangreen87 since mike.smith not contain "d". displays no user names. im not sure behaviour is? i have datatable so: <h:body> <ui:composition> <h:panelgroup layout="block" styleclass="messagespanel" rendered="#{socialadvertisermanagedbean.displaysearch}" > <p:datatable resizablecolumns="true" var="account" value="#{searchmanagedbean.accountstodisplay}" scrollable="true" paginator="true" rows="10" rowkey="#{account.id_value}" emptymessage="no accounts found given criteria" widgetvar="searchtable" fi

java - Eclipse editor runs slow on Ubuntu 16.04 after first project build -

i've installed ubuntu (16.04) i've noticed after first build of project on eclipse (i've tried luna , mars) editor starts run slow. there noticeable lag when typing , selecting text etc. doesn't make unusable, irritating. i've done following try , fix this, no avail: allocate more memory in eclipse.ini set environment variable $swt_gtk3=0 (as found said there may gtk3 bug in 16.04. update graphics drivers at point i'm not sure else do. seems run @ first, after first build (java) dies bit. suggestions on try , fix appreciated! it's first time i've used eclipse ubuntu, i'm on windows machine, i'm not sure if maybe i've not set properly. add below lines eclipse.ini file: --launcher.gtk_version 2 before line: --launcher.appendvmargs

java - Converting UTC date from server into local time -

i getting string date server 2016-06-11t11:14:57.000z since utc, want convert local time. simpledateformat mformat = new simpledateformat("yyyy-mm-dd't'hh:mm:ss.sss'z'"); simpledateformat endformat = new simpledateformat("hh:mm a"); mformat.settimezone(timezone.gettimezone("gmt+5:00")); date date = mformat.parse(mbooking.starttime); however date converted 2:00am now don't why 11am getting converted 2:00am what wrong doing? because don't set timezone each simpledateformat indeed mformat should set utc , endformat gmt + 5 , here supposed do: simpledateformat mformat = new simpledateformat("yyyy-mm-dd't'hh:mm:ss.sss'z'"); // set utc original date format input timezone mformat.settimezone(timezone.gettimezone("utc")); date date = mformat.parse("2016-06-11t11:14:57.000z"); simpledateformat endformat = new simpledateformat("hh:mm a"); // set gmt + 5 t

raspberry pi - Python GPIO add_event_detect each state individually -

i have few lever-type on off switch have status printed switches on/off independantly off other switches. so far, have come far: import rpi.gpio gpio time import sleep gpio.setmode(gpio.bcm) gpio.setup(7, gpio.in) # switch 2 gpio.setup(11, gpio.in) # switch 3 def print_func(pin): if gpio.input(7) == 0: print "switch 2 on" elif gpio.input(7) == 1: print "switch 2 off" elif gpio.input(11) == 0: print "switch 3 on" elif gpio.input(11) == 1: print "switch 3 off" gpio.add_event_detect(7, gpio.both, callback=print_func, bouncetime=300) gpio.add_event_detect(11, gpio.both, callback=print_func, bouncetime=300) while true: sleep(1) however, doesn't me anywhere. can't figure out how mentioned status of lever move, without going through loop mentioning status each one.. any appreciated! i don't have raspberry-pi on me

android - onGpsStatusChanged NOT firing for GpsStatus.Listener -

would listen gps availability . followed this . however, ongpsstatuschanged not fired when disabled/enabled gps. tried on multiple phones. also, looked related stackoverflow qns such this , this , this . met no success. appreciated. thanks! code snippets: listener listener mgpslistener = new gpsstatus.listener() { @override public void ongpsstatuschanged(final int event) { log.d(tag, "---ongpsstatuschanged---"); switch (event) { case gpsstatus.gps_event_started: log.d(tag, "gps_event_started"); break; case gpsstatus.gps_event_first_fix: log.d(tag, "gps_event_first_fix"); break; case gpsstatus.gps_event_stopped: log.d(tag, "gps_event_stopped"); break; case gpsstatus.gps_event_satellite_status: log.d(tag, "gps_event_satellite_status");