Posts

Showing posts from March, 2014

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - Regex matching doesn't work even though the pattern is correct -

it's been few years since i've used regex, if remember correctly, following should work: string test = "axaxa"; pattern p = pattern.compile("([a-c])x\1x\1"); matcher m = p.matcher(test); m matches nothing on run. super simplified version of i'm doing in code. example taken java tutorial on regex! tried rewrite html matching code way when didn't work, went researching, thinking did wrong... according internet, haven't. so. have clue why doesn't work? extra info, test.matches(the_pattern) returns false . seems group backtracking messing up. try using \\1 in pace of \1 . \ escape character in java string. send \1 regex engine, need escape \ \\1 .

c# - asp.net publish only pages -

i have asp.net 3.5 web project. there lots of images on images folder. apprx. 1.5gb size. everytime want publish project, takes 35minutes. dont want publish folders. want publish pages. im using shared web hosting. how can solve problem? thanks. remove images folder project. publishing website publish folders part of project, removing folder project ensure not published. this add burden maintaining site , ensuring have images on development environment. you can still have in source control if wish.

erlang - CouchDB heart-beat time-out -

my couchdb (production) server shut down, without wanting to. while inspecting logs noticed erlang/couchdb (one or other) sends heart beat, , heart beat monitored. when time-out occurs, server brutally killed ( couchdb -k ). unwanted behaviour, on production server. i've come across this issue , states same , indicates occurs during heavy server loads, noticed also. i'm looking solution keep server running, need know more behaviour. unfortunately both the couchdb wiki , the guide don't give information (only parameter in changes api). can provide more info this? the couchdb -k should kill background process , couch should restarted. default restart feature disabled. enable should use -r parameter value greater 0. can in bin/couchdb script - change respawn_timeout 0 e.g. 5.

logging - message passing in python -

i read metaphor objects use message passing while passing message object. possible capture/log such messages! learning purposes, thought necessary handly tool provenance system! you might want @ aop (aspect oriented programming) . in essence allows capture object events such method invocation , apply logic them. in case it'd print out traces. have @ a lightweight approach aspect-oriented programming in python , should need.

Dynamic WCF Service Contracts based on authentication credentials -

1) want have client application adds reference wcf service 2) client application should able send credentials wcf service 3) based on credentials permissions, wcf service should return appropriate interface (service contract) client 4) client consumes it. e.g. suppose hav class @ server, defines entity 'asset' , have methods related possible operations on it class asset { add() { ..... } edit() { ...... } flag() { ...... } deploy() { ........ } } now have client application wants perform actions on 'asset'. don't want give entire class dll client. instead want give interface. client can consume , call appropriate actions on it. now problem when client app adds reference wcf service. how can appropriate interface asset class returned client based on ws* or authentication credentials. .net 4.0 provides easy way create , return service contract dynamically? e.g. //following pseudo code if(current.user.role == 'admin') {

Ruby/RoR - Count occurrence of an element in an array -

i'v hash {1=>true, 7=>false, 6=>true, 4=>false} or array [1, true], [7, false], [6, true], [4, false]] or [true, false, true, false] . how can find number of true s in array? in order count elements, have iterate on collection. since iterating on hash yields two-element array s, first 2 same: { 1 => true, 7 => false, 6 => true, 4 => false }.count(&:last) [[1, true], [7, false], [6, true], [4, false]].count(&:last) for simple array case, this: [true, false, true, false].count(true) this array of course same hash#values hash above, use same method on that: { 1 => true, 7 => false, 6 => true, 4 => false }.values.count(true) if don't know 1 of 3 get, use this: { 1 => true, 7 => false, 6 => true, 4 => false }.flatten.count(true) [[1, true], [7, false], [6, true], [4, false]].flatten.count(true) [true, false, true, false].flatten.count(true)

objective c - iPhone, Access Array, local declaration hides instance variable -

i have array in view controller a: fiarray = [[nsmutablearray alloc] init]; firma * afirma = [[firma alloc] init]; afirma.title = @"title"; afirma.boxofficegross = [nsnumber numberwithint: 200000000]; afirma.summary = @"summary"; afirma.name = @"name"; afirma.subtitle = @"subtitle"; afirma.coordinate = cllocationcoordinate2dmake(37.33444, -122.036777); [fiarray addobject: afirma]; [afirma release]; now want access values , add them object in view controller b nsmutablearray *anarry = [root fiarray]; firma *gettitle = (firma *) [anarry objectatindex:0]; myannotation *ale = [[myannotation alloc] init]; ale.title = gettitle; ale.subtitle = @"bla"; ale.coordinate = (123,123); [mapview addannotation:ale]; but warning above, regarding "gettitle" variable. , there no value stored in ale.title . gettitle getter defined in uiviewcontroller access title property. rename !

Is it possible to place plugin files inside a Wordpress theme? -

i'm building wordpress theme, , work without having separately download plugins uses (e.g. internalization, contact form , lightbox). is possible place plugin files inside wordpress theme (or there way of solving this)? e.g: wp-content/themes/my-wordpress-theme/plugins when theme comes packaged own plugins, end user instructed install in /wpcontent opposed normal /wp-content/themes directory plugins , theme files installed in appropriate places. want separation between form , function. the theme should include hooks plugins, , administrator has activate them after installation. packaging theme trying do; broadening definition of theme bit include plugin directory. if determined have plugin directory subdirectory of theme, i'm not sure if or how that's doable, bad practice because doesn't maintain separation between form , function.

