Posts

javascript - Is there a callback for ng-bind-html-unsafe in AngularJS -

i remove of elements brought dom this... <div ng-bind-html-unsafe="whatever"></div> i wrote function remove elements, need way trigger function after ng-bind-html-unsafe complete. there callback ng-bind-html-unsafe or better approach? ng-bind-html-unsafe has been removed current version (1.2+) of angular. recommend using $sanitize service in new version of angular. you'll need include sanitize library , add module. that way can whatever want once sanitize operation complete , not worry callback. a quick , dirty implementation: <!doctype html> <html lang="en"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.js"></script> <script src="libs/angular/angular-sanitize.js"></script> </head> <body ng-app="myapp"> <div ng-controller="mycontroller"> <div>{{sanitized}}</div> ...

android - Positioning a progress bar behind a button -

Image
i have button defined in relativelayout follows: <button android:id="@+id/search_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/current_location" android:layout_marginleft="5dp" android:layout_marginright="5dp" android:paddingbottom="30dp" android:paddingtop="30dp" android:text="@string/search" /> i add progressbar behind button occupies exact same space button, when button disabled (translucent), can see progress bar behind it. how this? to had define button in main.xml first, followed progress bar follows: <button android:id="@+id/search_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/current_location" android:layout_m...

oop - Clarification needed on Concept of a listener anonymous class in java -

i'm new java. purpose of listener anonymous inner class design? heard anonymous classes used listeners in java. , no 1 creates inner classes or static inner classes. i'm not sure means. 1 explain these concepts bit? listener design , how created via anonymous class. thank in advance. an anonymous listener this: mycontrol.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { // handle event } }); using inner class accomplish same goal this: public void init() { mycontrol.addactionlistener(new myactionlistener()); } private class myactionlistener implements actionlistener { public void actionperformed(actionevent e) { // handle event } } now consider 2 in scope of larger program. anonymous listener still right there @ spot you're adding it. inner class may somewhere else in source file entirely. ide, difference can minimized (such members browser), there need entirely new class you...

java - Why does trim() not remove the trailing white spaces in this example? -

i revising java here: http://java-success.blogspot.com.au/2012/06/core-java-coding-questions-frequently.html , came along question: "q1. output of following code snippet? string s = " hello "; s += " world "; s.trim( ); system.out.println(s); a1. output be " hello world " with leading , trailing spaces. expect trimmed "hello world". so, concepts question try test? string objects immutable , there trick in s.trim( ) line. understanding object references , unreachable objects eligible garbage collection." can explain why trailing white spaces not removed? the method trim() doesn't modify string , immutable. returns trimmed string , promptly ignored, leaving s unchanged. replace s.trim( ); with s = s.trim( );

c++ - Trouble figuring out what's wrong with this code on Linux -

i'm having trouble figuring out why code not working on linux. i'm getting errors shared_ptrs like: (partial list) roject.cpp:21: error: iso c++ forbids declaration of 'shared_ptr' no type project.cpp:21: error: expected ';' before '<' token project.cpp:22: error: iso c++ forbids declaration of 'shared_ptr' no type project.cpp:22: error: expected ';' before '<' token project.cpp:23: error: iso c++ forbids declaration of 'shared_ptr' no type project.cpp:23: error: expected ';' before '<' token project.cpp:30: error: iso c++ forbids declaration of 'shared_ptr' no type project.cpp:30: error: expected ';' before '<' token project.cpp:37: error: iso c++ forbids declaration of 'shared_ptr' no type project.cpp:37: error: expected ';' before '<' token project.cpp:82: error: 'shared_ptr' has not been declared project.cpp:82: error: expected...

Python Parsing XML Response -

i have soap response trying parse elementtree doc = et.parse(response_xml) cust in doc.findall('.//{http://www.starstandards.org/webservices/2005/10/transport}content'): custnumber = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}customernumber') custfname = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}firstname') custlname = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}lastname') return custnumber, custfname, custlname i trying information out of response , keep getting following error: no such file or directory does response_xml need saved file before can parse it? why can't use memory? et.parse() needs file name. might want try et.fromstring() instead.

gruntjs - unexpected identifier error in grunt.js file -

can tell me why getting following error in terminal when running following grunt.js file? module.exports = function(grunt) { grunt.initconfig({ pkg: grunt.file.readjson('package.json'), concat: { // here our concatenating dist: { src: [ 'components/js/*.js' // in src js folder ], dest: 'js/script.js', } } uglify: { build: { src: 'js/script.js', dest: 'js/script.min.js' } } }); //add plugins here grunt.loadnpmtasks('grunt-contrib-concat'); grunt.loadnpmtasks('grunt-contrib-uglify'); //what happens when type 'grunt' in terminal grunt.registertask('default', ['concat', 'uglify']); }; the error is: loading "gruntfile.js" tasks...error syntaxerror: unexpected identifier warning: task "default" not found. use --force continue. thanks! you have missing comma: grunt.initcon...