Posts

Showing posts from March, 2015

javascript - OnClick interaction with .load(ed) page not working -

i'm in process of loading view different info panels using jquery's .load() function. however, of content in loaded element i'd interact (using .on('click')) doesn't seem responding accordingly. can have click actions on dynamically loaded content? if not, what's best work around? #updatejson lives within viewjson.php file. $().ready(function() { $("#viewlatestjson").load("viewjson.php"); $("#viewlivedatafeeds").load("viewfeed.php"); $('#updatejson').on('click', function(e){ e.preventdefault(); $("#alertpanel").removeclass( "success warning info alert secondary" ); $("#alertpanel").addclass( "secondary" ); $("#alertmessage").html( "<img src=\"icons/alert-loader.gif\"> updating local json conversion, please wait..." ); $("#alertpanel").fadein(300); $.ajax({ url: 'downloadjson

javascript - auto apply masonry in knockout binding handler after dynamic update -

i using knockoutjs masonry , have created custom knockout binding handler apply masonry html element. the container want apply masonry has it's content injected dynamically using knockout's foreach binding. the issue having getting masonry apply after masonry container has been updated dynamically. in snippet example if click masonryize button destroy masonry container , reapply mansonry, how behaviour binding handler? ko.bindinghandlers.masonry = { update: function(element, valueaccessor) { var options = valueaccessor(); $(element).masonry(options); } } var vm = { term: ko.observable(), page: ko.observable(1), per_page: ko.observable(3), items: ko.observablearray(), masonryize: function() { $('.grid').masonry('destroy'); $('.grid').masonry({ itemselector: '.item', columnwidth: 200 }); }, getstuff: function() { $.ajax({ url: 'https://api.g

Sitecore/xDB/MongoDB arbiter instance receiving application account connection attempts -

i have sitecore 8 test environment 3 mongo 2.6.5 instances xdb. these configured replication set using keyfile 2 servers 'mongotest1' & 'mongotest2' , 1 arbiter 'mongotest3'. non-admin account has been createdin mongo web application, stored in admin database readwrite permissions in 5 xdb databases. sitecore connection strings in format: connectionstring="mongodb://webapp:password@mongotest1:27018,mongotest2.local:27019/sc8-tracking-history?replicaset=repset1&amp;authsource=admin note arbiter not specified in connection string, normal. rs.status() gives following, looks correct: "date" : isodate("2015-07-23t16:47:08z"), "mystate" : 2, "syncingto" : "mongotest1.local:27018", "members" : [ { "_id" : 0, "name" : "mongotest1.local:27018", "health" : 1, "state"

pointers - flattening and dumping nested struct in C -

how 1 take struct contained multiple other structs, amongst bools, ints etc, , flatten text form? struct person { struct eye_data eyes; struct nose_data nose; struct ear_data ear; int height; int weight; bool alive; } the scenario under operating is: person wants send on struct created , used, on person b, individual configurations of struct many send on via email or something. how write dump function in order able say, write struct information text file, can later parsed program read in, create struct. also, how change if struct person contained pointers structs, ie: struct person { struct eye_data *eyes; struct nose_data *nose; struct ear_data *ear; int *height; int *weight; bool alive; } if struct in question contains no pointers, , of structs contained within contain no pointers (fixed size arrays fine, including fixed size strings), can write disk is: struct person person; // not show

javascript - AngularJS - compiled html in tootilp -

i trying use tooltip in ng-repeat based on angularjs: grab compiled html , set tooltip however somehow not able make work. html- <tr ng-repeat="row in docdetails"> <td class="usebootstrap uploadeddocs"> <div class="usebootstrap col-sm-2" upload-info="row" index="{{$index}}"> <p tooltip-html-unsafe="{{tooltips[$index] }}"> {{ row.filename | limitto: 15 }}{{row.filename.length > 15 ? '...' : ''}}</p> my directive app.directive('uploadinfo', function ($compile, $timeout) { /* wrap in root element can final innerhtml*/ var tiptemplate = '<div> {{row.filename}} injected in tooltip </p><div>'; return { link: function (scope, el, attrs) { var tipcomp = $compile(tiptemplate)(scope) $timeout(function () { scope.tooltips[attrs.index] = tipcomp.html() }); } } }); controller have declared

java - How to leave resources in the jar file to not need external folders? -

i finishing first game in java, called spacewar. build project requires resources folder (where put sprites etc ...) in same place jar file. wanted know way let images inside jar file, because better because prevents user deleting accidentally. place images part of java packages . example, com.project.images and may need use following in code : getclass().getresource("com/project/images/picture.bmp")); to access images. then images part of jar.

javascript - How i can download bootstrap-dialog.min.js? -

where can download file: bootstrap-dialog.min.js ? i arrived here: https://github.com/nakupanda/bootstrap3-dialog/blob/master/examples/assets/bootstrap-dialog/js/bootstrap-dialog.min.js but not sure how can download file. i want load in locally. copy/past file content locally: https://raw.githubusercontent.com/nakupanda/bootstrap3-dialog/master/examples/assets/bootstrap-dialog/js/bootstrap-dialog.min.js clone repo locally: git clone https://github.com/nakupanda/bootstrap3-dialog.git download npm package: npm install bootstrap3-dialog download bower package: bower install bootstrap3-dialog

angularjs - How do I mock an Angular controller when I compile the directive? -

i have following angular code... <!-- directive template --> <div style="display:hidden" ng-if="ctrl.test()"> ... // controller ... this.test = function() { return false; } now need mock ctrl.test can test dom rendered when true (this isn't real code demo why returns false). try following test... beforeeach(module('mod')); var $controller, $scope, $httpbackend, $rootscope, $compile; beforeeach(inject(function(_$controller_, _$rootscope_, _$httpbackend_, _$compile_){ $rootscope = _$rootscope_; $scope = _$rootscope_.$new(); $httpbackend = _$httpbackend_; $controller = _$controller_(impactformcontroller, { $scope: $scope }); $compile = _$compile_; })); describe("form functionality", function(){ it("submitting saves form properly", function() { //todo should check response seems uness. var compiled = $

rest - Is Restful independent of the transport protocol? -

i doing test, , confused on below question which 2 statements true restful web services? a. can both stateful , stateless. b. support use of ajax in web applications. c. similar simple object access protocol (soap) equivalents. d. independent of transport protocol. e. support remote procedure call (rpc) , message-oriented middleware (mom) integration styles. there test answers b & c , other answers b & d. correct answers? the option c. has typo: 'similar' shall 'simpler'. correct answer b , c. a. wrong. rest stateless. restful web service can made stateful, sending , forth session-id, same goes soap web service. however, rest concept use http infrastructure , super scalable. once there state maintained, scalability suffers 1 can not reuse same url serve (other client’s) request d. wrong soap web service can support many transport protocols not rest. e. wrong. feature soap web services.

android - Convert AsyncTask to RxAndroid -

i have following method post response ui using otto , asynctask . private static void ongetlateststorycollectionsuccess(final storycollection storycollection, final bus bus) { new asynctask<void, void, void>() { @override protected void doinbackground(void... params) { bus.post(new lateststorycollectionresponse(storycollection)); return null; } }.execute(); } i need convert asynctask rxjava using rxandroid library . don't use .create() use .defer() observable<file> observable = observable.defer(new func0<observable<file>>() { @override public observable<file> call() { file file = downloadfile(); return observable.just(file); } }); to know more details see https://speakerdeck.com/dlew/common-rxjava-mistakes

Elasticsearch not merging highlights -

i have elasticsearch field index using ngram tokenizer. unexpectedly, elasticsearch not merge adjacent highlights. example search term 854511 following highlights da v50 v335 auf v331 j06a <mark>85</mark><mark>45</mark><mark>11</mark> while i'd expect this da v50 v335 auf v331 j06a <mark>854511</mark> here analyzers: additional_analyzers = { analyzer: { ngram_analyzer: { tokenizer: :ngram_tokenizer, filter: 'lowercase' }}, tokenizer: { ngram_tokenizer: {type: :ngram, min_gram: 2, max_gram: 20, token_chars: [ 'letter', 'digit', 'symbol', 'punctuation' ] }} } settings analysis: additional_analyzers mappings indexes :name, type: 'multi_field' indexes :name, type: :string, analyzer: :ngram_analyzer, term_vector: :with_positions_offsets indexes

matlab - Setting a name for data -

i using matlab software generate set of data , save these data '.mat' file. there parameters on file , want set name these '.mat' files according value of parameters. example, if a=10,b=20, name of '.mat' file 'data-10-20'. if a=20,b=30,the name of '.mat' file 'data-20-30' , on. is there can me?

regex - How to match a hex sequence of characters and replace it with white space in PHP -

Image
i have text need clean characters. characters showed in pictures attached question. want replace them white space x20 . my attempt use preg_replace . $result = preg_replace("/[\xef\x82\xac\x09|\xef\x81\xa1\x09]/", "\x20", $string); for particular case approach works, cases won't, because example had text comma , matched x82 , removed text. how write regex search exact sequence ef 82 ac 09 , or other 1 ef 81 a1 09 , , not each pair separately ef 82 ac 09 ? 1.) match of 6 different hex bytes or pipe character in character class. wanted use group (?: ... | ... ) matching different byte sequences. 2.) byte sequences not match image. seems messed 2 bytes. picture shows: ef 82 a1 09 , ef 81 ac 09 vs try: \xef\x82\xac\x09 | \xef\x81\xa1\x09 3.) when testing input sample $str = "de la nouvelle;  fourniture $  option :"; foreach(preg_split("//u", $str) $v) { var_dump($v, bin2hex($v)); echo "\

javascript - Option for removing the uploaded files displayed using <g:downloadfile> tag -

i have used <g:downloadfile> tag display list of uploaded files. display uploaded files list of downloadable links. but have problem here, unable provide user, delete option if he/she wish delete uploaded file. usage: <g:downloadfiles filelist="${filelist}" /> i think there should way out using jquery or javascript. thanks in advance help. below solution have written question: gsp: <g:each in="${filelist}" var="file"> <div class="remove"> <a href="#"> <span class="glyphicon glyphicon-remove"></span></a> <a href="/forms/landing/attachment/${file.attachmentid}" filename="${file.name}">${file.name}</a> </br> </div> </g:each> jquery: $(document).ready(function(){ $('.glyphicon-remove').click ( function(e){ e.preventdefault(); $(this).

ruby on rails - ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: permission denied for relation schema_migrations -

i have local project, rails , postgres. threw on aws amazon linux ami. have run test projects rails , postgres on server. when uploaded local project, , try run rake db:migrate i following error: activerecord::statementinvalid: pg::insufficientprivilege: error: permission denied relation schema_migrations i saw similar issues, none of them help. have proper role setup , connected. i'm not sure if you're running rake db:migrate rails_env production or development. whichever (development default), in config/database.yml user, password, , database running on. user must have all privileges on public.schema_migrations table. if does, , it's still not working, make sure user has privileges on public schema. read more manipulating postgres database privileges here . postgres has excellent documentation. one more thing: if you're creating database locally, , trying create initial database instead of running migration, use rake db:schema:load

java - Disabling the listening to rabbit queues from spring application.properties -

i want create application-development.properties file in spring define dev environment. in environment want disable listening rabbit queues because don't want interfere staging queues while debugging etc. problem - can't find property controls this. no "active" property or "enabled" property or anything.. these properties found in spring docs : # rabbit (rabbitproperties) spring.rabbitmq.addresses= # connection addresses (e.g. myhost:9999,otherhost:1111) spring.rabbitmq.dynamic=true # create amqpadmin bean spring.rabbitmq.host= # connection host spring.rabbitmq.port= # connection port spring.rabbitmq.password= # login password spring.rabbitmq.requested-heartbeat= # requested heartbeat timeout, in seconds; 0 none spring.rabbitmq.listener.acknowledge-mode= # acknowledge mode of container spring.rabbitmq.listener.concurrency= # minimum number of consumers spring.rabbitmq.listener.max-concurrency= # maximum number of consumers spring.rabbitmq.listener.

from c malloc matrix to java array -

i have c code: double **a; = (double **)malloc( (m+2+1)*sizeof(double *)); for(i=1; i<=m+2; i++) a[i] = (double *)malloc( (n+1+1)*sizeof(double)); and have convert in java code. not sure but, equivalent write in java?: double[][] = new double[m+2+1][n+1+1] what best way convert data structure in java? ============================================== debugging 2 codes have 2 different behaviors: m=8 , n=13 debugging c code, allowed access a[14][407] int main() { int i,m,n; m = 2; n = 2; double **a; = (double **)malloc( (m+2+1)*sizeof(double *)); for(i=1; i<=m+2; i++) a[i] = (double *)malloc( (n+1+1)*sizeof(double)); int num_rows = sizeof(a) / sizeof(a[0]); int num_cols = sizeof(a[0]) / sizeof(a[0][0]); printf("r %d c %d", num_rows, num_cols); } debugging java code a[10][15] what's difference? thanks ============================================== @crawford-whynnes to do: al

jquery - Find each img src in document body -

i want find each image on page , replace image i attempting following piece of jquery. $('img').each(function() { $(this).attr("src", "http://myurl.com/mypic.jpg"); } however not updating of images on page? there have missed? in code haven't finished function closing ) . try: $("img").each(function () { $(this).attr("src", "http://myurl.com/mypic.jpg"); }); or simplify: $("img").attr("src", "http://myurl.com/mypic.jpg");

asp.net mvc - iis7 url rewrite for webforms aspx to mvc page -

i have had website /contact.aspx gets succesful redirect /contact want redirect old /content.aspx?contentid=123 /about/123 here redirect xml part in web.config: <rewrite> <rules> <rule name="contact" patternsyntax="wildcard" stopprocessing="true"> <match url="contact.aspx" /> <action type="redirect" url="contact" redirecttype="found" /> </rule> <rule name="content" patternsyntax="wildcard" stopprocessing="true"> <match url="content.aspx?contentid=*" /> <action type="redirect" url="about/{r:1}" appendquerystring="false" redirecttype="found" /> </rule> </rules> </rewrite> visiting mydomain.com/content.aspx?contentid=123 gives me 404. tried without appendquerystring="

c++ - How to destroy a smart pointer prematurely -

i have class has setter method takes unique_ptr argument. unique_ptr saved class member. class testclass { std::unique_ptr<tester> sp; void settester_way1(std::unique_ptr<tester> te) { auto deleter=std::move(sp); sp=std::move(te); } void settester_way2(std::unique_ptr<tester> te) { sp=std::move(te); } }; which way correct way set smart pointer? way2 leak original pointer of sp? way2 fine, when assign unique_ptr existing owned pointer safely deleted.

Spring + multiple H2 instances in memory -

two different h2 instances created in-memory. make sure happens, initialized both instances same shema , different data. when query using dao different set of data picked different datasource. not happening. doing wrong? how name instance of h2 correct? @bean(name = "ds1") @primary public embeddeddatabase datasource1() { return new embeddeddatabasebuilder(). settype(embeddeddatabasetype.h2). setname("db1"). addscript("schema.sql"). addscript("data-1.sql"). build(); } @bean(name = "ds2") public embeddeddatabase datasource2() { return new embeddeddatabasebuilder(). settype(embeddeddatabasetype.h2). setname("db2"). addscript("schema.sql"). addscript("data-2.sql"). build(); } you have created 2 datasources , have marked 1 @primary -- 1 used when entitymanagerfactories

angularjs - Angular.js ui-grid custom date filter -

Image
i using angular grid, ui-grid, located @ ui-grid.info . i trying make custom filter filter grid date using date inputs controls, 1 less , 1 greater than. i seem able put controls want them using in columndefs: { field: 'mixeddate', cellfilter: 'date', filterheadertemplate: '<div>from <input type="date"> <input type="date"></div>' } . can sort of filtering work setting data-ng-model="colfilter.term" when putting these things in different scope. filtering doesn't seem equals though. does have code works or can point me in right direction? here tutorials on topic on own site, i'm not quite sure how manipulate them fit needs or if it's possible. ui-grid filtering ui-grid custom filtering do mean ? first should include jquery ui datepicker then create directive it: app.directive('datepicker', function(){ return { restrict : "a", req

view - Zend framework 2 loop through elements of element collection -

i created collection of inputs zend\form\element\collection, like $this->add([ 'type' => 'zend\form\element\collection', 'name' => 'some-name', 'options' => [ 'label' => 'some name', 'count' => 3, 'target_element' => [ 'type' => 'text', ], ], ]); this codes renders 3 inputs label , fieldset if use echo $this->formcollection($form->get('some-name')); (or of formcollection) in view script. i want wrap each input of collection divs. idea iterate on input collection extract inputs. how can this? you can treat collection traversable object. <?php foreach ($form->get('some-name') $element) : ?> <div>..</div> <?php endforeach; ?>

c# - Efficient way to edit a list of EF entities -

i know opinion efficient way update entity contains collection of child-entities, using ef. not familiar inner workings of ef. let's have study entity, has many center entities. 2 tables linked using linking table contains idstudy , idcenter. list of centers belong study can change. every study has between 1 , 50 centers. for example: initial selection center 1,2,3,4. user edits list removing 1,2 , adding 5,6. new list 3,4,5,6. what approach more efficient update db? delete existing entries. inserting items in new list. determine new. determine should inserted. delete no longer selected. insert new. for each item in new list, update existing records. delete remaining records if new list has fewer elements. insert rest of elements if new list has more. thank in advance. personally go first option. writing code updates if necessary, , deletes right records afterwards, cumbersome. you can delete pretty entity framework, , can in transaction even. i'd g

html - Aligning a table to the second column of another table -

i want align second <table> in <div> . table should start second column of first table. right now, second table text “1111111111111” starts extreme left wish align textboxes start in first table. here html: <div style="float: left; height: 250px;overflow:auto; display:block;margin-left: 10px"> <table border="1"> <tr> <td style="padding-left: 10px; font-size: 24px;text-align: center" colspan="2">title</td> </tr> <tr> <td style="padding-top: 10px;"> <asp:label runat="server">first name</asp:label> </td> <td style="padding-top: 10px;padding-left: 10px"> <input type="text" /> </td> </tr> <tr> <td style="padding-top: 10px;"> <asp:label runat="server">email</asp:la

python - Can ElementTree be told to preserve the order of attributes? -

i've written simple filter in python using elementtree munge contexts of xml files. , works, more or less. but reorders attributes of various tags, , i'd not that. does know switch can throw make keep them in specified order? context this i'm working , on particle physics tool has complex, oddly limited configuration system based on xml files. among many things setup way paths various static data files. these paths hardcoded existing xml , there no facilities setting or varying them based on environment variables, , in our local installation in different place. this isn't disaster because combined source- , build-control tool we're using allows shadow files local copies. thought data fields static xml isn't, i've written script fixing paths, attribute rearrangement diffs between local , master versions harder read necessary. this first time taking elementtree spin (and fifth or sixth python project) maybe i'm doing wrong. abstracted s

java - How to print pretty JSON using docx4j into a word document? -

i want print simple pretty json string (containing multiple line breaks - many \n) word document. tried following docx4j prints contents inline in 1 single line (without \n). ideally should print multiline pretty json recognising "\n" json string contains : 1) wordmlpackage.getmaindocumentpart().addparagraphoftext({multiline pretty json string}) 2) objectfactory factory = context.getwmlobjectfactory(); p p = factory.createp(); text t = factory.createtext(); t.setvalue(text); r run = factory.creater(); run.getcontent().add(t); p.getcontent().add(run); ppr ppr = factory.createppr(); p.setppr(ppr); pararpr pararpr = factory.createpararpr(); ppr.setrpr(pararpr); wordmlpackage.getmaindocumentpart().addobject(p); looking help. thanks. the docx file format doesn't treat \n newline. so you'll need split string on \n, , either create new p, or use w:br, so: br br = wmlobjectfactory.createbr(); run.getcontent().add( br);

swift - Sending array data from one view controller to another -

i trying copy array 1 view controller view controller, somehow not work.. have tried using code: let othervc = terningspilletviewcontroller() minespillere = othervc.minespillere2 println("othervc") in view controller want send data has code: var minespillere = ["spiller 1", "spiller 2", "spiller 3"] the view controller going received data, has code: var minespillere2 = [string]() the " var minespillere " going show text, when try show it, says " var minespillere " empty. suggestions/ideas? if want access array of viewcontroller can save in memory , can use nsuserdefaults way: //save var minespillere = ["spiller 1", "spiller 2", "spiller 3"] var defaults = nsuserdefaults.standarduserdefaults() defaults.setobject(minespillere, forkey: "yourkey") now can read anywhere way: //read if let testarray : anyobject? = nsuserdefaults.standarduserdefau

c# - WebAPI Certificates and Authentication - ELI5 -

i'm sure i'm missing key facts, can you. i'm confused on how needs work: server 1 – iis 8, hosting vendor’s webapi, anonymous , windows authentication. providers negotiate, ntlm. https , signed certificate (cert1). server 2 – iis8, new webapi connecting server1’s webapi. i’m assuming need store cert1 on server 2. have certificate, https (cert2) server 3 – iis 8, website connecting server 2’s webapi. user – browser connecting server 3, windows authentication only. every server , user’s browser connects same active directory. i have access server1’s web.config change bindings, not code. in visual studio 2013, when add service reference server 2, web.config added this: <system.servicemodel> <bindings> <wshttpbinding> <binding name="wshttpbinding_icorewebservice"> <security mode="transport"> <transport clientcredentialtype="windows" proxycredentialtype="none" realm

javafx - How to use ColorAdjust to set a target Color? -

Image
situation i have image circle filled radial gradient ranges white black/transparency. serves particle , needs colorized during lifecycle. problem i'm using coloradjust apply different colors image. problem colors aren't way want them be. if use green target color, pink ball. question how calculate coloradjust's hue value match given target color? or there better way colorize images? can't use shape because using imageview way faster using shape. code here's code. problem hue difference current color: import javafx.application.application; import javafx.scene.node; import javafx.scene.scene; import javafx.scene.snapshotparameters; import javafx.scene.effect.coloradjust; import javafx.scene.image.image; import javafx.scene.image.imageview; import javafx.scene.image.writableimage; import javafx.scene.layout.hbox; import javafx.scene.paint.color; import javafx.scene.paint.cyclemethod; import javafx.scene.paint.radialgradient; import javafx.scene.pain

linux - Re-initialize and build Android project from the command line? -

i have once built android project on linux machine; that, downloaded android sdk , used gradlew build it, worked fine. now, got zip containing android project source code; however, i'm not experienced this, have no idea project made in, nor how built. directory structure looks this: . ├── androidmanifest.xml ├── assets ├── bin │   ├── androidmanifest.xml │   ├── classes │   │   └── com # ... .class files here ... │   ├── jarlist.cache │   └── res ├── gen │   └── com # ... buildconfig.java here ... │   └── android-support-v4.jar ├── lint.xml ├── proguard-project.txt ├── project.properties ├── res │   ├── drawable # ... .png files here ... │   ├── drawable-hdpi # many similar dirs, launcher.png file ... │   ├── layout # main.xml , other .xml files ... │   ├── raw # .json files here ... │   ├── values # values-v11, values-v14 dirs; has styles.xml ... └── src └── com # .java source files here ... i have tried how/when gene

nullpointerexception - Android FileoutputStream NullPOinter Exception -

public class database_wrapper { users_database u_db; sqlitedatabase sql_db; context context; database_wrapper(context context) { u_db = new users_database(context); sql_db = u_db.getwritabledatabase(); } public long insert_data(list<name_holder> list) { contentvalues contentvalues = new contentvalues(); long error_code = 0; string filename; for(int = 0; < list.size(); i++) { filename = "test_image";//string.valueof(list.get(i).id); log.v("datadata",filename); if(list.get(i)._bmp == null) { log.v("datadata", "no image"); } try { bytearrayoutputstream bytes = new bytearrayoutputstream(); fileoutputstream fo; list.get(i)._bmp.compress(bitmap.compressformat.jpeg, 100, bytes); fo = context.openfileoutpu

spring data neo4j 4 - SDN4 - Error mapping GraphModel to instance -

in web app storing , authenticating users against neo4j server. in flow if register app (thus saving user instance) , proceed login page can log in fine. if stop server , start again cannot log in. error is: org.springframework.security.authentication.internalauthenticationserviceexception: error mapping graphmodel instance of co.foo.data.models.user the user in database. if delete user, register again , log in works fine until restart server, repeatable. using sdn 4.0.0.rc1 code public interface myuserdetailsservice extends userdetailsservice { @override userdetails loaduserbyusername(string username) throws usernamenotfoundexception, dataaccessexception; user getuserfromsession(); @transactional user register(string username, string firstname, string lastname, string password); } public interface userrepository extends graphrepository<user>, myuserdetailsservice { user findbyusername(string username); } @primary @service public class

javascript - Class method with google maps event listener run external function -

sorry question title, hard find one... i have class handle google maps , 1 of methods create custom control: // method: map.prototype.addbutton = function (order, onclickevent) { var = this; var buttonui = $.get('/templates/order-button.html', function (data) { var button = $(data)[0]; $(button).attr('id', order.id); $(button).find('span:eq(1)').text('#' + order.id); google.maps.event.adddomlistener(button, 'click', function() { onclickevent; }); }); } as can see added click event. click should open modal window. when use method i'm doing: var map = new map(); map.addbutton(order, openmymodal()); unfortunately open modal page load. i tried well: var map = new map(); map.addbutton(order, function() { openmymodal(); }); so, question is, how can attach open modal window function google maps event listener? var map = new map(); map.addbutton(order,

javascript - Want to make http get request only if text is typed in input field ANGULARJS -

the data coming local json file, want make http.get request when searchtext (on keypress) typed in input field <input type="text" class="form-control" ng-model="searchtext"> i show results in following table: <table ng-if="searchtext" class="searchresults table table-bordered table-hover table-responsive"> <tr> <th>dll id</th> <th>kvk nummer</th> <th>company name</th> </tr> <tr ng-repeat="data in getdata | filter: customfilter"> <td>{{data.id}}</td> <td>{{data.sttax_id_vat_number}}</td> <td>{{data.accountname}}</td> </table> in controller have far following: $scope.searchtext = undefined; if($scope.searchtext){ $http.get('data/json_sample/dv_ic_01.json') .success(function(data){ $scope.alldata = data; $scope.ge