Posts

java - How to Remove Duplication from Spring 3 MVC Standard and Ajax Request Controllers and Views -

lately i've been running same issue spring mvc applications on , on again, , i'm trying come long term solution. the problem in standard spring 3 controller, add model objects, specify view name (either inline or injected field) , return. problem i've run if have request returns page person, , pets have (not compilable, psuedo): @requestmapping( value="personoverview", method="get" ) public string getpersonoverview(model) { model.add(personrepo.getperson( thename )); model.add(petrepo.getpetsforperson( theperson )); return "personoverviewviewname"; } now, in view able render of information. however, issue arises when updates "pets" person, , want re-render part of page shows pets. not need rewrite rendering logic in jsp fragment or in javascript, need duplicate controller code each portion of getpersonoverview method. if break controller methods smaller chunks, not able render full page, have render each ch...

php - social media feeds - client or server side requests? -

i'm curious other developers when integrating twitter, facebook , other such feed content on site. make these requests , handle on client or server side? seems there number of jquery plugins out there handle type of simple integrations tend have sites, e.g 3 latest posts. previously, using php (twitter became more complicated integrate when switched openauth) content twitter, blogger etc, i'm wondering if there real need when can done javascript. obviously, if javascript isn't enabled feeds wouldn't display. interested hear people in situation! i tend hook directly feeds client-side code, unless i'm doing complicated, need additional validation or cache results of feed. the rationale if grab feeds on server, have 2 download data twice - once api server server, , once server - whereas grabbing directly api in client-side code results in single http request, should arguably load quicker. of course, if you've got lot of traffic, third-party se...

persistence - WF4 Workflow under AppFabric not resuming properly after IISreset -

folks, i've been having trouble wf4 problem. i'm modeling batch engine/work scheduler after ron jacobs' demo in endpoint.tv webcast ( http://archive.msdn.microsoft.com/wf4batchjob ). in example, "work branch" counts inside while loop. sample, send message workflow called sampleengine.xamlx counting. every count, workflow calls parent (jobscheduler.xamlx) , reports progress completed. works , have working - can schedule job , watch progress both in appfabric dashboard , calling queryprogress (a send/receive pair in scheduler workflow). the problem when iireset simulate server failure or other problem, workflows (sampleengine.xamlx , jobscheduler.xamlx) both come online , show "in progress". problem neither of them track more events - seem stalled somewhere. furthermore, neither of them respond service messages in same way see wf services respond when there's no receive activity scheduled workflow's current state. i've added persist a...

c++ - DllMain freezing When register a COM dll -

i try register com dll named mixcenter.dll . have found out dlls dependent on. when executives dllmain first time, freezes , never returns. seems deadlock, don't call loadlibrary , , never execute dllmain . there other reasons situation ? dllmain looks like: bool apientry dllmain(handle hmodule, dword ul_reason_for_call, lpvoid lpreserved) { switch(ul_reason_for_call) { case dll_process_attach: g_hinstdll = hmodule; log(info) <<"--------------begin logging--------------"; return dllentrypoint((hinstance)hmodule, ul_reason_for_call, lpreserved); case dll_thread_attach: break; case dll_thread_detach: break; case dll_process_detach: log(info) << "--------------end logging--------------"; break; } return true; } i log whole execution using dependency walker, essential part ...

C++ how to pass method as a template argument -

suppose have class x : class x { // ... size_t hash() const { return ...; } }; i create std::tr1::unordered_map<x, int, hashfn> want pass in x::hash() hashfn . know can declare own functor object. feel there should way directly passing pointer x::hash() . is there? no; you've shown it, need small utility struct: #include <functional> template<typename t, std::size_t (t::*hashfunc)() const = &t::hash> struct hasher : std::unary_function<t, std::size_t> { std::size_t operator ()(t const& t) const { return (t.*hashfunc)(); } }; then can create unordered_map so: std::tr1::unordered_map<x, int, hasher<x> > m;

asynchronous - c# how to set the code run at final -

i need set line of code run after has finish run. know how that? private void scanbt_click(object sender, eventargs e) { var folder = @"c:\users\shen\desktop\lenzocr\lenzocr\windowsformsapplication1\imagefile"; directoryinfo directoryinfo; fileinfo[] files; directoryinfo = new directoryinfo(folder); files = directoryinfo.getfiles("*.jpg", searchoption.alldirectories); var processimagesdelegate = new processimagesdelegate(processimages2); processimagesdelegate.begininvoke(files, null, null); **//here line of code need run after finish run system.io.file.delete(@"c:\users\shen\desktop\lenzocr\tempfolder\temppic.jpg");** } private void processimages2(fileinfo[] files) { var comparableimages = new list<comparableimage>(); var index = 0x0; foreach (var file in files) ...

php - How do I prevent internet explorer from rewriting my text? -

i have javascript variable contains url, populated outputting script tag php. intention change webpage url under circumstances. var url = "/somepage?q=3&region=1"; the problem url contains sequence "&reg" internet explorer changes "®" without being asked. i've tried escaping whole url htmlspecialchars, breaks other browsers. turning off quirks mode might help, it's not option current system. adding script tag did nothing. edit: figured out 1 solution, "escaping" url concatenation. var url = '<?php implode( "&'+'", explode( '&', '/somepage?q=3&region=1' ) ); ?>'; i realized should mention how change page: document.location.href = url; edit: turns out had error in script tag. minimal example shows same "problem": <script type="text/javascript" /> var url = "/test?mode=preview&region=1"; </script> the...