wpf - Design-time document for FlowDocument -

i trying set document of flowdocumentreader @ design-time cannot figure out how in pure declarative way. there no design-time attribute document , using datacontext not work (for obvious reasons think). best way this: in declarative way (preferred) in declarative way helper code (less preferred) using code (least preferred) the declarative design-time important since using sketchflow mockup application screen user can see (paragraph , character) styles , navigate through document using these styles. suggestions welcome. thanks, marc

html5 - Android Browser textarea scrolls all over the place, is unusable -

so i've built nice, shiny html5 application targeted @ mobile safari, , android's default browser. android versions i'm testing on 2.1 , 2.2. my app has textarea on 1 of pages, , textarea tends have amount of text in @ times. free-form writing field. this works expected in ios. on android, type, screen scrolls wildly , down on every keystroke, can't see you're typing type, , dizzy jumping around. furthermore, if content within textarea exceeds height, appears impossible scroll within it. don't me started on landscape mode. above issues more pronounced there. this feels bug android there isn't fancy textarea. i've stripped down bare essentials, , behaves same. wondering if else has had fun textareas on android, , maybe give advice, or @ least empathize? it seems google has managed solve in gmail web interface android. i'm guessing there's js magic going on because markup/css identical. solution: 3d webkit broken in android

Have narrowing conversion error in C++ arm from Android NDK -

i have narrowing conversion error in c++ arm android ndk. have following code: int16_t ax = li.a.x, ay = li.a.y; int16_t bx = li.b.x, = li.b.y; rect16 rca = { ax - 8, ay - 8, ax + 8, ay + 8 }; rect16 rcb = { bx - 8, - 8, bx + 8, + 8 }; and error, when try compile: error: narrowing conversion of '(((int)ay) + -0x00000000000000008)' 'int' 'int16_t' inside { } rect16 struct: typedef struct tagrect16 { int16_t left, top, right, bottom; } rect16; your problem stems fact in expression ay - 8 compiler says calling int operator-(int, int) . need tell compiler 8 short, using method in this question .

c++ - Send MIDI events to a stand-alone sampler/synth -

i'd develop simple program map pc keyboard piano keyboard: each time user press key midi event generated , stand-alone sampler/synth (such sfz+ or other) receives these events , plays sound. i able generate midi events (using midioutshortmsg), sent directly fm synth (and played it), i'd send them external software . code must in c/c++. could me? tnx. you should @ jack jack system handling real-time, low latency audio (and midi). runs on gnu/linux, solaris, freebsd, os x , windows (and can ported other posix-conformant platforms). can connect number of different applications audio device, allowing them share audio between themselves. clients can run in own processes (ie. normal applications), or can can run within jack server (ie. "plugin"). jack has support distributing audio processing across network, both fast & reliable lans slower, less reliable wans. jack designed ground professional audio work, ,

php - Export ebay items / import into ZenCart -

