Posts

Showing posts from January, 2012

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.

Fastest way to resolve ListItem from ItemId in SharePoint? -

what fastest way check content type of list item in sharepoint 2010 when have siteid (site collection) , itemid (the guid)? (i have spsite instance) i reading audit log entries , need additional properties of list item in order filter entries. entries same site collection, different lists , webs. do have uniqueid or id ? with id , cannot determine list, since integer. if have uniqueid, fastest way fire spsitedataquery retrieve splistitem , splist. http://vspug.com/mykiep/2007/05/09/getting-an-splistitem-by-it-s-unique-id/ avoid iterating spweb , splist find matching uniqueid. slow.

cruisecontrol.net - Cruisecontrol Publish command onfailure -

i've got problem publishing current project status. mapping: <publishers> <xmllogger /><!-- log webdashboard ##do not remove##--> <email> ... </email> <onfailure> <exec> <executable>echo error > logs/status.txt</executable> </exec> </onfailure> </publishers> when want start service following message: thoughtworks.cruisecontrol.core.config.configurationexception: unable instantiate cruisecontrol projects configuration document. configuration document missing xml nodes required populating cruisecontrol configuration. unable load array item 'onfailure' - cannot convert type system.string thoughtworks.cruisecontrol.core.itask object value: "echo error > logs/status.txt" does know message means? thanks in anticipation alex are using cruisecontrol or cruisecontrol.net? if cc.net, "onfailure" node not exist.

c# 4.0 - Can't query EF context under TPL -

i've got process read thousands of records database, encode each individual xml message , send said message off wcf service. the database referenced via ef4 model. i'm using tpl parallelize creation of xml messages. problem occurs first linq query: var practice = (from patient in db.t_accountholder join practitioner in db.t_practitioner on patient.defaultpractitioner_id equals practitioner.practitioner_id join _practice in db.t_practice on practitioner.practice_id equals _practice.practice_id patient.accountholder_id == accountholder_id select _practice).firstordefault(); i following exception: argumentexception: item same key has been added. after lots of research found out ef doesn't assign new key queried results, meaning if query same table same result, above exception occur (because result in same datacontext). since i'm using tpl, i'm in exact situation. recourse not use ef? go

ASP.Net MVC "logged in" best practice in view/markup -

quick question. if wanted say, have login button if user isn't logged in, , other markup if user logged in, best approach? i'm reluctant go the <% if(user.loggedin){ %> <!-- --> <% }else{ %> <!-- else --> <% } %> approach, since hate code in markup. way off base, if thought 'pretty' way make user control accomplish this? , have code in user control code-behind? can give me quick 'n dirty example? i'm reluctant go ... right approach. and have code in user control code-behind no, wouldn't better simple logic in view. in fact, can't avoid logic in view. presentation purposes, it's fine. watch out not go far.

java - Using if else statement for named query? -

@namedqueries( { @namedquery(name = "getavailableproducts", query = new stringbuilder("").append("select p product p p.type= :type , (p.available = 'all' or").append(istest() ? "(p.available = 'test' or)" : " ").append("p.available = :available)")), } this gives me error can't recognize istest() method. instead of method if put if statement lik if(1==1) or that, says "attribute must constans" in intellij idea. how solve? the parameters of java annotations can compile-time constants. can't work. reference page: annotations quote: once annotation type defined, can use annotate declarations. annotation special kind of modifier, , can used anywhere other modifiers (such public, static, or final) can used. convention, annotations precede other modifiers. annotations consist of at-sign (@) followed annotation type , parenthesized list of element-value pairs. t

GWT + Ajax Crawling -

i trying incorporate ajax crawling (http://code.google.com/web/ajaxcrawling/docs/getting-started.html) gwt apps. app single html page content rendered using gwt. using gwt-rpc communicate server , data exchanged in form of serializable pojos. such, there no links in application pointing "servlets". in such scenario, how go making app crawlable? gwt relies on mvp (model-view-presenter) pattern , not mvc. hence, fine (and expected) if have single html page views rendered. the way make gwt app crawlable have distinct urls each of views wish indexed. one can go doing using history mechanism in gwt ( click here docs ). ie, every view, ought assign 'history token' using hash-bang notation . gwt 2.1 introduces concept of activities , places can utilize compartmentalize ajax app logically distinct views, each of have own 'history token' , hence unique crawable url. hope helps.

How to get an HTML file using Python? -

i not familiar python. trying extract artist names (for start :)) following page: http://www.infolanka.com/miyuru_gee/art/art.html . how retrieve page? 2 main concerns are; functions use , how filter out useless links page? example using urlib , lxml.html: import urllib lxml import html url = "http://www.infolanka.com/miyuru_gee/art/art.html" page = html.fromstring(urllib.urlopen(url).read()) link in page.xpath("//a"): print "name", link.text, "url", link.get("href") output >> [('aathma liyanage', 'athma.html'), ('abewardhana balasuriya', 'abewardhana.html'), ('aelian thilakeratne', 'aelian_thi.html'), ('ahamed mohideen', 'ahamed.html'), ]

sql server 2008 - SQL: How to return any Part that occurs more than Once -

i have following query returns following error: aggregate may not appear in clause unless in subquery contained in having clause or select list, , column being aggregated outer reference. select part parts count(part) > 1 how rewrite return part appears more once. you need use group , having clause this: select part parts group part having count(*) > 1

php - Parsing query like string to array -

i have string looks this: $query = '(((306352743) , (306354310 or 306354381 or 306354379 or 306354383 or 306354372 or 306354371 or 306354378 or 306354384 or 306354373 or 306354375 or 306354376 or 306354377 or 306354382 or 306354380 or 306354374)) , ((306348630 or 306347920) , (306348630)))'; and want parse in kind of array can easly loop through. sugestions? what try, using string functions replace parens square brackets, wrap each number or word in quotes, inserting comma between each, until have string can use json_decode() parse array.

c# - Button click causes not post back in IE browser asp.net -

its strange behavior i'm facing. have delete button, onclick i'm attaching particular event. i'm storing entire data in session so, in if(!ispostback) clearing out session when page loads. when click on delete button instead of doing ispostback = true ispostback = false in ie , resets session data. but, other browser expected functionality. 1 have clue issue ? button tag aspx file, <tr id="rowpurpose"> <td> <asp:label id="lblpurpose1" font-bold="true" runat="server">purpose</asp:label> </td> <td width="65"> <asp:button id="btndeletepurpose1" text="delete" visible="false" commandargument="lblpurpose1" onclick="delete_purpose" runat="server" /> </td> </tr> c# file: void page_load() { rowpurpose.attributes["onclick"] = "javascript:method('id')"; if (!page

php - Brackets in Doctrine query -

hi have nest or / , conditions need brackets in sql statement in right order how make this is should in form (... or ...) , ... thnx according blog post, " solving doctrine parenthesis problem ", need $query->where("(conditiona or conditionb) , conditionc"); that may like: doctrine_query::create() ->from(...) ->where('a = ? or b = ?', array(vala, valb)) ->andwhere('c = ?', valc); the poster does, however, provide more generic solution, whereparenwrap() , extending doctrine_query : dq::create() ->from(...) ->where('a = ?', vala) ->orwhere('b = ?', valb) ->whereparenwrap() ->andwhere('c = ?', valc);

.net - Convert method to Delegate? -

i want call example trydo.do(messagebox.show(""), null); how can that?? using system; namespace trycatchhandlers { public static class trydo { public static callresult do(delegate action, params object[] args) { try { return new callresult (action.dynamicinvoke(args), action.method.returntype, true); } catch { return new callresult(null, null, false); } } } public class callresult { public callresult() { } internal callresult(object result, type resulttype, bool issuccessful) { result = result; resulttype = resulttype; issuccessful = issuccessful; } public object result { get; private set; } public type resulttype { get; private set; } public bool issuccessful { get; private set; } } } your code calls messagebox.show

networking - can client connect from 10.20.0.2 to wcf host on 192.168.0.2? -

it's possible mobile client on 10.20.0.2 network connect wcf service host on other network ? connected usb cord , want test can connect... if have network route, don't see why not, provided wcf can networking.

sql - Historical / auditable database -

this question related schema can found in 1 of other questions here. in database store users, locations, sensors amongst other things. of these things editable in system users, , deletable. however - when item edited or deleted need store old data; need able see data before change. there non-editable items in database, such "readings". more of log really. readings logged against sensors, because reading particular sensor. if generate report of readings, need able see attributes location or sensor at time of reading . basically should able reconstruct data point in time. now, i've done before , got working adding following columns each editable table: valid_from valid_to edited_by if valid_to = 9999-12-31 23:59:59 that's current record. if valid_to equals valid_from, record deleted. however, never happy triggers needed use enforce foreign key consistency. i can possibly avoid triggers using extension "postgresql" database. provide

tfs2010 - TFS - Cannot Check-In "big" files -

i've been working tfs months without problem, suddently can't check-in "big" files (2kb files ok, 50kb files or multiple files not). tfs hosted on server in same network. when try check-in, gives-me error like: " check in: operation not performed : underlying connection closed: unexpected error occurred on receive. please refer output window more information ". "more information" in output window same error. event viewer of server shows nothing, , i've been looking in google past couple hours , turned out nothing yet. the error message the underlying connection closed indicator between client , server dropping connection unexpectedly. some things investigate/try: is application pool on server restarting ? @ application event log on @ server. asp.net , w3svc warnings/errors indicate app pool has restarted. how client connecting server ? there http proxy in middle? server behind load balancer or firewall device? idle timeout

c# - Converting binary characters to something jQuery can use -

i’m using binarywrite method of httpresponse class fetch web page. something similar example… filestream myfilestream; long filesize; myfilestream = new filestream("apage.html", filemode.open); filesize = myfilestream.length; byte[] buffer = new byte[(int)filesize]; myfilestream.read(buffer, 0, (int)filesize); myfilestream.close(); response.binarywrite(buffer); i’m using jquery ajax method response. i’m having trouble doing - if had… $.ajax({ type: "get", url: "geturl.proxy", data: { url: 'http://www.example.org/test.html' }, success: function(data) { $('iframe').contents().find('html body').html(data.tostring()); }, error: function(xmlhttprequest, textstatus, errorthrown) { alert(errorthrown); } }); this returns stream of binary characters, want jquery can use set html element. set content-type first: response.clear(); response.contenttype = "text/html"

Jquery Cool Drag and Drop snap to position -

anyone know how cool thing in jquery can drag , drop divs , snaps position , saves location? try checking out jquery ui - more relevantly draggable feature.

emacs - how to write a locate-function for ede -

i use emacs c++ ide. have cedet , ede configured , working nicely, have minor problem. in project header files spread on project tree, need write function ede find headers. have been looking example time, have not found anything. kind me? thanks in advance. here's example "quick find file" in project using ede , ido: (defun de-ido-find-files-in-project () (interactive) (let ((allfiles nil) choice) (ede-map-all-subprojects ede-object-root-project (lambda (p) (let ((targets (oref p targets))) (dolist (target targets) (setq allfiles (append allfiles (oref target source))))))) (setq choice (ido-completing-read (format "file in project %s: " (oref ede-object-root-project name)) allfiles nil t)) (when choice (ede-find-file choice))))

algorithm - Simple row transposition cipher -

for lisp class, given simple row transposition cipher homework, tried solve in haskell, too. basically, 1 splits string rows of length n , , transposes result. concatenation of resulting list of lists of chars encrypted string. decoding little harder, since there may missing elements in last row of input (incomplete columns in result), have taken care of. this solution in haskell: import data.list import data.ratio import data.list.split encode :: string -> int -> string encode s n = concat . transpose $ chunk n s decode :: string -> int -> string decode s n = take len $ encode s' rows s' = foldr (insertat " ") s idxs rows = ceiling (len % n) idxs = take (n-filled) [n*rows-1,(n-1)*rows-1..] filled = len - n * (rows - 1) len = length s insertat :: [a] -> int -> [a] -> [a] insertat xs ys = pre ++ xs ++ post (pre,post) = splitat ys it job, not sure, whether considered idiomatic h

Spring Security 3.x: How can I enable both BASIC and DIGEST authentication? -

i want configure spring security enable both basic , digest authentication same set of url's, it's unclear whether or not possible. see need enable multiple authenticationentrypoint instances set appropriate http headers, don't see built in classes accomodate this. delegatingauthenticationentrypoint comes close, selects 1 entry point. i implemented custom authenticationentrypoint calls commence method on supplied list of authenticationentrypoint instances, throws illegalstateexception because each authenticationentrypoint calls senderror (which gather not allowed). is there way without implementing custom entry point? id did configuring spring security digest authentication only, , adding basicprocessingfilter manually @ beginning of filter chain, explained there <bean id="basicprocessingfilter" class="org.springframework.security.ui.basicauth.basicprocessingfilter"> <property name="authenticationmanager">&

android - Is it possible to get authorized on twitter and change twitter status without asking users to enter PIN? -

is possible authorized on twitter , change twitter status without asking users enter pin ? or can store access token use when user starts application next time ? you can activate xauth authentification. in order have create twitter app , ask xauth activation twitter.

Rails, collection_select - remembering values with :selected after form submitted -

(using rails 2.3.5 on internal work server no choice of versions, , i'm pretty new) i'm building search form need provide list of directories user can select one(s) search against. i'm trying figure out how selected values of collection_select remain after form submitted. say user selected 3 directories collection_select, id's of directories in params: directory: !map:hashwithindifferentaccess id: - "2" - "4" - "6" i know can manually specify multiple selected items: <%= collection_select :directory, :id, @directories, :id, :name, {:selected => [2,4,6]}, {:size => 5, :multiple => true} %> i've played around bit , able "to_i" against single value in params hash: <%= collection_select :directory, :id, @directories, :id, :name, {:selected => params[:directory][:id][0].to_i}, {:size => 5, :multiple => true} %> what can't figure ou

javascript - YUI "Saved" notification -

i'm trying create short term overlay notification app i'm working on. happen constrained using yui script library. goal make yui-styled notification appear on page following post wherein form saved. use simpledialog, client doesn't want have interact notification, , don't want buttons or controls on whatsoever, featureless, styled box displays message. the effect i'm trying pull off right produce similar jquery's showglobalmessage function. so, there yui controls capable of doing this? , if not, best way, using self-written js, produce effect? thanks help. is yui overlay widget you're looking for? i pasted sample page demonstrating how works. if that's more or less you're looking for, should able have function that, upon form submission, activates overlay. have lookup api learn more -- http://developer.yahoo.com/yui/3/overlay/ also, yui has custom events (but don't know them): http://developer.yahoo.com/yui/3/event/ <bo

When creating my own view in Android, the bottom area where the context menu inflates is Black. How can I fix this? -

<framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <test.viewz.mazeview android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/mazeview" /> </framelayout> so supposed create 3x4 grid , have sizing work out fine (to best of knowledge) no matter have tried changing, can't seem canvas paint in bottom section of screen. help? , more information need provide? it turns out problem in way had raster set up. accidentally made column major , paint of pixels off screen , not reaching far enough height. happened difference in width , height of screen same options menu. everybody's time.

sql server - SQL - all patients who had only dental visits in 2010 -

i have t-sql query that's giving me recent office visit in 2010 wasn't dental visit. relevant part of query is: and pv.patientvisitid in ( select max(pv1.patientvisitid) patientvisit pv1 join doctorfacility df1 on pv1.facilityid = df1.doctorfacilityid join patientvisitresource pvr1 on pv1.patientvisitid = pvr1.patientvisitid join doctorfacility dfr on pvr1.resourceid = dfr.doctorfacilityid pv1.patientprofileid = pp.patientprofileid , pv1.visit < '2011-01-01' , df1.listname not '%dental%' ) now, want flip around recent office visit patients only had dental appointments. keep hitting wall here, though. can bust me through other side? :-) the clue use not exists and pv.patientvisitid in ( select max(pv1.patientvisitid) patientvisit pv1 join doc

Change Background Color with jQuery -

Image
i have form multiple drop downs... set background color of visible dropdowns gray when disabled. of these dropdown's id's begin usrcontrol. here have far.. $('select[id ^= "usrcontrol"]:visible').each(function(){ this.css("background-color") }); not sure how disabled/enabled selectors. thanks in advance protected _picklistcolorscripttext string = "$(document).ready(function(){ " + _ "$('[id ^= ""usrcontrol""]:visible:disabled').css(""background-color"", '#dcdcdc'); " + _ "$('[id ^= ""usrcontrol""]:visible:enabled').css(""background-color"", '#ffffff');" + _ "});" this works. however, sets background entire control gray, how can change color o

c# - The best way to let asp.net fire events and methods automatically -according to a schedule- -

well, i'm sure not first time see question. , tbh can find question answered on many other websites , blogs -not here- but never saw complete answer question, mean no 1 talked advantages , disadvantages. no 1 shared real experience. although quartz.net seems solution yet, there's no enough reviews or comparison between different ways achieve such thing. as far read found possible ways of doing : using a: web service, windows appliction, console application, quartz.net. examples of stuff want achieve scheduled or automatic methods/events archiving after period, auto deleting/moving records in database, setting property of object after time, automatically run methods according holiday schedule. i hope you'd share experience either 1 of approaches or share new way of doing this. at e-commerce web site work for, use quartz.net in windows service called "worker". executes quartz.net ijob implementations via programmatically-defined schedule

svn - How do I set a custom Author name in TortoiseSVN locally? -

i using auto props populate $id$ tag tortoisesvn using author name name of computer, in case 'peter'. i want use name instead of computer's account name. using vista on machine. repo local machine. thanks! tortoisesvn not have such feature. asks username if server requests one. since repo local, there no authentication @ , therefore tsvn doesn't ask username/password. in case, windows logon name used automatically. sorry.

git - Could I change my name and surname in all previous commits? -

i change name, surname , email in commits, possible? use git-filter-branch . git filter-branch --commit-filter 'if [ "$git_author_name" = "josh lee" ]; export git_author_name="hobo bob"; export git_author_email=hobo@example.com; fi; git commit-tree "$@"' this affects author, not committer (which commits same author). if want rewrite well, set git_committer_name , git_committer_email variables. the standard warning rewriting history applies; history has not yet been shared.

php - How to output multiple line mysql string from database without quotes -

i'm retrieving string database entered form, if string long, it's generated double quotes in html. how i'm retrieving data: echo '<p>' . $descr['field_value'] . '</p>'; when view html source, browser adds double quotes. short single line strings not show quotes. is there way force php display strings without quotes? you should use echo '<p>' . htmlspecialchars($desc['field_value']) . '</p>'; . see http://php.net/manual/en/function.htmlspecialchars.php more details.

asp.net - IIS7 Application Configuration -

i have custom asp.net application utilize several clients host. each client has separate domain , application child application under root domain (http://domain.com/customapp). application files same (aspx, ascx, style sheets, images, etc.). thing different web.config file each client. development of application continues evolve, have update application each directory , becoming tedious. trying come method keep application date. first though placing application single physical path , creating multiple applications pointing path (the problem method can't have different web.config files). curious solution others using in scenario... if want handle entirely in visual studio, vs2010 offers web.config transforms solve problem. in nutshell, create build configuration (in vs, select build|configuration manager...) each site. add web.config transform each client, specifies differences required each application. i use differentiating between development, staging , r

jQuery or JavaScript: Determine when image finished loading -

how can detect when image has finished loading server or browser cache? want load various images in same <img/> tag , detect when loading of new images has finished. thank you. $('img').on('load', function() { // whatever want });

http - Chrome and IE cache static content, Firefox does not -

i trying improve performance of website adding cache headers static content. so far, can content cache in chrome , internet explorer, not firefox. here caching-related headers i'm supplying: cache-control:private, max-age=1800 etag:"809067e0179acb1:0" expires:mon, 20 dec 2010 21:35:10 gmt (note: etag , expires variable; expires 30 minutes in future) i verified behavior using fiddler 2. chrome , ie7 not request images, css, , js after first request, while firefox requests them every time. is there header should supply make firefox cache these? update 2010.12.22 i noticed same behavior on websites, including www.yahoo.com. there way force firefox cache? this have occurred ssl content, should no longer case. firefox altered way caches resolution gecko bug 531801 . now, ssl content cached disk regardless of cache-control header.

algorithm - Convert a post-order binary tree traversal index to an level-order (breadth-first) index -

assuming complete binary tree, each node can adressed position appears in given tree traversal algorithm. for example, node indices of simple complete tree height 3 this: breadth first (aka level-order): 0 / \ 1 2 / \ / \ 3 4 5 6 post-order dept first: 6 / \ 2 5 / \ / \ 0 1 3 4 the height of tree , index in post-order traversal given. how can calculate breadth first index information? i think has computed iteratively/recursively. having said that, come along in 37 seconds simple single-line computation , downvote me. nonetheless, can solved thinking of recursively. consider simple tree (1-based) of depth-first post-order traversal: 3 / \ 1 2 from recursive standpoint, that's have think about. either @ root of subtree (3), in left part of subtree (1) or in right part (2). if @ root, done. otherwise, left , right subtrees identical , post-order traversal index in right subtree equal correspon

iphone - App from Xcode works great, but App Store version freezes on load -

has ever heard of this? i'm baffled, , google. when debugging on iphone 4 ios 4.1, app shows splash screen, shows animation while loads , gets gps location, , goes main menu. when download app store, never stops loading. more strange that, if hide forever-loading-app , restore it, load animation freezes , app no longer responds! i've been trying make kinds of guesses what's going wrong, nothing working. how can useful information failure? edit: app has been tested on iphone 3 ios 4.0 , ios 4.2.1, , iphone 4 ios 4.0.2 , 4.2.1. edit edit: problem not occur if not download app store. makes extremely difficult debug, narrows down out there more experience have. first, sounds you've tested app on 1 device. apps should tested on few devices @ least, can debug , understand inside flows on several cases. but if can't device, try elimination. means - try put unnecessary code under remark, , load necessary code. step-by-step can understand bug. it sou

rubygems - How to validate if keyword matched is highlighed or not in Ruby and Rails -

i writing testing script using ruby , rails. have validate whether proper keyword highlighted or not. how do in rub. eg. "confidential" keyword , want validate whether got highlighted or not. assuming highlight keyword <em> -tags , have highlighter class highlighting: assert_contains "<em>confidential</em>", highlighter.highlight(text)

sharing audio input on Android -

i doing preparation research android phone app involve voice search or speech recognition while user simultaneously engaged in phone call. i'm finding when in middle of call , attempt invoke voice search or similar action take input microphone "audio error" message. phone app take exclusive control on microphone input of phone such other apps cannot access audio input? in answer direct question, yes. phone app takes full exclusive control on microphone input. same apps use microphone. 1 app can have access microphone @ time. however, in hope app, can access voice uplink stream, same thing (it spoken mic , uploaded service towers), plus won't interfere call @ all. can this: mediarecorder mrecorder = new mediarecorder(); mrecorder.setaudiosource(mediarecorder.audiosource.voice_uplink); you have add permissions record manifest , such, that's that. luckily speech recognition stuff built in, should able find out how poking around bit on here or google

java - Swing: easiest way to align width of [dynamic][static][dynamic] components? -

what easiest way in standard java swing align 3 components in such way that: the dynamic widths of component1 , component3 adjusted equal , while component2 (which in between) has constant width? imagine have resizable jpanel (such inside jframe). small width should this: [----------------whole jpanel----------------] [--component1--] [component2] [--component3--] big width should this: [------------------------whole jpanel------------------------] [------component1------] [component2] [------component3------] note: "trialed-and-errored" grouplayout long. one option using gridbaglayout . quick , dirty snippet started: gridbagconstraints gbc; final int a_center = gridbagconstraints.center; // anchor: center final int f_none = gridbagconstraints.none; // fill: none final int f_dx = gridbagconstraints.horizontal; // fill: dx final insets in_0 = new insets(0, 0, 0, 0); // empty insets setlayout(new gridbaglayout() ); gbc = new gridbagco

sharepoint 2010 - When remove admin-approved form template from Central admin , IIS will reset? -

when remove admin-approved form template central admin , iis reset? it shouldn't. have option "quiesce" form active users don't dumped iis shouldn't reset. form should stop showing on.

winapi - Static Control Background Color with C++ -

i creating basic gui windows api , have run issue. starts main window opens custom background color set (rgb(230,230,230)) . displays text in upper left corner static control. settingstext = createwindow("static", "settings", ss_left | ws_child, 12, 20, 100, 20, hwnd, null, proginstance, null); showwindow(settingstext, 1); this works, when text displayed need way change background of match main window or else looks doesn't blend in. my question is, how do this? use method below , works, wanted know, there way permanently set background color somehow, right after createwindow function static control without changing system colors, , have apply 1 control , not sends

c# - Is there a way to see the value of a variable as the program is running? -

i'd see value variable holding program running. i remember scott hanselman blogging variable viewbox, can't seem find post. i'd view variable program running it's loop. inside of visual studio. often when there data , logic difficult trace..eg . due large loops , many variables, dump state comma separated files.. , inspect them in excel.

java - What's a good, efficient way to implement run()? -

should contain loop while (true) { ... } i find not efficient consumes cpu much. thread keep on waiting what's best way make wait without consuming cpu? there many ways efficiently using object.wait , object.notify (see here ), or using various higher level java concurrency classes such blocking queues, latches, futures, semaphores or barriers. =================================================== you correct repeatedly testing condition bad idea; e.g. while (!condition) { // bad idea ... burns cpu cycles. } the following improvement, can still problematic: while (!condition) { thread.sleep(...); // bad idea } the problem if set sleep interval short, loop gets expensive. if set longer (e.g. second or so), thread can take amount of time respond condition becoming true. net result can reduced throughput , / or sluggish user interfaces. sometimes loop{test; sleep} approach best available option, unfortunately, if can av

qt - How to invoke a signal from a custom widget at runtime -

we have custom widget plugin, lets myprogressbar. we have exe. exe has dialog.ui file has custom plugin. we use quiloader load file @ runtime, loads custom plugin. have verified that, constructor of myprogressbar invoked when load dialog.ui file. now question how declare signals , slot @ runtime exe emit signal , corresponding slot in custom plugin invoked. i found clue here , how do it. regards,

where should I put the EF entity and data annotations in asp.net mvc + entity framework project -

so have dataentity class generated entityframework4 sqlexpress08 database. data context exposed via wcf data service/odata silverlight , win forms clients. should data entities + edmx file (generated ef4) go in separate class library? the problem here specify data annotations few entities , of them require specific mvc attributes (like compareattribute) class library reference mvc dlls. there happen entity users encapsulated or wrapped iidentity in website. pretty tied mvc website. or should maybe go in base folder in mvc project itself? mostly website data driven around database, approve users, change global settings etc. real business happens in silverlight , win forms apps. im using mvc3 rc2 razor. thanks should data entities + edmx file (generated ef4) go in separate class library? imho data access logic specific data access technology (in case entity framework) should go separate assembly. there should no mvc specific assemblies referenced there. in a

c++ - accessing nested container members -

i trying create 2d array using nested containers. want print members. can me please.i new stl. thanx in advance. typedef vector<int> v; vector<v>v1; v1.push_back(v(45,67)); v1.push_back(v(36,89)); v1.push_back(v(27,81)); v1.push_back(v(18,78)); you print elements this: for(size_t = 0, mi = v1.size(); < mi; i++) { for(size_t j = 0, mj = v1[i].size(); j < mj; j++) cout << v1[i][j] << ' '; cout << '\n'; } then you'll see created array contains: {67,67,67,...,67}, // 45 times {89,89,89,...,89}, // 36 times {81,81,81,...,81}, // 27 times {78,78,78,...,78}, // 18 times probably not expected.

Android eclipse ERROR: Unknown option '--auto-add-overlay' -

i had abnormal shutdown of mac , when came up, eclipse no longer compile project correctly. gone through link1 , link2

xml - RSS feed created with PHP only shows the title in the feed reader -

i using following php code generate xml rss feed, doesn't seem working correctly. no short description displayed in feed reader, see title of article. also, of articles published @ same time. first time have tried setup rss feed, i'm sure i've made several stupid mistakes. $result = mysql_query("select * blog order id desc limit 10"); $date = date(date_rfc822); header('content-type: text/xml'); echo ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); echo ("<rss version=\"2.0\">\n"); echo ("<channel>\n"); echo ("<lastbuilddate>$date</lastbuilddate>\n"); echo ("<pubdate>$date</pubdate>\n"); echo ("<title>my website name</title>\n"); echo ("<description><![cdata[the description]]></description>\n"); echo ("<link>http://my-domain.com</link>\n"); echo ("&

Saving an Excel sheet in a current directory with VBA -

i have created sheet in vba excel. save current directory, not in absolute path, then, when executed somewhere else, there won't problem. can ? i not clear situation requires following may started. key here using thisworkbook.path relative file path: sub savetorelativepath() dim relativepath string relativepath = thisworkbook.path & "\" & activeworkbook.name activeworkbook.saveas filename:=relativepath end sub

text to speech - Android call TTS in BroadcastReceiver -

i need call tts service within subclass of broadcastreceiver. when implement class oninitlistener, gave run-time error. is there other-way implement tts within broadcastreceiver? thank you, sorry code: public class textapp extends broadcastreceiver implements oninitlistener { private texttospeech tts; private string message = "hello"; @override public void onreceive(context context, intent intent) { tts = new texttospeech(context, this); message = "hello tts"; } @override public void oninit(int status) { if (status == texttospeech.success) { tts.speak(message, texttospeech.queue_flush, null); } } } your code didn't work on : tts = new texttospeech(context, this); context on broadcastreceiver " restricted context ". means cannot start service on context in broadcastreceiver. because tts service, doesn't call anyting. the best solutions start intent on broadcastreceiver activity call service

c# - Windows Identity Framework on ASP.NET MVC - how to authorize user per action basis? -

windows identity framework on asp.net mvc - how authorize user per action basis? like: [authorize] public actionresult about() { return view(); } instead of whole site level security default wif site integration behaviour? update: maybe should question goes like, how allow anonymous users access site too? well turns out, authorization element has set in web.config. default like: <authorization> <deny users="?" /> </authorization> which mean deny anonymous users. but in mvc should like: <authorization> <!--<deny users="?" />--> </authorization> which mean allow users, , leave application handle authentication. so mean default wif setting have reverted: from: <authentication mode="none" /> to like: <authentication mode="forms"> <forms loginurl="~/account/logon" timeout="2880&q

python importerror no module named zope.interface twisted -

i new in python.i installed "scrapy" giving error "importerror no module named zope.interface twisted".please me. thanks in advance.......... scrapy requires few additional libraries, namely twisted , libxml2 (and optionally pyopenssl , simplejson ). installation instructions describes how install these libraries.

mysql - To get a average % of two columns -

i have columns mentioned below 1)oldorderqty 2)neworderqty 3)oldunitrate 4)newunitrate my issue need % of savings if there savings new unit rate please me out lot answers your question , terms aren't defined, i'd lean towards: select 100*(1-newunitrate/oldunitrate) percent_savings table so, example, if oldunitrate 10, , newunitrate 7.5, percent savings 25%.

