Posts

Showing posts from January, 2012

javascript - Text Area in JSP Enter to implement a functionality -

i using spring mvc , have created textarea in it, want add functionality: when user presses 'enter' 2 times cursor automatically go next line , indicate paragraph number in new line: here code textarea: <textarea name="notings" style="width:800px ; height:200px" ></textarea> example: users types ... ................................ //presses enter key 2 times consecutively types else.... i clueless in implementing functionality. starter @ front end development , don't know javascript well. little appreciated. if point me towards right direction, alot thanks in advance you try way <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> var pn=1; var count=0; function newlinefun(e) { if(e.keycode==13) { count++; if(count==2) { count=0; v

networking - iOS, testFlight, app can't connect to the Internet -

i installed testflight, added app itunes connect, , downloaded using testflight. test app can't connect internet. if upload app through cable - internet works. had same issue rebuilt phone , did not connect internet either. seems issue app transport security, new in ios9

Simple Pathfinding in Javascript Canvas - Think Adventure game -

i trying replicate function in point , click adventure game character needs walk within path without going outside boundaries of path. just example: have js fiddle: http://jsfiddle.net/1ztzz6an/1/ draws polygon. want characters feet(bottom part of imported image) stay within polygon. here code: var canvas = document.getelementbyid("canvas"); var ctx = canvas.getcontext("2d"); var triangle = [{ x: 71, y: 247 }, { x: 299, y: 313 }, { x: 520, y: 215 }, { x: 587, y: 49 }, { x: 468, y: 154 }, { x: 420, y: 36 }]; // define polygon function define(polygon) { ctx.beginpath(); ctx.moveto(polygon[0].x, polygon[0].y); (var = 1; < polygon.length; i++) { ctx.lineto(polygon[i].x, polygon[i].y); } ctx.closepath(); } define(triangle); ctx.fill(); i have seen examples using tiles , such. want within polygon itself. alternatively, if easier, willing @ solution way walk outside polygons, long

ajax - Url Parameter after logout Php? -

