Posts

Showing posts from September, 2015

SAP Web Service from .NET via WCF -

i'm trying consume sap web service .net via wcf. i've generated proxy , have configured app.config file. here test code: webservicesap.ztest_rfcclient mywcfservice = new webservicesap.ztest_rfcclient("myendpoint"); mywcfservice.clientcredentials.username.username = "<username>"; mywcfservice.clientcredentials.username.password = "<password>"; webservicesap.ztestrfc parameter = new webservicesap.ztestrfc(); parameter.testinput = "this simple test"; webservicesap.ztestrfcresponse response = mywcfservice.ztestrfc(parameter); console.writeline(reponse.testoutput); console.readline(); the ztestrfc sap method simple function accepts input string, , outputs: "result: <the input string>" when call ztestrfc method, got null value in variable response. soap messages seem fine. soap request <messagelogtracerecord> <httprequest xmlns="http://schemas.microsoft.com/2004/06/servic

Optimized Line drawing in QT -

i new qt. working on graphics. i using qwidget drawing graphics(for drawing graphics in qwidget paint event). need draw background , foreground graphics. background fixed graphics. foregrounds drawing lines. each 100 millisecond need draw 20points. drawing time 8 sec. total need draw 1600 points (total points represents contentious line). i using qtimer invoke drawing in each 100ms. first few drawing drawn fast. in middle of drawing it's become slow. the problem need draw foreground , background in each 100ms. please me fix problem. if 1 have sample code please provide. in advance. is there way draw partial area ie. particular modified region of graphics? qpainter-drawing can slow without hardware support. using qgraphicsview won't if lines visible, since internally uses qpainter anyway. if have draw 20 new points (or lines) per update , per update background gets cleared have render again, there few things try: 1) disable background autofill. see

java - how can i have a list of icons in my android app; -

can 1 suggest how can have list of icons browser icon,email icon , contacts icon upon clicking on should lead android browser,email , contacts apps respectively...right have done it, upon clicking buttons. want icons(with image , text) instead of buttons... check out: http://developer.android.com/resources/tutorials/views/hello-formstuff.html#custombutton this show had put images want in res/drawable/ , load them buttons in app.

regex - Replacing all non-ASCII characters, except right angle character in C# -

writing file utility strip out non-ascii characters files. have regex: regex rgx = new regex(@"[^\u0000-\u007f]"); which works fine. unfortunatly, i've discovered silly people use right angles (¬) delimiters in files, these stripped out well, need those! i'm pretty new regex, , understand basics, awesome! thanks in advance! you need include code point angle bracket in set: try this: regex rgx = new regex(@"[^\uxxxx\u0000-\u007f]"); or this: regex rgx = new regex(@"[^\uxxxx-\uxxxx\u0000-\u007f]"); (where xxxx unicode code point character want preserve.) the reason giving 2 options here know can specify multiple ranges within 1 negative character group, don't know if can match individual characters ranges.

datetime - str to time in python -

time1 = "2010-04-20 10:07:30" time2 = "2010-04-21 10:07:30" how convert above string time stamp? i need subtract above timestamps time2-time1 . for python 2.5+ from datetime import datetime format = '%y-%m-%d %h:%m:%s' print datetime.strptime(time2, format) - datetime.strptime(time1, format) # 1 day, 0:00:00 edit: python 2.4 import time format = '%y-%m-%d %h:%m:%s' print time.mktime(time.strptime(time2, format)) - time.mktime(time.strptime(time1, format)) # 86400.0

internationalization - Why NHibernate returns multiple results from one database row? -

i have translation engine mapped follows: <class name="core.model.entities.translation, core.model" table="translation" lazy="false"> <id name="id" column="id" type="int64"> <generator class="native" /> </id> <map name="translations" table="translation_value" inverse="true" fetch="join" cascade="all-delete-orphan" lazy="false"> <key column="translation_id" /> <index-many-to-many column="language_id" class="core.model.entities.language, core.model"/> <one-to-many class="core.model.entities.translationvalue, core.model"/> </map> </class> <class name="core.model.entities.translationvalue, core.model" table="translation_value" lazy="false"> <id name="id" column="id" type="int64"&g

oracle - is it possible to regexp_replace using a function? -

i calculations on value in string , replace them. oracles regexp seemes \1 gets evaluated @ end of calcualtions. wondering if fore evaluation before passing function? set serveroutput on declare l_foo varchar2(4000); function f_test(i_t varchar2) return varchar2 begin dbms_output.put_line('given parameter: ' || i_t); return upper(i_t); end; begin l_foo := regexp_replace( 'http://www.scoach.com/${asset_type}/${isin}?eventtarget=${target}andeventvalue=${target_value}' ,'\$\{([[:alpha:]_]+)\}' ,f_test('\1') ); dbms_output.put_line(l_foo); end; gives result like: given parameter: \1 http://www.scoach.com/asset_type/isin?eventtarget=targetandeventvalue=target_value pl/sql procedure completed. it looks passing backreference function within reg ex function not going work (at least in test , lack of finding out there works (although there link hard call reference) but can this, it'll slow-by-slow pro

