Posts

Showing posts from September, 2013

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

Cannot Insert data from C# into SQL Server -

i want insert data .mdf sql server file, when want see data insert. wasn't happen. use local database work. private sqlconnection connection; private sqlcommand command; private string sql; private void frmnewemp_load(object sender, eventargs e) { string constr = @"server=(localdb)\v11.0;attachdbfilename=|datadirectory|\payrolldatabase.mdf;"; connection = new sqlconnection(constr); if (connection.state == connectionstate.closed) { connection.open(); } } private void insertdata() { sql = @"insert employee(eid, ename, eadd, essid, etel, edatesub, esalary) values(@id, @name, @add, @ssid, @tel, @date, @sal)"; command = new sqlcommand(sql, connection); command.parameters.clear(); command.commandtext = sql; addparamtervalues(); messagebox.show("add complete"); } you not executing command anywhere. (assuming have correctly attached parameters) you need command.executenonquery(); a

c++ - iOS - implicit conversion loses integer precision 'size_t' (aka 'unsigned long') to 'int' -

size_t subsetbytesperrow, subsetheight, subsetwidth, subsetheight; method calling: (new greyscaleluminancesource(subsetdata, subsetbytesperrow, subsetheight, 0, 0, subsetwidth, subsetheight)); method declaration: greyscaleluminancesource(unsigned char* greydata, int datawidth, int dataheight, int left, int top, int width, int height); getting warning 'size_t' (aka 'unsigned long') 'int' . how fix one? just change type declarations int: int subsetbytesperrow, subsetheight, subsetwidth, subsetheight; in event trades off 1 set of warnings another, change type size_t , cast each parameter int in call greyscaleluminancesource .

vert.x - It's possible inlcude worker module in standard verticle? -

using vert.x in java, use worker module ( ebean orm ) in standard module(event loop) declaring "include" in mod.json or better setting ebean module system-module. will block event loop , should use eventbus instead? if module has blocking code (using blocking apis or doing lot of computation), should not use on event-loop. golden rule: never block event-loop. otherwise application won't responsive. even if code in module non-blocking, i'd try use standard module way: can reuse different languages easier , if decide change internal implementation details in future, won't break user-code easy have json interface via event-bus.

bytearray - Efficient way to convert string to ctypes.c_ubyte array in Python -

i have string of 20 bytes, , convert ctypes.c_ubyte array bit field manipulation purposes. import ctypes str_bytes = '01234567890123456789' byte_arr = bytearray(str_bytes) raw_bytes = (ctypes.c_ubyte*20)(*(byte_arr)) is there way avoid deep copy str bytearray sake of cast? alternatively, possible convert string bytearray without deep copy? (with techniques memoryview?) i using python 2.7. performance results: using eryksun , brian larsen 's suggestion, here benchmarks under vbox vm ubuntu 12.04 , python 2.7. method1 uses original post method2 uses ctype from_buffer_copy method3 uses ctype cast/pointer method4 uses numpy results: method1 takes 3.87sec method2 takes 0.42sec method3 takes 1.44sec method4 takes 8.79sec code: import ctypes import time import numpy str_bytes = '01234567890123456789' def method1(): result = '' t0 = time.clock() x in xrange(0,1000000): byte_arr = bytearray(str_byte

objective c - UIScrollView error in iOS -

i new uiscrollview. don't know how add buttons them. in app, need button in horizontal view. when tried create uiscrollview programatically, not working. throwing errors. pls me i tried implement using storyboard too, failed dont how connect them both using viewdidload. this code have used far: - (void)viewdidload { [super viewdidload]; // additional setup after loading view. self.layerposition = self.toplayer.frame.origin.x; uiscrollview *scrollview =[[uiscrollview alloc]initwithframe:cgrectmake(0, 0, 320, 480)]; scrollview.showshorizontalscrollindicator=yes; scrollview.userinteractionenabled=yes; scrollview.scrollenabled=yes; uibutton *button = [uibutton buttonwithtype:uibuttontyperoundedrect]; [button addtarget:self action:@selector(newview:) forcontrolevents:uicontroleventtouchdown]; [button settitle:@"excavations",@"concrete",@"framing",@"insulation" forstate:uicontrolstatenorm