after logout on page url contains old parameters here parameter include dynamic page when login again redirect logout page again , logged out. logout page reload echo '<meta http-equiv="refresh" content="1; url="./index.php">'; login page reoad after login location.reload(); parameter url /index.php?act=logout s0 question... how fix after logout no parameters @ url @ least when logout /index.php ? well question doesn't make sense .. don't know how code working can simple match in index.php if($_get['act'] == "logout"){ //update parameter url parameter }

vba - MS word find and replace: Change how to replace based on captured values in Find's RegEx -

i working on bilingual documents (arabic-english), 2 languages have different directions (rtl , ltr respectively) makes working bit more challenging. i writing macro change numbers of form (x.x) (x,x), change in comma. now here problem, 2 numbers switched when replace, example: x.y becomes y,x. after debugging turned out (.) in first form arabic character , when replaced (,) english 1 causing change in order. so want following, don't know how translate vba: 1- match expression ([0-9]{1, }).([0-9]{1, }) 'two numbers dot in between 2- if dot in between english, replace follows \1,\2 'no change 3- else if arabic, replace follows \2,\1 thanks help edit here current version of macro, recorded macro. added if else statement. sub fixcomma() ' ' fixcomma macro ' ' if (selection.start <> selection.end) selection.find.clearformatting selection.find.replacement.clearformatting selection.find.replacement.languageid = wdengl

bash - Python 2.7 keep env variables from a subprocess -

i'm calling bash script exporting few variables, found way variables , it's working, once i'm trying add args bash script it's failing. here part of python script: bash_script = "./testbash.sh" script_execution = popen(["bash", "-c", "trap 'env' exit; source \"$1\" > /dev/null 2>&1", "_", bash_script], shell=false, stdout=pipe) err_code = script_execution.wait() variables = script_execution.communicate()[0] this sample bash script: export var1="test1" export var2=$var1/test2 echo "this firsr var: var1=$var1" echo "this second var: var2=$var2" once i'm changing bash_script = "./testbash.sh" bash_script = "./testbash.sh test test" i'm not getting exported variables bash script variables variable in python script. provided above sample, , of course real scripts more bigger. if c

actionscript 3 - AS3 Array issue and Arduino -

i hoping can me issue having as3 script, new , apologizes if there simple answer import flash.net.socket; import flash.events.event; var mysocket:socket = new socket(); mysocket.connect("127.0.0.1",5331);; mysocket.addeventlistener(progressevent.socket_data, socketdatahandler); var buffer:string = ""; function socketdatahandler(event:progressevent):void { var str:string = string(mysocket.readutfbytes(mysocket.bytesavailable)); var array:array = new array(); buffer += str; array = buffer.split(","); var textpwm:array = new array; var textpercentage:array = new array; var textvoltage:array = new array; textpwm.push(array[0]); textpercentage.push(array[1]); textvoltage.push(array[2]); var pwm_a:string; pwm_a = textpwm.join(""); var percentage_a:string; percentage_a = textpercentage.join(""); var voltage_a:string; voltage_a = textvoltage.join(""); pwmbox.text = pwm_a; percentagebox.text =

visual studio 2013 - How to hide reference counts in VS2013? -

Image
visual studio 2013 introduced new feature shows how many times each of methods used. i don't find useful, , messes spacing of file. how disable it? can't seem find option. i guess running preview of vs2013 ultimate, because not present in professional preview. looking online found feature called code information indicators or codelens , , can located under tools → options → text editor → languages → codelens (for rc/final version) or tools → options → text editor → languages → code information indicators (for preview version) that according link . seems pretty hidden. in visual studio 2013 rtm , can codelens options right clicking indicators in editor: documented in q&a section of msdn codelens documentation

JSXGraph. Calculate displacement of point -

how can calculate displacement of point in jsxgraph. suppose there point @ (0, 0) location. if drag point (0, 0) (2, 0). displacement 2 units. query formula in jsxgraph calculate displacement. if want calculate distance between 2 jsxgraph points, p , q , dist method can used: p.dist(q) if want determine distance point p coordinate array [x, y] , done this: jxg.math.geometry.distance(p.coords.usrcoords, [1, x, y]); instead of [x, y] 1 has use [1, x, y] , because jsxgraph works homogeneous coordinates, allow handle infinite points. a dynamic example this: var p = board.create('point', [3, 0]), q = board.create('point', [0, 0]), t = board.create('text', [1, 1, function() { return p.dist(q); }]);

canvas - JavaScript: Cut circular small images out of a big one and compare them using resemble.js -

Image
i'd cut several circular parts (px) out of big image (a) , compare them pixel pixel same sized round portions (qx) of big image (b) using resemble.js (or similar, did not find else seems suitable) factor of similarity. update: "factor of similarity" mean average of color distance (length of rgb vector between both pixels) of 1 pixel of px corresponding pixel of qx. if both images same images 100% identical, factor 1. if identical 1 inverted, 0% identical because each pixel has maximum possible color distance corresponding 1 of image compare. in case, factor 0. the aim find px fits best qx @ orientation (5 degrees rotation steps), , replace qx px in final image @ best fitting angle. imagine kind of photo mosaic. want reassamble given image circular smaller images in big image conveniance. first have cut them out, place them on photo in hex grid manner. challenge find fits best @ position , in orientation. i c# backend developer, javascript knowledge pretty b

ios - I think i have done some mistake in allocating segmentcontrol..i am getting an error [unrecognized selector sent to instance] -

segcontrol = [[uisegmentedcontrol alloc] initwithitems:[nsarray arraywithobjects:@"mind", @"munches", nil]]; segcontrol.frame=cgrectmake(cgrectgetwidth(self.view.frame)/4.5, self.view.frame.size.height/4, cgrectgetwidth(self.view.frame)/1.8, cgrectgetheight(self.view.frame)/12); [segcontrol addtarget:segcontrol action:@selector(segtap:) forcontrolevents:uicontroleventvaluechanged]; [segcontrol setselectedsegmentindex:0]; [segcontrol settintcolor:[uicolor bluecolor]]; segcontrol.layer.cornerradius=5; [self.view addsubview:segcontrol]; -(void)segtap:(id)sender{ if (segcontrol.selectedsegmentindex==0) { self.view.backgroundcolor=[uicolor bluecolor]; }else if (segcontrol.selectedsegmentindex==1){ self.view.backgroundcolor=[uicolor redcolor]; } } you adding segmentcontrol object segcontrol target segment action. rather object self should added target. change code below , go. [segcontrol ad

Google Calendar API and php -

i have used google calendar api user authentication porocess shows error , did not knwo reason error strictly follow instruction of google developer code please give me answer. here code authentication <?php require 'src/google/autoload.php'; define('application_name', 'google calendar api quickstart'); define('credentials_path', '~/.credentials/calendar-api-quickstart.json'); define('client_secret_path', 'client_secret.json'); define('scopes', implode(' ', array( google_service_calendar::calendar_readonly) )); /** * returns authorized api client. * @return google_client authorized client object */ function getclient() { $client = new google_client(); $client->setapplicationname(application_name); $client->setscopes(scopes); $client->setauthconfigfile(client_secret_path); $client->setaccesstype('offline'); // load authorized credentials file. $credentia

fluentd in_tail plugin pos_file content format -

i'm using fluentd tail log files , and push logs elastic search index. have 2 questions - 1) how fluentd store position last read given file? example in pos file - /myfolder/myfile.log 00000000004cfccb 0000000000116ce0 what values 00000000004cfccb , 0000000000116ce0 denote? 2) particular file ( myfile.log ) has 2520 lines in total. reason last 100 lines not read. restarted td agent still failed read last 100 lines. when can happen? my td-agent source looks - <source> type tail format none path /myfolder/*.log pos_file /var/log/td-agent/mylogfiles.pos tag mylog.* read_from_head true </source> thanks, for 1, see comment: https://github.com/fluent/fluentd/blob/5ed4b29ebda0815edb7bdd444e7e5ca2e9874a27/lib/fluent/plugin/in_tail.rb#l652 . hex number of position in file , inode of file. for 2, putting events file 2420 lines? can check problem in_tail or out_elasticsearch below. <match mylog.*> type copy <stor

mysql - How to add user in phpmyadmin -

i want know how add user in phpmyadmin , have done research didnot find proper answer. unable find privilege section in phpmyadmin can add username , password . working on hosting , cant see privilege section in phpmyadmin main's page. sorry inconvenience english weak phpmyadmin not handle user management, rather passes username , password on mysql. create mysql user. and if mean, users controlling own database, go here .

replace node in basex xml using xquery -

i trying replace node in xml using following code string xquery_replace="xquery replace node cidem/shopfloor/foo[/cidem/shopfloor/shopfloorid=1] "+new_gbxml; session.execute(xquery_replace); so want example change foo node of first shopfloor node the xml has following content <cidem> <shopfloor> <shopfloorid>1</shopfloorid> <foo bar="2"> <baz>there</baz> </foo> </shopfloor> <shopfloor> <shopfloorid>2</shopfloorid> <foo bar="5"> <baz>there</baz> </foo> </shopfloor> </cidem> and receiving following error "[xuty0008] single element, text, attribute, comment or pi expected replace target." any idea why? the error message telling whats wrong. "[xuty0008] single element, text, attribute, comment or pi expected replace target." means

angularjs - angular-translate. What is the best way to implement i18n using json files that are stored on the server, not the client -

implementing i18n isn't difficult when have list of json documents stored on client. if can't have json files stored locally? have retrieved @ runtime. best way achieve this. i thought storing them in sessionstorage required how angular-translate work or similar? when work local files point location: urltemplate: 'assets/translation/{lang}/{part}.json' i don't know if best way, have been using static files loader angular-translate this. let's have folder full of translation files: locales/locale-de_de.json locales/locale-en_gb.json locales/locale-nl_be.json ... then in app, this: var app = angular.module('myapp', [ ]); app.config([ '$translateprovider', function($translateprovider) { $translateprovider.usestaticfilesloader({ prefix: 'locales/', suffix: '.json' }); } ]); app.run([ '$translate', function($translate) { // set default language german $translate.

php - Annunity calculation before and after tax -

i'm doing annunity calculation through script: $calculation= ( 400000 * 0.02458/( 1- pow( 1+(0.02458) , -84) ) ) ; return round($calculation,2); this return me payment per. month of loan (4.337,76), on period of 84 months. now, know payment per. month after deduction of 33% tax on interest rate. in previous example (4.337,76) result 4.236,91 . etc. loan before tax: month interest payment total 0 815,87 3.561,88 4.377,76 1 807,12 3.570,64 4.377,76 2 798,34 3.579,42 4.377,76 loan after tax: month interest payment total 0 546,63 3.561,88 4.108,52 1 540,77 3.570,64 4.111,41 2 534,89 3.579,42 4.114,30 as can see, deduction made interest, deducted 33%. ( month 1: (851,86*0.67) = 546,63 i'm there fancy method of do

Spring Integration DSL Channel Support -

in current release 1.0.2 of spring integration dsl can see of basic channels not present rest/http, tcp/udp, jdbc, mqtt, etc. just wanted know whether protocols/channel in roadmap or has been excluded deliberately. ps: might sounding stupid posted question wanted know reason. from 1 side should understand enough big work address them all. example http module on our radar 1.1 release. from other side spring integration java dsl edition existing spring java & annotation configuration, @bean definition valid there, too. with desired protocols can go ahead , configure components @bean , refer them .handle() or .from() eip-methods. for example: @bean public messagesource<object> jdbcmessagesource() { return new jdbcpollingchanneladapter(this.datasource, "select * foo"); } @bean public integrationflow myflow() { return integrationflows.from(jdbcmessagesource()) .split(...) .transform(..

elasticsearch - How to design multi X axis graph in Kibana 4 -

Image
i need design graph in kibana 4 this, don't have idea how set y axis , x axis same. any pointers here? not available. track this issue .

Angularjs Error: [$location:nobase] -

y try create simple web angular project asp.net mvc 5 have js var app = angular.module("app", ["ngroute"]) .config(function ($routeprovider, $locationprovider) { $routeprovider.when('/', { templateurl: '/angularjs/templates/inicio.html', controller: 'bienvenidocontroller' }); $locationprovider.html5mode(true); }); and this: app.controller("bienvenidocontroller", function ($scope) { }); view: layout: <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@viewbag.title - asp.net application</title> </head> <body ng-app="app"> @renderbody() <!--librerias angular--> <script src="~/scripts/angular.min.js"></script> <script src="~/scrip

angularjs directive - How do i test my custom angular schema form field -

i've started developing angular schema form , i'm struggling write tests custom field directive. i've tried compiling schema form html tag runs through directives config testing it's display conditions against data in schema. never seems run controller , can't reference directives html elements. can give me guidance on how reference directive? below have far: angular.module('schemaform').config(['schemaformprovider', 'schemaformdecoratorsprovider', 'sfpathprovider', function(schemaformprovider, schemaformdecoratorsprovider, sfpathprovider) { var date = function (name, schema, options) { if (schema.type === 'string' && schema.format == 'date') { var f = schemaformprovider.stdformobj(name, schema, options); f.key = options.path; f.type = 'date'; options.lookup[sfpathprovider.stringify(options.pa

html - How do I add an expandable box of extra information to a table row that is created in an Angular repeat statement? -

i have table within angular app looks this: <table id="visible_table" class="table table-hover table-striped"> <tr class="info"> ... </tr> <tr ng-repeat="x in environment_service_packages | filter:isenvironmentcorrect | orderby:'service'"> ... </tr> </table> i wanting make each table row clickable information displayed below line's service. have information stored within model. can't seem formatting of data work, however. my original idea put div @ end of second tr tag included within repeat. able information appear, each service's data appeared below table rather below table row expected. i tried doing line break , doing td spanned across entire table, br didn't end changing page's layout whatsoever. i considering turning each row simple div , removing table structure altogether, wanted check see if there better way first. thanks.

encryption - on DSA key size -

when execute ssh-keygen -t ssh-dss it generates 2 files: 1 containing public , other, private key. the ssh-keygen man-page says generates 1024bit key, when open public key file, 580 characters line (which 4640 bits in ascii). am missing or thinking wrong? i've tried reading algorithm, it's hard calculate, considering size of prime numbers involved. is there way can validate if it's 1024bit key quantity of characters in id_dsa.pub file? the files ssh-keygen stores public , private keys have predefined format (pem, ...), not dump of keys (remember, example, private key encrypted). in link ( https://martin.kleppmann.com/2013/05/24/improving-security-of-ssh-private-keys.html ) find explanations different formats, , usage of tools "openssl asn1parse" display them: the private key asn.1 data structure, serialized byte string using der, , base64-encoded. asn.1 comparable json (it supports various data types such integers, booleans, string

Is there a way to check if a file/folder in Dropbox has a shared link without creating one? -

we want use dropbox rest api check if file/folder has shared link, , if permissions has (e.g. password protected). the relevant api call seems /shares , creates public shared link if no shared link exists. calling http verb has side effect. is there way check shared link status without changing it? no, it's not possible shared link status/metadata on dropbox api, we're tracking feature request.

c# - Deployment isn't copying certain files over -

i added this nuget package mvc project written in c#. works fine when run code locally. but, when deploy solution remote server , run it, seems missing of these scripts. example, missing scripts/bootstrap-treeview.js , errors in chrome browser's debugger it. files not being deployed onto server @ because when browse remote server's disk not see them in deployment location. i checked file's properties, set build action: content , copy output directory: not copy . that's set. tried setting copy output directory: copy always did not fix deployment copy these files over. other stack questions eluded me believe should deploy because i've set build action: content . so structure follows (if helps in way): project.csproj /scripts /bootstrap-treeview.js <-- want file deploy, not deploying. what problem be? since using bundling , minification , issue bundle wasn't registered. not rendered because of (so there no reference , seems op

python - Passing strings to Django URL in template -

i think simple, can't figure out life of me why these urls aren't matching. my template code looks this: <form action="{% url 'view_record' "facility_report" %}" method="post"> {% csrf_token %} {{ form }} <input type="submit" value="view report" name='view' label="submit"> </form> the url supposed match line in url conf: url(r'^view_record/((?p<report_type>.+)/)?$', views.view_record, name='view_record'), what missing here? won't match , of other questions regarding 5 years ago when engine seems have been lot more picky formatting. exception type: noreversematch @ /view_record/ exception value: reverse 'view_record' arguments '('facility_report',)' , keyword arguments '{}' not found. 1 pattern(s) tried: ['view_record/((?p<report_type>(.*))/)?$'] the outer group in ((?p<report_type>

rust - serde_json - how to make my struct convertable from / to json? -

looking @ the documentation of serde_json , can't understand trait have implement make struct serializiable , deserializiable json. obvious answer deserializer , serializer these structs, not traits. with rustc-serialize implement tojson , fromjson traits. from crate index page : serde provides mechanism low boilerplate serialization & deserialization of values , json via serialization api. able serialize piece of data, must implement serde::serialize trait. able deserialize piece of data, must implement serde::deserialize trait. serde provides provides annotation automatically generate code these traits: #[derive(serialize, deserialize)] . -- type-based serialization , deserialization

How to convert a GeoJSON polygon to a list of Geohashes of a given precision in ruby? -

i'm working combinations of geopoint + radius i've transformed geojson polygon (loosing bit of precision). need conversion list of geohashes intersects area predetermined precision. i've found geohash-poly want it's in javascript/node-js rather ruby. is there equivalent in ruby out there ? thanks

Issue in to_bytes in porting python 3.x to 2.7 -

i started work on python 3.4 version, dont have idea python 2.7. this code works fine in python 3.4 , want make run python 2.7, since major project works in 2.7 s = 0b10000000000000000000001110000000000000011000000000 v = s.to_bytes(8, 'little') print(v) j = 0 k = j.to_bytes(8, 'little') print(k) cdll.func(0,6,0,v,50,k,90) i researched to_bytes function , got function like def to_bytes(n, width): b = bytearray(width) in range(width-1, -1, -1): b[i] = n & 0xff n >>= 8 if n == 0: break return bytes(b) s = 0b10000000000000000000001110000000000000011000000000 j = (to_bytes(s, 16)) v = 0b0 k = (to_bytes(v, 16)) cdll.func(0,6,0,j,50,k,90) but if use in code not working expected.is there compatible to_bytes function in 2.7 please on this. you can use struct module in either 2.7 or 3.x convert values byte strings. v = struct.pack('<q', s)

javascript - Export to csv using java script -

i facing problem exporting csv . problems: 1) have export html table csv file . can change delimiter of csv file else semicolon. if have values in table under same column separated comma, in csv sheet showing in different column. 2) code not working ie , working mozilla 3) wanted user save csv file. getting automatically saved. please find code . can body of issue. function exporttabletocsv(filename) { var tab = $('#searchobjecttabletabs').tabs('getselected');// selecting table var tabindex = $('#searchobjecttabletabs').tabs('gettabindex', tab); var data; var rows; if (tabindex == '0') // first index of tab under table displayed { data = $('#dg');//only 1 table rows = $('#dg').datagrid('getrows'); } else if (tabindex == '1') // second index { data = $('#doc').first(); //only 1 tabl

c# - How to add new property to settings -

"that's been asked thousand times" you'll , may right, none of answers either covers problem or doesn't work. here's question 1001 : method below called, when specific property doesn't exist. in case property should created default value , added settings. property correctly added, settins.save() doesn't work. long application running property exists when application closed , restartet property missing; private void createnewproperty(string _property, object _value) { applicationsettingsbase settings = #######.properties.settings.default settingsproperty property = new settingsproperty(_property); property.defaultvalue = _value; property.isreadonly = false; property.propertytype = _value.gettype(); property.provider = osettings.providers["localfilesettingsprovider"]; property.attributes.add(typeof(system.configuration.userscopedsettingattribute), new system.configuration.userscopedsettingattribute()); settings.properties.add(property)

r - Calling functions from a list recursively -

i writing program in need function call function determined in period beforehand, may again call function determined before , on. however, finding myself inable implement in r. here minimal example of trying do: functions <- list() functions[[1]] <- function(x){ x } (i in 2:10) { functions[[i]] <- function(x){ functions[[i-1]](x) + x } } so after running script, want happen when call functions[[10]](1) r determines value function have had in period 9, needs value of function in period 8 , on , adds input it. (so obviously, output should 10). the problem when this, function calls infinitely. list looks this: [[1]] function (x) { x } [[2]] function (x) { functions[[i - 1]](x) + x } [[3]] function (x) { functions[[i - 1]](x) + x } (...) so when call functions[[10]](x) , evaluates functions[[9]](x) + x , functions[[9]] keeps calling on , on again. is there can force r write value of i - 1 each element of list, such follows? [[1]]

javascript - Selecting a single HighCharts container causes other containers to change position -

Image
i using highcharts, , seeing weird functionality when selecting 1 of charts. if , if select top right gauge, causes other gauges move position. other gauges work fine. i having trouble figuring out why happening, , hoping point out missing. my end uses python flask module, html uses jinja2 framework, , javascript. front.html <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.com/highcharts-more.js"></script> <script src="http://code.highcharts.com/modules/solid-gauge.js"></script> <link rel="stylesheet" type="text/css" href=" {{url_for('static',filename='style.css')}}"/> </head> <body id="body" <div class=&

php - "QueryPerf" method of vSphere API returns strange results -

i need average daily statistics given vm. vm runs on vmware vsphere 5.1. use php , call methods through soap. my code looks this: $result = $this ->soapclient ->queryperf( array( '_this' => $this->servicecontent->perfmanager, 'queryspec' => array( 'entity' => $object, 'starttime' => $starttime->format( 'c' ), 'intervalid' => 86400, ), ) ); returned results cpu usage percentage during interval , memory usage percentage of total configured or available memory strange. cpu result: stdclass::__set_state(array( 'groupinfo' => stdclass::__set_state(array( 'label' => 'cpu', 'summary' => 'cpu', 'key' => 'cpu', )), 'nameinfo' => stdclass::__set_state(array(

Reading gzip files inside gzip file using Java -

using java have read text files inside gz file in .tar.gz gz_ltm_logs.tar.gz filename. has files ltm.1.gz, ltm.2.gz inside , these files have text files in them. i wanted using java.util.zip.* if impossible can @ other libraries. thought able using java.util.zip. doesn't seem straightforward here's code give idea. method try extract given tar.gz file outputfolder. public static void extract(file input, file outputfolder) throws ioexception { byte[] buffer = new byte[1024]; gzipinputstream gzipfile = new gzipinputstream(new fileinputstream(input)); byteoutputstream tarstream = new byteoutputstream(); int gziplengthread; while ((gziplengthread = gzipfile.read(buffer)) > 0){ tarstream.write(buffer, 0, gziplengthread); } gzipfile.close(); org.apache.tools.tar.tarinputstream tarfile = null; // files inside tar outputstream out = null; try { tarfile = new org.apache.tools.tar.tarinputstream(tarstre

javascript - How to target hover effect with Snap.SVG? -

i'm testing animations snap.svg on hover in/out , on click svg illustration created , exported illustrator. i have group includes others sub-groups. on hovering parent group, child groups animated snap. problem hover event triggers on entering parent group, hover out triggers when hovering children groups, resulting animation stop, or start again, or going initial state. the structure of svg groups following : --the 'renard' group ----the 'tete' groupe ----the 'bras_gauche' group ----the 'bras_droit' group ----the 'queue' group i tried using elm.attr({pointerevents: "none" }); ( see here ) doesn't work. desactivate totally hover triggering on parent group. the result here : http://codepen.io/hugo8705/pen/zgvxpl i achieved desired effect using transparent rectangular hotspot above fox, hotspot doesn't fits fox shape : http://codepen.io/hugo8705/pen/zgdyox i hope it's clear enough, don't know

ios - Frequent deadlock when using PFUser.CurrentUser in multiple threads -

Image
i know there have been many similar issues opened in past, haven't run 1 until recently. the deadlock occurs when app launching. i've tried commenting out dozens of lines of code stacktrace points to, problem doesn't go away. if knows way avoid this, awesome. app depends on being able run multiple queries on launch, can't rid of functionality that's causing problem. here partial stacktrace: i'm not sure problem is, has currentuser. based on previous problems people have had, may issue facebook login. either way, frustrating problem, , i'm not sure how go fixing it. i using parse 1.8.0, parseui 1.1.5, , parsefacebookutils 1.8.0.1 i post more details if can point me in right direction of look. edit here stack trace different run. think problem has facebook authenticating currentuser while accessing currentuser elsewhere

Laravel 5 - Extract emails from array? -

i've looked around didn't find solution or way in laravel out of box, wondering if there way this: i have $emails array, 2 emails valid , 1 invalid: $emails = ["apple@fruits.com","banana@fruits.com","apple.com","banana"]; // how can following 2 arrays using laravel? $validemails = ["apple@fruits.com","banana@fruits.com"]; $invalidemails = ["apple.com","banana"]; how can last 2 arrays using laravel $emails array? probably don't need laravel this. $validemails = []; $invalidemails = []; foreach ($emails $email){ if (filter_var($email, filter_validate_email)) { $validemails[] = $email; } else { $invalidemails[] = $email; } } [note : work after php 5.2]

swift2 - Reflection Swift 2.0 XCode 7 beta 5 -

apple has changed swift reflection in xcode 7 beta 5. global reflect() function gone, , you'll have this: let mirror = mirror(reflecting: object) it gives more or less same information in nicer way (no more .1 og .2 propertyname , value). can't find way explore if mirrored item instance of class. older implementation check following: reflectedproperty.1.objectidentifier != nil || reflectedproperty.1.count > 0 but objectidentifier seems gone , count 2 regardless of type. help anyone? ok found workaround. iterating on mirror.children.enumerate() seemed make properties of type string. instead dug apple preliminary documentation, , read idea "upgrade" children e.g. anyrandomaccesscollection. made possible rely on count of objects children determine if it's object (after testing whether it's array) currently have functioning swift class json serializer working here on gist if interested in code: https://gist.github.com/peheje/cc3618253d4

angularjs - Grunt index task src globbing order -

i'm using vs2015 grunt task java-script files in project , write them template index.html before build. problem have order files dependent on each other. instance need create script src='' angular.js before ui-bootstrap-tpls.js otherwise reference errors. index task src wildcard getting files in 'an order' , it's not 1 works dependency graph. there way customize order without writing out each sub-directory individually , defeating purpose of hands-off template grunt task when adding new dependencies in future (i.e. shouldn't have add new directories)? i have index task registered (with wildcard source): index: { dev: { dir: '<%= wwwroot_dir %>', src: [ '<%= build_dir %>/wwwroot/**/*.js', ] i have multi task: grunt.registermultitask('index', 'process index.html template', function () { var dirre = new regexp('^(' + grunt.config('b

android - Notification title cut off -

i have following code show notification title notification message in java class (not activity class): // display sync success or failure notification. public static void displaysyncendnoti(context mcontext) { ... sbuilder = new notification.builder(mcontext); sbuilder.setcontenttitle(strcontenttitle); sbuilder.setcontenttext(strcontenttext); ... sbuilder.setstyle(new notification.bigtextstyle().bigtext(strcontenttitle)); sbuilder.setstyle(new notification.bigtextstyle().bigtext(strcontenttext)); } i used bigtext method when text long, moves sentence next line when gets cut off. so, bigtext worked notification message, doesn't seem work notification title ("at&t address book sync incomplete") following notification shows: http://i.stack.imgur.com/3fnt4.png does know how resolve issue?

javascript - AngularJS wait for tag to load into DOM -

i'm adding google chart via angular directive page , add attribute element creates after it's loaded. best way ensure element exists before attempting add attribute? from looking around seems directive have should work not: .directive('vdfwidgetgooglechart', ['$timeout', function ($timeout) { return { restrict: 'e', //replace: true, templateurl: 'widgetgooglechart.html', link: function ($scope, elem, attrs) { function addtabindex () { elem.find('svg').attr({tabindex: -1}); } $timeout(addtabindex); }, scope: { chartobject: '=' } } personally when doing charting easiest thing append attribute svg element, you're being angular aren't looking elements. another option create controller , directive element svg requires controller. when have svg child of directive svg directive should called. (this guess haven't tried it) <div controller-directive="..&

Create PDF Hyperlinked Table of Contents inside R -

this first questions on stackoverflow, please let me know if i'm doing wrong. i'm using r generate lot of large pdf documents. data 580,000 observations, , breaks down in 32 categories each category containing 70 answers between 20 , 300 questions. use 2 loops (i try avoid loops, creating these pdfs way worked). first goes through , creates pdf category title page, second adds page each graph showing results of question. i'm using ggplot2 & "pdf" function. the script works great, creating 32 pdfs (one each category) custom title page , pages questions in category. add table of contents after title page. know how add page labels , page numbers, need 1 links each question. i've searched site , google, haven't found way in r. question: adding table of contents pdf r plots talks using rpython. i've come across sources mentioning "hyperref", latex, pandoc, , knitr. know how use kintr in rmarkdown doc, doesn't work i'm tryin

entity framework - EF projections many to many not loading -

i have 4 classes defined follows: public class operator : base { public string name { get; set; } public string url { get; set; } public icollection<address> addresses { get; set; } public icollection<contact> contacts { get; set; } public icollection<application.application> applications { get; set; } } public class address : base { public string street{ get; set; } public int? parentid { get; set; } public operator parent { get; set; } public icollection<application.application> applications { get; set; } } public class contact : base { public string name { get; set; } public int? parentid { get; set; } public operator parent { get; set; } public icollection<application.application> applications { get; set; } } public class application : base { [maxlength(300)] public string name { get; set; } public icollection<operator.operator> operators { get; set; } public ic

angularjs - Terminating unused http connections that are a result of img ng-src -

i developing ios , android app (using ionic/angular) i have following situation: i have view this: <div ng-repeat="monitor in monitors"> <img ng-src = 'http://myserver.com/cgi-bin/videofeed?id={{monitor}}' /> </div> each monitor ip camera , doing here transmitting live feed continuous jpg images (multipart/mime). what therefore happens img tag keeps showing new images continuously making live video feed the problem facing when exit view, looks angular still keeps http connection open , server keeps connection open on side result. server launches instance of 'videofeed' per connection, , can see instances don't go away long after (15-20 minutes) exit view. is there possible way clear out these connections forcibly client? i searched in other such questions , talk http timeouts - not relevant in case, continuously updating image feed 1 image tag , time needs abort when exit view. thanks i have theory no ide

sql - Updating one column based on the value of another column -

i have table named vendor, within table have column called accountterms shows value (i.e. 0, 1, 2, 3) , on. have column want use ( ularageing ) in order reflect meaning of value, such as: 0: current 1: 30 days 2: 60 days and on... what need script @ value in accountterms , update ularageing show word value shown above. how do this? i going try explain in simple manner as possible it's easy understand : let's assume, have table vendor setup this: create table vendor (accountterms int, ularageing varchar(50)); and, insert sample values both columns in vendor table: insert vendor values (0,'test'), (1,'test1'), (2,'test2'); next, write update statement update ularageing column based on values in accountterms column in same table: update vendor set ularageing = (case when accountterms = 0 'current' when accountterms = 1 &

Javascript - How to get your browser in focus -

i'm running script on retail site when browser in focus, passes every time. when browser not in focus, fails every time. my waituntil(waits.elementdisplayed(.... doesn't work when not in focus. any ideas ? thanks you can detect if browser out of focus following javascript function function onblur() { document.body.classname = 'blurred'; }; function onfocus(){ document.body.classname = 'focused'; }; if (/*@cc_on!@*/false) { // check internet explorer document.onfocusin = onfocus; document.onfocusout = onblur; } else { window.onfocus = onfocus; window.onblur = onblur; } reference however, i'm not sure if getfocus if out of focus. hope helps.

Using an absolute path when setting the webdriver for Internet Explorer in Protractor on Windows -

i trying run automated tests using protractor. protractor.cong.js file follows. exports.config = { specs: ['tests/**/*.test.js'], params: { colors: false }, multicapabilities: [ { 'browsername': 'firefox', 'proxy': { 'proxytype': 'autodetect'} }, { 'browsername': 'chrome' }, { 'browsername': 'internet explorer', 'ignoreprotectedmodesettings': true } ], seleniumargs: ['-dwebdriver.ie.driver=node_modules\grunt-protractor-runner\node_modules\protractor\selenium\iedriverserver.exe'] } this works , prefer if path webdriver absolute rather relative. example: seleniumargs: ['-dwebdriver.ie.driver=c:\selenium\iedriverserver.exe'] is possible? have checked wiki has not offered solution. the problem was trying use window style paths or unix style paths rather amalgimation of two. correct way write is: seleniumargs: ['-dwebdriver.ie.driver=c:/seleni

javascript - Unable to enter texts in passcode textfields for iOS UI testing -

Image
here's code run ui test on xcode: var target = uiatarget.localtarget(); var app = target.frontmostapp(); var window = app.mainwindow(); //display current screen target.logelementtree(); //set value email address window.textfields()[0].setvalue("test11@test.com"); //set value in passcode window.textfields()[1].setvalue("1234"); window.buttons()["sign in"].tap(); and app interface looks this: for line: window.textfields()[0].setvalue("1234"); it shows: unexpected error in -[uiatextfield_0x7fc8ac0e360 setvalue:],/sourcecache/uiautomation_sim/uiautomation-430.2.1/frameworks/uielement.m.line 1088, kaxerrorcannotcomplete so works when scripts enter email address, not passcode. thinking app detects passcode entered robot, not human. that's why produces error? if so, how fix it? it's security problem. just uncheck circled box testing reason, proble

Rails JQuery Validate within Modal not Firing -

i have been successful in getting jquery form validation work fine within regular body of page, however, when try validation working within modal box, jquery doesn't fire. modal partial: <div class="modal" id="mymodal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">new account</h4> </div> <div class="modal-body" id = "addclientform"> <%= simple_form_for @client, :remote => true, :html => { :id => "addclientform"} |f| %> <div> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12"> <%= f.input :company