Posts

Showing posts from August, 2011

c# - how to filter from nested collections without ForEach? -

i have entity type property type list of b. type b has property of type list of c. i want apply filter on object of such there c objects in list of c selected property true. this can done like: a obja = a.listb.foreach(b => {b.listc.removeall(c => c.selected == false);}); but don't have remove c objects have selected = false. want filter them. any ideas? more explanation: there object of type a, list of b property. in each b object of a's list of b, there exists list of c property. c object has selected property. now, need is- object of list of b, in each of b's list of c has c objects have selected = true. desirable output type a. list b shouldn't filtered list c needs filtered. what this: a.listb.where( b => b.listc.exists( c => c.selected ) ) is want?

image processing - How to crop a large jpeg into smaller tile jpegs? -

for example, have big.jpg 600 (w) x 300 (h), crop 250 x 250 each. such big.jpg becomes 6 tile jpegs: tile_0_0.jpg (250 x 250) tile_0_1.jpg (250 x 250) tile_0_2.jpg (100 x 250) tile_1_0.jpg (250 x 50) tile_1_1.jpg (250 x 50) tile_1_2.jpg (100 x 50) any tool (command line or gui) recommended? thanks! http://www.imagemagick.org/usage/crop/#crop_tile

sql server - how to convert column values into comma seperated row vlaues -

i have table values fktable_name fkcolumn_name pkcolumn_name table1 column1 column1 table1 column2 column2 table2 column1 column1 table2 column2 column2 how need convert into fktable_name fkcolumn_name pkcolumn_name tablel1 column1,column2 column1,column2 table12 column1,column2 column1,column2 basically, trying comma seperated columns group table name. thanks here's working query on db select distinct table_name, stuff((select ','+data_type information_schema.columns b b.table_name=a.table_name xml path(''),type).value('.[1]','nvarchar(max)'),1,1,'') data_types, stuff((select ','+column_name informatio

iis 6 - HTTP 404 file not found error even the file exist in the webserver IIS6.0 -

i having files in server available downloads. using iis6.0. when try download pdf file http 404 file not found error. having file in server. while googling found need enable mime type. can 1 explain me , rid of problem this easy enough sort out to enable globally on site hosted iis instance open iis manager right click server name select properties click mime types button click new extension .pdf mime type application/pdf to add single site on iis instance open iis manager right click sites name select properties choose 'http headers' tab click mime types button click new extension .pdf mime type application/pdf

php - codeigniter where to process sql result? -

