Posts

Showing posts from January, 2015

apache - PHP code is not being executed, instead code shows on the page -

Image
i'm trying execute php code on project (using dreamweaver) code isn't being run. when check source code, php code appears html tags (i can see in source code). apache running (i'm working xampp), php pages being opened php code isn't being executed. does have suggestion happening? note: file named filename.php edit: code..: <? include_once("/code/configs.php"); ?> sounds there wrong configuration, here few things can check: make sure php installed , running correctly. may sound silly, never know. easy way check run php -v command line , see if returns version information or errors. make sure php module listed and uncommented inside of apache's httpd.conf should loadmodule php5_module "c:/php/php5apache2_2.dll" in file. search loadmodule php , , make sure there no comment ( ; ) in front of it. make sure apache's httpd.conf file has php mime type in it. should addtype application/x-httpd-php .php . tells...

unit testing - Python SQLAlchemy - Mocking a model attribute's "desc" method -

in application, there class each model holds commonly used queries (i guess it's of "repository" in ddd language). each of these classes passed sqlalchemy session object create queries upon construction. i'm having little difficulty in figuring best way assert queries being run in unit tests. using ubiquitous blog example, let's have "post" model columns , attributes "date" , "content". have "postrepository" method "find_latest" supposed query posts in descending order "date". looks like: from myapp.models import post class postrepository(object): def __init__(self, session): self._s = session def find_latest(self): return self._s.query(post).order_by(post.date.desc()) i'm having trouble mocking post.date.desc() call. right i'm monkey patching mock in post.date.desc in unit test, feel there better approach. edit: i'm using mox mock objects, current unit test...

iphone - How to create custom UITableViewCell without using XIB -

i found many tutorials on how create custom table view cell using xib, possible create custom table view cell without using xib? can 1 me? yeah, can create custom table view cell without using xib. for this, have create 1 new class in xcode subclass of uitableviewcell. here can't select xib options. now open custom uitableviewcell class , here's code achieve want: #import "customcell.h" @implementation customcell @synthesize ivuser; @synthesize lblusername; - (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier: (nsstring *)reuseidentifier { self = [super initwithstyle:style reuseidentifier:reuseidentifier]; if (self) { // initialization code ivuser = [[uiimageview alloc] initwithframe:cgrectmake(4.0f, 3.0f, 39.0f, 38.0f)]; lblusername = [[uilabel alloc] initwithframe:cgrectmake(58.0f, 8.0f, 50.0f, 27.0f)]; [self.contentview addsubview:ivuser]; [self.contentview adds...

c# - How to remove nodes using HTML agility pack and XPath so as to clean the HTML page -

i need extract text webpages related business news. html page follows.. <html> <body> <div> <p> <span>desired content - 1</span></p> <p> <span>desired content - 2</span></p> <p> <span>desired content - 3</span></p> </div> </body> </html>" i have sample stored in string can take me desired content -1 directly, can collect content. need collect desired content -2 , 3. for tried current location i.e in span node of desired content -1 used parentof , moved external node i.e para node , got content need entire desired content in div. how it? might ask me go div directly using parentof.parentof.span. specific example, need general idea. mostly news articles have desired content in division , go directly nested inner node of division. need come out of inner nodes till encounter division , innertext. i using xpath , htmlagilitypack. xpath...

jquery - Javascript: add onclick attribute DOM -

i've tryed add listeners existing div element //prepare div $(this.div).css("z-index","256"); $(this.div).attr("onmouseover",this.myname+".resize();"); $(this.div).attr("onmousedown",this.myname+".resize();"); $(this.div).attr("onmouseout","if("+this.myname+".sized)"+ this.myname+".resize();"); but in ie , chrome event doesn't fired while still gets added elements attributes. firefox works expected. does know whats wrong it? thanks do not set events strings. instead, should use jquery's bind method: var me = this; //inside handlers, element. $(this.div).bind('mouseenter mousedown mouseleave', function() { me.resize(); });

java - Log to a different file according to thread -

i have application multiple "controllers", , i'd have each log own file. easy enough own code, i'm using library code uses commons logging. somehow code log controller-specific file well? i thinking somehow thread: class controller { public void action() { setcurrentthreadlogfile(mylogfile); try { library.stuff(); } { restorecurrentthreadlogfile(); } } } currently i'm using commons-logging own logging well, log4j backend. change that, if needed, or use mix (is that's possible within commons logging framework). one way write own commons logging implementation (possibly wrapper around log4j), there existing solution? you want looking @ mapped diagnostic contexts (mdcs). commons logging not support these log4j does, have go directly log4j set up. have roll own filter filter using mdc , apply appenders. if willing change logging implementations use sl4j logging facade , logback logging implementation. have controller or ...

Add Watermark on Facebook profile image with an APP -

could please me app have made add watermark people give authorization it. have been searching app , have not found neither info code it. yo me please or tell me important information success in intention. , best regards as far know, can't alter profile image itself. can retrieve it, upload profile album can't set profile picture.

java - Integrating ExtJS with JAX-RS -

i'm trying integrate extjs jax-rs. setup jersey pojomappingfeature , works fine. want rid of glue code. every class looks this: @path("/helloworld") public class { @post @produces(mediatype.application_json) public final extjsrestoutput createaction(extjsrestinput<b> tocreate) { try { final b created = tocreate.getdata(); // logic return new extjsrestdataoutput<b>(created); } catch (exception e) { return new extjsrestfailure(); } } @get @produces(mediatype.application_json) public final extjsrestoutput readcollectionaction() { try { final list<b> readcollection; //logic return new extjsrestdataoutput<list<b>>(readcollection); } catch (exception e) { return new extjsrestfailure(); } } @put @path("{id}") @produces(mediatype.application_json)...

java - how to use transaction manager in spring 3 -

i tried using in spring 3 xml file gives error <tx:annotation-driven transaction-manager="transactionmanager" /> what thinga required work you need transactionmanager, e.g., <bean id="transactionmanager" class="org.springframework.orm.hibernate3.hibernatetransactionmanager"> <property name="sessionfactory" ref="sessionfactory" /> </bean> which requires sessionfactory in turn requires datasource (here c3p0): <bean id="sessionfactory" class="org.springframework.orm.hibernate3.annotation.annotationsessionfactorybean"> <property name="datasource" ref="datasource" /> ... </bean> <bean id="datasource" class="com.mchange.v2.c3p0.combopooleddatasource" destroy-method="close"> ... </bean> you need declare transactions. prefer declarative transaction approach annotate database routin...

jQuery Access Object Value -

hi guys can please show me how access content inside audiocollection object? i using echonest jquery plugin jquery templates https://github.com/rodeoclash/echonest-jquery-plugin/blob/master/scripts/echonest.js i went on firebug , typed console.log(audiocollection) , getting referenceerror: audiocollection not defined . not sure if doing right. echonest.artist(artist).audio( function(audiocollection) { $('#blog-page').find('.post').append( audiocollection.to_html('<p class="song-url" style="display:none;">${url}</p>') ); //appends url variable html inside of audiocollection var testing = audiocollection; //returns [object object] }); thank you! i'm not familiar object, can try use dump() function see what's in it.. echonest.artist(artist).audio( function(audiocollection) { $('#blog-page').find('.post').append( audiocollection.to_html('<p class="song-url" s...

objective c - Redrawing the cocoa app's main window when clicked -

Image
i made mac os x cocoa app, , when click red button main window disappears. however, when clicked icon in dock, doesn't show main window anymore. what's wrong? how redraw main window catching message? you might able in application delegate: - (bool)applicationshouldopenuntitledfile:(nsapplication *)sender { //show window here return no; }

ruby on rails - capybara assert attributes of an element -

i'm using rspec2 , capybara acceptance testing. i assert link disabled or not in capybara. how can this? how disabling link? class you're adding? attribute? # check link has "disabled" class: page.should have_css("a.my_link.disabled") page.should have_xpath("//a[@class='disabled']") # check link has "disabled" attribute: page.should have_css("a.my_link[disabled]") page.should have_xpath("//a[@class='disabled' , @disabled='disabled']") # check element visible find("a.my_link").should be_visible find(:xpath, "//a[@class='disabled']").should be_visible the actual xpath selectors may incorrect. don't use xpath often!

Run Word VBA with msgbox via C# without user interaction -

i running macro in word document via c#, macro creates copy of document , adds couple of more attributes. but issue that, macro has confirmation msgbox @ point of code needs user interaction. i using code below grabbed ms's web site. question is; is there way suppress or auto-confirm messagebox shown on run of macro? private void runmacro(object oapp, object[] orunargs) { oapp.gettype().invokemember("run", system.reflection.bindingflags.default | system.reflection.bindingflags.invokemethod, null, oapp, orunargs); } since your macro, change not show confirmation msgbox. when need macro in context confirmation msgbox shall appear, add boolean flag useconfirmationmsgbox boolean macro code, , show msgbox when flag true. then, provide 2 different entry points, 1 useconfirmationmsgbox set true, , 1 set false.

php - Auto-populating select boxes using jQuery and Ajax - not working in anything newer than 1.3.2 -

i have been going through tutorial on auto-populating boxes using jquery , ajax: http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/ and in demo author running jquery version 1.2.3. locally managed function running on jquery 1.3.2. running on version above 1 not working (the second box not populating). here jquery code: <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" charset="utf-8"> $(function(){ $("select#ctljob").change(function(){ $.getjson("/select.php",{id: $(this).val(), ajax: 'true'}, function(j){ var options = ''; (var = 0; < j.length; i++) { options += '<option value="' + j[i].optionvalue + '">' + j[i].optiondisplay + '</option>'; } $("select#ctlperson").html(options); }) }) }) </script> this html ...

Google Maps API v3: Links (a href) in bubbles are not working within a jQuery UI Dialog -

i have problem integration of google maps within jquery ui dialog . links in maps bubbles (infowindowhtml) not work, not clickable. tested firefox 3.6.8, chrome 9. unfortunately, works in internet explorer. example: http://www.periscope.de/files/jquery_dialog.htm if embed google maps outside of jquery ui dialog, links clickable , work fine. is there problem googlemaps , jquery ui? maybe z-index? map , dialog created same dom element, confusing browser. practical approach place map on child div of dialog. hope helps!

javascript - json causes problem in IE -

i'm using bit of javascript json string send data flash project var flashvars = { xmlfile: 'http://iyt.psu.edu/xml/abington/home.xml', preface: 'http://iyt.psu.edu/', preload: '{"url":"flash/project.swf","x":"375","y":"237","link":"home","tween":{"prop":"y","begin":"0","finish":"-200","duration":"1"}}' }; however preload line causes problems in ie have idea i"m might doing wrong besides using ie ; ^ ) if there trailing comma , using firefox or webkit based browser fine. in ie trailing commas no more object properties cause problem may not obvious. this fail. see comma @ end: var flashvars = { "xmlfile" : "http://iyt.psu.edu/xml/abington/home.xml", "preface" : "http://iyt.psu.edu...

Loading/Creating an image into SharpDX in a .NET program -

i'm trying use sharpdx create simple maze-like 2d program using directx. to end want create bitmaps can render on-screen walls, hallways, outside of maze, etc. however, can't seem figure out how either load existing image file bitmap class in sharpdx library, or how create new such bitmap class scratch. since classes said mapped directly directx types, guess means need learn more directx, hoping there simple example somewhere show me need do. if have construct new bitmap scratch , draw it, can that, it's not difficult getting pixels need right, can't seem figure out part. does have experience sharpdx library , can give me pointers? you should ask directly question "issue" tab on sharpdx project, able give quick response there (you lucky i'm checking usage net ;) ). if asking officially, make improvement library , keep record of request in issue database. concerning particular issue, it's not clear kind of directx api using. a...

visual studio 2010 - MVC3 Strange error after switching on compilation of views -

i working on mvc3 project razor. have switchen on compilation of views aware of spelling errors etc. @ compile-time. as switch on <mvcbuildviews>true</mvcbuildviews> in projects configuration file following error during compile: error 1 error use section registered allowdefinition='machinetoapplication' beyond application level. error can caused virtual directory not being configured application in iis. i read several possible solutions problem, concerning iis , virtual directories or applications. problem is, not use iis, instead use default visual studio development server. what can solve problem? i have tried lot of different solutions available in web, either did not quite fit onto problem, or did not work. to recap problem: after switching compileviews on, got above error during compile. using default visual studio development server of vs2010 test mvc app. today opened request @ microsoft developer support, , - ashamed admit ...

youtube - How to measure upload bitrate using Java+Google Data API -

i'm writing java client application uses google data api upload things youtube. i'm wondering how go tracking progress of upload, using google data api library call service.insert insert new video, blocks until complete. has else come solution monitor status of upload , count bytes sent? thanks ideas link: http://code.google.com/apis/youtube/2.0/developers_guide_java.html#direct_upload extend com.google.gdata.data.media.mediasource writeto() include counter of bytesread: public static void writeto(mediasource source, outputstream outputstream) throws ioexception { inputstream sourcestream = source.getinputstream(); bufferedoutputstream bos = new bufferedoutputstream(outputstream); bufferedinputstream bis = new bufferedinputstream(sourcestream); long bytecounter = 0l; try { byte [] buf = new byte[2048]; // transfer in 2k chunks int bytesread = 0; while ((bytesread = bis.read(buf, 0, buf....

internet explorer 7 - Is there an alternative to the CSS white-space property for use in IE 7? -

i'm trying display text line breaks in div using css white-space property value of pre-line . works expected chrome, firefox, , ie 8, not in ie 7. for example, <div style="white-space:pre-line"> css has pretty useful property called white-space i’m guessing goes unnoticed among css beginners. can live without property quite time, once learn how use it, come in handy , you’ll find going on , on again. </div> will display in chrome, firefox, , ie 8 this: css has pretty useful property called white-space i’m guessing goes unnoticed among css beginners. you can live without property quite time, once learn how use it, come in handy , you’ll find going on , on again. but in ie 7 displays this: css has pretty useful property called white-space i’m guessing goes unnoticed among css beginners. can live without property quite time, once learn how use it, come in handy , you’ll find going on , on again. you can see here: http://jsfidd...

java - Mallet topic modelling -

i have been using mallet inferring topics text file containing 100,000 lines(around 34 mb in mallet format). need run on file containing million lines(around 180mb) , getting java.lang.outofmemory exception . there way of splitting file smaller ones , build model data present in files combined?? in advance in bin/mallet.bat increase value line: set mallet_memory=1g

html - Setting Checkbox in a Table Using Javascript -

trying set checkbox inside table. thought straightforward , similar doing in form. i can form , getting stuck when checkbox in table. when checkbox in form use: <form name="access_menu_form"> <input type="checkbox" name="mybox_name" id="mybox_id" value="1"> </form> document.access_menu_form.mybox_name.checked == true which works great!! i know missing key point dom. trying set checkbox have in table fails using similar technique fails: my table: <table name="access_table"> <thead> <tr> <th>area</th> <th>item</th> <th>access</th> </tr> </thead> <tr> <td><input type="checkbox" name="mybox_name" id="mybox_id" value="1"></td> <td><input type="checkbox" name="mybox1_name" id="mybox1_id...

c# - Linq to sql between List and Comma separated string -

i have 1 list , 1 comma separated column value. lst.add("beauty"); lst.add("services"); lst.add("others"); and column value beauty,services service,others beauty,others other,services other beauty, food food now want rows contains list item. output result is beauty,services service,others beauty,others other,services other beauty, food first edit these comma separated values 1 of table's 1 column value. need check against column. assuming can figure out how rowcollection rowcollection.where(row => row.split(",").tolist().where(x => list.contains(x)).any()).tolist(); will evaluate true if row contains value list.

G Contour Matlab -

how use mesh() draw gaussians in 2d, inside matlab function... function g(mean,cov,c) icov = inv(cov); det_cov = det(cov); const = 1/(2*pi*sqrt(det_cov)); xx = linspace(mean(1)-3*sqrt(cov(1,1)),mean(1)+3*sqrt(cov(1,1))); yy = linspace(mean(2)-3*sqrt(cov(2,2)),mean(2)+3*sqrt(cov(2,2))); [x y] = meshgrid(xx,yy); mx=x-mean(1); = y-mean(2); z=const*exp(-0.5*(icov(1,1)*mx.^2+icov(2,1)*mx.*my +icov(2,1)*my.*mx+icov(2,2)*my.^2)); contour(x,y,z,c); simply replace contour mesh . also, try not use mean , cov variable names. mean , cov matlab functions, , while spelling different, you're still setting hard-to-find bugs.

Python Algorithm Challenge? -

i have python function (call myfunction ) gets input a list of numbers , and, following complex calculation, returns result of calculation (which number ). the function looks this: def myfunction( listnumbers ): # initialize result of calculation calcresult = 0 # looping through indices, 0 last 1 in xrange(0, len(listnumbers), 1): # complex calculation goes here, changing value of 'calcresult' # let return result of calculation return calcresult i tested function, , works expected. normally, myfunction provided listnumbers argument contains 5,000,000 elements in it. may expect, calculation takes time. need function run fast possible here comes challenge : assume time 5am, , listnumbers contains 4,999,999 values in it. meaning, last value not yet available . value only available @ 6am . obviously, can following ( 1st mode ): wait until 6am . then, append last value listnumbers , , then, run myfunction . solution works, it ...

java - how can i display my data on jsp page in struts2 -

my action class :- package com.action; import java.util.iterator; import java.util.list; import javax.persistence.entitymanager; import javax.persistence.entitymanagerfactory; import javax.persistence.entitytransaction; import javax.persistence.persistence; import javax.persistence.query; import org.apache.struts2.convention.annotation.*; import org.apache.struts2.rest.defaulthttpheaders; import com.opensymphony.xwork2.actionsupport; @parentpackage(value="default") @namespace("/") @resultpath(value="/") public class noofusers extends actionsupport { private static final long serialversionuid = 1l; @action(value="usersn",results={ @result(name="create",type="tiles",location="users") }) public static defaulthttpheaders create(){ entitymanagerfactory emf=persistence.createentitymanagerfactory("tujpa"); ...

cross browser - Is the website rendering OS dependent? -

i'm developing simple web site, 1 web page, need 1 single page should in browsers. now, testing purposes, have installed bunch of web browsers on windows 7 machine (ff, chrome, opera, safari, netscape etc.) , after doing markup changes, i've got same looking webpage on browsers. now question is, "the way" browser renders web-page depend on operating system browser running on? should install linux (or other os) , test again or fine? you should testing sites cross-platform, others may disagree, rendering different. in addition base-rendering, may missing fonts, have alternate fonts same name, have anti-aliasing enabled/disabled on different platforms/configurations , more. to see mean, on base install of windows 7 firefox 5, osx firefox 5 , linux firefox 5, when using font 'arial' or 'verdana', see differences, if fonts do exist on platforms. on top of differences you'd see above, positioning out if you're using non-absolute...

iphone - How to implement custom delegate methods for my view controllers -

in app there 2 tabbars. in tab-0 parent class "firstviewcontroller" , in tab-1 parent class "secondviewcontroller". in "secondviewcontroller" have declared protocol , custom delegate method. want pass information in "firstviewcontroller"(fvc). fvc has assigned delegate. now doubt is, right in "svc". how can assign "fvc" delegate of "svc"? in "svc" [[self delegate] sendcoordinates:self]; definition of method in "fvc". execute method, first need assign "fvc" delegate. i hope clear in explaining problem. thanks in advance. you need set delegate. let me demonstrate: `svc.h` @interface svc { id _delegate; } - (void)setdelegate:(id)delegate; //sets delegate - (id)delegate; //gets delegate @end @protocol svcdelegate - (void)sendcoordinates:(svc *)svc; @end then, in svc.m , call delegate in same way showed in question, [[self delegate] sendcoordinates:self]...

iphone - ASIFormDataRequest: POST both image/jpeg and application/xml with a -

given both: nsdata *jpegdata; nsstring *xmlpost: how construct asiformdatarequest post both image/jpeg data , applicaton/xml data multipart/mixed post request? i'm afraid i'm not answering question. two facts. the asiformdatarequest class not designed support 'multipart/mixed'. (at least, currently) xml plain string can sent via multipart/form-data too. if situation forcing have use multipart/mixed , ignore me. (for instance, client don't want modifying server program support multipart/mixed .) if not, please think again once. need multipart/mixed itself? no choice? never 'multipart/form-data'? know, server part programmers 'multipart/form-data' more other used format because supported server frameworks. makes life lot easier :) if want 'regularity' or 'efficiency' or other specials instead of simplicity, should consider other http. benefits of http stability , compatibility. (from it's well-define...

android - Add array of strings to linear layout -

my code below. displaying details, not in proper way. can please me? textview tv1=new textview(this); tv1.settext("displayname:"+strdisplayname); textview tv2=new textview(this); tv2.settext("email:"+stremail); textview tv3=new textview(this); tv3.settext("firstname:"+strfirstname); textview tv4=new textview(this); tv4.settext("lastname:"+strlastname); textview tv5=new textview(this); tv5.settext("createddate:"+strcreateddate); mprofilelayout.addview(tv1, new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); mprofilelayout.addview(tv2, new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); mprofilelayout.addview(tv3, new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); mprofilelayout.addview(tv4, new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); mprofilelayout.addview(tv5, new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); ...

indexing clob column in oracle using solr -

i unable index clob clumn using solr. tried using clob transformer , doesn't work. any idea on how index clob column in oracle using solr indexing? <entity name="***" query="***" transformer="clobtransformer" > <field column="clob_column" name="clob_column" clob="true" /> </entity> works me. maybe mixing lower , uppercase? debug , set breakpoint in clobtransformer.java

Python: Parsing HTML with BeautifulSoup -

<a href="/watch?gl=us&amp;client=mv-google&amp;hl=en&amp;v=0c_yxohjxwg">miss black ocu 2011</a> my program reads html file, , above chunk of file. want grab miss black ocu 2011 using beautifulsoup in python. suggestions? i suggest looking @ attributes of tag , navigablestring class text = """<a href="/watch?gl=us&amp;client=mv-google&amp;hl=en&amp;v=0c_yxohjxwg">miss black ocu 2011</a>""" soup = beautifulsoup(text) print soup.find('a').text

Cakephp:: Auto submit form after validate $_GET parameters? -

This summary is not available. Please click here to view the post.

Python Work Around For 'Goto' -

at moment have check see if string has specific characters in it. i trying find work around 'goto' function. this have @ moment: chars = set('0123456789$,') if any((c in chars) c in userinputamount): print 'input accepted' else: print 'invalid entry. please try again' i need python go string input of 'userinputamount' if entry invalid. push in right direction appreciate. you don't need goto, need loop. try this, loops forever unless user provides valid input: chars = set('0123456789$,') while true: # loop "forever" userinputamount = raw_input() # input user if any((c in chars) c in userinputamount): print 'input accepted' break # exit loop else: print 'invalid entry. please try again' # input wasn't valid, go 'round loop again

iphone - Base64 HTTP Authenthication -

how can contents of url using base64 authentication (username:password) iphone sdk passing username , password in url doesn't work because api states authentication basic web authentication, using base64 encryption of "username:password" i hope can me out one. thanks in advance! ok i've managed figure out. have set correct authorization value in header , trick :d

java - getting only name of the class Class.getName() -

how can name of class string.class.getname() returns java.lang.string interested in getting last part ie string api can that? class.getsimplename()

ruby on rails - How to set in a middleware a variable accessible in all my application? -

i using ruby on rails 3 , trying use middlewares in order set variable @variable_name accessible later in controllers. for example middleware is class auth def initialize(app) @app = app end def call(env) @account ||= account.find(1) @app.call(env) end end the above code set @account variable, isn't available in application (in controllers, models, views, ...). so, how can accomplish that? i seen this answer way need, have @account variable "directly accessible". is, without use way making available, example in views, this: <%= debug @account %> you can use 'env' that. in middleware this: def call(env) env['account'] = account.find(1) @app.call(env) end you can value using 'request' in app: request.env['account'] and please don't use global variables or class attributes people suggest here. that's sure way troubles , bad habit.

c++ - Semaphore On Multiple Producer Single Consumer Problem -

i need suggestion on case studies on c++. i have taken queue multiple thread 20 producer thread writing on it.there single consumer thread read queue , process it. planning use critical section , semaphore achieve synchronization. addtail-adding message in queue. removehead-remove data queue. i have restricted queue length 10. crtical section protect wrting or/reading problem. semaphore synchronized access queue. let me know other possible solution on this. there many ways write such queue. example, use mutex , condition variable in example @ http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html herb sutter discusses queues in articles @ dr dobb's. see http://www.drdobbs.com/high-performance-computing/211601363 , http://www.drdobbs.com/high-performance-computing/210604448

Set CSS property in Javascript? -

i've created following... var menu = document.createelement('select'); how set css attributes e.g width: 100px ? use element.style : var element = document.createelement('select'); element.style.width = "100px";

jquery - Why are there no raptors in IE? -

the other day, smashingmagazine gave world wonderful gift . unfortunately ie (at least ie7) shock , amazement, has problem it. know why code below not fire in ie7? it listens keypresses , fires function if can match konami code. i'm not super knowledgeable on js events, direction appreciated. var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65"; $(window).bind("keydown.raptorz", function(e){ kkeys.push( e.keycode ); if ( kkeys.tostring().indexof( konami ) >= 0 ) { init(); $(window).unbind('keydown.raptorz'); } }, true); edit: can else test in ie7 confirm? jquery supports e.which keycode in case e.keycode doesn't work. try change e.keycode e.which . but think true third argument in bind. take away , try again. here copy in js fiddle of ie compliant version: link updated: wow, bind keydown on $(window) w...

decompiler - How do I decompile a .dll file? -

i have .dll decompile make improvements code. tools out there allow me this? it's written in vb, believe. the answer depends on language dll written in. if .net language then, pointed out, can use .net reflector. if it's older visual basic (pre-.net), dll compiled what's called p-code , there few options doing variations on decompiling. finally, if it's written in language c++, there no direct way obtain source code. such dll compiled machine language , can directly decompiled assembly language. so, again, depends on language used. , answer might it's not possible resembling original source code.

Automapper: How to ignore a member in VB.NET -

i'm using automapper in vb.net project, , trying make ignore member. can see how in c#, not in vb.net. have quick example of using formember method. thanks, paul here's how :) mapper.createmap(of incomingmodel, outgoingmodel)().formember(function(x) x.fieldtoignore, sub(y) y.ignore()) the thing important, , messed sub instead of function second part. this works in vs2010. older versions can't it.

php - Zend Form: how to automatically set the class of an element to required if required option is set to true? -

is possible? i'm trying use jorn's jquery validation plugin, , avoid having add 'class' => 'required' if i'm setting required => true option. thx in advance input! not possible using standard zf classes. can accomplish creating custom decorator replace standard viewhelper . class my_form_decorator_viewhelper extends zend_form_decorator_viewhelper { public function render($content) { $element = $this->getelement(); if ($element->isrequired()) { $class = $element->getattrib('class'); // append current attrib $element->setattrib('class', $class . ' required'); } return parent::render($content); } } of course, might want add prefix path decorator in form.

winforms - semi-transparent form but opaque Controls in C# -

how make semi transparent form in c# windows form application i have tried transparentkey makes full-transparent. , tried opacity effects whole form (with controls). i want form part semi-transparent not controls. you can use hatch brush percentage, example: using system.drawing.drawing2d; private void form1_paint(object sender, painteventargs e) { var hb = new hatchbrush(hatchstyle.percent50, this.transparencykey); e.graphics.fillrectangle(hb,this.displayrectangle); }

c# - databinding DataGrid to a List<object[]> -

i have list<object[]> mycollection result of select sql query. each object[] represents row in query result, , length of array vary different queries. have name of column headers in separate list<string> myheaders . i want databind mycollection datagrid header of columns myheaders , , autogenerate columns. the reason want use autogeneratecolumns because want datagrid reconize datatypes of each object, , use appropriate column templates each datatype. thanks! if you're stuck , need on: use dataset/ datatable. ancient still work fine! if want know if can done, don't know. examples of binding ilist i've seen manually loop , create columns. regards gj

javascript - What is the most normal way to deliver a ClojureScript desktop application -

i have desktop application written in clojure suffers jvm startup time , fit clojurescript. delivered jar file jvm, equivalent clojurescript/javascript? the deployment rules regular javascript apply. there's nothing wrong sending user optimized .js file emitted clojurescript's compiler. means double clicking script or running command line if python or ruby. can desktop development using javascript? for windows machines, have windows script house http://msdn.microsoft.com/en-us/library/9bbdkx3k(vs.85).aspx if run *nix can use node.js http://nodejs.org/ note: may need lookup tips getting google's closure library work node.js via https://github.com/hsch/node-goog if depend on it.

javascript - How do you make an event listener that detects if a boolean variable becomes true? -

for example, have var menu_ready = false; . have ajax function sets menu_ready true when ajax stuff done: //set event listener here $(...).load(..., function() { ... menu_ready = true; } how set event listener waits menu_ready true? one way continual polling: function checkmenu() { if (!menu_ready) { settimeout("checkmenu();", 1000); return; } else { // menu_ready true, need here. } } and... <body onload="checkmenu();">

java performance on two different servers -

not sure if question should here or in serverfault, it's java-related here is: i have 2 servers, similar technology: server1 oracle/sun x86 dual x5670 cpu (2.93 ghz) (4 cores each), 12gb ram. server2 dell r610 dual x5680 cpu (3.3 ghz) (6 cores each), 16gb ram. both running solaris x86, exact same configuration. both have turbo-boost enabled, , no hyper-threading. server2 should therefore faster server1. i'm running following short test program on 2 platforms. import java.io.*; public class testprogram { public static void main(string[] args) { new testprogram (); } public testprogram () { try { printwriter writer = new printwriter(new fileoutputstream("perfs.txt", true), true); (int = 0; < 10000; i++) { long t1 = system.nanotime(); system.out.println("0123456789qwertyuiop0123456789qwertyuiop0123456789qwertyuiop0123456789qwertyuiop"); long t2 = system.nanotime(); ...

asp.net - In ASP MVC3, how can execute a controller and action using a uri? -

how can i, when executing controller action, take uri (not 1 requested) , invoke action controller have been executed had uri been 1 called? can't redirect action need happen in same request context. assuming have access httpcontext (and suppose since asking) could: var routedata = new routedata(); // controller , action compulsory routedata.values["action"] = "index"; routedata.values["controller"] = "foo"; // additional route parameter routedata.values["foo"] = "bar"; icontroller foocontroller = new foocontroller(); var rc = new requestcontext(new httpcontextwrapper(httpcontext), routedata); foocontroller.execute(rc); personally use approach handling errors inside application. put in application_error , execute error controller custom error pages staying in context of initial http request. place complex objects inside routedata hash , complex objects action parameters. use pass actual exception occurre...

jquery - having problems passing javascript variable to php file in the url -

i have code right : $(document).ready(function() { var ktitle = $('.hiddentwo').text(); $('div#tab2').load('morefour.php?title=ktitle'); }); but php file doesn't seem getting variable...am doing wrong? i echo in php file , see text. when echo $ktitle in php file 'kitle'...that should not happening :p. stupid question, want know how store variable in url. $('div#tab2').load( 'morefour.php?title=' + encodeuricomponent(ktitle) );

silverlight - RIA Service ObjectContext filter included records -

using ria domain services entity framework 4, having trouble entity filtered related items. for example, given: order table , product table (1 order has many products) i have service returns order products loaded, e.g. public iqueryable<order> getorderbyid(int orderid) { return this.objectcontext.order .include("products") .where(n=>n.orderid == orderid); } question, is there way filter products record in linq query in case? say, return order of specified id , include products prices higher 100.0 ; return empty/null products if there isn't any. point here return order though there isn't products meet criteria . have tried this: var query = o in objectcontext.order.include("products") join p in objectcontext.product on o.productid equals p.productid o.orderid == orderid , p.price > 100 select o; ...

javascript - Disabling a control based on checkbox state? -

i want disable referenced control in html , javascript below, yet it's not doing it. seems simple enough. missing? <html xmlns="http://www.w3.org/1999/xhtml"> <head><title> </title> <script language="javascript" type="text/javascript"> function disable(isdisable, controlid) { var objcontrol = document.getelementbyid(controlid); if (objcontrol != null) { objcontrol.disabled = isdisable; } } </script> </head> <body> <form name="form1" id="form1"> <input name="date?4" type="text" value="1/1/2011 12:00:00 am" id="date?4" runat="server" style="border-color:black;font-family:arial;width:300px;" /><input type="checkbox" style="font-family: arial" onclick="disable(this.checked, "date?4" );" >disable </form><...

Incompatibility between InfoPath 2007 WebServiceConnection and WCF -

i trying post data infopath using webserviceconnection, wfc service inside of appfabric. messgae never arrives in appfabric, , think know why. wcf service configured this <endpoint address="workflow1.xamlx" binding="basichttpbinding" contract="workflowoperation" /> and when called wcf test client, generates header <s:header> <a:action s:mustunderstand="1">http://tempuri.org/workflowoperation/receiveformpayload</a:action> </s:header> however, infopath not generate soap header, generates http header post /workflow1.xamlx http/1.1 soapaction: "http://tempuri.org/workflowoperation/receiveformpayload" content-type: text/xml; charset="utf-8" user-agent: soap toolkit 3.0 host: localhost:51842 content-length: 1893 connection: keep-alive cache-control: no-cache how configure wcf endpoint need http-header action, , not soap action? well, i'm again, answer interested in g...

ANTLR ambiguous reference -

when compile following antlr grammar file, conditional_expression : (logical_or_expression -> logical_or_expression) ('?' expression ':' rhs=conditional_expression -> ^('?' $conditional_expression expression $rhs))? ; i following error message. error(132): nesc.g:769:109: reference $conditional_expression ambiguous; rule conditional_expression enclosing rule , referenced in production (assu ming enclosing rule) can tell me solution this? thanks. :-) antlr cannot decide mean $conditional_expression : rule itself, or 1 labeled $rhs . conditional_expression // <--- one? : (logical_or_expression -> logical_or_expression) ('?' expression ':' rhs=conditional_expression -> ^('?' $conditional_expression expression $rhs))? // ^ // | // +--- or one? ; to working tried, you'll need move ...

static - How to find complete list of warnings in eclipse IDE -

i'd find places in project ' the static method should accessed in static way ' warning raises. is there way of getting complete list @ once ? did search rule set in pmd, dint find any. so, need !!! click on small triangle in upper right corner of problems view , select "configure contents". in dialog check "show items" , uncheck "use item limits" show warnings.

Can I deploy Rational Publishing Engine Data Services on IIS? -

i shall use rational publishing engine generating documentations rational requisitepro. such shall have deploy rpe data services. can deploy data services on iis? apache/was mandatory data services? i eagerly waiting response. rpe data services not supported on iis.

objective c - How can I cancel a UIScrollView zoom bounce? -

i'm using zooming uiscrollview show images in ipad app. zooming works great, pinch making image smaller or bigger appropriate. have bounceszoom enabled bounces minimum or maximum zoom if user stretches far 1 way or other. now i'd recognize when pinch has ended image 10% smaller minimum zoom size and, in such case, prevent bounce happening , trigger different animation shrinks image "close" it. way, there can sort of "pinch close" gesture. i've come this, @ simplest, this: - (void)scrollviewdidzoom:(uiscrollview *)scrollview { if (self.zoombouncing && zoomedtoscale / self.minimumzoomscale < 0.90) { // we've let go , under 90% of minimum size. self.minimumzoomscale = zoomedtoscale; [self shrinkimagetonothing]; } else { // how far have gone? zoomedtoscale = self.zoomscale; } } this works great, except @ point it's bouncing, setting of minimumzoomscale nothing. therefore, boun...

sharepoint - Setting a TextFilter's value from a Query String (URL) Filter -

i'd start off saying i'm new sharepoint, i'm sorry if i'm asking obvious. i've done quite bit googling , can't find answer question. leads me believe maybe i'm asking wrong question. so, here goes: we have sharepoint webpage contains 3 web parts (2 lists , text filter). text filter can used filter 2 lists. i've been asked provide following functionality: a user must able open page http link (easy) the text-filter must automatically filled-in , applied, filtering 2 lists this seemed pretty straight-forward me: pull parameter page's url , feed filter. found , added query string (url) filter , managed pull parameter url, can't feed existing filter! sure, can pass value 2 lists (effectively coding same filter 2 different ways) seems wrong. so, question boils down this: is possible set text filter's value query string (url) filer? am asking wrong question? looking @ problem in wrong way? appreciated, thanks. i ...

c# - Question on two different class extension patterns -

what semantic difference between following 2 methods: public static bool isnullorempty(this array value) { return (value == null || value.length == 0); } and public static bool isnullorempty<t>(this t[] value) { return (value == null || value.length == 0); } is there advantage 1 on other? the first work any array, including rectangular arrays , ones non-zero lower bound. work when compile-time type of array array , may happen weakly-typed apis. in short, first more general, , should work anywhere second does. (i'm assuming don't want "extra" features this, such constraints on t in second form... want find out whether array reference null or refers empty array.) edit: ienumerable , you'd use: public static bool isnullorempty(this ienumerable value) { if (value == null) { return true; } var iterator = value.getenumerator(); try { return !iterator.movenext(); } { ...

Ways to deal with Daylight Savings time with Quartz Cron Trigger -

i have quartz cron trigger looks so: <bean id="batchprocesscrontrigger" class="org.springframework.scheduling.quartz.crontriggerbean"> <property name="jobdetail" ref="batchprocessjobdetail" /> <property name="cronexpression" value="0 30 2 * * ?" /> </bean> how should solve this, if have several configurations happen within 2-3am period? there accepted best practice? relevant link: http://www.quartz-scheduler.org/docs/faq.html#faq-daylightsavings basically says "deal it." question how! i solved using separate trigger fires (an hour early) on beginning date of dst configurations happen between 2am , 3am eastern. seems kludgey, works...

math - Lambert W function implementation in Java -

i'm working on project , have found myself in situation need function able @ least approximation of value of w(x), lambert w function , x can real number. i'm working in java. couldn't find implementations of w in java when searched. willing code implementation myself if need be, unsure of how done right now. pushes in right direction appreciated. take @ page: http://mathworld.wolfram.com/lambertw-function.html it lists approximation z>3 series expansion function. you can use newton's method , halley's method approximate function: http://en.wikipedia.org/wiki/lambert_w_function#numerical_evaluation

Asp.net design patterns -

i'm junior developer, knows basics , have experience well, when comes building project ground i'm useless in terms of writing maintainable code. know there tons of design patterns purpose, , i'm aware of asp.net mvc3. now, need read asp.net design patterns books become architect asp.net or should concentrate on mvc new , better design pattern ? have impression design patterns , mvc stand separately since mvc "forced" design pattern on it's own. need clarify myself , appreciate answers ! thanks. i asp.net mvc more web forms because easier understand whats going on. other thing mvc has better "seperation of concern" building architecture. clean, no asp.net controls no viewstate, no dopostback(). you cold learn using webcasts phill haack , / or scott hanselman. have many videos different events mix , other. http://www.hanselman.com/ http://haacked.com/ pattern /techniques prefer: repository pattern dependencie resolution (ninje...

jpa - Is there a way to get all managed entities from an EntityManager -

i'm setting basic test data util , want keep track of data entitymanager handles. rather having bunch of lists each entity there way grab being managed entitymanager in 1 fell swoop? so instead of this: entitymanager em; list<entity1> a; list<entity2> b; ... list<entityn> n; cleanup() { for(entity1 e : a) em.remove(e); for(entity2 f : b) em.remove(f); ... for(entityn z : n) em.remove(z); } i want this; entitymanager em; cleanup() { list<object> allentities = em.getallmanagedentities(); //<-this doesnt exist for(object o : allentities) em.remove(o); } not sure if possible, image manager knows managing? or, if have ideas of managing bunch of entities easily. i think might help: for (entitytype<?> entity : entitymanager.getmetamodel().getentities()) { final string classname = entity.getname(); log.debug("trying select * from: " + classname); query q = entitymanager.createquery(...

quickest way to invite a friend via gmail or facebook? -

i'm trying find quickest way implement simple feature allows invite facebook or gmail friend website. so user on website gets page , has option "invite friend". want ability , choose list of facebook friends invite or contacts in gmail. ideally start typing name , auto complete gmail contact or facebook. there's nothing both, i'm wondering if such thing possible either gmail contacts or facebook friends? possible solution google? http://code.google.com/apis/contacts/docs/poco/1.0/developers_guide.html facebook provides 'send' button purpose: https://developers.facebook.com/docs/reference/plugins/send/ [edit] there's combined + send button - https://developers.facebook.com/docs/reference/plugins/like/ [/edit] allows users send link page via facebook messages, or email email address with right meta tags ( https://developers.facebook.com/docs/opengraph/ ) control how recipient sees link, , insights on share activity of page ...

.net - SqlServer Xml Data Type - How to Force Full End Elements -

i have table in sql server... [id] [int] identity(1,1) not null, [firstname] [nvarchar](100) null, [lastname] [nvarchar](100) null, [dataitemsxml] [xml] null, which has xml column. want store xml in column in following format... <data> <item-1>some data here</item-1> <item-2></item-2> </data> notice empty element item-2. need store in manner support code cannot modify. even when pass xml in insert or update statement in format, sql server appears convert empty elements item-2 following... <data> <item-1>some data here</item-1> <item-2 /> </data> i understand valid xml, need have sql server store in first format, full end tags elements, empty elements. i cannot figure out how this. any ideas? thanks! according microsoft : sql server preserves content of xml instance, not preserve aspects of xml instance not considered significant in xml data model. means retrieved xm...

PHP GZIP more information -

i use plugin of google firefox "speed test" , have error: enable compression compressing following resources gzip reduce transfer size 65.8kib (65% reduction). now.. know nothing subject , want learn more subject. this related/connected ob ( ob_start ) or somthing that? i'll gateful more information , tutorials subject. if there vidoe guides better. this full notice i've got google speed test: compressing following resources gzip reduce transfer size 65.8kib (65% reduction). compressing http://localhost/english/jquery.js save 57.3kib (65% reduction). compressing http://localhost/english/javascript/slider.js save 4.0kib (69% reduction). compressing http://localhost/english/style/style.css save 3.7kib (72% reduction). compressing http://localhost/english/javascript/home.js save 853b (62% reduction). take @ ob_gzhandler . have straight-forward example too: <?php ob_start("ob_gzhandler"); ?> <html> <body> <p...