Posts

java - LinearLayout cannot be cast to a class I've created -

java - LinearLayout cannot be cast to a class I've created - my exception: caused by: java.lang.classcastexception: android.widget.linearlayout cannot cast dismo.ufrj.br.bradmobile.headerclass i've created class, headerclass, extends linearlayout. cant seem cast right way.(header linearlayout) here's code headerclass = (headerclass) findviewbyid(r.id.header); the problem stated in error message: layout contains linearlayout , , effort cast own class. can't that. instead, need alter xml read: <dismo.ufrj.br.bradmobile.headerclass .... .... .... > .... </dismo.ufrj.br.bradmobile.headerclass> inheritance doesn't matter much here, since headerclass extends linearlayout , cast above xml linearlayout in code. java android android-layout android-linearlayout

c - File locking between threads and processes -

c - File locking between threads and processes - i have programme spawns multiple processes or threads, each of writes line on file, don't want line mixed up, need exclusive access file. more specifically, in first case, have process f spawns several kid processes (c1, c2, c3, c4, ...), , want block access f, c2, c3, c4, ... when c1 writing. in sec case, have same process f spawns several threads (t1, t2, t3, t4, ...) and, again, want block access f, t2, t3, t4, ... when t1 writing. i'm guessing function flock() takes care of first part, threads case? , windows platform? you can utilize locking mechanism want. between threads, mutex simplest. access file protected mutex, no 2 threads seek write file @ same time. for processes, can utilize process-shared mutex. on windows, can utilize named mutex. c windows multithreading unix locking

javascript - Add class with a particular div -

javascript - Add class with a particular div - i have div <div class="newdiv"> it generating in loop, like <div class="newdiv"> <div class = "innerdiv"> somecode </div> </div> <div class="newdiv"> <div class = "innerdiv"> somecode </div> </div> <div class="newdiv"> <div class = "innerdiv"> somecode </div> </div> now want add together class "brightdiv" div generated @ odd places like with first , 3rd div. what should add together class "brightdiv" along "newdiv" every div @ odd place? try : can utilize :odd or :even select odd / elements, depend on index position , not natural number count. in case, want first , 3rd position div i.e. index= 0 , 2 index position , hence utilize :even . $('div.newdiv:even').addclass(...

timeout - How do I have 'brew install most' use a different ftp address since the current one times out? -

timeout - How do I have 'brew install most' use a different ftp address since the current one times out? - i'd install most brew . i've tried recently, ftp address timing out, , i'm not sure how tell brew utilize different location retrieve source. how can tell brew utilize different url when attempts download most-5.0.0a.tar.bz2 lib? if type in brew edit most , it'll open text editor url. editing , saving file results in brew installing new url. as can see in example, url download location changed accordingly: # changed url ftp:// notrealftp://..... $ brew edit $ brew install ==> installing ==> downloading notrealftp://space.mit.edu/pub/davis/most/most-5.0.0a.tar.bz2 curl: (1) protocol notrealftp not supported or disabled in libcurl error: failed download resource "most" download failed: notrealftp://space.mit.edu/pub/davis/most/most-5.0.0a.tar.bz2 timeout homebrew

C program to split char using strtok and strchr -

C program to split char using strtok and strchr - i have next c programme split char* its user entred value in format "111/222". (code produce right output) in cases , value entered "/222". char* ptr ="/222" ; char* val1 , *val2; val1 = strchr( ptr, '/'); if ( val1 != null) val1++; val2 = strtok(ptr,"/"); myoutput : val1 = 222 val2 = 222 i dont know how get val1 = "" (as empty char) val2 = 222 thanks in advance ur help! the easiest way check if string start / or not. if then, set val1 "" , val2 have point (ptr + 1). else currently c

build - Custom Makefile With Eclipse CDT -

build - Custom Makefile With Eclipse CDT - i have c++ project 3 .hpp files , 1 .cpp file, , custom makefile. code , makefile project existed, right clicked in project explorer, , did import->existing code makefile project named project , pointed location root dir of project contains of files. , selected mingw gcc toolchain because compiler have. went project->properties->c/c++ build , unchecked generate makefiles automatically then changed build directory choosing file system , navigating root directory of project contains of files. build directory c:\users\ryan\desktop\school\cse\cse 100\pa1-rbridges then changed build command make -f c:\users\ryan\desktop\school\cse\cse 100\pa1-rbridges\makefile bst bst target in makefile , makefile @ location. when click hammer on toolbar build project, nil happens. when seek run project, launch failed: binary not found. i want project utilize makefile , build properly. have searched google , stack overflow hours trying figur...

javascript - how to pass an array elements to log set of parameters in one line -

javascript - how to pass an array elements to log set of parameters in one line - once upon time advertisement assignment task on 1 of interviews hasn't been giving me sleep since: need log arguments -object in console in 1 line date in end. objects(to able inspect those), not string( array prototype.join() - not solution in case) a fail attempt(out of function scope): var fn = function () { var arr = array.prototype.slice.call(arguments); arr.push(new date().tojson()); function.prototype.call.apply( console.log, arr ); } fn( 1, 'a', [2, 3], {a:1} ); logs: uncaught typeerror: illegal invocation any ideas? use logging function.prototype.call.apply( console.log.bind(console), arr ); instead of function.prototype.call.apply( console.log, arr ); it work. javascript arguments prototype