zend framework - Strange requests in my 404 log file (possible hacking?) -

firstly, using zend has nothing 404 errors i'm seeing of terminology i'll using below specific zend. i using zend framework , anytime 404 error have error controller handle , write 404s out log file , include controller specified , action. i've been getting strange requests action like: degyhfbsuov.html i've gotten several above .html same characters preceding period different. unfamiliar zend url required typed browser window make above error occur be: http://domain_name.com/degyhfbsuov.html just yesterday starting getting this: ).html(data); as action. is sort of bot or spider? thanks!

serialization - Serialising and Deserialising Requests and Responses exactly as WCF does -

i need deserialise soap request xml .net request object , serialise .net response object soap response xml. need work wcf does, using same xml element local names , namespace uris. the .net request , response classes generated wsdl using svcutil. i have looked @ xmlserializer class, of it, doesn't take notice of wcf-specific custom attributes, messagebodymemberattribute. looked @ datacontractserializer, had exceedingly strange ideas element names , namespaces use. finally, tried xmlserializer xmltypemapping generated soapreflectionimporter; didn't seem use namespaces @ all. i rather suspect need using 1 of above techniques, additional subtlety, of unaware. perhaps there entirely different approach? all suggestions welcome. i'm puzzled why want this. can clarify? take @ implementation of datacontractserializeroperationformatter , datacontractserializeroperationbehavior via reflector. captures how message formatters , serializers interoperate within wcf

