Search Results

Search found 1323 results on 53 pages for 'eric ness'.

Page 49/53 | < Previous Page | 45 46 47 48 49 50 51 52 53  | Next Page >

  • Why can I call a non-const member function pointer from a const method?

    - by sdg
    A co-worker asked about some code like this that originally had templates in it. I have removed the templates, but the core question remains: why does this compile OK? #include <iostream> class X { public: void foo() { std::cout << "Here\n"; } }; typedef void (X::*XFUNC)() ; class CX { public: explicit CX(X& t, XFUNC xF) : object(t), F(xF) {} void execute() const { (object.*F)(); } private: X& object; XFUNC F; }; int main(int argc, char* argv[]) { X x; const CX cx(x,&X::foo); cx.execute(); return 0; } Given that CX is a const object, and its member function execute is const, therefore inside CX::execute the this pointer is const. But I am able to call a non-const member function through a member function pointer. Are member function pointers a documented hole in the const-ness of the world? What (presumably obvious to others) issue have we missed?

    Read the article

  • Determining polygon intersection and containment

    - by Victor Liu
    I have a set of simple (no holes, no self-intersections) polygons, and I need to check that they don't intersect each other (one can be entirely contained in another; that is okay). I can check this by simply checking the per-vertex inside-ness of one polygon versus other polygons. I also need to determine the containment tree, which is the set of relationships that say which polygon contains any given polygon. Since no polygon can intersect any other, then any contained polygon has a unique container; the "next-bigger" one. In other words, if A contains B contains C, then A is the parent of B, and B is the parent of C, and we don't consider A the parent of C. The question: How do I efficiently determine the containment relationships and check the non-intersection criterion? I ask this as one question because maybe a combined algorithm is more efficient than solving each problem separately. The algorithm should take as input a list of polygons, given by a list of their vertices. It should produce a boolean B indicating if none of the polygons intersect any other polygon, and also if B = true, a list of pairs (P, C) where polygon P is the parent of child C. This is not homework. This is for a hobby project I am working on.

    Read the article

  • Does it ever make sense to make a fundamental (non-pointer) parameter const?

    - by Scott Smith
    I recently had an exchange with another C++ developer about the following use of const: void Foo(const int bar); He felt that using const in this way was good practice. I argued that it does nothing for the caller of the function (since a copy of the argument was going to be passed, there is no additional guarantee of safety with regard to overwrite). In addition, doing this prevents the implementer of Foo from modifying their private copy of the argument. So, it both mandates and advertises an implementation detail. Not the end of the world, but certainly not something to be recommended as good practice. I'm curious as to what others think on this issue. Edit: OK, I didn't realize that const-ness of the arguments didn't factor into the signature of the function. So, it is possible to mark the arguments as const in the implementation (.cpp), and not in the header (.h) - and the compiler is fine with that. That being the case, I guess the policy should be the same for making local variables const. One could make the argument that having different looking signatures in the header and source file would confuse others (as it would have confused me). While I try to follow the Principle of Least Astonishment with whatever I write, I guess it's reasonable to expect developers to recognize this as legal and useful.

    Read the article

  • Sqlite3 prompting `...>` instead of `sqlite>`

    - by Imray
    I'm following a beginners tutorial to sqlite3. The first step is creating a new database. So I enter a name (movies.db). I'm expecting to get another sqlite> prompt on the next line, and continue with the tutorial, but instead I get a lame ...> after which I can type any gibbersish I want. Clearly, this is not good. What my command prompt looks like: SQLite version 3.8.1 2013-10-17 12:57:35 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> $ sqlite3 movies.db ...> gibberish ...> dsds ...> sdada ...> gfgys ...> a ...> Aaaaarrrgh! ...> How do I get sqlite3 to work normally for me? Pardon my newbie-ness. I hope I've phrased this question in a way that might help other newbs too.

    Read the article

  • Argument type deduction, references and rvalues

    - by uj2
    Consider the situation where a function template needs to forward an argument while keeping it's lvalue-ness in case it's a non-const lvalue, but is itself agnostic to what the argument actually is, as in: template <typename T> void target(T&) { cout << "non-const lvalue"; } template <typename T> void target(const T&) { cout << "const lvalue or rvalue"; } template <typename T> void forward(T& x) { target(x); } When x is an rvalue, instead of T being deduced to a constant type, it gives an error: int x = 0; const int y = 0; forward(x); // T = int forward(y); // T = const int forward(0); // Hopefully, T = const int, but actually an error forward<const int>(0); // Works, T = const int It seems that for forward to handle rvalues (without calling for explicit template arguments) there needs to be an forward(const T&) overload, even though it's body would be an exact duplicate. Is there any way to avoid this duplication?

    Read the article

  • (HTML) PNG on top of another PNG - possible to eliminate full transparency?

    - by MHTri
    I'd like to put a logo png onto of another coloured png. They both have transparent backgrounds. When I try this the images blend together. Curiously, in Photoshop the logo retains its opaque-ness - I put colours on the layers underneath it, another image, etc etc, the logo is still opaque. I'd like to do it this way so I can rotate the background images. How do I fix this? [edit]I've cooked up an example image: http://i.imgur.com/XtoGn.png The left is what I want to happen, the right is what happens on all browsers (I know the background isn't transparent but bear with me - they're both transparent pngs, with the background having a gradient layer mask). I've put the images like this <div> <img id="backgroundImg" style="position: absolute; top: 0;" src="/Images/background.png" /> <img id="logoImg" src="/Images/logo.png" /> </div> I'm not entirely sure what blending mode I'm using in PS.

    Read the article

  • How can I simplify this user interface?

    - by Bears will eat you
    I'm writing an internal-tools webapp; one of the central pages in this tool has a whole bunch of related commands the user can execute by clicking one of a number of buttons on the page, like this: Ideally, all of the buttons would fit on one line. Ordinarily I'd do this by changing each widget from a button with a (sometimes long) text label to a simple, compact icon - e.g. could be replaced by a familiar disk icon: Unfortunately, I don't think I can do this for every button on this particular page. Some of the command buttons just don't have good visual analogs - "VDS List". Or, if I needed to add another button in the future for some other kind of list, I'd need two icons that both communicate "list-ness" and which list. So, I'm still considering this option, but I don't love it. So it's come time for me to add yet another button to this section (don't you love internal tools?). There's not enough room on that single line to fit the new button. Aside from the icon solution I already mentioned, what would be a good* way to simplify/declutter/reduce or otherwise improve this UI? *As per Jakob Nielsen's article, I'd like to think that a dropdown menu is not the solution.

    Read the article

  • Simple syntax question

    - by stabby
    Hey everyone, First off, sorry for my noob-ness. Believe me when i say ive been rtfm'ing. Im not lazy, im just dumb (apparently). On the bright side, this could earn someone some easy points here. I'm trying to do a match/replace with a pattern that contains special characters, and running into syntax errors in a Flex 3 app. I just want the following regex to compile... (while also replacing html tags with "") value.replace(/</?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)/?>/g, ""); On a side note, the pattern /<.*?/g wouldn't work in cases where there are html entities between tags, like so: <TEXTFORMAT LEADING="2"> <P ALIGN="LEFT"> <FONT FACE="Arial" SIZE="11" COLOR="#4F4A4A" LETTERSPACING="0" KERNING="0"><one</FONT> </P> </TEXTFORMAT><TEXTFORMAT LEADING="2"> <P ALIGN="LEFT"> <FONT FACE="Arial" SIZE="11" COLOR="#4F4A4A" LETTERSPACING="0" KERNING="0">two</FONT> </P> </TEXTFORMAT> The first regex would get both "<one" and "two", but the second would only get "hi" Thanks! Stabby L

    Read the article

  • Nhibernate upgraded getting 'Antlr.Runtime.NoViableAltException' on outer join using *=

    - by user86431
    so we upgraded to newer Nhibernate and Fluent Nhibernate. now I' getting this exception: FailedNHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. near line 1, column 459 On this hql, which worked fine before the upgrade. SELECT s.StudId, s.StudLname, s.StudFname, s.StudMi, s.Ssn, s.Sex, s.Dob, et.EnrtypeId, et.Active, et.EnrId, sss.StaffLname, sss.StaffFname, sss.StaffMi,vas.CurrentAge FROM CIS3G.Jcdc.EO.StudentEO s , CIS3G.Jcdc.EO.EnrollmentEO e , CIS3G.Jcdc.EO.EnrollmentTypeEO et , CIS3G.Jcdc.EO.VwStaffStudentStaffEO sss, CIS3G.Jcdc.EO.VwAgeStudentEO vas WHERE ( e.EnrId = et.EnrId ) AND ( s.StudId = vas.StudId ) AND ( s.StudId = e.StudId ) AND ( et.EnrtypeId *= sss.EnrtypeId ) AND ( Isnull ( sss.StudStaffRoleCd , 1044 ) = 1044 ) AND ( s.StudId = 4000 ) Clearly it does nto like the *= syntax, I tried rewritign is as ansi sql outer join and no joy. Can anyone tell me what ineed to change the sql to so I can get the outer join to work correctly? Thanks, Eric-

    Read the article

  • Diff Algorithm

    - by Daniel Magliola
    I've been looking like crazy for an explanation of a diff algorithm that works and is efficient. The closest I got is this link to RFC 3284 (from several Eric Sink blog posts), which describes in perfectly understandable terms the data format in which the diff results are stored. However, it has no mention whatsoever as to how a program would reach these results while doing a diff. I'm trying to research this out of personal curiosity, because I'm sure there must be tradeoffs when implementing a diff algorithm, which are pretty clear sometimes when you look at diffs and wonder "why did the diff program chose this as a change instead of that?"... Does anyone know where I can find a description of an efficient algorithm that'd end up outputting VCDIFF? By the way, if you happen to find a description of the actual algorithm used by SourceGear's DiffMerge, that'd be even better. NOTE: longest common subsequence doesn't seem to be the algorithm used by VCDIFF, it looks like they're doing something smarter, given the data format they use. Thanks!

    Read the article

  • Implementing Domain Driven Design

    - by Steve Dunn
    Is anyone using the techniques from Domain Driven Design? I've recently read the Eric Evans book of the same name (well, most of it!) and would be interested to hear from anyone who's implemented all/some of it in a project (particularly in C#/C++) I've kept this question open ended as I'd like to see as many comments as possible, but I have a few questions in particular: 1 - Should value types be real 'value types' if the language supports it? e.g. a struct in C# 2- Is there any feature in C# that makes clearer the association between the language and the model (for instance, this is an entity, this is an aggregate etc.)

    Read the article

  • What is the recommended toolchain for formatting XML DocBook?

    - by Jonathan Leffler
    I've seen Best tools for working with DocBook XML documents, but my question is slightly different. Which is the currently recommended formatting toolchain - as opposed to editing tool - for XML DocBook? In Eric Raymond's 'The Art of Unix Programming' from 2003 (an excellent book!), the suggestion is XML-FO (XML Formatting Objects), but I've since seen suggestions here that indicated that XML-FO is no longer under development (though I can no longer find that question on StackOverflow, so maybe it was erroneous). Assume I'm primarily interested in Unix/Linux (including MacOS X), but I wouldn't automatically ignore Windows-only solutions. Is Apache's FOP the best way to go? Are there any alternatives?

    Read the article

  • Editing a 9gb .sql file

    - by CERIQ
    Hi. I've got a "slightly" large sql script saved as a textfile. It totals in at 8.92gb, so it's a bit of a beast. I've got to do some search and replaces in this file(specifically, change all NOT NULL to NULL, so all fields are nullable) and then execute the darned thing. Does anyone have any suggestions for a text editor that would be capable of this? The other way that I can see to solve the problem is to write a program that reads a chunk, does a replace on the stuff I need, and then save it to a new file, but I'd rather use some standard way of doing this. It also does not solve the problem of opening the beast up in sql server management studio to execute the darned thing... Any ideas? Thanks, Eric

    Read the article

  • Trying to compile MobileSubstrate addon - Undefined symbol

    - by eWolf
    Hi! I went through this tutorial to create a MobileSubstrate addon. I could compile the example hook without errors. But as soon as I add #import <SpringBoard/SBAwayController.h> in ExampleHookProtocol.h and SBAwayController *awayController = [SBAwayController sharedAwayController]; in ExampleHookLibrary.mm (as the first line of the __$ExampleHook_AppIcon_Launch function) I get the following error message when attempting to make (triggered by the latter change): Undefined symbols: "_OBJC_CLASS_$_SBAwayController", referenced from: __objc_classrefs__DATA@0 in ExampleHookLibrary.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [ExampleHook.dylib] Error 1. The header file for SBAwayController is located in /var/toolchain/sys30/usr/include/SpringBoard, just like SBApplicationIcon.h, which is used by the ExampleHook. I'm compiling on my iPod touch 2G. Can anyone help me? Thanks in advance, Eric

    Read the article

  • For reliable code, NModel, Spec Explorer, F# or other?

    - by ja
    I've got a business app in C#, with unit tests. Can I increase the reliability and cut down on my testing time and expense by using NModel or Spec Explorer? Alternately, if I were to rewrite it in F# (or even Haskell), what kinds (if any) of reliability increase might I see? Code Contracts? ASML? I realize this is subjective, and possibly argumentative, so please back up your answers with data, if possible. :) Or maybe an worked example, such as Eric Evans Cargo Shipping System? If we consider Unit tests to be pecific and strong theorems, checked quasi-statically on particular “interesting instances” and Types to be general but weak theorems (usually checked statically), and contracts to be general and strong theorems, checked dynamically for particular instances that occur during regular program operation (from B. Pierce's Types Considered Harmful, where do these other tools fit? We could pose the analogous question for Java, using Java PathFinder, Scala, etc.

    Read the article

  • How to decode a JSON String with several objects in PHP?

    - by ilnur777
    Hi, guys! I know how to decode a JSON string with one object with your help from this example http://stackoverflow.com/questions/2543389/how-to-decode-a-json-string But now I would like to improve decoding JSON string with several objects and I can't understand how to do it. Here is an example: { "programmers": [ { "firstName": "Brett", "lastName":"McLaughlin" }, { "firstName": "Jason", "lastName":"Hunter" }, { "firstName": "Elliotte", "lastName":"Harold" } ], "authors": [ { "firstName": "Isaac", "lastName": "Asimov" }, { "firstName": "Tad", "lastName": "Williams" }, { "firstName": "Frank", "lastName": "Peretti" } ], "musicians": [ { "firstName": "Eric", "lastName": "Clapton" }, { "firstName": "Sergei", "lastName": "Rachmaninoff" } ] } How to decode this JSON, call data and display on the page from what object the informartion list is being read? Thank you!

    Read the article

  • Adding an Object to Vector loses Reference using Java?

    - by thechiman
    I have a Vector that holds a number of objects. My code uses a loop to add objects to the Vector depending on certain conditions. My question is, when I add the object to the Vector, is the original object reference added to the vector or does the Vector make a new instance of the object and adds that? For example, in the following code: private Vector numbersToCalculate; StringBuffer temp = new StringBuffer(); while(currentBuffer.length() > i) { //Some other code numbersToCalculate.add(temp); temp.setLength(0); //resets the temp StringBuffer } What I'm doing is adding the "temp" StringBuffer to the numbersToCalculate Vector. Should I be creating a new StringBuffer within the loop and adding that or will this code work? Thanks for the help! Eric

    Read the article

  • Maven 2.1.0 not passing on system properties to Java virtual machine

    - by raisercostin
    We use the command line to pass on system properties to the Java virtual machine when running our Hudson builds on a Linux box. It used to work quite well in 2.0.9 by since we upgraded to 2.1.0 it has stopped working altogether. The system properties just never make it to the Java virtual machine. I have created a small test project and indeed it does not work at all. I have attached it in case you want to give it a go. This should work just fine with Maven 2.0.9: mvn2.0.9 -Dsystem.test.property=test test But this will fail: mvn2.1 -Dsystem.test.property=test test The Java code simply does this assertTrue( System.getProperty("system.test.property") != null); , Apr 20, 2009; 12:44pm edward eric pedersson

    Read the article

  • NHibernate and SetSessionAuth audit columns

    - by user86431
    We have audit columns set by triggers. For obscure security reasons predating my tenure and out of my control, we log in with a generic user, and do a 'set session authorization' to change the user to the db user of the user who is logged in. When we converted to NHibernate, it creates a whole new session and jacks everything up when we try to do a set session auth, so we turned the set session auth off... Now we are trying to find out a way to get NHibernate to let us do 'set session authorization' without recycling the session on us, so we can use our existing trigger based audit column stuff with both legacy apps, and our new NHibernate apps. It's not a ideal soloution, or the best way to do it even, but is it possible? I was hoping there was a alternate interface that allowed this kind of access. Does anyone know how to do it, or can you point me towards and good hints? Thanks, Eric-

    Read the article

  • how is this jquery app validating the username? (3rd party script)

    - by SarmenHB
    The tutorial that I'm trying to figure out is this: http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/ The username field looks like this: <input value="" class="validate[required,custom[noSpecialCaracters],length[0,20],ajax[ajaxUser]]" type="text" name="user" id="user" /> That <input> field has a class item named ajax[ajaxUser] which has its rules contained in this script (jquery.validationEngine-en.js). The snippet for that item looks like this: "ajaxUser":{ "file":"validateUser.php", "extraData":"name=eric", "alertTextOk":"* This user is available", "alertTextLoad":"* Loading, please wait", "alertText":"* This user is already taken"}, What I can't figure out at all is how its PHP page is working which is validateUser.php. Where are all those post fields coming from? I looked around and can't find a field with those names. Thanks

    Read the article

  • find xml element by attribute

    - by Moudy
    Using JQuery or Javascript how would I return 'Mary Boone' from the xml below starting out with the show 'id' attribute of '2'? I'm thinking something along the lines of - var result = xml.getElementByAttribute("2").gallery.text(); the XML: <shows> <show id="1"> <artist>Andreas Gursky</artist> <gallery>Matthew Marks</gallery> <medium>photography</medium> </show> <show id="2"> <artist>Eric Fischl</artist> <gallery>Mary Boone</gallery> <medium>painting</medium> </show> </shows>

    Read the article

  • OOP App Architecture: Which layer does a lazy loader sit in?

    - by JW
    I am planning the implemention an Inheritance Mapper pattern for an application component http://martinfowler.com/eaaCatalog/inheritanceMappers.html One feature it needs to have is for a domain object to reference a large list of aggreageted items (10,000 other domain objects) So I need some kind of lazy loading collection to be passed out of the aggregate root domain object to other domain objects. To keep my (php) model scripts organised i am storing them in two folders: MyComponent\ controllers\ models\ domain\ <- domain objects, DDD repository, DDD factory daccess\ <- PoEAA data mappers, SQL queries etc views\ But now I am racking my brains wondering where my lazy loading collection sits. Any suggestions / justifications for putting it in one place over another another? DDD = Domain Driven Design Patterns, Eric Evans - book PoEAA = Patterns of Application Architecture Patterns, Martin Fowler - book

    Read the article

  • How to get consistence rendering of <p> paragraph text in all browsers?

    - by jitendra
    How to get consistence rendering of paragraph text in all browsers? See IE 7 rendering like this and FF like this . which is ok to client How to get same result in both browsers, i mean FF rendering in IE? my client needs "non-executive" in same line in all browsers, Is <br /> only solution of this. Update : see all code for <p> here http://easycaptures.com/fs/uploaded/248/4505395091.jpg I'm already using XHTML 1.1 doctype and eric meyer reset CSS Update: 28 March Thanks for all replies! I tested this problem is only not coming on firefox . but coming in all other browser IE6, 7, 8, Safari(windows), Google Chrome. Is there any possibility css only solution now?

    Read the article

  • What programming languages do you consider indispensable in your experience?

    - by Federico Ramponi
    Each programming language comes with its concepts, best practices, libraries, tools, community, in one word: culture. Learning more than one programming language will make you a better programmer, for the more concepts you learn, the faster you will feel comfortable when the next language or technology will come. Mine, so far, are C, some C++, and Python, and many times I read that it would be worth learning LISP, for "the profound enlightenment experience you will have when you finally get it" (quoting Eric Raymond). My questions are: Which is the next one you would consider a good investment to learn? Of the many programming languages you have learnt and worked with, which ones do you consider to be an essential part of one's CS culture, and why? EDIT. Further question: is there any language you would sincerely advise to avoid as a waste of time? (The famous, and questionable, slatings in this letter from Dijkstra come to my mind.)

    Read the article

  • How to align checkboxes and their labels consistently cross-browsers

    - by One Crayon
    This is one of the minor CSS problems that plagues me constantly. How do folks around StackOverflow vertically align checkboxes and their labels consistently cross-browser? Whenever I align them right in Safari (usually using vertical-align: baseline on the input), they're completely off in Firefox and IE. Fix it in Firefox, and Safari and IE are inevitably messed up. I waste time on this every time I code a form. Here's the standard code that I work with: <form> <div> <label><input type="checkbox" /> Label text</label> </div> </form> I usually use Eric Meyer's reset, so form elements are relatively clean of overrides. Looking forward to any tips or tricks that you have to offer!

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53  | Next Page >