just wondering if has done following, , point me in right direction; has exported ebay items ebay shop? imported these items zencart cheers shane i have created web scraper using php similar purpose. pretty simple. scrape data , write database pretty. here brief excerpt: function get_web_page( $url ) { $options = array( curlopt_returntransfer => true, // return web page curlopt_header => false, // don't return headers curlopt_followlocation => true, // follow redirects curlopt_encoding => "", // handle encodings curlopt_useragent => "spider", // curlopt_autoreferer => true, // set referer on redirect curlopt_connecttimeout => 120, // timeout on connect curlopt_timeout => 120, // timeout on response curlopt_maxredirs => 10, // stop after 10 redirects ); $ch

java - GWT and an unreproducable 503 error -

have web-application built gwt (2.0.3) , run on apache tomcat 6. application uses long polling enable client-server conversations. when client unable connect server displays disconnected message on page , grays out controls until able resume conversation server. happens through use of onfailure method of rpc services; keep track on how many consequtive exceptions i've received , if passes defined threshhold above scenario happens. allows notifying user of problem while in background continuing resume server conversation. has been configuration 6 months, , without problem. compiled application after change , wanted see in stand-alone mode started tomcat (not via eclipse) , seemed work fine. when ctrl+c'd apache (while having clients up) saw clients displaying 503 error instead of app disconnected message. tried reproduce issue unable next times app behaved expected. i'm not sure if it's relevant added uncaughtexceptionhandler module's onmoduleload .

html - CSS: How do I stop hover effects from pushing my text? -

i hope understood question, can see example here: http://jsfiddle.net/nfbjy/ when scroll on of links move :( any advice on how solve issue? html: <div class="links"> <ul> <li><a href="home.html">home</a></li> <li><a href="pricing.html">pricing</a></li> <li><a href="faq.html">faq</a></li> <li><a href="about.html">about</a></li> <li><a href="contact.html">contact</a></li> </ul> </div> css: div.links {float: left; padding-top:15px;} ul {list-style:none;} li {float: left; margin: 0 .15em; padding: 3px 10px 3px 10px; border: 1px solid #ccc; border-radius: 5px; -moz-border-radius: 5px;} a:hover { border: 1px solid blue; border-radius: 5px; -moz-border-radius: 5px; padding: 3px 10px 3px 10px; background-color:yellow;} most of styling resides on li, try movi

.net - Dynamic view binding using DataTemplate -

<datatemplate datatype="{binding getviewmodel}" resources="{binding getview}"> <!--<vw:someview/>--> </datatemplate> i trying bind view dynamically in code of mainviewmodel linked above mainview's code. how can bind datatype , vw:someview dynamically? the datatemplate.datatype property not dependency property cannot bind values: http://msdn.microsoft.com/en-us/library/system.windows.datatemplate.datatype.aspx typically have multiple datatemplate instances define in xaml describe how ui renders each view model. framework takes care of using these datatemplates when control tries render view model of type.

c# - Converting from an interface to an object that implements the interface? -

i have interface implemented several different objects. trying write method in c# accept interface object parameter , convert parameter object implements don't have write same function several different types. such as: class unappliedcashdetails implements interface itransactiondetail. constructor issbatch: public issbatch(list <itransactiondetail> details) public static issbatch getnextreceiptbatch() { list <unappliedcashdetail> details = new list <unappliedcashdetail> (); /`*`some code here populate list`*`/ return = new issbatch(details); } c# not this. trying use interface wrong or not casting correctly? thanks! you're passing list<unappliedcashdetail> constructor accepts list<itransactiondetail> . unappliedcashdetail may implement itransactiondetail , type of variance not supported c#. consider inside constructor (or other method) attempt add instance of someothertransactiondetail

c++ - Best-First search in Boost Graph Library -

i starting work boost graph library. need best-first search, implement using astar_search having 0 costs. (please correct me if i'm wrong.) however, wonder if there possibility of doing this? if costs not considered, algorithm should more efficient. edit: sorry unclear description. implementing potential field search, don't have costs/weights associated edges rather need steepest-descent-search (which can overcome local minima). thanks hints! you use a* tackle this; you'd need h(x) 0 though, not g(x) . a* rates nodes based on f defined f(n) = g(n) + h(n). totalcost = pathcost + heuristic. g(n) = path cost, distance initial current state h(n) = heuristic, estimation of cost current state end state. from wikipedia : dijkstra's algorithm, example of best-first search algorithm, can viewed special case of a* h(x) = 0 x.

How to Exit windows phone 7 app? -

possible duplicates: windows phone 7 close application close wp7 application programatically? is there way programmatically quit app? (windows phone 7) hi all, there way exit application in windows phone 7. problem eula.xaml , mainpage.xaml solved have exit app on mainpage.xaml in either of cases. in advance. there no standard api in wp7-silverlight. trick can throw un-handled exception , can cause app break , go start menu of windowsphone. public class exitexception :exception {} and throw ever want quit. throw new exitexception();

php - zend based where clause disappearing -

i have weird problem using socialengine db class (based on zend framework). wrote this: $statustable = engine_api::_()->getdbtable('actions', 'activity'); $myposts = $statustable->fetchall($statustable->select() ->where('subject_id = ?',$id) ->where('comment_count > ?',0) ->where('type = ?',$type) ->where('date > ?',$newer_than) ->order('date desc') ->limit(intval($num_items))); its part of plugin made, problem query generated somthing this: select `engine4_activity_actions`.* `engine4_activity_actions` (subject_id = 5) , (comment_count > 0) , (type = ) , (date > ) order `date` desc limit 10 you can see $type , $newer_than have disappeared, though have values ($type='status', $newer_than='01/01/2000') edit: seems respond integers , not strings, if replace 'status' 0 shows in query. the server runs on php 5.3.2 there'

iphone - Easy ways to crop out the status bar when taking iOS Screenshots? -

apple recommends cropping out status bar screenshots submitted app store. doing manually in preview tedious , error-prone process. do developers have best-practices recommendations or automated techniques speeding process? goal take input ipad and/or iphone screenshots, , output them toolbar cropped off. need support both portrait , landscape orientation, , retina-resolution iphone screens. i've found few utilities online purport this, ones have found seem fail on retina-display resolution screens. , another works via ios simulator requires 1920x1080 resolution monitor process ipad screenshots - making useless non-17" laptop-based developers. any other recommendations taking screenshots appstore? know (based on searching) there lot of other developers interested in quicker workflow handle this. bonus points being able bulk-process entire directory. i developed free app, status barred on mac app store. crops ios screenshots iphone, ipad, portrait, lands

c - Does this function return the same pointer as its argument? -

i have written function in c: void *pwnretain(void *object) { pwnobject *obj = (pwnobject *)object; // <-- looks stupid, know :) obj->retaincount++; return obj; } it's important return same pointer it's argument. obj equal object , or did make pointer mistake? thanks. :) yes, return same pointer in c. in fact, don't need explicit cast on second line, c allows implicit conversions void * other pointer types.

delphi - how to retrieve exact text width for RenderText in Graphics32 -

i think question clear enough, explain more. simply, when using antialias on rendertext procedure, value gotten within textwidth function not correct. can right text width? you can algorithm in own code. must calculate it. anyway how it. function tgr32canvas.textwidth(const text: string): integer; var tempfont: tfont; tempwidth: integer; begin if text <> '' begin tempfont := tfont.create; try tempfont.assign(font); tempfont.size := font.size shl aa_mode; tempwidth := gettextwidth(text, tempfont); tempfont.free; end; end else tempwidth := 0; tempwidth := (tempwidth shr aa_mode + 1) shl aa_mode; result := tempwidth shr aa_mode; end; the gettextwidth function simple. can differently. function gettextwidth(const text: string; const font: tfont): integer; var canvas: tcanvas; begin canvas := tcanvas.create; try canvas.handle := getdc(0); try canvas.font.assign(font); resul

iPhone Testing on Device Issue -

with iphone connected mac via 30-pin connector (standard apple/iphone cable) of course test , run app xcode building run on device. for reason though, when build , run, installs on device doesn't go further loading screen of app default.png showing. then if stop build in xcode quit application, run in manually on device , new build there me test, don't know why have , doesn't run past loading screen when building? hope can help, thanks. this happened me once after added certificates. removed build directory (myapp/build/) , did clean , build again, , miraculously worked. might try that.

ruby on rails - Developing gems and testing -

i new developing ruby gems, thought i'd give try. recently checking out latest episode on railscasts (http://railscasts.com/episodes/245-new-gem-with-bundler) i'm using bundler create gem. however i'm kind of clueless on how test gem. sure run rake install , require irb , seems kind of slow workflow me. what i'd create dummy rails app , require gem referencing it's source code. possible? i'm sure i've read somewhere… thanks! you can include these lines in rakefile: task :console exec "irb -r mygem -i ./lib" end this create rake task initialize new irb session , preload library. now, have is: $ rake console

html - jQuery - Given a DIV with a bunch of <P> tags, how to find the first <P> that isn't empty -

given div lot of paragraph tags: <div> <p></p> <p>adsadasad ads ads </p> <p>adsadasad ads ads </p> <p>adsadasad ads ads </p> <p>adsadasad ads ads </p> </div> how magically find first <p> isn't empty using jquery? ideas? i find little less mind-bending use methods rather selectors this: $('div').find('p').not(':empty').first() edit: per poster's comment, here's version defines "empty" "having no text content, although there may html tags present": $('div#foo').find('p').filter( function(){ return ( $.trim($(this).text()).length ); }).first() example: http://jsfiddle.net/8dem8j8l/

sorting - bash sort unusual order. Problem with spaces? -

lots of time gone in bug, tracks sort... can explain why unsorted result, when bash docs tell me delimiter transition white non-white characters? shouldn't first field sorted? >sort myfile.txt 10_10000000 19 10_10000001 20 10_10000002 19 10_10000003 17 10_10000004 16 10_1000000 44 10_10000005 16 10_10000006 16 10_10000007 17 10_10000008 16 of course using +0 -1 gives me expected result: >sort +0 -1 myfile.txt 10_1000000 44 10_10000000 19 10_10000001 20 10_10000002 19 10_10000003 17 10_10000004 16 10_10000005 16 10_10000006 16 10_10000007 17 10_10000008 16 some metainfo: >type sort sort hashed (/bin/sort) i using sort (gnu coreutils) 5.97 >locale lang=en_us.utf-8 lc_ctype="en_us.utf-8" lc_numeric="en_us.utf-8" lc_time="en_us.utf-8" lc_collate="en_us.utf-8" lc_monetary="en_us.utf-8" lc_messages="en_us.utf-8" lc_paper="en_us.utf-8" lc_name="en_us.utf-8" lc_address="en

sorting - Unix sort of version numbers -

i have list of version numbers, let's instance in file versions.txt 1.2.100.4 1.2.3.4 10.1.2.3 9.1.2.3 i wish sort them sorted version. i.e: 1.2.3.4 1.2.100.4 9.1.2.3 10.1.2.3 i have tried using various sort commands using "k" parameters, not understand enough pull off. appreciated. the -v option nicest, wanted stay away installing new/other software since sort didn’t have option. this command worked me in end: sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n test.txt from comments: to reverse order: sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr to skip v prefix: sort -t. -k 1.2,1n -k 2,2n -k 3,3n -k 4,4n

javascript - jQuery not doing what I want it to do -

i'm having trouble little jquery, , thought in community me out? so, markup follows: <div class="left"> <ul id="editing-nav"> <li><a class="active testforso" href="#testforso">test so</a></li> <li><a class="testforso2" href="#testforso2">test so2</a></li> ...and on. </ul> </div> <div class="scroll"> <div class="scrollcontainer"> <div id="testforso"> ...some content </div> <div id="testforso2"> ...some content </div> ...and on. </div> </div> so, - .left floated left, , .scroll on right side. looking way active nav element (by default, first one, , when user click one, it'd assign element class of ".active" , remove previous one's active c

WPF, WCF, Entity, MVVM doubts! -

i using wcf service reference in wpf project, , entity framework data model resides in wcf project. and using mvvm light framework. doing following things: i use linq in service data , fetch wpf, obersvablecollections usually. everything works in view part populating datagrid, views required. but have following doubts: is correct way of transferring data between wcf , wpf. i haven't used model yet, have doubt when use it? i wanted save data datagrid. able pass on observablecollection of updated data of datagrid service's function. how update entity collection? looping? doesnt sound right. once update entity collection able use savechanges update database. when need show hierarchal data in treeview, make data hierarichal, stored procedure xml? use view create grouping criteria column? create column in service? create column/property in presentation? 1 - there no correct way, depends on requirements , goals. 2 - mvvm, model should sit between wpf

c - Win32 dispatch program and redirect stdout to file buffer problem? -

on wi32 trying start executable redirects filename (current date) e.g. same as: someexecutable.exe > 20101220000000.txt when windows cmd.exe works fine. when doing program shown below system seems ot either drop redirect if creates file and/or seems buffer large amount of data before flushing disk. can't change executable being run. program beeing executed writes stdout, remember can't change @ all. (the simplest way woud stdout = filehandle; sadly impossible me right now!) (not required: program waits system() not required simplest way of detaching program being run via system() ) #include <stdio.h> #include <stdlib.h> #include <time.h> int main(int argc, char *argv[]) { char execstr[512]; char s[30]; size_t i; struct tm tim; time_t now; = time(null); tim = *(localtime(&now)); = strftime(s,30,"%y%m%d%h%m",&tim); sprintf(execstr,"someexecutable.exe > %s.txt",s); printf("executing:

Iphone - The executable was signed with invalid entitlements -

i trying load application on iphone , error receiving. know how fix this. have searched forums , s.o. , cannot find answer. the entitlements specified in application’s code signing entitlements file not match specified in provisioning profile. this may have been answered. take here: the executable signed invalid entitlements

optimization - C++ String Interview Question -

i in c++ technical interview, given bit of simple string manipulation code, intended take string , return string comprised of first , last n-characters, , proceed correct bugs , make function efficient possible, came solution below, interviewer claimed there faster more optimal way: original code: std::string first_last_n(int n, std::string s) { std::string first_n = s.substr(0,n); std::string last_n = s.substr(s.size()-n-1,n); return first_n + last_n; } my code: bool first_last_n(const std::size_t& n, const std::string& s, std::string& r) { if (s.size() < n) return false; r.reserve(2 * n); r.resize(0); r.append(s.data(),s.data() + n); r.append(s.data() + (s.size() - n), s.data() + s.size()); return true; } summary of changes: changed interface take return string reference (assuming rvo , rvalues not available yet) removed temporary strings being constructed via substr passed input string const reference inorder around

algorithm - Revisit: 2D Array Sorted Along X and Y Axis -

so, common interview question. there's topic up, have read, it's dead, , no answer ever accepted. on top of that, interests lie in more constrained form of question, couple practical applications. given 2 dimensional array such that: elements unique. elements sorted along x-axis , y-axis. neither sort predominates, neither sort secondary sorting parameter. as result, diagonal sorted. all of sorts can thought of moving in same direction. ascending, or descending. technically, think long have >/=/< comparator, total ordering should work. elements numeric types, single-cycle comparator. thus, memory operations dominating factor in big-o analysis. how find element? worst case analysis matters. solutions aware of: variety of approaches are: o(nlog(n)), approach each row separately. o(nlog(n)) strong best , average performance. one o(n+m): start in non-extreme corner, assume bottom right. let target j. cur pos m. if m greater j, move left. if

sharepoint 2010 - Why I have to use vs2005 for InfoPath2010 programming -

hi reasones have use vs2005 infopath2010 programming.is there settings can let infopath open vs2010 instead of vs2005? you have use visual studio tools applications (part of office installs). no point in speculating why ms decided go way, although infopath 1 of products didn't support vsta. agree quite annoying! currently there no setting open ip projects in vs2010. might able play around references , settings trial , error working.

c# - How to figure out who owns a worker thread that is still running when my app exits? -

Image
not long after upgrading vs2010, application won't shut down cleanly. if close app , hit pause in ide, see this: the problem is, there's no context. call stack says [external code], isn't helpful. here's i've done far try narrow down problem: deleted extraneous plugins minimize number of worker threads launched set breakpoints in code anywhere create worker threads (and delegates + begininvoke, since think labeled "worker thread" in debugger anyway). none hit. set isbackground = true threads while next brute force step, roll code point didn't happen , on of change logs, isn't terribly efficient. can recommend better way figure out, given notable lack of information presented debugger? the other things can think of include: read on windbg , try use stop anytime thread started. @ least, thought possible... :) comment out huge blocks of code until app closes properly, start uncommenting until doesn't. update per

javascript - How do I retrieve the value of a specific XML node by path? -

i looking javascript solution problem: i have xml document loaded way of typical ajax method: var xml = http.responsexml; consider following example xml snippet: <main> <primary> <enabled>true</enabled> </primary> <secondary> <enabled>true</enabled> </secondary> </main> i value of node specifying path follows: var second_enabled = getnodevaluebypath('main/secondary/enabled', xml); i cannot find concise way of doing this. seem forced iterate through node collections after using getelementsbytagname , like. how construct method getnodevaluebypath or there construct in javascript allows this? i not versed in javascript. edit: here example shows attempt @ using xpath , how failing: xml: <?xml version="1.0" ?> <main xmlns="example.com"> <primary> <enabled>true</enabled> </primary> <second

c# - How to send a Status Code 500 in ASP.Net and still write to the response? -

i have asp.net single-file web service (a .ashx file containing ihttphandler implementation) needs able return errors responses 500 internal server error status codes. relatively straightforward thing in php: header("http/1.1 500 internal server error"); header("content-type: text/plain"); echo "unable connect database on $dbhost"; the asp.net (c#) equivalent should be: context.response.statuscode = (int)httpstatuscode.internalservererror; context.response.contenttype = "text/plain"; context.response.write("unable connect database on " + dbhost); of course, doesn't work expected; instead, iis intercepts 500 status code, trashes whatever i've written response object, , sends either debug info or custom error page, depending on how app configured. my question - how can suppress iis behaviour , send error information directly ihttphandler implementation? this app port php; client-side written, i'm stuck spe

html - In IE6, and using divs, how to split entire page into two columns, left div with static width and right with elastic width? -

Image
i don't know if asking possible in ie6, here goes: working on page layout , want split body 2 container divs. want give left div fixed width of 200px; while making right div elastic along page's width. right div's left border must touching left div's right border make things clearer made diagram: example on jsfiddle: http://jsfiddle.net/damien_at_sf/uhdhu/ html: <html> <body> <div id="col_1"> <p>column 1</p> </div> <div id="col_2"> <p>column 2</p> </div> </body> </html> css: html, body { height:100%; margin:0; padding:0; background-color:#000000; } #col_1 { height:100%; position:absolute; top:0px; left:0px; width:200px; padding:10px; background-color:#dbdbdb; } #col_2 { height:100%; margin-top:0px; margin-right:0px; mar

xml - eXML-PARSER output contains unwanted hash references -

so wrote parser routine take 1 xml file , reparse one. code later modified split large xml file many small xml files. i having problem output. parsing works fine thing output includes unwanted strings hash(0x19f9b58), not sure why , need set of friendly eyes. use encode; use xml::parser; $parser = xml::parser->new( handlers => {start => \&handle_elem_start, end => \&handle_elem_end,char => \&handle_char_data,}); $record; $file = shift @argv; if( $file ) {$parser->parsefile( $file );} exit; sub handle_elem_start { my( $expat, $name, %atts ) = @_; if ($name eq 'articles'){$file="_data.xml";unlink($file);} $record .= "<"; $record .= "$name"; foreach $key (keys %atts){$record .= " $key=\"$atts{$key}\"";} $record .= ">"; } sub handle_char_data { my( $expat, $text ) = @_;

vb6 - Declare Attribute in VB.NET -

in vb 6.0 code, declare have following line: attribute vb_name = "myfile" however, in vb.net, error "expecting declaration". isn't declaration statement? there reference finding differences between vb.net , vb 6.0? there's no need above code @ in vb.net. in vb 6, specifies name of file within code—this used things window title, allowing explicitly qualify references members of class in code. in vb.net, name used in declaration of class serves purpose. no longer need provide explicit name attribute . consider following mini-class: public class myfile public sub dowork() 'do here end sub end class to call dowork method of class you've named myfile place in code, write: myfile.dowork() just after specified vb_name attribute under previous versions of vb. also note file name class/module saved can different; name specify in class declaration not dependent on name you've given file itself, previous v

ruby on rails - Ordering category select menu alphabetically with awesome_nested_set -

using awesome_nested_set rails 3, i've created hierarchical categories system. display category selector in view, i've used following code: <%= form.select :parent_id, options_for_select(nested_set_options(category, @category) {|i| "#{'-' * i.level} #{i.name}" }.unshift(["no parent", nil]), @category.parent_id) %> i'm attempting order categories in alphabetical order, on level level basis. if change nested_set_options(category, @category) nested_set_options(category.order("name"), @category) reorder whole categories list name; want reorder children of each node alphabetically name. for example, want resulting select menu ordered this: animal - bird -- chicken -- hawk - fish -- cod -- goldfish -- trout - mammal -- cat -- primate --- chimpanzee --- human -- zebra plant - tree although unfamiliar awesome_nested_set, can call order twice in rails 3. category.order(:level).order(:name) this should order categ

javascript - Better way to write this jQuery Function? -

basically trying trim down of code, not sure how so, have 9 div's positioned absolute in different spots. grey, when hovered div hovered, fades out , corresponding div fades in. there better way write this? $('#l1').hover(function () { $(this).fadeout('300'); $('#l1c').fadein('300') }); $('#l2').hover(function () { $(this).fadeout('300'); $('#l2c').fadein('300') }); $('#l3').hover(function () { $(this).fadeout('300'); $('#l3c').fadein('300') }); $('#l4').hover(function () { $(this).fadeout('300'); $('#l4c').fadein('300') }); $('#l5').hover(function () { $(this).fadeout('300'); $('#l5c').fadein('300') }); $('#l6').hover(function () { $(this).fadeout('300'); $('#l6c').fadein('300') }); $('#l7').hover(function () { $(this).fadeout(

asp.net mvc2: Why to minimize the code in controllers? -

i heard bit should keep code in controllers less possible. put code? this depend on code talking about. example if talking validation, should go model, if talking data access should go repository or model (personally prefer repository), if talking business logic should go service, that's left controller call thing , pass result view. i recommend watching this video presentation how put controllers on diet jimmy bogard.

WPF - Binding problem -

why after clicking button text in textblock doesn't change ? xaml: <grid> <grid.rowdefinitions> <rowdefinition/> <rowdefinition/> </grid.rowdefinitions> <textblock text="{binding name}"/> <button click="button_click" grid.row="1" margin="20">click me</button> </grid> code behind: public partial class window1 : window, inotifypropertychanged { private person _myperson; public person myperson { { return _myperson; } set { _myperson = value; if (propertychanged != null) { propertychanged(this, new propertychangedeventargs("myperson")); } } } public window1() { myperson = new person { name = "a" }; datacontext = myperson; initializecomponent(); } private void button_click(obj

PHP question about global variables and form requests -

this stupid question ask anyway sine have no idea. i have written basic php code serve forms. have login page , serve using login.php page , called in login.html page - <form action="login.php" method="post"> by implied every post needs own php file, doesn't it? kind of feels weird. there way have single file, code.php, , have each of forms functions instead? edit: specifically, have 5 forms used 1 after other in application. after login user a, b, c , d tasks each of sent server post request. instead of having a.php, b.php, c.php , d.php have single code.php , have a(), b(), c() , d() functions. there way this? also on same note, how deal global array (e.g. array of logged in users) across multiple forms? want without writing db. know better write db , query possible global array? reason thinking having form functions in 1 file use global array. thanks, - pav sure, no problem, post forms same .php file , have deal incoming post da

Flash CS, reference root from external class -

i made class , put in same package of timeline.as (the document class): package { import flash.utils.timer; import flash.events.timerevent; public class counter2 extends timer { public function counter2(delay:number, repeatcount:int=0) { super(delay, repeatcount); super.addeventlistener(timerevent.timer, timerhandler); } public override function start():void { super.start(); } public override function stop():void { super.stop(); } public function timerhandler(evt:timerevent) { trace(evt.target.currentcount); } } } this class instanciated in timeline.as constructor. there way reference timeline(root) class? and, if so, how? thanks! the static stage object accessible objects on display list. try creating public method in custom timer class & use pass (and store) reference stage.... so: document class (or object on display

entity framework - Linq return child entities not used in parent entities -

i have case whereby have following entities in model. public class permission { public int id { get; set; } public operation operation { get; set; } } public class operation { public int id { get; set; } public string name { get; set; } } the way repository set need query operationrepository find operations have not been used in permission. ef operation entity has navigation property permissions entitycollection below: public partial class operation : entityobject { public entitycollection<permission> permissions { get; set; } } the method in operationrepository is: public ienumerable<ioperation> findunassigned() { //query here } filter operations navigation property `permissions doesn't have elements .where(p => p.permissions.count() == 0)

unable to import BlogML.XML in my wordpress blog -

i unable import blogml.xml in word press blog. giving following error after creating .htaccess -> the uploaded file not moved /htdocs/blog.myblog.com/wp-content/uploads/2010/12. the following content of .htaccess file--> php_value upload_max_filesize 40m php_value post_max_size 40m php_value max_execution_time 2000 php_value max_input_time 2000 i there permission issue uploads folder. can upload file (like image) using media library? if not, have fix permissions (most group of upload folder). to set correct permissions, connect sevrer through ssh, navigate wp-content folder , use following commands: chgrp group_name_of_apache_server -r . chmod g+w -r . that should fix upload issue.

forms - Django problem: problem with choice fields -

i seem have problem in django when looking field has choice parameter. not field name instead number odd reason. my forms.py : from django import forms contract_type_choices = ( (1, 'annual'), (2, 'ad-hoc'), ) contract_status_choices = ( (1, 'active'), (2, 'in-active'), ) class contractform(forms.modelform): contract_type = forms.choicefield(choices=contract_type_choices) contract_status = forms.choicefield(choices=contract_status_choices) class meta: model = contract in template. have following {% contracts in contracts_list %} {{contracts.client_contract_number}}<br/> {{contracts.contract_type}}<br/> {{contracts.contract_status}}<br/> {% endfor %} they return value. contact_type , contract_status returns numbers. not make return numbers names. how do this? model fields take choices kwarg automagically get_field_name_display method.

c# - compare two text files using linq? -

i have 4 text files in 1 folder , pattern.txt compare these text files..in pattern.txt have insert update delete drop i need compare text file 4 text files , if these patterns matches line in text files have write lines in log file...i had read files using linq..i need compare files , write in text file line number..here code var foldercontent = directory.getfiles(patha) .select(filename => file.readalltext(filename)) .aggregate(new stringbuilder(), (sb, s) => sb.append(s).append(environment.newline), sb => sb.tostring()); var pattern = file.readalllines(pathb).aggregate(new stringbuilder(), (sb, s) => sb.append(s).append(environment.newline), sb => sb.tostring()); using (var dest = file.appendtext(path.combine(_logfolderpath, "log.txt"))) { //dest.writeline("lineno : " + counter.tostring() + "

How can I include a model association in a JSON response in Rails? -

i've looked @ similar posts can't seem quite figure out. i have following function works fine. listing model has foreign key called price_id maps price model , price_range column. price_id returned part of message object in json response. how can return corresponding price_range value association instead of price_id value (as part of message obj, and keep other attributes )? def update @listing = listing.find(params[:listing][:id]) #if params passed in updating if @listing.update_attributes(params[:listing]) #should return whole thing or what's needed? json_response = { "success" => @listing.save, #save db , assign true/false based on success... "message" => @listing.attributes #use attributes show output content of @message obj, , not object called "message" } respond_to |format| #json response format.html { render:json => json

android - Unread SMS tray notification stays after marking SMS as read -

i've written application handles incoming sms. works great , marking processed sms works. thing doesn't seem care tray notification. still sits there in tray , claims there unread message (just standard sms app little green "1" does). checked message marked read using method used in smspopup sample application, seems have same problem. if "close" on received message, tray icon not updated. miss here? have send notification tray should check again? if talking notification bar application sent notification android system should cancel calling notificationmanagers cancel(int id) method. making sms read not clears notifications, when go sms application(stock sms app may be) call cancel notification method clear notification bar. sms popup apps can not clear notification bar of other stock sms app.

java - how to find in xsd, whether the particular tag is available in xml or not? -

my xml file is, <?xml version="1.0"?> <type xmlns:xs="http://www.w3.org/2001/xmlschema-instance" xs:nonamespaceschemalocation="datatype.xsd"> <int>integer</int> <varchar>varcharacter</varchar> <double>doubles</double> </type> in xml, want set <float></float> mandatory. didn't use tag. how validate <float> present or not in xml file, using xsd java.? in advance. the following can used validate xml against schema: import java.io.file; import javax.xml.xmlconstants; import javax.xml.validation.schema; import javax.xml.validation.schemafactory; import javax.xml.validation.validator; public class demo { public static void main(string[] args) throws exception { schemafactory sf = schemafactory.newinstance(xmlconstants.w3c_xml_schema_ns_uri); schema schema = sf.newschema(new file(&

vba - Visual Basic - how to force event to fire -

i'm new vb (using vba, actually) , force event fire. specifically, updating value in textbox , call textbox's afterupdate() event. private sub cmdcreateinvoice_click() me.txtinvdate = '11/01/10' me.txtinvdate.afterupdate end sub during run time, error says "compile error: invalid use of property". if try similar, click event (ex: cmdcreateinvoice.click), not have property shares name, error says "compile error: method or data member not found". know there must way fire 1 event another. proper syntax? thanks! afaik, there no way "fire event manually" in vb(a). can call event handler manually, , this, rdkleine has given answer already: call txtinvdate_afterupdate() this have same effect if event had fired (though not give whole chain of events may fire along it--unless call handlers well). igorm has valid point, in comments on answer--it's "cleaner" write different sub work want done, call b

networking - network issue router configuration -

i have router ip 172.19.5.1 , network interface 172.19.5.2 mask 255.255.255.248 , can rich router interface when configure interface(my pc)i can’t rich router. have mask 255.255.255.0 , had proved 248 , different ip address , doesn’t work. i can't tell information given problem is, make sure you're in correct ip range subnet. need have same subnet 255.255.255.248 (or /29), not 255.255.255.0 (/24). here's network info working 172.19.5.2/29 address. netmask: 255.255.255.248 /29 host address range: 172.19.5.1 -> 172.19.5.6 default gateway: 172.19.5.1 network id: 172.19.5.0 broadcast address: 172.19.5.7

css - Drupal: HTML Button on page to match theme -

i've got simple question ask time i'm hoping has simple solution; i made theme drupal website (using artisteer) , want create page button on looks same others, i.e: using same css, , wondered how that? i've tried <html><input type="button" value="more info..." class="art-button" /></html> , i've tried: <html> <div id="art-button"><input type="button" value="more info" /> </div> but display standard html button , not 1 styled in artisteer. i'm 'art-button' right thing use if knows style need use please inform me. so, if answer question please appricate it! thanks in advance, andy ps use openwysiwyg create drupal pages if makes difference?! find button on page , view source code. telepathically attaching stylesheets doesn't work on so, you'll need quote code next time more exact answer. wysiwyg editors don't make

c# - Getting correct auto incremented ID in Oracle DB -

i inserting 1 row oracle database table, primary key id autoincrement. , retriving autoincremented id table. in case of many people using same table. may run consumer producer problem may id of other user. some of user on mentioned getting these incremented id based on connection not result in consumer producer problem: just want check below things so: first: will exact autoincremented id below sceneario: 1) 2 computer in different subnet using db. 2) 2 computer wiht in same subnet using db. 3) 2 process using using db connection. 4) 2 thread uisng db connection. second : if insert is: insert tables (id,name,description) values (dbnull,'name','description'); should query autoincremented id generated above insert. c# related command :) you should use returning clause: declare v_id tables.id%type; begin insert tables (id,name,description) values (seq.nextval,'name','description') returning id v_id; --

php - CodeIgniter Default Controller -

tring create default controller no matter url access to. meaning, custom 404. class my_exceptions extends ci_exceptions { var $ci; public function __construct() { parent::ci_exceptions(); $this->ci =& get_instance(); } function show_404($page = '') { //load view here } } i getting get_instance undefined. (because defined after libraries called) there way create custom 404 controller in codeignigter 1.7.2 without playing system core code. thanks http://maestric.com/doc/php/codeigniter_404 i have used solution , works me in ci 1.7