Posts

Showing posts from February, 2014

wpf - Modifying a resource in C#? -

i have resource (mypoint) defined in xaml follows: <path name="mypath"> <path.resources> <point x:key="mypoint" x="200" y="200"/> </path.resources> </path> in onapplytemplate override in corresponding c# code, use following reference resource. mypointreference = (point)mypath.findresource("mypoint"); now, whenever modify value of mypointreference, let's say, mypointreference.x = 30; it doesn't modify value of resource mypoint, changes value of mypointreference. how can make mypointreference actual reference xaml defined resource mypoint when modify value of mypointreference, modifying value of mypoint? under covers when use resources extension in xaml dealing resourcedictionary , dealing adding struct (aka value type) passed value (aka copied) dictionary, , when request returned copy. there no way pass value types reference when dealing resourcedictionary. ...

java - What could cause socket ConnectException: Connection timed out? -

we have webstart client communicates server sending serialized objects on https using java.net.httpsurlconnection . everything works fine on local machine , on test servers located in our office, i'm experiencing very, strange issue occurring on our production , staging servers (and sporadically @ that). main difference know of between servers , ones in our office located elsewhere , client-server communication them considerably slower, worked fine long time in production prior well. anyway, here's what's happening: the client, after setting options such read timeout , properties such content-type on httpurlconnection , calls getoutputstream() on stream write to. at point, can tell, client hangs period of time. the client throws following exception: java.net.connectexception: connection timed out: connect @ java.net.plainsocketimpl.socketconnect(native method) @ java.net.plainsocketimpl.doconnect(unknown source) @ java.net.plainsocketimpl.conn...

asp.net - Handler with IRequiresSessionState does not extend session timeout -

