Search Results

Search found 1588 results on 64 pages for 'pure'.

Page 41/64 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Does C++ have a static polymorphism implementation of interface that does not use vtable?

    - by gilbertc
    Does C++ have a proper implementation of interface that does not use vtable? for example class BaseInterface{ public: virtual void func() const = 0; } class BaseInterfaceImpl:public BaseInterface{ public: void func(){ std::cout<<"called."<<endl; } } BaseInterface* obj = new BaseInterfaceImpl(); obj->func(); the call to func at the last line goes to vtable to find the func ptr of BaseInterfaceImpl::func, but is there any C++ way to do that directly as the BaseInterfaceImpl is not subclassed from any other class besides the pure interface class BaseInterface? Thanks. Gil.

    Read the article

  • (this == null) in C#!

    - by SLaks
    Due to a bug that was fixed in C# 4, the following program prints true. (Try it in LINQPad) void Main() { new Derived(); } class Base { public Base(Func<string> valueMaker) { Console.WriteLine(valueMaker()); } } class Derived : Base { string CheckNull() { return "Am I null? " + (this == null); } public Derived() : base(() => CheckNull()) { } } In VS2008 in Release mode, in throws an InvalidProgramException. (In Debug mode, it works fine) In VS2010 Beta 2, it doesn't compile (I didn't try Beta 1); I learned that the hard way Is there any other way to make this == null in pure C#?

    Read the article

  • On Memory Allocation and C++

    - by Arpan
    And I quote from MSDN http://msdn.microsoft.com/en-us/library/aa366533(VS.85).aspx: The malloc function has the disadvantage of being run-time dependent. The new operator has the disadvantage of being compiler dependent and language dependent. Now the questions folks: a) What do we mean that malloc is run-time dependent? What kind of dynamic memory allocation functions can be independent of run-time? This statement sounds real strange. b) new is language dependent? Of course it should be right? Are HeapAlloc, LocalAlloc etc language independent? c) From a pure performance perspective are the MSVC provided routines preferable? Arpan

    Read the article

  • c++ "interface"-like classes similar to Java?

    - by William the Coderer
    In Java, you can define an interface as a class with no actual code implementation, but only to define the methods that a class must implement. Those types can be passed as parameters to methods and returned from methods. In C++, a pure virtual class can't be used as a parameter or return type, from what I can tell. Any way to mimic Java's interface classes? I have a string class in C++, and several subclasses for different encodings (like UTFxxx, ISOxxx, etc) that derive from the base string class. However, since there are so many different encodings, the base class has no meaningful implementation. But it would serve well as an interface if I could handle it as its own object and calls to that object would call on the correct subclass it was inherited to.

    Read the article

  • Looking for substantial open source GWT/App-Engine project to use as reference

    - by tempy
    I'm working on GAE-J/GWT app, wherein a desktop app connects to the GAE-J component, and there is also a web-app component whose front-end is written in GWT, and the GAE-J backend supports both the desktop app and the web app. I have a good amount of experience with writing pure server code and desktop code, but not so much on the web-app side of things. So I'm looking to study some good sophisticated open source code to see how other's have done things, but I can't find much open source GWT and/or GAE-J stuff, other than frameworks. Does anyone know of any good projects out there?

    Read the article

  • Drawing rectangles on a grid in a web browser

    - by Dhruv
    I would like to create an online, simple WYSIWYG drawing editor allowing people to draw rectangular shapes. I'm thinking of a grid which the lines and points can snap on to, ensuring that the lines are strictly vertical or horizontal. I will be parsing the rectangular shapes to obtain some area calculations and compute certain things. How can I achieve the drawing ability? The new canvas tag is good but people have been telling me that IE does not support it. I found some Java applets but I have never programmed in Java before. Is there a way to do this using pure javascript or jquery? Does ASP.NET help at all? Thanks.

    Read the article

  • How do I extend the classpath used for 'grails run-app'

    - by Eric
    I have the following in my Config.groovy file: grails.config.locations = [ "classpath:env.groovy" ] Now, where exactly am I supposed to place "env.groovy" such that it is available on the CLASSPATH during grails run-app? The documentation here is sorely lacking. I am able to get it to work on the pure commandline by placing "env.groovy" in $APP_HOME/etc and then running: $ grails -classpath ./etc run-app This seems a little hackish, but I can live with it... However, I am unable to get any such configuration working when I launch run-app using the Grails eclipse plugin (STS): Unable to load specified config location classpath:env.groovy : class path resource [env.groovy] cannot be opened because it does not exist I've seen related posts here, here, here, and here but the answers have been unfulfilling. I am looking for a CLASSPATH-based solution that will work with 'run-app' in development mode (both commandline and from eclipse). I know how to set up the CLASSPATH for my deployment servlet container, so that is not an issue.

    Read the article

  • is it better to use a "natural" language to write code?

    - by M.H
    I recently saw a programming language called supernova and they said in the web page : The Supernova Programming language is a modern scripting language and the First one presents the concept of programming with direct Fiction Description using Clear subset of pure Human Language. and you can write code like: i want window and the window title is Hello World. i want button and button caption is Close. and button name is btn1. btn1 mouse click. instructions are you close window end of instructions my question is not about the language itself but it is that are we need such languages and did they make writing code easier or not?

    Read the article

  • Get signature from a file

    - by Eugen
    I have a php code that gets a signature for a file using such a code shell_exec("openssl smime -binary -sign". " -certfile '".$keyPath."/WWDR.pem'". " -signer '".$keyPath."/passcertificate.pem'". " -inkey '".$keyPath."/passkey.pem'". " -in '".$this->workFolder."/manifest.json'". " -out '".$this->workFolder."/signature'". " -outform DER -passin pass:'$pass'"); I need to have a pure managed C# code that would the same? Any idea how to do this? Thx

    Read the article

  • How do you have grayed out text in a textfield that dissapears when the user clicks on it

    - by John Smith
    In HTML & JS, how do you make a textfield that has grayed out text telling the user what the field is for that goes away when the user clicks on the field? For example, in firefox the search field in the top right hand side says which search engine it uses when there's nothing entered, then once you click it's an empty textfield, but if you leave it blank and remove focus from the textfield then the grayed out text is back again. Is there a name for this behavior? Also, is it possible to do in pure css without the use of js to do the on focus / on blur events?

    Read the article

  • Creating a Better Tabbed Interface in Django

    - by ygd
    I've been trying to create a tabbed interface using Django. The current effort (which works fine) is having each template have the header hard-coded in, with the selected tab given the "selected" CSS attribute. Of course, this is a massive violation of DRY and I'm looking to remedy it. My current idea is adding a jQuery script to the page that looks at all the tabs and sets one to "selected" if it's text matches the beginning of the title for the page. Is there a better way to do this without using JavaScript and just pure CSS?

    Read the article

  • How are python pages coded and what can the language be compared to? [closed]

    - by avon_verma
    I have a few questions about python I've seen many pages like these on Google http://mail.google.com/support/bin/answer.py?answer=6583 https://www.google.com/adsense/support/bin/topic.py?topic=13488 ...that have .py extensions. 1: Are pages like these built on pure python code, but printing out html like print "<div etc..." or like the typical asp,jsp,php type of pages with html pages and embedded python code like: <html> <% some python code %> </html> 2: What is python mainly used for making? windows apps or web or .. ? 3: Are ruby and perl also similar to python?

    Read the article

  • Force Response to Download File(s) to Desktop with Ruby?

    - by viatropos
    I was thinking about making a little crop/resize batch processor online, and wanted to know if there was a way for me to do the following: upload image and specify dimensions click "process" and remote app resizes image image downloads automatically locally to wherever it was I uploaded it (say from my desktop), but with a new name (based on the time for example). This would make it so I could host a free image processor that never stored any data other than tempfiles. Is that possible? Something like Rails' send_file method, but I'm using Sinatra and am looking for something in pure ruby. What's the basic concept behind this? What if I wanted to do this for multiple files? Åssuming I can get multiple files uploaded no problem, how can I download all of them automatically?

    Read the article

  • Qt applications on new Mac App Store

    - by PDI
    I have a Qt app that runs on OS X that has potential to go on the new Mac App Store. I have reviewed the guidelines at https://developer.apple.com/appstore/mac/resources/approval/guidelines.html. I also saw a post here on SO about Java and the AppStore. Has anyone else considered this with their own apps and whether or not the Qt framework will run afoul of the App police? You still have to stay within the Apple HIG, i.e. no theming and cannot use private APIs. Still seems like a risky proposition over pure ObjC. Anyone else tempted?

    Read the article

  • JSF (and friends) tags vs. traditional html tags

    - by H3wh0s33ks
    So this question came up today and I didn't have a specific or scientific answer. What are the costs associated with using jsf (or tomahawk, faclets, etc., etc.) tags in place of traditional html tags. My gut reaction is that you should use jsf tags in situations where you need the additional functionality they provide, and use traditional tags when you don't. Also I feel like jsf tags would require more resources (since the server has to take them and rerender them as html anyways) than html. Does anybody know what the cost actually is (as far as time and memory)? Also useful information is what is the convention that is in use, pure jsf or a mixture of the two?

    Read the article

  • DJANGO complex modelling

    - by SledgehammerPL
    Hello. I have such model now: receipt contains components. component contain product. The difference between component and product is, that component has quantity and measure unit: eg. component is 100g sugar - sugar is a product. So I need to make lots of components to satisfy different recipes - 100g sugar is not equal 200g sugar I wonder if I can remodel it to kick off components - in pure sql it's rather easy, but I'm trying to USE django - not making workarounds. class Receipt(models.Model): name = models.CharField(max_length=128) (...) components = models.ManyToManyField(Component) class Component(models.Model): quantity = models.FloatField(max_length=9) unit = models.ForeignKey(Unit) product = models.ForeignKey(Product) class Product(models.Model): name = models.CharField(max_length = 128) TIA

    Read the article

  • How i call NSObject method in UIViewController class method?

    - by Rajendra Bhole
    Hi,I am the beginner in iphone development. I develop an application in which i calling some GPS related information(method name is getGPSInformation{}) in clsGPS{} is an pure NSObject class.The code is as follows, import "clsGPS.h" -(void)getGPSInformation { locationManager = [[CLLocationManager alloc ] init]; locationManager.delegate = self; locationManager.distanceFilter = 5.0f; locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; [locationManager startUpdatingLocation]; } I want the above method calling in UIViewController class. How i call this method in UIViewController class from that i automatically call this method at application launching time? should i calling that method in viewDidLoad event or viewWillAppear method?

    Read the article

  • How can this code be made more Pythonic?

    - by usethedeathstar
    This next part of code does exactly what I want it to do. dem_rows and dem_cols contain float values for a number of things i can identify in an image, but i need to get the nearest pixel for each of them, and than to make sure I only get the unique points, and no duplicates. The problem is that this code is ugly and as far as I get it, as unpythonic as it gets. If there would be a pure-numpy-solution (without for-loops) that would be even better. # next part is to make sure that we get the rounding done correctly, and than to get the integer part out of it # without the annoying floatingpoint-error, and without duplicates fielddic={} for i in range(len(dem_rows)): # here comes the ugly part: abusing the fact that i overwrite dictionary keys if I get duplicates fielddic[int(round(dem_rows[i]) + 0.1), int(round(dem_cols[i]) + 0.1)] = None # also very ugly: to make two arrays of integers out of the first and second part of the keys field_rows = numpy.zeros((len(fielddic.keys())), int) field_cols = numpy.zeros((len(fielddic.keys())), int) for i, (r, c) in enumerate(fielddic.keys()): field_rows[i] = r field_cols[i] = c

    Read the article

  • Ideas for using R to create a T-shirt design (for useR 2010) ?

    - by Tal Galili
    There is now a competition for creating a T-shirt design for useR2010. Someone proposed the idea to use R for creating the T-shirt image. Which leads me to my questions: What type of images do you think might be fitting for this? How would you suggest to use R to create the images ? Would anyone here want to have a go at it? (p.s: I understand this is not a pure "programming" question. Yet it involves R programming, the understanding of R aesthetics, and some caring for the R community. I also understand I am at the risk of annoying people here with this question, so in case that happens - I deeply apologies! My only justification is that I am acting in good faith and in the purpose of having nice things for R users to enjoy, while learning something in the process) Related thread I once opened: http://stackoverflow.com/questions/2162131/how-can-i-learn-to-create-beautiful-infographics-with-connection-to-my-r-knowled

    Read the article

  • Type hinting and optional attributes in PHP

    - by Álvaro G. Vicario
    I have a class method that deals with dates: public function setAvailability(DateTime $start, DateTime $end){ } Since item availability can have lower limit, upper limit, both or none, I'd like to make setAvailability() accept NULL values as well. However, the NULL constant violates the type hinting: $foo->setAvailability(NULL, $end); triggers: Catchable fatal error: Argument 1 passed to Foo::setAvailability() must be an instance of DateTime, null given And, as far as I know, I cannot have a DateTime instance with no value. (Can I?) For a reason I cannot grasp, this seems to work: public function setAvailability(DateTime $start=NULL, DateTime $end=NULL){ } ... $foo->setAvailability(NULL, $end); But it looks like a hack that works by pure chance. How would you deal with unset dates in PHP classes?

    Read the article

  • Translating this query in LINQ ? (list of like)

    - by Erick
    I would like to translate this query in LINQ ... it is very easy to construct if we do it in pure SQL but in dynamically created LINQ query (building a search query based on user input) it's a whole new story. SELECT * FROM MyTable WHERE 1=1 AND Column2 IN (1,2,3) AND ( Column1 LIKE '%a%' OR Column1 LIKE '%b%' ) Now to try to construct this we tried it this way : if(myOjb.Column2Collection != null) query = query.where(f => f.Column2.Contains(myOjb.Column2Collection)); if(myObj.Column1Collection != null) { // tough part here ? //query = query.Where(); ... } So what would be the best aproach to this normally ? Note that I am aware of the SqlMethod.Like, tho I can't figure a way to implement it here ...

    Read the article

  • How is fseek() implemented in the filesystem?

    - by pajton
    This is not a pure programming question, however it impacts the performance of programs using fseek(), hence it is important to know how it works. A little disclaimer so that it doesn't get closed. I am wondering how efficient it is to insert data in the middle of the file. Supposing I have a file with 1MB data and then I insert something at the 512KB offset. How efficient would that be compared to appending my data at the end of the file? Just to make the example complete lets say I want to insert 16KB of data. I understand the answer varies depending on the filesystem, however I assume that the techniques used in common filesystems are quite similar and I just want to get the right notion of it.

    Read the article

  • c++: strange syntax in what() method of std::exception

    - by Patrick Oscity
    When i am inheriting from std::exception in order to define my own exception type, i need to override the what() method, which has the following signature: virtual const char* what() const throw(); This definitely looks strange to me, like if there were two method names in the signature. Is this some very specific syntax, like with pure virtual methods, e.g.: virtual int method() const = 0; or is this a feature, that could somehow be used in another context, too? And if so, for what could it be used?

    Read the article

  • Qt/C++ event loop exception handling

    - by Georg
    I am having an application heavily based on QT and on a lot of third party libs. THese happen to throw some exceptions in several cases. In a native Qt App this causes the application to abort or terminate. Often the main data model is still intact as I am keeping it in pure Qt with no external data. So I am thinking that I could also just recover by telling the user that there has occured an error in this an that process and he should save now or even decide to continue working on the main model. Currently the program jsut silently exits without even telling a story. Please help.

    Read the article

  • Instance where embedded C++ compilers don't support multiple inheritance?

    - by Nathan
    I read a bit about a previous attempt to make a C++ standard for embedded platforms where they specifically said multiple inheritance was bad and thus not supported. From what I understand, this was never implemented as a mainstream thing and most embedded C++ compilers support most standard C++ constructs. Are there cases where a compiler on a current embedded platform (i.e. something not more than a few years old) absolutely does not support multiple inheritance? I don't really want to do multiple inheritance in a sense where I have a child with two full implementations of a class. What I am most interested in is inheriting from a single implementation of a class and then also inheriting one or more pure virtual classes as interfaces only. This is roughly equivalent to Java/.Net where I can extend only one class but implement as many interfaces as I need. In C++ this is all done through multiple inheritance rather than being able to specifically define an interface and declare a class implements it.

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >