Posts

Showing posts from February, 2013

WPF: Expand the validation rectangle -

this current xaml. <stackpanel orientation="horizontal" grid.column="3" grid.row="1"> <label content="allocated:" fontsize="14"/> <label content="{binding allocatedunits, mode=oneway, validatesondataerrors=true}" contentstringformat="n0" fontsize="14"/> </stackpanel> how change red validation rectangle around whole text instead of number. (i accept throwing away stack panel entirely , doing else. a string-formatted binding trick in case, wasn't available in .net 3.0 (in case you're still using version!). if can use it, you'd need single label control (so can ditch both other label and stackpanel, , validation border wrap text in remaining label). edit: per jonathan's comment, seems need 2 attributes on content control... use binding: content="{binding allocatedunits, validatesondataerrors=true}" contentstringformat="all...

debugging - Debug symbols not found for static lib in Visual C++ 2008 -

i'm trying debug static library using mfc in visual studio 2008. when running project in debug mode breakpoints turn circles , hovering on them produces message "the breakpoint not hit. no symbols have been loaded document" the project configuration set "debug", , have tried cleaning , rebuilding solution, did not solve problem. in project's debug folder, there vc90.pdb file, file containing debug information. when running project in debug mode tried debug->windows->modules, right clicked on exe file using lib, , added vc90.pdb file symbol settings. still didn't work. has had problem, , ideas of how fix this? thanks, alex alex - compiled sample dll/exe msft - dllscreencap. worked fine, able step dll code ok. should able set breakpoint in dll source, , should hit when called .exe. work? when i've had kind of problem in past - turned out ide loading old version of dll, test making changing feature in dll, , change sho...

php - JavaScript Pass Variables Through Reference -

is there equivalent in javascript php's reference passing of variables? [php]: function addtoend(&$therefvar,$str) { $therefvar.=$str; } $myvar="hello"; addtoend($myvar," world!"); print $myvar;//outputs: hello world! how same code in javascript if possible? thank you! objects passed as references. function addtoend(obj,$str) { obj.setting += $str; } var foo = {setting:"hello"}; addtoend(foo , " world!"); console.log(foo.setting); // outputs: hello world! edit: as posted in comments below, cms made mention of great article . it should mentioned there no true way pass by reference in javascript. first line has been changed "by reference" "as reference". workaround merely close you're going (even globals act funny sometimes). as cms , holyvier , , matthew point out, distinction should made foo reference object , reference passed ...

visual studio - How To read/write C array stored in text file created through bin2C utility -

i creating application, input c file having array ( created bin2c.exe ) , code segment of c file is:- unsigned int myarray[] = { 0x00000001,0x00000002,0x00000005 ...}; now need read array text file , story value in int array. need modify array , put text file final output like:- unsigned int myarray[] = { 0x39481212,0x33943121,0x3941212 ...}; please let me know how can in c/visualc++ application in vc++ mfc? regards, vikas input open file ( fopen ) in text mode , read lines ( fgets , sscanf ) store array you cannot have array unspecified size. must either use size limit , leave elements unused, or use malloc , friends , manage storage array manually modify use + , - , * , other operators along sqrt , abs , sin , other functions available in standard library massage data (you can create functions of own too) put back it's better write new file , if went ok, delete old file , rename new 1 ... open new file ( fopen "w...

how to show link "send to" in a Document library in Sharepoint 2010 -

how show link "send to" in document library in sharepoint 2010 struggled myself. firstly have setup send feature in ca - general application settings. its site feature can enable - need that. then setup send locations on actual doc library under 'library settings' - 'advanced settings'

sql - TSQL Computed column limitations -

Image
create table [dbo].[membershipmodule]( [id] [uniqueidentifier] rowguidcol not null, [parentid] [uniqueidentifier] null, [targetid] [int] null, [webcontentid] [uniqueidentifier] null, [name] [varchar](35) not null, [nameupper] (isnull(upper([name]),'')) persisted not null, [uriprefix] [varchar](max) null, [uritext] [varchar](max) null, [uricomputed] ??? persisted, [description] [varchar](100) null, [created] [date] not null, [modified] [datetime2](7) not null, [menuitem] [bit] not null, [enabled] [bit] not null, [position] [smallint] null, constraint [pk_membershipmodule] primary key clustered ( [id] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary] ) on [primary] so far uricomputed field computed this: lower(replace(isnull([uriprefix],'/')+coalesce([uritext],[name]),' ','-')) this produces output following now, i'd want termi...

java - Basic Spring MVC config: PageNotFound using InternalResourceViewResolver -

i'm trying first spring 3 mvc setup running. my app running on tomcat, in server context of "grapevine" for purposes of testing, i'm trying requests http://localhost:8080/grapevine/test render contents of web-inf/jsp/nosuchinvitation.jsp when try this, i'm getting 404 , , logs suggest jsp isn't present: warn org.springframework.web.servlet.pagenotfound - no mapping found http request uri [/grapevine/web-inf/jsp/nosuchinvitation.jsp] in dispatcherservlet name 'grapevine' i must have mis-configured somewhere, can't see i've done wrong. here's relevant snippets. web.xml: <servlet> <servlet-name>grapevine</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>grapevine</servlet-name> <url-pattern>/*</url-patte...

++i + ++i + ++i in Java vs C -

possible duplicate: how explain result of expression (++x)+(++x)+(++x)? int i=2; = ++i + ++i + ++i; which more correct? java's result of 12 or c = 13. or if not matter of correctness, please elaborate. thank you. there nothing more correct. undefined , called sequence point error. http://en.wikipedia.org/wiki/sequence_point

Learning Google App Engine & BigTable -

i have traditional rdbms based php app need convert on gae , learn how bigtable works prior doing this. however, i'd kinda through sample problems or examples show maximal way think , utilize non rdbms platform such bigtable... it seems best route take prior jumping in , screwing things in one-to-one conversion happen both feet in first method. anyone able recommend starting path perhaps helped or of nature initiate app engine , bigtable? i recommend having play app engine cookbook see how things work. has examples , has helped me lot when trying understand datastore http://appengine-cookbook.appspot.com/cat/?id=ahjhchblbmdpbmuty29va2jvb2tyfwsscenhdgvnb3j5igleyxrhc3rvcmum

Java memory Management for JNI -

i have 2 questions : what if have jni call method , jni method leaks memory. once method completes jvm garbage collector able memory back. heard jvm not manage heap space used jni ? memory used jni part of memory used java process ? is absolutely necessary use jni achieve ipc ? other popular java techniques or there open source library achieve shared memory in java ? no: "the jni framework not provide automatic garbage collection non-jvm memory resources allocated code executing on native side" ( wikipedia ). no, java has sockets , indeed processbuilder. shared memory can achieved mappedbytebuffer .

wordpress - sexy bookmark plugin breaks my site in ie6 -

the sexy bookmark plugin breaking wordpress site in ie6. it's showing error message. there way can disable plugin if ie6 detected? use conditional comment handle ie6 issues <!--[if ie 6]><![endif]--> more informations

Problems in copying resultset to Excel, Access 2003/20007 -

i've got access 2003 application generates excel reports querying sybase. one of reports produces 204,000 rows. getting split across multiple sheets in excel 2003. i'm testing whether excel 2007 can used , if data can dumped single sheet. the access vba code used copy result sets excel: worksheet.range("a2").copyfromrecordset rs it seems work when number of rows around 90,000, not work @ 204,000 rows. i'm testing on windows 2003 server. i've converted app access 2007 , still face same issues. wondering if can ... many thx --ag make sure excel 2007 installed on machine running access app , specifying fileformat:=52 in .saveas method.

flex4 - actionscript: DownloadProgressBar and Flex 4 can't find resource bundle -

i using flex 4 , want custom preloader, meet error of downloadprogressbar. code: public class mypreloader extends downloadprogressbar { var progress:progressbar = new progressbar(); or substitude progressbar label produce same error: error: not find compiled resource bundle 'collections' locale 'en_us'. anyone has implemented custom preloader? missing here. resolved adding: [resourcebundle("")] tag in source! hope can others.

javascript - Document Type Definition in html -

if add js script above line <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> css not working. there way solve issue <script type="text/javascript"> <?php $data3 = getmaildata(); ?> var collection = [<?php echo $data3; ?>]; </script> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org /tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <title>.:: sample ::.</title> <link rel="stylesheet" href="css/stylesheet.css" type="text/css"> a script element can appear in head or in body, can't appear before doctype , no element can appear outside root element ( <html> ). if doctype (with couple of provisos don't apply in case) isn't first thing in document browsers enter quirks mode (and emulate bugs seen in ...

sql - Informix: procedure with output parameters? -

i searched lot, couldn't find anything.. want ask if there's way create , call procedure ( informix ) out parameters. know how return 1 or more values (for procedures , functions), not want. strange, if informix not allow output parameters.. thanks in advance! edit : yes, saw it's possible, still can't execute such procedure. example: create procedure mytest(batch int,out p_out int) define inc integer; let inc = 1; let p_out = 5; end procedure; and receive is: the routine mytest can not resolved and happens on executing functions output parameters.. why need 'out' parameters? informix procedures can return multiple values single call (or, in case, single value): create procedure mytest(batch int) returning int p_out; define inc integer; define p_out integer; let inc = 1; let p_out = batch + inc; return p_out; end procedure; there limited number of places can use out parameter. ...

how to animate div at fixed postion with jquery -

i have divs side side i.e <table><tr> <td><div id="div1"></div></td> <td><div id="div2></div></td> </tr></table> where div1 has content in , div2 hidden have link in div1 on clicking link want show div2 animate() slide left right on position... div2 has position:fixed in css how can that firstly should consider using using non tabular layout. floating 's next each other better starting point. but answer question like: $(function(){ $('#div1 a').toggle( function(){ $('#div2').animate({width:$('#div1').width()},'slow'); }, function(){ $('#div2').animate({width:0},'slow'); } ); }); this assumes have got css properties overflow:hidden , width:0px set on second div. make div2 same width first div. the slideup , slidedown functions used achieve this.

Reconnect to DB within log4j -

if have jdbcappender configured throw log messages mysql and, while system restart database reconnect db? i have had use case occur on past weekend. database hosted amazon aws. rolled on log database , of instances logging database via log4j jdbc appender stopped logging. bounced 1 of apps , resumed logging. so answer question, through experience, appears no . if database goes down , comes online, jdbc appender not reconnect automatically. edit jdbcappender getconnection might overridden fix.

actionscript 3 - as3 real fireworks -

is there actionscript 3 class fireworks looks real , not kind of bubbles? you need particles, there plenty of libraries out there. have @ 1 instance http://desuade.com/partigen

c# - WPF MediaElement: SpeedRatio not working for .m4a files? -

i'm working simple mediaplayer based on this msdn example user can control volume, playback speed ( speedratio ) , seek ( position ) using 3 sliders. everything works correctly when play .mp3 files, play .m4a file song playback speed, controlled mediaelement.speedratio , ignored. volume , seek still works , audio working. questions: are there logical explanations this? any known solutions/workarounds problem? speedratio essential in application. thanks, avada check out: mediaelement speedratio not linear

Need help with Ionic rewriter in ASP.NET -

