Search Results

Search found 8634 results on 346 pages for 'base'.

Page 7/346 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • C++: Binding to a base class

    - by Helltone
    The following code works, but I'm not sure it is correct/portable. #include <iostream> #include <tr1/functional> class base { public: base(int v) : x(v) {} protected: int x; }; class derived : public base { public: bool test() { return (x == 42); } }; int main(int argc, char* argv[]) { base b(42); if(std::tr1::bind((bool (base::*)()) &derived::test, b)()) { std::cout << "ok\n"; } return 0; }

    Read the article

  • Extending ENUM valus inherited from base object

    - by Tim
    Hi, If I defined a ENUM in a base object with serveral default values. When I inherit from the base object I want to add more options the the ENUM list which are specific to the inheriting object. For example my base could have a ENUM called Direction with values: None ALL Stop Start I create a new class call Compass which inherits the base class and what to add the following to the ENUM Direction. North South East West I create a new class call Navigation which inherits the base class and what to add the following to the ENUM Direction. Left Right So, In my inheriting class haow do I extend the ENUM. I am using VB.NET. Regards

    Read the article

  • How to set Delphi WebBrowser Base directory different that HTML location

    - by Steve
    I have a Delphi program that creates HTML files. Later when a button is pressed a TWebBrowser is created and a WebBrowser.Navigate causes the html page to display. Is there anyway to set the WebBrowser "default directory" so it will always be the location of the Delphi executable not the HTML file? I do not want to set the Base value in the HTML to a hardcoded value because then when the HTML is ran from another Delphi exe they are not found. for example: if the exe is run from D:\data\delphi\pgm.exe then the base location D:\data\delphi\ and the jpgs are at D:\data\delphi\jpgs\ but if the exe is run from: C:\stuff\pgm.exe i want the base location to be C:\stuff\ and the jpgs to be at C:\stuff\jpgs\ So I cannot write a line in the HTML with the base location since when it is ran from another exe it would point to wrong location for that exe. So I either need to set the base location when I create the webbrowser and before I read the HTML or I need a way to pass into the webbrowser the location where I can then set the base location. Sorry for being so long-winded but I could not figure out how to saw what I needed.

    Read the article

  • Ideas Needed for a Base Code System

    - by Tegan Snyder
    I've developed a PHP web application that is currently in need of a strategic restructuring. Currently when we setup new clients we give them the entire code base on a subdomain of our main domain and create a new table for them in the database. This results in each client having the entire codebase, meaning when we make bug changes, fixes we have to go back and apply them independently across all clients and this is a pain. What I'd like to create is a base code server that holds all the core PHP files. base.domain.com Then all of our clients (client.domain.com) will only need a few files: config.php would have the database connection information. index.php - displays the login box if session non-existant, otherwise it loads baseline code via remote includes to base.domain.com. My question is does my logic seem feasible? How do other people handle similar situations by having a base code? Also.... Is it even possbile to remotely include PHP files from base.domain.com and include them in client.domain.com? Thanks, Tegan

    Read the article

  • VB.NET class inherits a base class and implements an interface issue (works in C#)

    - by 300 baud
    I am trying to create a class in VB.NET which inherits a base abstract class and also implements an interface. The interface declares a string property called Description. The base class contains a string property called Description. The main class inherits the base class and implements the interface. The existence of the Description property in the base class fulfills the interface requirements. This works fine in C# but causes issues in VB.NET. First, here is an example of the C# code which works: public interface IFoo { string Description { get; set; } } public abstract class FooBase { public string Description { get; set; } } public class MyFoo : FooBase, IFoo { } Now here is the VB.NET version which gives a compiler error: Public Interface IFoo Property Description() As String End Interface Public MustInherit Class FooBase Private _Description As String Public Property Description() As String Get Return _Description End Get Set(ByVal value As String) _Description = value End Set End Property End Class Public Class MyFoo Inherits FooBase Implements IFoo End Class If I make the base class (FooBase) implement the interface and add the Implements IFoo.Description to the property all is good, but I do not want the base class to implement the interface. The compiler error is: Class 'MyFoo' must implement 'Property Description() As String' for interface 'IFoo'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers. Can VB.NET not handle this, or do I need to change my syntax somewhere to get this to work?

    Read the article

  • Common protected data member in base class?

    - by EXP0
    I have a base class and several derived classes. The derived classes use some common data, can I just put those common data as protected member of the base class? I know the protected member breaks encapsulation sometimes, so I wonder if there is any good approach. Here is a specific example: class Base{ public: virtual void foo() = 0; void printData(); protected: std::vector<std::string> mData; } class Dr1 : public Base{ public: virtual void foo(); //could change mData } class Dr2 : public Base{ public: virtual void foo(); //could change mData } If I put mData into Dr1 and Dr2 as private member, then I need to put it in both of them, and I can not have printData() in Base since printData() need access to mData unless I make printData() virtual and have identical function in both Dr1 and Dr2, which doesn't make much sense to me. Is there a better way to approach this without using protected member? Thank you.

    Read the article

  • Is there a decent way to maintain development of wordpress sites using the same base?

    - by Joakim Johansson
    We've been churning out wordpress sites for a while, and we'd like to keep a base repository that can be used when starting a new project, as well as updating existing sites with changes to the wordpress base. Am I wrong in assuming this would be a good thing? We take care of updating the sites, so having a common base would make this easier. I've been looking at solutions using git, such as forking a base repository and using it to pull changes to the wordpress base, but committing the site to it's own repository. Or maybe, if it's possible, storing the base as a git submodule, but this would require storing themes and plugins outside of that. Is there any common way to go about this kind of website development?

    Read the article

  • with nginx having the base url rewrite to https

    - by jchysk
    I'd like only my base domain www.domain.com to be rewritten to https://www.domain.com By default in my https block I have it reroute to http:// if it's not ~uri = "/" (base domain) or static content. server { listen 443; set $ssltoggle 2; if ($uri ~ ^/(img|js|css|static)/) { set $ssltoggle 1; } if ($uri = '/') { set $ssltoggle 1; } if ($ssltoggle != 1) { rewrite ^(.*)$ http://$server_name$1 permanent; } } So in my http block I need to do the rewrite if it has to https: server { listen 80; if ($uri = '/') { set $ssltoggle 1; } if ($ssltoggle = 1) { rewrite ^(.*)$ https://$server_name$1 permanent; } } If I don't have the $uri = '/' if-statement in the http block, then https works fine if I go directly to it, but I won't get redirected if I go to regular http which is expected. If I do put that in-statement in the http block then everything stops working within minutes. It might work for a few requests, but will always stop within a minute or so. In browsers I just get a blank page for all requests. If I restart nginx it continues to not work until I remove both if-statement blocks in both the https and http blocks and restart nginx. When I look in the error logs I don't see anything logged. When I look in the access log I see this message: "-" 400 0 "-" "-" which I assume means a 400 error. I don't understand why this doesn't work for me. My end goal is to have the base domain be https-only while all other pages default to http. How can I achieve this?

    Read the article

  • Idiomatic Scala way to deal with base vs derived class field names?

    - by Gregor Scheidt
    Consider the following base and derived classes in Scala: abstract class Base( val x : String ) final class Derived( x : String ) extends Base( "Base's " + x ) { override def toString = x } Here, the identifier 'x' of the Derived class parameter overrides the field of the Base class, so invoking toString like this: println( new Derived( "string" ).toString ) returns the Derived value and gives the result "string". So a reference to the 'x' parameter prompts the compiler to automatically generate a field on Derived, which is served up in the call to toString. This is very convenient usually, but leads to a replication of the field (I'm now storing the field on both Base and Derived), which may be undesirable. To avoid this replication, I can rename the Derived class parameter from 'x' to something else, like '_x': abstract class Base( val x : String ) final class Derived( _x : String ) extends Base( "Base's " + _x ) { override def toString = x } Now a call to toString returns "Base's string", which is what I want. Unfortunately, the code now looks somewhat ugly, and using named parameters to initialize the class also becomes less elegant: new Derived( _x = "string" ) There is also a risk of forgetting to give the derived classes' initialization parameters different names and inadvertently referring to the wrong field (undesirable since the Base class might actually hold a different value). Is there a better way? Edit: To clarify, I really only want the Base values; the Derived ones just seem necessary for initializing the Base ones. The example only references them to illustrate the ensuing issues. It might be nice to have a way to suppress automatic field generation if the derived class would otherwise end up hiding a base class field.

    Read the article

  • Virtualbox, merging snapshots and base disk

    - by Henrik
    Hi, I have a virtual machine with about 30 snapshots in branches. The current development path is 22 snapshots plus the base disk. The amount of files is seemingly having an impact now on IO and the dev laptop I'm using (don't know if it is host disk performance issues with the 140GB total size over a lot of fragments, or just the fact that it is hitting sectors distributed across a lot of files). I would like to merge the current development branch of snapshots together with the base disk, but I am unsure if the following command would produce the correct outcome. I am not able to boot this disk after the procedure completes (5-6 hours). vboxmanage clonehd "C:\VPC-Storage\.VirtualBox\Machines\CRM\Snapshots\{245b27ac-e658-470a-b978-8e62137c33b1}.vhd" "E:\crm-20100624.vhd" --format VHD --type normal Could anyone confirm if this is the correct approach or not?

    Read the article

  • overriding enumeration base type using pragma or code change

    - by vprajan
    Problem: I am using a big C/C++ code base which works on gcc & visual studio compilers where enum base type is by default 32-bit(integer type). This code also has lots of inline + embedded assembly which treats enum as integer type and enum data is used as 32-bit flags in many cases. When compiled this code with realview ARM RVCT 2.2 compiler, we started getting many issues since realview compiler decides enum base type automatically based on the value an enum is set to. http://www.keil.com/support/man/docs/armccref/armccref_Babjddhe.htm For example, Consider the below enum, enum Scale { TimesOne, //0 TimesTwo, //1 TimesFour, //2 TimesEight, //3 }; This enum is used as a 32-bit flag. but compiler optimizes it to unsigned char type for this enum. Using --enum_is_int compiler option is not a good solution for our case, since it converts all the enum's to 32-bit which will break interaction with any external code compiled without --enum_is_int. This is warning i found in RVCT compilers & Library guide, The --enum_is_int option is not recommended for general use and is not required for ISO-compatible source. Code compiled with this option is not compliant with the ABI for the ARM Architecture (base standard) [BSABI], and incorrect use might result in a failure at runtime. This option is not supported by the C++ libraries. Question How to convert all enum's base type (by hand-coded changes) to use 32-bit without affecting value ordering? enum Scale { TimesOne=0x00000000, TimesTwo, // 0x00000001 TimesFour, // 0x00000002 TimesEight, //0x00000003 }; I tried the above change. But compiler optimizes this also for our bad luck. :( There is some syntax in .NET like enum Scale: int Is this a ISO C++ standard and ARM compiler lacks it? There is no #pragma to control this enum in ARM RVCT 2.2 compiler. Is there any hidden pragma available ?

    Read the article

  • Rails & ActiveRecord: Appending methods to models that inherit from ActiveRecord::Base

    - by PlankTon
    I have a standard ActiveRecord model with the following: class MyModel < ActiveRecord::Base custom_method :first_field, :second_field end At the moment, that custom_method is picked up by a module sent to ActiveRecord::Base. The functionality basically works, but of course, it attaches itself to every model class, not just MyModel. So if I have MyModel and MyOtherModel in the same action, it'll assume MyOtherModel has custom_method :first_field, :second_field as well. So, my question is: How do I attach a method (eg: def custom_method(*args)) to every class that inherits from ActiveRecord::Base, but not by attaching it to ActiveRecord::Base itself? Any ideas appreciated.

    Read the article

  • Multi-base conversion - using all combinations for URL shortener

    - by Guffa
    I am making an URL shortener, and I am struggling with the optimal way of encoding a number (id) into a character string. I am using the characters 0-9,A-Z,a-z so it will basically be a base-62 encoding. That is pretty basic, but it doesn't make use of all possible codes. The codes that it would produce would be: 0, 1, ... y, z, 10, 11, ... zy, zz, 100, 101, ... Notice that the codes 00 to 0z is not used, the same for 000 to 0zz, and so on. I would like to use all the codes, like this: 0, 1, ... y, z, 00, 01, ... zy, zz, 000, 001, ... It would be some combination of base-62 and base-63, with different bases depending on the position... Using base-62 is easy, for example: create procedure tiny_GetCode @UrlId int as set nocount on declare @Code varchar(10) set @Code = '' while (@UrlId > 0 or len(@Code) = 0) begin set @Code = substring('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', @UrlId % 62 + 1, 1) + @Code set @UrlId = @UrlId / 62 end select @Code But I haven't yet managed to make a multi-base conversion out of it, to make use of all the codes.

    Read the article

  • extend base.html problem

    - by momo
    I'm getting the following error: Template error In template /home/mo/python/django/templates/yoga/index.html, error at line 1 Caught TemplateDoesNotExist while rendering: base.html 1 {% extends "base.html" %} 2 3 {% block main %} 4 <p>{{ page.title }}</p> 5 <p>{{ page.info}}</p> 6 <a href="method/">Method</a> 7 {% endblock %} 8 this is my base.html file, which is located at the same place as index.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <div style="width:50%; marginleft:25%;"> {% block main %}{% endblock %} </div> what exactly is going on here? should the base.html file be located somewhere else?

    Read the article

  • An algorithm for converting a base-10 number to a base-N number.

    - by roja
    Guys, I am looking for a way to convert a base-10 number into a base-N number where N can be large. Specifically i am looking at converting to base-85 and back again. Does anyone know a simple algorithm to perform the conversion? Ideally it would provide something like: to_radix(83992, 85) - [11, 53, 12] Any ideas are appreciated! Roja

    Read the article

  • Uiimport does not save variable to base workspace

    - by Tim
    I tried using uiimport to load a file to the base workspace.....It worked first time....but after trying again after a while...I wasnt seeing the variable in the base work space. I used the default variable name which is given by 'uiimport". This was the command I used: uiimport(filename) And two variables where created by default..."data" and "textdata"(which is the header)....but now when i run it is no longer saved in the base workspace I do not want to assign a variable to the uiimport like so... K = uiimport(filename) assignin(base,'green',K) I do not want to do that because My dataset has a text header and the data itself, and doing this would assign both "textdata" and "data" to "green" variable How would I be able to get the dimensions of ONLY the "data" in green and how would I pass only "data"(which is in the green variable in the workspace.."rmbr"...the green variable holds both "data" and "textdata") to another function. I was able to do all this when the uiimport automatically saved the variables in the base workspace....but somehow now it doesn't. I would appreciate any help or tips on this matter

    Read the article

  • Java: Embedded Data Base

    - by Dmitry
    Hello! I want to create a desctop application with an embedded data base. Data base is JavaDB(Derby). I have connected a jar file derby.jar to my project. The problem is I don't understand how to register a driver to use this data base. It is said that I should use Class.forName("org.apache.derby.jdbc.EmbeddedDriver") But what if that was another data base and its driver was not in a java standart package? As you can see I'm confused with this. I want to know, how to use my connected derby.jar, how to work with its jdbc driver and how to create tables in a specified directory. Please, give as detailed answer, as you can. (I'm a dummy in this =)) )

    Read the article

  • Hide a base class method from derived class, but still visible outside of assembly

    - by clintp
    This is a question about tidyness. The project is already working, I'm satisfied with the design but I have a couple of loose ends that I'd like to tie up. My project has a plugin architecture. The main body of the program dispatches work to the plugins that each reside in their own AppDomain. The plugins are described with an interface, which is used by the main program (to get the signature for invoking DispatchTaskToPlugin) and by the plugins themselves as an API contract: namespace AppServer.Plugin.Common { public interface IAppServerPlugin { void Register(); void DispatchTaskToPlugin(Task t); // Other methods omitted } } In the main body of the program Register() is called so that the plugin can register its callback methods with the base class, and then later DispatchTaskToPlugin() is called to get the plugin running. The plugins themselves are in two parts. There's a base class that implements the framework for the plugin (setup, housekeeping, teardown, etc..). This is where DispatchTaskToPlugin is actually defined: namespace AppServer.Plugin { abstract public class BasePlugin : MarshalByRefObject, AppServer.Plugin.Common.IAppServerPlugin { public void DispatchTaskToPlugin(Task t) { // ... // Eventual call to actual plugin code // } // Other methods omitted } } The actual plugins themselves only need to implement a Register() method (to give the base class the delegates to call eventually) and then their business logic. namespace AppServer.Plugin { public class Plugin : BasePlugin { override public void Register() { // Calls a method in the base class to register itself. } // Various callback methods, business logic, etc... } } Now in the base class (BasePlugin) I've implemented all kinds of convenience methods, collected data, etc.. for the plugins to use. Everything's kosher except for that lingering method DispatchTaskToPlugin(). It's not supposed to be callable from the Plugin class implementations -- they have no use for it. It's only needed by the dispatcher in the main body of the program. How can I prevent the derived classes (Plugin) from seeing the method in the base class (BasePlugin/DispatchTaskToPlugin) but still have it visible from outside of the assembly? I can split hairs and have DispatchTaskToPlugin() throw an exception if it's called from the derived classes, but that's closing the barn door a little late. I'd like to keep it out of Intellisense or possibly have the compiler take care of this for me. Suggestions?

    Read the article

  • Accessing a namespace containing .base in its name from F#

    - by emaster70
    As the title says, I'm trying to use a class declared in a namespace which contains "base" in its name. Think of a situation like the following: open Foo.base.Bar In C# I'd just use @ before base but F# seems to ignore that and to think that @ is the infix operator used for list concatenation. Since the namespace belongs to a third-party library which I cannot modify, is there a way I can still access it from F#?

    Read the article

  • Having a base class function depend on its child class C#

    - by Junk Junk
    I have a Base class with a method that a child class will almost always override. However, instead of replacing the base class' method entirely, I would like for whatever is derived in the child class to be added to what is already in the base class. For Example: class BaseClass public string str() { var string = "Hello my name is" ; } class ChildClass : BaseClass public override string str(){ var string = "Sam"; } The point is that if I want to access the str() method by creating an instance of the ChildClass, the string will print out as "Hello, my name is Sam". I've been looking around and all I have been finding is that this should NOT happen, as the base class shouldn't even know that it is being inherited. So, if the design is false, how would I go about doing this? Keep in mind that there will be multiple child classes inheriting from BaseClass. Thank you

    Read the article

  • Injecting a dependancy into a base class

    - by Jamie Dixon
    Hey everyone, I'm on a roll today with questions. I'm starting out with Dependency Injection and am having some trouble injecting a dependency into a base class. I have a BaseController controller which my other controllers inherit from. Inside of this base controller I do a number of checks such as determining if the user has the right privileges to view the current page, checking for the existence of some session variables etc. I have a dependency inside of this base controller that I'd like to inject using Ninject however when I set this up as I would for my other dependencies I'm told by the compiler that: Error 1 'MyProject.Controllers.BaseController' does not contain a constructor that takes 0 argument This makes sense but I'm just not sure how to inject this dependency. Should I be using this pattern of using a base controller at all or should I be doing this in a more efficient/correct way?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >