Posts

Showing posts from April, 2011

android - permission denial for content provider when called from within the same app -

i have 1 app. has content provider not exported (i don't want other apps have access content) have been using content provider until now. i have created content observer update textview . onchange method gets called when content changes , tries re-query content. that's when gets security exception looks this: java.lang.securityexception: permission denial: reading org.sil.lcroffline.data.dataprovider uri content://org.sil.lcroffline/users/by_account_name/5555544444 pid=0, uid=1000 requires provider exported, or granturipermission() here's code generates it: @override public void onchange(boolean selfchange, uri uri) { cursor c = null; try { c = mcontentresolver.query(userentry.builduserphoneuri(maccount.name), null, null, null, null); // stuff data in cursor } { if (c != null) c.close(); } } the uri looks it's formed properly, , don't think there's problem matching in content provider. the code above ...

What is the best way to automate REST api -

i trying automate rest api methods. wanted know way automate using java+selenium+httpclient or using ruby+minitest . please help... instead of using httpclient in java, better use jersey clients[jax-rs implementation]. following links familiarity jersey client. https://jersey.java.net/documentation/latest/client.html http://howtodoinjava.com/jersey/jersey-restful-client-examples/

java - How to call ic_action_overflow button(option menu )onclicklistner in oncreate of main class in android -

i need call onclicklistner ic_action_overflow button(option menu button) in oncreate of main class ....how write onclicklistner button..thanks in advance! code should like... public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); ic_action_overflow.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub //body } }); } } use performclick method ic_action_overflow.performclick();

cordova - Developing platform independent app in Ubuntu using PhoneGap -

i new phonegap.i need develop application should platform independent(that should run in platforms android,ios,windows) using phonegap.i have created sample project android in ubuntu working fine when building ios same sample project showing warning - "warning: applications platform ios can not built on os - linux." how create project of ios , windows in ubuntu using phonegap.please me.thanks in advance. you cannot build ios version of phonegap app without access xcode due restrictions put in place apple. you can use phonegap build build ios version, run you'll still need set various keys , certificates required.

Is Firebase 3 node.js server authentication going to change? -

right seems way authenticate node.js server passing service account private key means private key lays in ram won't pass security review. is method going change passing token expiration can generated in secured manner somewhere else? i'm talking firebase 2 authentication (but not hs256 shared secret) love comment firebase's engineers team. thanks just answer that. you can : var config = { apikey: "<api_key>", authdomain: "<project_id>.firebaseapp.com", databaseurl: "https://<database_name>.firebaseio.com", storagebucket: "<bucket>.appspot.com", }; firebase.initializeapp(config); and doing firebase.auth().signinwithcustomtoken(<token>) before calling firebase.database().ref() you can config going firebase's app overview ( https://console.firebase.google.com/project/<app_name>/overview ) , pressing "add firebase web app"

adding the same admob unit id on multiple android apps -

i created admob account , built android apps , want know if there problem if added same admob unit id on multiple android apps? no there not problem if add single unit-id of admob multiple apps. but better keep unique unit-id of admob helps know how particular app. performing in requests , clicks. understand android market, can adjust and/or improve app.

Show embed youtube video from database to web using php -

this question has answer here: php parse/syntax errors; , how solve them? 12 answers i want display embed video database , display web browser syntax eror "parse error: syntax error, unexpected t_variable in c:\xampp\htdocs\iklan2\vid2.php on line 3" this eror you dont have semicolon after include (include_once "config.php"; )

Soft lines after html elements and a specific letter showing wrongly in Linux -

the previous week moved local server site computer windows 1 linux.thats when noticed there weird soft lines after elements , letter "Λ" (which greek) showing damaged.its important mention if zoom out letter displayed correctly.also visited site pc windows , seems fine. hope these photos understand better problem. soft lines + letter problem soft lines + zoom out i have read somewhere (don't remember exactly) many problems of sort caused encoding. might want ensure characters utf-8. have @ this article hope helps

Javascript inside HTML tags -

i want reference javascript variable inside html tag this: <ul data-target="#{this.state.name}"></ul> but doesn't seem valid syntax. know possible in coffeescript, there similar syntax in javascript? i'm using es6. you seem looking template literals allow string interpolation in es6. equivalent coffeescript 's "<ul data-target=\"#{this.state.name}\"></ul>" would be `<ul data-target="${this.state.name}"></ul>`

C# unit testing a class -

i'm doing unit testing class library , i'm stuck on how test method. need test scenarios check if password less 8 characters cannot accepted, check if password 8 or more characters can accepted , check if password space in front cannot accepted. the code below class library. public class passwordchecker { public bool checkpassword(string pwd) { if (pwd.length >= 8 && !pwd.startswith("")) { return true; } else { return false; } the code below testing project. [testclass] public class passwordcheckertest { [testmethod] public void checkpassword8charslong() { string validpassword = "12345678"; string invalidpassword = "abc"; passwordchecker checker = new passwordchecker(); assert.istrue(checker.checkpassword(validpassword)); assert.isfalse(checker.checkpassword(invalidpassword)); } ...

c# - How to check if a keystroke was a backspace in the textbox key press event handler -

i receiving key press event , want check if key in question backspace. what's best way that? use e.keychar == (char)keys.back need cast char since keys enumeration. msdn

ios - Fetch data from FMDB Database -

Image
in app, want fetch data fmdb database , data want send watch. problem when data fetched, doesn't show actual data in console ticket_type = movie, time = 11:42 p.m. instead shows memory address result. the source code ticketdata below class ticketdata: nsobject { var field1: string? var field2: string? var field3: string? var field4: string? override init() { super.init() } convenience init(field1: string, field2: string, field3: string, field4: string) { self.init() self.field1 = field1 self.field2 = field2 self.field3 = field3 self.field4 = field4 } } the screenshot app screenshot app my source code below class ticketdetailviewcontroller: uiviewcontroller, wcsessiondelegate { var databasepath = nsstring() var holding_ticket_category: string = "" var holding_image: uiimage? var hold_ticketname: string = "" var hold_ticketdate: string = "" var hold_tickettime: string = "" var session:...

mysql - How to get total delay from two columns group by day? -

Image
i have table in mysql database named internet 3 columns: id, dropped_at , dropped_to shown in image how find total delay group date? well, have tried it's not working here mysql code: select dropped_at, dropped_to, timediff(dropped_to,dropped_at) delay internet weekday(dropped_at) between 0 , 6 , week (dropped_at) = week (now()) group cast(dropped_to date) if want total delay each day following query work: select date(dropped_at) date, sum(timestampdiff(minute,dropped_at,dropped_to)) delayinminutes internet group date order date; note: delay in minutes . can change unit like if want delay in hh:mm:ss format try following query instead select date(dropped_at) date, sec_to_time(sum(timestampdiff(second,dropped_at,dropped_to))) delay internet group date order date;

bash - Find all matched pattern with grep -

in txt1 s01a1p2 s01a1p5 s01a1p4 in txt2 data/train/wave/s01a1p3.mfc data/train/wave/s01a1p7.mfc data/train/wave/s01a1p8.mfc data/train/wave/s01a1p1.mfc data/train/wave/s01a1p5.mfc data/train/wave/s01a1p6.mfc data/train/wave/s01a1p2.mfc data/train/wave/s01a1p4.mfc use grep -f txt1 txt2 , result data/train/wave/s01a1p4.mfc but want result find pattern data/train/wave/s01a1p5.mfc data/train/wave/s01a1p2.mfc data/train/wave/s01a1p4.mfc what can do? txt1 contains crlf line terminators. try this: grep -f <(dos2unix <txt1) txt2

How can I hide/show a form when a button is clicked using javascript? -

i need correct code. have watched video youtube in video, use checkbox instead of button. i'm having problem if else statement of javascript. have checked previous post have same problem couldn't find 1 can solve problem. please me. thank much. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <link href="css/tabmenu.css" rel="stylesheet" type="text/css" /> <style> .hidden { display:none;} </style> <script type="text/javascript"> function showhide() { var button = document.getelementbyid("butt"); var h...

java - get file list from glob without specifying base directory -

there previous questions checking if file matches glob pattern ( here one ). however, list of files match glob pattern without having specify base directory search. need accept both relative , absolute directories (i resolve relative ones specified directory), , needs cross-platform compatible. given string such "c:/users/foo/ ", "/user/foo/ .txt" or "dir/*.txt", how list of matching paths? yes, you'll need programmatic way find out if glob pattern absolute. can done follows: (string glob : new string[] { "../path/*.txt", "c:/../path/*.txt", "/../path/*.txt" }) { system.out.println(glob + ": " + (new file(glob).isabsolute() ? "absolute" : "relative")); } on windows output ../path/*.txt: relative c:/../path/*.txt: absolute /../path/*.txt: relative on unix last absolute. if know glob pattern relative, prepend special directory it. after you'll have abso...

How to cancel volly request in android? -

i have activity contain listview when user scrolldown request sent server more data request sent parameter count=5(it static) , last=5 , again on scroll down last becomes 10 , want when server response "no item" want cancel volley requeston listview scroll down.how can that code listview scroll down; @override public void onscrollstatechanged(abslistview view, int scrollstate) { if (scrollstate == abslistview.onscrolllistener.scroll_state_idle && bbottomofview) { log.i("listview", "scrolling stopped..."); if (networkutil.isconnected(getactivity())) { m_n_defaultrecordcount = 5;// increment of record count 5 on next load data m_n_deafalutlastcount = m_n_deafalutlastcount + 5;// same here.....as above sz_recordcount = string.valueof(m_n_defaultrecordcount);// convert int value string sz_lastcount = string.valueof(m_n_deafalutlastcount);// convert int value string ///// ...

angularjs - Angular ui-router dynamic params double slash -

i have ui-router's config below: .state('xxx.components',{ url: '/:runid/component', reloadonsearch: false, templateurl: '/modules/xxx//views/cloud-components/templates/cloud-components.tpl.html', controller: 'cloudcomponentsctrl', controlleras: 'ctrl' }) if go component page without runid, url below: http://localhost:3031/xxx/run-topologies//component it contain double slash in url, want contains 1 slash below, should can solve issue? expect behavior: with runid: (this correct due current config) http://localhost:3031/xxx/run-topologies/6/component without runid: (should 1 slash) http://localhost:3031/xxx/run-topologies/component what asking not possible afaik. but, there 2 ways might interested in use cloudcomponentsctrl both routes. define separate state url without runid .state('xxx.components',{ url: '/component'...

Python 3.5: Exporting Chinese Characters -

i have been trying several times export chinese list variables csv or txt file , found problems that. specifically, have set encoding utf-8 or utf-16 when reading data , writing them file. however, noticed cannot when window 7’s base language english, change language setting chinese. when run python programs under window 7 chinese base language, can export , show chinese perfectly. i wondering why happens , solution helping me show chinese characters in exported file when running python programs under english-based window? i found need 2 things achieve this: change window's display language chinese. use encoding utf-16 in writing process.

flume hdfs rollSize not working in multi channels and multi sinks -

i trying use flume-ng grab 128mb of log information , put file in hdfs. hdfs rolling options not working. flume-ng send log file per seconds. how can fix flume.conf file? agent01.sources = avrogensrc agent01.channels = memorychannel hdfschannel agent01.sinks = filesink hadoopsink # each 1 of sources, type defined agent01.sources.avrogensrc.type = avro agent01.sources.avrogensrc.bind = dev-hadoop03.ncl agent01.sources.avrogensrc.port = 3333 # channel can defined follows. agent01.sources.avrogensrc.channels = memorychannel hdfschannel # each sink's type must defined agent01.sinks.filesink.type = file_roll agent01.sinks.filesink.sink.directory = /home1/irteam/flume/data agent01.sinks.filesink.sink.rollinterval = 3600 agent01.sinks.filesink.sink.batchsize = 100 #specify channel sink should use agent01.sinks.filesink.channel = memorychannel agent01.sinks.hadoopsink.type = hdfs agent01.sinks.hadoopsink.hdfs.uselocaltimestamp = true agent01.sinks.hadoopsink.hdfs.path = hdfs:/...

vue.js - Can't change router component -

i have .vue file following <template> <div class="container"> <div class="row"> <div class="column"> <h2>create mia</h2> <p><img src="../../static/intro.gif"/></p> <p><a v-on:click="go()" href="javascript:void(0)" class="button">enter</a></p> </div> </div> </div> </template> <script> export default { methods: { go: function () { console.log(this.$router.go) this.$router.go({ path: '/app' }) } } } </script> and in main index.html file have <main class="container center"> <div id="logo"></div> <div id="section"> <router-view></router-view> </div> </main> and in main.js import vue 'vue' import resource 'vue-resource' import router 'vue-r...

sql - How to count every half hour? -

i have query counting every hour, using pivot table. how possible count every 30 minutes? for example 8:00-8:29,8:30-8:59,9:00-9:29 etc. until 5:00 select convert(varchar(8),start_date,1) 'day', sum(case when datepart(hour,start_date) = 8 1 else 0 end) 8 , sum(case when datepart(hour,start_date) = 9 1 else 0 end) nine, sum(case when datepart(hour,start_date) = 10 1 else 0 end) ten, sum(case when datepart(hour,start_date) = 11 1 else 0 end) eleven, sum(case when datepart(hour,start_date) = 12 1 else 0 end) twelve, sum(case when datepart(hour,start_date) = 13 1 else 0 end) one_clock, sum(case when datepart(hour,start_date) = 14 1 else 0 end) two_clock, sum(case when datepart(hour,start_date) = 15 1 else 0 end) three_clock, sum(case when datepart(hour,start_date) = 16 1 else 0 end) four_clock test user_id not null group convert(varchar(8),start_date,1) order convert(varchar(8),start_date,1) i use sql se...

How do you use TypeScript typings that are modules? -

i'm trying use typings load definition file bowser . i've got typings installed , run typings install dt~bowser -dg --save-dev install locally. works great. i'm @ loss how use it. in past, has "just worked" - meaning, if try , write references bowser in typescript, find definition file (downloaded typings definitelytyped ) , recognize bowser global function. however, looks definition file has changed , it's "module": declare module 'bowser' { var def: bowsermodule.ibowser; export = def; } how supposed use in typescript files? of course can this: declare var bowser: bowsermodule.ibowser; but feels wrong/hacky. missing here-- what's changed in world of typings/definitelytyped? the correct syntax be import bowser = require('bowser') if typings configured, should work. else, check if typings/index.d.ts file referenced in build script, , if bowser referenced in there: /// <reference path="g...

Java lang IllegalAccess on collecting Guava Immutable Table via HashBasedTable accumulator -

error while executing below code, caused by: java.lang.illegalaccesserror: tried access class com.google.common.collect.abstracttable class immutabletable.copyof(listitemstoprocess.parallelstream() .map(item -> processorinstanceprovider.getinstance() .buildimmutabletable(item)) .collect(() -> hashbasedtable.create(), hashbasedtable::putall, hashbasedtable<integer, string, boolean>::putall) ); error in coming on - hashbasedtable::putall using oracle's 1.8 jre this compiler bug, related reports are jdk-8152643 : “javac compiles method reference allows results in illegalaccesserror” jdk-8059632 : “method reference compilation uses incorrect qualifying type” note first report has status “fixed in 8u102”, downloading jdk8u102 solve issu...

c++ - boost python dll load failed when wrapping a library function -

i trying use boost.python wrap exisiting c++ code. want make seperate project. hence wrap function library call follows. #include < iostream > #include "stdafx.h" #include < boost/python/module.hpp > #include < boost/python/def.hpp > #include "mylib/header1.hpp" #include<string> #include<vector> #include "umf/header2.hpp" #include "umf/header3.hpp" using namespace std; using namespace boost::python; using namespace my_ns; void init(const char* name) { cout << "hiiii " << name << "\n"; my_ns::initialize(); } boost_python_module(libname) { def("init", init); } when remove line my_ns::initialize(), wrapping works. if include get importerror: dll load failed: specified module not found. what doing wrong here?

git - How much of my code is still around? -

strange question, pretty reasonable 1 think. there's project started several years ago couple hundred lines of code. amazingly, since it's grown huge, robust project i'm proud of. now, have question pops head: how of code still around? almost vast majority of code has been rewritten @ point, feels should possible have git give me picture of what's still around. now, i've looked on basic level, can't find else along these lines, though of github's charts helpful. any ideas? so git blame way go. here how can calculate number of lines changed each author in current revision git ls-tree -r head --name-only \ | xargs -i{} git blame --line-porcelain {} \ | sed -n 's/^author //p' \ | sort \ | uniq -c \ | sort -rn which give 15492 alice 3406 bob 100 carol

sharepoint online - Prevent text being treated as a link -

i have text want put on page looks [[:upper:]]. unfortunately being interpreted link. how prevent this? this sharepoint office 365. thanks. maybe sharepoint guru contradict me think default behaviour (wiki-type pages) interpret '[[' 'link following'. i found workaround insert 'hair space' ( &#8202; ) between 2 left square brackets. edit: or better, put '\' in front of [[ , ]]. example: \[[:upper:\]]

sql - Oracle - Assigning the correct Date from a Set -

i have table below regid | pkg_desc | event_date | is_con | is_ren ----------------------------------------------------- 1234 | cc | 27-mar-14 | 0 | 0 1234 | cc | 27-jun-14 | 1 | 0 1234 | gui | 27-mar-14 | 0 | 0 1234 | gui | 27-jun-14 | 1 | 0 1234 | gui | 27-sept-14 | 0 | 1 1234 | gui | 27-sept-15 | 0 | 1 1234 | remote | 27-mar-14 | 0 | 0 1234 | remote | 27-jun-14 | 1 | 0 1234 | remote | 27-sept-14 | 0 | 1 2431 | cc | 27-mar-14 | 0 | 0 2431 | cc | 27-jun-14 | 1 | 0 i have query below select a.reg_id, b.sess_start_dt, case when trunc(a.event_date) - b.sess_start_dt between 0-30 'days 0_30' when trunc(a.event_date) - b.sess_start_dt between 31-60 'days 31-60' tab inner join tab b on a.reg_id = b.reg_id , a.is_ren = 1 union select a.reg_id, b.sess...

javascript - Cancel a script if directed to that page from a specific URL -

i have bit of code redirect mobile site if <script type="text/javascript"> <!-- if (screen.width <= 800) { window.location = "http://mymobilesite.com "; } //--> </script> i want cancel above script if direct page form speific url, like: if (document.referrer !== "http://mymobilesite.com") { } any appreciated if not understanding need, want cancel script, if redirected spcific site. this, below work. if (window.location.origin !== "http://mymobilesite.com") { // } this not include query string, url of website including http/https .

javascript - Formatting a number to include a thousands-separting comma -

i working on project @ work want format values on table (128879) (128,879). code have used far is: $(document).ready(function(){ $('#tableone tr td:nth-child(3)').each(function(){ var num = $(this).text; num.tostring().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,") }); }); also, tried jquery numberformatter library, error code shows jquery not defined (the last line of code on debugger page using chrome) , math.js (no luck). not sure why happening. the <script> tag used jquery , math.js shown below: <script type = 'text/javascript' src ="jquery.numberformatter-1.2.4.min.js"></script> <script type="text/javascript" src="math.js"></script> you need include jquery library can use $ want. also, $(this).text function; want num = $(this).text() , $(this).text(num.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")) . have not tested regex, don't know if work.

java - Injection of stateless session bean into custom JsonDeserializer fails -

i building application providing jax-rs rest service using jpa (eclipselink). when exposing user entities on json, using @xmltransient annotation on fields (e.g. password field) hide them json representation. when sending create or update (post/put) operation, populate missing fields again jpa correctly perform operation. my current approach have custom jsondeserializer used deserialize user , add missing fields. inject (using @inject ) userfacaderest bean handles jpa-stuff. however, injection fails , bean instance null (which of course causes nullpointerexception ). my userfacaderest bean annoted follows: @stateless @localbean @path(userfacaderest.path) public class userfacaderest extends abstractfacade<user> { //... } my userdeserilizer (custom jsondeserializer ): public class userdeserializer extends jsondeserializer<user> { @inject private userfacaderest userfacade; @override public user deserialize(jsonparser parser, deserializationcon...

c# - Haversine formula Unity -

so i'm trying use haversine formula in unity distance between 2 different points (latitude , longitud given). code working (no errors) keep gettting wrong result. followed entire formula don't know math/code problem is. idea? here's code: public float lat1 = 42.239616f; public float lat2 = -8.72304f; public float lon1 = 42.239659f; public float lon2 = -8.722305f; void operacion(){ float r = 6371000; // metres float omega1 = ((lat1/180)*mathf.pi); float omega2 = ((lat2/180)*mathf.pi); float variacionomega1 = (((lat2 - lat1)/180)*mathf.pi); float variacionomega2 = (((lon2 - lon1) / 180) * mathf.pi); float = mathf.sin(variacionomega1/2) * mathf.sin(variacionomega1/2) + mathf.cos(omega1) * mathf.cos(omega2) * mathf.sin(variacionomega2/2) * mathf.sin(variacionomega2/2); float c = 2 * mathf.atan2(mathf.sqrt(a), mathf.sqrt(1-a)); float d = r * c; } i think line incorrect: float c = 2 * mathf.atan2(mathf.sqrt(a), mathf.sq...

objective c - iOS Multitask App Switcher Custom Image -

im developing ios app , behave paypal when user double taps home button. for dont know paypal app displays custom image when app displayed on multitask switcher doesnt when notification arrives or when user pulls notifications bar. my issue comes when implementing this, im using event applicationwillresignactive display custom image (as applicationenteredbackground not called this). method called on events on dont want app display image (such notifications, calls, pulling top bar, etc). is there way of setting image when home button double tapped? thank you! from see, paypal doesn't cover viewport custom image – when double tap home button, remains rendered until else – on applicationdidenterbackground: . after switching home screen or application, paypal preview becomes covered. on other hand, mobile banking application when applicationwillresignactive: triggered. these afaik 2 approaches can achieve.

node.js - get array if array contains id mongoose -

it tricky one. thought use $in, after querying, wasn't looking for. this schema var gameschema = new mongoose.schema({ state: { type: string, default: "invited" }, finished: { type: boolean, default: false }, players: { type: [{ type: mongoose.schema.types.objectid, ref: 'users' }], required: true, }, scores: [scoreschema], chat : [chatschema] }); the request i'm trying make following, send user id, if players array contains id, return other id (the array have length 2) in array. the context can lookup against whom have played before. this had, "players" should array , it's not games want return, exports.getfriends = function(id, cb){ gameschema.find({ id: { "$in": "players"} }, function(err, games){ if(err){ return cb(err, null); } else{ return cb(n...

Change Alt-Key shortcut in MS Office for custom addin in VSTO -

Image
i'm developing addin ms project via vsto , wondering if there way change letter appear under tab of addin when user presses alt key? suppose developing team addin , want user press t instead of y2 addin. i understand brings table potential conflicts because way shortcut potentially conflict other custom ones. guess should quite easy resolve. yes, have specify keytip . has not conflict visible tab, or control on same tab. can 1-3 letters long. this not work tabs did not create.

r - Does geom_smooth() of ggplot2 show pointwise confidence bands, or simultaneous confidence bands? -

Image
i unsure whether question more appropriate here or on cross validated. hope made right choice. consider example: library(dplyr) setosa <- iris %>% filter(species == "setosa") %>% select(sepal.length, sepal.width, species) library(ggplot2) ggplot(data = setosa, aes(x = sepal.length, y = sepal.width)) + geom_point() + geom_smooth(method ="lm", formula = y ~ poly(x,2)) default, ggplot "displays confidence interval around smooth" (see here ), given gray area around regression curve. i've assumed these simultaneous confidence bands regression curve , not pointwise confidence bands. ggplot2 documentation refers predict function details on how standard errors computed. however, reading doc predict.lm , doesn't explicitly simultaneous confidence bands computed. so, correct interpretation here? one way check predict.lm() computes inspect code ( predict multiplies standard errors qt((1 - level)/2, df) , , not appear make adj...

html - Press with Python an Webpage button and download file -

i have following site, has no api. need downloaffrom there specific data. how can python click on right things , let accept file? url: https://osm.wno-edv-service.de/boundaries/ things need pressed (in order): activate oauth on bottom line: "shp" on list @ left side right click , there "export full subtree" after python need accept file , save it. is possible , there documentation it? (i tried google seems to specific) edit: not searching exact code if there libs or examples it.

ios - Troubles to detect if a CGPoint is inside a square (diamond-shape) -

Image
i have 2 skspritenode: a simple square (a) the same square rotation (-45°) (b) i need check, @ time, if center of skspritenode (a ball) inside 1 of these squares. ball , squares have same parent (the main scene). override func update(_ currenttime: timeinterval) { let spritearray = self.nodes(at: ball.position) let arr = spritearray.filter {$0.name == "square"} square in arr { print(square.letter) if(square.contains(self.puck.position)) { print("inside") } } } with simple square (a), code works correctly. data right. know, @ time, if cgpoint center inside or outside square. but square rotation (b), data aren't desired. cgpoint detected inside it's in square diamond-shape contained. the skspritenode squares created via level editor. how can have correct result diamond-shape? edit 1 using view.showsphysics = true i can see bounds of skspritenode physicsbody. bounds of diam...

java - Inner CrudRepository interface in Main doesn't works -

i doing tests spring-data-jpa don't make new file repository interface i've put in main next: @springbootapplication public class application { private static final logger log = loggerfactory.getlogger(application.class); public static void main(string[] args) { springapplication.run(application.class); } @bean public commandlinerunner demo(brepository repository) { return (args) -> { log.info("insert a"); repository.save(new entitya("testa")); log.info("find " + repository.findone(1)); }; } @entity @table(name = "a") public static class entitya{ @id @generatedvalue(strategy=generationtype.auto) private integer id; @column(name = "name") private string name; //getters, setters && constructors } public interface brepository extends crudrepository<entitya, integer> { } } then i've tested @bean commandlinerunner to see output g...

javascript - Using data from a PHP array in AJAX -

i'm making change way site works , trying find solution requires little re-writing possible. at moment, have file (myfile.php) loads (using wordpress) page. uses php array outputting data. php array $property_list_featured_search , content looks this: <?php foreach($property_list_featured_search $individual_property){ ?> <span><?php echo $individual_property['info']['status'] ?></span> <?php } ?> so in small example, it's outputting data $property_list_featured_search , works ok. my problem want load html&php above using jquery ajax. when user clicks button, loads html (which stored in file, called myfile.php div on page: function loadview(view){ $.ajax({ type: "post", url: 'path/to/file/property-search/myfile.php', data: property_data, success: function(result) { $("#search-page-content")...

WebStorm wraps text not as expected -

Image
how can configure webstorm wraps text near restriction line not @ window corner? there's no native setting can enable directly. however, wrote plugin : wraptocolumn .

python - Dumping JSON directly into a tarfile -

i have large list of dict objects. store list in tar file exchange remotely. have done writing json.dumps() string tarfile object opened in 'w:gz' mode. i trying piped implementation, opening tarfile object in 'w|gz' mode. here code far: from json import dump io import stringio import tarfile stringio() out_stream, tarfile.open(filename, 'w|gz', out_stream) tar_file: packet in json_io_format(data): dump(packet, out_stream) this code in function 'write_data'. 'json_io_format' generator returns 1 dict object @ time dataset (so packet dict). here error: traceback (most recent call last): file "pdml_parser.py", line 35, in write_data dump(packet, out_stream) file "/.../anaconda3/lib/python3.5/tarfile.py", line 2397, in __exit__ self.close() file "/.../anaconda3/lib/python3.5/tarfile.py", line 1733, in close self.fileobj.close() file "/.../anaconda3/lib/python3.5/tarfile...

Connect to RS232 from Android - No permission dialog or shell command -

objective i'm developing custom app internal use on rooted android mini-pc. goal (between others... so...many...others...) able turn on , off tv using serial port embeeded on tv. i'm using ftdi uart rs232 serial usb cable it. status the application working right now, using android library ( serial-driver ) can communicate tv, problem device asks permissions every install (and sometimes, weirdly, again on same device), needs improved. issue since device doesn't have mouse or keyboard default, when happens has click buttons, , since device hidden behind screen, can annoying. my 2 bits this problem, feel, can solved 2 methods, still haven't been able make them work. since device rooted, might able modify unknown (to me) parameter allows me bypass permission request. have tried make intent filter usb device , , rewrite interface controlls behaviour , both without success. there way make android version more lenient permissions? i use other reasons supe...

Create a new page in scribble with pdf/latex backend -

in latex, can create new page \newpage command. there not seem way directly in scribble (at least not pdf/latex end.) so, how can force scribble make me new page document? yes, doable. bit clunky, , works when rendering latex file (or pdf file), not make sense webpage. original way had went latex. however, turns out there way staying entirely in scribble. whichever prefer going depend on context, i've put both options here. option 1: entirely in scribble option the way works use scribble styles string name. doing turns style latex environment or command (depending on put into.) in our case, want command, use element . resulting code this: (define (newpage) (make-element (style "newpage" '()) '())) now can use newpage function wherever want , latex insert \newpage . option 2: insert raw latex: the other option insert bit of raw latex code in scribble file. this, first need create file, say: textstyle.tex , , in file, ...