objective c - Is it possible to change global sound volume in iphone SDK? -

is possible change global sound volume our app in iphone sdk? if yes, how? thanks! the way can throught mpvolumeview. there no such code make louder unless user throught standard component. think reason way not input control when change volume in phisical button displayed in mpvolumeview too.

customizing gtk window title bar -

Image
how can customize gtk window title bar. need add custom buttons, , title bar image. you can't. title bar drawn window manager, not gtk. can tell window manager set title using window.set_title() , , can set icon, may or may not displayed window manager, using window.set_icon() , window.set_icon_name() , or window.set_icon_from_file() . that's it.

c# - Listview Trouble - Tooltip Needed -

i building wpf application in c# using vs2010 i have listview contains items database , , each item contains field called (name) , field called (time) . back in database , each item has third field called (description) ... now want : when choose item listview , tooltip shown , contains data third field .. how can have various tooltips on 1 listview - 1 tooltip each item - ?? how can deal database ?? thank you setting tooltip listviewitem can done this <listview ...> <listview.itemcontainerstyle> <style targettype="{x:type listviewitem}"> <setter property="tooltip" value="{binding path=name}"/> </style> </listview.itemcontainerstyle> <!-- ... --> </listview>

asp.net - validation control -

i've regular expression validation accept aphabets only. not accepting user input data... use re control : <asp:regularexpressionvalidator id="regularexpressionvalidator1" runat="server" errormessage="please input alphabets." controltovalidate="txtinput" validationexpression="^[a-za-z]+$" height="19px" width="165px"></asp:regularexpressionvalidator>

php - populate listbox with table names -

i want populate listbox table names database. here's code i've written doesn't seem work <select id="arrays" name="arrays" style="width: 403px;" class="fieldcell"> <?php $dbname = 'mybase'; if (!mysql_connect('localhost', 'root', '')) { echo 'could not connect mysql'; exit; } $sql = "show tables $dbname"; $result = mysql_query($sql); if (!$result) { echo "db error, not list tables\n"; echo 'mysql error: ' . mysql_error(); exit; } $num_tables = mysql_num_rows($result); for($i=0;$i<$num_tables;$i++) { echo "<option value=\"$row[i]\">$row[i]</option>"; } /*while ($row = mysql_fetch_row($result)) { echo <option value=\"$row[0]\">$row[0]</option>"; }*/ mysql_free_result($result); ?> </select> the commented out section section make work. using loop

xml - Validate a webpage against its doctype (dtd) within a Canoo Webtest step using a Groovy script -

