Posts

android - How do I play an animation through a button that is already set up to play music? (eclipse) -

as said in title, have set button play specific music, want activate animation existing imageview play along (for case, sheet music piece of music) , revert original imageview if button repressed (stopping music) or when song finished. the code activity button here: package net.zachapps.sheetmusicapp; import android.app.activity; import android.media.mediaplayer; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.imageview; public class eldoradoscore extends activity { button btneldorado; imageview imgscore; mediaplayer songeldorado; int playing; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.eldoradoscore); btneldorado = (button)findviewbyid(r.id.btneldorado); btneldorado.setonclicklistener(beldorado); songeldorado = new mediaplayer(); songeldorado ...

javascript - Navigate to next text element with keyboard arrow when at start or end of text -

i having hard time navigating 1 element using keyboard arrow; want navigation occur when cursor @ start or end of text i.e. "move right if @ end of text , move left @ start of text, press left arrow when @ end of text not want navigate, want let default event happen." here's start of want, try1 this function need writing function isendorstartoftext($this) { return true; // @todo calculate here } you want separate 2 checks because can @ end of string , press left, shouldn't focus previous field. in modern browsers can node.selectionstart on node, check on left-key press if selection start 0: if ($this[0].selectionstart === 0) { e.preventdefault(); if ($('#'+previous_id).length > 0) { $('#'+previous_id).focus(); } } for right key, check: if ($this[0].selectionstart === $this.val().length) { e.preventdefault(); if ($('#'+next_id).length > 0) { $('#'+next_id).fo...

text mining - Ranking keywords in a doc -

i have requirement of ranking keywords in document. have 1 document, dont know how tf-idf help. rank keywords based on proximity , relevance document, know if use term vector this, , if yes how? thanks in general, obtain "proximity" between several document using terms or terms using several documents, use latent semantic space --- latent semantic analysis here . however given have 1 document, cannot that, because have no reference. it's trying find how many standard deviations away mean value of interest located, have single number. 1 way solve this, obtain new data, if topics of document isn't obscure try scraping information off internet. if isn't looking for, perhaps may explain problem more desired outcome rather method think may applicable here. cheers

symfony - how to use Gaufrette Stream Wrappers? -

if have defined below stream wrapper in symfony2 config.yml: knp_gaufrette: adapters: my_drive: local: directory: %my_drive_path% create: true filesystems: user_fs: adapter: my_drive alias: my_drive_filesystem stream_wrapper: protocol: data how can use in controller download file ? i have this: $response = new binaryfileresponse("data://user_fs/" . $key); so call file using addres: "data://user_fs/" haw can change dont use it, couse if change name in config have change in controller. , want manage in 1 file (config) you can define path parameter in parameters.yml : parameters: data_protocol: data data_filesystem: user_fs data_path: "%data_protocol%://%data_filesystem%/" and container: $path = $this->get('system_container')->getparameter('data_path') $response = new binaryresponse...

html - How to bind OnClick function to list of images in Javascript -

i using following code crete images programatically (dynamically in loop): function showimage(source, id) { var list = document.getelementbyid("display-list"); //image var cellimage = document.createelement("td"); var objimage = document.createelement("img"); objimage.classlist.add("obj"); cellimage.setattribute("align", "center"); cellimage.setattribute("valign", "bottom"); cellimage.appendchild(objimage); list.appendchild(cellimage); //checkbox var cellcheckbox = document.createelement("td"); var objcheckbox = document.createelement("input"); objcheckbox.id = id; objcheckbox.type = 'checkbox'; cellcheckbox.setattribute("valign", "bottom"); cellcheckbox.appendchild(objcheckbox); list.appendchild(cellcheckbox); objimage.src = source; } now, need bind function on click of each image passing each image id function. how can in jscript? thanks. ...

javascript - Updating array items angularfire -

i using angularfire $add method add basic js objects of form {id:integer,name:name} now, if want update particular item (which has firebase-assigned key "-jeca_f70efhbki5js7j" or something, impression should use $save method. here how trying this: $scope.chosencolors = $firebase(mychosencolorsref); $scope.updatecolor = function(data){ //data js object {id:'id',name:'name'} if($scope.chosencolors.$getindex().length>0){ var keys = $scope.chosencolors.$getindex(); keys.foreach(function(key, i) { if($scope.chosencolors[key].id!=data.id){//if id matches want update name $scope.chosencolors[key] = {id:data.id,name:data.name} $scope.chosencolors.$save[key]; return; } }); }else{ $scope.chosencolors.$add(data); } but doesn't appear have effect on firebase...any ideas doing wrong? firstly, should call $save method in...

c++ - How to 'delete' this linked list from memory? -

i've created class building linked list. class declaration follows: class linkedlist { private: int data; linkedlist *next; static int count; public: linkedlist(void); ~linkedlist(void); int insert(int arg); int remove(int arg); bool find(int arg); }; how can make sure nodes of linked list deleted ? destructor made responsible deleting 1 node. used make linked list never thought clearing memory. the naive implementation ~linkedlist() {delete next;} will right thing - delete call destructor on next element, delete 1 following it, , on, delete whole list. however, means destructors called recursively, deleting long list cause stack overflow. iteration might better: ~linkedlist() { while (linkedlist * head = next) { next = head->next; head->next = nullptr; delete head; } } as noted in comments, might more appropriate have separate list , node classes, list r...