Posts

Showing posts from April, 2013

html - Two-Column Layout - Divs Leave Extra Space -

firstly, i'd don't want javascript. http://jsfiddle.net/wqrby/2/ in jsfiddle, i've got 2 columns bottom right div aligned bottom left. i'd able (without adjusting markup) move bottom right div under top right (just how bottom left under top left). i don't want change markup because order of divs important when switches one-column layout smaller screen sizes. can me out here? i'm going preface saying i'm not sure why works... i'm going keep fiddling test it. comments welcome. here's fiddle edit: i know mentioned don't want 'change' markup because of div ordering. open adding markup? shouldn't change order of information, might simple fix you're trying do: http://jsfiddle.net/tracyfu/wqrby/7/

java - Will inheritance break encapsulation? -

let's have csv file , create class called csvfile extends java.io.file . class can parse csv file , return data how many columns in file. can used functions takes java.io.file input. f ileutils.copyfile(file from, file to) . my colleague thinks expose inheritance. idea wrap java.io.file holding in private property, instead of inheriting it. think exposing public method/property file breaks encapsulation, take benefit since functions in java.io.file free. what think? i rather agree colleague: inheriting java.util.file expose methods not applicable csvfile objects, such list() , listfiles() , setexecutable() , , on. making java.util.file property behind getter sounds better choice: not reveal irrelevant operations users of class, , lets inherit base class of choice.

extension_dir not being picked from PHP.INI: PHP 5.3.5 not getting configured on Apache 2.2.22 For Zend 1.11.11 on Windows Ultimate 7 -

i trying configure php 5.3.5, apache 2.2.22, zend 1.11.11 on windows 7 ultimate 64 bit having service pack 1. have consulted many sites , have applied ideas still cannot configure mysql adaptor zend. php.ini file not getting correctly configured because extension_dir need direct correct location adapter dll available , get: the mysql driver not installed following actions have taken far: changes in httpd.conf (apache) loadmodule php5_module c:/php/php5apache2_2.dll phpinidir "c:/php" - tried, 'c:/php', c://php upper case , backslashes combination docaumentroot "e:/personel/mics/libraryprj/public/" <directory /> #options followsymlinks ::commented out manually #allowoverride none::commented out manually #order deny,allow ::commented out manually #deny ::commented out manually options allowoverride </directory> addtype application/x-httpd-php .php addtype applicati...

ios - IPad Split View Implement in Another View -

i creating ipad app , has several views load data,but 1 view need add split view. dont need split views in other views. detail pages. search through net , found lots of tutorials based on ipad split view. problem creating project split view project or create window base app , add slipt view delegate. dont need that, need implement split view 1 view. there way overcome problem? you can add split view inside navigation controller. if split view container view controller , apple recommends in documentation containers should not embedded in other containers, adding split view inside navigation controller works correctly , never noticed side effect in doing it. basically should is: - in app delegate create uinavigationcontroller , use root view of application window - hide navigation controller navigation bar if don't want see (showing split view main navbar on top not nice looking...) - add view controllers inside navigation bar. example: imagine have application views...

xcode - edit an attribute in core data -

here code edit particular attribute , save sqlite db can't save changes db. -(void)changememberkey { nsentitydescription *entitydesc=[nsentitydescription entityforname:@"table1" inmanagedobjectcontext:context]; nsfetchrequest *request=[[nsfetchrequest alloc] init]; nspredicate *predicate=[nspredicate predicatewithformat:@"(member_id=null)"]; [request setpredicate:predicate]; [request setentity:entitydesc]; table1 *matches; nserror *error; nsarray *objects=[context executefetchrequest:request error:&error]; nslog(@"object count===%d",[objects count]); for(int i=0;i<[objects count];i++) { matches=[objects objectatindex:i]; table1 *data=(table1 *)matches; nslog(@"data before===%@",data); [data setvalue:memberkey forkey:@"member_id"]; [context save:&error]; nslog(@"data after====%@",data); data=nil; } entitydesc=nil; request=nil; matches=nil; error=...

Installed Software/Plugins On Eclipse Has Stopped Working -

