Posts

Showing posts from May, 2010

android - TextChange listener usage with single TextView -

i using addtextchangedlistener waits user input textview part of simple quiz app. i using single activity of questions - updating ui whenever user proceeds next question. problem having listener picking events of questions due same textview being used. know methods of making listener listen events text view on current question? //listener added in oncreate() textviewletter = (textview) findviewbyid(r.id.textview6); textviewletter.addtextchangedlistener(new textwatcher() { @override public void ontextchanged(charsequence s, int start, int before, int count) { } @override public void beforetextchanged(charsequence s, int start, int count, int after) { } @override public void aftertextchanged(editable s) { toast t = toast.maketext(introduction.this, "changed" toast.length_short); t.show(); } }); //methods ui updated - lessonno

windows - Deploying java application using capistrano -

i trying java application deployed on tomcat server (in windows), getting following error. please me guideline on following connection error. have admin privilege , server running in local. c:\builds>cap local deploy dl deprecated, please use fiddle * 2013-04-01 14:19:06 executing `local' * 2013-04-01 14:19:06 executing `deploy' * 2013-04-01 14:19:06 executing `deploy:update' ** transaction: start * 2013-04-01 14:19:06 executing `deploy:update_code' * executing "xcopy c:/_savita/app/my-app \"c:/builds/releases/20 130401084906\" /s/i/y/q/e && (echo > c:/builds/releases/20130401084906/revision )" servers: ["localhost"] *** [deploy:update_code] rolling * executing "rm -rf c:/builds/releases/20130401084906; true" servers: ["localhost"] ** [deploy:update_code] exception while rolling back: capistrano::connectionerr or, connection failed for: localhost (errno::econnrefused: no connect

scala - Method to return values after predicate is satisfied -

to match condition use : val c = "this test".split(" ").tolist//> c : list[string] = list(this, is, a, test) c.takewhile({x => !x.equals("is")}) //> res0: list[string] = list(this) is there method similar takewhile except takes after predicate satisifed ? c.takeafter({x => x.equals("is")}) returns list("a" , "test"); you use dropwhile : scala> c.dropwhile(_ != "is") res4: list[string] = list(is, a, test) this drop elements until hits predicate, note predicated string included need check if list empty , if not take tail.

android - Why is GridView null on 2nd pass through onPostExecute() -

for fun i'm going through udacity popular movies app tutorial. have set there spinner in toolbar calls sortmovies(string sortby) method in mainactivityfragment. sortmovies() calls getmoviestask.execute(sortby). when run program, works out fine. displays gridview of movie posters sorted popularity have called in oncreateview() of mainactivityfragment. however, when click spinner , choose sort "highest rated" executes getmoviestask.execute (i checked json being returned), when gets time set gridview adapter, saying gridview null. here mainactivity: public class mainactivity extends appcompatactivity { final string sort_popularity = "popularity.desc"; final string sort_highest_rated = "vote_average.desc"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); spinner spinner = (spinner) findviewbyid(r.id.spinner_sort_by); arrayadapter spin

Curl works, JSOUP returns HTTP Error 500 -

i'm trying web scrape java, , plan throw code android, @ moment i'm trying jsoup. using chrome's devtools, pulled request headers , curl command return data webpage. can run following command in curl , works: curl 'mysite/campaign/list' -h 'cookie: __requestverificationtoken_l0n5yxjhv2viug9ydgfs0=iecny-sonb09iy9mqmm3xl1bsbase8eha9j1fwupurhtmlldojgqpaljhziuhffh6zrnoygjsrkyuhj2krwissnxif76grnh_39lgvymj0i1; asp.net_sessionid=gojtobwzycl0lvs0ip4glf3n; mycompany.web.portal.auth=40c13baf08884380f805b99e217754f3d35920ce1861debb580dc143da4249c4682c33a36dd29272a3a844880110e4d0ec1f24298e4d1b2a4a94e3fa2cac08b934989acf155616d6cb5665338ff3cff82ead87bf93eb46fa3ba6aae6b00401f9' -h 'origin: mysite' -h 'accept-encoding: gzip, deflate' -h 'accept-language: en-us,en;q=0.8' -h 'user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/48.0.2564.97 safari/537.36' -h 'content-type: application/json;charset=u

javascript - Update id after collection.create in Backbone.js -

on collection, using create function save new instance of model server. post request successful , return new model. {id:135, type:tweet, start:08:00:00, end:14:00:00, text:foo, date:2013-04-01} however, need update collection new model.id has been returned server , appears sync method in create not this. should add callback create function update model it's changed attributes? var addscheduleblock = backbone.view.extend({ savescheduleblock: function (ev){ var text = "foo" this.model.set({ text: text }); var block = blockcollection.create(this.model, { silent: true, wait: true }); }); backbone's collection create method calls model save method underneath ( code reference ). don't need set id yourself, backbone you. the model save method sets response attributes model ( code reference ) if create not doing job, should try debugging it.

c++ - How to install GDI+ SDK -

i downloaded gdi+ sdk following link: https://www.microsoft.com/en-us/download/confirmation.aspx?id=18909 i have it, extracts 2 folders, 1 of contains no code @ all, eula. i not sure call files given here. assumed library, , should #included. however, c++ seems lot less straight forward importing things(java seemed lot clearer me on how use external code). again, maybe haven't found essential tutorial yet. either way, @ loss on how incorporate gdi+ code. following site ( https://msdn.microsoft.com/en-us/library/system.drawing.image(v=vs.110).aspx ) says plainly system.drawing namespace, knowledge in gdi+. have following code: #include "c:\gdi+\asms\10\msft\windows\gdiplus\gdiplus.dll" #include <stdafx.h> #include <windows.h> #include <objidl.h> #include <gdiplus.h> when trying code following: using namespace system.drawing; i error: must namespace name. how should install sdk files can use them in projects? clearly, not doing ri

ios - Scale up UITextView's layer with it's contents without losing quality -

so, want scale uitextview 's layer text inside , save image without losing quality. how can achieve that? in advance! maybe should scale font property of uitextview (actually size of font )?

iphone - break iteration of photos ALAssetsLibrary -

how break through enumeration going on alassetslibrary enumerateassets method boolean set. can out of loop? code: [self.library enumerategroupswithtypes:alassetsgroupsavedphotos usingblock:^(alassetsgroup *group, bool *stop) { @try { if(group != nil) { @autoreleasepool { int newnumberofphotos = [group numberofassets]; if (self.numberofphotosinsavedphotos < newnumberofphotos) { //only new photos nsrange range = nsmakerange(self.numberofphotosinsavedphotos, newnumberofphotos-self.numberofphotosinsavedphotos); nsindexset *indexset = [nsindexset indexsetwithindexesinrange:range]; [group enumerateassetsatindexes:indexset options:0 usingblock:^(alasset *result, nsuinteger index, bool *stop) { @autoreleasepool { if(somecondition) { //get out of enumeration block (

data modeling in cassandra for CDR data -

i trying design data model in cassandra cdr (call detail records) data such store , keep adding call details in same row of same mobile number or set of columns added dynamically each call same mobile number. can support queries like, mobile no. called maximum times between 2 given date or given time(e.g., between 9am 7pm)? your suggestions are highly appreciable. in advance. when comes designing cassandra data models, first thing need list of queries need satisfied. important consider amount of incoming cdr data (so can shard data appropriately) , how each query run (so high frequency queries matched against fast read performance). due non-relational nature of cassandra, , limited querying capabilities of cql (compared traditional rds), database design largely determined queries need run. based on examples, need multiple column families satisfy kinds of queries. as starting point, in terms of storing raw cdrs, have single 'wide row' column family row ke

ruby on rails - Server log issue in terminal -

i find these issue each , every stylesheets , hence unable find things in teminal log. how can solve this? actioncontroller::routingerror (no route matches [get] "/assets/calendar_date_select/calendar_date_select.js"): actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app' railties (3.2.3) lib/rails/rack/logger.rb:16:in `call' actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call' rack (1.4.1) lib/rack/methodoverride.rb:21:in `call' rack (1.4.1) lib/rack/runtime.rb:17:in `call' activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call' rack (1.4.1) lib/rack/lock.rb:15:in `call' actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call' railties (3.2.3) lib/rails/engine.rb:479:in

I/O exception in post JSON android -

i sending post request using http client ... m getting i/o exception... can any1 plz me... struggling code ... public jsonobject makehttprequest(string url, string method, list params) { // making http request try { stringbuilder url= new stringbuilder(url); // check request method if(method == "post"){ // request method post // defaulthttpclient system.out.println("i m in post method"); defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url.tostring()); httppost.setentity(new urlencodedformentity(params)); httppost.setheader("accept", "application/json"); httppost.setheader("content-type", "application/json"); httpresponse httpresponse = httpclient.execute(httppost); int status=httpresponse.getstatusline().getstatusc

iphone - UIBarButtonItem width with a two-line label -

i know how can rid of spaces left , right two-line label in uibarbuttonitem, has view set setcustomview follows: uibutton* forwardbutton = [uibutton buttonwithtype:101]; [forwardbutton settransform:cgaffinetransformmakescale(-1.0, 1.0)]; [forwardbutton.titlelabel settransform:cgaffinetransformmakescale(-1.0, 1.0)]; [forwardbutton settitle:@"now\nplaying" forstate:uicontrolstatenormal]; [forwardbutton addtarget:self action:@selector(openplayer) forcontrolevents:uicontroleventtouchupinside]; [forwardbutton.titlelabel setnumberoflines:2]; [forwardbutton.titlelabel setlinebreakmode:nslinebreakbywordwrapping]; [forwardbutton.titlelabel settextalignment:nstextalignmentcenter]; [forwardbutton.titlelabel setfont:[uifont boldsystemfontofsize:10]]; [navbutton setcustomview:forwardbutton]; here result get. the width of button if label had text written in 1 line this . you try changing bounds button. uibutton* forwardbutton = [uibutton buttonwithtype:101]; [forw

AngularJS - Watch array and update object -

i'm trying figure out how watch array , update object, this. var vm = this; //controller vm.order = { totalvalue: 25, products: [{id:0, val: 10, qtd: 1}, {id:1, val: 15, qtd: 1}] }; if push new product order object, how update totalvalue watching collection ? (totalvalue = val * qtd) it necessary because "qtd" field bind input field, can change value of "products" @ time. update $scope.$watchcollection( function() { return self.order.products; }, function(products) { self.order.totalvalue = products.reduce(function (p, n) { console.log(n.qtd); console.log(n.val); return p + n.qtd * n.val; }, 0); }); the code worked, when push new "product" order. have watch every order.products.product.qtd , change order.totalvalue every time user change qtd of product try way: $scope.$watch('order.produ

c# - Returning three IQueryable lists in a single ActionResult to show in a view -

i'm new asp.net, mvc, c# , programming in general, have been doing personal projects , various tutorials learn. i've hit problem not sure way turn solution or if indeed have gone down right road. code below best explains trying do. know viewmodel isn't right, think shows trying do. (alltransactions , vars various days have been snipped brevity). var yesterdaystransactions = alltransactions.where(t => t.whenithappensid == yesterday); var todaystransactions = alltransactions.where(t => t.whenithappensid == today); var tomorrowstransactions = alltransactions.where(t => t.whenithappensid == tomorrow); var viewmodel = yesterdaystransactions.tolist() + todaystransactions.tolist() + tomorrowstransactions.tolist(); the intention show at-a-glance screen has list of yesterday's transactions @ top, today's in middle, , tomorrow's @ bottom. i tried @html.partial @ first, of course showed me same list 3 times. tried if statements in view didn't feel

perl - How to Verify a Page is loaded Succesully -

hi have 1 url open page in xml format. there no style information page when trying use asserttextpresent(); for verification of text on page showing error couldn't access document.body. html page loaded? is there other way verify page loaded. i using perl language selenium rc. using open function launching page. this not perl question. checking whether page loaded or not client side concern , can use javascript tackle this. ajax, on xmlhttprequest object, check status code of 4 , response code of 200, pretty done.

Error bars on log scale using errorbarxy in matlab -

Image
in matlab using errorbarxy plot x , y error bars. however, log scale on both x , y axes, error bars not right - i.e. error bar 'heads' different sizes. how can fix this? x = 10 * rand(7,1); y = 10 * rand(7,1); ux = rand(7,1); uy = rand(7,1); lx = rand(7,1); ly = rand(7,1); errorbarxy(x,y,ux,uy,lx,ly,'color','k','linestyle','none','marker','o','markerfacecolor','w','markersize',11); set(gca,'yscale','log'); set(gca,'xscale','log'); print -r600 -dtiff myplot.tif i suppose can use ploterr instead. from documentation: following features supported: linear/ logarithmic scaling x and/or y error bars relative/absolute errors width of bar handles adjustable

jQuery is to be used with Web Forms or HTML Forms? -

i studying asp.net , jquery, , found there several approaches creating forms in html. being windows developer, find common methods following: html forms asp.net webforms asp.net mvc jquery ajax now, understand little bit more differences. see html forms basic, can integrated jquery, asp.net webforms can integrated jquery. a) can consider ajax useless simple webform (post-get of json) if use jquery? b) can consider mvc simple webform? c) 1 choose, , why? thanks help, have read many websites i'm super confused! edit-- more details: have backend provides jsons through rest calls, , need make pages (frontend) show result of calls (example: choose date in calendar, tell me if appointment available). server logic there, trying approach best way keeping sharp, cool , clean (and looking if possible!) when right down it, there 2 ways create form , both use client side code. html javascript in cases, using straight html better bet. (see progressi

file_get_contents() failing. PHP -

the following 2 lines of code work. save data here , here down successfully. can see files on server. file_put_contents("vix.json", fopen("https://www.quandl.com/api/v3/datasets/yahoo/index_vix.json?api_key=example", 'r')); file_put_contents("aaa.json", fopen("https://www.quandl.com/api/v3/datasets/moody/daaayld.json?api_key=example", 'r')); i can pull data first file using this: $v = file_get_contents("vix.json"); but following stopping php script: $a = file_get_contents("aaa.json"); i comment out above line , script runs, include , fails. error: php parse error: syntax error, unexpected '$a' (t_variable) work in progress. googling error. de-bug pointers/suggestions appreciated. it's tiny little issues face hardest ones. future reference while developing, have error reporting turned on can pick errors this. ini_set('display_errors', 1); error_reporting(-1

c# - Join Dictionary<int, string> and List<MyClass> error (type arguments for method cannot be inferred from the usage) -

i´m trying join dictionary<int, string> , list<myclass> throws error "type arguments method cannot inferred usage". but seems me arguments defined... class row { public string name { get; set; } public string[] data { get; set; } } dictionary<int, string> devices = new dictionary<int,string>(); list<row> rows = new list<row>(); rows = rows.join(devices, row => row.data[0], device => device.key, (row, device) => { row.data[1] = device.value; return row; }).tolist(); row row , device pair<int,string> , device.key int , , device.value k. problem? know must silly thing, i´m stuck error. row.data[0] string, device.key integer, key types don't match.

c# - How to sort a list by a specific property in .NET 2.0? -

this question has answer here: how sort list<t> property in object 19 answers in .net 4.0 can use linq sort list specific property: list<point> list = ...; sorted = list.orderby(p => p.x).tolist(); // sort list of points x can similar when cannot use .net 4.0 linq syntax? is there one-liner sort syntax? check sort method, takes comparison<t> . avaliable .net 2.0 var list = new list<point>{ /* populate list */ }; list.sort(comparison); public int comparison (point a, point b) { //do logic comparison , b return -1; }

javascript - Varying pixel color value for same -

i trying create interactive map in webgl . each counrty in map image filled unique color. when user clicks on image, read pixeldata iof point clicked using readpixels() , depending on color of pixel intend highlight counrty. clicking on same country returns different color everytime leading incorrect info country clicked. how eliminate error in finding exact color of point on image, user clicked? shadowing effects or lighting positions causing problem? or there different approach identify user clicked on image , country corresponds to? var texture = three.imageutils.loadtexture('map_indexed.png'); var material = new three.meshlambertmaterial({map: texture}); var sphere = new three.mesh(new three.spheregeometry(globeradius, globeradius, globeradius),material); sphere.overdraw = true; scene.add(sphere); reading pixel data var x = e.pagex ; var y = e.pagey ; var canvas = document.getelementbyid('canvas'); var gl = rende

countdowntimer - How to set countdown timer for playing song by using streaming in android -

i trying set count down timer streaming song url.countdown timer working, when data not buffered because of slow internet speed countdown timer not stopped. if have idea please me. thanks. you can total duration , current duration media player this long totalduration = mediaplayer.getduration()/1000; // converted seconds long currentduration = mediaplayer.getcurrentposition()/1000; and count down timer can use this long coundown = currentduration - totalduration ; hope helped you.

c - fscanf segfault reading into an array -

why fscanf in code giving me segfault? int main(int argc, char *argv[]) { file *file = fopen(argv[1], "r"); int n = atoi(argv[2]); char *words[n]; int i=0; while ((fscanf(file, "%s ", &words[i])) != eof) i++; } because didn't allocate memory words[i]. pointers point random memory addresses.

visual studio 2010 - How to set AntTweakBar to be on top of OpenGL 3 content (using GLFW) -

i using glfw display opengl content in msvs 2010. want use anttweakbar modify directive variables (speed rotation, object size, ...) , want bar above opengl content (not behind can see in picture). i read manual, followed examples cant figure out how set this. examples use old deprecated fixed pipeline use dynamic pipline guess might problem. picture: (i donr have enough rep post directly) http://s9.postimg.org/43aa3pt0v/cube.png code: twinit(tw_opengl_core, null); int width=0; int height=0; glfwgetwindowsize(&width,&height); twwindowsize(width, height); twbar * buildinggui = twnewbar("window settings"); twsetparam(buildinggui, null, "refresh", tw_param_cstring, 1, "0.1"); twdefine(" 'window settings' alwaystop=true ") twaddvarrw(buildinggui, "movement speed" , tw_type_float, &speed, "step=0.1"); thank time ! i had same problem , placed twdraw(); function before glfwswapbuffers

c# - Prioritize threads. -

so application has collection of points. each point has checkstatustimer, checknewdatatimer, , checkdevcetimer (they system.timers). point has sampletime property. if sample time set 30 seconds then: checkstatustimer.interval = sampletime/4; // ~7 seconds, reset , start on checknewdatatimer.interval = sampletime/2; // 15 seconds, reset , start on checkdevcetimer.interval = sampletime; // 30 seconds, reset , start on all timers trigger function pull data connected (modbus tcp) device , takes time. can imagine more points add more threads scheduled , process time user calls increase. i create task process user incoming messages. task.factory.startnew(() => this.proccessmessage(session, value)); i have tried set (i know bad idea) thread.currentthread.priority = threadpriority.highest; but didn work, , tried to var worker = new thread(() = this.proccessmessage(session, value)) { priority = threadpriority.hig

xml - Why does DTD validation fail when optional child element is omitted? -

the xml document has embedded dtd declaration , fails. here dtd: <!doctype movielist [ <!element movielist (movie+)> <!element movie (title+, rating+, runtime+, genrelist*, datereleased+, country+, review+, description+, director+)> <!element title (#pcdata)> <!element rating (#pcdata)> <!element runtime (#pcdata)> <!element genrelist (genre+)> <!element genre (#pcdata)> <!element datereleased (#pcdata)> <!element country (#pcdata)> <!element review (#pcdata)> <!element description (#pcdata)> <!element director (#pcdata)> ]> and here xml elements: <movielist> <movie> <title>jaws</title> <rating>pg</rating> <runtime>124 minutes</runtime> <genrelist> <genre>adventure</genre> <genre>thriller</genre> </genrelist> <datereleased>20 june 1975</datereleased>

apache - add trailing slash and remove .htaccess -

how can that: website.com/store/ redirect website.com/store website.com/outbound/store/5 redirect website.com/outbound/store/5/ what want have urls without prefix remove trailing slash , prefix add trailing slash my .htaccess: options +followsymlinks rewriteengine on rewritecond %{request_filename} !-f rewriterule ^(.+)/$ /$1 [r=301,l] rewritecond %{request_filename} !-f rewriterule ^pa/?$ /admin/index.php [l,qsa] rewritecond %{request_filename} !-f rewriterule ^([^/]+)/?$ stores.php?store=$1 [l] rewritecond %{request_filename} !-f rewriterule ^outbound/([^/]*)/([^/]*)$ /outbound.php?type=$1&id=$2 [l] options +followsymlinks rewriteengine on rewritebase / # force tailing slash urls starting /outbound/ rewriterule ^outbound/.*[^/]$ /$0/ [r=301,l] #remove tailing slash except urls starting /outbound/ rewritecond $1 !^outbound/ rewriterule ^(.+)/$ /$1 [r=301,l] rewriterule ^pa/?$ /admin/index.php [l,qsa] rewritecond %{request_filename} !-f rewriterule ^out

cocoa bindings - How do you bind a storyboard view to a Core Data entity when using NSDocument? -

i'm building os x app uses core data, nsdocument, storyboards, , cocoa bindings. my expectation following occurs: an instance of mydocument ( nsdocument subclass) created. mydocument creates core data nsmanagedobjectcontext represents document's data. mydocument instantiates nswindowcontroller storyboard identifier. within storyboard, window controller contains documenteditorviewcontroller ( nsviewcontroller subclass) displays , edits document. within storyboard, documenteditorviewcontroller has nsarraycontroller that's bound mydocument 's managed object context. within storyboard, documenteditorviewcontroller has table view that's bound nsarraycontroller . this way changes in ui make way nsmanagedobjectcontext , without glue code. i expect straightforward, believe i'm using these technologies in way intended. have been unable bindings work, particularly @ steps 5 , 6. of project templates , example projects i've found either do

javascript - svg image is added to DOM, but isn't *visible* unless touched in Firebug -

this question has answer here: generated svg image doesn't display 1 answer i'm trying add feature webtoy built. uses raw javascript , svg. app has bunch of functionality , on year old , lives @ http://stereosketcher.com . new feature supposed add svg <image> <g> when drag image file onto special spot on screen file system. have dragging , parsing , appending done, image isn't appearing. isn't isn't in markup, it in markup , it's can't see image. i suspect kind of layering or opacity issue or something, except there 2 weird tricks can make image appear: just copy whole <image> element (xlink:href , all) else's svg editor (like 'try it' editor on @ w3schools) use firebug manually edit markup , touch last few characters of <image> inserting space or carriage-return before "/>" closing

spring - OpenSessionInViewFilter and Wicket and still running into LazyInitializationExceptions -

i'm using spring's opensessioninviewfilter in combination wicket , kept running lazyinitializationexceptions, couldn't resolved. see in logging hibernate session closed before exception thrown, doing wrong. the osivfilter must above wicketfilter, or else requests won't reach it. wicketfilter handles page requests itself, doesn't delegate other components, such servlet (thus, filter chain stops there). another way create implementation of irequestcyclelistener same osivfilter. i've created such class modifying spring's filter code comply new interface, below: import org.apache.wicket.metadatakey; import org.apache.wicket.protocol.http.webapplication; import org.apache.wicket.request.cycle.abstractrequestcyclelistener; import org.apache.wicket.request.cycle.requestcycle; import org.hibernate.flushmode; import org.hibernate.hibernateexception; import org.hibernate.session; import org.hibernate.sessionfactory; import org.slf4j.logger; import or

ios - NSFetchedResultsController with additional objects -

i trying use nsfetchedresultscontroller fetch objects db display in tableview. append custom objects fetched objects displaying purposes. best way this? my current method store [fetchedresultscontroller fetchedobjects] in array called objectsdatasource , append objects it. use objectsdatasource datasource tableview. when receive controllerdidchangecontent, call fetchedobjects again , reload objectsdatasource. there performance issue? alternative abandon nsfetchedresultscontroller , create own array , add observer nsmanagedobjectdidsavenotification. does [fetchedresultscontroller fetchedobjects] fetch objects faults , fire fault when property accessed? i avoid copying array returned fetch results controller , keep added results in seperate array when possible (the array returned fetch results controller virtual cursor actual data stored in db, , might not actualy hold entire dataset in memory). if aditional items not mixed results returned fetch results controller, m

javascript - Grid with freezon last column -

Image
i have create angular grid last column frozen. frozen column summation of row values. last row editable one. problem how create html/css structure. can create angular grid how create html/css structure question. attached screen shot of grid required. any pointers helpful. thanks here solution came : http://jsfiddle.net/anirbankundu/djqpf/1881/ i implemented using 2 ways - have indicated in fiddle more favorable way implement. hope helps html : <div id="left"> <h4>left col</h4> <table> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> <td>6</td> <td>7</td> <td>8</td> <td>9</td> <td>10</td> <td>11</td> <td>12</td>

uitableview - how to connect textfield with table view of listed options instead of keypad -

i need able disable keypad in textfield, , instead when user taps on start editing, new table view appear presenting list of possible strings textfield should filled. anyone has suggestions on how achieve this? thanks in advance p.s. tried functionality cannot nicely implemented picker in case, there many options choose , (more importantly) each 1 of them rather long string , cannot appear entirely in picker. i believe need regular cell that, when tapped, pushes new detail uitableviewcontroller options choose from. once option chosen, set cell's textlabel whatever option have been selected. if you'd go easier path, should check free sensible tableview framework, has these kinds of cells out of box (called selection cells). pass on strings array selection cell , automatically display detail view, , assign selected option 1 of object's properties if wish. should save amount of manual work. luck!

JAVA - Write binary number to a file and read it -

how can write file binary number without cut zeros . i'm writing : byte[] b = new biginteger("1011010101010110", 2).tobytearray(); fileoutputstream fos = new fileoutputstream("file",true); fos.write(b); but example : when write 0000001, writes in file 1 , ignores zeros, same happens if write 001001001000 , ignores zeros on left reading 8bits @ time right left. what correct way write binary digits file ? if correct way, i'm might trying read file in wrong way ( i'm using read() of inputstream ) ps-(8 digits must 1 byte writing string not option, cause each digit 1 byte.) you can try this string s = "0000001"; byte[] = new byte[s.length()]; (int = 0; < s.length(); i++) { a[i] = (byte) (s.charat(i) & 1); }

java - Cannot invoke @Remote interface in separate ear -

this real newbie question appreciate help. have looked in other questions haven't found solution. maybe overlooking simple. i deploying ear jboss has ejb module: in ejb jar single bean, mybean @stateless. the ejb jar has dependency on api jar. in api jar single @remote interface, myinterface. this api jar in lib folder of ejb. mybean implements myinterface. deploy ear, , goes ok. deploying jboss eap 6.3.0. in theory bean should available other ears & wars. then: have war simple rest class call remote myinterface. (the idea call remote bean war deployed separately ear has bean). this gives me following error when deploy war: weld-001408 unsatisfied dependencies type [myinterface] qualifiers [@default] @ injection point [[field] @inject private com.test.rest.messagerestservice.myinterface] the rest class follows: package com.test.rest; import javax.inject.inject; import javax.ws.rs.get; import javax.ws.rs.path; import javax.ws.rs.pathparam; import

c# - Async HFP discovery with 32feet -

Image
i in process of writing bluetooth scanner monitor traffic outside house. understand car bt devices have 3 states, visible (always on), limited, , invisible. i'm using asynchronous device discovery bluesoleil drivers, , class 1 bluetooth dongle. my problem device name , device class isn't being discovered. discovering device address, , range, not name of device. i have tried using system.threading.thread.sleep(1000) calling device.refresh() no avail. it picking name of few things in range, tvs, , fitbit flexes, it's important can find name , cod of car bluetooth devices, not mac address , range. public void setuplistener() { var client = new bluetoothclient(); var component = new bluetoothcomponent(client); component.discoverdevicesasync(255, false, false, true, false, null); component.discoverdevicesprogress += component_discoverdevicesprogress; component.discoverdevicescomplete += component_discoverdevicescomplete

java - Issues on cast Object to Integer or String -

i have implement interface iexecutable console menu application.the method implementing is: object execute(object o); display menu. read console menu option integer or string. on execution have error : java.lang.string cannot cast java.lang.integer question best way make conversion. consolemenu.java public object execute(object o) { show(); o = read(); try{ int choice = integer.parseint((string) o); // error on line iexecutable menuoption = getmenuoptions(choice); if(menuoption != null){ o = menuoption.execute(o); return o; } } catch(exception e){ system.out.println("invalid option"+ e.getmessage()); } return null; } private static iexecutable getmenuoptions(int i){ for(menuoptions option : options){ if(option.getkey() == && option.getisactive()){ return option; }

c# - How to add radcombobox to cell in a table row cell -

i trying add radcombobox table row cell. cannot use table.row.cells.add(radcombobox) expects cell object. table programatically created . protected override void page_init(object sender, eventargs e) { base.page_init(sender, e); configuretablecolumns(datacontext, operatingconditionstable, node, segments); configuretablerows(datacontext, operatingconditionstable, node, segments, inputs); } private void configuretablerows(ctaladatacontext context, table table, ctala.entity.treenode reviewnode, ienumerable<ctala.entity.treenode> segments, ilookup<string, operatingconditioninput> inputsgroupedbycategory) { foreach (var category in inputsgroupedbycategory) { foreach (var input in category) { var row = new tablerow() { cssclass = (altrow) ? "rgaltrow" : "rgrow" }; table.rows.add(row); var cell = new tablecell() {

database - What are scope values for an OAuth2 server? -

i'm facing difficulty understand how scopes work. i found here small text describes scopes of stackexchange api need more information on how work (not one...). can provide me concept? thanks in advance to authorize app need call url oauth2 authorization process. url "living" in api's provider documentation. example google has url: https://accounts.google.com/o/auth2/auth also need specify few query parameters link: cliend_id redirect_uri scope : data application requesting access to. typically specified list of space-delimited string, though facebook uses comma-delimited strings. valid values scope should included in api provider documentation. gougle tasks, scope https://www.googleapis.com/auth/tasks . if application needed access google docs, specify scope value of https://www.googleapis.com/auth/tasks https://docs.google.com/feeds response_type : code server-side web application flow, indivating authorization code returned applic

c - Making a validation function to tell if the number entered is positve -

/* function i'm trying make bigger program calcs area of room. when answer <= 0 want function take over, keep getting few arguments error when compile it. gladly appreciated.*/ #include <stdio.h> int validinput(double len); int main(void) { double len ; int check; printf("\nenter length of room in feet:"); scanf("%lf", &len); check = validinput(); return 0; } int validinput(double len) { int check; if (len <= 0 ) printf("\nnumbers entered must positive."); return check; } this line: check = validinput(); is missing parameter. suggest: check = validinput( len ); of course, code should check returned value, not parameter value, call scanf() assure operation successful. in case, returned value should 1. other returned value indicate error occurred. regarding validinput() function: the variable check never initialized specific value. suggest: int validinput(double len) { int check = 1; // i

how to convert jpg to pdf in Android java -

i want convert several .jpg files (taken using device camera) 1 .pdf file. saw lot of tools itext, mupdf, pdfjet, pdjbox. is there more simple? (like api ready android?) thanks. using itext library convert text pdf. use convert image pdf. import java.io.*; import com.lowagie.text.*; import com.lowagie.text.pdf.*; public class imagespdf { public static void main(string arg[])throws exception { document document=new document(); pdfwriter.getinstance(document,new fileoutputstream("yourpdfhere.pdf")); document.open(); image image = image.getinstance ("yourimagehere.jpg"); document.add(new paragraph("your heading image goes here")); document.add(image); document.close(); } }

css - Floating multiple li's left and right -

i trying make custom sidebar in wordpress, have element , info in li's, trying try shift half of total li's left , half right... what using float/clear left , right, not seems work wanted... html structure:- <ul> <li class="left">left</li> <li class="left">left</li> <li class="left">left</li> <li class="left">left</li> <li class="left">left</li> <li class="right">right</li> <li class="right">right</li> <li class="right">right</li> <li class="right">right</li> <li class="right">right</li> </ul> the css:- .left { float:left; width:50%; clear:left; } .right { float:right; width:50%; clear:right } jsfiddle if you're willing give list style disc (depending on browser), can without floats

javascript - Elements Floated Right do not activate Transitions -

i attempting elements transition onscreen. example purposes have set them transition on page load. the elements not floated work fine. however, elements have been floated right (they have class exleft because should expanding leftward) not transition. can explain why happening? jsfiddle here html: <div id="templatebox"> <div class="ribbon exright" id="r1"> </div> <div class="ribbon exleft" id="r2"> </div> <div class="ribbon exright" id="r3"> </div> <div class="ribbon exleft" id="r4"> </div> </div> css: #templatebox{ width: 100%; height: 800px; padding-top: 50px; } .ribbon{ height: 50px; position: relative; transition: 1s ease; width: 300px; margin-bottom: 20px; z-index: 1000; } .exleft{ right: -1200px; left: 0px; margin-right: -100px; float: right; } .exright{ left: -1200px;

playframework - Scala foreach member variable -

is there way loop each member variable of class? it's trivial lists , arrays have construct case class each json field mapping member variable use play framework's reads/validator api did mean this: case class someclass(a: int, b: int) someclass(1,2).productiterator.foreach{ => println(a)} this give output of: 1 2 or if trying construct object json. can define reads in case class deserialises json object : override def reads(json: jsvalue): jsresult[someclass] = jssuccess(someclass( (json \ "a").as[int], (json \ "b").as[int] ) ) then use deserialisation: val json = json.obj() //your json json.validate[someclass] json.fold( errors => { json.obj("status" -> "not ok", "message" -> jserror.tojson(errors)) }, preset => { json.obj("status" -> "ok") } )

javascript - What's the correct way to trigger jQuery DOM Manipulation from within a controller? -

so keep reading jquery manipulation within controller bad practice, i'm not clear on why, or how correct. below code youtube tutorial video creator comments bad idea, doesn't explain why , continues use bad behavior anyway. from https://www.youtube.com/watch?v=ilch2euobz0#t=553s : $scope.delete = function() { var id = this.todo.id; todo.delete({id: id}, function() { $('todo_' + id).fadeout(); }); }; solution : based on langdon's answer below, i've arrived @ following working code own work, derives example code above: var projectlistctrl = function ($scope, project) { $scope.projects = project.query(); $scope.delete = function() { var thiselem = this; var thisproject = thiselem.project; var id = thisproject.id; project.delete({id: id}, function() { var idx = $scope.projects.indexof(thisproject); if (idx !== -1) { thiselem.destroy('removeitem(&#