c# - Linq to Xml: error on saving a document twice -

i have following xml: <?xml version="1.0" encoding="utf-16" standalone="yes"?> <property_set_list xmlns="mynamespace"> <property_set symbol_id="config"> </property_set> </property_set_list> i want open it, add property close , edit added property , save again: var xws = new xmlwritersettings { indent = true, indentchars = tab }; using (var reader = readercreator()) using (var output = outputcreator()) using (var xmlwriter = xmlwriter.create(output, xws)) { xdoc = xelement.load(reader, loadoptions.none); namespace = "mynamespace"; // append node appendtonode("config", "", main_lobby_list_ctrl_local_tables_color, 318, 8); xdoc.save(xmlwriter); // edit added node setcolors(); // error here xdoc.save(xmlwriter); } the property added. saved successfully. edited successfully. receive following

axapta - get help text of system command button? -

how can helptext of system command button , use class browse node of form , helptext of controls contained in form, have not use tooltip method cause use formrun object , doesn't work correctly , degrades performance i use program : runnode = treenode::findnode(#formspath); form = runnode.aotfindchild("name of form "); formbuilddesign = form.design(); formgridcontrol = formbuilddesign.control("deletecode"); idx= formgridcontrol.id(); args = new args(); args.object(form); // create run-time form. // formrun = classfactory.formrunclass(args); formrun.init(); formgridcontrol = formrun.control(idx); info(strfmt("helptext: %1",syslabeledit.findlabel("fr",formrun.control(idx).tooltip()))); works first time , after make ax crash thank's in advance your code crashes when call init() method second time. can use treenodetraversercontrols class traverse control nodes of form design. following example demonstrates th

O(n) algorithm to find a “publisher” in a social network -

i asked question how find "publisher" in social network. suppose (simplified) social network has "following" relationship between 2 users , 1 cannot follow himself. define "publisher" user followed other users not follow anyone. more specifically, given such social network graph in format of adjacency matrix, nxn bool matrix, cell[i,j] indicates whether or not user follows user j. how find out publisher. what can see there @ 1 publisher exist.(it's easy prove: since publisher followed else, else follows @ least 1 user, not publisher). come naive solution: first scan column column, if there true column j (except cell[j,j] of course), scan row[j] make sure it's false. obviously, performance o(n^2) naive algorithm cause scan whole matrix. however, told there o(n) solution. kind of stuck @ o(n). hints? if data presented adjacency matrix, can proceed follows. start checking entry (1,2) in matrix. if 1 follows 2 1 not publisher, , if 1

batch file - Running SSH script to Remote Ubuntu vps - Please advise on code -

i attempting run ssh script windows 7 local, run on ubuntu 12.04 vps. using plink. please advise wrong following: i run .bat file on local containing following code: start c:\plink.exe -ssh www.host.com -l usersname -pw password -m c:\script.sh the script .sh file , intention enter simple command text shell , execute. code follows: #!/bin/bash echo text executed echo text executed done i able connect remote script isn't working. appreciated. thanks time. jimy

ios - Add UIImage or UILabel to navigationItems -

in app, have customize navigation bar depending on page i'm on. in views, need add uibutton , uiimage (for logo not centered) or uilabel . i using [self.navigationcontroller.navigationbar addsubview:mylabel] . don't method because if ever have add uibutton or change text of uilabel , need change manually origin of each uilabel , each uiimage . i thought of using exists : uibarbuttonitem . can contain text, image, , need add each of them in navigationitem.leftbarbuttonitems , , every thing nicely positioned. the problem remains, still button, , reacts 1 when pressed. if disable it, it's alpha changes show it's disabled... how keep it's normal apparence, , let disabled ? thanks ! ps: i'm open other idea add uiimages or uilabels in navigation bar :) you can not setting @selector created button, , setting same customized properties both uicontrolstatenormal , uicontrolstateselected. also, set tintcolor clearcolor. that, button still button,

excel - How can I reference a dynamically created control in VBA? -

i've been finding answers need here on stackoverflow months (thank all!) far search terms aren't finding result need time... hence, first post here... i have excel file includes 2 userforms: the first used input invoice data , export data in format can uploaded our proprietary accounting system. the second later used post payment data against invoices , then, similarly, export data in format can uploaded our accounting system. the second form has created dynamically in userform_initialize, because number of payments required (and, thus, number of textbox , label controls created) varies depending on size of invoices. i've finished code create second form , works well, i'd add functionality triggered when of these dynamically created controls changed user. i've done in other forms using given control's _change() procedure (for example, when want move next box after entering dollar amount, use _change() setfocus elsewhere value has 2 digits after

Why does my program not work (reverse function in python help)? -

i've made program had been set homework in computer science. i've found new, unfamiliar function won't seem work expected. i'm new forum. p.s. hobby, i'm not here anwsers def reverse(): s3 = '' char in reversed(s3): s3 = s3 + char def match_char(): global s1 global s2 global s3 s1 = input('what first string? ') s2 = input('what next string? ') reverse(s2) num_matches = 0 in range(len(s1)): if s1[i] == s2[i]: num_matches = num_matches + 1 return num_matches in python, strings immutable. when do: reverse(s2) some things happen inside of reverse , string passed in unchanged. to fix, first want return function: def reverse(my_str): s3 = '' char in reversed(my_str): s3 = s3 + char return s3 and assign on s2 when call reverse : s2 = reverse(s2) there lots of other ways improve code, that's expla

Leftmost outermost Reduction (Haskell) -

i got task use leftmost outermost reduction on following expression: f inc expo 9 (f (*2) expo 3 1) inc defined as: inc :: int -> int inc x = x+1 expo defined as: expo :: int -> int expo x = expo (x*2) and f as: f :: (int->int) -> (int-> int) -> int -> int -> int f g h b = g(a-b) i have absolutely no clue start reduction more functions. read hint redex not contained in other redexes, dont ;(. i appreciate every tip/help. the first (leftmost, outermost) reduction for f inc expo 9 (f (*2) expo 3 1) is apply definition of f , once, f g h b = g(a-b) use g inc , a 9 , b (f (*2) expo 3 1) , giving inc(9 - (f (*2) expo 3 1)) now we're done question asked. that's leftmost, outermost reduction made. notice didn't need use facts other functions, hint getting at.

audio - How to install stagefright on my android? -

i hear sound program supposedly comes android called "stagefright" needed in order play audio files command-line of terminal emulator. 1 source heard of here: how use stagefright command line? problem --- checked pretty on android device (aesus nexus 7) , isn't there. (either there no "stagefright" or it's command-line interface program missing.) how can installed --- , if can't, there else install allow me play audio files terminal-emulator command line? i ask because inability play audio files command-line serious limitation. as android reserves direct audio access permission system processes acting delegates applications through android app-only apis, stagefright executable not add secured device if not placed there system vendor. however, can accomplish need play audio upon request adb command line using intent. here's example - adjust specifics: am start -a android.intent.action.view -d file:///mnt/sdcard/ringtones/hangou

knockout.js - How do I show a Knockout observable value in an editable field without changing the value -

i'm trying create modal window used values user send off server. want prepopulate fields values have, , have them update current values (stored locally) when modal window appears. the issue i'm running when link fields observable directly, user edit fields , if hit 'cancel', values previous screen shows contain updated values. if bind "value: (), string can edited if user open it, edit value, close it, reopen it... edited changes still there. does have advice on how updated information form without having link directly observable? there way refresh these bindings when make call open window? a sample of current form below. <form> ... <div class="control-group"> <label class="control-label" >cellular fault time (in minutes)</label> <div class="controls"> <input type="text" class="input-small" id="gsmfaultecptime" maxlength="2

How to create loop for changing Lable[ID] in asp.net using c#? -

i want create loop changing lable[id]. label1.text = multiarray[rowcount - 1, 1]; label2.text = multiarray[rowcount - 1, 2]; label3.text = multiarray[rowcount - 1, 3]; please give me code solve problem. for(int index = 1; index <= 3; index ++) { label label = (label)this.controls.find("label" + index, false)[0]; label.text = multiarray[rowcount - 1, index]; }

mysql - Add many-to-many select into existing query -

i have query set return comments given 1 user another. now want allow ability rate these comments. i've added new table has 3 fields: comment_id, user_id, , score. how can grab array of {user_id,score} comment fetched? will need loop through comments after fetched , run second query? approach result in adding several queries. can done single query? here's function have now: function getallcomments($args) { if(empty($_session['user']['id'])) return false; $limit = 5; if(isset($args['limit'])) $limit = $args['limit']; $page = 1; if(isset($args['page'])) $page = $args['page']; $data = array(); $offset = ($page-1)*$limit; $sql = "select c.*,concat(u1.firstname,' ',u1.lastname) owner,u1.title ownertitle,concat_ws(' ',u2.firstname,u2.lastname) sendername,u2.title sendertitle,a.name actionname,a.behavior comment c join user u1 on c.recipient = u1.id join user u2 on c.s

How Get some specific value from Rails string? -

i want specific value string of rails below these 2 string. 1. "http://localhost:3000/admin/shops/assign_shoes?id=50&page=1" 2. "http://localhost:3000/admin/shops/assign_shoes?id=50" i need value of "id" "50". don't matter how many parameters in string as query string. actually these strings values of request.referer any efficient method? thanks there several different ways this, common way know parsing string using uri class , , making use of cgi class extract query params, so: uri = uri.parse(request.referer) parsed_query = cgi::parse(uri.query).symbolize_keys id_value = parsed_query[:id].first note .first , values of query params resolved arrays. additionally, keys parsed in strings, therefore include symbolize_keys convenience , consistency.

retain - Retaining variable value in a dataframe in r -

i have dataframe in r id subgroup first.id var 103 17 true abc 103 17 false xyz 103 17 false def 103 17 false pqr 106 16 true abc 106 16 false pqr first.id created identify first element in group(id). want create new variable should retain value in group. here, group use id variable. new dataframe should this id subgroup first.id var condition 103 17 true abc abc 103 17 false xyz abc or xyz 103 17 false def abc or xyz or def 103 17 false pqr abc or xyz or def or pqr 106 16 true abc abc 106 16 false pqr abc or pqr df <- read.table(text="id subgroup first.id var 103 17 true abc 103 17 false xyz 103 17 false def 103 17 false pqr 106 16 true abc 106 16 false pqr", header=true) library(plyr) cumpaste <- function(x, sep) { sapply(seq_along(x), function(y,z,sep) paste(z[1:y], collapse=sep), z=x

php - How to display values to modal from jquery-ajax? -

i'm using bootstrap modal , i'm stuck displaying values modal. here html when user click view <a data-toggle="modal" data-id="<?php echo $row33['bicycle_id']; ?>" href="#mymodal" class="buto" >view</a> then used jquery-ajax pass value of data-id execute query in php $(document).on("click",".buto", function () { var dataid = $(this).data('id'); $.ajax({ url: 'getid.php?id=' + dataid, type:'get', datatype: 'json', context: this, success: function(values) { values = $.parsejson(values); $('.table-responsive #pname').html(values.name); $('.table-responsive #pprice').html(values.price); $('.table-responsive #pdescription').html(values.description); } }); }); here getid.php file <?php inclu

ios - APNS notification not waking app in background -

i have app registers woken in background when apns notification received (i.e., remote-notification setting uibackgroundmodes ). in vast majority of cases works fine. apns notification comes in, app woken , call app delegate's application:didreceiveremotenotification:fetchcompletionhandler: made. in cases apns received user app never gets woken up. seems happen when device has been inactive while (overnight, left behind weekend, etc). once user launches app normal , subsequent apns notifications again trigger background wake-up. does have idea trigger this?

mysql - How to select max value for each id in sql select statement? -

consider these 2 tables. first table stagetable stageid-----stagename 1-----------start 2-----------planning 3-----------working 4-----------review 5-----------closing second table stageproject stageid-------projectid 1-------------1 2-------------1 3-------------1 4-------------1 1-------------2 2-------------2 3-------------2 4-------------2 5-------------2 1-------------3 2-------------3 3-------------3 what want each projectid, want max stageid value so want end with: 1-4 2-5 3-3 and assign stagename stage table final result be projectid-----max-----stagename 1 4 review 2 5 closing 3 3 working i've tried with select a.projectid, max(a.stageid), b.stagename stageproject a, stagetable b a.stageid=b.stageid group a.projectid but not work i end correct stageid , max stagename same can me out ! try this: select a.projecti

ios - Posting JSON data using AFNetworking 2.0 -

i have web script accepts json string input through http post request. have came across several afnetworking 1.x example same , can please point me or give afnetworking 2.0 example http post request web script formatted json input ? thanks after searching docs , trying out codes got following example afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; manager.requestserializer = [afjsonrequestserializer serializer]; nsdictionary *params = @ {@"user" :txtusername, @"pwd" :txtpwd }; [manager post:url_signin parameters:params success:^(afhttprequestoperation *operation, id responseobject) { nslog(@"json: %@", responseobject); } failure: ^(afhttprequestoperation *operation, nserror *error) { nslog(@"error: %@", error); }]; also don't forget set response header type in server script application/json.

php - Saving CSS changes on REMOTE HOST using development tools? -

there bunch of possibilities save css , html changes made using chrome devtools (eg. tincr) or using firebug on local host. questions have been asked long ago* this, there might updates since. is there way upload changes made instance using chrome devtools website hosted on remote server? (like filezila on ftp) would possible (and safe) save these changes via php script provide ftp , db login ; script work 1 or development tools? *: 2008 : why can't save css changes in firebug? 2011 : how save css changes of styles panel of chrome developer tools? most of these extensions experimental , not have large developer base. translates buggy , pretty unreliable. , there reason - browser not know language/technology/platform spits out html/css renders. if using dynamic language generate html, saving edited css/html using browser tools pretty useless, because still have go code files/data source , make corresponding edits. if browser developers thought there real

scala - Play! 2.2 Subproject Split Routing -

i'm working on splitting scala/play! 2.2 project modules. route splitting failing compile, actual source code seem compile. here's code think relevant problem: /build.sbt : import play.project._ name := "edshare_play" common.settings playscalasettings librarydependencies ++= common.librarydependencies routesimport += "_root_.utils.binders._" resolvers ++= common.resolvers scalacoptions ++= common.scalacoptions keys.fork in test := false lazy val root = project.in(file(".")) .aggregate(core, edmoderator) lazy val edmoderator = project.in(file("modules/edmoderator")) .dependson(core) lazy val core = project.in(file("modules/core")) /conf/routes : # moderation api -> /api/edmoderation edmoderator.routes # core api -> /api core.routes /modules/edmoderator/conf/edmoderator.routes : get /:entity

java - Hibernate not running after I change user -

org.springframework.beans.factory.beancreationexception: error creating bean name 'performancedao' defined in class path resource [dao-bean.xml]: invocation of init method failed; nested exception org.hibernate.exception.genericjdbcexception: cannot open connection @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1412) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:519) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:456) @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:291) @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:222) @ org.springframework.beans.facto

