Posts

Showing posts from August, 2010

.net - SDK for writing DVD's -

i need add dvd writing functionality application i'm working on. needs able write out files being grabbed "live" camera, on long period of time. can't wait until files captured before start writing them dvd, need write them out in chunks go along. i've looked @ imapi v2 , main problems seems need point files plan write out disk before start burning process. know has concept of "sessions", means can write dvd in several parts, before "close" it. but wondering if there other dvd writing sdk's allow writing files dvd , in particular files in memory. more efficient if didn't have write captured images out hard before burned dvd. the solution needs work under .net on windows xp , vista the primo burning engine .net works nicely.

Is there a keyboard shortcut for "Build Page" in Visual Studio 2005? -

"build page" 1 of items can add toolbar compile aspx page or ascx control working on. there keyboard shortcut it? i use ctrl + shift + b , rebuilds entire solution. you configure own keyboard shortcut clicking tools / options / keyboard , scrolling down build options. (there's ones build.buildpage or build.buildselection...)

asp.net - Enforce SSL in code in an ashx handler -

i have site, contains several ashx handlers, on couple of handlers want reject non-ssl requests. there way can in code? if must programmatically, way i've done in past inspect url , "https" in it. redirect if don't see that. request.issecureconnection should preferred method, however. may have add additional logic handle loopback address.

windows - Subversion Client-Side application -

which standalone windows gui application recommend use accessing subversion repository? edit: lot of people mentioning tortoise, looking application not shell extension. people questioning reasoning behind not wanting use shell extension. in our environment rather interact repository (when not using ide plugin) through management application , not navigate files through windows explorer. standalone clients for total stand alone synchro svn powerful , cross platform solution. looks native application on each of platforms. the subversion website includes listing of other standalone svn clients (most cross platform). [copied list below http://subversion.tigris.org/links.html#clients] esvn - cross-platform qt-based gui frontend subversion http://sourceforge.net/projects/esvn fsvs - fast subversion command-line client centered around software deployment http://fsvs.tigris.org/ kdesvn - subversion client kde http://www.alwins-world.de/wiki/programs/kdesvn ...

profiling - How to turn off flash protection against long executing scripts? -

i profiling code measuring wall clock time. in order minimize error need run code long period of time. however, flash seems protect unresponsive scripts throwing exception after period of unresponsiveness, namely: error #1502: script has executed longer default timeout period of 15 seconds. is there way disable protection, or @ least extend timeout period? if publishing adobe flash cs/4/5 etc. goto publish settings. select "flash" @ bottom of screen there textbox says "script timeout" know can increase this, think limit 90seconds though can enter value here.

.net - XMLSerialization in C# -

i have simple type explicitly implemets interface. public interface imessageheader { string fromaddress { get; set; } string toaddress { get; set; } } [serializable] public class messageheader:imessageheader { private string from; private string to; [xmlattribute("from")] string imessageheade.fromaddress { { return this.from;} set { this.from = value;} } [xmlattribute("to")] string imessageheade.toaddress { { return this.to;} set { this.to = value;} } } is there way serialize , deserialize objects of type imessageheader?? i got following error when tried "cannot serialize interface imessageheader" you cannot serialize imessageheader because can't activator.createinstance(typeof(imessageheader)) serialization going under covers. need concrete type. you can typeof(messageheader) or say, have instance of messageheader , xmlserializer serializer = new xmlserializer(instance.gettype()) ...

Listview background drawing problem C# Winform -

i have little problem listview. i can load listview items fine, when set background color doesn't draw color way left side of row [the listviewitems loaded listviewsubitems make grid view, first column shows error]. there a narrow strip doesn't paint. width of strip approximately same row header if had row header. if have thought on can done make background draw i'd love hear it. now try new idea, i'm offering ten vote bounty first solution still has me using awful construct of mess of pseudo grid view. [i love legacy code.] edit: here sample exhibits problem. public partial class form1 : form { public form1() { initializecomponent(); listview lv = new listview(); lv.dock = system.windows.forms.dockstyle.fill; lv.fullrowselect = true; lv.gridlines = true; lv.hideselection = false; lv.location = new system.drawing.point(0, 0); lv.tabindex = 0; lv.view = system.windows.f...

Apache LocationMatch regex with subdomain -

i'm trying use locationmatch match url in website's second-level subdomain not in it's third-level subdomain. because want password protect urls @ level. eg. level2.domain.com/some/url should match not level3.level2.domain.com/some/url than apply necessary directives password protect urls. does locationmatch match part or url ? don't think so, , if that's case, use achieve desired effect ? i think have break locations separate virtualhost blocks , use servername / serveralias appropriately specify domains want cover...

c# - WCF: Windows or UserName authentication in one endpoint -

we implementing following log on mechanism our 3-tier application: user launches client application , - authenticates using windows session credentials (active directory) or enters ad credentials if user logged on windows session or enters user name , password if computer not on ad domain. i.e. sql server management studio log on box (+point 2. above). the solution came having 2 endpoints, 2 system bindings (one windows, other username client credential type). i wondering if there's way of having 1 endpoint custom binding magically allow mixed authentication (either windows or username)? also, why bad idea? thanks!

python - I need help making a list -

i trying make disorganized text file list suitable use python program. text file list of data seperated few spaces not in standard columns or organized. goal of program read through file using python , after each piece of data want there space, want make new line. output should list of data each term on 1 line. in addition there terms not want. terms want start "jj". here have far. note not run yet. looking finishing program select terms starting jj , make new line @ space after jj term. robert datafile = open ('c:\\textfile.txt', 'r') line_list = line.split(" ") x in line_list: if x.startswith("jj") : print line_list edit: want open file called textfile , have python keep lines of data start "jj". additionaly want each data on it's own line, why want seperate them using space after each ilne of data? clearer? lines = [item item in open('c:\textfile.txt', 'r').read().split(' ') i...

tdd - Database integration tests -

when doing integration tests either data access layer or majority of application stack. best way prevent multiple tests clashing each other if run on same database? transactions. what ruby on rails unit test framework this: load fixture data. each test: begin transaction # yield control user code rollback transaction end each this means that any changes test makes database won't affect other threads while it's in-progress the next test's data isn't polluted prior tests this zillion times faster manually reloading data each test. i 1 think pretty cool

visual studio - VS Code Snippets automatic synchronizer? -

i use more 1 machine development in vs 2008. there tool automatically synchronize snippets between machines? same concept of synchronizing browsers' bookmark. if have vista , livemesh client installed try this suggestion hope helps.

objective c - Clipping NSImage around certain NSRect -

i have nsimage different images inside it. positions of images inside of stay same time, need specify rectangle subimage @ position of rectangle inside of image. how done? why there multiple images inside of 1 image? premature optimization? in case, when draw image , 1 of parameters pass section of image want. normally, pass either bounds of image or 0 rect (which both mean same thing), can pass subrectangle if want. if destination rectangle larger source rectangle, scale (non-proportionally); if it's smaller, scale down (non-proportionally). adjust size of destination rectangle match of source rectangle if don't want scaling. if want leave drawing nsimageview, create empty nsimage of desired size , draw it, pass image image view. destroys whatever performance advantage you'd hoped gain mashing these 1 image. you create custom subclass of nsview, nsimageview, or calayer has property nsimage , property source rectangle, , draws section.

How do I create a session on a server in PHP? -

i trying make wdtv live plugin in linux, plays video web url. i have url parsed html source code. problem url playable in xbmc, can't play in media players. checked xbmc log, , looks xbmc creates session movie url. below log xbmc log file. info: xcurl::dlllibcurlglobal::easy_aquire - created session http://121.125.77.146 debug: cplayercorefactory::getplayers(http://121.125.77.146/cgi-bin/sbview.cgi?systype=10000&subtype=4&id0=17678&id1=27635&id2=368507&id3=285792&nodeid=3071517&userno=0&userid=&level=1&part=0&ispay=0&mkey=2bd5454e93890a8ae2fe76948764a2d6&skey=5176153017445b5b79f897eec711996b&dummy=1279941981&title=%5bstar2gether%5d%20%c0%cc%ba%a5%c6%ae%c0%fc_1%ba%ce&impurl=&tvinfo=10000,4,17678,27635,368507,285792,) is possible xbmc in php? thanks adding on sac's answer, you'll need implement authentication system if want single media player use it, kind of netflix does. afaik, netflix g...

coding style - bitwise indexing in C? -

i'm trying implement data compression idea i've had, , since i'm imagining running against large corpus of test data, had thought code in c (i have experience in scripting languages ruby , tcl.) looking through o'reilly 'cow' books on c, realize can't index bits of simple 'char' or 'int' type variable i'd to bitwise comparisons , operators. am correct in perception? reasonable me use enumerated type representing bit (and make array of these, , writing functions convert , char)? if so, such type , functions defined in standard library somewhere? there other (better?) approaches? there example code somewhere point me to? thanks - following on kyle has said, can use macro hard work you. it possible. to set nth bit, use or: x |= (1 << 5); // sets 6th-from right to clear bit, use and: x &= ~(1 << 5); // clears 6th-from-right to flip bit, use xor: x ^= (1 ...

User uploaded images on google app engine? -

say creating facebook style app app engine. how handle user profile pics? as far know, have either store images in datastore or blobstore. means every fetch picture require going through dynamic handler , using @ least 20ms cputime. is there efficient way this? or app engine can't handle? you don't have issue anymore, since get_serving_url() doesn't use of cpu quota (only outgoing bandwidth , storage). plus gives scaling , cropping free.

java - Converting Between Hibernate Collections and My Own Collections -

i have set hibernate give me set<integer> convert internally , set<myobjecttype> ( myobjecttype can represented single integer). say, when hibernate calls void setmyobjecttypecollection(set<integer> theset) method iterate through elements in theset , convert them myobjecttype . when hibernate calls set<myobjecttype> getmyobjecttypecollection() allocate new hashset , convert myobjecttype s integer s. the problem every time call commit , hibernate deletes in collection , re-inserts regardless of whether element of collection has changed or collection has changed. while don't technically consider bug, afraid deleting , inserting many rows cause database perform unnecessarily slowly. is there way hibernate recognize though have allocated , returned different instance of collection, collection contains items used , there no need delete , reinsert them all? i think best way achieve goal use usertype . lets handle conversion sql own objec...

c# - How do I drag and drop files into an application? -

i've seen done in borland's turbo c++ environment, i'm not sure how go c# application i'm working on. there best practices or gotchas out for? some sample code: public partial class form1 : form { public form1() { initializecomponent(); this.allowdrop = true; this.dragenter += new drageventhandler(form1_dragenter); this.dragdrop += new drageventhandler(form1_dragdrop); } void form1_dragenter(object sender, drageventargs e) { if (e.data.getdatapresent(dataformats.filedrop)) e.effect = dragdropeffects.copy; } void form1_dragdrop(object sender, drageventargs e) { string[] files = (string[])e.data.getdata(dataformats.filedrop); foreach (string file in files) console.writeline(file); } }

language agnostic - Database of Actual Federal Holidays / Closure -

i working on coding problem , need check whether past date federal holiday. trivial , have pulled historic planned holidays there have been many federal holidays/non-working days have been declared presidential proclamation or executive order. these include day before(or) after christmas done last year, day of mourning former president ford , snow emergency days affected federal operations in dc. so question is, know there listing of these can counted upon reasonably comprehensive. things can find lists of statutory holidays. thanks the best know of http://www.opm.gov/operating_status_schedules/fedhol/2010.asp you can replace year year between 1997 , 2020. cheers stu

algorithm - How to programmatically normalize music tags? -

suppose have large , legal collection of music has been inconsistently tagged. want normalise single field, eg artist, that, example, following artists become 1 artists: the grateful dead the gratefull dead grateful dead grateful dead, the so... should looking @ trying match against large database freedb, or there lower-level string-manipulation approach, etc? i have tried hand-rolling code string-similarity checks, , try , match these high-frequency data in freedb, limited success. any more ideas? musicbrainz recommended, , no coding required!

class - Most interesting/useful Java classes? -

i've been using java year or now, , find myself discovering new things in language. of cool stuff, interestingly enough, doesn't come 3rd-party apis or libraries, rather classes ship in jdk. so i'm wondering, partly out of curiosity , partly education of others , myself, classes come in jdk interesting/useful/your favorite? by definition, object.

c# - Using Outlook API to get to a specific folder -

i'm trying write c# code specific folder in outlook mailbox. have following code: outlook.application oapp = new outlook.application(); outlook.namespace ons = oapp.getnamespace("mapi"); outlook.recipient orecip = ons.createrecipient("accountnamehere"); orecip.resolve(); if (orecip.resolved) { oinbox = ons.getshareddefaultfolder(orecip, outlook.oldefaultfolders.olfolderinbox); oinboxmsgs = oinbox.items; itemcount = oinboxmsgs.count; console.writeline("there {0] items.", itemcount.tostring()) } this me to "inbox" folder. i'm trying folder @ same level inbox folder. believe need use getfolderfromid instead of getshareddefaultfolder, don't understand how use it. there way iterate through top level folders? how might determine entryid , storeid of folder? thanks! you can use folders collection member of outlook.namespace object. way can iterate through collection , find folder it's name. in case still want u...

performance - Perl: why is the if statement slower than "and"? -

in perl, conditional can expressed either as if (condition) { } or as (condition) , { } interestingly, second way seems 10% faster. know why? some comments deparse below: first, don't use b::terse, it's obsolete. b::concise gives better information once used it. second, you've run using literal code given, condition taken bareword happens true, boolean check optimized away in both cases, kind of defeats purpose. third, there isn't opcode - "null" indicates opcode that's been optimized away (completely out of execution tree, though still in parse tree.) here's concise execution tree 2 cases, shows them identical: $ perl -mo=concise,-exec -e'($condition) , { }' 1 <0> enter 2 <;> nextstate(main 2 -e:1) v 3 <#> gvsv[*condition] s 4 <|> and(other->5) vk/1 5 <$> const[pv "something"] s/bare 6 <1> dofile vk/1 7 <@> leave[1 ref] vkp/refc -e syntax ok ...

makefile - Pause GNU Make in a Windows console if an error occurs -

part of install app responsible for, compiles c code libraries. done in console using gnu make. so, part of install, console window pops open, see make file output wiz compiles , links, when finished console window closes , installer continues. all good, unless there compilation error. make file bugs out , console window closes before have chance figure out happening. so, i'd happen have console window pause 'press key continue' type functionality, if there error makefile console stays open. otherwise, exit normal , close console. i can't work out how in gnu makefile or batch file run make. this should trick: if not errorlevel 0 pause type help if in dos more info on errorlevel usage.

Saving credit card information in MySQL database? -

i want allow customer users enter credit card information can charge them every month. i wonder how 1 should save information? should saved in mysql database ("user" table) or kind of information sensitive , need stored in place? i have no experience of , glad if advice me how accomplish this. thanks. as mentioned above, not store credit card information in database. it's recipe trouble. doing make attractive target hackers and, if successful in retrieving them, end business , potentially ruin life lives of credit card numbers stolen. having said here 3 things consider: 1) best bet use payment processor/payment gateway offers recurring billing. example of authorize.net's automated recurring billing service. once set subscription automatically bill user every month automatically , let know results of transaction. saves ton of work , relieves of liability of storing credit card information. 2) if store store credit card numbers must follow pc...

javascript - Use jQuery to replace XMLHttpRequest -

i quite new javascript libraries. wanted replace current code jquery. current code looks this: var req; function createrequest() { var key = document.getelementbyid("key"); var keypressed = document.getelementbyid("keypressed"); keypressed.value = key.value; var url = "/my_servlet/response?key=" + escape(key.value); if (window.xmlhttprequest) { req = new xmlhttprequest(); } else if (window.activexobject) { req = new activexobject("microsoft.xmlhttp"); } req.open("get", url, true); req.onreadystatechange = callback; req.send(null); } function callback() { if (req.readystate == 4) { if (req.status == 200) { var decimal = document.getelementbyid('decimal'); decimal.value = req.responsetext; } } clear(); } i wanted replace code little friendlier jquery's $.get(url, callback); however doesn't call callback function. also call func...

Maximum lines of code permitted in a Java class? -

how many lines of code can .java file contain? depend on jvm being used? to extend upon jonas's response , java virtual machine specification, section 4.8 constraints on java virtual machine code says that: the java virtual machine code method, instance initialization method (§3.9), or class or interface initialization method (§3.9) stored in code array of code attribute of method_info structure of class file. section describes constraints associated contents of code_attribute structure. continuing section 4.8.1, static constraints the static constraints on class file defining well-formedness of file. exception of static constraints on java virtual machine code of class file, these constraints have been given in previous section. static constraints on java virtual machine code in class file specify how java virtual machine instructions must laid out in code array , operands of individual instructions must be. ...

.net - Update SQL Server Database Schema with software update -

how update sql sever database when installing product's update? there tools integrate windows installer? typical schema changes are: adding/removing columns adding/removing tables. adding views. adding/alter indexs. not sure integration windows installer, might red gate's sql packager

c++ - How do I get a multi line tooltip in MFC -

right now, have tool tip pops when hover on edit box. problem tool tip contains multiple error messages , in 1 long line. need have each error message on own line. error messages contained in cstring new line seperating them. my existing code below. bool ontooltiptext(uint, nmhdr* pnmhdr, lresult* presult) { assert(pnmhdr->code == ttn_needtexta || pnmhdr->code == ttn_needtextw); // need handle both ansi , unicode versions of message tooltiptexta* pttta = (tooltiptexta*)pnmhdr; tooltiptextw* ptttw = (tooltiptextw*)pnmhdr; // tchar szfulltext[256]; cstring strtiptext=_t(""); uint nid = pnmhdr->idfrom; if (pnmhdr->code == ttn_needtexta && (pttta->uflags & ttf_idishwnd) || pnmhdr->code == ttn_needtextw && (ptttw->uflags & ttf_idishwnd)) { // idfrom hwnd of tool nid = ::getdlgctrlid((hwnd)nid); } //m_errprojaccel[ch] contains 1 or more error messages each...

web services - c# webservice class response -

i have class: public class loginresponse { public string sessionid { get; private set; } public datetime? activeto { get; private set; } public loginresponse() { } public loginresponse(string sessionid, datetime? activeto) { this.sessionid = sessionid; this.activeto = activeto; } } and want return class webservice response: [webmethod] public loginresponse login(string login, string password) { return new loginresponse("a", null); } the class loginresponse in other dll. must do, because got error?? the errors told must using attribute webmethodattribute or change root type using xmlrootattribute, because loginresponse refers method or type i have solution: i must change function name login :) it's name servicelogin , works fine :) regards

Generating random numbers in Objective-C -

i'm java head mainly, , want way generate pseudo-random number between 0 , 74. in java use method: random.nextint(74) i'm not interested in discussion seeds or true randomness, how accomplish same task in objective-c. i've scoured google, , there seems lots of different , conflicting bits of information. you should use arc4random_uniform() function. uses superior algorithm rand. don't need set seed. #include <stdlib.h> // ... // ... int r = arc4random_uniform(74); the arc4random man page: name arc4random, arc4random_stir, arc4random_addrandom -- arc4 random number generator library standard c library (libc, -lc) synopsis #include <stdlib.h> u_int32_t arc4random(void); void arc4random_stir(void); void arc4random_addrandom(unsigned char *dat, int datlen); description arc4random() function uses key stream generator employed arc4 cipher, uses 8*8 8 bit s-boxes. s-boxes can in (...

java - Struts Validation with multiple validation rules for a single field -

this might basic question: i'm trying understand how struts validation code below works: <field property="myfield" depends="validwhen, maxlength"> <msg name="validwhen" key="error1.key" /> <msg name="maxlength" key="error2.key"/> <var> <var-name>test</var-name> <var-value> isfieldsshown == "no" </var-value> </var> <var> <var-name>maxlength</var-name> <var-value>128</var-value> </var> </field> is like, first validwhen rule checked , if succeeds maxlength rule checked? or, if validwhen returns true, field considered valid without going maxlength rule @ all? it has been while since worked validator framework remember goes following. when validate field, field considered valid if of validations pass. if @ least 1 validation fails field considere...

how to create a file of mysql database schema? -

i need how dump database schema, not data. our database has data.but want create database dump schema out data. i think mysqldump dumps schema along data. there options can specify let me dump schema without data. mysqldump --no-data databasename or use mysqladministrator, phpmyadmin or other tool.

html - Why it is accepted to use an UL, LI structure in menu lists? -

i'm new html. when started reading documentation lists, i've noticed everywhere <ul> , <li> structure used, creating simple lists. but me it's comfortable use <a> elements css: display: block; /* and/or */ float: left; so, why use <ul> , <li> instead of <a> ? thanks lot. because structurally they're appropriate elements purpose. helps screen reader users in terms of dictating elements of page. remember html markup/content ( text? paragraph? wrap in p tag ), css styling, js behaviour. you can have thousands of anchors on web page, if want style anchors nested within listed items differently other anchors? <ul> <li><a href="#">blah</a></li> </ul> <a href="#">sfl</a> if had done things properly, css trivial implement a { } ul li { } otherwise you'd have throw classes around anchors , messy , unstructural. in regards seo - believ...

html - Table caption element is causing page to break when printing -

consider following table: <table> <caption>the caption</caption> <thead>...</thead> <tbody>...</tbody> <tfoot>...</tfoot> </table> the table renders right when displaying on screen, when printing breaks table new page. when delete caption element or display:none, table renders right on printing. any help? according w3c: the table elements, table, tr, td, th, , caption, should have standard meaning , display treatments: table, table-row, table-cell, , table-caption. from understanding means caption { display: table-caption; } edit: found more accurate style: table { display: table } tr { display: table-row } thead { display: table-header-group } tbody { display: table-row-group } tfoot { display: table-footer-group } col { display: table-column } colgroup { display: table-column-group } td, th { display: table-cell } caption ...

Why would XCode keep trying to install an ad hoc profile when I set iPhone developer Code signing identity in the build options? -

i want run iphone app in debug mode on device. have valid certificate , provisioning profiles developer , debug. have code signing identity set "iphone developer" in project preferences. when try install app, asks me if want install ad hoc distribution profile. strange because explicitly tell use iphone developer code signing identity. using ad hoc distribution profile won't work because doesn't have debug rights. anyone know how fix this? maybe can you: go project -> edit project settings -> build in "configuration" dropdown list select debug configuration (not "active") , check build settings. entilements.plist should not added debug configuration. try so. xcode ignores settings active configuration , uses previous configuration. check info.plist file, use debug build (it can setted in build configuration "info.plist file" key). think, "bundle identifier" in file equal app identifier in adhoc ...

java - xdoclet vs xdoclet2? -

i'm updating old project & version of xdoclet complains java 1.5 annontations (arraylist data = ....) when parsing hibernate (hibernate3) tags. so question this... is there fix xdoclet 1.2.3, or should move xdoclet2? i've started moving of code over, xdoclet2 doesn't seem offer same level of configuration hibenate, such excludedtags. wrong on though. what lot think? jeff porter i definitively lose xdoclet in favor of jpa annotations. can same functionality hibernate using jpa annotations.

asp.net - Is there any reason to put code in the code behind rather than in the aspx file? -

any time need write code put in code behind file. reason has seemed "right" way write code. based on of examples see online, lot of other people choose write code way too, seems putting code in aspx file allows same stuff offering few advantages. top of list being: easier make changes since no recompile. you have access code if can't find project in source control (this happened me). is there benefit having code in code behind file? there disadvantage putting code in aspx file? separating code markup results in cleaner structure, non-trivial pages. 1 of major benefits asp.net on asp classic.

sql server insert records from one table to another -

how 1 insert records 1 table has unique index in destination table without going through insert , removal of duplicates deleting index? insert forms(url,feedurl, dateadded) select url, feedurl, dateadded book3 t2 not exists(select * forms t1 t1.url = t2.url; t2.feedurl = t1.feedurl , t2.dateadded =t1.dateadded) violation of unique key constraint 'ix_forms'. cannot insert duplicate key in object 'dbo.forms'. table forms create table [dbo].[forms]( [id] [int] identity(1,1) not null, [url] [varchar](450) null, [feedurl] [varchar](450) null, [dateadded] [datetime] null, constraint [pk_forms] primary key clustered ( table book3 create table [dbo].[book3]( [url] [varchar](450) null, [feedurl] [varchar](450) null, [dateadded] [datetime] null ) on [primary] you may have duplicates in results set. query give fewer records orginal select? select distinct url, feedurl, dateadded book3 t2 not exists(select * forms t1 t1.url = t2.url t2.feedurl = t...

multithreading - Does Delphi have any equivalent to C's volatile variable? -

in c , c++ variable can marked volatile , means compiler not optimize because may modified external declaring object. there equivalent in delphi programming? if not keyword, maybe work around? my thought use absolute , wasn't sure, , may introduce other side effects. short answer: no. however, not aware of situation in conservative approach of compiler change number of reads or writes if follow approach: when reading cross-thread visible location, save value local before doing further manipulation; similarly, restrict writes single assignment. the delphi compiler not perform common subexpression elimination (cse) on non-local location expressions when there calls non-inlined methods between expressions, compiler doesn't interprocedural optimization , not correct single-threaded code. so, may want use interlockedexchange() reads , writes force this; additionally, cause full memory barrier, processor won't reorder reads , writes either.

Google Website Optimizer & Adwords -

right running a/b test through google website optimizer(gwo). adwords used link static version of page not running in test. wanted verify if set destination url adwords original page in test gwo route traffic other test versions. i wanted verify if set destination url adwords original page in test gwo route traffic other test versions. yes, traffic adwords included in test, means visitors adwords randomly assigned test versions. in fact, any traffic a gwo test page included in test.

algorithm - Random points inside a parallelogram -

i have 4 side convex polygon defined 4 points in 2d, , want able generate random points inside it. if simplifies problem, can limit polygon parallelogram, more general answer preferred. generating random points until 1 inside polygon wouldn't work because it's unpredictable time takes. a. if can restrict input parallelogram, simple: take 2 random numbers between 0 , 1. we'll call u , v . if parallelogram defined points abcd such ab, bc, cd , da sides, take point being: p = + (u * ab) + (v * ad) where ab vector b , ad vector d. b. now, if cannot, can still use barycentric coordinates. barycentric coordinates correspond, quad, 4 coordinates (a,b,c,d) such a+b+c+d=1 . then, point p within quad can described 4-uple such that: p = a + b b + c c + d d in case, can draw 4 random numbers , normalize them add 1. give point. note distribution of points not uniform in case. c. can also, proposed elsewhere, decompose quad 2 triangles , use half-p...

flash - (stream.bytesLoaded / stream.bytesTotal) * video.duration != loaded seconds for mp4? -

good day! i'm trying determine how of video loaded (in seconds). when try (stream.bytesloaded / stream.bytestotal) * video.duration result not accurate because distribution of video stream size not uniform inside file. for example if video starts static part video title or blank screen, size of part less (in other words compressed better) other video fast movements. far understand mp4 adaptive , more movement in video more space take. i tried use seek points (time + offset) defined in mp4 , works , accurate, don't want depend on them. thanks advices! you correct video loaded may vary according compression. a better way handle might instead display buffer , show user how of buffer has been loaded. otherwise, might need fix videos constant bit rate can estimate how of video has loaded.

c# - When to use a webservice over a windows service? -

i have data loading application has executed multiple times per day @ irregular intervals. planning write service kick off downloads , import data database server. there advantages using standard service on webservice or vice versa? i think you're missing point here. web services typically used form of communication or remote execution. call remote function on web-service either adjust behavior of machine it's running on or retrieve data it. windows services background processes run on machine without "logged on user" being required. can perform tasks , things while user @ login screen, or elevated operations. can talk services adjust behavior or retrieve information, it's general purpose different webservice. the biggest notable difference here web-services must called, don't run on own. for application suggest using windows (standard) service, can have execute code once per day. use web-service if you've got else automate calls we...

Can comments be used in JSON? -

can use comments inside json file? if so, how? i don't believe can have actual comment. json should data, , if include comment, data too. you have designated data element called "_comment" (or something) ignored apps use json data. you better having comment in processes generates/receives json, supposed know json data in advance, or @ least structure of it. but if decided to: { "_comment": "comment text goes here...", "glossary": { "title": "example glossary", "glossdiv": { "title": "s", "glosslist": { "glossentry": { "id": "sgml", "sortas": "sgml", "glossterm": "standard generalized markup language", "acronym": "sgml", "abbrev": "iso 88...

Why am I getting an exception when I try to set the value of a cell in Excel using Perl's Win32::OLE? -

i getting error win32::ole<0.1709> error 0x80020009: "exception occurred" in propertyput "value" @ line 109. the code in perl. foreach $ref_array1 (@$array1) { # loop through array foreach $col1 (@$ref_array1) { foreach $ref_array2 (@$array2) { # loop through array foreach $col2 (@$ref_array2) { if ($col1 eq $col2) { line 109: **$worksheet1->cells($j,1)->{'value'} = $col1;** $j++; any kind of appreciated. thankyou the following incomplete example works (i.e., puts 5 in cell a1 ): #!/usr/bin/perl use strict; use warnings; use win32::ole qw(in with); use win32::ole::const 'microsoft excel'; $win32::ole::warn = 3; $excel = get_excel(); $excel->{visible} = 1; $book = $excel->workbooks->add; $sheet = $book->worksheets->add; $sheet->{name} = 'perl win32-ole example'; $range = $sheet->cells(1,1); $range->{value} = ...

assembly - x86 LOCK question on multi-core CPUs -

is true x86 asm "lock" command prefix causes cores freeze while instruction following "lock" being executed? i read in blog post , doesn't make sense. can't find indicates if true or not. it's locking memory bus address. the intel 64 , ia-32 architectures software developer's manual - volume 3a: system programming guide, part 1 tells us: 7.1.4 effects of lock operation on internal processor caches. for intel486 , pentium processors, lock# signal asserted on bus during lock operation, if area of memory being locked cached in processor. for p6 , more recent processor families, if area of memory being locked during lock operation cached in processor performing lock operation write-back memory , contained in cache line, processor may not assert lock# signal on bus . instead, modify memory location internally , allow [its] cache coherency mechanism insure operation carried out atomically. ...

asp.net - Populate a DropDownList with AJAX -

i have long list of items dropdownlist. list long, show items in list if user clicks on dropdownlist expand it. found various tutorials on how use ajax cascading dropdownlists none explaining if possible have 1 dropdownlist gets populated ajax when user expands it. are there extenders coming ajax toolkit missed? best way of achieving this? thanks, ben what this: have 1 empty item in list. when dropdownlist receives focus change 1 item loading or that. make ajax call want. once completes unbind focus event dropdown don't reload on subsequent focus events. seems wouldn't difficult this. i'll see if can whip on jsfiddle if need help. edit: way question extenders don't know that. edit 2: try this: $(document).ready( function() { $("#theselect").bind("focus", function() { $("option:first", this).html("loading..."); ...

wordpress - htaccess a dynamic URL -

i'm using wordpress plugin , it's making urls this: http://www.example.com/?name=the-office i redirect similar urls http://www.example.com/name/the-office current htaccess: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress i tried few things , nothing seemed work, maybe i'm need place rewritecond in ifmodule? not sure, htaccess foreign me. in advance. if you'd workaround easier accomplish - login wordpress admin panel, go settings, permalinks , there can select how links like. select last option (post name) post names in urls.

logging - How to eliminate 'unused output column' warnings in SSIS jobs? -

i'm trying rid of spurious warnings in ssis progress log. i'm getting bunch of warnings unused columns in tasks use raw sql work. have data flow responsible archiving data in staging table prior loading new data. data flow looks this: +--------------------+ | oledb source task: | | read staging table | +--------------------+ | | +---------------------------+ | oledb command task: | | upsert history table | +---------------------------+ | | +---------------------------+ | oledb command task: | | delete staging table | +---------------------------+ my 'upsert' task like: -------------------------------------- -- update existing rows first... update history set field1 = s.field1 ... history h inner join staging s on h.id = s.id h.last_edit_date <> s.last_edit_date -- update changed records -- ... insert new rows insert history select s.* staging s join history h on h.id = s.id h.id...

jquery - dynamicaly populate input text box value on select onchange -

models.py class subject(models.model): code = models.charfield(max_length = 31) name = models.charfield(max_length = 31) credit = models.charfield(max_length = 31) def __unicode__(self): return str(self.code) + "-"+ str(self.name) class student(models.model): name = models.charfield(max_length = 31) roll = models.charfield(max_length = 31) subject = models.foreignkey(subject, related_name = 'subjects') marks = models.charfield(max_length = 31) def __unicode__(self): return str(self.name) + "-"+ str(self.roll) views.py def add_student(request): subject = subject.objects.all() if request.method == "post": obj = student() obj.name = request.post['name'] obj.roll = request.post['roll'] obj.subject = subject.objects.get(name = request.post['subject']) obj.marks = request.post['marks'] obj.sav...

c# - Is there a way to set the value of #define on runtime? -

i wonder if there way set value of #define in run time. i assume there query oracle specific , sql server specific @ code below. #define oracle // ... #if oracle // code #else // different code. #endif absolutely not, #defines compiled out preprocessor before compiler sees - token 'oracle' isn't in code, '1' or '0'. change #define global variable or (better) function returns correct value.

data structures - What's a RDF triple? -

in layman's terms, what's rdf triple? i think question needs split 2 parts - triple , makes "rdf triple" special? firstly, triple is, of other commenters here have pointed out statement in "subject/predicate/object" form - i.e. stament linking 1 object (subject) object(object) or literal. via predicate. familiar triples: triple smallest irreducible representation binary relationship. in plain speak: spreadsheet collection of triples: e.g. if column in spreadsheet has heading "paul" , row has heading "has sister" , value in cell is, example, "lisa", here have triple: paul (subject) has sister(predicate) lisa (literal/object). what makes rdf triples special every part of triple has uri associated it, everyday statement "mike smith knows john doe" might represented in rdf as: uri://people#mikesmith12 http://xmlns.com/foaf/0.1/knows uri://people#johndoe45 the analogy spreadsheet giving every part of ur...

css - Repeat table headers in print mode -

is possible in css using property inside @page table headers (th) should repeated on every page if table spreads on multiple pages? this thead element for. official docs here .

javascript - How to display jQuery Validation error container only on submit -

i trying make validation plugin work. works fine individual fields, when try include demo code error container contains of errors, have issue. problem shows container errors when in fields, display error container when user presses submit button (but still show inline errors beside control when losing focus). the problem message in container. when took off code mentioned in answer below container, container output displays number of errors in plain text. what trick list of detailed error messages? display "error" next control in error when user presses tab button, , have summary of @ end when presses submit. possible? code input here: $().ready(function() { var container = $('div.containererreurtotal'); // validate signup form on keyup , submit $("#frmenregistrer").bind("invalid-form.validate", function(e, validator) { var err = validator.numberofinvalids(); if (err) { con...

pattern matching - How To Identify Email Belongs to Existing Thread or Conversation -

we have internal .net case management application automatically creates new case email. want able identify other emails related original email can prevent duplicate cases being created. i have observed many, not all, emails have thread-index header looks useful. does know of straightforward algorithm or package use? use jwz threading algorithm .

asp.net mvc - Does Request.IsMvcAjaxRequest() method return true for requests originating from Ajax.ActionLink() click? -

i have controller action being executed link created using 'ajax.actionlink()' problem can't tell in action request ajax request because request.ismvcajaxrequest() returning false. does request.ismvcajaxrequest() not work ajax.actionlink() generated requests? here code using generate link: <%= ajax.actionlink("delete", "delete", new { graphuri = viewdata.model.uri.value }, new ajaxoptions { confirm = "really delete?", onsuccess = "success", onfailure = "fail", httpmethod = "delete" }, new { title = "delete graph", @class = "deletegraphlink" })%> when @ code ismvcajaxrequest extension method looks work ajax forms , not ajax actionlinks. update 11/13 if change httpmethod in ajaxoptions post, well. know how request.ismvcajaxrequest() work when using delete method? there no form parameters on delete. try adding __mvcasyncpost=true route data (query parameter in u...

What is the difference between request, response and server? -

what difference between request, response , server? request : client server response: server client server: receive request , send response client: send request , receive response

Using Java 6, on linux how can I make sure to use an ipv4 socket? -

i'm trying write quick little java application read contents of pcap file (from wireshark) , play data on network on linux box. file contain udp broadcast packets, application needs timestamp, port number, , data packet need. problem application i'm trying test code listening ipv4 udp broadcasts on windows. test application keeps opening ipv6 socket send data out. i'm using netstat -a -u -p determine socket udp6 socket. on windows know isn't. what easiest or best way force test app on linux in java open udp or udp4 socket instead? don't want forced in providing ipv4 network address each time. want able move code machine without having remember configuration needs changed. add -djava.net.preferipv4stack=true java application runtime properties.

console - Polling the keyboard (detect a keypress) in python -

how can poll keyboard console python app? specifically, akin in midst of lot of other i/o activities (socket selects, serial port access, etc.): while 1: # doing amazing pythonic embedded stuff # ... # periodically non-blocking check see if # being told else x = keyboard.read(1000, timeout = 0) if len(x): # ok, key got pressed # what correct pythonic way on windows? also, portability linux wouldn't bad, though it's not required. the standard approach use select module. however, doesn't work on windows. that, can use msvcrt module's keyboard polling. often, done multiple threads -- 1 per device being "watched" plus background processes might need interrupted device.

java - What's the difference between ModelAndView and ModelMap? -

is modelmap new name in spring 3 modelandview ? does functionality change in spring 3? consider code in spring 3 app using modelmap : @requestmapping(value = "/order", method = requestmethod.get) public final string setup(final modelmap model) { model.addattribute(order, new order()); return "setup"; } i know equivalent use here of modelandview in older spring app? require name change modelmap modelandview working in spring 2.5? modelandview , name suggests, contains model, and name of view. modelmap , in contract, contains information model. your example have been written (in "old" spring) as public modelandview handlerequest(httpservletrequest request, httpservletresponse response) { return new modelandview("setup", order, new order()); }

php - FTPS problem: "A TLS packet with unexpected length was received." -

i'm trying connect ftps server (not sftp). connecting linux system, have tried lftp, ftp-ssl, , using php's ftp_ssl_connect, none of them work. (i have been able connect other ftps servers using or @ least of above methods). the descriptive error have lftp debug way 11: $ lftp lftp :~> open -u my-username ftps://server.net password: lftp my-username@server.net:~> debug 99999999999 lftp my-username@server.net:~> ls filecopy(0x717bf0) enters state initial filecopy(0x717bf0) enters state do_copy ---- dns cache hit ---- connecting server.net (ip address) port 990 gnutls: hsk[acfbb0]: keeping ciphersuite: dhe_rsa_aes_128_cbc_sha1 gnutls: hsk[acfbb0]: keeping ciphersuite: dhe_rsa_camellia_128_cbc_sha1 gnutls: hsk[acfbb0]: keeping ciphersuite: dhe_rsa_aes_256_cbc_sha1 gnutls: hsk[acfbb0]: keeping ciphersuite: dhe_rsa_camellia_256_cbc_sha1 gnutls: hsk[acfbb0]: keeping ciphersuite: dhe_rsa_3des_ede_cbc_sha1 gnutls: hsk[acfbb0]: keeping ciphersuite: dhe_dss_aes_128_c...

local - Is there a way to blame someone else or be able to change the blamee in subversion/TortoiseSVN? -

i have project working on being version controlled on local machine. have changes made person outside of network/company need incorporate project want able put "blame" on them changes make. manually make changes or may incorporate changes make adding files , such. have suggestions? make new subversion account changes them, , commit changes user.

uniqueidentifier - What are the experiences with using unicode in identifiers -

these days, more languages using unicode, thing. presents danger. in past there troubles distinguising between 1 , l , 0 , o. have complete new range of similar characters. for example: ì, î, ï, ı, ι, ί, ׀ ,Ø£ ,Ø¢, ỉ, ﺃ with these, not difficult create hard find bugs. at work, have decided stay ansi characters identifiers. there out there using unicode identifiers , experiences? besides similar character bugs mention , technical issues might arise when using different editors (w/bom, wo/bom, different encodings in same file copy pasting problem when there characters cannot encoded in ascii , on), find it's not worth using unicode characters in identifiers. english has become lingua franca of development , should stick while writing code. this find particularly true code may seen anywhere in world developer (open source, or code sold along product).

.net - Formatting strings in C# consistently throughout a large web application -

i'm looking consistent way structure use of formatting strings throughout large web application, , i'm looking recommendations or best practices on way go. up until i've had static class common formatting e.g. formatting.formatcurrency formatting.formatbookingreference i'm not convinced way go though, i'd prefer use standard way of formatting strings within .net directly , use: amount.tostring("c") reference.tostring("000000") id use iformattable , icustomformatter of our more complicated data structures, i'm struggling more simple existing objects need format (in case int32 datetime). do define constants "c" , "000000" , use them consistently around whole web app or there more standard way it? one option use helper class extension methods like public static class mywebappextensions { public static string formatcurrency(this decimal d) { return d.tostring("c"); }...

c# - Why does the ItemAdd Event stop being Handled on my Sent Items folder? -

i having trouble keeping event handle alive reason. my project outlook addin prompts user when send email. now, have event handler hooked sent items folder when sent email arrives in folder fires prompt. reason have attached sent items folder can deal email after sent. initially worked great , put onto client machine , event didnt want fire @ all. when attached event (initially figure happening) onsend event. call singleton class attaches handle require sent items folder handle doesnt re-created multiple times. (i did have without singleton class , instead had global flag switch when handle attached, no different) i hope making sense! what happening though in instances first few emails respond how supposed to; ie prompt after have been sent. after stops prompt , cant figure out why. i hopeing maybe there way can check see if event handle exists directly. other thought maybe handle have setup getting cleaned somehow? if has suggestions me figure going on appreciate it. ...

android - Can i pass uri value from onActivityResult() to onClick()? -

public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); msurfaceview01 = (surfaceview) findviewbyid(r.id.msurfaceview1); msurfaceholder01 = msurfaceview01.getholder(); msurfaceholder01.addcallback(ex10_04.this); mbutton02 = (button)findviewbyid(r.id.buttonobj); mbutton02.setonclicklistener( new button.onclicklistener(){ public void onclick(view arg0) { intent intent = new intent( intent.action_get_content ); intent.settype("audio/*"); intent destintent = intent.createchooser( intent, "select audio" ); //pick audio file startactivityforresult( destintent, 0 ); } }); } protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if ( resultcode == result_ok ) { uri uri = data.getdata(); if( uri != null ) { drawo();//it draw circle } ...

logging - Using Stomp and Apache ActiveMQ as reliable syslog -

one of programs requires reliable way log across unreliable network (ie internet). sender or receiver may go offline time , can come later. message sent client should not missed. syslog not fit bill. exploring use of messaging servers apache activemq instead of syslog. message senders in perl, ruby , c. have stomp message transport. does serve purpose? there pitfall missing here? raj that sounds fine me

c++ - How can I resolve this address of overloaded member function issue? -

[ edit - long since forgot here until got 2,500 views "notable question". since people viewing - there useful information overloads in accepted answer, checking std::endl worse realized @ time, , wrong thing. basically, effect of std::endl output \n stream flush std::flush . that's irrespective of platform, including windows end-of-line "\r\n". endl manipulator doesn't abstract away platform differences wrt line ends, c++ handles same way c - translating \n "\r\n" (for text mode, not binary) later on. thought c++ doing different, assumption strong never questioned 2 decades, wrong. i don't remember details, it's possible define own streams anyway, , provide alternative output (and translation) of whatever characters streamed in. manipulators should work expected, before custom stream code sees resulting output characters. provide special end-of-line behaviour, watch \n there (which still before text-file end-of-line translat...

c# - What is a partial class? -

what , how can used in c#. can use same concept in python/perl? the c# partial class has been explained here i'll cover python part. can use multiple inheritance elegantly distribute definition of class. class a_part1: def m1(self): print "m1" class a_part2: def m2(self): print "m2" class a(a_part1, a_part2): pass = a() a.m1() a.m2()

php - Handling the '.' character passed to a MySQL query via url -

i've hit bit of snag 1 of projects. lot of nerds, decided create own video game review site. reviews stored in database, , can retrieved via title of game url like: http://www.example.com/reviews/ {gamename}/{ optional pageofreview} unfortunately, when testing edge cases, came across odd error - if game has period in title can't retrieve it. if period leading character of title (like .hack), kohana stack trace error screen telling me review (or, more accurately, game) doesn't exist. if it's in middle or end of title, 1 of own error messages saying review (game) not retrieved. there way around this? issue of how mysql parses period, or else? edit: queries handled via kohana 2's orm functionality using mysqli driver. saving review (admin controller): public function savereview() { $this->checkadmin(); if (isset($_post['submit'])) { $this->storereview(); } else { header('location: /admin'); } } private function st...