i have eclipse ide java developers (indigo) , have been using several months. had many installed plugins including svn 1 , e-git. then 1 day, stopped working. example, used able commit explorer (using svn plugin), option has disappeared if not installed. i have checked installed software list , present. is there setting somewhere may have miss? thanks in adavnced! please check error log in workspace/.metadata/.log see if there warnings or errors. also, have tried other perspectives, plug-in development, or svn.

spring - Is it possible to Split an ehcache config file? -

i'm writing jar intended used spring , ehcache. spring requires there cache defined each element, planning have ehcache defined jar, preferably resource in jar imported primary ehcache configuration app. however, reading of example ehcache config file , google searches have not turned way import sub ehcache config file. is there way import sub ehcache config file, or there other way solve problem? what did similar (replace placeholders in ehcache xml file - import statement more or less placeholder if will) extend (more or less copy honest) springs ehcachemanagerfactorybean , create final ehcache xml config file on fly. for creating cachemanager instance in afterpropertiesset() hand on inputstream points config. @override public void afterpropertiesset() throws ioexception, cacheexception { if (this.configlocation != null) { inputstreamsource finalconfig = new yourresourcewrapper(this.configlocation); // put custom logic here inputstr...

Is it safe to use Google Analytics in a private/secure Rails App? -

i built private/secure web app in rails , have beta users on it. use type of analytics track concurrent users on site, time on site, frequency, , features/parts of app using. google analytics great hesitant use because i'm not sure how private information , if compromise security of web app - passwords , other sensitive information submitted via forms, stored in database, , viewed users. i'm curious other private, web-based apps using. thanks. if need details on how google analytics handle data should read google privacy center page. the short answer wouldn't worry using google analytics in app.

php - Index and Variable errors -

