Posts

Showing posts from September, 2011

google maps - How to get formatted_address and other in ubilabs geocomplete? -

how formatted_address , other in ubilabs geocomplete? i user ubilabs geocomplete. https://github.com/ubilabs/geocomplete http://ubilabs.github.io/geocomplete/docs/ how formatted_address , other. i lat , lng use code: $("#geocomplete").bind("geocode:dragged", function(event, latlng){ $("input[name=lat]").val(latlng.lat()); $("input[name=lng]").val(latlng.lng()); $("#reset").show(); }); but need: location location_type formatted_address street_number postal_code locality sublocality country country_short administrative_area_level_1 place_id how can ubilabs geocomplete? i having same problem managed fix bellow code $("#geocomplete").bind("geocode:dragged", function(event, latlng){ $("input[name=lat]").val(latlng.lat()); $("input[name=lng]").val(latlng.lng()); $("input[name=formatted_address]").geocomplete("find", latl

How would I free memory allocated to a pointer in C? -

i have function in c adds new question head of singly linked list: int addquestion() { unsigned int acount = 0; question* tempquestion = malloc(sizeof(question)); tempquestion->text = malloc(500); fflush(stdin); printf("add new question.\n"); printf("please enter question text below:\n"); fgets(tempquestion->text, 500, stdin); printf("\n"); fflush(stdin); printf("how many answers there?: "); scanf("%u", &tempquestion->numanswers); fflush(stdin); tempquestion->answers = malloc(sizeof(answer*) * tempquestion->numanswers); (acount = 0; acount < tempquestion->numanswers; acount++) { tempquestion->answers[acount] = malloc(sizeof(answer)); tempquestion->answers[acount]->content = malloc(250); printf("enter answer #%d: \n", (acount + 1)); fgets(tempquestion->answers[acount]->content, 250, stdin);

excel vba - Decrement in for each loop -

is possible decrement in each loop in vba excel? i have code this: sub makro1() dim rng range dim row range dim cell range set rng = range("b1:f18") each row in rng.rows if worksheetfunction.counta(row) = 0 row.entirerow.delete 'previous row end if next row end sub and want step in commented statement. possible? no. you have use for...next loop , step backwards: dim long = rng.rows.count 1 step -1 set row = rng.rows(i) if worksheetfunction.counta(row) = 0 row.entirerow.delete 'previous row end if next

java - Exact String parsing on antlr4 -

i having issue while doing parsing of file. scenario follows : in file got parse, have values follows abc/123/test the first 3 letters kind of identifiers, , way can differ various line in grammar file: file1: str1?; str1 : newline identifier1 slant integer slant alpha; integer : [0-9]+; alpha : [a-z]+; slant : '/'; newline : '/n'; identifier1 : 'abc'; while running parser, parser not getting line identifier abc, instead giving me strange error mismatched input 'abc' expecting 'abc' how can parse against exact string in antlr4? the problem lexer lexes abc alpha instead of identifier1 . here why: your identifier1 rules should rather lexer instead of parser rule. rename identifier1 the identifier1 rule must declared before alpha rule, otherwise, alpha have higher precedence , abc parsed alpha instead of identifier1 . sure move identifier1 rule above alpha rule, should wok fine.

php - CURL POSTFIELDS to contain "&" character -

i have working sms sending on gateway using curl method. if include character "&" in message text area, send message before character only. so how fix send messages including character normally. here code: $from = "gateway_username"; // sms username $token = "gateway_password"; // sms password $option = $_request["option"]; $text = $_request["bulksms1__messagetextbox"]; if ($text == "") { } else { $url = "http://awaljawaly.awalservices.com.sa:8001/send.aspx"; $postfields = array ("requesttype" => "smssubmitreq", "username" => "$from", "password" => "$token", "mobileno" => "$d_mobile", "message" => "$text"); if (!$curld = curl_init()) { echo "could not initialize curl session."; exit; } curl_setopt($curld, curlopt_post, true); curl_setopt($cur

ios - How to put application to the background? -

my application after 30 seconds of doing nothing should came background. if there's no activity after 30 seconds, want log user out. it's application contains user interface. when user want must write again username , password. put below code: timer.m: #define kapplicationtimeoutinminutes 0.1 #define kapplicationdidtimeoutnotification @"apptimeout" @interface timer : uiapplication { nstimer *myidletimer; } -(void)resetidletimer; timer.h: @implementation timer //here listening touch. if screen receives touch, timer reset -(void)sendevent:(uievent *)event { [super sendevent:event]; if (!myidletimer) { [self resetidletimer]; } nsset *alltouches = [event alltouches]; if ([alltouches count] > 0) { uitouchphase phase = ((uitouch *)[alltouches anyobject]).phase; if (phase == uitouchphasebegan) { [self resetidletimer]; } } } //as labeled...reset timer -(void)resetidle

java - live wallpaper-settings button is not working -

okay, first application working on, works fine until wanted add settings button live wallpaper, problem is, when hit "settings" comes message of "live wallpaper picker has stopped". here's code android manifest <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.live.zaki" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="10" android:targetsdkversion="16" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.example.ui.mainactivity" android:configchanges="orientation|keyboardhidden|screensize" android:exported="true" android:label="@string/app

php - Facebook OG Debugger bugged? -

i build website using laravel 4. in code of pages, use '@include('path/to/i.e./form')'. but, when enter url of webpage has '@include', gives me 'error' (error parsing input url, no data cached, or no data scraped.) even though displays og stuff correct,i can't see still need debugged. can see when remove @include. my question is, possible fix this? i.e. there alternative in laravel @include? there have write read page correctly? and, others have this?

web services - CRUD processes using SSIS and C# into CRM 2011 -

i trying insert/update contact records in crm 2011 (on premise ro15) using crm web services. using ssis package data source , using c# (script component) inserting them in crm. originally using 1 row @ time using contactinput_processinputrow(contactinputbuffer row) method. insert 1 row @ time , after reading this post changed in bulk import using contactinput_processinput(contactinputbuffer buffer) method. this appears fix problem @ first when starts inserting rows. after 1500 rows, timeout error. normally, change client side timeout settings in config file because done through script component, don't see config file. have increased timeout limit on server side 24 hours. the c# code using same bulk insert code post (linked) above. have changed buffer size 10 scribe use , works crm 2011 setup have. how fix timeout issue? expecting have around 5k records per integration. thank replies. think have fix issue adding following block of code in app.config file (in sc

matplotlib - Python combining the format method with long strings that use LaTeX -

Image
i'm trying write long string several latex commands , variables image. i'm having trouble setting arbitrary precision variables while maintaining latex formatting. here's mwe: import matplotlib.pyplot plt # define variables names , values. xn, yn, cod, prec, prec2 = 'r', 'p', 'abc', 2, 4 ccl = [546.35642, 6785.35416] ect = [12.5235, 13.643241] plt.figure() text1 = "${}_{t} = {:.{p}f} \pm {:.{p}f} {c}$".format(xn, ccl[0], ect[0], c=cod, p=prec) text2 = "${}_{t} = {:.{p}f} \pm {:.{p}f} {c}$".format(yn, ccl[1], ect[1], c=cod, p=prec2) text = text1 + '\n' + text2 plt.text(0.5, 0.5, text) plt.savefig('format_test.png', dpi=150) this throws error keyerror: 't' since recognizing sub-index {t} variable. if instead use: text1 = "${{{a}}}_{t} = {:.{p}f} \pm {:.{p}f} {c}$".format(a=xn, ccl[0], ect[0], c=cod, p=prec) text2 = "${{{a}}}_{t} = {:.{p}f} \pm {:.{p}f} {c}$".format(b=yn, c

c# - Why does Intellisense show a variable as an option on the right side of its declaration? -

Image
in example below, visual studio gives me intellisense variable haven't finished declaring / instantiating. variable in scope , used on right side of it's own declaration? if not, why intellisense show option? quirk how intellisense works? var myvariable1 = 1; // throws compiler error, vs offers option of type // when start typing "myv"... var myvariable2 = myvariable2; yes, variable in scope. that's how declarations work. ordinarily, doesn't make sense refer variable being declared in own initialiser, , local variables, compiler not allow observe value before it's initialised. use of variable doesn't rely on being initialised can show in scope. non-local variables, have default value, initialiser well-defined if refers variable. static class program { static int f(out int i) { return = 0; } static void main() { int = f(out i); // okay } static int j = j; // okay }

How to evaluate a DSL with PARSE in Rebol? -

as learnt dsl , realized parse dialect in rebol can great lexer , parser. there example the parse tutorial : expr: [term ["+" | "-"] expr | term] term: [factor ["*" | "/"] term | factor] factor: [primary "**" factor | primary] primary: [some digit | "(" expr ")"] digit: charset "0123456789" probe parse "4/5+3**2-(5*6+1)" expr ;will output true the code above verifies if expression conforms "grammar" defined above. question is: how compute or evaluate it? how denote prior of operators such "*" , "+"? 1, generate either string or better block e.g. collect, can evaluate do. 2, there old example dialect gabriele santilli on rebol.org operator precedence.

android - Wrap_content doesn't work on RelativeLayout : Action bar custom View -

i have created custom layout action bar : add code on activity : layoutinflater inflater = (layoutinflater)getsystemservice (context.layout_inflater_service); view actionbarview = inflater.inflate (r.layout.main_actionbar, null); getsupportactionbar ().setcustomview (actionbarview); and main_actionbar.xml layout : <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:style="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" > <relativelayout android:id="@+id/lefticons" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_toleftof="@+id/empty" android:paddingtop="4dp" android

sql - How to select sub string in oracle? -

i have scenario data below: chapter 18 unit 10 sect 16 case 1 : want select chapter 18 above string. case 2 : want select unit 10 above string. case 3 : want select sect 16 above string. thanks & regards, keerthi using substr: declare l_start number := dbms_utility.get_cpu_time; begin in ( t ( select 'chapter ' || level || ' unit ' || level || ' sect ' || level d dual connect rownum < 100000 ) select substr(d, 1, instr(d, ' ', 1, 2) - 1) chapter , substr(d, instr(d, ' ', 1, 2), instr(d, ' ', 1, 4) - instr(d, ' ', 1, 2) ) unit , substr(d, instr(d, ' ', 1, 4), length(d) - instr(d, ' ', 1, 4) + 1 ) sect t ) loop null; end loop; dbms_output.put_line((dbms_utility.get_cpu_time - l_start) || ' hsec'); end; 126 hsec using regexp: declare l_start number := dbms_utility.get_cpu_time; begin in ( t ( s

What is the formal definition of scalability? -

when read the definition of scalability on different websites. came know in context of cpu & software means number of cpus added, performance of software improves. whereas, description of scalability in book on "an introduction parallel programming peter pacheco" different as: "suppose run parallel program fixed number of processes/threads , fixed input size, , obtain efficiency e. suppose increase number of processes/threads used program. if can find corresponding rate of increase in problem size program has efficiency e, program scalable. question proper definition of scalability? , if performing test scalability of parallel software, definition among 2 should looking at? scalability application's ability function correctly , maintain acceptable user experience when used large number of clients. preferably, ability should achieved through elegant solutions in code, isn't possible, application's design must allow horizontal growth usi

ruby - Array in serializer with multiple serializer rails -

i getting array after processing. gem 'active_model_serializers' now want use serializer send data in json format. but when called serializer, it'll not getting object because of array . controller - def index question = user.questions.available answer = user.where(:answer => params[:ans]) render :json => {:qust => question, :each_serializer => questionserializer, :ans => answer, :each_serializer => answerserializer} end question_serializer.rb class questionserializer < activemodel::serializer attributes :id, :question, :type end answer_serializer.rb class answerserializer < activemodel::serializer attributes :id, :answer, :date def date object.date = "..." end end try this: render json: { qust: activemodel::arrayserializer.new(question, each_serializer: questionserializer), ans: activemodel::arrayserializer.new(answer, each_serializer: answerserializer), } side r

WordPress Custom Post Type and Taxonomy URLs -

i made custom post type , taxonomy have structure of /episodes archive page show children "terms", /episodes/custom-term show archive of specific term, , /episodes/custom-term/post-title show single posts. i able /episodes/custom-term working custom term create. however, receiving 404 /episodes 404 /episodes/custom-term/post-title. in cms, when make post, assuming custom term season 1 , post title sample episode. can go /episodes/season-one , use "taxonomy-episode_category.php" template output posts within season one. knows when creating post permalink /episodes/season-one/sample-episode reaches 404 page. i not sure go here or if doing wrong. function episodes() { $labels = array( 'name' => _x( 'episodes', 'post type general name', 'text_domain' ), 'singular_name' => _x( 'episodes', 'post type singular name', 'text_domain' ), 'menu_name' => __

guidance on java class design -

i in process of building data tool allows users build etl code. before getting meat , bones of this, need build 'agent' deal database related work tool need perform. specifically, involve - selecting, inserting, updating, , deleting multiple records from/to/in different tables different layouts my thought build class following 4 methods - arraylist[][] selectfromrepository (string dbtable, string[] columnnames) arraylist[][] selectfromrepository (string dbtable, string[] columnnames, map<string, object> predicate) void inserttorepository (string dbtable, map<string, object>[] payload) void updateinrepository (string dbtable, map<string, object>[] payload, map<string,object>[] predicate) void deletefromrepository (string dbtable, map<string, object>[] payload) selectfromrepository respond 2d arraylist of heterogenous elements based on types of elements in "columnnames" retrieved argumen

javascript - How to use the setTimeout with angular -

i have code: if (xxx == xxx){ var x = 5 + 3; settimeout(function() { $('.regerrmsg').text(""); $scope.errmsg = "hi."; }, 5000); } i execute function i.e, show "hi" message after 5 seconds. so, code correct. of now, message not showing up. have gone wrong? my question .. hi executes , waits 5 sec or wait waits 5 secs , shows hi ? let's consider simplified example foo(); settimeout(function () {bar();}, 5000); baz(); now it's easier describe happen, step step (in excruciating detail) line 1: foo gets interpreted () invokes foo line 2: settimeout gets interpreted the arguments passed settimeout interpreted, i.e. function references set here the (/* ... */) invokes settimeout settimeout sets callback invoke argument 0 after argument 1 milliseconds line 3: baz gets interpreted () invokes baz end of file ...nothing happens while... argument 0 (from 5 ) gets invok

php - CodeIgniter: Adding Dynamic Data to Multiple Views -

i'm new codeigniter , have noticed when this: $data1['title']='new place'; $data2['color']='red'; $this->load->view('header', $data1); $this->load->view('content', $data2); i can access $title views/content.php , did not add $data1 second view. if that's normal, more efficent add data first loaded view, following? $data['title']='new place'; $data['color']='red'; $this->load->view('header', $data); $this->load->view('content'); or isn't important (especially when adding lots of data views)? there's no reason separate data in 2 arrays. 1 array data , sent each view. each view use needed variables. code clearer if split data , there's no difference in resources consumption.

php - laravel send mail on server with gmail not working -

hi in laravel application im sending mail when create new user !! in localhost use gmail smtp gmail account , username , it's working on server got error swift_transportexception expected response code 250 got code "535", message "535-5.7.8 username , password not accepted. learn more @ 535 5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 pn5sm18998642wjc.4 - gsmtp " here code if ($user->save()) { view::composer('emails.auth.usermail', function($view) { $mail = input::get('email'); $pass = input::get('password'); $view->with('username' , $mail )->with('password' , $pass ); }); mail::send('emails.auth.usermail', $data, function($message) use ($user) { $message->to(input::get('email'), '')

javascript - Google Map API - multiple icons in wrong spot -

Image
i have strange issue seems have appeared recently. haven't done major code changes project in while , none function in question in long while. so problem, when add more 1 icon google map using api, icons appearig on top of each other. the strange thing labels correctly located use same coordinates icons. here string passed function 1344, 52.65665917, -2.49004717, '../images/icons/direction/container_bluen.ico', 'galahad', '2014 mar 05 wednesday, 14:00', 'wellington road, horsehay, hollybank', 'reserved', '0 kph', 0 the function function addclusterlocation(fid, latitude, longitude, icon, id, datestamp, location, event, speed, ignitionstatus) { if (objmap) { var cssname = 'markerignitionoff'; switch (ignitionstatus) { case '1': cssname = 'markerignitionon'; break; default: cssname = 'markerignitionoff'; } var adjuste

internet explorer 11 - epub.js not loading properly on IE11 -

Image
i'm trying load epub on page using epub.js library , not working on ie 11, works perfrectly on chrome , firefox though. i'm not getting script error, don't message in console log, fiddler says scripts (including zip.js , epub) downloaded properly. it doesn't load, iframe embedded has src="" property , empty html body. in following snapshot. here html page content: <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="content/epubjs/epub.js"></script> <script src="content/epubjs/libs/zip.min.js"></script> </head> <body> <span onclick="book.prevpage();">prev</span> <span onclick="book.nextpage();">next</span> <div style="height: 700px; border: 5px solid red" id="area"></div> <script type="text/javasc

javascript - Find and replace occurrence of string in whole html itself -

assume <html> <head>....</head> <body> . . // occurrences here . </body> </html> i do $(function() { $('html').html() = $('html').html().replace(/strtofind/g,'somethingelse'); }); in head, does't work. how find , replace occurrence of string in html document (not store in variable)? thanks .html() function returns html, can't assign it. if want change html of object in jquery, put new html parameter function: $('html').html($('html').html().replace(/strtofind/g,'somethingelse'));

node.js - Protractor JS pre-processors -

i aware there option within karma use pre-processors however, in protractor can't see same sort of thing. using onprepare option wondering if possible / if there way have npm module run prior (basically same onprepare) config , not having require etc. try using scripts in package.json: "scripts": { "postinstall": "bower install", "pretest": "npm install", "test": "karma start test/karma.conf.js", "test-single-run": "karma start test/karma.conf.js --single-run", "preupdate-webdriver": "npm install", "update-webdriver": "webdriver-manager update", "preprotractor": "npm run update-webdriver && node setup.js", "protractor": "protractor test/protractor-conf.js", "postprotractor": "node teardown.js", } by saying 'npm run protractor'

Video not playing in Firefox on server but will play on local development box -

testing out updated site html5 , cannot play video when using firefox on hosting server running "windows iis 8 w/ plesk on godaddy shared". updated site run on local development server without issues in firefox. suggested create wev.config file. i created web.config file containing following update mime mapping: <configuration> <system.webserver> <staticcontent> <mimemap fileextension=".mp4" mimetype="video/mp4" /> <mimemap fileextension=".ogg" mimetype="audio/ogg oga" /> <mimemap fileextension=".webm" mimetype="video/webm .webm" /> <mimemap fileextension=".m4v" mimetype="video/m4v" /> </staticcontent> </system.webserver> </configuration> i still cannot video start on server. go daddy suggested post this. test site url www.gslproductions.com/zzzdefault.html i appreciate suggestions. best rega

ACRA put user email in crash report -

how can fill user_email field acra crash reporter? the report starts with: user_email = n/a to set user_email field edit sharedpreferences sharedpreferences prefs = acra.getacrasharedpreferences(); prefs.edit().putstring(acra.pref_user_email_address, user).commit();

linux - A little help for a script -

i have made script downloads libreoffice , upgrades on slackware linux. wanna simple correction; if package file fails download, want script return "script fail at..." for example, if libreoffice-mozplug..etc fail script returns "failed @ upgradepkg --install-new libreoffice-mozplug..etc" how it? this script (i know..it not best i'm working on it) #!/bin/sh set -e version=4.3.1 lackversion=14.1 alias wget="wget -nc" #get! wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-$version-x86_64-1alien.txz.asc wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-$version-x86_64-1alien.txz wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-dict-it-$version-x86_64-1alien.txz.asc wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-dict-it-$version-x86_64-1alien.txz wget http://www.slackware.com/

jquery cookies in edge animate -

so in regular html5 page in ie can following jquery code work: $.cookie('mycookiex',cookiexcounter,{expires:7,path:'/'}); $.cookie('mycookiey',cookieycounter,{expires:7,path:'/'}); console.log($.cookie('mycookiex')); but can't code work in edgeactions.js file... tried changing syntax (since when use jquery in edge before i've had change things example: $('#bluecar').animate({ left:cararrayx[cararrayxcounter] + "px", top:cararrayy[cararrayycounter] + "px" }); ' to sym.$('bluecar').animate({ left:myvariablex + "px", top:myvariabley + "px" }); but can't figure out cookies in edge jquery them workign... it's probaby syntax thing think of this: sym. $.cookie('mycookiex',cookiexcounter,{expires:7,path:'/'}); sym. $.cookie('mycookiey',

Call an Oracle stored procedure via OCI and return the results with an out ref cursor in C++ -

i call oracle stored procedure c++ using oci interface , iterate on results using out sys_ref_cursor parameter procedure. i'm new oci might missing simple. of code taken here: https://community.oracle.com/thread/507765?start=0&tstart=0 my stored procedure is: create or replace procedure fxt_test_call(cresults out sys_refcursor) stestquery varchar2(4000); begin stestquery := ' select set_nam, cc_type fxt_con_rules'; open cresults stestquery; end fxt_test_call; and c++ code snippet is: ocierror* pocierror; int answer; ocistmt* pocistatement; char* sqlchararray = "begin fxt_test_call; end;"; char set_nam[40]; char cc_type[40]; ocienv* g_pocienvironment = null; ociserver* g_pociserver = null; ocisession* g_pocisession = null; ocisvcctx* g_pociservicecontext = null; sb2* pindicator=0; sb2* pindicator2=0; sb2* pindicator3=0; ocidefine* pocidefine; ocidefine* pocidefine2; ocibind* pbind; ocistmt* cursor; answer = ocihandlealloc(g_pocienvironment, (voi

java - Could not initialize proxy - no Session -

i've got error looks this: could not initialize proxy - no session i'm working java, hibernate , spring. error comes when trying generate pdf document, , i'm following next steps generate on fly , store in database. i sent request app through post method. generates pdf on fly , shows user. just after request send another, through ajax request. generate same pdf save in db. the error shows query not executed due "could not initialize proxy - no session" error. is there doing wrong, calling same methods twice same user session? session closed before both requests have finished? hope can me understand happening. your problem hibernate session lives 1 request. opens in start of request , closes @ end. guessed answer: hibernate session closed before both requests finished. exactly happening? entity objects live during both requests. how? stored in http session (which different thing called session) don't give information framework

io - Multipage Tiff write in MATLAB doesn't work -

i'm reading in tiff using below function, works fine, when try use write function write same tiff different file, it's 255's. know how fix this? thanks, alex. function y = tiff_read(name) % tiff reader works info = imfinfo(name); t = numel(info); d1 = info(1).height; d2 = info(1).width; y = zeros(d1,d2,t); t = 1:t temp = imread(name, t, 'info',info); y(:,:,t) = temp(1:end,1:end); end % tiff writer doesn't work function tiff_write(y,name) % y should 3d, name should end in .tif t = size(y,3); imwrite(y(:,:,1),name); t = 2:t imwrite(y(:,:,t),name,'writemode','append'); end try using line : y = zeros(d1,d2,t,'uint16'); instead of one: y = zeros(d1,d2,t); your data in uint16 format , when export clip maximum value 255 (uint8), makes pixel values greater 255 (a lot of them if data in uint16) appear white. otherwise might want use line: function tiff_write(y,name) % y should 3d, name should end in

wireless - Adding obstacle between the turtles -

i new netlogo environment , trying develop model wireless communication. came across 1 problem have block communication between 2 nodes( turtles) in such way if keep obstacle in between 2 nodes ( patch color or that), transmitting node should scan obstacle , reports end procedure. went through line of sight model , obstacle avoidance model in netlogo community of little me. node supposed scan obstacle not in range of 1 patch ahead whole distance between , other node. ideas or primitives suitable problem of great me. hope have made clear , sorry english :) best regards that's not efficient solution, assuming have following breeds: breed [ obstacles obstacle ] breed [ nodes node ] you can use following reporter: to-report can-see? [ target ] let result false hatch 1 [ face target fd 0.1 set result ifelse-value (any? turtles-here [ self = target ]) [ true ] [ ifelse-value (any? obstacles-here) [ false ] [ can-see? tar

python - PyAPNs version 1.1.2 doesn’t have enhanced keyword? -

i’m sure obvious, i’m missing it. i’ve installed pyapns via pip: # pip install apns then when try use “enhanced” flag in apns, it’s not there. # python python 2.7.6 (default, nov 11 2013, 18:34:29) [gcc 4.4.7 20120313 (red hat 4.4.7-3)] on linux2 type "help", "copyright", "credits" or "license" more information. >>> apns import apns >>> server = apns(use_sandbox=true, cert_file=“/mydir/apns-dev-cert.pem", key_file=“/mydir/apns-dev-key.pem", enhanced=true) traceback (most recent call last): file "<stdin>", line 1, in <module> typeerror: __init__() got unexpected keyword argument 'enhanced' >>> and sure enough 1.1.2 version pip installed doesn’t have keyword. thought latest released version in pyapns repository https://github.com/djacobs/pyapns . i want use ‘enhanced’ keyword, error checking. ideas? version 1.1.2 available on pypi doesn't provide

ios - How do I delete a row from a Parse object? -

i have class on parse.com called "hospital", has few rows on it. want query rows in object, , selectively delete of them. i figure need cycle through object, gathering objectids, , @ row associated each id figure out ones should deleted. can't find how anywhere. i've tried this: pfquery *query = [pfquery querywithclassname:@"hospital"]; but returns object 0 objects inside it, when there row in parse.com database. once part working, , objectids, seems can delete row following: pfobject *testobject = [pfobject objectwithoutdatawithclassname:@"hospital" objectid:@"nmz8glj3re"]; [testobject deleteinbackgroundwithblock:^(bool succeeded, nserror *error) { if (succeeded){ nslog(@"booooom"); // function refresh data } else { nslog(@"delete errir"); } }]; pfquery *query = [pfquery querywithclassname:@"hospital"]; [query findobjectsinbackgroundwithblock:^(nsarray *hospitals, nserror *error

docusignapi - Not receiving event notifications from DocuSign API -

Image
i'm using the docusign rest api v2 , not receiving event notifications when posting composite template envelope endpoint. here's json request looks like: { 'accountid': '[ommitted]', 'status': 'sent', 'emailsubject': 'xyz corp_msa_singapore-ou_0.1_2014099.pdf', 'compositetemplates': [ { 'inlinetemplates': [ { 'sequence': '1', 'recipients': { 'signers': [ { 'email': 'jeff@mattnibecker.com', 'name': 'jeff dunham', 'recipientid': '1', 'defaultrecipient': 'true', 'clientuserid': '1' } ] } } ], 'd

Swift - UICollectionView repeats (duplicate) cells -

hi have array 100 pictures url's taken flickr. when use uicollectionview display 100 cells, 8 cells on screen , when scroll down see next 8 same previous , when execute func collectionview(collectionview: uicollectionview!, cellforitematindexpath indexpath: nsindexpath!) -> uicollectionviewcell! and println("something") writes in console 8 time content of array 100 i use this: func collectionview(collectionview: uicollectionview?, numberofitemsinsection section: int) -> int { return self.photosurls.count } it makes 100 cells cells repeats always... knows how beat swift in new version of xcode gm seed ? func collectionview(collectionview: uicollectionview!, cellforitematindexpath indexpath: nsindexpath!) -> uicollectionviewcell! { let cell: imagecell = collectionview.dequeuereusablecellwithreuseidentifier("cell", forindexpath: indexpath) imagecell let imgurl = photosurls[indexpath!.row] let api_url = nsurl.urlwithstring(im

inno setup - use a var in [RUN] section -

i wish read var value in [run] section, kets code - [setup] [files] source: "myprog.exe"; destdir: "{app}"; flags: ignoreversion [run] filename: "{app}\myprog.exe"; description: ""; parameters:"/setid=sessionidvalue" [code] var sessionidvalue: string; procedure initializewizard(); begin sessionidvalue:= 'test'; end; is possible pass sessionidvalue value parameters:"/setid=sessionidvalue" 10x help you can write scripted {code:...} constant getter function bridge [code] section scripting sections, e.g.: [run] filename: "{app}\myprog.exe"; parameters: "{code:getsessionid}" [code] var sessionid: string; function getsessionid(param: string): string; begin result := sessionid; end;

xml - Python: Better solution to repeat function invocation in comprehension -

i have xml file which, need extract id , title fields (under page tag). doing, , works fine. but, not happy 3 calls elem.find('title). there better approach avoid comprehensions? understand writing in loop solve problem. import xml.etree.elementtree et tree = et.parse(some file) root = tree.getroot() id_title_list = [(elem.find('id').text, elem.find('title').text) elem in root.findall('page') if elem.find('title').text.startswith('string1') or elem.find('title').text.startswith('string2')] there nothing wrong in breaking down normal loop , having intermediate variables: id_title_list = [] elem in root.findall('page'): title = elem.find('title').text if title.startswith(('string1', 'string2')): id_title_list.append((elem.find('id').text, title)) note startswith() supports multiple prefixes passed

How to preserve formatting in PowerPoint when replacing text with RegEx in VBA -

i using regex in vba replace text in powerpoint presentation, of original formatting altered after running script. specifically, bullet points , font colours. here code using. how can alter in order preserve initial format? sub use_regex2() dim regx object dim osld slide dim oshp shape dim strinput string dim b_found boolean dim irow integer dim icol integer 'move dollar sign end of numbers set regx = createobject("vbscript.regexp") regx .global = true .pattern = "([$])([0-9,.]*\d)" end each osld in activepresentation.slides each oshp in osld.shapes if oshp.hastable irow = 1 oshp.table.rows.count icol = 1 oshp.table.columns.count strinput = oshp.table.cell(irow, icol).shape.textframe.textrange.text b_found = regx.test(strinput) if b_found = true strinput = regx.replace(strinput, "$2 $1") o

javascript - Scroll to NEXT/PREV buttons with Bootstrap ScrollSpy -

i looking through answers creating next , prev buttons go through anchor points on page, couldn't find need. 1 might of been close wanted decided use starting point: how can make link go next anchor on page without knowing anchor name? i created fiddle concept presented in answer , tried make work bootstrap's scrollspy (detects current section , anchor). i have gotten far: http://jsfiddle.net/gukne0ol/2/ $('.next').click(function (e) { e.preventdefault(); var current_anchor = $('li.active a'); var next_anchor = current.next('li a'); $('body').animate({ scrolltop: next_anchor.offset().top }); }) $('.previous').click(function (e) { e.preventdefault(); var current_anchor = $('li.active a'); var previous_anchor = current.prev('li a'); $('body').animate({ scrolltop: previous_anchor.offset().top }); }) the original answer targets <a> tag, in boot

multithreading - Java using multiple threads during memory allocation -

i'm writing java program allocates large multi-dimensional array processing. during allocation, java ends using of cpus available (in case, 8 cpus). expected behaviour? i'm running ubuntu 14.04 java version 1.7.0_65. if need more information please let me know. if expected behaviour, there way limit uses 1 cpu? public class test { public static void main(string[] args){ system.out.println("test"); int = 1000; int b = 100; int c = 100; int d = 1; int e = 10; float[][][][][] test = new float[a][b][c][d][e]; system.out.println("done"); } } edit: setting initial heap size large enough, program never ended using more 1 cpu. in future using both large enough initial jvm size , taskset command limit cpu affiinty. allocation performed in current thread, if there insufficient space on heap allocation request can trigger garbage collection, which, depending on jvm , garbage col