Posts

Showing posts from April, 2015

Uppercase "a"'s inside a Meteor template -

how can uppercase small a's inside meteor template after rendering? what tried: meteor's liverange object has visit() method. can access rendered dom nodes of template. each dom text node modify data in visitor. however! how liverange object template?? in callback rendered() template this template instance. has liverange object in member called _spark_keezuqtoktbuqw3xw or such. looks meteor disliking access member. how can liverange object of template in way pleases meteor gods? and before ask why such stupid thing uppercasing "a"'s: it's complicated. execute search-and-replace on dom text nodes in template, because trying apply cross-cutting concern several templates in meteor application. do have constraints on a's within template? for example, how you'd uppercase a's within spans in template: template.complicated.rendered = function() { this.findall('span').each(function(idx, element) { $

kendo ui - LoadContentFrom with dynamic route value -

is possible specify dynamic route value in kendo ui tabstrip loadcontentfrom(string actionname, string controllername, object routevalues) method? want embed tabstrip page show different customers , change customer data (including id) via ajax. mean tabstrip works first customer. @code html.kendo().tabstrip() _ .name("tabstrip") _ .items(sub(tabstrip) tabstrip.add().text("tasks") _ .selected(true) _ .loadcontentfrom("list", "task", new {.customerid = model.customerid}) tabstrip.add().text("contacts") _ .loadcontentfrom("list", "contact", new {.contactid = model.customerid}) _ .render() end code

Quartz.net with MVC -

i initializing quartz inside application_start() in globals.asax.cs followed: // construct scheduler factory ischedulerfactory schedfact = new stdschedulerfactory(); ischeduler sched = schedfact.getscheduler(); sched.start(); ijobdetail dailyusermailjob = new jobdetailimpl("dailyusermailjob", null, typeof(dailyusermail)); // fire every daye itrigger dailyusermailtrigger = new simpletriggerimpl("dailyusermailtrigger", 1, new timespan(1, 0, 0, 0)); sched.schedulejob(dailyusermailjob, dailyusermailtrigger); the job should run once day, problem is, runs everytime hit website. any ideas ? the job should run once day then shouldn't launched web application. should console application that's run on scheduler, or perhaps windows service. a web application is, design, request/response system. it's not suited ongoing background tas

sql server - SQL IN clause causes scan on too many parameters -

i'm having trouble understanding result of query here: http://pastebin.com/sgvnq1ju . it works intended, whenever t2.cityid in (...) clause of clusters cte expression reaches more 6 values match, execution plan changes including expensive table scan, , query gets slow. any ideas on why might be? try avoiding in clause in favor of join on cte table constructed parameter values in clause (below) additionally, make sure have index on map.clusterdist.cityid column. declare @cityids0 int, @cityids1 int, @cityids2 int, @cityids3 int, @cityids4 int, @cityids5 int, @cityids6 int, @cityids7 int select @cityids0 = 0, @cityids1 = 1, @cityids2 = 2, @cityids3 = 3, @cityids4 = 4, @cityids5 = 5, @cityids6 = 6, @cityids7 = 7 ;with cities ( select @cityids0 [cityid] union select @cityids1 union select @cityids2 union select @cityids3 union select @cityids4 union select @cityids5 union select @cityids6 union select @cityids7 ), clust

iOS - Curved Rounded UITextfield -

i need have textfield in app curved, able pre-define path. i have textfield in storyboard, , when button tapped, text field needs appear in, curved. how achieve curved part, making textfield round , text curve entered? thanks, ari you need write hefty chunk of core text code + code calculate curve geometry navigates writing along path. here on/offline resources: eva diaz-santana, core text tutorial http://weblog.invasivecode.com/core-text rob napier, ios6 pushing limits (chapter 26, fancy text layout) http://iosptl.com/ apple, coretextarccocoa (sample code) http://developer.apple.com/library/mac/#samplecode/coretextarccocoa/introduction/intro.html erica sadun, advanced ios6 developer's cookbook (chapter 3, core text , chapter 4, geometry - see recipe 4.8, laying out text along bezier path) https://github.com/erica/ios-6-advanced-cookbook

javascript - How to split a string with letters and numbers into different variables using js? -

given following string: var mystring = "s1a174o10"; i have following result: var s = 1; var = 174; var o = 10; each letter on string matches following number. keep in mind string not static, here example: var mystring = "s1p5a100"; you can regex: var vars = {}; mystring.replace(/(\d+)(\d+)/g, function(_,k,v){ vars[k] = +v }); console.log(vars); //=> {s: 1, a: 174, o: 10}

ios - Exchange ActiveSync Objective-C Provision Command Bad Request -

i have spent days of trial , error, looked through exchange logs, , searched on internet , far unable resolve issue. i implementing activesync capabilities within ios app , far have coded autodiscover process , http options request server's capabilities. trying run provision command keep getting 400 bad request. here sending server: url: https://mobile.[myexchangeserver].com/microsoft-server-activesync?cmd=provision&user=jack&deviceid=123412341234&devicetype=ios authorization = "basic wekrju283j"; //base 64 encoded auth, garbage posting "content-length" = 104; "content-type" = "application/vnd.ms-sync.wbxml"; "ms-asprotocolversion" = "12.1"; "user-agent" = myapp; "x-ms-policykey" = 0; body (converted wbxml before sending): <?xml version="1.0" encoding="utf-8"?> <provision xmlns="provision:"> <policies> <policy>

GWT - Celltable image flickering on Chrome -

we have custom implementation of celltable in there custom column render label , image. part of hovering on table row, call table.redrawrow(rownum) render context menu. however, doing that, cause text , image column re-render image (make server call fetch image). causes flickering effect. happens in chrome (version using - chrome27) the table row looks this: <tr __gwt_row="0" __gwt_subrow="0" class="gah0tqlmkd"> <td class="gah0tqlkkd gah0tqlnkd gah0tqlokd"> <div style="outline-style:none;" __gwt_cell="cell-gwt-uid-65" tabindex="0"> <div style="border-collapse: separate; border-spacing:0"> <div style="display:table-cell;vertical-align:middle"> <img src="icon.png" alt="" style="vertical-align:middle; border: 0;width:16px;height:16px; "> </div> <div

Toggle inside toggle for Google Maps -

i've made google map show location @ beginning 1 marker. there have possibility switch location. show new location 1 marker. aside location switching it's possible select sub locations each of 2 main locations. i thought making 2 vars ( each location 1) best thing [example]: var locationsberlin = [ ['berlin 1', 52.519433,13.406746, 1], ['berlin 2', 52.522606,13.40366, 2], ['berlin 3', 52.52113,13.409411, 3], ['berlin 4', 52.517043,13.402394, 4], ['berlin 5', 52.51703,13.412801, 5], ['berlin 6', 52.525086,13.399798, 6], ['berlin 7', 52.525151,13.410741, 7] ]; this how select "main" location. markermain = new google.maps.marker({ position: new google.maps.latlng(locationsberlin[0][1], locationsberlin[0][2]), map: map, icon: custompin }); the rest of array sublocations. want user able press link , show rest of locations in var (the amount of loc

java - Spring Autowire Annotation with Several Interface Implementations -

suppose have 1 interface public interface { public void dosomething(); } and 2 implementation classes @component(value="aimpl1") public class aimpl1 implements { } @component(value="aimpl2") public class aimpl2 implements a{ } and class use "a" implementation: @component public class myclass { @autowire a; } now if want inject aimpl1 add @qualifier("aimpl1") while if want inject aimpl2 add @qualifier("aimpl2") the question is: possible instruct spring somehow implementations of "a" in case aimpl1 , aimpl2 , use application specific conventions choose appropriate implementation? example in case convention use implementation greatest suffix (i.e. aimpl2)? edit: class myclass should not aware @ implementation lookup logic, should find property "a" set object of aimpl2. assuming have hundreds of interfaces , implementations (as said in comment), , not want refactor code... tr

javascript - Opening Pdf on Google Chrome -

Image
opening local pdf works if specify url , access data dynamically created @ server , fails. url : "test.pdf" // works url: "api/items/301/convert/pdf" // fails (ajax call, see attached image ) i using pdf_object.js a javascript interface open pdf files in browser

objective c - Deleting charachters as long as button is pressed -

how can deleting characters interval long button pressed? have tried use longpressgesturerecognizer, got infinite loop. if want change things that, have implement own text editor. default text editors react on keypress events auto repeated os after has been held down time. can change os settings minimize delay works on system-wide keypresses (and you). if want change behavior of specific text editor, have implement own text editor reacts on keydown/keyup events , handles repeating internally through timer.

python - Sending JSON Object in URL -

i'm working diffbot api in python, , have feature can send batch request contains 50 urls in 1 http requests. problem not know how construct such script. i'm getting stuck @ start, here have. import requests import json url = 'http://www.diffbot.com/api/' batch = {"method": "get", "relative_url": "/api/article?url=http%3a%2f%2fblogs.wsj.com%2fventurecapital%2f2012%2f05%2f31%2finvestors-back-diffbots-visual-learning-robot-for-web-content%2f%3fmod%3dgoogle_news_blog%26token=xxx"},{"method": "get", "relative_url": "/api/article?url=http%3a%2f%2fgigaom.com%2fcloud%2fsilicon-valley-royalty-pony-up-2m-to-scale-diffbots-visual-learning-robot%2f%26token=xxx"} r = requests.get(u+batch) now, of course error says str , tuples cannot concatenate, i'm lost how i'd pass json object in form of url. if point me in right direction appreciated. here example of how perform call curl, i

c++ - How to declare a variable in the brackets of if statement? -

i want declare local variable in brackets of if statement. example. if((char c = getc(stdin)) == 0x01)//this not ok g++. { ungetc(c, stdin); } what want is, see if character 1 want. commonly, want use variable(char c) both in line of if , body of if , not outside if . but g++(gcc 4.8.1) says expected primary-expression before 'char' . wonder if there's way that, because don't want like char c = getc(stdin); if(c == 0x01) { bla... } if it's namespace pollution worrying can define if statement within block: { char c = getc(stdin); if(c == 0x01) { // ... } } so c last until end of block reached.

Python object proxying: how to access proxy -

i found this recipe create proxy class. i've used wrap custom object , overload properties , attach new attributes proxy. however, when call method on proxy (from within proxy class), end being delegated wrappee not want. is there way of accessing or storing reference proxy? here's code (untested) demonstrate problem. class myobject(object): @property def value(self): return 42 class myobjectproxy(proxy): # see link above def __getattribute__(self, attr): # problem `self` refers proxied # object , throws attributeerror. how # can reference myobjectproxy.another_value()? if attr == 'value': return self.another_value() # return method or attribute, doesn't matter (same effect) return super(myobjectproxy, self).__getattribute__(attr) def another_value(self): return 21 o = myobject() p = myobjectproxy(o) print o.value print p.value in sense problem proxy works good, hiding own methods/attributes , posing proxied obj

r - Create a separate variable for each element of a list -

i have list of data frames, produced reading in 25 .csv files @ once. unlist data frames begin spatial analysis. is, have individual data frames each element of list. i have tried unlist() , not produce result want. have tried approach lapply() , produces error. here's i've tried: x <- 1:3 y <- 4:6 l <- lapply(1:2, function(x){data.frame(x, y)}) lapply(1:length(l), function(i){paste('df', i, sep = '') <- data.frame(l[[i]])}) the problem seems in assigning data frame pasted name. wrapping as.character() did not help. this work: "df1" <- data.frame(l[[1]]) it seems problem somewhere in output of paste() function, output has str() 'chr'. ideas how can make approach work? there cleaner way unlist data frames? one way of doing it: list2env(setnames(l,paste0("df",seq_along(l))), envir = parent.frame()) though heed @baptiste 's advice before late , avoid doing this. why? because in

java - Null pointer exception when adding TextView -

i have scrollview, , i'm trying add textviews linearlayout in keep getting error. textview l = new textview(stopwatch.this); l.settext("didn't work"); l.settextsize(20); lllocations.addview(l); i trying use code see if arraylist using empty, wasnt that. says error caused nullpointerexception at... lllocations.addview(l); i have other code same thing, , tried comparing them there wasn't difference i'm confused. how fix this? 07-10 21:14:42.687: e/androidruntime(5241): fatal exception: main 07-10 21:14:42.687: e/androidruntime(5241): java.lang.illegalstateexception: not execute method of activity 07-10 21:14:42.687: e/androidruntime(5241): @ android.view.view$1.onclick(view.java:3599) 07-10 21:14:42.687: e/androidruntime(5241): @ android.view.view.performclick(view.java:4204) 07-10 21:14:42.687: e/androidruntime(5241): @ android.view.view$performclick.run(view.java:17355) 07-10 21:14:42.687: e/androidruntime(5241): @ android.os.hand

How not to be confined into content area... full size web app on Joomla -

i creating intranet erp application integrate existing corporate joomla 3.1 based web site. the extension made far has 1 default controller php file , made using javascript ui framework. (i.e. jqwidgets) not using model, views, helpers. the other php files there respond client side interface ajax requests. so need joomla user authentication , session control features dont want confine extensions output content area... need entire document surface... no menu, no module columns, no nothing ! can done ? two ways component.php in template show component's output add &tmpl=component urls make custom template outputs component <html> <head> <!-- put scripts stylesheets need etc//--> </head> <body> <jdoc:include type="component" /> </body> </html>

Voice Recognition in Python -

i'm working on virtual assistant program in python 3.3, , i'd incorporate voice recognition in it. know of python modules or tools with? appreciated! i've spent lot of time working on subject. currently i'm developing python 3 open-source cross-platform virtual assistant program called athena voice : https://github.com/athena-voice/athena-voice-client users can use siri, cortana, or amazon echo. it uses simple "module" system users can write own modules enhance it's functionality. let me know if of use. otherwise, recommend looking google's python speech-to-text , text-to-speech packages. both packages can installed using command: pip install speechrecognition gtts google stt: https://pypi.python.org/pypi/speechrecognition/ google tts: https://pypi.python.org/pypi/gtts/1.0.2 i believe stt has pyaudio dependency can found here (unofficial): http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio however, if intend passive/off

PostgreSQL 9.0.13 doing a pg_restore but no evidence that disk space is being used -

i'm trying restore pg_dump taken command server. sudo -u postgres pg_dump --verbose --format=custom --file=pg-backup.sql -u postgres salesdb after copied on pg-backup.sql file i'm trying restore command sudo -u postgres pg_restore --verbose --jobs=`nproc` -f pg-backup.sql the pg-backup.sql file 13gb. pg-restore has been running 4 hours, scrolling data screen whole time. no errors. but when execute statement psql session select pg_size_pretty(pg_database_size('salesdb')); i 5377 kb in size. what? should @ least 1gb now. i'm totally lost. data scrolling screen , can't prove going anywhere. no disk usage. help try without "-f" flag in pg_restore command. also, might want try creating empty salesdb database , pass in "-d salesdb". note db name fold lowercase unless created within double-quotes. added example steps show db grows in size restore running -- sample pg_dump command pg_dump -f testdb.out -fc src_te

out of memory exception caused by big array in java -

i'm implenmenting algorithm based on probabilistic latent semantic indexing(plsa) , paper here and need 4 dimension array named p_z_d_wt_wv, z topic, d document, wt text word, wv visual word,and number of each dimension 12, 7000,100, 500, , array double array, need 32g memory !! allocate memory way below, , demonstration number of wt , wv in each document different. p_z_d_wt_wv = new double[12][7000][][]; for( int t = 0; t < 12; ++t) { for( int d = 0; d < 7000; ++d ) { p_z_d_wt_wv[t][d] = new double[100][500]; } } when run code, has out of memory problem. first, why code run out of memory? are memory allocated consecutively if array allocated in way? because java have memory limit consecutive memory? if so, what's limit? second, can solve problem supposed memory of server big enough. know can change float array, there other solutions? if need of memory, well, need of memory. there alternatives: you using memory mapped

php - Can't get printTimeLineItemMetadata to pass variables outside of the function -

hello i've been trying mirror api check if timeline item has been deleted , if create new 1 if not update old one. programming in php , know seems should straight forward reason i'm stuck! please help! right have setup , doesn't seem want pass variable outside of function , can't insert inside of function either. function printtimelineitemmetadata($service, $itemid) { try { $timelineitem = $service->timeline->get($itemid); print 'timeline item id: ' . $timelineitem->getid(); if ($timelineitem->getisdeleted()) { $deleted = "deleted"; echo $deleted; } else { $deleted = "nope"; echo $deleted;} } catch (exception $e) { print 'an error occurred: ' . $e->getmessage(); } } i can $deleted echo in both cases once try , pass $deleted if statement further down below won't take. as question asker explained in comment on question, has scoping. functions in php have own scope, variables defined in function

javascript - How do I give an id to an appended element? -

the 1 i'm talking 1 have code appear literally, string. how combine actual code, <div id="thing">string goes here</div> ? i've tried making div , id part of content inside (' ') doesn't work. when that, content never gets appended. here's code: $('#placetoappendto').append ('&lt;br&gt;&lt;div&gt;&lt;input&nbsp;type="text"&nbsp;class="textfield"&nbsp;id="text'+textclicked+'"&lt;/div&gt;'); to html presented, this: var elem = document.createelement('div'); elem.id = "thing"; elem.appendchild(document.createtextnode("string goes here")); i hope helps, since question isn't particularly clear.

php - Xss when echoing direct from url -

this question has answer here: how prevent xss html/php? 8 answers i printing directly form url if(isset($_get['name']){ echo $_get['name']) } but friend told me bad , vulnerable xss how bad , should prevent xss? just wrap content should not contain tags in htmlspecialchars echo htmlspecialchars($_get["name"]);

java - Two threads, same static variable, same value, concurrent access -

i've been trying ready scjp exam have take next week, , i've encountered question java threads . 1-public class stone implements runnable { 2- static int id = 1; 3- 4- public void run() { 5- try { 6- id = 1 - id; 7- if (id == 0) { 8- pick(); 9- } else { 10- release(); 11- } 12- 13- } catch (exception e) { 14- } 15- } 16- 17- private static synchronized void pick() throws exception { 18- system.out.print("p "); 19- system.out.print("q "); 20- } 21- 22- private synchronized void release() throws exception { 23- system.out.print("r "); 24- system.out.print("s "); 25- } 26- 27- public static void main(string[] args) { 28- stone st = new stone(); 29- new thread(st).start(); 30- new thread(st).start(); 31- } 32-} which true? (choose apply.) the output p q r s the output p r s q the output p r q s the output p q p q the

c# - EntityFramework (6) and async ( waitingForActivation)? -

Image
i've downloaded ef6 ( in order use async ) so wrote simple method : public async task<list<int>> myasyncmethod() { var locations = await mydumpentities.agegroups.select(f=>f.endyear).tolistasync(); return locations; } ...later... dumpentities1 mydumpentities = new dumpentities1(); var data = mydumpentities.agegroups.tolistasync(); myasyncmethod().continuewith(s => { response.write("f"); }); mydumpentities.dispose(); but don't see on screen , when inspect data see : p.s. tolistasync signature what missing ? basing of off comments , line have problem with: var data = mydumpentities.agegroups.tolistasync(); what data type be? task<list<agegroup>> . that's right, not list<agegroup> . so, either have mark page_load async (if possible): public async void page_load(object sender, eventargs e) { using(var mydumpentities = new dumpentities1())

angularjs - $routeProvider not loading template when url has a parameter -

i have use angular's $routeprovider load templates using code similar this $routeprovider.when('/store', { templateurl: 'views/store.html', controller: 'storecontroller' }); however, when use code below nothing happens. is, template not loaded. think must because have parameter in url, i'm not sure. $routeprovider.when('/item/:item_id/info', { templateurl: 'views/item.html', controller: 'itemsctrl' }); how can work? update: clear, links this: ng-click="setroute('/item/1/info')" "1" parameter. update2: $scope.setroute = function(route){ $location.path(route); }; update3: the parameter :item_id being loaded via $http . when inspect source code page see parameter (e.g., "123"), reason not bound setroute function. if hard code parameter works, don't want hard code it. how can bind url parameter works? you need make partials absolute in: tem

java or javascript way to convert images file to favicon.ico -

i trying create java function convert image files such "jpg, jpeg, gif, png" favicon.ico. know library can that? want pure java or javascript way. not way using imagemagick jni take @ image4j allow create ico images through java as as... list<bufferedimage> listofimages = ...; icoencoder.write(listofimages , new file("favicon.ico")); you may want check out reading/loading image well...

sql - How I merge results of two queries -

here queries , there op, how merge queries ans required result 1. select sum(rpl) rpl,decrip comm c, book b b.bookid=c.parbookid , booktype='trading' group b.decrip o/p rpl decrip 55 rbc 45 bny 2. select sum(estcomm) commission,decrip comm c, book b b.bookid=c.parbookid , booktype='wash' group b.decrip o/p commission decrip 2234 rbc 2468 bny how output rpl commission decrip 55 2234 rbc 45 2468 bny how one? select sum(rpl) rpl, sum(estcomm) commission,decrip comm c, book b b.bookid=c.parbookid , (booktype='trading' or booktype='wash) group b.decrip

jsf - HashMap with Boolean inside get reset when onchange in tabview is call -

i have 1 hashmap inside tabview 2 tab on first tab user can see object selected on second can see object can select. it's same hashmap both. xhtml: <p:tabview id="tabviewelement" style="margin-top: 5px;min-height: 50px;max-height: 300px;overflow-x: hidden;" dynamic="true" activeindex="0"> <p:ajax event="tabchange" listener="#{bean.ontabchangeelement}" update="tabviewelement:productconfs tabviewelement:cardselements" /> <p:tab id="idtabelementview" title="elements sectionnes"> <h:inputtext rendered="#{bean.objectselected}" value="aucun produit selectionné"/> <p:datatable id="productconfs" var="productconf" value="#{bean.keyaslistforallelement}" rendered="#{bean.objectselected}"> <f:facet name="header"> <h:outputtext value="elements" />

postgresql - How to write a function that returns text or integer values? -

i'm using postgresql 9.2.4. postgres=# select version(); version ------------------------------------------------------------- postgresql 9.2.4, compiled visual c++ build 1600, 64-bit (1 row) sqlfiddle link my query executes insertion safely. need function should return except void datatype. text("inserted table") or integer(0-false,1-true) , useful me validate whether inserted or not? i need syntax function returns integer or text when insertion done. validation purpose. there way solve this? what need most need 1 function return text , 1 return integer or function returns boolean indicate success. of trivial , i'll refer excellent manual on create function or code examples in similar questions on so . what asked how write function returns text or integer values? ... in sense have one return type being either text or integer . not trivial, not impossible has been suggested. key word is: polymorphi

Implementing ASP.NET web with WIF & ADFS 1.0 -

i have developed solution asp.net front-end using wcf-services back-end. web-site authenticates using adfs 1.0 (i not have control of adfs-implementation has been configured web-application). also, it's no option upgrade adfs 2.0 (at least not in near future) the configuration in web.config following: <httpmodules> <add name="identity federation services application authentication module" type="system.web.security.singlesignon.webssoauthenticationmodule, system.web.security.singlesignon, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35, custom=null" /> </httpmodules> <membership defaultprovider="singlesignonmembershipprovider2"> <providers> <add name="singlesignonmembershipprovider2" type="system.web.security.singlesignon.singlesignonmembershipprovider2, system.web.security.singlesignon.partialtrust, version=1.0.0.0, culture=neutral, publickeytoken=

java - Passing parameters between managed beans -

i trying pass parameters 1 managed bean another. saw similar question , applied solutions not work. here code: in moneytransfer.xhtml file: <h:commandbutton action="#{moneytransferbean.transferaccounts()}" value="continue"> <f:param name="sender" value="#{exttableselectionbean.sender}" /> </h:commandbutton> my exttableselectionbean: @managedbean @viewscoped public class exttableselectionbean implements serializable { private account sender; public void setsender(account sender){ this.sender=sender; } public account getsender(){ return sender; } and moneytransferbean: @managedbean @viewscoped public class moneytransferbean { @managedproperty("#{exttableselectionbean .sender}") private account sender; //no setter-getter sender here public void transferaccounts() throws ioexception { if (sender != null) {

Reading an NDEF message from an NFC tag from an Android application -

i trying create application using nfc , want try , read nfc tag , text message tag , place textview. have code already, nothing happens when try pair phone nfc tag. here code , please @ , see doing wrong , needs done fix issue please: button measurementsdatabutton; nfcadapter mynfcadapter; pendingintent mypendingintent; intentfilter ndef; intentfilter[] filters; string[][] techlists; int mcount; textview mtext; string payload; byte payloadheader; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_nfc_scanner); final actionbar actionbar = getactionbar(); actionbar.setdisplayhomeasupenabled(true); mtext = (textview) findviewbyid(r.id.flowtextview1); measurementsdatabutton = (button) findviewbyid(r.id.measurementsbutton1); measurementsdatabutton.setonclicklistener(this); mynfcadapter = nfcadapter.getdefaultadapter(this); mypendingintent = pendingintent.getacti

google visualization - How do I grouping data in geochart using tooltip column values? -

Image
i using geochart display following data in country map i have plotted map using state cloumn , totalsales($) value column now ,the tooltip displays : id totalsales($_113607.00) i have following summary data in datatable this actual data now have added more columns(city,brandname) break data summary data first table the tooltip displays : va totalsales($_:34943(city fairfax(brandname sony)))- wrong but want display tooltip : va totalsales($_:7768(city fairfax(brandname sony))) - correct this data display tooltip from these, got , geochart takes last row display tooltip,but want display particular brand's totalsales i.e sony -7768$ how do this? you can group data in geo chart using categoryfilter control . can group data in way. var categorypicker = new google.visualization.controlwrapper({ controltype: 'categoryfilter&

Re-opened nested module anomaly in Ruby -

why re-opening nested module give different results depending on syntax used? example, works fine: module module e end end module module e def e.e end end end but this: module module e end end module a::e def e.e end end gives error: reopen.rb:6:in `<module:e>': uninitialized constant a::e::e (nameerror) reopen.rb:5:in `<main>' (before points out, workaround use self instead of module name when defining e.e, that's not point of post.) the module keyword sets namespace context checked references existing names of modules. these namespaces searched inner-to-outer resolve references module (and class) names. in first example, looks may need define e.e inside module e block, in fact don't: module module e end end module def e.e end end what happens in both examples ruby looks @ current namespace, , tries <namespace>::e module name. in both examples, first thing checks in fact a::e::e not

android - how to send value through intent after finishing an activity -

i have activity shows gridview of items. when click in of them, move activity showing information of item. have option go (gridview activity) or delete it. if delete it, need refresh gridview, need send variable saying "eey, have deleted item. need refresh". i guess need open second activity startactivityforresult, don't know how should set value. option 1 (back arrow): finishes activity. no result back. option 2 (delete item): finishes activity , sets result back. thanks in advance! you can set custom result. delete_item . on delete button : public static int delete_item = 1234; intent intent = new intent(); intent.putextra("item_id", item id); setresult(delete_item , intent); now on activity result : @override protected void onactivityresult(int requestcode, int resultcode, intent intent) { if (resultcode == delete_item) { // code delete item super.onactivityresult(requestcode, resultcode, intent); } }

javascript - Jquery use data-id and disable and clear input field -

for variety of reasons want change code below out data attributes rather class called "mygroup". html <select id="apply"> <option value="email">email</option> <option value="website">website</option> </select> <input type="text" class="input" id="email" placeholder="test@test.com" data-id="application"/> <input type="text" class="input" id="website" placeholder="www.example.com" data-id="application"/> <textarea class="input" rows="4" cols="50" placeholder="text*" data-id="applicationdetails"></textarea> js // apply fields function applyfield() { $(document).on('change', '#apply',function() { var selected = $(this).find(':selected').val(), elem = $("#"+selected);

ios - Assigning a VC as Another VC's property in Segue, as Another VC's UIbutton Try to Add the VC (Now a property) as Target, Gone Wrong -

in custom segue of mine i've assigned vc_a ( self.sourceviewcontroller ) property of vc_b ( self.destinationviewcontroller ). vc_b.property = (vc_aclass*) self.sourceviewcontroller; in vc_b i've #imported "vc_aclass " , declared correct class property. @property(nonatomic)vc_aclass* property; i didn't forget synthesize (in m file) too; @synthesize property; however, when try trigger method in vc_a using uibutton in vc_b (by adding target ), uibutton* auibutton = [[uibutton alloc] initwithframe:frame]; [auibutton addtarget:property action:@selector(somemethod) forcontrolevents:uicontroleventtouchupinside]; it doesn't work , being newbie, couldn't seem understand why happening. i thought i've done correct (which apparently didn't couldn't figure out part had gone wrong). it great if can point out me i've gone wrong.

NullpointerException when using multiple @Before in Cucumber-jvm -

i using cucumber-jvm. i have init method initialize necessary stuff, such browser dimensions, application url etc. have put init method under @before (cucumber.api) tag. @before public void initloginpage() throws exception { getbrowserdimension(); setbrowsercapabilities(); init(getapplicationurl()); } my life fine running smoothly. now, wanted use @before tags @ scenario levels. scenario looks like: @mytag when blah should blah-blah and wanted use like: @before(@mytag) public void beforescenario(){ blah = true; } but moment give @before, starts giving nullpointerexception. tracked runbeforehooks , runhookiftagsmatch methods in cucumber's runtime class. throwing exception @before (for initloginpage()) itself. there conflict getting created multiple @before's? how can resolve this? i found solution working. problem of @before codes getting picked in random order. wasn't based on assumption @before without parameters executed before

javascript - Detect installation of firefox extension -

i developing firefox extension , need open new tab when user install add-on. i found solution in here opening page in firefox after installing addon using preferences. work problem after removing extension , installing again still need have new tab , it's not working preference because found no solution delete it. there extensions stumbleupon same thing . so question : there way detect installation of add-on? thanks why don't use preference value show new install tab @ first run, change preference false, , if uninstall it, instead of trying delete it, set true again. way if re install you'll show again. see reference install , uninstall scripts

java - In inheritance, when an object is created for subclass, is an object also created for its superclass? -

in inheritance, when object created subclass, object created superclass? find answer above question yes, created. right? based on assumption right, solved question , found answer 4. right? is long primitive type or wrapper class? question : when last brace reached, how many objects eligible garbage collection? interface animal { void makenoise(); } class horse implements animal { long weight = 1200l;//here long primitive variable or wrapper class?? //if wrapper class object, think answer // question 6 public void makenoise() { system.out.println("whinny"); } } public class icelandic extends horse { public void makenoise() { system.out.println("vinny"); } public static void main(string[] args) { icelandic i1 = new icelandic(); icelandic i2 = new icelandic(); icelandic i3 = new icelandic(); i3 = i1; i1 = i2; i2 = null; i3 = i1; } } in inheritance, when object created subclass, object

highstock - Live plot with multiple y axis in highcharts -

i have created live line chart multiple y-axis.on-click of legends,creating y- axis. here demo http://jsfiddle.net/ashwinp/j7lmp/3/ first thing, not showing scale values on each y axis,just showing title. second thing, i used linkedto -- > inheriting primary y axis. here demo http://jsfiddle.net/ashwinp/j7lmp/4/ here, want each y axis should have own scaling. should not inherit scaling primary y axis. y axis should scale depending upon value of own series. for example : series1 values falls between 1 100 may go beyond 100 time should auto scale. series2 : 200- 500 , series3: 600 1000 in case: yaxis1 min 1 , max 100 , y axis2 : 200-500 y axis3:600-1000 i used min , max , tick interval auto re-sizing when values goes beyond.used setextrem workaround solution. thanks in advance $(function () { $(document).ready(function () { rawdatachartwithmultiyaxis(); }); }); function addaxes(name, visiblity, index) { var chart = $('#

java - Getting HashMap associated with particular item in ListView -

i have listview showing items in arraylist fetched url in json format. each item consists of 5 elements. want pass elements associated particular list item when clicked activity. when pass arraylist other activity , iterate arraylist last item in list opens no matter list item click on. here code: mainactivity.java jsonarray jobject = new jsonarray(responsebody); (int = 0; < jobject.length(); i++) { jsonobject menuobject = jobject.getjsonobject(i); string title= menuobject.getstring("title"); string description= menuobject.getstring("bodytext"); string thumbnail= menuobject.getstring("thumbnailpath"); string nurl = menuobject.getstring("url"); string body = menuobject.getstring("body"); string nbigimage = menuobject.getstring("imagebloburls"); map = new hashmap<string,string>(); map.put(sourcetitle, title); map.put(title, description); map.put(thumbnailpath, thumbnail); map.put(b

How to import an Xtext Project from git in Eclipse? -

Image
i have xtext project in git repository. tried various ways import blank workspace. didn't succeed far. search google @ least 2 hours. found various tutorials how setup new xtext project in eclipse, not how import existing resources. the closest got far this: import > projects git > existing local repository > at least default xtext project , ui project imported. test project not recognized project -> not import far. the imported projects don't work. packages shown folders , don't have java compiler on buildpath. can please explain me how can import existing xtext project eclipse correctly? solution far copying friends workspace folder. can create new xtext project in eclipse, how can import existing project? more creator of xtext project has not included generated code git repository. however, results in possible problems: the end-user has execute mwe2 workflow of grammar manually after checkout; until expected have compile errors in p

c - Given a header file, Is there a way I can find out which library it belongs to? -

the source codes downloaded internet has lot of non standard, uncommon header files different depended modules, say. #include<calendar.h> or #include <vconf.h> given header file, there way find out files these headers fetched from? look @ documentation of lib header belongs may best way. you may header , note down function names , search through lib define symbol belongs function edit: ah thought have bunch of libs , headers , not know have link functionality declared in specific header in case looking @ documentation downloaded source code may way (mostly information in install or readme - file)

javascript - Drag and drop function matching images -

i made dropspot drag , drop function in div has image + dropspot unfortunately function doesnt work :( wrong ? http://jsfiddle.net/6tsfh/ $(function() { $( ".right img" ).draggable ({ revert: "invalid", helper: 'clone' }); $( "#dropspot0" ).droppable({ tolerance: 'fit', drop: function( event, ui ) { $(ui.draggable).clone().appendto($("#dropspot0")); } }); }); check jsfiddle i think jqueryui library not included in jsfiddle. $(function() { $( ".right img" ).draggable ({ revert: "invalid", helper: 'clone' }); $( "#dropspot0" ).droppable({ tolerance: 'intersect', drop: function( event, ui ) { $(ui.draggable).clone().appendto($("#dropspot0")); } }); });

windows - DELPHI: Store a some data in a shared memory to have an access from several apps -

problem defitintion have 2 applications: first , second . first mine, second developed outsource. 1) @ time need send message first app second , make second 1 visible , maximized, after has been minimized. 2) in order (1) step, second app should store handle somewhere in shared memory, accessed name or whatever might (like mutexes do). question so, better option store data (a handle) in operating memory? if want store information in shared place, typically use shared memory. in windows terms that's file mapping object. create 1 calling createfilemapping . these kernel objects , can named in kernel namespace. file mappings not whole lot of fun work with, might find easier solution. give application's main form unique class name. instance might name form's class tmycompanynamemyproductnamemainform . call findwindow passing class name find existing application window.

php - QUERY NOT EXECUTED IN SQL (WHERE CLAUSE) -

$coursearr = $this->query(' select courses.*,modules.* courses inner join student_courses on student_courses.student_id = "'.$student_id.'" , courses.id=student_courses.course_id inner join modules on modules.course_id=courses.id , courses.course_title "$search%" ; '); try this: $coursearr = $this->query('select courses.*,modules.* courses inner join student_courses on student_courses.student_id="'.$student_id.'" , courses.id=student_courses.course_id inner join modules on modules.course_id=courses.id courses.course_title "'.$search.'%"'); you using $search in ' single quotes. "semi colon" , "and" removed

gis - gdalwarp too slow (compared to gdal_merge) -

i have 70+ raster images in tiff format trying merge. originals can found here: http://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/vfr/ after pre-processing (pct2rgb, gdalwarp individual charts, gdal_translate cut collars) try run them through gdalwarp mosaic them using command this: gdalwarp --config gdal_cachemax 3000 -overwrite -wm 3000 -r bilinear -srcnodata 0 -dstnodata 0 -wo "num_threads=3" /data/aeronav/sec/c/albuquerque_c.tif .....70 other file names ...master.tif after 12 hours of processing: creating output file 321521p x 125647l. processing input file /data/aeronav/sec/c/albuquerque_c.tif. 0...10...20...30...40... this means gdalwarp never going finish. in contrast. gdal_merge command this: gdal_merge.py -n 0 -a_nodata 0 -o /data/aeronav/sec/master.tif /data/aeronav/sec/c/albuquerque_c.tif ......70 plus files..... finishes in couple of hours. problem gdal_merge inferior quality output because of "average" sampling.