javascript - Canvas presents problems when resizing the screen -

i have design , works perfectly: http://jsfiddle.net/98bgq/22/ var offsetx = canvasoffset.left; var offsety = canvasoffset.top; var scrollx = $canvas.scrollleft(); var scrolly = $canvas.scrolltop(); but when resize screen of browser, seems canvas begins operate in totally different way normal, in above example can not click few more parts of design, how can solve this? since you're using jquery, easiest use event.pagex . e.g. mousex = e.pagex - $canvas.offset().left; mousey = e.pagey - $canvas.offset().top; edit: non-jquery, works well: mousex = e.hasownproperty('offsetx') ? e.offsetx : e.layerx; mousey = e.hasownproperty('offsety') ? e.offsety : e.layery; event.pagey/x returns mouse position relative top/left edge of document. $elmnt.offset() returns coordinates of element relative document. subtracting latter former gives relative position of mouse in canvas. event.offsety/x / event.layery/x give coordinate of event relative current l

shell - Postgress.app: Searching through history -

say type multiple commands: select table select foo bar ... how can search through command history type command/query? e.g. if start typing: select and press c-r , can have psql search , autocomplete command entries start with select some ? (i.e. select foo bar skipped) note asking searches fix characters typed far.

mysql - Looking for help on joining query -

