Search Results

Search found 1218 results on 49 pages for 'razor shadow'.

Page 19/49 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Why is the this-pointer needed to access inherited attributes?

    - by Shadow
    Hi, assume the following class is given: class Base{ public: Base() {} Base( const Base& b) : base_attr(b.base_attr) {} void someBaseFunction() { .... } protected: SomeType base_attr; }; When I want a class to inherit from this one and include a new attribute for the derived class, I would write: class Derived: public Base { public: Derived() {} Derived( const Derived& d ) : derived_attr(d.derived_attr) { this->base_attr = d.base_attr; } void SomeDerivedFunction() { .... } private: SomeOtherType derived_attr; }; This works for me (let's ignore eventually missing semicolons or such please). However, when I remove the "this-" in the copy constructor of the derived class, the compiler complains that "'base_attr' was not declared in this scope". I thought that, when inheriting from a class, the protected attributes would then also be accessible directly. I did not know that the "this-" pointer was needed. I am now confused if it is actually correct what I am doing there, especially the copy-constructor of the Derived-class. Because each Derived object is supposed to have a base_attr and a derived_attr and they obviously need to be initialized/set correctly. And because Derived is inheriting from Base, I don't want to explicitly include an attribute named "base_attr" in the Derived-class. IMHO doing so would generally destroy the idea behind inheritance, as everything would have to be defined again. EDIT Thank you all for the quick answers. I completely forgot the fact that the classes actually are templates. Please, see the new examples below, which are actually compiling when including "this-" and are failing when omiting "this-" in the copy-constructor of the Derived-class: Base-class: #include <iostream> template<class T> class Base{ public: Base() : base_attr(0) {} Base( const Base& b) : base_attr(b.base_attr) {} void baseIncrement() { ++base_attr; } void printAttr() { std::cout << "Base Attribute: " << base_attr << std::endl; } protected: T base_attr; }; Derived-class: #include "base.hpp" template< class T > class Derived: public Base<T>{ public: Derived() : derived_attr(1) {} Derived( const Derived& d) : derived_attr(d.derived_attr) { this->base_attr = d.base_attr; } void derivedIncrement() { ++derived_attr; } protected: T derived_attr; }; and for completeness also the main function: #include "derived.hpp" int main() { Derived<int> d; d.printAttr(); d.baseIncrement(); d.printAttr(); Derived<int> d2(d); d2.printAttr(); return 0; }; I am using g++-4.3.4. Although I understood now that it seems to come from the fact that I use template-class definitions, I did not quite understand what is causing the problem when using templates and why it works when not using templates. Could someone please further clarify this?

    Read the article

  • Using JQuery to traverse DOM structure, finding a specific <table> element located after HTML 'comme

    - by Shadow
    I currently have a website source code (no control over the source) which contains certain content that needs to be manipulated. This would be simple on the surface, however there is no unique ID attribute on the tag in question that can uniquely identify it, and therefore allow for further traversal. Here is a snippet of the source code, surrounding the tag in question. ... <td width="100%"> <!--This table snaps the content columns(one or two)--> <table border="0" width="100%"> ... Essentially, the HTML comment stuck out as an easy way to gain access to that element. Using the JQuery comment add-on from this question, and some help from snowlord comment below, I have been able to identify the comment and retrieve the following output using the 'dump' extension. $('td').comments().filter(":contains('This table snaps the content columns(one or two)')").dump(); returns; jQuery Object { 0 = DOMElement [ nodeName: DIV nodeValue: null innerHTML: [ 0 = String: This table snaps the content columns(one or two) ] ] } However I am not sure how to traverse to the sibling element in the DOM. This should be simple, but I haven't had much selector experience with JQuery. Any suggestions are appreciated.

    Read the article

  • scanf segfaults and various other anomalies inside while loop

    - by Shadow
    while(1){ //Command prompt char *command; printf("%s>",current_working_directory); scanf("%s",command);<--seg faults after input has been received. printf("\ncommand:%s\n",command); } I am getting a few different errors and they don't really seem reproducible(except for the segfault at this point .<). This code worked fine about 10 minutes ago, then it infinite looped the printf command and now it seg faults on the line mentioned above. The only thing I changed was scanf("%s",command); to what it currently is. If I change the command variable to be an array it works, obviously this is because the storage is set aside for it. 1) I got prosecuted about telling someone that they needed to malloc a pointer* (But that usually seems to solve the problem such as making it an array) 2) the command I am entering is "magic" 5 characters so there shouldn't be any crazy stack overflow. 3) I am running on mac OSX 10.6 with newest version of xCode(non-OS4) and standard gcc 4) this is how I compile the program: gcc --std=c99 -W sfs.c Just trying to figure out what is going on. Being this is for a school project I am never going to have to see again, I will just code some noob work around that would make my boss cry :) But for afterwards I would love to figure out why this is happening and not just make some fix for it, and if there is some fix for it why that fix works.

    Read the article

  • .net - how to connect windows service with systray application

    - by razor
    I have a windows service that do something periodically. on user account runs systray application (written in C#) that communicate with windows service (thru .net remoting) and shows a status and some option to users. Everything works well beside that systray app uses 20-30MB of RAM ! it have to work in terminal environment, when 50 users login, only systray apps take 1GB of RAM ! and i don't have to add, that's wrong :) Is it possible to write .net systray application that will be small ? (1-2MB max?) or should I write it in c/c++? then, what kind of communication should I use between windows service (written in C#) and systray app ?

    Read the article

  • How do I make faint words in search bar that go away when you click/type?

    - by Razor Storm
    So, for instance facebook's search bar has faint word that says "search", but when you click on the bar, it becomes blank and you may begin typing, when you click away the "search" goes back. Similarly, SO's ask a question title box has faint words that go away when you start typing. I'm not too sure what this effect is called, but I'm wondering if theres a jQuery plugin that helps to achieve this. This isn't particularly difficult to program, but I thought why reinvent the wheel if someone already made a plugin for it.

    Read the article

  • Weak hashmap with weak references to the values?

    - by Razor Storm
    I am building an android app where each entity has a bitmap that represents its sprite. However, each entity can be be duplicated (there might be 3 copies of entity asdf for example). One approach is to load all the sprites upfront, and then put the correct sprite in the constructors of the entities. However, I want to decode the bitmaps lazily, so that the constructors of the entities will decode the bitmaps. The only problem with this is that duplicated entities will load the same bitmap twice, using 2x the memory (Or n times if the entity is created n times). To fix this, I built a SingularBitmapFactory that will store a decoded Bitmap into a hash, and if the same bitmap is asked for again, will simply return the previously hashed one instead of building a new one. Problem with this, though, is that the factory holds a copy of all bitmaps, and so won't ever get garbage collected. What's the best way to switch the hashmap to one with weakly referenced values? In otherwords, I want a structure where the values won't be GC'd if any other object holds a reference to it, but as long as no other objects refers it, then it can be GC'd.

    Read the article

  • IIS 7 with PHP 5.2 - Error 500

    - by Razor
    I have a fresh install of IIS 7 - I just added Web Platform Installer, and PHP 5.2 thru that. However, when trying to access to a simple test.php file (just has phpinfo() in it), I get the following list of errors: • IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly. • IIS was not able to process configuration for the Web site or application. • The authenticated user does not have permission to use this DLL. • The request is mapped to a managed handler but the .NET Extensibility Feature is not installed. Any idea of what I'm doing wrong here?

    Read the article

  • whats wrong with this peace of code for saving contacts

    - by Shadow
    Hi, i am using the latest Nokia Qt SDK. i have tried to add the contacts, its not getting added.. what is missing here.. // Construct contact manager for default contact backend QContactManager* cm = new QContactManager("simulator"); // QContactManager* cm = new QContactManager("memory"); // i tried this, its also not working // Create example contact QContact example; // Add contact name QContactName name; name.setFirstName("John"); name.setLastName("Doe"); example.saveDetail(&name); // Add contact email address //QContactEmailAddress email; // email.setContexts(QContactDetail::ContextHome); //email.setEmailAddress(“[email protected]”); // example.saveDetail(&email); // Finally, save the contact details cm->saveContact(&example); delete cm; Thanks

    Read the article

  • Dynamically alter outter div as inner one gets bigger.

    - by Razor Storm
    I have two divs, one inside another. The outter one is called #wrapper, while the inner one is called #pad. Now #pad allows user input, and I have a javascript (jQuery) function that changes the content of #pad based on what the user input is. Sometimes, because of this function, #pad's content will cause the div to become more elongated than before. Now obviously I would wish for #wrapper to grow longer as well to accommodate this change in #pad's length. However, this does not occur. #wrapper { clear:both; padding-top:0.5em; /*padding-left:50px;*/ height: 100%; background-color: rgba(255,255,255,0.4); -moz-border-radius: 20px 20px 0px 0px; -webkit-border-radius: 20px 20px 0px 0px; border-radius: 20px 20px 0px 0px; } #pad { margin-top: 25px; -moz-border-radius: 5px; border: solid 1px #DDD; margin-left:25px; padding-left:25px; margin-right:25px; padding-right:25px; margin-bottom:2em; } This is the javascript function: function preview() { var id1=$("#input1").val(); var id2=$("#input2").val(); var id3=$("#input3").val(); var id4=$("#input4").val(); var id5=$("#input5").val(); if(id1!= null && id1!="") { if( $("#preview1").attr("src")!=id1) { $("#preview1").attr("src",id1); $("#preview1").fadeIn("slow"); } } else { $("#preview1").attr("src",""); $("#preview1").fadeOut("slow"); } if(id2!= null && id2!="") { if( $("#preview2").attr("src")!=id2) { $("#preview2").attr("src",id2); $("#preview2").fadeIn("slow"); } } else { $("#preview2").attr("src",""); $("#preview2").fadeOut("slow"); } if(id3!= null && id3!="") { if( $("#preview3").attr("src")!=id3) { $("#preview3").attr("src",id3); $("#preview3").fadeIn("slow"); } } else { $("#preview3").attr("src",""); $("#preview3").fadeOut("slow"); } if(id4!= null && id4!="") { if( $("#preview4").attr("src")!=id4) { $("#preview4").attr("src",id4); $("#preview4").fadeIn("slow"); } } else { $("#preview4").attr("src",""); $("#preview4").fadeOut("slow"); } if(id5!= null && id5!="") { if( $("#preview5").attr("src")!=id5) { $("#preview5").attr("src",id5); $("#preview5").fadeIn("slow"); } } else { $("#preview5").attr("src",""); $("#preview5").fadeOut("slow"); } setTimeout("preview()",1000); $("#wrapper").attr("height",$(document).attr("height")); } http://surveys.mylifeisberkeley.com/

    Read the article

  • Private API and SMS content URI's on Android

    - by Shadow
    Without accessing private API's to get Content URI's, etc. for SMS, how are we expected to query this data? I am currently in the process of writing my own SMS app and I want to stay as compatible as possible. Without storing the information myself in my own database (such that I can store the text messages so that other programs can access the data when/if they delete my app) and without using private API's how the heck are we suppose to query SMS data?

    Read the article

  • what property should i set to Fit the text in label

    - by Shadow
    Hi, i want to display a big string in Qlablel for this simply i have created a label in Qt GUI editor, then i put the string, with the Wordwrap property ON. here text is not coming to the next line itself, instead its crossing the view region. but if i give "\n" it works well. how to put up big string in label, to display in visible region.

    Read the article

  • Identical CSS behaves differently when applied to either body or a div

    - by Razor
    Using a DIV as container <div class="container"> <div class="half-hidden"></div> </div> CSS .container { margin: 20px auto 0; width: 200px; height: 200px; border: 1px solid red; position: relative; overflow: hidden; } .half-hidden { position: absolute; top: 10px; bottom: 10px; left: -50px; width: 100px; border: 1px solid teal; } Using body as container <div class="half-hidden"></div> CSS Replace the above .container with body Why?

    Read the article

  • How can I find out how much memory an object (rather the instance of an object) of a C++ class consu

    - by Shadow
    Hi, I am developing a Graph-class, based on boost-graph-library. A Graph-object contains a boost-graph, so to say an adjacency_list, and a map. When monitoring the total memory usage of my program, it consumes quite a lot (checked with pmap). Now, I would like to know, how much of the memory is exactly consumed by a filled object of this Graph-class? With filled I mean when the adjacency_list is full of vertices and edges. I found out, that using sizeof() doesn't bring me far. Using valgrind is also not an alternative as there is quite some memory allocation done previously and this makes the usage of valgrind impractical for this purpose. I'm also not interested in what other parts of the program cost in memory, I want to focus on one single object. Thank you.

    Read the article

  • How to install the Qt mobility ?

    - by Shadow
    Hi, i have installed Qt 4.6.2 and developing the application for symbian. Now i want use Qt mobility API for accessing the contacts.. how can i install the Qt mobility and acces the API.. my build environment is windows XP :) Thanks

    Read the article

  • whats wrong with this piece of code for saving contacts

    - by Shadow
    Hi, i am using the latest Nokia Qt SDK. i have tried to add the contacts, its not getting added.. what is missing here.. // Construct contact manager for default contact backend QContactManager* cm = new QContactManager("simulator"); // QContactManager* cm = new QContactManager("memory"); // i tried this, its also not working // Create example contact QContact example; // Add contact name QContactName name; name.setFirstName("John"); name.setLastName("Doe"); example.saveDetail(&name); // Add contact email address //QContactEmailAddress email; // email.setContexts(QContactDetail::ContextHome); //email.setEmailAddress(“[email protected]”); // example.saveDetail(&email); // Finally, save the contact details cm->saveContact(&example); delete cm; Thanks

    Read the article

  • Specify fields in a recursive find with cakephp

    - by Razor Storm
    Suppose I have a table Recipe that hasmany ingredients. I do a recursive find to grab recipes with their associated ingredients: $this->Recipe->find('all', array('fields' => array('id','title','description'))); Here I can use the 'fields' attribute to specify that I only want it to return id, title, and description. However, despite this, cakephp still returns ALL columns from the ingredients table. How do I tell cakephp that I only want ingredient table's id and name fields? btw ingredient model is "Ingredient" and the table is ingredients, and the aggregation table is recipes_ingredients.

    Read the article

  • wget: retrieving files recursively

    - by Shadow
    When using wget with the recursive option turned on I am getting an error message when it is trying to download a file. It thinks the link is a downloadable file when in reality it should just be following it to get to the page that actually contains the files that I want. wget -r -l 16 --accept=jpg website.com The error message is: .... since it should be rejected. This usually occurs when the website link it is trying to fetch ends with a sql statement. The problem however doesn't occur when using the very same wget command on that link. I want to know how exactly it is trying to fetch the pages. I guess I could always take a poke around the source although I don't know how messy the project is.

    Read the article

  • How can I find out how much memory an instance of a C++ class consumes?

    - by Shadow
    Hi, I am developing a Graph-class, based on boost-graph-library. A Graph-object contains a boost-graph, so to say an adjacency_list, and a map. When monitoring the total memory usage of my program, it consumes quite a lot (checked with pmap). Now, I would like to know, how much of the memory is exactly consumed by a filled object of this Graph-class? With filled I mean when the adjacency_list is full of vertices and edges. I found out, that using sizeof() doesn't bring me far. Using valgrind is also not an alternative as there is quite some memory allocation done previously and this makes the usage of valgrind impractical for this purpose. I'm also not interested in what other parts of the program cost in memory, I want to focus on one single object. Thank you.

    Read the article

  • How to create url preview in javascript?

    - by Razor Storm
    Can someone help me with creation of a url preview script in javascript? What I mean is this. Say I have a link on my site, I want the user to be able to mouse over the link, and have an image pop up that shows what the target of the link looks like. Don't worry about the css, I got that working, I just need the actual script to show the image. Currently I am doing it by showing up an iframe that actually renders the page, but this is not scalable and looks ugly. No, having the page display premade images is not an option, since the links will be linking to dynamically generated user content. thanks

    Read the article

  • How can I find out how much memory an object of a C++ class consumes?

    - by Shadow
    Hi, I am developing a Graph-class, based on boost-graph-library. A Graph-object contains a boost-graph, so to say an adjacency_list, and a map. When monitoring the total memory usage of my program, it consumes quite a lot (checked with pmap). Now, I would like to know, how much of the memory is exactly consumed by a filled object of this Graph-class? With filled I mean when the adjacency_list is full of vertices and edges. I found out, that using sizeof() doesn't bring me far. Using valgrind is also not an alternative as there is quite some memory allocation done previously and this makes the usage of valgrind impractical for this purpose. I'm also not interested in what other parts of the program cost in memory, I want to focus on one single object. Thank you.

    Read the article

  • how do i install a game patch on an external hard drive

    - by shadow
    I have a 2tb external hard drive and I want to install battlefield 1942 on it. i can get the game on the hard drive without problems, and it runs great. the problem is that i have an outdated version, and i need to install a patch. thats when it gets iffy. i get the patch and start the install, and it finishes, but it doesnt install to the game itself. it goes to its own seperate folder, and that does nothing to the game. the patch installer doesnt ask me where the game is, and so im thinking that it cant find the game itself, and then screws up. any help would be great!

    Read the article

  • How to get the Displayed Webpage source

    - by Shadow
    Hi, how can i get the web-page source displayed on a web-browser control, either in c# or Win32.even ATL COM also fine. i mean.. i dont want to create new "HTTPReqest" or "openURL" to get source.. i want to get the source from the control only..is it possible for windows mobile.. if so how?.. please let me know. Thank u

    Read the article

  • Safe way for getting/finding a vertex in a graph with custom properties -> good programming practice

    - by Shadow
    Hi, I am writing a Graph-class using boost-graph-library. I use custom vertex and edge properties and a map to store/find the vertices/edges for a given property. I'm satisfied with how it works, so far. However, I have a small problem, where I'm not sure how to solve it "nicely". The class provides a method Vertex getVertex(Vertexproperties v_prop) and a method bool hasVertex(Vertexproperties v_prop) The question now is, would you judge this as good programming practice in C++? My opinion is, that I have first to check if something is available before I can get it. So, before getting a vertex with a desired property, one has to check if hasVertex() would return true for those properties. However, I would like to make getVertex() a bit more robust. ATM it will segfault when one would directly call getVertex() without prior checking if the graph has a corresponding vertex. A first idea was to return a NULL-pointer or a pointer that points past the last stored vertex. For the latter, I haven't found out how to do this. But even with this "robust" version, one would have to check for correctness after getting a vertex or one would also run into a SegFault when dereferencing that vertex-pointer for example. Therefore I am wondering if it is "ok" to let getVertex() SegFault if one does not check for availability beforehand?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >