Posts

apache - PHP code is not being executed, instead code shows on the page -

Image
i'm trying execute php code on project (using dreamweaver) code isn't being run. when check source code, php code appears html tags (i can see in source code). apache running (i'm working xampp), php pages being opened php code isn't being executed. does have suggestion happening? note: file named filename.php edit: code..: <? include_once("/code/configs.php"); ?> sounds there wrong configuration, here few things can check: make sure php installed , running correctly. may sound silly, never know. easy way check run php -v command line , see if returns version information or errors. make sure php module listed and uncommented inside of apache's httpd.conf should loadmodule php5_module "c:/php/php5apache2_2.dll" in file. search loadmodule php , , make sure there no comment ( ; ) in front of it. make sure apache's httpd.conf file has php mime type in it. should addtype application/x-httpd-php .php . tells...

unit testing - Python SQLAlchemy - Mocking a model attribute's "desc" method -

in application, there class each model holds commonly used queries (i guess it's of "repository" in ddd language). each of these classes passed sqlalchemy session object create queries upon construction. i'm having little difficulty in figuring best way assert queries being run in unit tests. using ubiquitous blog example, let's have "post" model columns , attributes "date" , "content". have "postrepository" method "find_latest" supposed query posts in descending order "date". looks like: from myapp.models import post class postrepository(object): def __init__(self, session): self._s = session def find_latest(self): return self._s.query(post).order_by(post.date.desc()) i'm having trouble mocking post.date.desc() call. right i'm monkey patching mock in post.date.desc in unit test, feel there better approach. edit: i'm using mox mock objects, current unit test...

iphone - How to create custom UITableViewCell without using XIB -

i found many tutorials on how create custom table view cell using xib, possible create custom table view cell without using xib? can 1 me? yeah, can create custom table view cell without using xib. for this, have create 1 new class in xcode subclass of uitableviewcell. here can't select xib options. now open custom uitableviewcell class , here's code achieve want: #import "customcell.h" @implementation customcell @synthesize ivuser; @synthesize lblusername; - (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier: (nsstring *)reuseidentifier { self = [super initwithstyle:style reuseidentifier:reuseidentifier]; if (self) { // initialization code ivuser = [[uiimageview alloc] initwithframe:cgrectmake(4.0f, 3.0f, 39.0f, 38.0f)]; lblusername = [[uilabel alloc] initwithframe:cgrectmake(58.0f, 8.0f, 50.0f, 27.0f)]; [self.contentview addsubview:ivuser]; [self.contentview adds...

c# - How to remove nodes using HTML agility pack and XPath so as to clean the HTML page -

i need extract text webpages related business news. html page follows.. <html> <body> <div> <p> <span>desired content - 1</span></p> <p> <span>desired content - 2</span></p> <p> <span>desired content - 3</span></p> </div> </body> </html>" i have sample stored in string can take me desired content -1 directly, can collect content. need collect desired content -2 , 3. for tried current location i.e in span node of desired content -1 used parentof , moved external node i.e para node , got content need entire desired content in div. how it? might ask me go div directly using parentof.parentof.span. specific example, need general idea. mostly news articles have desired content in division , go directly nested inner node of division. need come out of inner nodes till encounter division , innertext. i using xpath , htmlagilitypack. xpath...

jquery - Javascript: add onclick attribute DOM -

i've tryed add listeners existing div element //prepare div $(this.div).css("z-index","256"); $(this.div).attr("onmouseover",this.myname+".resize();"); $(this.div).attr("onmousedown",this.myname+".resize();"); $(this.div).attr("onmouseout","if("+this.myname+".sized)"+ this.myname+".resize();"); but in ie , chrome event doesn't fired while still gets added elements attributes. firefox works expected. does know whats wrong it? thanks do not set events strings. instead, should use jquery's bind method: var me = this; //inside handlers, element. $(this.div).bind('mouseenter mousedown mouseleave', function() { me.resize(); });

java - Log to a different file according to thread -

i have application multiple "controllers", , i'd have each log own file. easy enough own code, i'm using library code uses commons logging. somehow code log controller-specific file well? i thinking somehow thread: class controller { public void action() { setcurrentthreadlogfile(mylogfile); try { library.stuff(); } { restorecurrentthreadlogfile(); } } } currently i'm using commons-logging own logging well, log4j backend. change that, if needed, or use mix (is that's possible within commons logging framework). one way write own commons logging implementation (possibly wrapper around log4j), there existing solution? you want looking @ mapped diagnostic contexts (mdcs). commons logging not support these log4j does, have go directly log4j set up. have roll own filter filter using mdc , apply appenders. if willing change logging implementations use sl4j logging facade , logback logging implementation. have controller or ...

Add Watermark on Facebook profile image with an APP -

could please me app have made add watermark people give authorization it. have been searching app , have not found neither info code it. yo me please or tell me important information success in intention. , best regards as far know, can't alter profile image itself. can retrieve it, upload profile album can't set profile picture.