Posts

reactjs - How to create helper file full of functions in react native? -

though there similar question failing create file multiple functions. not sure if method outdated or not rn evolving fast. how create global helper function in react native? i new react native. what want create js file full of many reusable functions , import in components , call there. what have been doing far might stupid know ask here are. i tried creating class name chandu , export this 'use strict'; import react, { component } 'react'; import { appregistry, text, textinput, view } 'react-native'; export default class chandu extends component { constructor(props){ super(props); this.papoy = { : 'aaa' }, this.hellobandu = function(){ console.log('hello bandu'); }, } hellochandu(){ console.log('hello chandu'); } } and import in required component. import chandu './chandu'; and call console.log(chandu); console.log(chandu.hellochandu); console.log(chan...

python - Registering SIGINT/SIGQUIT signals in a Django application served in Docker -

i've got django application queue system (that builds releases various developers) needs completed. however, towards end of day, need shut down running builds should not terminated. achieve this, thought can catch termination signals (like sigint/sigquit/sigterm) application can wait releases complete , shut system down then. i have following signal registering system: import time, sys, signal def signal_handler(signum, frame): print('waiting releases complete') time.sleep(5) print('terminating gracefully...') sys.exit(0) sig in [signal.sigterm, signal.sigint, signal.sigquit]: signal.signal(sig, signal_handler) when run django's development server command line code snippet, registers signal , trigger handler function. problem application runs on docker nginx , uwsgi in place. when run container, registers signal when stop docker container, sigint/sigquit signal caught uwsgi, not python , signal handler not triggered. i'm rel...

web services - How can I make the url configurable in the ksoap Android-studio? -

i want configurable url , , user can change running application public string namespace ="http://tempuri.org/"; public string url; // **how can make url configurable** public int timeout = 60000; public iwsdl2codeevents eventhandler; public soapprotocolversion soapversion; i try session variable , external file, , sqlite when trying call process , tell parameter method , give value url extracting database , application stops. this geturl public string geturl() { string url = null; sqlitehelper sql = new sqlitehelper(voceo.this, "servicioweb", null, 1); sqlitedatabase bd = sql.getwritabledatabase(); cursor fila = bd.rawquery(" select url direcciones idurl= 0", null); if (fila.movetofirst()) { url = fila.getstring(0); } bd.close(); return url; } and when try call him public vectorstring obtenerpuertas(list<headerproperty> headers){ soapserializationenvelope soapenvelope = new soaps...

java - Cobertura shows 0% coverage for instrumented WAR in Tomcat -

we bunch of automated testing against deployed java web application (in addition unit testing) , track code coverage of these tests. app written in java , runs on tomcat. use cobertura track coverage our unit tests i’d stick cobertura. i’ve instrumented our war , able generate reports coberura.ser file show 0% coverage. here steps i’m following: build jar , war in normal process (no instrumenting). our application classes packaged jar file placed in lib director of war deploy. unpack both jar , war rebuild again time instrument classes. copy instrumented classes in unpacked jar directory. i’m doing because instrumenting not seem output class files things not have runnable code (like interfaces). build jar unpacked jar directory add new instrumented jar , cobertura.jar lib directory of unpacked war directory , build war that. add new instrumented war , coberturaflush.war tomcat webapps directory add cobertura.ser (that generated during instrumentation) tomcat bin di...

android - Force main activity to show every time app is loaded -

i want main activity show every time after home screen pressed , app opened again. my layout is: main screen --> menu page --> sub menu i want able use button go sub menu menu page. however, regardless of page on when home screen pressed want show main screen when app reopened. have tried onfinish() in java class menupage. causes return button close app because previous activity finished. have researched how can detect if home button pressed finish activity way seems that's not option. know way around this? to control presses, can direct each activity or fragment go wherever on press overriding backpress event. @override public void onbackpressed() { // } to handle backpress , state fragments, advisable manage stack. providing proper navigation i use custom home button on apps when want user able go straight main activity. public void gohome() { startactivity(new intent(this, mainactivity.class)); } edit this part of original answer, ...

c# - Why does Resharper offer to "Remove Unreachable Code" here? -

inspecting project i've inherited resharper, first suggested wrap this: if (cellrng != null) ...around code, cellrng acted on if it's not null. after doing that, tells me "if block" code not reachable, anyway. here code in context: if (cellrng != null) { cellrng.font.bold = true; cellrng.value2 = ave.tostring(cultureinfo.invariantculture); cellrng.numberformat = "##0.00"; cellrng.horizontalalignment = xlhalign.xlhaligncenter; . . . } how can code both reference possibly null object (cellrng) , then, after check implemented, turn out null (code runs if not null considered unreachable)? in second line below, resharper offers remove code, saying, "expression null" cellrng = _xlsheet5.cells[rowidx, colcnt] range; if (cellrng != null) but how that? how range assigned cellrng seen null? the code in if block following code above tagged resharper "code heuristically unreachable" what czech!?!?!

api - Official way to fetch the number of tweets for a URL -

twitter has private endpoints one: http://urls.api.twitter.com/1/urls/count.json tweet counts can fetched here, not recommended twitter. besides, keep saying gonna shut down these endpoints in near future. the site streams api in closed beta, don't accept applications. https://dev.twitter.com/streaming/sitestreams so leaves 1 option, rest api, don't see endpoint there return number of tweets given url. what's best way data? there "official" endpoint this? or way use public stream api or rest api search endpoints , filter results? the private endpoint shut down 20 nov , there'll nothing replace it. this blog post twitter explains background: apparently it's move new "real-time, multi-tenant distributed database" system codenamed manhattan. the rest api of limited use purpose. you'd have search url, collect each page of results , add total number of tweets yourself. example request https://api.twitter.com/1.1/sea...