class selectedmodel extends ci_model { var $title = 'selectedmodel'; var $content = 'get top n articles'; var $date = '23.2.2011'; function __construct() { parent::__construct(); } function gettoparticles() { $result = $this->db->query('select top 5 article articles;'); if( ! $result->num_rows() > 0 ) die('there no articles in db.'); return $result; } } class front extends ci_controller { function __construct() { parent::__construct(); } function index() { $this->load->database(); $this->load->helper(array('text', 'html')); $this->load->model('selectedmodel'); // controller process data , validate $top_articles = $this->selectedmodel->gettoparticles(); foreach($top_articles->result() $item) { $item

objective c - NSColor | Creating Color from RGB Values -

in application, rgb values unsigned character not more 255, using nscolor api create color , make use of draw font , background color, this function have written +(nscolor *)getcolorfromrgb:(unsigned char)r blue:(unsigned char)b green:(unsigned char)g { cgfloat rfloat = r/255.0; cgfloat gfloat = g/255.0; cgfloat bfloat = b/255.0; // return [nscolor colorwithcalibratedred:((float)r/255.0) green:((float)g/255.0) blue:((float)b/255.0) alpha:1.0]; return [nscolor colorwithcalibratedred:rfloat green:gfloat blue:bfloat alpha:1.0]; } in case, when compare color using rgb value in rgb palate, color not matching, example, when pass , r = 187, g = 170, b = 170, it should draw light gray, getting complete whilte color, in case, anyone has idea, doing wrong, kind regards rohan if passing input components out of 255 , want restrict within 255 safety purpose, can try this: cgfloat rfloat = r % 255.0; cgfloat gfloat = g % 255.0; cgfloat bfloat =

unix - why fork and exec are kept 2 seperate calls -

i understand differences between fork, vfork, exec, execv, execp. pls dont rant it. question design of unix process creation. why did designers think of creating 2 seperate calls ( fork , exec ) instead of keeping 1 tight call ( spawn ). api design reason developers had more control on process creation? because of performance reason, delay allocating process table , other kernel structures child till either copy-on-write or copy-on-access? the main reason separation of fork() , exec() steps allows arbitrary setup of child environment done using other system calls. example, can: set arbitrary set of open file descriptors; alter signal mask; set current working directory; set process group and/or session; set user, group , supplementary groups; set hard , soft resource limits; ...and many more besides. if combine these calls single spawn() call, have have complex interface, able encode of these possible changes child's environment - , if ever added new se

iphone - Objective-C++ for iOS development -

is possible use objective-c++ ios application (iphone, ipad, ipod touch) development? are there examples , source code on internet? using objc++ quite easy. have declare source files extension .mm. make compiler treat them objc++. same headers: use .hh extension. there option: go target settings , set compile sources objective-c++. that's all. no additional work necessary. some notes: if want develop native ios app, use objective c. save lot of time. in cases using c++ more appropriate. e.g. cross-platform development. use little bit of objective c iphone or java android glue code environment. else in c++. use cross-platform game development. another case performance: objective c principally slower c++. noticeable during method calls (in objc called messaging).

nosql - Graph DB's Vs Azure Table storage for a Social networking application -

i'm starting on architecture work .net based social networking application hosted on azure cloud. going using asp.net mvc on front end. i consider options storage. considering scalability needs , due inter-connected nature of application, sql azure has been ruled out. what main considerations in choosing graph db such sones graphdb or neo4j have features specific social networking application against using windows azure table storage achieve needs. i'm concerned development time, cost, ability leverage existing skills .net , reliability of graph db platforms , ease of setup , administration. graph databases designed applications such social networks. ease of development, may best start graphdb. key advantage on key-value database powerful query , traversal capabilities. easy to, instance, find occurrences of friends of friends using graphdb query syntax. the benefit of key-value database service azure table low cost, minimal administrative overhead , scalab

How to append the data at the top of the div using jquery -

i have content in div , need append data @ top of previous content inside div moving remaining content down after jquery function call. thanks in advance $("#mydiv").prepend(data) :) that should trick :)

iphone - horizontal flip animation on modal UIView -

how can present modal view horizontal flip animation (like pushing view controller on navigation controller) ? tried doesn't work [uiview beginanimations:@"animation" context:nil]; [uiview setanimationtransition:uiviewanimationtransitionflipfromleft forview:self.view cache:no]; [self presentmodalviewcontroller:detailsviewcontroller animated:no]; [uiview commitanimations]; thanks ! this need: detailsviewcontroller.modaltransitionstyle = uimodaltransitionstylefliphorizontal; [self presentmodalviewcontroller:detailsviewcontroller animated:yes];

c++ - Pass an object of a type aggregated by a boost::variant to a function that accepts that boost::variant -

suppose have: class typea { }; class typeb { }; typedef boost::variant<typea, typeb> type; this ok: void foo(type t) { }; int main(){ typea a; foo(a); } this not compile: void foo(type &t) { }; int main(){ typea a; foo(a); } with error: invalid initialization of reference of type ‘type&’ expression of type ‘typea’ also not compile: void foo(type *t) { }; int main(){ typea a; foo(&a); } with error: cannot convert ‘typea*’ ‘type*’ argument ‘1’ ‘void foo(type*)’ is there way pass function accepts boost::variant instance of 1 of types aggregated boost::variant, either through reference (as in case 2) or pointer (as in case 3)? thank much! what happens in 1: typea a; type __temporary__(a); foo(__temporary__); what cannot happen in 2 or 3: typea a; type* __temporary__(&a); // fails because there no inheritance relationship foo(__temporary__); you have 2 solutions (for non template fo

.net - Can IoC and the Managed AddIn Framework (System.AddIn) work together with isolated AppDomains? -

if use managed addin framework (system.addin) , set use separate appdomains, can use centralized ioc container in primary/default appdomain? can ioc container resolve across appdomains? i'm going approach answer ignoring maf part of equation, , concentrating on appdomain issue. ioc container theoretically describe, assuming ioc entry point inherits marshalbyrefobject or wrapped class in turn inherits marshalbyrefobject. 29k+ rep score, sure know but: 1) objects inherit marshalbyrefobject can accessed across appdomain boundaries via proxying (that is, of calls marshalled across appdomain boundary object). 2) objects serializable can passed across appdomain boundary via serialization, is, can copy of them in other appdomain. for number of reasons, wouldn't want serialize whole ioc container , ship across appdomain boundary. first off, overhead of doing enormous, , secondly there lot of plumbing behind ioc container isn't serializable. therefore possibl

Structure for big GWT project -

context big project multi maven module or single maven module structure question did use multi-maven-module or single-maven-module structure? details if you've worked on big project had long development duration , contains lots of functionality(i.e. not trivial project), did choose split project multiple maven modules or went single-module approach? for example, having multi-module structure, crashes when running maven commands mvn gwt:eclipse(see http://bit.ly/gs4rmo ). guess have worked single module gwt project. , there other commands above has issues multi-module structure. however, multi-module structure bring benefits of faster development, i.e. if separate "server" "client" module, compile business logic(server) separately , package resulting web archive. compiling gwt code, takes 20 seconds, if modify server package, save lots of time in long run. which other cases 1 above did encounter when working multi-module/single module proj

c# - Linq to SQL many-to-many relationship without a third class -

in database have following tables: customers (id) orders (id) customersorders (customerid, orderid) how map customers table customers class , orders table orders class without creating class customersorders? that depends on linq version you're talking about. if you're using entity framework 4.0 , have no additional information in table other ids asking should generated. believe same true entity framework 1.0. linq sql story. never handled many-to-many relationships well. have allow linq sql generate third table , extend partial classes hand in separate file mask away third table. it's ugly works. here's series of blog posts detail needs done: how implement many-to-many relationship using linq sql

c# 4.0 - c# fill something on html page -

how can fill "myusername" on <td width="18%" class="more"><div align="right">¿¿¿¿¿¿ </div></td> <td width="82%"> <font color="#ffffff" face="ms sans serif, tahoma, sans-serif"> <input type=text name="qtitle" size=51 maxlength=100 class=violet> </font> </td> i try in c# not work please help private void webbrowser2_documentcompleted(object sender, webbrowserdocumentcompletedeventargs e) { } private void loadprofileinformation() { dataset dsnew = new dataset(); //some code fetch information if store in db //else can put in static info if may want. //so nto need dataset. qtitle.text = "myusername"; } you can store in class access code behinds <%= myvar %> in front end. if want modify values of divs on front end need use asp tags l

Relative Path Problems in Javascript Ajax call -

okay, have javascript file following functions: function askreason() { var answer = prompt("please enter reason action:", ""); if (answer != null) doreason(answer); } function createxmlhttprequest() { try { return new xmlhttprequest(); } catch (e) { alert('xmlhttprequest not working'); } try { return new activexobject("msxml2.xmlhttp"); } catch (e) { alert('msxml2.xmlhtt not working'); } try { return new activexobject("microsoft.xmlhttp"); } catch (e) { alert('microsoft.xmlhttp not working'); } alert("xmlhttprequest not supported"); return null; } function doreason(reason) { var xmlhttpreq = createxmlhttprequest(); var url = "/shared/askreason.ashx?reason=" + reason; xmlhttpreq.open("get", url, true); xmlhttpreq.send(null); } this line: var url = "/shared/askreas

c# - Why can I not assign the concatenation of constant strings to a constant string? -

occasionally want break apart constant string formatting reasons, sql. const string select_sql = "select field1, field2, field3 table1 field4 = ?"; to const string select_sql = "select field1, field2, field3 " + "from table1 " + "where field4 = ?"; however c# compiler not allow second form constant string. why? um, should fine... sure doesn't compile? sample code: using system; class test { const string myconstant = "foo" + "bar" + "baz"; static void main() { console.writeline(myconstant); } } my guess in real code you're including non-constant expression in concatenation. for example, fine: const string myfield = "field"; const string sql = "select " + myfield + " table"; but isn't: static readonly string myfield = "field"; const string sql = "sele

How to create large PDF files (10MB, 50MB, 100MB, 200MB, 500MB, 1GB, etc.) for testing purposes? -

i tried for ((i=1; i<=10; i++)); convert 100mb.pdf 10mb.pdf 100mb.pdf; done create 100mb file run out of ram. any ideas? the simple tool: use pdftk (or pdftk.exe , if on windows): pdftk 10_mb.pdf 100_mb.pdf cat output 110_mb.pdf this valid pdf. download pdftk here . update: if want large (and valid!), non-optimized pdfs, use command: pdftk 100mb.pdf 100mb.pdf 100mb.pdf 100mb.pdf 100mb.pdf cat output 500_mb.pdf or (if on linux, unix or mac os x): pdftk $(for in $(seq 1 100); echo -n "100mb.pdf "; done) cat output 10_gb.pdf

JQuery Plugin - Date Picker -

i attempting implement jquery data picker http://www.eyecon.ro i have embedded in page without problems, unable achieve functionality require it. the date picker not attached form element, purely going used calendar visible user , allow them scroll through various months, weeks etc. the website shows various example of varying items of functionality - http://www.eyecon.ro/datepicker/#about however, able achieve first example shown on page displays years ranging 2002 - 2013, however, upon load display current month opposed user having select correct year, , month in order use calendar. i presuming using 'date' option there should way me specify if display todays date. has achieved above functionality plugin? thank you. you can current date with: var today = new date(); var month = today.getmonth() + 1; var datestring = today.getfullyear() + '-' + month + '-' + today.getdate(); note have add 1 month, js counts january 0. edit: rea

lucene - Java, cannot find symbol : method methodName(org.bla.blabla.myClass) -

i'm using lucene apis, , following error on line of code: import org.apache.lucene.document.document; import org.apache.lucene.document.field; import org.apache.lucene.document.fieldable; ... document _document = new document(); _document.add(new field("type", document.gettype())); error: collectionindexer.java:34: cannot find symbol symbol : method add(org.apache.lucene.document.field) location: class collectionindexer.document _document.add(new field("type", document.gettype())); this documentation method: http://lucene.apache.org/java/3_0_3/api/all/org/apache/lucene/document/document.html#add(org.apache.lucene.document.fieldable ) thanks update: javac -cp commons-digester-2.1/commons-digester-2.1.jar:lucene-core-3.0.3.jar myapp.java the problem comes fact document.gettype() method returns string , there no constructor in field class matches call. see http://lucene.apache.org/java/3_0_3/api/all/org/apache/lucene/document/f

blackberry - Update text on a buttonfield when it is clicked -

i'm trying set text on button when clicked. i'm initialising bigvector update text of button value. i'm using counter value determine wihcih bigvector value should selected. problem is, below code expecting counter value final. a better methodology updating text on field when clicked welcome. here code - final bigvector bigstringvectora = new bigvector(); bigstringvectora.addelement("a test answer 1"); bigstringvectora.addelement("a test answer 2"); bigstringvectora.addelement("a test answer 3"); aansweroptionbutton.setchangelistener(new fieldchangelistener() { public void fieldchanged(field field, int context) { aansweroptionbutton.settext((string)bigstringvectora.elementat(counter)); } }); thanks you can make counter instance variable, either in outer class or in anonymous fieldchangelistener: aansweroptionbutton.setchangelistener(new fieldchangelistener() { pr

convertToWorldSpace - cocos2d -

converttoworldspace hi, i'm not sure understand how works. api states converts local coordinate world space. let' have 3 sprites. spritea added scene , , spriteb added spritea. , spritec added spriteb. - scene - spritea - spriteb - spritec and want convert spritec origin world if do: [self converttoworldspace:[spritec cgpointzero]]; or this: [spritea converttoworldspace:[spritec cgpointzero]]; or this: [spriteb converttoworldspace:[spritec cgpointzero]]; or [spritec converttoworldspace:[spritec cgpointzero]]; shouldn't give same answer since transformed world coordinates? or go 1 node space parent node space ...until world space. what correct answer see spritec position in world coordinates? to find world space origin on spritec , take sprites parent, in case spriteb , ask world space of child: [spriteb converttoworldspace:[spritec cgpointzero]];

asp.net - For Loop in C# not looping -

i have issue loop doesn't loop. i've posted simplified version of code below. basically, using npoi excel library, have excel file data on first , second sheet, need loop through both sheets. below have done far, works through first sheet , exits. fails increment variable w. can see, there other loops implemented in code function fine don't it. it's been long day , perhaps i'm missing simple. have placed wrong or something. if else can spot might doing wrong i'd grateful :) public class salesfileprocessor : isalesprocessor { public list<ftpsalesrow> processsalesfile(string filename) { try { using (filestream fs = file.open(filename, filemode.open, fileaccess.read)) { int numberofsheets = 2; //loop through sheets - not work (int w = 0; w <= numberofsheets; w++) { hssfworkbook templateworkbook = new hssfworkboo

How to unit test my Google OpenID consumer app? -

my web app google openid consumer (with attribute exchange , oauth extension) , need write unit test [edit: test unit responsible interact google]. the problem default openid login procedure needs user interaction (entering user/pass) not possible in unit test. do have idea how can solve problem , unit test openid consumer app? (i prefer not run own openid provider.) you need use remote controlled browser this. selenium made use case. (indeed called functional tests then). search on google best way integrate selenium tests web framework.

google maps - Android: Got right lat and long but markers are printed at the wrong place -

i'm fetching 's stores in "göteborg" , adding marker on mapview. problem code markers bunched in africa. i've checked coordinates correct isnt that. anyone know what's problem is? df = ((classhandler)getapplication()).getstoredatabadefacade(); cursor plotstore = df.getallstorepos("göteborg"); startmanagingcursor(plotstore); plotstore.movetofirst(); while(plotstore.isafterlast() == false){ geopoint addstore = new geopoint(plotstore.getcolumnindex("lat"), plotstore.getcolumnindex("long")); //overlayitem overlayitem = new overlayitem(addstore, plotstore.getstring(plotstore.getcolumnindex("_id")), plotstore.getstring(plotstore.getcolumnindex("address"))); overlayitem overlayitem = new overlayitem(addstore, plotstore.getstring(plotstore.getcolumnindex("_id")), plotstore.getstring(plotstore.getcolumnindex("address"))); itemizedst

ruby on rails - Args not being passed through to Rake tasks -

i have rake task accepts argument, :scope (below). call rake task this: rake podcast:generate_inventory["new"] this task used pass :scope arg perfectly, however, noticed today arg no longer being passed. have idea why happening? namespace :podcast task :itunes_top_300, [:scope] => :environment |t,args| podcast.podcast_logger.info("begin: #{time.now}") if args[:scope] == "new" podcast.podcast_logger.info("new podcasts only") end podcast.itunes_top_rss end task :itunes_genres_top_300 => :itunes_top_300 podcast.itunes_genre_rss end task :site_and_feed_discovery, [:scope] => :itunes_genres_top_300 |t,args| if args[:scope] == "new" podcast.site_and_feed_discovery(:new_podcasts_only => true) else podcast.site_and_feed_discovery end end task :social_discovery, [:scope] => :site_and_feed_discovery |t,args| if args[:scope] == "new" p

svn - What is the best way to use InstallShield together with Subversion? -

does know subversion client plug-in installshield? suppose use tortoisesvn client on our setups-preparing pc. i’m interested know , how control multiple project builds. installshield project, script directory files and/or corresponding data directory tree files changes build build. data directory tree our projects content 100 1.1 gb of binary , text files. i see following options: installshield project file, script directory corresponding data directory tree save in subversion repository; installshield project file , script directory save in subversion repository. data directory tree versions save on file server because of large data size; don’t use source control setup projects. i use cvs our installshield setup, don't have anywhere near data do. i keep .ism , setup.rul file in cvs, alongside product source code. the entire tree checked out , copied on network build server. the compile performed, , binary files , installer data files co

java - Building example code using asant -

i'm studying java web services , trying follow oracle tutorial tells me build , deploy example code using asant. i've looked high , low , can't find it. doesn't seem included glassfish more. i'm using glassfish version 3, jdk 1.6. can tell me or how it? thanks in advance. asant shipped glassfish 2 releases. wrapper included number of convenience tasks. as team sun used develop glassfish shrank, 'features' of releases pruned glassfish 3 development work. asant 1 of features. your best bet may follow web services section of java ee 6 tutorial . more up-to-date current state of art.

Is there a cc equivalent to the -Wformat gcc flag? -

my company uses massive makefile uses cc compile, not gcc. use -wformat flag show errors types in printf , sprintf don't match provided arguments. does know similar flag in cc provide functionality? task compiles fine, yet know fact there mismatched types in 100's of places, need find them. i compiling on sun architecture. thanks! complete solaris studio cc , cc documentation available @ http://www.oracle.com/technetwork/server-storage/solarisstudio/documentation/index.html there man pages cc(1) , cc(1) installed on system. http://download.oracle.com/docs/cd/e18659_01/html/821-2676/cc.1.html you might run source code thru lint(1) http://download.oracle.com/docs/cd/e18659_01/html/821-2676/lint.1.html

javascript - Custom trigger event using prototype js not finding current pasted values -

i'm having issue version of prototype in richfaces 3.3.3. the code list below worked fine before upgrading richfaces. event.observe('#{formname}:suggest', 'paste', this.handlemousepaste.bind(this)); // trigger keyup event when user copy , pastes data field. (using mouse paste not work without fix) function handlemousepaste(event) { // element object event occured on var element = event.element(event); // trigger keyup event send ajax request server (event attached in richfaces code) triggerevent(element,'keyup'); } // create custom function allow trigger event anywhere in our javascript code function triggerevent(element,event){ if (document.createeventobject) { // dispatch ie var evt = document.createeventobject(); return element.fireevent('on'+event,evt) }

php - Kohana - Views Within Views -

i have problem passing variables through views. but, first code // enter url http://localhost/my_projects/blog/index/index // classes/controller/index.php class controller_index extends controller { protected $rendered_view; public function before() { $this->rendered_view = view::factory('index') ->set('head', view::factory('subpages/head') ->set('title', 'site title') ) ->set('nav', view::factory('subpages/nav') ->set('title', 'site title') ) ->set('header', view::factory('subpages/header') ->set('h1', 'header h1') ) ->set('sidebar', view::factory('subpages/sidebar') -

beginner question about python -

the following code doesn't perform how expected , can't figure out why. i'm relatively new python , confused. both times display x.attributes they're set 0. shouldn't rollstats() updating them? import random def roll(size): return random.randint(1, size) class lifeform: def __init__(self, name): self.name = name self.attributes = { 'str': 0, 'dex': 0, 'con': 0, 'int': 0, 'wis': 0, 'cha': 0, } def rollattribute(self): # roll 4 6sided di d1 = roll(6) d2 = roll(6) d3 = roll(6) d4 = roll(6) # discard lowest roll if d1 < d2 , d1 < d3 , d1 < d4: total = d2 + d3 + d4 elif d2 < d1 , d2 < d3 , d2 < d4: total = d1 + d3 + d4 elif d3 < d1 , d3 < d2 , d3 < d4: total = d1 + d2 + d4

c# - Strip ALL HTML from a String? -

i've seen regex can remove tags, great, have stuff like &nbsp; etc. this isn't html file. it's string. i'm pulling down data sharepoint web services, gives me html users might use/get generated like <div>hello! please remember clean break room!!! &quot;bob&quote; <br> </div> so, i'm parsing through 100-900 rows 8-20 columns each. take @ html agility pack , it's html parser can use extract innertext html nodes in document. as has been pointed out many times here on so, can't trust html parsing regular expression. there times when might considered appropriate (for extremely limited tasks); in general, html complex , prone irregularity. bad things can happen when try parse html regular expressions . using parser such hap gives more flexibility. (rough) example of might use task: htmlagilitypack.htmldocument doc = new htmlagilitypack.htmldocument(); doc.load("path html document"); stringb

android - Force down error in a calculation app(use if/if else) -

i have created app user places numbers editexts , app making calcs , displays number..i have 7 lines editexts .but 7th editext optional user fill it(i added checkbox , if user select editext visible,else invisible..).i have strange problem code , have help.. firstly code: apostoli.setonclicklistener(new onclicklistener() { private alertdialog show; public void onclick(view arg0) { if ((vprosvasis.gettext().tostring() == " ") || (vprosvasis.gettext().length() == 0) || (vprosvasis2.gettext().tostring() == " ") || (vprosvasis2.gettext().length() == 0) || (vprosvasis3.gettext().tostring() == " ") || (vprosvasis3.gettext().length() == 0) || (vprosvasis4.gettext().tostring() == " ") || (vprosvasis4.gettext().length() == 0)

c++ - OpenGL - mask with multiple textures -

Image
i have implemented masking in opengl according following concept: the mask composed of black , white colors. a foreground texture should visible in white parts of mask. a background texture should visible in black parts of mask. i can make white part or black part work supposed using glblendfunc(), not 2 @ same time, because foreground layer not blends onto mask, onto background layer. is there knows how accomplish in best way? have been searching net , read fragment shaders. way go? this should work: glenable(gl_blend); // use simple blendfunc drawing background glblendfunc(gl_one, gl_zero); // draw entire background without masking drawquad(backgroundtexture); // next, want blendfunc doesn't change color of pixels, // rather replaces framebuffer alpha values values based // on whiteness of mask. in other words, if pixel white in mask, // corresponding framebuffer pixel's alpha set 1. glblendfuncseparate(gl_zero, gl_one, gl_src_color, gl_zero); // &quo

.net - WPF validation adorners - only show if the control has held focus before -

in wpf application, want show validation adorner after control has been edited/entered/focused user. way user given chance provide valid input field , if chose not to, validation display. we want encourage every field completed indicating mandatory fields when form first opens may circumvent user inclined complete need in order rid of big red validation errors may circumvent flow of form. is there way know if control has held focus yet? attached property maybe work? in case helps provide more concrete response: here current validation style displays red border [if control has border] , little exclamation mark tooltip error message (pretty standard really): <style targettype="control"> <style.triggers> <trigger property="validation.haserror" value="true"> <setter property="tooltip" value="{binding relativesource={x:static relativesource.self}, p

php - Custom PDO Class Fails Quietly -

for reason, custom pdo class fails write database. quietly fails - no error message thrown. similar custom pdo class (readpdo) works wonderfully reading database. sql statement generated works fine when it's queried db through phpmyadmin. i've double-checked user permissions, , seems in order. i suspect i'm misunderstanding how works. ideas? // creates write-only pdo, using config settings inc_default.php class writepdo extends pdo{ public function __construct(){ //pull global db settings global $db; global $write_host; global $write_username; global $write_password; try{ parent::__construct("mysql:dbname={$db};host={$write_host}", $write_username, $write_password); } catch (pdoexception $e){ echo 'connection failed: ' . $e->getmessage(); } } } private function updateplayer(){ $conn = new writepdo(); $sql = "update {$this->hvz

perl - Display data from an array of objects -

i'm trying display data array of objects obtained using company's api, getting errors when attempt using foreach loop. i'm using dumper display in array. print dumper($object); partial output dumper: 'enable_dha_thresholds' => 'false', 'members' => [ bless( { 'ipv4addr' => '192.168.1.67', 'name' => 'name.something.com' }, 'something::network::member' ), bless( { 'ipv4addr' => '192.168.1.68', 'name' => 'name.something.com' }, 'something::network::member' ) ], 'comment' => 'this comment', i'm trying extract "members" appears double array: //this works print $members->enable_dha_thresholds(); //this works print $members[0][0]->ipv4addr; //does not work foreach $member ($members[0]){ print "ip". $member->ipv4addr()."\n";

jquery - Get "class" attr from <body> of $.get() object -

i need class attribute body element of page object retrieved $.get(). in example below, fullcontent set object can't select body element... i'd rather not resort text manipulation this $.get(url, refreshfullcontent); var refreshfullcontent = function(response, status, xhr) { fullcontent = response; var bodyclass = $(fullcontent).find("body").attr("class"); $("body").attr("class", bodyclass); } is there way selectors on object (like i'm trying in example)? if not, best way text? xhr.responsetext contains string of entire response. if you're getting full html document response, won't consistent behavior between browsers. some browsers strip away head , body elements. you try this, no guarantees: var fullcontent = '<div>' + response + '</div>'; var bodyclass = $(fullcontent).find("body").attr("class"); $("body").attr("class&quo

CSS: Floating DIV content spilling outside of container when using min-width. Rather have scrollers -

hoping 1 of guys know answer this. i have 2 floating divs , 1 div containers content has min-width. when resize window , window smaller min-width content, content spills out of parent container. i parent container expand accomodate rather have inside min-content spill out , horizontal scrollers @ bottom of browser. anyone know solution? <html> <style> .outer { width:100%; border:2px solid green; position:relative; } .left { float:left; width:20%; max-width:250px; background:red; } .right { float:left; width:80%; background:#eee; } .inner { min-width:620px; border:1px solid blue; } .clear { clear:both; } </style> <div class='outer'> <div class='left'>this inner content page. inn

android - Linking two EditText boxes for unit conversion -

i'm trying come scalable way link 2 edit text boxes unit conversion. user enter value in either of boxes , converted value show in other. i make when 1 edittext edited, input, pass through method convert value , set text of other field. the problem have lot of these pairs , each pair used convert different kind unit. if used textwatcher each box, can see start out of hand. i thought extending textwatcher pass edittext view , partner's view, i'm not sure how pass kind of conversion method needs used. assign int each kind of conversion , use switch, doesn't seem solution me. is there better way? this how it. create class, partneredittextinfo ,which contains reference number , edittext obj. attach tag every edittext in app. set edittext in partneredittextinfo partner edittext , have unique reference number. every edittext can hold of partner. extend edittext class , on ride ontextchanged() method call common conversion method(this can static class st

verify the existence of a folder using the msbuild extension pack? -

how can dependably verify existence of folder using msbuild extension pack task? how without throwing error , stopping build? could use exists condition on target? this execute onlyifexists target if there directory or file called testing in same directory msbuild file. <itemgroup> <testpath include="testing" /> </itemgroup> <target name="onlyifexists" condition="exists(@(testpath))"> <message text="this ran!" importance="high" /> </target>

c# - JSON serialization performance issue on WP7 -

i have .json file approx. 1.5mb in size containing around 1500 json objects want convert domain objects @ start-up of app. currently process on phone (not on development pc) takes around 23 seconds far slow me , forcing me write list of objects applicationsettings dont have each time app loads (just first off), takes 15-odd seconds write to, , 16 seconds read from, of not enough. i have not had lot of serialization experience , dont know fastest way done. currently, using system.runtime.serialization namespace datacontract , datamember approach. any ideas on performance type of data loading? i found json.net library more performant , have better options standard json serializer. one performance issue encountered in app domain objects implemented inotifypropertychanged code support dispatching event ui thread. since deserialization code populated properties doing lot of thread marshalling didn't need there. cutting out notifications during deserialization

Java related Lab/homework questions -

my professor asked me these 2 labs, , finished first 1 not know how second one. write person class contains following fields , methods: first name, last name, unique id number should assigned starting 1001. methods return information , tostring method returns neatly formatted string describing key attributes of person. i finished 1 above. public class person { private string first; private string last; private static int idnumber = 1001; int id; private string full; person(){ first = "john"; last = "doe"; int idnumber; full = first +" "+ last; } person(string fn,string ln){ first = fn; last = ln; id = idnumber++; full = first +" "+ last; } static int getidnumber(){ return idnumber; } void setfirst(string fn) { first = fn; } string getfirst(){ return first; } void setlast(string ln){ last = ln; } string getlast(){ return last; } @override publi

objective c - On iphone: how to show a new window transition from bottom -

i want show new window transition bottom , transition bottom when close,like email app, when write new mail new window transition bottom, close window window transition bottom use presentmodalviewcontroller:animated: method of uiviewcontroller see here

Logging for C# Webservices -

we consuming web services. use wsdl.exe generate client proxy. how keep underlying xml files proxy sends , receives web services provider? the purpose protect ourselves showing did have send parameters in format when system malfunctions , disputes arise. we did using soapextension in application making web service requests. the entire system consisted of 2 classes, copystream class provided ability duplicate contents of stream second stream read / written to, , soaplogger class intercepts soap requests , responses in application , logs them file. you need register in app.config file: <configuration> <system.web> <webservices> <soapextensiontypes> <add type="mynamespace.soaplogger, myassembly" priority="3" group="high" /> </soapextensiontypes> </webservices> </system.web> </configuration> apologies big blob of code, here is: /// <summary>

PHP - AJAX Process HTTP requests -

i have form x number of fields. when submitted, want to; get input data, $var = $_post['input'] validate input, (!empty($var) && is_numeric($var)) stick in array, array_push($myarray, $var) generate urls, $url.=$var process url's without leaving page 1 - 4 done in php simply, im not familiar ajax. been decade since ive touched javascript. im not sure if should using javascript whole process. however, prefer php validate, ajax http requests. sample code/sites available passes php var's/array ajax handle http requests? you'll want use kind of format pass data server client. recommend json . php has a built-in function encode array it, , javascript parses natively. as ajax part itself, recommend using framework jquery. makes way simpler, , don't have deal different browsers yourself. $.ajax({ url: "yourpage.php", success: function(data){ alert(data); } });

cross platform - How to obtain a pointer out of a C++ vtable? -

say have c++ class like: class foo { public: virtual ~foo() {} virtual dosomething() = 0; }; the c++ compiler translates call vtable lookup: foo* foo; // translated c++ to: // foo->vtable->dosomething(foo); foo->dosomething(); suppose writing jit compiler , wanted obtain address of dosomething() function particular instance of class foo, can generate code jumps directly instead of doing table lookup , indirect branch. my questions are: is there standard c++ way (i'm sure answer no, wanted ask sake of completeness). is there remotely compiler-independent way of doing this, library has implemented provides api accessing vtable? i'm open hacks, if work. example, if created own derived class , determine address of dosomething method, assume vtable first (hidden) member of foo , search through vtable until find pointer value. however, don't know way of getting address: if write &derivedfoo::dosomething pointer-to-member, totally diffe