rewriterule ^/main/mypage$ / [i] rewriterule ^/main/mypage/$ /main/general/mypage.aspx?id=$1&gid=$2 [i] above's ionic entry in .ini file. now, when write following in code file , run it says "file not found". what's wrong? str = str.replace("#reset#", "<a href='" + qab.con.mysite + "mypage?myid=" + id + "&gd=" + gid + "'>click here</a>"); something's wrong part:- "mypage?myid=" + userid + "&gd=" + gid + " because when type here full name of page, is, /main/general/mypage.aspx instead of above part runs right. how can fixed? [edit] made changes in "str" follows. same problem persists. "mypage/" + id + "/" + gid + " try removing end slash, e.g., change rewriterule ^/main/mypage/$ /main/general/mypage.aspx?id=$1&gid=$2 [i] to rewriterule ^/main/mypage$ /main/general/mypage.aspx?id=$1...

javascript - Trigger procedure on textarea attribute value changes -

i want call user defined function, once <textarea> attribute values changes. attributes height, width , val() of <textarea> i.e. on content change. your suggestion welcome!!! regards, -pravin what want change , keyup , paste events, this: $("textarea").bind("change keyup paste", function() { //this executes when value changes });

iphone - MkMapView don't respond on touch event when panning and zooming? -

i have view controller has mkmapview, buttons , uiview on top of map. map don't respond on touches event. how can make mapview respond on touch events. thanks in advance. use - (void)bringsubviewtofront:(uiview *)view or disable userinteraction on uiview

Why does Lua default to global variables? -

my favourite language these days lua. have 1 issue it, why on earth default behaviour variables in functions global? in similar language icon there keyword "global" used when 1 wants use global instead of natural behaviour default local (i bitten again 5 minutes ago). feel better if tell me rational behind (like scoping difficulties know cause absence of "continue" keyword in lua). see why aren't variables locally scoped default? in lua ufaq .

perspective - meaning of m34 of CATransform3D -

what's meaning of m34 of structure catransform3d, know can change perspective, what's meaning when value -0.001 , 0.001? you can find full details here . note apple uses reversed multiplication order projection (relative given link) matrix multiplications reversed , matrices transposed. a short description of meaning: m34 = 1/z distance projection plane (the 1/e z term in reference link) + z axis towards viewer, resulting in "looking in mirror" feel when using - projection center (0,0,0) plus translations set up

Select a different base for a logarithmic plot in matlab -

Image
i want have x-axis logarithmic base 2: 2^10 2^25 , @ each step exponent should increase one, while y-axis should linear. how possible? figured out set(gca,'xscale','log') but u can't set base. consider example: %# random data x = 2.^(0:10); y = rand(size(x)); plot(log2(x), y) %# plot on log2 x-scale set(gca, 'xticklabel',[]) %# suppress current x-labels xt = get(gca, 'xtick'); yl = get(gca, 'ylim'); str = cellstr( num2str(xt(:),'2^{%d}') ); %# format x-ticks 2^{xx} htxt = text(xt, yl(ones(size(xt))), str, ... %# create text @ same locations 'interpreter','tex', ... %# specify tex interpreter 'verticalalignment','top', ... %# v-align underneath 'horizontalalignment','center'); %# h-aligh centered

javascript - Clustering Google Maps API V3 -

could please tell me how find pixel co ordinates of marker in google maps api v3? you first need latitude , longitude marker.getlatlng() . have latlng object. next need transform geographic coordinates pixel coordinates, , map.fromlatlngtocontainerpixel . so: var pixelposition = map.fromlatlngtocontainerpixel(marker.getlatlng());

Java for Loop evaluation -

i want know if condition evaluation executed in for , while loops in java every time loop cycle finishes. example: int[] tenbig = new int[]{1,2,3,4,5,6,7,8,9,10}; for(int index = 0;index < tenbig.length;index++){ system.out.println("value @ index: "+tenbig[index]); } will index < tenbig.length execute every time loop cycle finishes? assumption , experience tells me yes. i know in example tenbig.length constant, there won't performance impact. but lets assume condition operation takes long in different case. know logical thing assign tenbig.length variable. still want sure evaluated every time. yes, logically evaluate whole of middle operand on every iteration of loop. in cases jit knows better, of course, can clever things (even potentially removing array bounds check within loop, based on loop conditions). note types jit doesn't know about, may not able optimize - may still inline things fetching size() of arraylist<t...

objective c - Problem with the duplicate values picking from Address book in Iphone sdk -

here had problem adding contact address book , checking whether in favourites list or not.if not adding contact favourite list. - (bool)peoplepickernavigationcontroller:(abpeoplepickernavigationcontroller *)peoplepicker shouldcontinueafterselectingperson:(abrecordref)person property:(abpropertyid)property identifier:(abmultivalueidentifier)identifier { contactdto* dtoobject = [[contactdto alloc] init]; abrecordid personid = abrecordgetrecordid(person); nsstring* personidstr = [nsstring stringwithformat:@"%d", personid]; dtoobject.contactid = personidstr; nsstring *lastnamestring, *firstnamestring; firstnamestring = [self getvalueforproperty:kabpersonfirstnameproperty forcontact:personidstr]; lastnamestring = [self getvalueforproperty:kabpersonlastnameproperty forcontact:personidstr]; dtoobject.firstname = firstnamestring; dtoobject.lastname = lastnamestring; printf("\n *****************firstnamestring %s",[firstnamestring utf8string]); //abmultiva...

sql - Temp table with converted values -

i want script convert table create table #temptable ( code nvarchar(5) primary key, name nvarchar(100) ) insert #temptable (code ,name) select st.code , st.name statictable st but there must change. code must autoincremented 100 where length of code more 3, want insert there integer, when not want copy code so code name abcd namezxc efgh nameasd ijk nameqwe i want temptable records: code name 100 namezxc 101 nameasd ijk nameqwe best regards first insert values, go , update ones len() > 3. use shady(because nvarchar , have cast) increment variable. create table #temptable ( code nvarchar(5) primary key, name nvarchar(100) ) insert #temptable (code ,name) select st.code , st.name ( select 'abcd' code, 'namezxc' name union select 'efgh' code, 'nameasd' name union select 'ijk' code, 'nameqwe' name ) st declare @vintcounter nvarchar(5) set @vintcounter...

mysql - Is there a way to make a param optional in PHP PDO? -

say have query: $qry = 'select p.id products p p.type = :type , p.parent = :parent'; if wanted make "type" optional way know how this: $qry = 'select p.id products p p.parent = :parent'; if(isset($type)) { $qry .= 'and p.type = :type'; } is best way? wondering if there way can keep original, , use sort of parameter indicate optional... example if $type = "*" pull types. whats best way this? you might want check blank values well if(isset($type) && $type != '') { $qry .= 'and p.type = :type'; }

dotnetopenauth - dotnetopenid tutorial -

pretty basic question, can please point me constructive tutorial on how implement , use dotnetopenid? i'm struggling find real documentation explains how implement thing. couldn't find on website, , i've gone through couple of samples, still can't work out, , included .chm file reference material, rather "getting started" guide. google searches failing me :( that depends on you're trying accomplish, dotnetopenauth lot of things lot of people. perhaps i'll start little table of scenarios, , people can add table discover tutorials: openid rp openid asp.net mvc, quick setup andrew kharlamov integrating openid in asp.net mvc application using dotnetopenauth rick strahl openid op oauth 1.0(a) consumer oauth 1.0(a) service provider oauth 2.0 client oauth 2.0 protected resource server oauth 2.0 authorization server infocard rp

python - Ways to implement Janrain Engage (RPXNow) on Google App Engine? -

what possible solutions best implement janrain engage (rpx now) on google app engine? for complete solution including sessions, recommend gae-sessions . source includes demo shows how integrate sessions library janrain/rpx . disclaimer: wrote gae-sessions, informative comparison of alternatives, read this article .

exit code - Why is the return value of Perl's system not what I expect? -

let me begin explaining i'm trying accomplish. there 2 perl scripts. 1 call main script ui. user runs script see list of other scripts can call menu. list loaded through custom config file. purpose of main script able add other scripts in future needed without changing source , run either cron job (non-interactive mode) , user needs (interactive mode). company policy, not entitle post entire script, post interactive-mode user selection section: for($i = 0;$i < @{$conf}+1;$i++) { if($i % 2 == 1 || $i == 0) { next; } print $n++ . ". @{$conf}[$i-1]\n"; } print "(health_check) "; # # user selection # $in = <>; chomp($in); if($in =~ /[a-za-z]/) { write_log("[*] invalid selection: $in"); print "\n<<<<<<<<<<<<>>>>>>>>>>>>>\n"; print ">>> ...

ruby on rails - Simple_captcha image not getting displayed -

captcha image not displayed on ui, instead shows simple_captcha.jpg. when try access image through url following error:- "postscript delegate failed /tmp/magick-xxkdifrg': @ error/ps.c/readpsimage/779: (null)'" thanks, anubhaw with rails 3 simple_captcha gem work if change application's route.rb file, example: yourapp::application.routes.draw #... match 'simple_captcha/:id', :to => 'simple_captcha#show', :as => :simple_captcha #... end otherwise produces no image cause doesn't arrive gem's controller.

django - Summing on only the most recently added record -

i'm having hard time wrapping head around django query. figure out sql (and maybe i'll have to), wondering if there way django objects. the model looks (simplified clarity): class stat(model.models): entry_date = models.datetimefield() quantity = models.positiveintegerfield() user = models.foreignkey(user) i need return sum (using annotate , sum, i'm guessing) of added quantities user, grouped month. it's little hard explain, quantity not cumulative -- need deal recent records given user , given month, , need sum quantities, , group them month. if more explanation needed, please so. update: here's rough psudo-code, requested. code not expect, it's if, in slow, programmatic way. i'm hoping there way via single query sake of speed. (btw, based on manoj govindan's code below.) year = list_of_months_that_have_stats users = all_users_in_database months in year: user in users: sum = stat.object.filter(user=user, entry_da...

Wrap anchors in list tags in jQuery -

i have code this: <div id="gallery"> <a href="#">link</a> <a href="#">link</a> <a href="#">link</a> </div> and want rewrite using jquery produce: <div id="gallery"> <ul id="carousel"> <li><a href="#">link</a></li> <li><a href="#">link</a></li> <li><a href="#">link</a></li> </ul> </div> what's best way? example: http://jsfiddle.net/pb98t/ $('#gallery > a').wrapall('<ul id="carousel">').wrap('<li>'); this wraps <a> elements <ul id="carousel"> using .wrapall() , wraps them individually <li> using .wrap() .

Preventing build breaks - using a pre-commit build -

what methods available preventing sloppy developers breaking builds. there version control systems have system of preventing check-in of code breaks build. thanks microsoft tfs build has called "gated check-ins" provides this, performing private check-in (called shelving) promoted normal check-in if build succeeds. http://blogs.msdn.com/b/patcarna/archive/2009/06/29/an-introduction-to-gated-check-in.aspx teamcity has concept of "delayed commit" http://www.jetbrains.com/teamcity/features/delayed_commit.html i can wholeheartedly recommend teamcity!

Matlab- How does you name a new variable based on other variables' values? -

possible duplicates: how concatenate number variable name in matlab? matlab: how can use variables value in variables name? i want name variable using values of other variables given in function. so, if have values x1,x2 can make new variable's name as: x_(x1's value)_(x2's value) name. i've checked out eval, num2str, strcat functions, of yet can't make have variable name above can assign value to. any appreciated. take @ following faq: how can create variables a1, a2,...,a10 in loop? it answers "how" part of question , recommends better approach using arrays.

build - Visual Studio - error LNK2005 in debug mode -

i'm integrating 3rd party code mfc app under visual studio 2010. when in debug mode following build error occurs: 1>libcmt.lib(invarg.obj) : error lnk2005: __initp_misc_invarg defined in libcmtd.lib(invarg.obj) 1>libcmt.lib(invarg.obj) : error lnk2005: __call_reportfault defined in libcmtd.lib(invarg.obj) 1>libcmt.lib(invarg.obj) : error lnk2005: __set_invalid_parameter_handler defined in libcmtd.lib(invarg.obj) 1>libcmt.lib(invarg.obj) : error lnk2005: __get_invalid_parameter_handler defined in libcmtd.lib(invarg.obj) 1>libcmt.lib(invarg.obj) : error lnk2005: __invoke_watson defined in libcmtd.lib(invarg.obj) 1>libcmt.lib(invarg.obj) : error lnk2005: "void __cdecl _invoke_watson(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invoke_watson@@yaxpbg00ii@z) defined in libcmtd.lib(invarg.obj) 1>libcmt.lib(invarg.obj) : error lnk2005: __invalid_parameter defined in libcmtd.lib(invarg.obj) 1>libc...

Cocoa WebView - Loading a local HTML page -

after browsing quite bit, still can't figure out. i've added html page , images directory project resources group in xcode (copied them over). when try load webview following code, text displayed fine, images aren't loaded. nsstring *path = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@"index.html"]; nsstring *htmlcontent = [nsstring stringwithcontentsoffile:path]; nsurl *url = [nsurl fileurlwithpath:[[nsbundle mainbundle] bundlepath]]; [[tempwebview mainframe] loadhtmlstring:htmlcontent baseurl:url]; edit: sorry delay, here's basic html failed. <html> <body> <img src="images/bg.png"></img> </body> </html> and edited code looks - nsstring *path = [[nsbundle mainbundle] pathforresource:@"index" oftype:@"html"]; nsurl *url = [nsurl fileurlwithpath:path]; [[webview1 mainframe] loadrequest:[nsurlrequest requestwithurl:url]]; edit2: realized...

wpf - Binding to property on root element in DataTemplate through a ContentControl -

in user interface want put titles above usercontrols. i want declare these titles in xaml future localizability, want keep them out of datacontexts. can databinding fetch them property set on root node of usercontrol? i have boiled problem down following code example: using system.windows; namespace wpfapplication12 { /// <summary> /// interaction logic mainwindow.xaml /// </summary> public partial class mainwindow : window { public mainwindow() { initializecomponent(); this.person = new author { name = "guge" }; this.datacontext = this; } public object person { get; set; } } public class author { public string name { get; set; } } } and: <window x:class="wpfapplication12.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/x...

worksheet function - Excel: Concatenate/retrieve cells that are across a merged key cell -

assume simple sheet so: ------------- | 1 | | need formula return: "a,b,c" | |-----| | | b | | |-----| | | c | ------------- | 2 | | need formula return: "a,b" | |-----| | | b | ------------- the first column merged key cells , second column has unknown number of rows text values in each cell. what want means, such vlookup/hlookup, retrieve list of cells across merged key cell. if want use macros, how retrieve a-b-c cell range programmatically result of vlookup on "1"? if doesn't work, i'm fine logical check on whether letter exists in list. example, given key value, want able programmatically apply conditionals like: - "does 'a' exist @ '1'? yes." - "does 'c' exist @ '2'? no." edit: keep in mind above example; not know there 'a', 'b', , 'c'; not know number of rows in each set. thanks. this give tr...

perl - Can I use multiple keys in Berkeley DB? -

i want use in berkeley db following perl logic (for many millions records): $hash{key1}{key2}{key3}{count1}++; $hash{key1}{key2}{key3}{count2}++; ... (key1) { (key2) { (key3) { print $hash{key1}{key2}{key3}{count1}."\t".$hash{key1}{key2}{key2}{count2}; } } } any example multiple keys? may of couse use "pseudo-multiple" key ( key1_key2_key3 ); there other way? berkeley-db doesn't support multiple keys that. each record can have 1 key. you can concatenate keys form single key, stated. you can use mldbm give appearance of nested keys. works storing serialized hash under key1 , inefficient if have lot of keys nested under top-level key. or, can give on bdb , go real sql database. dbd::sqlite easy install , includes sqlite database engine along driver. i'd go either concatenating keys or real database, depending on you're trying do.

php - Where do I put view scripts needed by view helpers (using Zend_View and the default directory layout)? -

i've got relatively complicated portion of application, editor access control lists. need reuse in few places, , i'd loadable ajax-y , such. because need use often, i'd make zend_view_helper. that's simple -- put $view->sethelperpath(application_path . '/views/helpers', 'cas_view_helper'); in bootstrap view, , seems set regards loading view helper. however, helper should output using view script. there standard location should put that? usually, when helper need view script script placed inside partial. location of partial may vary depending on directory structure, standard is: application[/modules/name]/views/scripts/partials/ you can write helper this: class cas_view_helper_foo extends zend_view_helper_abstract { protected $partial = 'partials/foo.phtml'; protected $view = null; // render partial here public function foo($params) { $this->view->partial($this->partial, $params); ...

Storing a PHP loop as a string in a variable -

i have problem storing php loop in variable. the loop this: for( $i = 1; $i <= 10; $i++ ) { echo $i . ' - '; } for it's ok echo or print produce: 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - now want store whole loop in variable $my_var means: echo $my_var; which produce: 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - the whole idea want make loop, store string in variable $my_var , use later in script. simply append new string old one. $str = ''; for( $i = 1; $i <= 10; $i++ ) { $str .= $i . ' - '; } echo $str; alternatively, do... $str = implode(range(1, 10), ' - ') . ' - '; ...or even... $str = implode(array_merge(range(1, 10), array(' ')), ' - ');

c# - Locking a static field -

i'm maintaining application consumes common library has static instance of class(classwrapper). class wrapper around microsoft patterns , practices's cachemanager (v3.1 of el) the library hosted in web application , in windows service app, (both inherently multi threaded) there bunch of places in app invokes add method on wrapper in turn calls add on cache manager add item cache manager. as understand, cachemanager not thread safe , cachewrapper not perform locking ensure thread safety in call add. i cannot modify library code directly add synhronization code , considering writing helper method , modifying call sites use helper instead of calling add on wrapper directly. class cachehelper { private static object _synclock = new object(); public static void add<t>(cachewrapper wrapper, string key, t value, int expireinmins) { lock (_synclock) { wrapper.add(key, value, expireinmins); } } } do see probl...

How do I fix ImageMagick install error on MacPorts? -

i've been trying install imagemagick through macports no luck. after running sudo port install imagemagick , following error: computing dependencies imagemagickerror: unable execute port: invalid command name "supported_archs" i'm running mac osx 10.5 latest version of macports. able shed light on error? fixed issue running port selfupdate through macports , confirming latest version.

jQuery event listener for when text has changed in a <td> cell? -

is there way in jquery attach listener cell when text inside cell has changed (by javascript, not user), event triggered? to extend mway's answer , here code. var td = $('#my-table tr td:eq(1)'); var tdhtml = td.html(); setinterval(function() { if (td.html() !== tdhtml) { // has changed tdhtml = td.html(); } }, 500); ... , second suggestion. function updatetd(html) { $('#my-table tr td:eq(1)').html(html); // additional code } you bind domsubtreemodified event element, browser support isn't best.

How do I use SQL to select rows that have > 50 related rows in another table? -

i've been trying find out how write query in sql. what need find productnames (in products table) have 50 or more orders (which in order table). only 1 orderid matched productname @ time when try count orderid's counts of them. i can distinct productnames once add in orderid's goes having multiple productnames. i need count number of customers (in order table) have ordered products. i need serious asap! if me figure out how figure out awesome! table: products `productname` in form of text 'grannysmith' table: orders `orderid` in form of '10222'..etc `custid` in form of 'smith' assuming orders table has field relates products table named productid. sql translate to: select p.productname, count(*) orders o join products p on o.productid = p.productid group p.productname having count(*) >= 50 the key in having component of group clause. hope helps.

java - Netbeans IDE 6.91 "center horizontally" not clickable -

i decent java programming, new gui development. wanted make console blackjack game made years ago 1 people can play via gui build using netbeans. think without gui, people won't take game when add working portfolio i created jframe size set 1000x700 pixels , on top of jpanel background of dark green simulate blackjack table. on top of the dark green jpanel have small 60x93 jlabel icon set of playing card. represents dealer , wanted center horizontally , vertically on top of jpanel on rests. however, in netbeans tool bar particular gui "center horizontally" , "center vertically" options greyed out , not clickable when select jlabel dealer. tried shift clicking select both jlabel , jpanel on rests still "center horizontally" , "center vertically" options greyed out. can please me or offer guidance please? thank you... have spent 2 days googling , don't understand how others have not run same problem. interesting questio...

How can i create read only database link in oracle -

consider following scenerio.... i have master user master. i have test user test. for both users table structure same. both user can on different oracle servers. then create database link master_link logging in test user sql plus using following command create database link master_link connect master identified password using (description = (address_list = (address = (protocol = tcp) (host =192.168.9.139)(port = 1521))) (connect_data = (service_name = orcl))) by loggin in test user , using database link name can modify tables in master user. example update table1@master_link set display_title = 'ponds' ; this query updates table table1 of master user. my requirement want give read permission database link (master_link) test user can't modify or insert table in master user using database link. on whatever database master schema resides, need create new user (i.e. master_read_only). grant master_read_only user select access on of master's t...

iphone - Horizonal Scroller in UITableView -

how make horizontal scroll allow in uitableview ? add label in cell content view frame. however, can't show in portrait view. want allow horizontal scroll bar on portrait view. check on scrollers horizontal in uitableview it's not working. i think can't have horizontal scroll in uitableview. maybe should associate uiscrollview able having horizontal scroll ^^ you see trick ? good luck !

javascript - Input Data To SharePoint RichText Control By WinForms WebBrowser Control -

i need edit value in sp rich text field via winforms web browser control. other controls (input tags) easy , can change value quite simply. however, not simple rich text. headed on to: http://blog.drisgill.com/2007_05_01_archive.html and got ideas. @ first, tried creatign javascript function , adding page: function getrichtextrange(strbaseelementid) var doceditor=rte_geteditordocument(strbaseelementid); if (doceditor == null) { return; } var selection = doceditor.selection; var range = selection.createrange(); return range; } however, every time call this, null value back. tried instead: object doceditor = document.invokescript("rte_geteditordocument", new object[] { fieldname }); ihtmldocument2 doc = (ihtmldocument2)doceditor; ihtmlselectionobject selection = doc.selection; ihtmltxtrange textrange = (ihtmltxtrange)selection.createrange(); textrange.pastehtml(value); well, getting error on second line: "unable cast object of type ...

android - Bluetooth A2DP profile -

i new bluetooth app development. bluetooth profile? hardware specification device? can android mobile phone bluetooth act sender , receiver in a2dp profile? a bluetooth profile specification on protocol , functionality of bluetooth device. not hardware specification, because implementing profile depend on both software stack , hardware chip. can find more information wikipedia page . and in case of a2dp, designed music streaming. cannot used arbitrary data communication (if that's mean "sender , receiver"). if looking generic data communication mechanism on bluetooth transport, serial port profile (spp) need (some people call rfcomm). android sdk user guide has quite detailed information on how use rfcomm api: http://developer.android.com/guide/topics/wireless/bluetooth.html

Creating Thumbnails with GridFS + MongoDB + PHP -

i'm creating site client selling photography sells lot of , quite bit of traffic. around 2k-5k uniques day. i'm using mongodb php , read should use gridfs store these large files. upwards of 2mb-5mb photos, bw extremely spendy (im on cloud hosting) , loading of of these images make page loads take forever. so, how create thumbnails gridfs in php , mongodb? googled , can't seem find real information except people pointing to: http://www.php.net/manual/en/class.mongogridfs.php but im not sure information. need (i hope not, sort of messy): upload -> store original -> use gd lib resize original -> resized image gridfs meta value original image? i ended creating own thumbnails after saving mongodb gd2 , saving thumbnails alongside full size.

java - JSF 1.2 difference between exception in action and actionListener -

i've noticed jsf 1.2. not return error page when exception thrown in actionlistener method return error page when exception thrown in action method. why that? can return error page in both cases? any exception thrown in facesevent listener method silently caught , wrapped in abortprocessingexception , logged console. that's per specification. the actionevent listener method (as other facesevent listener method) has no responsibility navigational tasks. real action method has. generally, action listener method should used whenever want observe action invoke, not execute business task (which affects response).

iphone - Hide detail View -

i need hide detail view shown when clicked on tableviewitem - (ibaction)done:(id)sender { [self.delegate orderdetailsviewdidfinish:self]; } it connected in the, xib , .h view doesnot close, loaded via code , loads great: //initialize detail view controller , display it. orderdetailsview *dvcontroller = [[orderdetailsview alloc] initwithnibname:@"orderdetailsview" bundle:[nsbundle mainbundle]]; dvcontroller.selectedorder = (@"%@",selectedorder); [self presentmodalviewcontroller:dvcontroller animated:yes]; [dvcontroller release]; dvcontroller = nil; the trouble comes when closing it, please not ahve correct .h in detail view thanks mason if present controller modalviewcontroller when hiding need this: - (ibaction)done:(id)sender { [self.parentviewcontroller dismissmodalviewcontrolleranimated:yes]; } when use modals parent-child relation created between 2 controller (the newly presented child) can call previous controller self.p...

sql - TSQL Trim - Portable Method -

i have string in following format 'domain\username'. i wish trim domain , backslash string. cannont use right() have multiple domains of varying length. what portable way this? thank you. select right('domain\username', len('domain\username') - charindex('\', 'domain\username'))

How do I know if the user selected a SharePoint file in OpenFileDialog? -

in openfiledialog, user can enter address of sharepoint site , select document in document library. need provide check-in/check-out integration sharepoint documents. there way determine if file stored in sharepoint document library? thanks in advance! after dialog returns, can check value of selected file. if there's value, selected file. can validate file selected attempting open file. start here: http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx

c# - How to force a synchronous call to a web service -

public string createorder(string purchaseorder) { using (mywebservice.createservice service = new mywebservice.createservice()) { string ordercode = service.createorder(purchaseorder); return ordercode; } } i've added web service reference domain layer of asp.net web app. this generates 2 methods expected - createorder , createorderasync . using thought should synchronous call above though, still seems calling asynchronously. above code returns null every time, though web service runs correctly. if add thread.sleep before return statement, correct value back. how can force synchronous call? , why calling async anyway since that's not function i'm using? note return value has returned client through ajax call, can't see anyway achieve using callback web service. edit: bit more specific because not problem client code. the above method called controller so: string ordercode; try { ordercode = orderservice.createo...

c++ - Push String in Stack? -

i using c++ , want push strings in stack push int in stacks. for example 3."stackoverflow" 2."is" 1."best" 0."site" at every index of stack want push string. how can this? using stl, example: #include <stack> std::stack<std::string> s; s.push("a"); s.push("b"); s.push("c"); s.push("d"); check stl reference more information.

asp.net - Insert hidden column in asp:GridView but still available client side -

this simple. want insert hidden column asp:griview i'll able access through javascript. pointers? you can hide column setting cssclass property, e.g: <style> .hidden {display:none;} </style> ... <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false"> <columns> <asp:boundfield datafield="id" itemstyle-cssclass="hidden" headerstyle-cssclass="hidden" /> <asp:boundfield datafield="title" /> </columns> </asp:gridview>

f# - Literal Attribute not working -

after reading chris' answer f# - public literal , blog post @ http://blogs.msdn.com/b/chrsmith/archive/2008/10/03/f-zen-the-literal-attribute.aspx don't why following not working: [<literal>] let 1 = 1 [<literal>] let 2 = 2 let trymatch x = match x | 1 -> printfn "%a" 1 | 2 -> printfn "%a" 2 | _ -> printfn "none" trymatch 3 this keeps printing "3", although think shouldn't. don't see here? i think literals need uppercase. following works fine: [<literal>] let 1 = 1 [<literal>] let 2 = 2 let trymatch x = match x | 1 -> printfn "%a" 1 | 2 -> printfn "%a" 2 | _ -> printfn "none" trymatch 3 in addition, if want nice general solution without using literals, can define parameterized active pattern this: let (|equals|_|) expected actual = if actual = expected some() else none and write let 1 = 1 l...

vim - How to map function keys to compile my program? -

in vim want map function key fn compiling open c/c++ file. possible ? if yes please guide me. it possible , preferred way of working. i have following in .vimrc : nnoremap <f5> :make<cr> this call 'makeprg' , defaults 'make' . can use results in vim's quickfix mode tackle compilations errors, warnings, etcetera , ( with correct setup ) deliver cursor right error lies in code. if want compile current file, set 'makeprg' other 'make ', such compiler, followed current file: :set makeprg=g++\ % [but you'll need add compiler flags such include paths, etc.] if you're using alternative build system, such boost build , scons , et cetera , humbly recommend using makeshift set 'makeprg' you. help topics in vim underway: :help :make :help :nnoremap :help :set :help 'makeprg' :help :_%

php - when all fields are empty, echo and exit - by newbie -

please tell me needs done, avoid message: parse error: syntax error, unexpected $end in /xxxx/xxxxxxx/public_html/contact- it/feedback.php on line xxx (the last line of feedback.php = ?>) thanks hint. if(empty($data_start)) { if(empty($data_end)) { if(empty($comment)) { # empty echo "you have not specified details submit us"; exit ; ?> you missing closing curly braces: if(empty($data_start)) { if(empty($data_end)) { if(empty($comment)) { # empty echo "you have not specified details submit us"; exit(); }}} you should re-factor code this: if(empty($data_start) && empty($data_end) && empty($comment)){ exit("you have not specified details submit us"); } more info: http://www.w3schools.com/php/php_operators.asp

javascript - How to trigger Ctrl+C key event with jQuery? -

i want simulate ctrl + c copy text page. first tried this: $('#codetext').click( function() { $("#codetext").trigger({ type: 'keydown', which: 99 }); } html: <input type='text' id='codetext'> i have tried using $(this) instead of selector, input element has focus on it, doesn't run. check out zeroclipboard ... think works, haven't tested it.

Display custom fields in assignment block (SAP CRM 7.0) -

i tried post on sdn forums (sap forums) very little help...seems anytime post sap topic no 1 can :(. decided post on stackoverflow , can hope there must sap crm gurus on here... here origional link posted on sap forums, maybe little did on sap forums can follow along clicking link: http://forums.sdn.sap.com/thread.jspa?threadid=1802454&start=0&tstart=0 and here description: we running sap crm 7.0. using opportunity module "create follow up" (sales order / quotation) have 1 many relationship (1 opportunity may contain many sales orders). have 2 custom fields inside sales cycle (quotation) module "actual sales order value" , "current points". what trying take these 2 custom fields , add them assignment block called "linked transactions" in opportunities module. when @ available fields assignment block these 2 custom fields nt available. not see way of adding these 2 fields assignment block. thing see "create new field...

Django Markdown works in dev but not in prod -

i'm using flatpages app markdown , on (django) development server markdown works fine. but when deployed on staging server apache/mod_python, markup vanish , see raw markdown formatting. there's not difference between staging server , dev server, both runs ubuntu same packages installed (including python-markdown). also there no errors @ all, doesn't work. i'm not sure start troubleshooting issue .. this template code: {% extends "base.html" %} {% load markup %} {% block content %} <h1>{{ flatpage.title }}</h1> <div class="page">{{ flatpage.content|markdown }}</div> {% endblock %} i see @ least 1 flag: "there's not much difference between staging server , dev server ...". ahem. i suggest going staging directory, make sure copy of python using exactly same 1 apache/mod_python using, , run dev server there. may interesting output. in django/contrib/markup/templatetags/markup.py there f...

Python: loop through a file for specific lines -

i have following lines in file want take third column; in file don't have numbers column: red; blue; green; white; orange; green; white; orange; blue; green; white; red; blue; green; white; blue; green; white; orange; orange green; white; orange; white; orange green; i used code line that: lines = i.split(";")[2] the problem of lines have 1 column or two, gives me 'index out of range' error. please tell me how go problem? thanks lot adia use slice instead of index. >>> open('test.txt') f_in: ... column3 = (line.split(';')[2:3] line in f_in) ... column3 = [item[0] item in column3 if item] ... >>> column3 [' green', ' orange', ' white', ' green', ' white', ' orange']

opengl - how to use glm's operator== in stl algorithms? -

is possible use operators defined in glm::gtx::comparison in stl algorithms? specifically have code: std::vector<glm::ivec3> veca, vecb; // vectors content bool result = std::equal(veca.begin(), veca.end(), vecb.begin()); this default fails cause operator== can't found. that's open bug apparently.

php - Accessing arrays whitout quoting the key -

i can access array value either $array[key] or $array['key'] is there reason avoid using 1 on other? use latter variant $array['key'] . former work because php tolerant , assumes string value key if there no constant named key : always use quotes around string literal array index. example, $foo['bar'] correct, while $foo[bar] not. […] wrong, works. reason […] has undefined constant ( bar ) rather string ( 'bar' - notice quotes). see array do's , don'ts . now in opposite accessing arrays in plain php code, when using variable parsing in double quoted strings need write without quotes or use curly brace syntax : […] inside double-quoted string, it's valid not surround array indexes quotes "$foo[bar]" valid. see above examples details on why section on variable parsing in strings. so: // syntax error echo "$array['key']"; // valid echo "$array[key]"; echo "{$ar...