Posts

java - when and how will ImageIO.write throw nullpointerexception? -

in imageio.write(renderedimage,string,file) method, imageoutputstream created through stream = createimageoutputstream (output);. in createimageoutputstream runtime exception caught , returns null catch block. try { iter = theregistry.getserviceproviders(imageoutputstreamspi.class,true); } catch (illegalargumentexception e) { return null; } can me understand: what reason behind catching runtime exception here?(unless crappy coding) on condition, code throw illegal argument exception? (i dont see reason throw) please help. it case of code has evolved on time , no 1 cared clean up, or implementers of imageio relied on contract of serviceregistry , rather implementation details of it. in current implementation of imageio , serviceregistry don't see how ever happen. the thing can see it, potentially change implementation of iioregistry or serviceregistry lazy loading of categories example, or perhaps flush...

Load Joomla 3.x Framework and Modules in external PHP file -

i migrating joomla 2.5 site joomla 3.3. now i'm struggling loading joomla framework , displaying module in phpbb-template. loading joomla framework worked fine in joomla 2.5 code: define( '_jexec', 1 ); define('jpath_base', '/var/customers/webs/tf2swiss/joomlasite'); define( 'ds', directory_separator ); require_once('../configuration.php'); require_once ( jpath_base .ds.'includes'.ds.'defines.php' ); require_once ( jpath_base .ds.'includes'.ds.'framework.php' ); require_once ( jpath_base .ds.'libraries'.ds.'joomla'.ds.'factory.php' ); require( jpath_libraries. '/import.php'); // joomla! library imports jimport( 'joomla.environment.uri' ); jimport( 'joomla.user.user'); jimport('joomla.application.module.helper'); /* create application */ $mainframe =& jfactory::getapplication('site'); jimport('joomla.plugin.helper'); but doesn...

eclipse - CVS How to remove a part of a commit -

i made commit , mistake (#%&* mousepad right click) included couple of generated folders in commit, is there way undo commit step partially? i not after ignoring folders, folders have been added .cvsignore, i'm after solution allow me undo commit of 2 folders (images , test-data) keep rest of commit. adding .cvsignore have been option if not reason that, mentioned, folders added, selecting files individually or adding wildcards going painful, since there folders within folders... thanks in advance ;) if can acces cvs repository have delete files want delete in cvs tree repository (not on working copy). might work, tested , works: when checked out without ignore , cvs downloaded files didn't removed on repository. if don't have acces repository: i'm not sure 100% way found solve issue revert commit, how revert it? cvs update -j <current rev> -j <old rev> <filename> then have commit instead of missclicking , done. sorry e...

C/C++ - Why is the heap so big when I'm allocating space for a single int? -

i'm using gdb see effects of low level code. right i'm doing following: int* pointer = (int*)calloc(1, sizeof(int)); yet when examine memory using info proc mappings in gdb, see following after presume .text section (since objfile shows name of binary i'm debugging): ... start addr end addr size offset objfile 0x602000 0x623000 0x21000 0x0 [heap] how come heap big when did allocating space single int? the weirdest thing is, when i'm doing calloc(1000, sizeof(int)) size of heap remains same. ps: i'm running ubuntu 14.04 on x86_64 machine. i'm compiling source using g++ (yes, know shouldn't use calloc in c++, test). how come heap big when did allocating space single int? i did simple test on linux. when 1 calls calloc glibc calls @ point sbrk() memory os: (gdb) bt #0 0x0000003a1d8e0a0a in brk () /lib64/libc.so.6 #1 0x0000003a1d8e0ad7 in sbrk () /lib64/libc.so.6 #2 0x0000003a1d87da49 in __defaul...

Android - Refresh/restart all tab fragments when selected/reselected -

once again, following tutorial: androidhive - tab layout swipe able views . 3 fragment tabs loaded different information , logic , layouts. refresh each fragment when tabs have been clicked auto loads fragments start uses view pager. there simplest way out load a/1 fragment using view pager? or reload fragments? help! try add viewpager: my_viewpager.setoffscreenpagelimit(0); check out documentation . pages beyond limit recreated adapter when needed. the limit of 0 cause recreation of fragment when open tab.

Decrease iOS Application size to App Store -

i trying submit application in app store, , need decrease memory little bit, if possible. tried method gonna describe below make app lighter, not luck. details i followed these steps see causing large size make archive of project distribute save enterprise or ad-hoc deployment select .ipa file , changed extension .zip extract it, , open payload show package contents contents i had .png files 680 kb (when added 32 kb approximately), deleted them , reduced size of application 2 mb . there other files take space not considerably, except 1 executable file taking 90 % of .ipa's size. question is possible decrease executable file's size? if not can give me hint should make app lighter in terms of size. p.s use third party libraries vuforia sdk , libraries on github how can reduce size of executable file you cannot reduce size of executable inside built app bundle. code! ways reduce size are: cut code. can't because exclude functio...

c - Why does ptrace not recognize the function? -

i can't figure out why function returns "no such process" error message every time run it, using same instructions inline produces required output. #include <sys/ptrace.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/user.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> void getregs(pid_t proc, struct user_regs_struct *regs); int main() { pid_t proc = fork(); if(proc == 0) { if(ptrace(ptrace_traceme, 0, null, null) == -1) { perror("traceme"); exit(0); } if(execl("child", "child", null) == -1) { perror("execl"); exit(0); } } else { wait(&proc); struct user_regs_struct regs; ptrace(ptrace_getregs, proc, null, &regs); ...