regex - Search and replace string and also put a counter in replacements -

i have bunch of files containing exact same log message. 1 of them happens messages identical don't known one. want append number after these messages distinguish them. now when have bunch search , replace perform write quick perl one-liner like: perl -pi -e 's/searched/replacement/g' *.c but how can insert counter in replacement ? you can use e regex modifier append running counter value replacement as: perl -pi -e 's/searched/"replacement".++$i/ge' *.c demo: $ cat file hi foo hey foo bye foo $ perl -p -e 's/foo/"bar".++$i/ge' file hi bar1 hey bar2 bye bar3

javascript - Actual numbers to the human readable values -

i have data in bytes. need draw values human readable labels on chart (like 2.5kb, 14mb etc.) , need function (input data - actual value, output - human readable string). i did funcion this, want more elegant realization function tickformatter(value, type) { var suffix = (type == "bytes") ? ['b', 'kb', 'mb', 'gb'] : ['', 'k', 'm', 'g'] if(value > (1024 * 1024 * 1024 * 1024)) { return (value / (1024 * 1024 * 1024 * 1024)).tofixed(2) + suffix[3] } else if(value > (1024 * 1024 * 1024)) { return (value / (1024 * 1024 * 1024)).tofixed(2) + suffix[2] } else if (value > (1024 * 1024)) { return (value / (1024 * 1024)).tofixed(2) + suffix[1] } else { return value.tofixed(2) + suffix[0] } } i love implementation: clear , compact: function readablizebytes(bytes) { var s = ['bytes', 'kb', 'mb', 'gb', '

iphone - How to get path to add number of Images that are in the resource to be displayed in the WebView in objective-c -

i added image application want display them web view. tried not succeeded. how can set path images in html in image tag , how display them. please me out of this. thank you, madan mohan. are displaying images individually or have html file references them? to url files directly: nsstring *pathforimage = [[nsbundle mainbundle] pathforresource:@"image" oftype:@"png"]; nsurl *url = [nsurl fileurlwithpath:pathforimage]; if you're loading html file references images (such including <img src="image.png"> , no path info) then: [webview loadhtmlstring:htmlstring baseurl:[[nsbundle mainbundle] resourceurl]]; edit: so, supposing had image.png in application bundle resource, do: [webview loadhtmlstring:@"<html><body><img src=\"image.png\"></body></html>" baseurl:[[nsbundle mainbundle] resourceurl]];

bash - How to display a specific user's commits in svn log? -

how display specific user's commits in svn? didn't find switches for svn log. you use this: svn log | sed -n '/username/,/-----$/ p' it show every commit made specified user (username). update as suggested @bahrep, subversion 1.8 comes --search option.

entity framework 4 - many-to-many, poco, ef4 -

i have 3 entities: goods [gid(pk), goodname] persons [pid(pk), personname] roles [rid(pk), rolename] but need associate these object each other. in other words, each can have many persons in many roles. have table in db 3 fields (gid, pid, rid) for example: book (gid#1), can have 3 associated persons: 1. jack (pid#1) in role author (rid#1) 2. jack (pid#1) in role editor (rid#2) 3. bill (pid#2) in role painter (rid#3) how can map in poco format in entity framework 4? i believe have create personroles header store person-role relation, access person+role via one: personroles [prid(pk), personname, rolename] (note: withnow entitykey, relationships, ef eliminate entity , give direct person.roles entity, can access via book.persons.select((p) p.roles) ). personrole#1: jack#1/author#1 personrole#2: jack#1/editor#2 personrole#3: bill#2/painter#3 book.personrole = context.personroles. singleordefault((pr) => pr.person.personid == 1 && pr.roleid == 1);

php - Parameterized Query -

pls code secure? /* create new mysqli object database connection parameters */ $mysqli = new mysql('localhost', 'username', 'password', 'db'); if(mysqli_connect_errno()) { echo "connection failed: " . mysqli_connect_errno(); exit(); } /* create prepared statement */ if($stmt = $mysqli -> prepare("select priv testusers username=? , password=?")) { /* bind parameters s - string, b - boolean, - int, etc */ $stmt -> bind_param("ss", $user, $pass); /* execute */ $stmt -> execute(); /* bind results */ $stmt -> bind_results($result); /* fetch value */ $stmt -> fetch(); echo $user . "'s level of priviledges " . $result; /* close statement */ $stmt -> close(); } /* close connection */ $mysqli -> close(); as far protection against mysql injection concerned: yes. mysqli's parametrized queries safe against injection attacks. if $user comes external source, may want add ht

visual c++ - c++ CopyFile function problem -

hey guys need use copyfile in win 2000 , above platforms. want copy application different folder c:. so works: bool didthisfail = false; if (copyfile(l"myapplication.exe", l"something.exe", didthisfail)) cout << "file copied" << endl; but dosen't: bool didthisfail = false; if (copyfile(l"myapplication.exe", l"c:\\something.exe", didthisfail)) cout << "file copied" << endl; getlasterror() tell why failed, access denied error.

performancecounter - Creating Performance Counters in Java -

does know how can create new performance counter (perfmon tool) in java ? for example: new performance counter monitoring number / duration of user actions. i created such performance counters in c# , quite easy, couldn’t find helpful creating in java… if want develop performance counter independently main code, should @ aspect programming ( aspectj , javassist ). you'll can plug performance counter on method(s) want without modifying main code.

sql - mysql join table - selecting the newest row -

i have following 2 mysql tables table names name_id name 1 name1 2 name2 3 name3 table status status_id name_id timestamp 1 1 2010-12-20 12:00 2 2 2010-12-20 10:00 3 3 2010-12-20 10:30 4 3 2010-12-20 14:00 i select info table names , add recent correspondent timestamp column table status result name_id name timestamp 1 name1 2010-12-20 12:00 2 name2 2010-12-20 10:00 3 name3 2010-12-20 14:00 am stuck on one. how left join on newer timestamp? try query : select n.name_id , n.name , max(timestamp) time names n left join status s on s.name_id = n.name_id group n.name_id

jquery - Using $.mobile.changePage and passing data -

i trying learn myself jquery mobile. think cool, stuck @ something. if want call this: $j.mobile.changepage({ url: $j("#news"), data: "apple=banana", type: "get"}, "slide", true, true); it not seem work. not known passing data jquery, mayby doing wrong. kind regards, senne edit: sorry, put wrong code there... as far know - url must real url or id of div[data-role=page] to clarify: providing id shows div avaliable in current document (you can create html files multiple pages in them). also - jquerymobile loading page once, , adding document later reference. no server side actions triggered later. (i'm not sure how handles calls data provided)