im taking first programming (sql) class. i've got no tech background whatsoever , i'm having little trouble getting code down. here database looks like. book book_code (unique) booktitle publisher_code booktype price inventory book_code (unique) branch_num (unique) on_hand the question is, list books (titles) available in branches 3 , 4 (on both @ same time). im thinking need use following tables: booktitle on book table , bookcode on both tables ( book , inventory), , branch_num on inventory table. also answer can show book titles available on branches 3 , 4 (at same time) , no other columns. sorry if im making no sense. said im n00b. select booktitle book book_code in (select book_code inventory branch_num = 3 , on_hand > 0) , book_code in (select book_code inventory branch_num = 4 , on_hand > 0); or select booktitle ( select book.book_code, booktitle, count(*) branch_count book inner join inventory on book.book

node.js - bus error:10 on grunt contrib-watch when updating scss files -

grunt watch runs , updates js updates, not scss. have wait minute changes picked up. running node v0.10.18 running "watch" task waiting...ok file "app/styles/styles.scss" changed. bus error: 10` upgrade version of node.js >= 0.10.21 . there node bug on watch within previous versions. see: https://github.com/gruntjs/grunt-contrib-watch/issues/204

javascript - remove all links from within div -

i've embedded custom ggl map within container div using javascript (not google iframe), , div display map within first/original container div. need deactivate links within either div links in embedded map not clickable. i've tried following jquery solution doesn't seem work: <script> $("#map_canvas a").click(function(e) { e.preventdefault(); }); </script> then i've tried following css solution blocks user's ability pan map. pointer-events: none; how can enable user interactivity map while preventing anchor links working within embedded map? thanks! i guess first problem links created dynamically. so, when call $("#map_canvas a") , there no a elements bind to. might try delegated syntax of bind() . assuming #map_canvas exists when script called (and recommend putting code in ready block): $( function() { $('#map_canvas').on('click', 'a', function() { // return fa

webmethods - Error in compiling Java WebService in WEBSERVICES? -

Image
i trying compile , test java services in webmethods. had reload method , tells me there error in code. not sure error on how find error because there no red rectangle on right side , there no error highlighted ont screen. question: causing error in webmethods services? class: import com.wm.data.*; import com.wm.util.values; import com.wm.app.b2b.server.service; import com.wm.app.b2b.server.serviceexception; import java.io.bufferedreader; import java.io.bufferedwriter; import java.io.filereader; import java.io.filewriter; import java.*; import java.io.printwriter; import java.util.arraylist; import java.util.regex.matcher; import java.util.regex.pattern; public final class createlistandwritefiles_svc { /** * primary method java service * * @param pipeline * idata pipeline * @throws serviceexception */ public static final void createlistandwritefiles(idata pipeline) throws serviceexception { try {

Android Bluetooth LE Chat example -

i trying read serial data on bluetooth le can't find code examples type of bluetooth , api19. 1 have example? there no profile defined serial data communication on bluetooth low energy till now. 1 can use bluetooth classic only. in case, android devices can not broadcast advertising packets. can scan advertising packets. hence, these devices in central mode only. can act either server or client. for bluetooth chat related app example 1 can refer android sdk as, sdk/samples/android-19/legacy/bluetoothchat the above example based on bluetooth classic based on rfcomm channel serial communication.

sql - Adding argument to SELECT statement with UNION changes record number -

when add new argument select clause of union , more records... how can be? isn't union mashing them together? example: edit: they're absolutely distinct. code column either "in" or "out", , that's i'm using separate two. edit2: union gives me 80 records, should, it's odd because 2 select statements absolutely distinct. final edit: ultimate problem records within 1 of select statements being not distinct, not between 2 select statements. all. -- yields 76 records select f.date , f.code , f.cost a.fact f f.code = 'in' union select f2.date , f2.code , f2.cost a.fact2 f2 f2.code = 'out' ; -- yields 80 records select f.key , f.date , f.code , f.cost a.fact f f.code = 'in' union select f2.key , f2.date , f2.code , f2.cost a.fact2 f2 f2.code = 'out' ; by default union selects distinct results, there must

java - Checking User's role in Google appengine -

need check if logged in user developer, owner or viewer in google appengine in java. this page explains putting constraint such user have administrator did not find java api whcih can give me role . the userservice has isuseradmin() method gives information.

Selenium (Python) - Changing Proxy During Runitime? -

i managed use proxy server selenium chrome using code below: chromedriver = "c:/seltests/chromedriver" os.environ["webdriver.chrome.driver"] = chromedriver chrome_options = webdriver.chromeoptions() chrome_options.add_argument('--proxy-server=141.0.175.141:443') driver = webdriver.chrome(chrome_options=chrome_options) however, know if possible change proxy new 1 during run-time. or if there other way of doing allows me to. i'm thinking using code above have have browser close re-open start new session , use proxy? please :) you have re-launch browser instance in order achieve this. wherever want change proxy insert following code: driver.quit() chrome_options = webdriver.chromeoptions() chrome_options.add_argument('--proxy-server=<new proxy>') driver = webdriver.chrome(chrome_options=chrome_options) this close current browser , launch new 1 new proxy.

cassandra - Cqlsh with client to node SSL encryption -

am trying enable client node ssl encryption in dse server. my cqlshrc file looks below [connection] hostname = 127.0.0.1 port = 9160 factory = cqlshlib.ssl.ssl_transport_factory [ssl] certfile = /path/to/dse_node0.cer validate = true ;; optional, true default. [certfiles] ;; optional section, overrides default certfile in [ssl] section. 1.2.3.4 = /path/to/dse_node0.cer when tried login cqlsh shell getting below error connection error: not connect 127.0.0.1:9160 there several possible causes hope 1 of these solutions helpful. 1) certificate in ssl section not same (derived from) keystore specified in cassandra.yaml file. solution: generate certificate keystore used in cassandra.yaml file , place in location pointed in cqlshrc file. 2) certificate file or keystore changed after starting node. cassandra loads copy of certificate when starts up. solution: restart node. 3) in certfiles section 127.0.0.1 over-ridden wrong certificate solution: use

c++ - Ruby require fails with Not enough space[loadquery failed] -

i managed compile ruby 2.0.0 on aix in 64 bit mode , trying swig wrapper around c++ class work. after compiling ruby, make test comes clean , indeed ruby seems running fine. next step compile extension. pointing new ruby install created extconf.rb following: require 'mkmf' create_makefile('wv') wv being name of module. ran make make install which ran clean. when run ruby -e "require 'wv'" i following traceback. /blah/blah/ruby/aix/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in `require': load failed - /blah/blah/ruby/aix/lib/ruby/site_ruby/2.0.0/powerpc-aix6.1.0.0/wv.so. not enough space[loadquery failed] (loaderror) btw, when used same swig generated cxx file , followed same procedure on linux , works fine. any idea's on begin figure out broken? when require fails reason other "no such file", need dig deeper. in case issue not related space @ all. in case issue not space fact , while

ios - When dismissing keyboard how do I keep my existing text fields in the same location? -

Image
so have uiscrollview contains uitextfields , uilabels, , when user clicks inside uitextfield keyboard shows. need way allow user dismiss keyboard , try use swipe down gesture (as in messages). added gesture recognizer view in storyboard , added action header file. here method: - (ibaction)swipekeyboarddown:(id)sender { if(self.movetextfield) { [self.movetextfield resignfirstresponder]; } } i have if there testing when user has clicked on first text field, , when try swipe down of text field , labels move bottom of screen. there need keep text fields , labels in place? using auto layout , created them in storyboard. this how view looks before swiping keyboard down: and how looks after swiping down: thanks help, , if more info needed please ask , can provide more. backtrace: 2014-02-02 01:28:33.453 bjjdrillingapppro[512:70b] ( 0 bjjdrillingapppro 0x0001de82 -[addmoveviewcontrollerpro observevalueforkeypath:ofobject:cha

Facebook php sdk photo upload success but page album does not show image -

i trying upload page album photos using facebook php sdk. seems work there no error response. cant see picture inside page album? can me clarify how upload album? config file : return array( 'appid' => 'foo', 'secret' => 'bar', 'fileupload' => true, 'allowsignedrequest' => true // optional should set false non-canvas apps ); and code while try send file : $facebook = new facebook(config::get('facebook')); #the id of fanpage $fanpage = '1404264166489378'; #the id of album $message = 'fotoğraf başarı ile yüklendi'; $album_id = "1404677233114738"; $facebook->api($album_id.'/photos','post',[ 'photo' => new curlfile($path.$filename,'image/jpeg'), 'message' => $message ]

vba - SQL Select statement in a Class module need table field in If Statement -

i building class module ms access 2007 vba sql statement sendsave down file , send 2 different e-mails out. keep getting variable not defined field mwstatus in status_tbl. blind code , need help. had sql statement in module behind form , worked, slowing down form, moving sql statement. question is, why field mwstatus in status_tbl giving me error "variable not defined". first time putting sql statement in vba module , don't know if did right public sub sendconfirm() on error goto err_sendconfirm_click dim borrower string, loemail string, procemail string, clsemail string, caution string, lnumber long, thefile string, thename string 'sql statement processor , closer email dim strsql string dim strcmcid string strcmcid = me!cmcid_txt.value strsql = "select commitments_tbl.cmcid, status_tbl.mwstatus, dbusers_tbl.email, dbusers_tbl_1.email " & _ "from ((commitments_tbl left join status_tbl on commitments_tbl.loannumber = status_tbl.loannumber) l

plsql - insert bulk data in oracle with validations -

i want insert bulk data emp table test table in single insert , if 1 column @ least violate constraint i want prevent user insert , return error messgaes . please? create table test ( c1 nvarchar(50) not null, c2 number, c3 date); insert test(c1,c2,c3) select (v1,v2,v3)from emp ; thanks if have bulk data insert sql loader better route go.. if end users should using stored procedure, package, or function.. haven't given detail of insert code going run..oracle through exception if have constraint in place..

java - Define filters order -

i'm trying code filters text processor. receive socket files have process line line. each line need apply filters , in specific order. example, 1 file i'll use filter 1, filter 2, filter 3 , after filter 2 again. my question best way run filters in specific order , how define them can add more filters without have change lot of code? best way ensure high speed executing filters line line? i use chain of responsibility. assume filter says either true (include/accept line), or false (do not include i.e. reject line). so chain several filters in chain, if filter 1 returns true , pass line next filter 2 (and on). otherwise (if filter chain says false ), reject line and don't go checking next filter chain. chain of responsibility pattern what best way ensure high speed executing filters line line? this depends on many factors so hard give response on it.

assembly - NASM - different behaviour depending on register -

i have string taken user, saved "variable" named num . now, load first character string register further processing. looked like mov rax, [num] cmp rax, '5' je character_equal_five i got problems in later part started debugging 1 line , input "522314" figured out rax register's value 2000, while should five's ascii code. doing xor rax, rax mov rax, [num] did not either. finaly done this mov al, [num] and successful reliable results. question is: why happen? why can't use bigger register task?

eclipse - Pass List array as params to Android AsynTask -

i have small huge problem in android app, i'm trying pass array list asynctask post data external api. eclipse allways returning data type error , cannot figure how pass params activity asynctask. please help public void login(view view){ string usern = username.gettext().tostring(); string pwd = password.gettext().tostring(); list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(); namevaluepairs.add(new basicnamevaluepair("username", usern)); namevaluepairs.add(new basicnamevaluepair("password", pwd)); namevaluepairs.add(new basicnamevaluepair("external-login", "true")); if(isnetworkavailable()){ getaxiomacredentials axiomacredentials = new getaxiomacredentials(); axiomacredentials.execute(); }else{ toast.maketext(this, "network not available.", toast.length_long).show(); } } so there can pass namevaluepairs execute para

Can a second parameter be passed to Controller constructors? -

castle windsor passes registered concrete type controller's constructors. typical implementation (no pun intended) is: private readonly idepartmentrepository _deptsrepository; public departmentscontroller(idepartmentrepository deptsrepository) { if (deptsrepository == null) { throw new argumentnullexception("deptsrepository"); } _deptsrepository = deptsrepository; } i need pass ctor second parameter, if possible, can pass val on repository constructor (i know: tramp data alert, don't know if there's straightforward way around it: public departmentscontroller(idepartmentrepository deptsrepository, int dbinstance) { if (deptsrepository == null) { throw new argumentnullexception("deptsrepository"); } _deptsrepository = deptsrepository(dbinstance); } repository public departmentrepository(int dbinst) { string connstr = string.format("phoo{0}bar", dbinst); using (var conn = new o