how can validate webpage against doctype (dtd) within canoo webtest step groovy? actually know answer. took me while working, thought i'd share solution. it's webtest macro. can use sequential if like... <macrodef name="verifyschema" description="validate current document against schema"> <sequential> <groovy description="validate schema" > import javax.xml.parsers.parserconfigurationexception import javax.xml.parsers.saxparser import javax.xml.parsers.saxparserfactory import java.io.inputstreamreader import org.xml.sax.errorhandler import org.xml.sax.inputsource import org.xml.sax.saxexception import org.xml.sax.saxparseexception import org.xml.sax.xmlreader class myhandler implements org.xml.sax.errorhandler { void warning(saxparseexception e) throws saxexception { println 'warning: ' + e.get

word-database integration in Rational RequistePro -

how integrate word document rational requistepro. if have document 50 requirements , want put word document in reqpro, generate 50 requirements.if does, how can that. thanks. it's quite easy d using "import document" feature of requisitepro. allows import requirements using mix of 3 kinds of parsing: delimiters: requirements delimited 2 strings in document, example: [[this requirement]]. "[[" , "]]" delimiters. keywords: requirements have keyword identifies them requirements. common practice use keywords "shall" (the system shall...) in requirements definition. option allows find requirement providing keywords use. word styles: if document uses specific style identify requirements can tell reqisitepro use style find requirements. to import document go file > import.. choose word document , follow wizard. able either import requirements , document or requirements (or document, i'm clear that's not yo

jquery ui - cant seem to drag my draggables onto an empty sortable li -

i have list call #gallery in i've defined couple of li boxes. e.g. <ul id="gallery"> <li style="display: list-item; ui-draggable">a</li> </li> and box drop them ... <div id="conditions-box" class="ui-droppable"> <ul class="gallery ui-helper-reset ui-sortable"></ul> </div> with following js $('#conditions-box > ul').sortable(); $("#gallery > li").draggable({ connecttosortable: '#conditions-box > ul', helper: 'clone' }); when conditions box list empty see can drag boxes in dont "stick" when place existing li conditions box code work. dont want have this. if want play can see below. ideas ? ref - http://jsfiddle.net/wmitchell/zcde7/2/ i think need set height conditions-box sortable. can use css like: #conditions-box { height: 40px; }

Why jquery defined two methods for the same purpose? size and length -

after reading this se discussion question pops up. why jquery defined 2 methods same purpose? there purpose missed? don't know belongs wiki discussion. if please guide me change so. i guess didn't think through, unless perhaps earliest versions had reason. find source 1.2.6 , , unchanged current version . edit: it seems have been unchanged since version 1.0.1. the documentation .size() suggests should not used. you should use .length property instead, faster.

iphone - How to search thru Core Data entities and delete certain objects -

i'm unclear how remove objects core data database. think i've got working can find objects, don't know how delete them core data. in example i'm searching entity news items have expired. use 'expires' property (an int 32 unix time stamp) , see if number less current unix time stamp. not sure if nspredicate right in this. nsfetchrequest *request = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"news" inmanagedobjectcontext:self.managedobjectcontext]; [request setentity:entity]; // set predicate here? nspredicate *pred = [nspredicate predicatewithformat:@"expires < %i", dateint]; // dateint unix time stamp current time [request setpredicate:predicate]; nssortdescriptor *sortdescriptor = [[nssortdescriptor alloc] initwithkey:@"forename" ascending:yes]; nsarray *sortdescriptors = [[nsarray alloc] initwithobjects:sortdescriptor, nil]; [request setsortdescriptors:sortdescriptor

user interface - How to update the image in the image button at refreshing the page in android? -

is possibility update image in imagebutton or imageview @ time of refreshing page in android. thanks in advance i'm not sure, understood question right, can use in application's onresume method setimageresource, setimagedrawable or setimagebitmap

c++ - What does *& mean in a function parameter -

if have function takes int *& , means? how can pass int or pointer int function? function(int *& mynumber); whenever try pass pointer function says: error: no matching function call 'function(int *)' note: candidate 'function(int *&)' it's reference pointer int. means function in question can modify pointer int itself. you can pass pointer in, 1 complication being pointer needs l-value, not r-value, example int myint; function(&myint); alone isn't sufficient , neither 0/null allowable, as: int myint; int *myintptr = &myint; function(myintptr); would acceptable. when function returns it's quite possible myintptr no longer point pointing to. int *myintptr = null; function(myintptr); might make sense if function expecting allocate memory when given null pointer. check documentation provided function (or read source!) see how pointer expected used.

asp.net - Do web.config's globalization settings affect non-http requests? -

in asp.net application set <system.web><globalization culture="pl-pl" uiculture="pl-pl" /> to have numbers , dates in culture. surprisingly noticed methods invoked job scheduler (quartz library) use en-us? why that? web.config globalization relatively simple - sets thread locale when request being processed. seem invoking methods non-asp.net thread, using quartz.net scheduler. invoker has set thread locale before calling methods, in job code, set locale manually, call methods need, so: thread.currentthread.currentculture = new cultureinfo("pl-pl"); thread.currentthread.currentuiculture = new cultureinfo("pl-pl");

c# - Replacing obsolete VisualBasic.Compatibility.VB6.Support -

we have upgraded old vb6 windows app c# .net 4.0. looking replace references microsoft.visualbasic.compatibility.vb6.support class, visual basic 2010 warning me 'microsoft.visualbasic.compatibility.* classes obsolete , supported within 32 bit processes only. http://go.microsoft.com/fwlink/?linkid=160862 ' this article assures me that: 'functions in compatibility namespaces created work around shortcomings in version 1.0 of .net framework. in cases, functionality added in later framework versions can used rewrite functions, resulting in improved performance.' my question is, additions later framework versions need use away compatibility.* classes? need phase out twipstopixelx, twipstopixely, , forth. also, fontchangeunderline, fontchangesize, , other font-related stuff. the font related functions can replaced enough. example: function fontchangebold(f font, bold boolean) font dim alreadyset = (f.style , fontstyle.bold) = fontstyle.bold if

.net - TFS 2010 Build Agent DLL References outside branch -

we've got project in source control: $/project/trunk/project.sln most of projects live under trunk $/project/trunk/website $/project/trunk/bll etc. the problem is, reference dlls stored in $/project/common when try build using build agent, error saying can't find dlls in $/common folder. i've run vs on build agent machine , done latest on $/project/common folder. i've done latest on $/project/ , managed build myself on build agent machine without issue. how can convince build agent in $/project/common folder (or maps d:\source\project\common ) during builds? whilst highlight fact dll references should point below branch, we're not going able change structure month or due business requirements (it works @ moment, automated builds nice not critical, getting upcoming releases out is critical) suggestions appreciated. use workspaces in build definition change project/common folder getting mapped to. want change verbosity of build log (fo

command line - How do you write comments in doskey macro files? -

i have inherited beautiful mess of doskey macros, , trying sort them areas of concern. far haven't been able find references mention comments in way, seems such common scenario i'd surprised if not supported in way.. is there support comments in doskey macro files? or have other suggestions on how achieve similar goal? this page has example of workaround comments in doskey. this involves using ;= pseudo-comment e.g. ;= file listing enhancements ls=dir /x $* l=dir /x $* ll=dir /w $* la=dir /x /a $*

java - Persisting time ojects as entities instead of value types? -

i'm using joda time datetime handle date , time. persist objects of kind using class persistentdatetime bundled in jodatime hibernate code . i have large collections of datetime objects, , persist them in following way (an excerpt of hibernate mapping file follows): <set name="validinstants" sort="natural"> <key column="myobject_id"/> <element column="date" type="myproject.utilities.hibernate.types.persistentdatetime"/> </set> doing so, i.e. storing datetimes value types , many duplicate elements in table validinstants, hundreds of thousands of them. i'd avoid , have in validinstants table datetimes needed, stored once per value . how can achieve this? as far know (i'm , hibernate beginner) way achieve creating class wraps datetime , maps entity, plus creating factory returns same datetime-wrapper when asking same date. best way want? suggestions? what relationship b

c# - Ways to kill a running program and how to trap them? -

we have different ways kill running c# program. ctrl + c; task bar right click icon, select 'close' on popup; task manager, select executable name , click end process; console window, use kill command; maybe more. what asking here how handle them in c# program guarantee c# program exit gracefully when possible. know how trap ctrl + c, don't others. can me? thanks, the best guarantee have @ code being run @ exit statement. note though program have run in try block when use mechanism. i believe time block inside finally not executed at: a stackoverflowexception ; corrupted state exceptions (from .net 4); forceful termination through task manager (an unmanaged process kill); crash of entire system (removing power cable e.g.). see keep code running reliability features of .net framework in depth analysis.

mobile website - QR code with URL, does it *REALLY* need the http://? -

it seems (if not all) qr readers on iphone handle urls without http:// fine wondering if universal? android? blackberry? there rfc somewhere should reading i'm building qr management/url shortener system , wondering if absolutely necessary. if not, can drop 7 characters qr's urls , make them lowest level of complexity (16 characters or less). which, i've read, thing™. i haven't found absolute documentation says must have it. but... after testing number of qr reader apps, it's clear many of them 'guess' @ url if there no http:// in it. many not , display string. since it's url, need it. , if apps won't read it, have bow them , add of them.

sql server - SQL 2000 query trouble -

consider following table create table sample(id, name, numeric, qno, ans1,ans2,ans3) sample data 1, 'vivek', 1, 'a', 'b', '' 2, 'vivek', 1, 'c', 'd', '' 3, 'vivek', 2, 'e', 'f', 'g' 4, 'vivek', 3, 'h', 'i', 'j' 5, 'vijay', 1, 'k', '', 'l' 6, 'vijay', 2, 'm', '', 'n' 7, 'vijay', 2, 'o', '', 'p' 8, 'vikram', 3, 'q', 'r', 's' output expected column names: name, info1, info2, info3 values 'vivek','ab','ef','hij' 'vivek','cd','','' 'vijay','kl', 'mn','' 'vijay','','op','' 'vikram','','','qrs' converting rows columns. in other words. 1 answer have 1 row. there can

c++ - Howto initialize a reference to an object if reference is a class member? -

let's class contains reference called matrix_ : class.h class class { matrix& matrix_; } class.cpp class::class() : matrix_(matrix()) { } i error: invalid initialization of non-const reference of type ‘matrix&’ temporary of type ‘matrix’. i see problem temporary object disappear , reference point null. how can create persistent object reference? want use reference because member should constant. class::class() : matrix_(matrix()) tries set reference point temporary object, illegal. well, there's case const references , temporary binding, seriously, don't go there. looks need use aggregation: class class { const matrix matrix_; }; and initializer list: class::class() : matrix_() /* or params constructor if need them */ { }

graphics - Draw lines on a picturebox using mouse clicks in C# -

i'm trying make program draw lines on picturebox using mouse clicks locations of line drawn , to. current code: public partial class form1 : form { int drawshape; private point p1, p2; list<point> p1list = new list<point>(); list<point> p2list = new list<point>(); public form1() { initializecomponent(); picturebox1.image = new bitmap(picturebox1.width, picturebox1.height); } private void button1_click(object sender, eventargs e) { drawshape = 1; } private void button2_click(object sender, eventargs e) { drawshape = 2; } private void picturebox1_mousedown(object sender, mouseeventargs e) { if (drawshape == 1) { if (p1.x == 0) { p1.x = e.x; p1.y = e.y; } else { p2.x = e.x; p2.y = e.y; p1list.add(p1);

python - PIL: Create one-dimensional histogram of image color lightness? -

i've been working on script, , need basically: make image greyscale (or bitonal, play both see 1 works better). process each individual column , create net intensity value each column. spit results ordered list. there easy way imagemagick (although need few linux utilities process output text), i'm not seeing how python , pil. here's have far: from pil import image image_file = 'test.tiff' image = image.open(image_file).convert('l') histo = image.histogram() histo_string = '' in histo: histo_string += str(i) + "\n" print(histo_string) this outputs (i looking graph results), looks nothing imagemagick output. i'm using detect seam , content of scanned book. thanks helps! i've got (nasty-looking) solution works, now: from pil import image import numpy def smoothlistgaussian(list,degree=5): window=degree*2-1 weight=numpy.array([1.0]*window) weightgauss=[] in range(window): i=i-degree+1

c# - Vertical ListView display -

im tryingh create list view im having issues designing how want it, know windows presentation foundation (wpf) im studying c# , language im tackling more difficult prospective. i assume view.list way go small tinker ownerdraw , ondraw still seem having issues what im building in youtube browser , desired layout so: --------------------------------------------- - ----- ----------------------------------- - - | | | title here - - ----- ----------------------------------- - - ----- ----------------------------------- - - | | | title here - - ----- ----------------------------------- - - ----- ----------------------------------- - - | | | title here - - ----- ----------------------------------- - - ----------------------------------------- - looking @ above layout can see need there's 1 row per line, main issue cant around, i image, , text right would. can me figure out settings or code need make sorting, blocking

xna - Collision detection - minor problem -

at minute, removes 1 or 2 asteroids, not appear on screen, think there's flaw in method, i'm not sure what... public void collisiondetection() { (int = 0; < ship.bullets.count; i++) { rectangle shiprectangle = new rectangle((int)ship.shipposition.x, (int)ship.shipposition.y, shiptexture.width, shiptexture.height); (j = 0; j < asteroidpositions.count; j++) { asteroidrectangle = new rectangle((int)asteroidpositions[j].x, (int)asteroidpositions[j].y, asteroidtexture.width, asteroidtexture.height); vector2 position1 = asteroidpositions[j]; vector2 position2 = ship.bullets[i]; float cathetus1 = math.abs(position1.x - position2.x); float cathetus2 = math.abs(position1.y - position2.y); cathetus1 *= cathetus1; cathetus2 *= cathetus2;

c# - How do I map a derived property on a base class using NHibernate? -

i'm having trouble mapping. let's have 3 assessments derive off base assessment : public abstract class assessment { public abstract int damagecosttotal { get; set; } } public class individualassessment { public virtual int damagecosthouse { get; set; } public virtual int damagecostcar { get; set; } public virtual int damagecostbelongings { get; set; } public override damagecosttotal { { return damagecosthouse + damagecostcar + damagecostbelongings; } } } public class businessassessment { public virtual int damagecostbuilding { get; set; } public virtual int damagecostgoods { get; set; } public virtual int damagecostother { get; set; } public override damagecosttotal { { return damagecostbuilding + damagecostgoods + damagecostother; } } } public class infrastructureassessment { public virtual int damagecoststructure { get; set; } public virtual int damagecostestimatedrepair { get; set; } pu

java - How do I convert a RelativeLayout with an Imageview and TextView to a PNG image? -

in android app activity, have relativelayout 1 imageview , couple of textviews being populated @ runtime. have save button in activity use save image in imageview device sd card. want convert elements (image , text in relativelayout) png image when save button clicked , save sd card. have tried conversion before? helpful if can give me hints or code snippets on how go doing this? the save functionality works fine saves image in imageview. thanks in advance. relativelayout subclass of view , , following should work view: final view v; // view want save image bitmap bitmap = bitmap.createbitmap(v.getwidth(), v.getheight(), bitmap.config.argb_8888); canvas c = new canvas(bitmap); v.draw(c); file outputfile; // save fileoutputstream out = new fileoutputstream(imagefile); boolean success = bitmap.compress(compressformat.png, 100, out); out.close(); add exception handling @ leisure. ;)

javascript - Is it wrong to put ID's on DOM elements for automation because it would turn their CSS classes into singletons? -

i'm wondering correct way go automation (like selenium) is. told shouldn't put id's on elements, because can lead js errors (if duplicate id's exists) , can cause elements css classes become singletons. agree this, not having ids can make automation pain in rear. thoughts? you got pretty bad advice. the "id" , "class" namespaces distinct. give page elements ( unique ) "id" values when need find them efficiently , reliably. (what mean "automation", way, not entirely clear.)

gen tcp - Erlang missing messages -

i'm running following code dbg:p(client, r) : -module(client). -export([start/0, start/2, send/1, net_client/1]). start() -> start("localhost", 7000). start(host, port) -> io:format("client connecting ~p:~p.~n", [host, port]), register(ui, spawn(fun() -> gui_control([]) end)), case gen_tcp:connect(host, port, [binary, {packet, 0}]) of {ok, socket} -> pid = spawn(client, net_client, [socket]), register(client, pid), gen_tcp:controlling_process(socket, pid); error -> io:format("error connecting server: ~p~n", [error]), erlang:error("could not connect server.") end, ok. send(msg) -> client!{send, msg}. %% forwards messages either gui controller or server. net_client(socket) -> receive {tcp, socket, message} -> msg = binary_to_term(message), io:format("received tcp mess

How to start a project -

just wondering how start project concept,specs,dev etc. in development start database design? or maybe theres resource know can at. starting database design big pet peeve of mine. sure, it's fine projects. simple forms-over-data apps, stuff that. more complex, has "domain" of logic, not start database design. start domain modeling. if you're taking business logic , putting in code, it's highly business users define logic flow not think in terms of sql or relational data @ rest. think in terms of logical interactions of concrete , abstract concepts. as eric s. raymond said, "smart data structures , dumb code works better other way around." usually, when 1 starts database design, 1 creates flat "dumb" data structure. not dumb in sense it's bad design, in sense has no built-in logic. it's flat , dimensionless. of intelligence need go code uses it. a rich domain model, on other hand, incorporates business logic ,

c++ - BitBlt draws a blank image -

i'm using mfc, , i'm trying draw image screen. i've got following ondraw function: void cgraphicstestview::ondraw(cdc* pdc) { cgraphicstestdoc* pdoc = getdocument(); assert_valid(pdoc); if (!pdoc) return; m_bitmap.loadbitmap(idb_wall); // m_bitmap cbitmap member of cgraphicstestview // idb_wall .png resource cdc dcmemory; dcmemory.createcompatibledc(pdc); dcmemory.selectobject(&m_bitmap); pdc->bitblt(10, 10, 32, 32, &dcmemory, 0, 0, srccopy); } this draw screen, destination area blank. bitblt working, since changing srccopy blackness draws black rectangle. see i'm missing? i have guess problem image somehow invalid. because tested , works fine. loadbitmap returns hbitmap, test this: hbitmap hresult = m_bitmap.loadbitmap(idb_wall); assert(hresult);

html - search button display unnormal -

http://run.xxmn.com/new/ the search button on top of site displays unnormal under ie8,chrome, lower search textbox. want top of search button can parallel search textbox . it's ok in ie7,6 , firefox. why? how alter it.thankyou apply float: left search input , button. i'm not sure if solve problem entirely because can't test in ie right now.

message passing - Memory allocation in MPI programs -

how memory allocated in slave nodes execution of mpi programs ? how slave nodes know amount of memory reserve ? happens when slave node can't find data wants access ? this not homework problem , question tried came in mind , could'nt find on googling with non-specific question, best answer can expect non-specific when programming using mpi typically write single program launched (via mpirun/mpiexec, or batching system eg. torque) on set of notes. the master-slave model 1 approach. the memory allocation typically under program control, in application allocate memory needed, in mpi program. as finding data, provided them (directly or indirectly) (by master process, if master-slave model used). if indeed each mpi instance has "search" data processing, program unable find requires, should send suitable error message/status caller (or master process) .pmcd.

Distributing Programs Written in Python -

possible duplicate: distributing python programs i have several source codes gui programs made in python. i'd distribute them. however, i'd make easy possible end user program , running. common way's of going problem? this in reference windows xp , on. all noteworthy linux distributions , mac os come shipped version of python. windows don't have python installed default, must install seperately in order run python module. of course installed python version must same program (version 2 or 3). the easiest way distribute program distribute source code (e.g. send module email or upload somewhere) in case, target pc must have python installed and meet dependencies. better solution (at least community) upload program package on pypi . more info procedure can found here . in cases there reasons prevent using these options. example can't install python and/or dependencies (no root/admin account). if case, can bundle module(s) along else requ

java - How can I bind a spring-injected dependency to a wicket page? -

how can bind particular dependency page, , have injected components on page? i have set environment in wicket application, using (very small) wicket-ioc , wicket-spring libraries, can call injectorholder.getinjector().inject(component), in order inject component dependencies. of wicket components injected spring via icomponentinstantiationlistener, , part works (i use hibernate access). i have serializable object (componentgraph) want store field on page. how can spring figure out page component on, , inject right componentgraph page when componentgraph field @springbean declared? if point me in right direction, appreciate it. have solid grasp of wicket, spring still maze of unfamiliar concepts me, @ point. =) this not sound job spring. however, don't know scope of componentgraph, have make guesses. a) if there 1 per user, store in custom session object . b) if there 1 per page instance, make base page class such pages inherit. let have componentgraph fiel

oop - How to write elegant perl code without ref -

help me code scenario better. let's have baseclass named "car", , 2 derived classes named "ferrari" , "chevrolet". have new class named "parkinglot", should know car operating on, customize lot-size , other attributes. now problem. current codebase iam working on matured, , it's complete written in perl oops. "parkinglot" constructor passed car object (instantiated before this) argument. code(parking lot) uses argument, ref on object pointer find whether class "ferrari"/"chevrolet" , specific operations based on car type. example, "tip of iceberg" , these kind of code littered everywhere throughout code making more unmaintainable. tommorow, if want add new car, parking lot should support, it's becomes nightmare check references through code , changes manually. rework code make more elegant , maintainable? as first comment on question alluded to, want here polymorphism. let ca

grails - ease of scaling mongodb vs mysql -

i creating grails application backend mobile application. deployed on amazon ec2. persists data mysql database. 1 instance pointing database. plan deploy multiple instances of app behind load balancer , have read requests go slave instances of db. plan release in coming months , have beta group of couple of thousand users. more read intensive write. we have looked using mongodb instead of sql , see solution. not having lot of experience scaling mysql ( or mongodb ) easier scale mongodb since has features such auto sharding. ( looking thoughts people have done both ) of thinking easier switch mongodb rather in 'production' , having migrate. thoughts? mongodb has 2 versions of "scaling": read scaling via replica sets . write scaling via sharding . they're not silver bullets, they're both easy set up. replica sets have auto-failover practically essential when using ec2 (they have history of randomly failing nodes). when need write sc

java - Modify Settings system app -

more want edit settings.apk , add more options. i'm unsure best approach is. know how convert classes.dex .jar, doesn't seem way go accomplishing anything. @ rate, i'm looking insight , advanced editing such this. knows how to, care share? good thing source stock settings.apk available: https://android.googlesource.com/platform/packages/apps/settings

syntax - php {$var} meaning -

hello, what meaning of {$var} in php? example: $query = "update table set field = '{$var}'"; thx. {$var} "shields" variable name surrounding characters. example: $root = "stick"; echo "{$root}y"; # adjectify! will output "sticky", where: $root = "stick"; echo "$rooty"; # adjectify! no, kidding. will output nothing @ all, since variable $rooty doesn't exist. it allows use expressions more variable names, array indexing or property access.

c# - What vector graphics libraries are available in ActionScript and/or .NET...? -

i'm looking build website has flash interface , allows visitors upload vector art in number of file formats such svg, eps , ai. i have 2 rather large problems... 1) need load original vector art, convert flv , display in flash application. 2) after user potentially loads number of images, adds text, rotates or transforms elements, need save resulting composition vector art format can print. i'm not of developer...my experience in .net/c# & c++. i'm looking library or api provides functionality need convert different image formats , save results. how of can done using flash / as...? how in c#...? i've used libspark svgparser before generate mxml svg , similar fxgparser create animation vector file. the svgparser should come handy, have @ svgeditor . hth

css - Simple two color gradient-like effect without image? -

i'd create simple visual effect display of rows of data on iphone/android/etc, seen in this example . the effect simple; it's 2 rectangles on top of each other, top 1 lighter bottom 1 , lighter-yet border-top. it: <style> .rowtop { background-color: #333; border-top: 1px solid #ccc; height: 25px; } .rowbottom { background-color: #000; height: 25px; } </style> <div class="row"> <div class="rowtop">&nbsp;</div> <div class="rowbottom">&nbsp;</div> </div> now i'd able place text , labels on top of this, again seen in the example . that's need help. i'd place text relative "row", row made of 2 divs, it's complicated. text has live on top of "rowtop" , "rowbottom" divs. i tried messing around third div labels , setting z-index couldn't wanted. i think can use background image instead of rowtop , rowbottom , make easy on myself, won

c# - Dynamic gridview based on dropdown -

i've got bit of chicken , egg. i need bind gridview set of database values. gridview dynamic , columns, cells created @ run time. as such, need re-bind grid on every postback in pre-init, init events after post back. however, data used populate grid uses value dropdown box on same page. such, value of dropdown not accessible through viewstate until after init event (i.e. selected index first item in list until after on init). how can access value of drop down in time rebind grid before pageload event? if gridview has same number of columns, have dynamic query generate column names aliases, , rebind gridview on dropdown change?

performance - How does Stack Exchange generate load new pages so fast? -

look @ profile pages of users have asked more 10 questions. (e.g., https://webapps.stackexchange.com/users/2496/tobeannounced ) now try skipping questions 10-20, or page 2 of questions have asked. the load new page instantaneous. how accomplished? simply loading questions when first page loaded additional pages called load fast? in other words, additional pages pre-loaded? using network tab of firebug firefox, can see http requests being made. turned on can see clicking next link fires off http request grabs next page of questions (i.e. not preloading questions initial page load). it's small request, small response, , server replies really quickly, why happens instantaneously.

php - Random values in MySql query with pagination -

i have advanced search on web page, how works follows. when search made, random results appear on content page, page included pagination, problem everytime visitor goes 1st page different results appear. possible use pagination this, or ordring random. i'm using query select * table order rand() limit 0,20; you should use seed mysql rand consistent results. in php $paginationrandseed = $_get['paginationrandseed']? ( (int) $_get['paginationrandseed'] ): rand() ; and in mysql use seed "select * table order rand(".$paginationrandseed.") limit 0,20" of course you'll need propagate initial seed in page requests. good luck, alin

c# - MembershipUser class - Comments method doesn't work? -

i'm unable set comments property of membershipuser type objects. e.g. membershipuser mu = membership.getuser(username); mu.comment = "somecomments"; i'd expect set comment property of mu object "somecomments" , write changes database. later, following check: mu.comment == "somecomments"; comment property set null. there anythign need change in web.config or...? thank you call membership.updateuser(mu)

ios4 - Getting general information from iPhone -

i fetch data "phone", "sms" , "mail" app on iphone. want fetch last call made number/person, last sms , last email send/recieved. is possible, , mean possible on "allowed apple" manor. best regards, paul peelen sorry, isn't possible using public apis. if did want use private functions (which cause app store rejection), check out of private stuff in core telephony: http://code.google.com/p/iphone-wireless/wiki/coretelephonyfunctions

tfs2010 - Unable to add Project to TFS 2010 collection from Visual Studio 2008 -

i have windows 7 64 bit computer i have following: visual studio 2008 professional: install team explorer 2008 install sp visual studio 2008 update team explorer 2008 sp1 forward compatibility update but didn't work. you need vs 2010 (or team explorer 2010) create new team projects in tfs 2010. see creating new tfs 2010 project vs 2008 previous question on this.

sdk - iPhone "Move and scale"... and rotate? -

i trying find way make way users adjust images app. tried default "move , scale" doesn't seem support rotation. want making users move, scale, , rotate picture fit in overlay/silhouette. should do? refer code erica sadun - https://github.com/erica/iphone-3.0-cookbook-/tree/master/c08-gestures/14-resize%20and%20rotate/

php - Unexpected observation: var_dump() of an array is flagging referenced elements... since when? -

i've been running simple debug tests against arrays, , noticed when var_dump() of array, output flagging element in array referenced variable. simple experiment, ran following code: $array = range(1,4); var_dump($array); echo '<br />'; foreach($array &$value) { } var_dump($array); echo '<br />'; $value2 = &$array[1]; var_dump($array); echo '<br />'; which gives following output: array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) } array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> ∫(4) } array(4) { [0]=> int(1) [1]=> ∫(2) [2]=> int(3) [3]=> ∫(4) } note ∫ symbol alongside element 3 , subsequently element 1. note entries don't show entry's datatype. following experimentation, don't see if var_dump scalar type, or objects or resources. if array contains string data, symbol & (and still show datatype), likewise float, boolean , object entries. t

html - serving lots of small images as one file -

simple. when html page contains lot of small images take time have rendered, since each file needs requested separately. example, if have 500 32x32 avatar images want display, browser needs 500 requests 500 headers resulting in 500 responses headers. thus, lot of traffic. reduce amount of traffic, think better send files single request/response , have client script splitting of file separate images, placed wherever needed. thus, browser executes script, script requests image package, server returns package , script put images in it's proper locations. thus, 1 request/response instead of 500 requests/responses. has similar been created already? if so, whom? it called css-sprites, have big image images in grid pattern , css rules 1 want. check http://spritegen.website-performance.org/ http://csssprites.com/

jsp - Prevent user from seeing previously visited secured page after logout -

i have requirement end user should not able go restricted page after logout/sign out. end user able browser button, visiting browser history or re-entering url in browser's address bar. basically, want end user should not able access restricted page in way after sign out. how can achieve best? can disable button javascript? you can , should not disable browser button or history. that's bad user experience. there javascript hacks, not reliable , not work when client has js disabled. your concrete problem requested page been loaded browser cache instead of straight server. harmless, indeed confusing enduser, because s/he incorrectly thinks it's coming server. you need instruct browser not cache all restricted jsp pages (and not logout page/action itself!). way browser forced request page server instead of cache , hence login checks on server executed. can using filter sets necessary response headers in dofilter() method: @webfilter public class noca

c# - MVC 2 - Passing enum to CheckBoxFor -

let's assume have model: public class document { public string name { get; set;} public list<dayofweek> weekdays { get; set; } } is possible render checkboxes represent days of week model? i've searched internet did not find solution. i mean works whith checkboxfor(model=> model.someproperty) not work if someproperty list<dayofweek> . dayofweek here enumeration. thanks in advance. you can enumerate on values of enum , manually create checkboxes. using same name each checkbox submit them array in actionmethod. <% foreach(var value in enum.getvalues(typeof(dayofweek))) { %> <% var name = enum.getname(typeof(dayofweek), value); %> <label for="dayofweek<%=value %>"><%=name %></label> <input type="checkbox" id="dayofweek<%=value %>" name="dayofweek" value="<%=value %>" /> <% } %> your action method like:

c++ - Undefined behavior and sequence points -

what "sequence points"? what relation between undefined behaviour , sequence points? i use funny , convoluted expressions a[++i] = i; , make myself feel better. why should stop using them? if you've read this, sure visit follow-up question undefined behavior , sequence points reloaded . (note: meant entry stack overflow's c++ faq . if want critique idea of providing faq in form, the posting on meta started this place that. answers question monitored in c++ chatroom , faq idea started out in first place, answer read came idea.) c++98 , c++03 this answer older versions of c++ standard. c++11 , c++14 versions of standard not formally contain 'sequence points'; operations 'sequenced before' or 'unsequenced' or 'indeterminately sequenced' instead. net effect same, terminology different. disclaimer : okay. answer bit long. have patience while reading it. if know these things, reading them again won't make