Posts

android - Null pointer exception when setting values to TextView in Fragments -

i have 2 fragments in mainactivity, first one, user clicks on button , send through listener char second fragment, depends of char textview in second fragment must print text. in metho onactivitycreated textview null. this code: fragmentone public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); btnchefcito = (button)getview().findviewbyid(r.id.btnchefcito); btnchefcita = (button)getview().findviewbyid(r.id.btnchefcita); btnchefcito.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { welcomelistener.elegirsexo(sexo); replacefragment(); } }); btnchefcita.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { sexo="f"; welcomelistener.elegirsexo(sexo); replacefragment(); } }); } this second fragment @override public...

angularjs - Angular js - On scroll up load more data -

i have developed chatting system facebook. want load earlier messages. can me functionality when scroll should load earlier messages same facebook. you may want take @ nginfinitescroll . module, easy implement want. here example: <div ng-app='myapp' ng-controller='democontroller'> <div infinite-scroll='loadmore()' infinite-scroll-distance='2'> <img ng-repeat='image in images' ng-src='http://placehold.it/225x250&text={{image}}'> </div> </div> var myapp = angular.module('myapp', ['infinite-scroll']); myapp.controller('democontroller', function($scope) { $scope.images = [1, 2, 3, 4, 5, 6, 7, 8]; $scope.loadmore = function() { var last = $scope.images[$scope.images.length - 1]; for(var = 1; <= 8; i++) { $scope.images.push(last + i); } }; }); if using bower , can install if bower install nginfinitescroll.

java - How to build libprotobuf-lite.so -

i'm trying protobuf lib communicate between java , jni layer in android. source code guided here . added source file in jni>source_sirectory. if perform ndk-build generate .so file prompt following error log: [armeabi] sharedlibrary : libprotobuf-lite.so jni/src/google/protobuf/stubs/common.cc:201: error: undefined reference 'google::protobuf::util::status::tostring() const' jni/src/google/protobuf/stubs/common.cc:207: error: undefined reference 'google::protobuf::operator<<(std::ostream&, google::protobuf::uint128 const&)' jni/src/google/protobuf/arena.h:622: error: undefined reference 'google::protobuf::arena::allocatealigned(std::type_info const*, unsigned int)' jni/src/google/protobuf/arena.h:624: error: undefined reference 'google::protobuf::arena::addlistnode(void*, void (*)(void*))' jni/src/google/protobuf/arena.h:462: error: undefined reference 'google::protobuf::arena::addlistnode(void*, void (*)(void*))' jn...

java - Getting Memory Leak Errors on Server Stop (Eclipse, Hibernate, Spring) -

when undeploy wars (stop server on eclipse), following logs. of them pretty suspicious, more worried new worker #x ones too. using hibernate, spring (guice), c3p0 lib connection pools. ideas? 2015-09-20 23:05:04.442 [localhost-startstop-2] [] error o.a.c.loader.webappclassloader - web application [] registered jdbc driver [com.mysql.jdbc.driver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. 2015-09-20 23:05:04.442 [localhost-startstop-2] [] error o.a.c.loader.webappclassloader - web application [] appears have started thread named [forkjoinpool-2-worker-1] has failed stop it. create memory leak. 2015-09-20 23:05:04.443 [localhost-startstop-2] [] error o.a.c.loader.webappclassloader - web application [] appears have started thread named [abandoned connection cleanup thread] has failed stop it. create memory leak. 2015-09-20 23:05:04.443 [localhost-startstop-2] [] error o.a.c.loader.webappclassloader - web applicati...

spring - provide user defined value to scheduler at run time -

i have create xml file scheduler unable run time customization code. below xml file <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:task="http://www.springframework.org/schema/task" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"> <bean id="runmetask" class="com.spring.server.tasks.sharemetask" /> <bean name="runmejob" class="org.springframework.scheduling.quartz.jobdetailbe...

Java - Method executed prior to Default Constructor -

this question has answer here: are fields initialized before constructor code run in java? 4 answers i'm learning java , accidentally came across following code default constructor executed after method. public class chkcons { int var = getval(); chkcons() { system.out.println("i'm default constructor."); } public int getval() { system.out.println("i'm in method."); return 10; } public static void main(string[] args) { chkcons c = new chkcons(); } } output : i'm in method. i'm default constructor. can please explain me why happened? thanks. instance variable initialization expressions such int var = getval(); evaluated prior constructor execution. therefore getval() called before constructor executed.

c++ - Template argument deduction of string literal -

consider simple function template<typename t> void func(const t& x) {std::cout<< typeid(t).name();} now if call function func("ddd") , t deduces to? . if there no const in func 's parameter , t char [4] , whats confusing me addition of const , t deduces ? is : const char [4] . if change parameter t const &x (i.e change order of const ) deduction produces t char const [4] ? can explain argument deduction string literals? string literals arrays of const characters. a reference string literal of 4 chars of type char const (&)[4] . const char [4] , char const [4] same types! char const (&)[n] , const char [n] , char const [n] deduce char const [n] #include <iostream> template<typename t> void func1(t& x) {std::cout<< typeid(t).name()<<std::endl;} template<typename t> void func2(const t& x) {std::cout<< typeid(t).name()<<std::endl;} template<typename t...