Posts

Showing posts from June, 2012

regex - php sentence boundaries detection -

i divide text sentences in php. i'm using regex, brings ~95% accuracy , improve using better approach. i've seen nlp tools in perl, java, , c didn't see fits php. know of such tool? an enhanced regex solution assuming care handling: mr. , mrs. etc. abbreviations, following single regex solution works pretty well: <?php // test.php rev:20160820_1800 $split_sentences = '%(?#!php/i split_sentences rev:20160820_1800) # split sentences on whitespace between them. # see: http://stackoverflow.com/a/5844564/433790 (?<= # sentence split location preceded [.!?] # either end of sentence punct, | [.!?][\'"] # or end of sentence punct , quote. ) # end positive lookbehind. (?<! # don\'t split after these: mr\. # either "mr." | mrs\. # or "mrs." | ms\. # or "ms." | jr\. # or "jr." | dr\. ...

java - Using scanner.nextLine() -

this question has answer here: scanner skipping nextline() after using next(), nextint() or other nextfoo()? 12 answers i have been having trouble while attempting use nextline() method java.util.scanner. here tried: import java.util.scanner; class testrevised { public void menu() { scanner scanner = new scanner(system.in); system.out.print("enter sentence:\t"); string sentence = scanner.nextline(); system.out.print("enter index:\t"); int index = scanner.nextint(); system.out.println("\nyour sentence:\t" + sentence); system.out.println("your index:\t" + index); } } example #1: example works intended. line string sentence = scanner.nextline(); waits input entered before continuing on system.out.print("enter index:\t"); . this produces output:...

iis - How do I register Network Service as an SPN? -

i registered domain account http spn earlier today before realising break network service app pools, deleted registrations domain account. i think need add network service spn app pools working again windows authentication. syntax this? can't work out network service account called in setspn syntax. thanks! you can reset computer use default spns using command: setspn -r hostname hostname actual host name of computer object want update. to verify existing spns can use: setspn -l hostname

wpf - MVVM light, Messages from mediator pattern should be killed manually? -

i developing project , using mediator pattern communication between viewmodel , view. the problem that, method registered message executed many times message sent. well, lets write down problem. from simple menu have item have assign command //mainwindow.xaml <awc:imagebutton istoolstyle="true" orientation="vertical" imagesource="" command="{binding showpriceswindowcommand}">prices</awc:imagebutton> //mainwindow viewmodel public icommand showpriceswindowcommand { { return new relaycommand(showpriceswindowexecute); } } void showpriceswindowexecute() { messenger.default.send(new notificationmessage<hotel>(this, selectedhotel, "showpriceswindow"), "showpriceswindow"); } //mainwindow.xaml.cs messenger.default.register<notificationmessage<hotel>>(this, "showpriceswindow", hotelpricemessagereceived); private void hote...

Android Text Display - Canvas.drawText() output pixelated -

my android app displays text in few different ways, , there annoying differences between them hoping folks with. when use display methods might termed "automatic," text displayed nicely. automatic methods, i'm referring tools, toasts , button widgets have supply text, , os (or "environment" or whatever) displays me. letters nicely curved, pleasant at, , legible. however, in code handle text display (using canvas.drawtext() in surface runner view), text quality poor. text still legible, looks pixelated. letters don't best. i've tried experimenting paint.settypeface() , using typeface.sans_serif example, quality of display when it's code poor. doable, poor. has else experienced this? chance have solution? you might try playing around paint.setantialias(boolean) or paint.setsubpixeltext(boolean) .

Logic issue in PHP -

ok, tested follows , i'll let know discovered: echo ('-1' < 0) ? 'true' : 'false'; // echo "true" echo ('1' > 0) ? 'true' : 'false'; // echo "true" # notice '-1' , '1' strings now let's take array, coming database after filtering result in order rows uid = 1 . $this->a = array( [0] => array( 'uid' => '1', 'pid' => '91', 'amount' => '-1' ), [1] => array( 'uid' => '1', 'pid' => '92', 'amount' => '1' ), [2] => array( 'uid' => '1', 'pid' => '93', 'amount' => '1' ) ); now want create function posamount($pid) returns true if 'amount' > 0 or false if 'amount' < 0 . (notice: amount = 0 ...

Android and Eclipse - a problem -

i'm newbie eclipse , android. have legacy project svn repository import , use under eclipse helios. changes inside , outside eclipse synchronized fine svn. now problem: project structure consists of root directory, referring src path, exists outside root (i.e. on same level root of project is). guess has been arranged designer, because src part has been referenced different java projects different platforms. think not such bad idea. however: whatever can't make eclipse , svn synchronize changes on files located in "outer" directory. have in order make both aware of outer parts, w/o being forced change file/dir structure completely? kind regards from understand description did following ? you removed src folder created eclipse during first check out. you create linked src folder (when created it, instead of accepting defaults, opened "advanced" dialog box , checked radio button saying link...(linked folder) , filled in location wanted...

iphone - Three20 & TabBarController -

i'm stuck on something. i'm using three20 , tttnavigator example. can find tabbarcontroller using : [self settaburls:[nsarray arraywithobjects:@"tt://crush", @"tt://crushes", nil]]; to create each tab. ok until here ok, problem have tabs without title , image. know how set individual when loads view controller inside - (void)viewdidload : self.title = @"crush"; uiimage* image = [uiimage imagenamed:self.title]; self.tabbaritem = [[[uitabbaritem alloc] initwithtitle:self.title image:image tag:0] autorelease]; but problem because when init app tabs except selected empty. any suggest on how implement that. ok i've resolved, used -init method of each view controller.. usually... need change : [self settaburls:[nsarray arraywithobjects:@"tt://crush/1", @"t...

regex - using sed to extract a time from a line -

line: 0.01user 0.00system 0:13.46elapsed 0%cpu (0avgtext+0avgdata 4272maxresident)k i want grab: 0:13.46 my current regex is: sed 's/.*\([0-9]*:[0-9]*.[0-9]*\)elapsed.*/\1/' i'm pretty sure regex correct, it's not finding anything. it's simple, i'm doing 10 things @ once. this works me: % sed 's/.*\s\([0-9]*:[0-9]*.[0-9]*\)elapsed.*/\1/' 0.01user 0.00system 0:13.46elapsed 0%cpu (0avgtext+0avgdata 4272maxresident)k 0:13.46 note how put \s before first digit want match. then again, regex kind of worked me before in print out :13.46 (the .* gobbled first 0 want print out).

sql server - Stored procedure problem in MS Access caused by ReturnsRecords (accdb) -

i have relatively stored procedure runs insert, , attempts return last inserted id. done can id via scope_identity(). working great me. then, got reports on machines, stored proc cause duplicate results. after investigating it, found cause use of property returnsrecords. when true, run query twice! select; cares. case though, causing duplicates in database. setting returnsrecords false gets rid of problem, defeats purpose of stored proc (i absolutely must proper last inserted id record)! my question this: how go inserting record , getting id of new record, while getting around problem? additional info: i using dao i have tried ado.command method, error prone , doesn't seem work output parameters me. i using stored proc solely purpose of retaining scope. not have heart set on using stored proc. need reliable way id of last inserted row. this accdb this happening in access 2007 my db backend mssql server 2008 any or insight appreciated. one of paramete...

json - Get template rendered from controller without render yet -

i want return response json ajax containing more atributtes instead template: default: render(template:"/templates/question",model:[question: question]) ..and want like: def template = *get*(template:"/templates/question",model:[question: question]) render [template:template, istemplate: true] json is possible? thanks then solution is: class mycontroller { def test = { // stored string ... def x = g.render(template:"/basecontroller/test",model:[name:"wysmedia.com"]); render(x); // display template instead render } }

How can I get the dreaded WRITE_SECURE_SETTINGS permission for my android app? -

i need able toggle gps receiver on , off, , write_secure_settings required able access secure settings. i've searched around quite bit, , every answer saw pretty said no app outside of system/firmware can permisssion. however, untrue. there several apps on market i'm trying (in regards gps), there bunch more have write_secure_settings permissions. example: extended controls switchpro profile flow so, how can done? i need able toggle gps receiver on , off for privacy reasons, if nothing else, enabling or disabling sort of location-tracking needs solely in hands of user via trusted applications, not @ request of arbitrary third parties. so, if wish enable , disable gps, create own firmware need , load firmware on whatever devices wish. or, contribute changes existing firmware mods (e.g., cyanogen). write_secure_settings required able access secure settings correct. i've searched around quite bit, , every answer saw pretty said no ap...

iphone - Moving an object randomly around the screen -

i'm trying animate uibutton move randomly around screen in different directions. code below kind of working. button begin moving along random path, however, continues move , forth between point , point b. [uiview beginanimations:nil context:nil]; [uiview setanimationduration:1]; [uiview setanimationrepeatcount:1000]; [uiview setanimationrepeatautoreverses:yes]; cgfloat x = (cgfloat) (arc4random() % (int) self.view.bounds.size.width); cgfloat y = (cgfloat) (arc4random() % (int) self.view.bounds.size.height); cgpoint squarepostion = cgpointmake(x, y); button.center = squarepostion; [uiview commitanimations]; how can keep moving new random point every time changes directions, instead of moving , forth? thanks! try this: -(void)animationloop:(nsstring *)animationid finished:(nsnumber *)finished context:(void *)context { [uiview beginanimations:nil context:nil]; [uiview setanimationduration:1]; // remove: // [uiview setanima...

Android Global Search app replacement -

i working on app alternative default android search app. want app default app runs when user presses (not long press) hardware search button. possible? there intent that: http://developer.android.com/reference/android/content/intent.html#action_search so need app listens intent , rest choice of user...

python - Django Debug Toolbar Install Problems -

i having issues trying django-debug-toolbar , running. have of necessary info added installed_apps , middleware_classes , , ip in internal_ips tuple. have run setup.py script , seems load fine getting no errors django or apache. however, nothing happens - no toolbar on pages, has else ever seen behavior? missing obvious? i had same issue awhile. have tried logging admin panel? if toolbar displays there, not display in code, it's missing opening , closing tags in template. default, django debug toolbar attaches body tag, though can change behavior if desire. see question: django debug toolbar working admin section

javascript - Seek in flowplayer on page load -

i want seek flowplayer @ page load. i have tried: $(document).ready(function() { $f(0).seek(5); }); and $(document).ready(function() { while(!$f(0).isloaded()) { $f(0).seek(5); } }); and $(document).ready(function() { $f(0).onload(function() { $f(0).seek(5); }); }); and 1 gave result, while $f(0).onload(function() { $f(0).seek(5); }); the last 1 moved pointer 5 seconds, , start right after. want stand there. any suggestions? official answer: http://flowplayer.org/forum/3/101287#post-101528 looks downvoted putting link, , understandable flowplayer has changed forum urls! https://web.archive.org/web/20120629142246/http://flowplayer.org/forum/3/101287 here op found old question on stack overflow... http://stackoverflow.com/questions/5034858/seek-in-flowplayer-on-page-load wondering official answer is? how seek on load? and response the onload event (of player) event seek clip. cannot seek onload. can seek once clip loa...

drupal - cache_set syntax issue -

cache_set($id, 'cache', serialize($my_data), time() + 360); i setting cache above. not set cache specified unix time stamp of 1 day. $id = id of cache; $my_data = data cached; 'cache' = table stored; time() + 360 = unix timestamp; so , correct syntax should cache_set($id,$data,'cache',time()+(24*60*60)) not update cache table. operation cache_get($id) not execute. shots in dark... if using drupal 5 should work fine. things remember: $id should string. format drupal 6: cache_set($id, $my_data, 'cache', time() + 360) you don't need serialize happens within cache_set()

php - How to send extra field data to the backend using Uploadify 3.0? -

has used uploadify version 3.0 beta? having difficulty implement it. there no documentation available @ moment. if has used script please let me know how send fields data backend php file. here's i'm trying (and doesnt work) : <script type="text/javascript"> $(document).ready(function() { $("#file_upload").uploadify({ "swf" : "uploadify.swf", "uploader" : "uploadify.php", "cancelimage" : "uploadify-cancel.png", "auto" : true, "onuploadstart" : function(){ $("#file_upload").uploadifysettings("postdata",{ "name": $("#name").val(), },0); }, }) }); </script> html: <fieldset> <form id="upload_form" action="" method="post" enctype="multipart/form-dat...

html - Problem creating equal height columns in CSS -

i have been using examples here setup webpage has columns equal heights (using html , css), , working relatively well. here complete html , css code using. newbie questions: (1) can see, tried make left column (id="column_bottom") have white (#f5f5f5) background black text, , right column (id="content_bottom") black background white (#f5f5f5) text, 1 side overriding other. can make want? (2) also, can see in css have defined fonts , background colors body, somehow not carrying through, should do? thanks! p.s. looking pure html/css solution, , prefer not use javascript. you're close. in code, change styling columns themselves, so: #content_bottom { color: #f5f5f5; background:#000000; /* right column background colour */ } #column_bottom { color: #000000; background:#f5f5f5; /* left column background colour */ }

oracle - Python Parameter pass to prevent sql injection. Why is this giving an error? -

from django.db import connection, transaction def pk_dt_catalog(p_cat_id,p_commons_id): c1 = connection.cursor() sql = "select commons_id, cat_id, cat_name dt_catalog" sql = sql + " cat_id = %s , commons_id = %s " param =(p_cat_id, p_commons_id) c1.execute(sql, param) return c1 >>> c = dt_catalog.pk_dt_catalog(513704,401) traceback (most recent call last): file "<stdin>", line 1, in <module> file "dt_catalog.py", line 24, in pk_dt_catalog c1.execute(sql,(p_cat_id, p_commons_id,)) cx_oracle.databaseerror: ora-01036: illegal variable name/number in code, you're using %s python substition string syntax, expects substitution values on same line, e.g. sql = sql + " cat_id = %s , commons_id = %s " % (p_cat_id, p_commons_id) however, (as stated already) not best way because (a) can sql injection vulnerability; , (...

compiler errors - Compiling Chipmunk with Code::Blocks -

i seem unable compile chipmunk without compile errors, can me? turned on c99 still errors. here's few: c:\c++\chipmunklib\chipmunk.c:70: error: 'm_pi' undeclared (first use in function) c:\c++\chipmunklib\chipmunk.c:70: error: (each undeclared identifier reported once c:\c++\chipmunklib\chipmunk.c:70: error: each function appears in.) c:\c++\chipmunklib\chipmunk.c: in function 'cpareaforsegment': c:\c++\chipmunklib\chipmunk.c:85: error: 'm_pi' undeclared (first use in function)

Good flash / actionscript tutorial for someone who already knows how to program? -

i enrolled in course @ our university need prototyping using flash. actual introduction using flash limited, have lot of searching around web ourselves. the problem ooooh garbage code when google flash tutorials it's not funny (imho it's worse googling javascript :p ). i'm fluent in c#, quite in java, c, c++ , javascript, , know functional languages scheme, getting actionscript quite easy me. however, whole frame / movieclip / symbol deal quite new me, stuff creating instance of class that's supposed have lifetime of whole application tricks me out - basically, scoping rules.. my question is: there (relatively small) tutorials out there people me wants actionscript right way? thanks in advance if @ java have nice handle on oop , looking understand syntax differences , things display list. best place kind of info actionscript tip of day: http://www.kirupa.com/forum/showthread.php?t=223798 really stuff there... if looking oop stuff, let me know...

java - Why does Jython not find this module? -

possible duplicate: how run python script java? i running python script using jython , got error: exception in thread "main" traceback (innermost last): file "c:\facebook\loginpython\facebook.py", line 5, in ? importerror: no module named cookielib why doesn't work? a little bit more using jython - had share of problems well. note may not best way it, works fine me. i assume want call function foo in module bar java code takes string argument , returns string: pythoninterpreter interpreter = new pythoninterpreter(); // append directory containing module python search path , import interpreter.exec("import sys\n" + "sys.path.append(pathtomodule)\n" + "from bar import foo"); pyobject meth = interpreter.get("foo"); pyobject result = meth.__call__(new pystring("test!")); string real_result = (string) result.__tojava__(string.class); the sys.path.append(...

jquery - JSON not loading -

having trouble getting json feed load site. i'm starting think wrong feed itself, since plugging address variety of different blocks of example code doesn't seem work. i've tried examples below, , continually meet "origin null not allowed access-control-allow-origin" when trying deep drill error through chrome's javascript console. ideas? try #1: <script type="text/javascript"> $().ready(function(){ var url = 'http://www.solidverbal.com/category/clicks?feed=json'; $.get(url, function(data) { // can use 'data' in here... }); }); </script> try #2: <script type="text/javascript"> $.ajax({ type: "post", url: "http://www.solidverbal.com/category/clicks?feed=json", data: '{}', // parameter goes here contenttype: "application/json; ch...

package - Packaging application with file -

i'm working on application use bouncy castle api in c# encrypt/decrypt, i've got of public/private , pass phrase key encryption/decryption working need able create encrypted self decrypting archives, i've read best way encrypt file using passphrase encryption i've written , create light weight forms application decrypt file, i've done question how package forms application file can automatically save file somewhere, launch forms application passing in file location in order user specify want save decrypted file , enter passphrase? many in advance after reading many other posts i've realised best way creating application on fly , adding file decrypted resources of application.

Performance question: ON DUPLICATE KEY UPDATE vs UPDATE (MySQL) -

is there performance difference between insert on duplicate key update , update? if know values can updated - should use update or not matter? there difference. the insert query has check constraints on every column see if they're violated adding row. if so, needs find matching row update , perform update. an update query has find row update , perform update. if know row exists, should update it.

git - Read an arbitrary string from the console -

i've bash function looks this. function gg() { git add . && git commit -v -m "$*" } it takes arguments console , uses commit message. the problem wont handle special characters () , ´ , " , on. there way escape ingoing params can use given arguments? this how use function. gg fixed bugs (closed 123) it runs command. git add . && git commit -v -m "fixed bugs (closed 123)" that example return error. -bash: syntax error near unexpected token `(' your error isn't coming out of script, it's coming bash, trying interpret special characters before gets passed script. gg "fixed bugs (closed 123)" should work fine.

javascript - CSS Cross-Browser Curved Borders -

what correct/best way define cross-browser css/css3 compliant/valid curved borders? is there non-javascript way of doing so, while being cross-browser compatible? if not, there proper workaround? have tried: -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px together? should cover primary 3 browsers in latest releases (at least). without javascript or using images, you're not going full cross-browser coverage.

c# - Is it good to test a condition then lock then re-test the condition -

possible duplicate: double-checked locking in .net edit: lots of edits clarify question not singleton i find myself writing code this: if(resourceondiskneedsupdating) { lock(lockobject) { if(resourceondiskneedsupdating) // has previous thread done this? updateresourceondisk(); } } return loadresourcefromdisk(); updateresource() slow operation. pattern make sense? there better alternatives? this called "double-checked locking". you need memory fence make correct. see wikipedia's article on double checked locking in .net

c# - How to create a caller/callee graph? -

Image
i want display 'flow' chart of process showing time spent in children relative parent. example, have methoda calls methodb , methodc. 30% of time relative methoda in methodb , 70% in methodc. want display this: i know sort of vague question, narrow scope, don't know kind of chart might be. kind of libraries might provide capability display type of chart? i've used graph# same purpose - wpf library. news uses quickgraph ( http://quickgraph.codeplex.com/ ) library internally , can google around library see whether there code used part of winforms.

How to catch 404 errors in Selenium using Perl? -

i have perl script uses selenium fetch html document called foo doesn't exist (404 not found.) default behavior script print error , terminate, such "bar" never printed. i'm looking way continue on instead, such "bar" printed. here's i've got. code (called foo.pl): #!/usr/bin/perl use strict; use www::selenium; $sel = www::selenium->new( host => "localhost", port => 4444, browser => "*chrome", browser_url => "http://www.google.com/" ); $sel->start; $sel->open("http://www.google.com/foo.html") print "bar"; here's message printed: error requesting http://localhost:4444/selenium-server/driver/?cmd=open&1=http%3a%2f%2fwww.google.com%2ffoo.html&sessionid=bc9c086eef804a7c8a0090674333e4c7: xhr error: url = http://www.google.com/foo.html response_code = 404 error_message = not found i've looked over...

android - local1 cannot be resolved or is not a field -

i don not know doing error on main.1 local1 = new main.1(this); multiple markers @ line - local1 cannot resolved or not field - syntax error on token ".1", . expected - syntax error on token ".1", delete token - constructor main(main) undefined and on localgridview.setonitemclicklistener(local1); error local1 cannot resolved variable any suggestions? import android.app.activity; import android.os.bundle; import android.view.window; import android.widget.gridview; public class main extends activity { public void oncreate(bundle parambundle) { super.oncreate(parambundle); getwindow().setflags(1024, 1024); setcontentview(2130903042); setrequestedorientation(1); gridview localgridview = (gridview)findviewbyid(2131034124); imageadapter localimageadapter = new imageadapter(this); localgridview.setadapter(localimageadapter); main.1 local1 = new main.1(this); localgridview.setonitemclicklistener(local1); } }

cross browser - Is it still bad practice to build a website that relies on javascript? -

is still bad practice create website relies on javascript? i know used be, nowadays browsers support them... why or why not should worry this? depends on target audience, more importantly how you're using javascript. using effects don't interfere actual functionality fine. if want target broad audience , website non-functional without javascript, may want reconsider.

design patterns - What is Inversion of Control? How does that relate to dependency injection? -

possible duplicates: difference between dependency injection (di) & inversion of control (ioc) inversion of control < dependency injection hey, scott hanselman interview question . find question hard answer. may parts of question answered on stack on whole important. i know other forms of ioc apart di. can explain me real time examples. thanks dependency injection not form of ioc. inversion of control pattern that's not related di @ all, except fact they're used in sort of framework, lead people think they're same thing when they're not. dependency injection means inject class's dependencies it, through constructor or series of setters, rather instantiating them in class. can done without ioc container of sort, manually. a simple example of manual di be: import org.apache.http.client.httpclient; public class twitterclient { private httpclient httpclient; public twitterclient(httpclient httpclient){ ...

python - Using cPickle to serialize a large dictionary causes MemoryError -

i'm writing inverted index search engine on collection of documents. right now, i'm storing index dictionary of dictionaries. is, each keyword maps dictionary of docids->positions of occurrence. the data model looks like: {word : { doc_name : [location_list] } } building index in memory works fine, when try serialize disk, hit memoryerror. here's code: # write index out disk serializedindex = open(sys.argv[3], 'wb') cpickle.dump(index, serializedindex, cpickle.highest_protocol) right before serialization, program using 50% memory (1.6 gb). make call cpickle, memory usage skyrockets 80% before crashing. why cpickle using memory serialization? there better way approaching problem? cpickle needs use bunch of memory because cycle detection. try using marshal module if sure data has no cycles

ognl - Is the ValueStack life cycle across the application in struts2? -

i can set property on valuestack in several ways. valuestack stack = actioncontext.getcontext().getvaluestack(); stack.getcontext().put("resultdto",resultdto); //1. creates different branch //parallel root stack.set("resultdto", resultdto); //2. pushes on root map? stack.push(resultdto); //3. pushes on root myactionclass.setproperty(); //4. normal action accessor i need able these values in jsp, freemarker , java stack.findvalue() or stack.findstring(). i want know life cycle of each of these 4 setting methods. across application. valuestack created every request , application , session values set in every request? i know 4th method common approach may not using in places, action class not accessible. i have doubt accessing in jsp <s:push value="resultdto" ><s:property value="data.form1[0]" /></s:push> <!--5.works context.put() & stack.set() both--> <s:property value="#...

c# - NHibernate DateTime for query, Overflow exception caused by string format -

nhibernate generating following sql not supported firebird; where (struct_cas0_.deleted null) , struct_cas0_.account_id = 372 /* @p0 */ , struct_cas0_.date_record <= '2005-01-01t00:00:00.00' /* @p1 */ , struct_cas0_.date_record >= '2006-12-31t00:00:00.00' /* @p2 */ the above sql fails in firebird error "overflow occurred during data type conversion. conversion error string '2005-01-01t00:00:00.00'" if remove 't' query, firebird executes query without problem; where (struct_cas0_.deleted null) , struct_cas0_.account_id = 372 /* @p0 */ , struct_cas0_.date_record <= '2005-01-01 00:00:00.00' /* @p1 */ , struct_cas0_.date_record >= '2006-12-31 00:00:00.00' /* @p2 */ is there way can have nhibernate remove 't' when converting datetime queryable string? an additonal question raised after reasearch. appears firebird not support combined date , fime format da...

IWA and WebSphere? -

is integrated windows authentication available in websphere (7)? specifically, how possible obtain username , group memberships of user accessing web application via ie? spnego supported on was7 see creating single sign-on http requests using spnego web authentication as specified in doc: the requester's identity in websphere application server security registry must identical identity spnego web authentication retrieves. identical match occur when microsoft windows active directory server lightweight directory access protocol (ldap) server used in websphere application server. which means httpservletrequest.getremoteuser() return actual username. you can perform ldap operations through jndi see jndi ldap api prefer mapping groups roles determine group membership.

c++ - Referring to the address of a collection element via iterators -

how can refer address of element in vector using iterators. vector<record>::const_iterator iter = collectionvector.begin(); while(iter != collectionvector.end()) { //how can refer address of record here function(...); //accepts &record type } you can use &(*iter) address. here sample code: std::vector<int> a; a.push_back(1); std::vector<int>::iterator iter = a.begin(); int *p = &(*iter) ; *p =10;

How to get HTML elements using objective C for iphone dev -

right working on small project requires me pull table website. read posts suggests using nsxmlparser , have suggested libxml2.2.dylib. of these easier use? need few values page, nothing complicated. nsxmlparser; if needs aren't deep. there external libraries consider: touchxml.

flex - How to redirect to an HTML page if Flash is not installed? -

i want in flex app redirect html page if user doesn't have flash installed. noticed in html generated flash has: <div id="flashcontent"> <p> view page ensure adobe flash player version 10.0.0 or greater installed. </p> <script type="text/javascript"> var pagehost = ((document.location.protocol == "https:") ? "https://" : "http://"); document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='" + pagehost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='get adobe flash player' /></a>" ); </script> </div> which displays generic message not having flash. i know can put html there displayed if flash doesn't exist don...

Replace Line Feed with a Space in unix shell script -

i have text file containing records. each record splitted in 4 rows (not 4), example: ---- row1 row2 row3 row4 ---- row1 etc... each row ended line feed character (lf). ok, need obtain record in 1 line, replacing lf character space, in example: ---- row1 row2 row3 row4 ---- row1 row2 ...etcetera any or suggestion solution? in advance. maybe can work ? cat file | xargs | sed "s/ ---- /\n---- /g"

iphone - How to make existing app windows transparent in smartphones? -

i trying find out if there way make existing app windows transparent in smartphone. platform of iphone/android/wp7. in own apps, can make use of alpha blending features , control transparency, there way make existing windows transparent? thanks! if want modify applications on given target, think you'd have modify default themes, far android concerned @ least. don't see how done easily. i'm guessing might need re-compile parts of source or, in worst case, "jailbreak" phone. if need alter specific applications perhaps easier talk directly developers of apps.

Another Forcing Java Garbage Collection Question (with *I think* a justifiable use case) -

i have data producer produces data used number of different consumers (let's call them cs). each c has own set of data it's interested in. data producer has weak references cs can notified updates. each c used number of independent components, no single 1 component can tell when c no longer needed, have leave jvm determine when c gc-able. the goal here notified when c becomes obsolete, data producer can turn off data interesting unused c. as mentioned earlier, data producer has weak references cs, it's easy when c gced. however, noticed cs stick around in vm extended period of time before it's gc-ed , while, data producer producing lot of data should have needed to. is there way me force gc of unused cs? hoping yes, i'm expecting no, follow-up question, have suggestion how can (re)design make work better/more efficiently? thank you!! some answers below make lot of points - in particular suggestion force users of c subscribe , unsubscribe. difficult ...

shadow - (iphone) i'm getting black rectangle behind image, why? -

i have uiimageview subclass instance has multiple image sublayers. i want add/remove shadow dynamically view. the following code works fine(imageview subclass's implementation) imageview 1 sublayer, shows black rectangle instead of shadow imageview multiple sublayers. (actually, 1 layer image, code seems keep adding shadow on top of previous shadow if run multiple times, minor problem) - (void) drawlayer: (calayer*) layer incontext: (cgcontextref)context { syslog(log_debug, "in drawlayer, isshadowed: %d", isshadowed); if(isshadowed == true) { cgcontextsavegstate(context); cgcontextclearrect(context, self.bounds); cgcontextsetshadow(context, cgsizemake(10, 10), 3); cgcontextbegintransparencylayer(context, null); [layer renderincontext:context]; cgcontextendtransparencylayer(context); cgcontextrestoregstate(context); } else { [layer renderincontext:context]; } } ...

winforms - Log batch in listbox C#? -

i working on program, can handle minecraft servers. running batch witch logs server, , want batch (called batch in code) log in listbox called lg_log. if possible, how can that? i programming in visual studio - windows forms in c#. edit: code: process batch = new process(); string pathtorunfile = @"\servers\base\start_server.bat"; string current_directory = directory.getcurrentdirectory(); string server_base = @"\servers\base"; string working_directory = current_directory + server_base; batch.startinfo.filename = current_directory + pathtorunfile; batch.startinfo.arguments = ""; batch.startinfo.workingdirectory = working_directory; batch.startinfo.useshellexecute = true; batch.start(); the process.startinfo contains properties redirectstandardoutput . setting flag true , able add event handler batch.startinfo.outputdatareceived , listen events. so: edit: might want enable redirecting erroroutput in order receive error messages....

python - comparing outputs from command.getoutput(cmd) -

i have following code working apart 1 problem. im trying compare 2 outputs commands.getoutput(cmd) im getting syntax errors. understand inherently wrong, point im doing wrong def diffgenerator(): try: sys.argv[1] except: print "no directory scan defined\n" try: sys.argv[2] except: print "no delay time defined\n" scandirectory = sys.argv[1] if not os.path.exists(scandirectory): print "scan directory not exist :" + scandirectory cmd = "ls -l " + scandirectory try: difffilea = commands.getoutput(cmd) print "printing difffilea" + difffilea time.sleep(1) difffileb = commands.getoutput(cmd) if operator.ne(difffilea, difffileb) print "new file placed within " + scandirectory except: print "blah" you might want consider subprocess http://docs.python.org/library/subprocess.html subprocess.popen(['ls','-a'], stdout = subprocess.pipe,...

c++ - DEBUG: During Hook procedure call , it shows vsjitdebugger.exe error -

my application contains ole widgets.to handle ole widgets , use mouse hook procedure keep track mouse click events.while closing application , provides flickering , shows following errors unable use location explorer.exe c:\windows\system32\vsjitdebugger.exe (runtime error) regards, karthik the solution problem follows: problem may occur in function setwindowshookex() , you may made threadid null in function setwindowshookex() . when replace null currentthreadid, runtimeerror solved.

oracle - database restore to particular state for testing -

we use oracle(or postgres) database , application server execute integration tests. isolate each test 1 , database schema dropped , re-created before each test. as see time taking process. application uses 100+ tables. thinking of writing custom sql delete unwanted data each tables. there better way save , restore database state? ( appears dbunit this, have not tried yet. ) a single test involves: create database schema. start app server. start multiple client applications. execute , verify. we have 5000 odd tests, taking 700 hours or so. (we on grid environment, finishes overnight) most of tests uses small data sizes, 10 mb. oracle flashback allows restore table @ specified time point using simple sql query. documentation available here . i don't know if postgre has similar feature.

blackberry - Subfolder in res folder not finding image -

Image
i'm attempting load bitmap image images folder within res folder using - bitmap.getbitmapresource("/images/bg_general.png") but image not being found though exists @ specified path. im using blackberry eclipse plugin. here snippet of dir structure image located - bitmap.getbitmapresource("bg_general.png") correct way display images. works me. also, check whether image empty.

jinja2 - Python - 'ascii' codec can't decode byte -

i'm using python 2.6 , jinja2 create html reports. provide template many results , template loops through them , creates html tables when calling template.render, i've started getting error. <td>{{result.result_str}}</td> unicodedecodeerror: 'ascii' codec can't decode byte 0xc4 in position 0: ordinal not in range(128) the strange thing is, if set result.result_str simple ascii string "abc" every result, still seeing error. i'm new jinja2 , python , appreciate ideas on how can go investigating problem root cause. if error string "abc", maybe non-ascii character somewhere else. in template source perhaps? in case, use unicode strings throughout application avoid kind of problems. if data source provides byte strings, unicode strings byte_string.decode('utf-8') , if string encoded in utf-8. if source file, use streamreader class in codecs module. if you're unsure difference between unicode strings ...

Why does JavaScript Math.log(1.001) return the wrong value? -

javascript returns .0009995003330834232. every other way of calculating returns 0.000434077479319. it returns natural logarithm , i.e. logarithm base e = 2.71828... , instead of logarithm base 10. log_e(1.001) = 0.00099950033308342321 log_10(1.001) = 0.0004340774793185929

c - Edid information -

redefining question: is there way serial id of connected monitor ? i want gather edid information of monitor. can xorg.0.log file when run x -logverbose option. but problem if switch monitor ( plug-out current monitor , plug-in monitor ), there no way information. is there way edid dynamically ( or runtime ) ? or utility/tool inform me monitor connected , disconnected ? i using lfs-6.4. regards, shw there read-edid package. http://www.polypux.org/projects/read-edid/ once have compiled , installed, can run these commands: # read-edid | parse-edid this provide x.org config-like output. feel free hack further.

objective c - Output of NSLog for applications running without XCode? -

i'm distributing first mac os x application beta-testers , have silly question have trouble finding answer : "where output of nslog calls once application packaged .app bundle ?" henry, asked , answered: here basically, stdout/stderr go console log, visible console.app.

php - Typo3 - Typoscript condition -

im trying use condition on img_resource in datastructure. problem part not seem work: the_img = img_resource the_img.if.equals.field = field_positiontype the_img.if.value = top the_img.file.xy = 200,150 the_img.file.import = uploads/tx_templavoila/ the_img.file.import.field = field_tabimage the_img.file.import.listnum = 0 the_img.file.maxw = 20 the_img.file.minw = 20 the_img.file.maxh = 15 the_img.file.minh = 15 the_img.file.params = -rotate 90 165 < the_img no matter value of "field_positiontype" is, image build anyway. here snippet of data structure: <field_positiontype type="array"> <tx_templavoila type="array"> <title>position</title> <sample_data type="array"> <numindex index="0"></numindex> </sample_data> <etype>select</etype>...

java - convert json to object using jackson -

i have convert json object using jackson. class like: class country { int a; int b; } and json getting: {"country":{"a":1,"b":1}} but when trying deserialize giving me following error org.codehaus.jackson.map.jsonmappingexception: unrecognized field "country" if remove "country", able object. is there way can tell jackson ignore "country" json string? thanks in advance. this correct behavior of jackson, actual json representation of country object should without top level country. if json absolutely has top level country attribute, cleaner approach use wrapper country class this: class wrappercountry { country country; } this way json representation should correctly deserialize wrappercountry object , can retrieve country that.

android - How do I Insert Latitude/Longtitude in my database & use it to open Google maps with Intent? -

create table if not exists employee (_id integer primary key autoincrement, firstname varchar(50), lastname varchar(50), title varchar(50), department varchar(50), managerid integer, city varchar(50), officephone varchar(30), cellphone varchar(30), email varchar(30), picture varchar(200)) insert employee values(1,'ryan','howard','vice president, north east', 'management', null, 'scranton','570-999-8888', '570-999-8887','ryan@dundermifflin.com','howard.jpg') you should put more time formulating question. i'm unsure you're stuck on. i'd recommend starting scratch. @ location + android , how tie together. here example of app works location services. there similar question yours answered here . if sqlite that's giving issues have @ this . due lack of information i'm unsure you're asking specifically. these few suggestions answer qu...

selecting current match from the cricket schedule using mysql query -

i have cricket schedule , need select matches of current day half hour before match starts , selection should last until 2 hours past end of match , should done in single query have used following query not working accurately... select * `schedule` date1 between date_sub(now(), interval 30 minute) , date_add(now(), interval 10 hour) if want display scheduled matches half hour before start until 2 hours after end, , mathces have duration of 12 hours, need show matches within 14,5 hours interval, , not 10,5 hours interval current code does: select * `schedule` now() between date_sub(date1, interval 30 minute) , date_add(date1, interval 14 hour) furthermore, should compare current time ( now() ) start time , end time of game, not other way round.

Problem to use GWT client to call a Restlet web service -

i using restlet framework, , want use gwt client side. have created serverresources in restlet. here codes gwt client: bookresourceproxy.java public interface bookresourceproxy extends clientproxy { @get public void getbooks(result callback); } the class use proxy: bookresourceproxy wrp = gwt.create(bookresourceproxy.class); wrp.getclientresource().setreference("/books"); wrp.getclientresource().getclientinfo().getacceptedmediatypes().add(new preference<mediatype>(mediatype.application_json)); wrp.getbooks(new result<string>() { public void onfailure(throwable caught) { window.alert("fail" + caught.getmessage()); } public void onsuccess(string json) { window.alert(json); } }); when run application, receive error: "no source code available type org.restlet.resource.clientproxy; did forget inherit required module?" but if inherit in .gwt.xml: another error occurs: unable find 'org/re...

documentum - How to recognize (programmatically) situation ‘property value has changed in object’? -

i beginner in documentum yet (all have documentum developer edition); advice experienced documentum developer helpful. need create program (on .net) monitoring specified documentum content server looking situation ‘property xxx in object of type has changed value yyy’. more detailed example: program monitors dm_document objects detect situation ‘a_status has changed value tobeexportedoutside’. after program retrieves document , exports document management system. another example: program monitors dm_document objects detect situation ‘the document has been promoted state tobeexportedoutside in lifecycle attached to’. after program retrieves document , exports document management system. the question is: how better using dfs? using dfs, or bfos, or what? case 1 : moniotor a_status has changed value 'tobeexportedoutside' using dql: select object_id, r_modify_date dm_document(all) a_status = 'tobeexportedoutside' , r_modify_date > date('01/01/...

Software protection dongle vs. Adobe Air -

this looks extremely silly question me, anyway, i'm curious: is there way protect adobe air application hardware key (aka software protection dongle )? i'm looking developing application require such key protection being pirated (i can't change fact), , looks using adobe flash easiest way write particular application should do. if writing purely in flash use product swf studio (or zinc ) encrypts flash file , produces , executable file. needs encrypted because in standard flash executable file swf data can extracted. can protect executable file using shell wrapper ties dongle. did using swf studio , dinkey dongles flash executable , worked well. links: swf studio dinkey dongles

java - Replace / Censored -

i'm working system called quiz ... the last thing remains 'clues'. in present have <id value="100"> <question value="who said e=mc2"/> <answear value="einstein"/> <clue1 value="e*******"/> <clue2 value="e******n"/> <clue3 value="ei****in"/> </id> and want remove xml clues because hard them manually ... made failed public class test { public static void main(string[] argv) throws exception { system.out.println(replacesubstring("einstein", "*", 3)); } static string[] letters = {"e","i"}; public static string replacesubstring(final string str, final string newtoken, int max) { if ((str == null) || (newtoken == null)) return str; stringbuffer buf = new stringbuffer(str.length()); int start = 0, end = 0; fo...

Django with Pluggable MongoDB Storage troubles -

i'm trying use django, , mongoengine provide storage backend gridfs. still have mysql database. i'm running strange (to me) error when i'm deleting django admin , wondering if doing incorrectly. my code looks this: # settings.py mongoengine import connect connect("mongo_storage") # models.py mongoengine.django.storage import gridfsstorage class myfile(models.model): name = models.charfield(max_length=50) content = models.filefield(upload_to="appsfiles", storage=gridfsstorage()) creation_time = models.datetimefield(auto_now_add=true) last_update_time = models.datetimefield(auto_now=true) i able upload files fine, when delete them, seems break , mongo database seems in unworkable state until manually delete filedocument.objects. when happens can't upload files or delete them django interface. from stack trace have: /home/projects/vector/src/mongoengine/django/storage.py in _get_doc_with_name doc = [d d in docs ...

extjs - All fields are "undefined" in a combobox -

have little problem combo box fields. undefined. buildmycombo : function(label) { var store = new ext.data.arraystore({ fields: ['name', 'value'], data : [ ['.xls', 1], ['.csv', 2], ['.htm', 3] ] }); var result = new bggne.components.fields.simplecombobox({ formfields: {}, enablekeyevents: true, store: store, valuefield: 'value', displayfield: 'name', lazyinit:false, formfielddefinition: { ismandatory: true, fieldlabel: label, hidetrigger: false, selectonfocus: true, iseditableindialog: false, type: { kind: 'local', type: 'text', selectablevalues: 'name' }, renderasextfield: true, isonapropagation: true, forc...

Query to check the MongoDB chunk size? -

is there query check mongodb chunk size?.i came know default chunk size 200mb.in event of exceeding chunk-size shards gets splitted next chunk correct?can guys me.... you can check in "config" database: use config db.settings.find() and default 64mb, not 200.