i have handler, this, using irequiressessionstate: public class myhandler : ihttphandler, irequiressessionstate { // code } in code, able read , set session values. check ensure caller logged in. works fine. the web site uses forms authentication, in web.config, have this: <authentication mode="forms"> <forms loginurl="login.aspx" timeout="10" slidingexpiration="true"></forms> </authentication> the problem ajax calls client server code myhandler not extend life of session! so if user busy sending , receiving data server, time out 10 minutes after last full page load. in handler, i've tried changing value session on each call, not extends time out. any suggestions? finally got solution this... sort of. i abandoned trying handler job, , instead called normal aspx page. in page, removed html code, , used response.write(...) send json wanted. however, that, session not being extended! ...

css - Navigation will not align right -

Image
i spent hours trying right, doesn't work me.... can see in image: the navigation isn't right. maybe can me? site http://elektrikhost.com .... used web dev extension fore firefox guide lines... don't know why won't work me.... heres css: nav { background: #282828 url(../images/nav-bg.png) repeat-x; border-radius: 6px; -webkit-border-radius: 6px; -moz-border-radius: 6px; -o-border-radius: 6px; margin: 24px auto; width: 822px; } nav ul { padding: 13px 0; } nav ul li { background: url(../images/nav-sep.jpg) left center no-repeat; display: inline; padding: 0 39px; margin: 0 auto; } nav ul li:first-of-type { background: none; } nav ul li:last-of-type { /*background: url(../images/ref2.png)*/ no-repeat right bottom; margin: 10px 0 0 0; } nav ul li { color: #626262; font: 1.2em arial, helvetica, serif; } nav ul li a:hover { color: #dfdfdf; } thanks help... your #main-wrap 897px wide , nav 822px wide margin : 24px auto . so, "extra" 75px ge...

iphone - How to search NSArray in Objective C -

hi friends, have array consists of many names. want search names starting character "c". how can search array. nsstring* firstletter; for(nsstring* currentstring in yourarray) { firstletter = [nsstring stringwithformat:@"%c", [currentstring characteratindex:0]]; if([firstletter isequaltostring:@"c"]) { // name ok } else { // name wrong } }

java - Calling controller from junit test -

how can call spring annotated controller junit test, in way spring comes play binding , all, without making http request (just mocking out request object)? has include whole shebang controller , down, jpa , database , all. using ejb, maybe bean can me? the reason this, have automatic tests tests performance of specific controller calls, without client , network traffic. thank you there's section in spring reference unit-testing spring mvc . here's relevant excerpt: unit testing spring mvc controllers test spring mvc controllers, use modelandviewassert combined mockhttpservletrequest , mockhttpsession , , on org.springframework.mock.web package. reference: org.springframework.mock.web package summary modelandviewassert javadoc

ruby on rails - Is it possible to preprocess the URL before mapping routes? -

we're migrating site proprietary framework ruby on rails (v2.3). current framework puts /base/ @ start of url no discernible reason, , i'd existing url work, though won't give out more. my current solution, don't like, define routes once on main map , once on 'base' scope: def draw_routes(map) # routing here end actioncontroller::routing::routes.draw |map| map.with_options :path_prefix => '/base' |base| draw_map(base) end draw_map(map) end what i'd like: actioncontroller::routing::routes.draw |map| map.strip 'base' # routing here end is there solution of form? you can write middleware remove base url. in lib/remove_base.rb: class removebase def initialize(app) @app = app end def call(env) env['request_path'].gsub!(/^\/base/, '') env['path_info'].gsub!(/^\/base/, '') env['request_uri'].gsub!(/^\/base/, '') @status, @header...

asp.net - What is request-processing pipeline? -

Image
what request-processing pipeline reference iis ? the request processing pipeline in iis mechanism requests processed beginning request , ending response. pictures speak louder words, should review iis7 architecture diagrams on page: introduction iis 7 architecture - http request processing in iis 7

audio - Can I use OSX AUGraph from monomac? -

i have mp3 playing application written in c# port osx. as uses directshow play mp3 realise need recode audio playback part. found apple's playfile sample uses augraph. the binding cocoa section of http://www.mono-project.com/monomac mentions "much simpler audiotoolbox api". can point me @ sample code using audiotoolbox c# or preferably using augraph c#. is porting code monomac best approach or better taking plunge , recoding in objective c. these samples of using audiounit using same api monomac has, except these samples target iphone using monotouch: https://github.com/migueldeicaza/monotouch.audiounit setting audiounit little cumbersome, if want play mp3 files without doing low-level processing or applying effects, can use monomac.appkit.nssound api instead.

iphone - Show photo with SCRATCH OUT EFFECT by finger -

i need know how create iphone application show photo scratch out effect. something effect in flash tutorial http://www.tutorial5.com/content/view/115/46/ please help. thanks. you can have @ following post on how create blurred image effect, don't think it's best & fasted method, might started: uiimage blur

search engine - Sitemap for a site with a large number of dynamic subdomains -

i'm running site allows users create subdomains. i'd submit these user subdomains search engines via sitemaps. however, according sitemaps protocol (and google webmaster tools), single sitemap can include urls single host only. what best approach? at moment i've following structure: sitemap index located @ example.com/sitemap-index.xml lists sitemaps each subdomain (but located @ same host). each subdomain has own sitemap located @ example.com/sitemap-subdomain.xml (this way sitemap index includes urls single host only). a sitemap subdomain contains urls subdomain only, i.e., subdomain.example.com/* each subdomain has subdomain.example.com/robots.txt file: -- user-agent: * allow: / sitemap: http://example.com/sitemap-subdomain.xml -- i think approach complies sitemaps protocol, however, google webmaster tools give errors subdomain sitemaps: "url not allowed. url not allowed sitemap @ location." i've checked how other sites it. eventbr...

java - How should one distribute the Javadoc for a Library? -

i writing custom library. it's build .jar archive. able generate javadoc, don't know how should distribute it? put in same .jar library put in different .jar some other way? and how include javadoc in project uses lib? if had put in same .jar, should have written in manifest? if it's in separate .jar, including in project enough? i using netbeans 9.1. i'd include library .jar , documentation , other things, readme, license file etc. in single archive (zip or tar.gz) mylib-1.0.1.tar.gz , contains: mylib-1.0.1/ ├── javadoc │   └── index.html (and other javadoc files under here) ├── mylib-1.0.1.jar └── readme instead of expanded javadoc/ sub directory within archive, add compressed javadoc in mylib-1.0.1-javadoc.jar (or zip) , both options common. mylib-1.0.1/ ├── mylib-1.0.1-javadoc.jar ├── mylib-1.0.1.jar └── readme

WCF in StreamInSight -

how implement streaminsight server, input adapter , output adapter wcf service? please provide me sample projects.. have looked @ streaminsight product team samples on codeplex ? include basic version of wcf input/output adapters.

.net - Want to find the control over which mouse is placed in wpf -

i have main control in wpf. , many controls placed in main control. when mouse moves on main control want find on control in main control mouse placed. sounds want uielement.inputhittest . takes in 2d point (relative uielement's location) , returns iinputelement uielement implements. example... button button = mywindow.inputhittest(mouseposition) button; if (button != null) // blahblahblah

html - fillText is not working in the Safari 3 -

i using html5 filltext method of canvas in coding.it working file in ie6+,but not working in mozilla 3.0, have tried mozmeasuretext , after working in mozilla 3.0, filltext not working in safari 3+. is there solution or patch safari 3+. safari 3 doesn't have filltext. (safari 5 does) you can use library, though, add safari 3: http://code.google.com/p/canvas-text/

javascript - Calling Borland C++ Builder application from ASP.NET/C# -

i'm new borland c++ builder , application i'm working on has launched asp.net application on click of button. asp.net application able launch other exes (made in c#) when application launched crashes msg "an error has encountered, please tell microsoft problem" button "don't send" "send error report" , "debug". asp.net program able call "notepad.exe" not written on .net. so, how call application asp.net/c# written in borland c++ builder , launching when double click application. can check event log more information on caused error, guess cannot load c++ dll.

oop - Can a PHP object instance know its name? -

if have code this: class person { $age; $height; $more_stuff_about_the_person; function about() { return /* can person's name? */; } } $john = new person(); $peter = new person(); print $john->about(); // print "john". print $peter->about(); // print "peter". is possible print person's name, stored variable name, method? as it's not standard procedure, i'm guessing it's bad idea. i've looked , can't find it. no. objects can have multiple names, or no names. happen here: $john = new person(); $richie = $john; // $john , $richie both refer same object. print $richie->about(); or here: function f($person) { print $person->about(); } f(new person()); if objects need know own names, need explicitly store names member variables (like $age , $height ).

mySQL show database for user -

anyone knows mysql syntax show database names specific user has privilege see in mysql database? user 'dimitris' accessing database @ 'localhost', syntax see databases has privilege select, update, insert etc? dimitris you can list of databases have access with: show databases; if want list other user user you're logged in as, have query mysql.db table.

php - problem with special characters -

i retrieving articles blog webiste mysqldb. articles displayed fine on blog on website characters such ţ,ş,ă etc replaced black square question mark inside . have "utf-8" set on document same on blog. you need tell mysql connection must made in utf-8. use function mysql_set_charset (you need php 5.2.3). if use php < 5.2.3 try : mysql_query("set character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $conn); also make sure headers tells document in utf-8 ( header function and/or html meta tags correctly set). also make sure php files saved in utf-8 without bom .

c# - Read source code from tabs in IE/Chrome/Firefox -

using c# , .net version i'd create program can read source code open tab using ie, firefox or chrome. program use myself. haven't been able find useful information googling subject. thanks! maybe it's bit overkill using c#. i'd using javascript , bookmarklet, loading url , displaying in overlay on page... if it's yourself.

artificial intelligence - Genetic Programming library for Java -

i'm looking genetic programming library jvm. (not genetic algorithm genetic programming) tried jgap (jgap.sourceforge.net) , watchmaker (watchmaker.uncommons.org). unfortunately, tools have experimental , immature support genetic programming (they focused on genetic algorithms). perhaps know better tool genetic programming, jvm (can written in java or other compiled language jvm). i'm not looking comprehensive list of gp tools, i'm rather looking good, popular tool (just popular operating systems windows, linux , mac, , popular java ides eclipse, idea , netbeans). it doesn't have genetic programming library (gp), can (and better) gene expression programming library (gep). edit (after 2 months since question): analyzed of links posted , available in wiki , must each of libraries have @ least 1 of following problems: no open-source, or open-source, restrictive (gpl); no documentation (or poor one); no built-in support genetic programming or gene expressi...

postgresql - How to create production database sample for testing? -

is there tool (for posgresql, ideally), can make small, consistent sample of big database? the need testing database, don't want copy production one. first, because big , second, nature of testing implies testing database recreated several times in process. obviously, can not take random rows tables, because violate hell out of foreign keys , not. so, wonder there tool available can that? what generating mock data tool databene benerator , as want, , store them reuse.

content management system - designing a web-cms database for an assignment -

i designing database system web cms. have added "status" column in "content" table shows status of each content in time. know there special values status can accept : 'draft', 'comment waiting', authorizing pending' and... want create check constraint make column accept above values. correct work? whole of status values can use in constraint? use enum() data type of status column. e.g.: create table example ( ... status enum('draft','comment waiting','etc.') not null, ... );

jquery validation -

i using jquery validation follow var validator=$("#myform") .validate({ rules: { field1: { required: true }, field2: { required: true }, field3: { required: true }, field4: { required: true } } }); field1, field2 in tab0 , field3,field4 in tab1 if click in tab1 without fill field1, field2 , fill field3, field4 validation true. i guess in case field1,field2 hidden because of tabs. here form <form id="myform" enctype="multipart/form-data" method="post" action="myaction.php" > <div id="tabs"> <ul> <li><a href="#tab-1">tab1</a></li> <li><a href="#tab-2">tab2</a></li> </ul> <div id="tab-1"> <input type="text" name="field1" id=...

C++ keeping access to protected member (of the function argument) when specializing base template class -

could please resolve (the problem persistent under both gcc , vc++). template <class t> class a{ protected: t a; public: a(int aa=0){a=aa;} virtual ~a(){} virtual void plus(a const *aa){a=a+aa.a;} }; class b:public a<int>{ public: b(int bb=0):a<int>(bb){} virtual ~b(){} void plus(a<int> const *aa){a=a+aa->a;} //<--problem: can access not aa->a? }; this expected. an instance of b has no right poking around in internals of arbitrary a; has right access part of (other) bs. that's protected keyword means.

e commerce - Looking for shopping cart ONLY app or hosted service recommendation -

i have been tasked selling made-to-order products online. have web-based product configurator , order processing system set produces prices, interfaces our inventory system, etc. i've reviewed magento , ubercart , appear much; management perceives integrating unnecessary abstraction have going. in addition, our pricing structure arranged in such way overwhelming task me extend pricing system in feature-rich ecommerce platform. i need able send arbitrarily generated product description , price cart , have handle sale checkout , secure payment gateway headaches. is there out there allows that? i ended going fairly-basic drupal site , rolled own very-basic cart module.

xcode - Using Objective-C++ static library in straight Objective-C target -

i build static library uses objective-c++. when used in straight objective-c target, get undefined symbols: "___gxx_personality_v0", referenced from: i can solve adding -lstdc++ target's "other linker flags". question: there way specify in static library make step unnecessary? (otherwise, have document step users of library.) and answer is… no. document flags library requires.

javascript - ExtJS Cell Selection Model with PivotGrid Doesn't Work -

i'm trying change selectionmodel of pivotgrid , isn't working. here code. can tell doing wrong. i need use cellselectionmodel want drill down , need top , left axis intersection points. i have tried 'cellclick' event in extjs 3.3 api no luck. selection model other default rowselectionmodel working? var pivotaccumgrid = new ext.grid.pivotgrid({ store : my_store, aggregator: 'count', measure : 'my_field', sm: new ext.grid.cellselectionmodel({ //i have tried selmodel key listeners: { cellselect: function(sm,row,col) { ext.msg.alert('click','got click!'); } } }), topaxis: [ {dataindex: 'top_field'},{dataindex: 'top_field2'} ], leftaxis: [ {dataindex: 'left_field', width: 80} ], }); this quick fix introduces new property meta in pivotgridview can later used out cell indices. of code isn't different,...

ASP.NET postbacks lose the hash in the URL -

on asp.net page tabstrip, i'm using hash code in url keep track of tab i'm on (using bbq jquery plugin ). example: http://mysite.com/foo/home#tab=budget unfortunately, i've realized there couple of places on page i'm using old-fashioned asp.net postback stuff, , when postback complete, hash gone: http://mysite.com/foo/home ... i'm whisked away different tab. no good. this webforms site (not mvc) using .net 4.0. can see, though, using url routing. is there way tell asp.net keep hash in url following postback? the problem postback goes url of current page, set in action of form on page. default url without #hash in asp.net, , automatically set asp.net, have no control on it. you add #hash forms action attribute javascript: document.getelementbyid("aspnetform").action += location.hash or, if updating action hash in it: var form = document.getelementbyid("aspnetform"); form.action = form.action.split('#')[0] +...

What's a good way of connecting a Windows service with an interactive window (HWND)? -

i have 2 pieces of windows technology i'd plumb together: tsp ( a tapi service provider ) , api wrapped around hardware. api accepts requests synchronously returns success/fail/status result asynchronously sending messages passed-down hwnd. as understand it, problem because tsp runs windows service, execution context doesn't have access interactive windows functions. so, i'd directly link 2 together, can't - far can tell, tsp doesn't ( and indeed couldn't ) have hwnd api send messages to. :-( for me has ever programmed windows stuff on 1 side of service/interactive line @ time, of bit of head-scratcher. windows being way is, there must several sensible ways of getting messages across line, surely? how advise me try hook these 2 things? thanks! :-) a service can create "message window" (a window whos parent hwnd_message) , run message pump. message window has no ui , therefore doesn't interact desktop.

php - Regex to parse Email Form "To" field -

if there 1 handle this, correct regex pattern extract email addresses string coming email form "to" line, allows addresses delimited commas ",", semicolons ";", spaces, or combination of three. regex has able ignore "noise" text, such if address enclosed in "<" , ">" characters, or has actual name next email address. example, string in field: "joe smith" <jsmith@example.com>, kjones@aol.com; someoneelse@nowhere.com mjane@gmail.com the pattern should able return following matches of: jsmith@example, kjones@aol.com, someoneelse@nowhere.com, mjane@gmail.com i using php, if can't done in single regex im open other php-based solutions. thanks try \b[a-z0-9._%+-]+@(?:[a-z0-9-]+\.)+[a-z]{2,6}\b (courtesy of regexbuddy ) in preg_match_all('/\b[a-z0-9._%+-]+@(?:[a-z0-9-]+\.)+[a-z]{2,6}\b/i', $subject, $result, preg_pattern_order); $result = $result[0]; note /i modifier mak...

Implementing Timeout Javascript in a PeopleSoft iScript -

regular peoplesoft components automatically generate timeout popup window when user logged out. iscripts, however, not. i reverse-engineer javascript peoplesoft automatically generates components in order leverage existing code. before do, thought i'd check if else has done this, , if there gotchas, tips or tricks. or maybe there's better way? i reverse engineered how navigation collections page (which iscript) works since handles timeouts. solution relatively simple. first, include results of %request.expiremeta (peoplecode function) in portion of html generate. secondly, include delivered javascript pt_savewarningscript in html generate. finally, have iscript call javascript function setuptimeout().

type of class in python -

why if do: class c(): pass type(c()) i got: <type 'instance'> , if do: class c(object): pass type(c()) i got: <class '__main__.c'> ? the first not userfull look difference between old-style , new-style classes. former default, , latter inherit explicitly object. all old-style objects implemented built-in type instance. fact still default , type remains 'instance' result of retro-compatibility precautions. this extracted python docs (http://docs.python.org/reference/datamodel.html) 3.3. new-style , classic classes classes , instances come in 2 flavors: old-style (or classic) , new-style. up python 2.1, old-style classes flavour available user. concept of (old-style) class unrelated concept of type: if x instance of old-style class, x. class designates class of x, type(x) . reflects fact old-style instances, independently of class, implemented single built-in type, called instance. ...

java - Why is this JPanel not sticking to the specified size? -

so, i'm trying learn java swing , custom components. i've created jframe, given background color, , added jpanel: jframe frame = new jframe("testing"); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setsize(1000, 2000); frame.setbackground(color.white); jpanel jp = new jpanel(); jp.setbackground(color.blue); jp.setsize(40, 40); frame.add(jp); frame.setvisible(true); the result 1000x2000 window colored blue (as opposed white window 40x40 blue box inside it). why jpanel expanding beyond specified size? using code, add 1 line change layoutmanager of jframe . then, when add component, keep it's preferred size. also, instead of calling jp.setsize(40,40) , call jp.setpreferredsize(new dimension(40,40)). and, need call pack() on jframe tell layout components. jframe frame = new jframe("testing"); frame.setlayout(new flowlayout()); // new line of code frame.setdefaultcloseoperation(jfr...

c# - about windows services -

have 2 questions: can windows services register receive sens network events because service stops when try it. after service onstart() method has been called, if no seperate timer or thread started, service stop ?? note: using c# services implement service thanx, ab you should able to, i'm not real familiar sens should able (outside of ui related, , that's doable more caveats). 1 thing might want check out user account service running, may need use localservie or localsystem have proper permissions. no process continues run, if don't have timer or other mechanism invoke code, service won't anything.

c# - Improve the design of GUI/website -

so using visual studio 2008, asp.net 3.5, basic toolkit provided. now have made gui lot of functionality design basic. , looks old. i need give new look, new feeling new designs.... like gridview, buttons textboxes, menus basic... not working me. please let me how should go doing this.?? 1) have herd tool kits dont kno ones good..(dont want expensive ones) if company ready spend. 2) new vs 2010 or asp.net 4.0 make difference. 3) ajax toolkit or silverlight toolkit good? 4) need show charts , graphs now, using ms charts.. need good. your best bet ask specific questions @ more appropriate forum. for ideas on designs, examples online , similar like. http://www.thecssawards.com/ http://www.csselite.com/ for questions on how implement specific design in html/asp.net/whatever, post specific question here. for ui guidance on how make specific better, post question on http://ui.stackexchange.com . include small screen shot of applicable controls (not wh...

Easiest way to get count val from mysql in bash -

maybe should use python or perl dont know any. i have 4 statements , check if there errors longer hour. user setup dont need enter mysql user/pass. statement in mysql_webapp_error_check.sh #!/bin/bash mysql testdb -e "select count(*) tbl last_error_date < date_sub(now(), interval 1 hour);" how make give me return value (count(*)) instead of printing screen? then i'll write if statement , output stdout/err cron use email me (otherwise want script silent nothing emailed unless theres problem) #!/bin/bash echo show databases\; | mysql -u root | (while read x; echo "$x" y="$x" done echo "$y" )

.net 4.0 - VB.Net Serialize anonymous type to xml -

in mvc can following serialise object anonymous type json... public function getstatelist() jsonresult dim myobject = new {.id = 1, .property = "somevalue"} return me.json(myobject) end function which return like; { "id": 1, "property"somevalue", } i'd same output xml. haven't been able find equivalent method. please point me in right direction? many thanks the short answer cannot, see post . recommend create concrete type represent structure of anonymous output, , use normal xml serialization technique example i've provided below. here basic example of how use (sorry it's in c# syntax): using (memorystream memstream = new memorystream()) { system.text.utf8encoding utf8 = new system.text.utf8encoding(); // read , convert byte array xmlserializer serializer = new xmlserializer( <<yourobject>>.gettype() ); serializer.serialize( memstream, <<you...

rest - How do I get NHibernate to save an entity if I assign it an ID, but generate one otherwise? -

according rest philosophy, put request should update resource @ url if exists, , create if doesn't exist. in other words, if use following url: put http://server/item/5 if item exists id of 5, updated. if item doesn't exist id of 5, new item created id of 5. however, i'm using nhibernate persistence, , mapped ids identity . means no matter value assign id, nhibernate replace own when save new item . how nhibernate save item id assign it, without changing id mapping assigned ? if use identity, db won't allow enter value. that said, if db has special syntax allow inserting explicit values in identity fields, can implement own generator, guarantee error prone, hard debug, , not useful. it's possible. study in https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate/src/nhibernate/id , start creating frankenstein :-)

iphone - which control touched -

in below code how can understand control touched?(imagine exist button1,label1,.. on view) - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [touches anyobject]; } check view property on touch object. documentation: the value of property view object in touch occurred.

python - Passing arguments inside Scrapy spider through lambda callbacks -

hi, i'm have short spider code: class testspider(crawlspider): name = "test" allowed_domains = ["google.com", "yahoo.com"] start_urls = [ "http://google.com" ] def parse2(self, response, i): print "page2, i: ", # traceback.print_stack() def parse(self, response): in range(5): print "page1 : ", link = "http://www.google.com/search?q=" + str(i) yield request(link, callback=lambda r:self.parse2(r, i)) and expect output this: page1 : 0 page1 : 1 page1 : 2 page1 : 3 page1 : 4 page2 : 0 page2 : 1 page2 : 2 page2 : 3 page2 : 4 , however, actual output this: page1 : 0 page1 : 1 page1 : 2 page1 : 3 page1 : 4 page2 : 4 page2 : 4 page2 : 4 page2 : 4 page2 : 4 so, arguemnt pass in callback=lambda r:self.parse2(r, i) somehow wrong. what's wrong code ? the lambdas accessing i b...

php - CakePHP JS Helper: How to set jQueryObject var outside of view? -

i using js helper in cake 1.3 , due need use jquery in noconflict mode, have set in every view: $this->js->jqueryengine->jqueryobject = 'jquery'; i have lot of views rely on this, , i'd avoid having enter line @ top of every view needs it. tried setting jqueryobject var in app_controller.php file, did not work. i'd rather not hack core jquery_engine.php file. is there way set jqueryobject var globally within app? thanks! how solved it: i created own js engine helper ( views/helpers/my_jquery_engine.php ) following code: app::import('helper', 'jqueryengine'); class myjqueryenginehelper extends jqueryenginehelper { var $jqueryobject = 'jquery'; } then in app_controller, say: var $helpers = array('js' => array('myjquery')); works charm.

silverlight - Item Template in the ItemPresenter -

in template itempresenter defines host panel items. possible define itemtemplate? <controltemplate x:key="itemscontroltemplate" targettype="itemscontrol"> <grid> <grid.rowdefinitions> <rowdefinition height="*"/> </grid.rowdefinitions> <scrollviewer> <itemspresenter width="{templatebinding width}" height="{templatebinding height}"/> </scrollviewer> </grid> </controltemplate> to go further, i've created class: public class itemscontrolextended : itemscontrol { public itemscontrolextended() { defaultstylekey = typeof(itemscontrolextended); } } and create dependency property "itemsmargin". after i've done i'm supposed bind item "margin" property "itemsmargin". how possible implement? getcontainerforitemoverride ? preparecontainerforitemoverri...

syntax - How to do exponentiation in bash -

i try echo 10**2 it prints 10**2 . how make work? you can do: let var=10**2 # sets var 100. or better , recommended way: var=$((10**2)) # sets var 100. if want print expression result can do: echo $((10**2)) # prints 100. for large numbers might want use exponentiation operator of bc as: bash:$ echo 2^100 | bc 1267650600228229401496703205376 if want store above result in variable can again use $(()) syntax as: var=$((echo 2^100 | bc))

jquery - Clicking on a <li> object and excluding tags under it -

possible duplicate: how ignore click event when clicked on children. i wanted know how can build <li> clickable jquery while inside it, have <a href="/home"> don't want same click on rest of li do... example : <li> <div> bla bla </div> <div> <a href="/home"> </a> </div> </li> and jquery code : $(document).ready(function () { $('li').hide(); $("li").toggle( function () { $(this).next().show("slow"); }, function () { $(this).next().hide(); } ); }); now want toggle function not work on <a href> on rest of <li> , explain, when click on link want reach "/home"... thanks, golan the problem comes fact click event happens on tag bubbles happen on list item, , other elements happen in branch of dom. the solution stop bubbling in click event on ...

Super simple to use (hand holding) project management software? -

currently 2 person programming team, project manager whom doesn't have experience in project management. need simple, hold hand of project manager. far more important features ease of use. deal gloried todo list - milestones. thanks basecamp ? enough two-person team keep track of todos, milestones, , basic communication.

jsf - richfaces 3.3.3 on google app engine -

i'm trying run richfaces 3.3.3final google app engine richfaces uses javax.imageio.imageio restricted class. is there workaround problem ? this indeed known . however, @ last javaone jboss presented richfaces in cloud jboss introduced richfaces 4.0 gae archetype (for maven2).

c# - How to display elements only if SQLDataSource has rows -

i'm creating asp.net/c# page user enters id @ top of page, , when press submit, page posts , displays data. right now, data fields displayed @ times - when page loads , no search has taken place. not ideal when navigate menu multiview have made, errors come up. plus it's not practise. is there way can hide these elements (they detailsviews , gridviews, plus multiview , menu) if sqldatasource blank? if search returned nor esults, or no query has been executed yet. thanks you surround these elements placeholder control , set placeholders visibility depending on whether there result display. haven't used sqldatasource object before meet requirements suggest checking see if page has been posted in pageload method , if not hiding data controls. handle case of no results being returned adding method sqldatasource.selected event: aspx: <asp:placeholder id="myplaceholder" runat="server"> ....data controlds </asp:placeholder...

ruby on rails - Simple helper method - Am I doing it right? -

new ruby , rails. i developing simple app can register teams, players etc , looks this: team has_many players players belongs_to team when want show player in view(normal users): <%= @player.name %> - <%= playerteam %> and in admin view looks this: <% @players.each |player| %> <tr> <td><%= player.id %></td> <td><%= player.name %></td> <td><%= playerteam(player) %></td> <td><%= owner(player) %></td> </tr> <% end %> and helper method: def playerteam(player = nil) if player != nil if player.team_id == nil return "no team" else @team = team.find(player.team_id) return @team.name end else if @player.team_id == nil return "no team" else @team = team.find(@player.team_id) return @team.name end...

amazon s3 - Removing response headers when accessing images from S3 -

can remove response headers when accessing images stored on amazon s3? by default giving following headers: x-amz-id-2: x-amz-request-id: server: by default giving amazon related values these headers. there way remove headers? not without proxying requests through software control can strip headers. pretty sure amazon has no user setting that.

JavaScript wrapper for Google Gears / HTML5 -

are there javascript wrapper scripts available can use html5 javascript features if available (e.g. locastorage / web storage / in common between google gears , html5), falling google gears if browser not capable (e.g. ie6 or ie7) while ideal ie7/6 users move ie8 (or chrome, firefox, opera), still around years come (maybe ie6 not last long ie7, ie7 lacks real javascript changes). for feature detection think here recommend excellent modernizr . of course you'd still have write gears part yourself, isn't hard - secondary test after modernizr reporting features you're looking isn't available, or creating own test addtest() api . it comes across little odd you're trying use gears fallback html5 components - far can tell, gears penetration very low, can't reliable fallback those. although functionality similar, syntax isn't, going writing twice amount of code that's unlikely used.

actionscript 3 - how to hide a row without deleting item from dataprovidor in DataGrid...AS3,Flex? -

how can hide row @ specific index of datagrid in as3 ? if dataprovider of datagrid arraycollection can specify filterfunction property it, that dataprovider.filterfunction = function (item:object):boolean{ if (dataprovider.getitemindex(item)==indexofrowyouwanttohide){ return false; } return true; }; the item still in arraycollection made invisible filter. not efficient solution works. need call dataprovider.refresh(); to apply filter. update: access raw, unfiltered data of arraycollection should use list property, if hid item @ index 0 , still want able access this: dataprovider.list.getitemat(0);

xml rpc - PHP remote procedure calling -

i have 2 servers on php need communicate, calling remote methods of each other. xml-rpc php not solution because it's slow, , can't call multiple methods in 1 request. try multirpc - multiple methods calling in 1 request, encrypted , compressed protocol.

sql server 2000 - Generate list of week number + start date + end date against any year using SQL query -

i want generate temp table following columns: weekno startdate enddate using udf having year parameter ( year(yyyy) ). why should consider using auxiliary calendar table?

HTML Snapshot for crawler - Understanding how it works -

i'm reading article today. honest, im interessed "2. of content created server-side technology such php or asp.net" point. i want understand if have understood :) i create php script (gethtmlsnapshot.php) include server-side ajax page (getdata.php) , escape (for security) parameters. add @ end of html static page (index-movies.html). right? now... 1 - put gethtmlsnapshot.php? in other words, need call (or better, crawler need) page. if don't have link on main page, crawler can't call :o how can crawler call page _escaped_fragment_ parameters? can't know them if don't specific them somewhere :) 2 - how can crewler call page parameters? before, need link script parameters, crewler browse each page , save content of dinamic result. can me? , think technique? won't better if developers of crawler own bots in others ways? :) let me know think about. cheers i think got wrong i'll try explain what's going on here including ba...

vb.net - How to have an integer string in an enum? -

i know proper enum: private enum months january = 1 february = 2 ... end enum however, want have enum string solely integers. example: private enum columncounts 01 = 5 02 = 4 03 = 40 end enum the 01, 02 , 03 strings. however, if put "01", [01] or 01, tells me expects end of enum , isn't valid statement. there way accomplish i'm missing? tried. 01.tostring(), wasn't option. :) , appreciated. thanks. edit: public class part private enum columncounts f01 = 39 end enum public shared function validatecolumns(byref lstfields list(of string)) boolean each colcount in [enum].getvalues(gettype(columncounts)) if colcount = "f" + lstfields(1) 'right here need compare count of list vs. value of enum.' return true end if next return false end function end class essentially, didn't want put f in there, wanted 01. way called is: select case (nrecordtype) case ...

securityexception - Silverlight - ClientAccessPolicy.xml Syntax -

i'm trying communicate apache web server in cross-domain way. i have clientaccesspolicy.xml file set on root of domain , retrieved silverlight client when attempting make request java servlet that's been set up. the specifics this: url access: dev.corp.companyname.com/servlets/targetservlet the clientaccesspolicy.xml file looks this: <access-policy> <cross-domain-access> <policy> <allow-from http-request-headers ="*"> <domain uri ="http://*" /> </allow-from > <grant-to > <resource path ="servlets/targetservlet" include-subpaths ="false"/> </grant-to> </policy > </cross-domain-access> </access-policy> i'm getting common securityexception "security error" it's message. assume means clientaccesspolicy.xml file set correctly. so here questions: should <domain uri =...

objective c - Sort strings in ascending -

i have array of strings in following format 5_5_a, 10_10_a, 0_0_a 1_1_a etc. want sort them in ascending/descending order. when use sortedarrayusingselector:@selector(compare:) 0_0_a,10_10_a,1_1_a,5_5_a. tried parse each string 5 5 chunks , cast int put first element array addobject:myinteger got warnings when compiling. please let me know if missing something. mark this because ascii code of '_' bigger '0'. i don't know if can change '_' '-' example ? fix problem , able use sortedarrayusingselector . if not can : [str stringbyreplacingoccurancesofstring:@"_" withstring:@"-"] then sort array , replace '-' '_'. (it solution... not best 1 ^^)

database - The Relational Model & Queries That Naturally Return Duplicate Rows -

it's commonly understood in relational model: every relational operation should yield relation. relations, being sets, cannot contain duplicate rows. imagine 'users' relation contains following data. id first_name last_name 1 mark stone 2 jane stone 3 michael stone if runs query select last_name users , typical database return: last_name stone stone stone since not relation - because contains duplicate rows - should ideal rdbms return? "but information lost - there 3 users last name." if count of users name interested in, query of example not question should asking. the query of example provide answer question "what last names such there exists user has last name ?". if question want ask "how many users there named 'stone'", query should submit select count(...) users last_name = 'stone'; projection always "looses" information. information tied attributes projecte...

php - Cron running but functionality not working -

i have several php files run cron. set crons using command- crontab crontab.txt inside crontab.txt file, have written cron commands this:- #(updating tutor activities) - every minute * * * * * /usr/bin/wget -o - -q -t 1 http://project/cron/tutor_activities.php but none of functionalities working (database queries, sending reminder mails etc.). running urls manually works. then put mail address in mailto , received mails. in mail, received entire html source of page. expected in mail? why functionalities not working? updates if change cron commands #(updating tutor activities) - every minute * * * * * /usr/bin/wget http://project/cron/tutor_activities.php still no success , comes in mail - --15:03:01-- http://project/cron/tutor_activities.php => `tutor_activities.php' resolving project... ip address connecting test.project|ip address|:80... connected. http request sent, awaiting response... 301 moved permanently location: http://project./ [...

java - using servlets in a struts 2 project -

i building application using struts2. web.xml file looks below <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> the application runs fine. have jsp needs input servlet, wrote servlet , added servlet-mapping in web.xml, server cannot find servlet because of filter-mapping. how use servlets in struts 2 , should web.xml like? from: http://struts-2.464677.n5.nabble.com/using-servlets-in-a-struts-2-project-td465399.html resolved !, filter mapping everthing struts2 besides 1 servlet? , http://struts.apache.org/2.2.1/docs/webxml.html

EditText in Android -

Image
i have edittext , button below edittext. edittext has width fill_parent , height wrap_content. my messages covers full screen, due button not visible hides below virtual keyboard can 1 sort problem. thanks. i've had success similar, not identical to, andrew's solution: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <edittext android:id="@+id/myedittext" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" /> <button android:id="@+id/mybutton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout...

How can I represent math variables in c#? -

i need represent these mathematical equations in code , solve them: 2x = 3y 3y = 4z 2x + 3y + 4z = 1 please advise. (i suspect homework, give clues how proceed...) think how solve these equations on paper. the same steps can written software. each equation has variable , coefficient , want represent coefficient variable in program, , "solve" equations using same techniques hand.

php - Unable to find phpexcel comment in xlsx file -

using code able create comment in excel file. $comment = $data_sheet->getcommentbycolumnandrow($col, 1); $comment->setauthor($table_name . '.' . $field_name); $comment->setwidth('200px'); $comment->setheight('24px'); $comment->setvisible(false); # activecell.comment.visible = true $objcommentrichtext = $comment->gettext()->createtextrun($table_name . '.' . $field_name); when saved file has comments in it, , can edited on re-opening file comment object in default condition. $comment = $data_sheet->getcomment('a1'); result :- $comment = phpexcel_comment object ( [_author:private] => author [_text:private] => phpexcel_richtext object ( [_richtextelements:private] => array ( ) ) [_width:private] => 96pt [_marginleft:private] => 59.25pt [_margintop:private] => 1.5pt [_visible:private] => [_height:private] => 55.5pt [_fillcolor:private] => php...

c# - Design Pattern for creating a set of data objects -

i'm writing code stuff , i'm pretty sure not designed @ moment can't think how should refactoring make nicer... the simple summary have code goes through files in directory structure , different directories contain different content types. have limited number of these content types , have content type object creating lot of add list in way such follows: contenttypes.add(new contenttype { contentname = "2010 call report", foldername = "2010 reports", renamefile = false }); contenttypes.add(new contenttype { contentname = "2010 email report", foldername = "2010 reports", renamefile = false }); contenttypes.add(new contenttype { contentname = "above average call recording", foldername = "call recordings", renamefile = true, hasmultiple = true }); contenttypes.add(new contenttype { contentname = "below average call recording", foldername = "call recordings", r...