i'm noob php/mysql programming , had form working when got new computer won't work. html form send results php page kicks wamp mysql database. said, had working beautifully , got new machine, reinstalled wamp, copied on database , info, , gives me nothing notices , if add die(mysql_error()) end ot $sql - ("select..... before, gives me cannot connect error. <?php $q=$_get["q"]; $con = mysql_connect("localhost","root","password"); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db("kalen_qc", $con); $sql = ("select `id` `users` `username` = ' " . $root . " ' , `password` = ' " . $password . " ' limit 1"); //retrieve data sql query string $cname = $_get["cname"]; $job = $_get["job"]; $apptype = $_get["apptype"]; $priority = $_get["priority"]; $daterec = $_get["daterec"]; $datereq = $...

apache - Property cmis:parentId is only defined for folders -

i'm writing cmis interface application. interface returns cmis:document object child of cmis:folder object. here a part of xml output . the cmis:document object has cmis:parentid property. i'd validate cmis:document object apache chemistry workbench . workbench tool tells me: property cmis:parentid defined folders. why property not allowed document? how can document reference parent? the property cmis:parentid not defined cmis:document objects because document can have none, 1 or multiple parents. to parents of document you have call getobjectparents() . you can, of course, deliver parent id(s) in property doesn't use reserved namespace cmis: , repository specific , generic cmis clients ignore it.

javascript - Add a character to the beginning and end of a string -

i using platform uses javascript-like syntax , allows convert values using regex. i need add single quote @ beginning , @ end of string, string have 9 characters. i.e.: 123456789 should converted '123456789' what expression should use? you don't need regular expression. str = "123456789"; str = "'" + str + "'";

perl - Writing the output of an SSH command to a file -

using net::openssh module, how can connect host , subsequently capture/write output of command file has been created? this command: ps -ef | grep jboss | grep java i have following perl script far.. open path,">","./report/archive/rpet-$now/path.txt" or die "unable create file: $!"; $ssh = net::openssh->new( $host, user=>$username passwd=>$password ); print path "ssh output go here"; close path; so best way run command , print output? in advance! did @ documentation (https://metacpan.org/module/net::openssh)? it's in synopsis. print path $ssh->capture('command'); though print error conditions too. capture works in both scalar , list context.

zipcode - lightweight python library to query city/state name by zip code? -

pretty simple here, i'm looking lightweight library allow me lookup city/state pairing given zip code. using django fwiw. in advance. try pyzipcode . example home page: >>> pyzipcode import zipcodedatabase >>> zcdb = zipcodedatabase() >>> zipcode = zcdb[54115] >>> zipcode.zip u'54115' >>> zipcode.city u'de pere' >>> zipcode.state u'wi' >>> zipcode.longitude -88.078959999999995 >>> zipcode.latitude 44.42042 >>> zipcode.timezone -6

ios - What could be causing this code to NOT allow re-entry into springboard? -

Image
i have app uploads images bunch of places @ once, kinda instagram style. it setup nsoperationqueue runs bunch of nsoperation wrappers around an asynchronous nsurlconnection . most questions begin end in "the callbacks don't called because calling thread joined before return. not kind of question. am getting callbacks expected, somehow preventing app backgrounding when home button pressed. thought not able blocked @ due sandboxing, somehow have done it. pressing home button while operations running nothing until complete, @ point (20-30sec later) app backgrounds. **nb seems happen on single core processor devices. can reproduce on iphone 4, not 4s or ipad 3.* still interested? here setup: self.uploadqueue = [[nsoperationqueue alloc] init]; [self.uploadqueue setmaxconcurrentoperationcount:1]; [self.uploadqueue setsuspended:yes]; later on, add operations queue , unsuspend start. here code nsoperation subclasses: - (bool)isconcurrent { return yes; } - (bool)...

css - using php to add classes to li then alternate after every third item? -

this may stupidly simple i'm trying figure out way add class unordered list, alternate class after every third item.. i've mananged add class on every third item (which not want), here's code: <?php $i=1; foreach($this->items $item) : ?> <li class="<?php if ($i % 3 == 0) : ?>odd<?php endif; ?>"><a href="<?php echo $linky; ?>">xxx</a></li> <?php $i++; endforeach; ?> which spits out: <li class="">xxx</li> <li class="">xxx</li> <li class="odd">xxx</li> <li class="">xxx</li> <li class="">xxx</li> <li class="odd">xxx</li> but i'm hoping is: <li class="odd">xxx</li> <li class="odd">xxx</li> <li class="odd">xxx</li> <li class="even">xxx</li> <li class="eve...

ruby on rails 3 - will_paginate not working with arrays -

i've added # config/initializers/will_paginate_array_fix.rb require 'will_paginate/array' but still not seem getting pagination support arrays, eg: def index @array = (1..100).to_a.paginate(params[:page]) end # gives typeerror: can't convert symbol integer it works fine models, , get defined? willpaginate # => constant activerecord::base.respond_to? :paginate # => true # but: array.respond_to? :paginate # => false anyone know missing pagination support arrays? found answer looking @ source code in will_paginate/array: def paginate(options = {}) page = options[:page] || 1 per_page = options[:per_page] || willpaginate.per_page total = options[:total_entries] || self.length willpaginate::collection.create(page, per_page, total) |pager| pager.replace self[pager.offset, pager.per_page].to_a end end so arrays, have use .paginate (not .page), , have pass hash. following works: def index @array = (1..100).to_a.p...

android - Enumerating folders and files using Google Drive SDK V2 -

i little confused v2 google drive sdk . there seems 2 methods retrieve information files , folders. files.list , children.list using files.list not seem able narrow search files in specific folder using children.list returns basic file information such id. there no filenames. it looks have retrieve list of children , perform request each child find out filename seems inefficient. what normal\correct way enumerate folders , contents using google drive? alternative approach use files.list query expression limit parent. q='id-of-parent' in parents this give same results child collection, full metadata each item.

iis 7.5 - ASP.NET Web API returns 404 for PUT only on some servers -

(cross post server fault. realised afterwards should have asked on stackoverflow first) ok, have been racking brain , internet solution this. can't figure out. i have written site uses asp.net mvc web api , working nicely until put on staging server. site works fine on local machine , dev web server. both dev , staging servers win server 2008 r2. the problem this: site works, there api calls use http put method. these fail on staging returning 404, work fine elsewhere. the first problem came across , fixed in request filtering. still getting 404. i have turned on tracing in iis , following problem. 168. -module_set_response_error_status modulename iis web core notification 16 httpstatus 404 httpreason not found httpsubstatus 0 errorcode 2147942402 configexceptioninfo notification map_request_handler errorcode system cannot find file specified. (0x80070002) the configs same on dev , staging, matter of fact whole site direct copy. why gets , posts work,...

c# - ASP.NET MVC Route: bypass staticfile handler for path -

i've been googling , tinkering couple hours , haven't made progress, here can help. i'm trying requests path handled 3rd party component. edit , need requests other paths behave normally. i'm using route handler wildcard mapping this: routes.add(new route("pathiwant/{*everythingelse}", new myroutehandler())); all traditional routes forward correctly handler, forwards nicely 3rd party component. when hit static files (.html, .txt, etc.), picked staticfile handler instead of handler, i'm attempting turn off staticfile handler (simplified): <system.webserver> <handlers> <remove name="staticfile"/> </handlers> </system.webserver> this turns off staticfile handler, mvc still doesn't pick route. i'd prefer not fall on creating own handler , injecting asp request stack since seems there should mvc-happy way this. any thoughts? , thanks. there couple options here. http://ww...

android - How do I replace the fragment from one of the tabs in a TabAdapter? -

Image
while realize nested fragments not option still have issue cannot figure out answer to. i'm using actionbarsherlock's fragmentstabpager example create interface possible page through tabs swiping rather clicking on tabs. problem 1 of these tabs consists of listview. when listview clicked, different fragment containing new list(with data based on item clicked) launched. how accomplish ? i figured might need bit of cose baseactivity(the 1 viewpager , tabsadapter *snippet* public class baseactivity extends sherlockfragmentactivity { tabhost mtabhost; viewpager mviewpager; tabsadapter mtabsadapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.fragment_tabs_pager); mtabhost = (tabhost)findviewbyid(android.r.id.tabhost); mtabhost.setup(); mviewpager = (viewpager)findviewbyid(r.id.pager); mtabsadapter = new tabsadapter(this, mtabhost, mviewpager); mtabsadapter.ad...

c++ - Gettin line number of the called function -

please let me know if can or not? i writing library work track memory allocation , de-allocation in c++. in short, trying see if application not have memory leaks. did far. overrode new , delete operator , now. whenever application uses new, planning store address , number of bytes allocated in call. similarly, when delete called on address, remove stored list. until fine. want store file name , line number "new" called. can in overridden new. there way line number in overridden function? 1 int main() 2 { 3 // say, structure 4 *a = new a(); 5 return 0; 6 } 7 void* operator new( size ) 8 { 9 // 10 // store line number , file name on line 4 ??? can it? 11 return (malloc(size)); 12 } ------------------------ the macros __line__ gives line number __function__ , __file__ helpful, giving const char* of enclosing function, , file name. edit: ( __function__ not standard supported several compilers) unfo...

c++ - Passing Socket to Thread C -

i'm trying make network system using udp. i've managed working, want put listening part in separate thread can continue program without having wait messages (it's going used game). the problem when pass socket new thread , use listening doesn't work , receives random input constantly. when use exact same code in method initialize socket, works fine. this works: bool serverudp() { wsadata w; socket sd; struct sockaddr_in server, client; char buffer[default_buflen]; int bytes_received; int client_length; /* open windows connection */ if (wsastartup(makeword(2,2)/*0x0101*/, &w) != 0) { fprintf(stderr, "could not open windows connection.\n"); return false; } /* open datagram socket */ sd = socket(af_inet, sock_dgram, 0); if (sd == invalid_socket) { fprintf(stderr, "could not create socket.\n"); wsacleanup(); return false; } /* clear out server struct */ memset((void *)&server, '\0', sizeof(struct sockaddr...

junit - Unit testing remote EJB bean with security -

this question similar java ee declarative security, acquiring reference secured bean application client more specific. i can unit test local beans glassfish embedded container. remote beans have written application clients. viable solution until security applied @ remote beans. encountered problem of authenticating application client towards glassfish 3.1.1. the phenomenon: testing remote bean without security application client right. the approach use security application of programmaticlogin not work , not sure correct way solve issue in unit tests. (see attached link @ beginning.) question: how think unit testing security remote beans should done? where 1 need place glassfish-ejb-jar.xml? (maybe erronous in case , reason programmaticlogin not work.) i continued search more information on internet , encountered following blog: http://www-02.imixs.com/roller/ralphsjavablog/entry/junit_and_glassfish_3_1 . it answers how test ejb 3.1 on glassfish 3.1.1 w...

ios - Asynchronous image loading in a uitableview -

i'm integrating facebook in application , i'm @ point i'm loading profile pictures of friends of loggedin user. i'm presenting these users in uitableview, in each cell picture , name of friend. i've subclassed uiimageview , when corresponding cell handled in cellforview method, image loaded asynchronously. however, when scroll , down several times, image flickering, first wrong pictures loaded, displayed short time , right image loaded. think have way stop loading of image when cell outside view. is there can me problem , give me solution? thanks in advance! you consider not reusing cells. could, however, impair performance if have lot of table cells need loaded (e.g., lot of friends). since every cell has own image, flickering won't occur because of cell reusing. another thing @ file size of images. chances they're bigger size you're showing them at. if there's way smaller version, help, too. third, can set image view default ...

apache - How to redirect C:/xampp/htdocs/myfolder to C:/somewhere_else? -

i installed xampp , have apache server running. files located on c:/xampp/htdocs , acessible www.mydomain.etc, www.mydomain.etc/foo read c:/somewhere_else instead. how possible? enable mod_alias , add httpd.conf: alias /foo c:/somewhere_else

How can I have list of all users logged in (via spring security) my web application -

i'm using spring security in web application, , want have list of users logged in program. how can have access list? aren't kept somewhere within spring framework? securitycontextholder or securitycontextrepository ? for accessing list of logged in users need inject sessionregistry instance bean. @autowired @qualifier("sessionregistry") private sessionregistry sessionregistry; and using injcted sessionregistry can access list of principals: list<object> principals = sessionregistry.getallprincipals(); list<string> usersnameslist = new arraylist<string>(); (object principal: principals) { if (principal instanceof user) { usersnameslist.add(((user) principal).getusername()); } } but before injecting session registry need define session management part in spring-security.xml (look @ session management section in spring security reference documentation ) , in concurrency-control section should set alias session re...

Updating Canvas content on onmouseover and onmouseout -

i'm working on creating game using html5 , in work i'm update canvas content based on onmouseover , onmouseout . on onmouseover i'm doing cxt.beginpath(); cxt.moveto(10, 10); cxt.lineto(40, 40); cxt.moveto(40, 10); cxt.lineto(10, 40); cxt.stroke(); cxt.closepath(); content[canvasnumber - 1] = 'value'; now , on onmouseout event want clear content of canvas without overriding current content !!, how can ?! i think know mean, have little more careful language. say: without overriding current content !! but x drew is current content! think meant "without clearing content there before". of course we'll try our hardest answer questions, please try hard use exact , careful language when asking them. english might not first language, , speak better speak second language, if y...

c# - Resourcemanager is returning same resource, although CultureInfo is specified -

a simple thing, , can't work. want globalise dll i'm using resource files + resourcemanager. i call resourcemanager this: var p = new resourcemanager("appname.default", assembly.getexecutingassembly()); get strings this system.diagnostics.debug.writeline(p.getstring("greeting")); system.diagnostics.debug.writeline(p.getstring("greeting", new cultureinfo("nl"))); system.diagnostics.debug.writeline(p.getstring("greeting", new cultureinfo("nl-nl"))); system.diagnostics.debug.writeline(p.getstring("greeting", new cultureinfo("en"))); and returns 4 times same string. files called default.resx default.en.resx default.nl.resx default.nl-nl.resx all file settings same, mentioned - resource in default file used. what overlooking here? there few ways of using resource files, 1 of using .resx files. these files localized automatically, based on value of thread.currentthread.cur...