Search Results

Search found 4999 results on 200 pages for 'derived instances'.

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

  • List of Lua derived VMs and Languages

    - by Shane Holloway
    Is there a compendium of virtual machines and languages derived or inspired by Lua? By derived, I mean usage beyond embedding and extending with modules. I'm wanting to research the Lua technology tree, and am looking for our combined knowledge of what already exists. Current List: Bright - A C-like Lua Derivative http://bluedino.net/luapix/Bright.pdf Agena - An Algol68/SQL like Lua Derivative http://agena.sourceforge.net/ LuaJIT - A (very impressive) JIT for Lua http://luajit.org MetaLua - An ML-style language extension http://metalua.luaforge.net/

    Read the article

  • Binding functions of derived class with luabind

    - by Anamon
    I am currently developing a plugin-based system in C++ which provides a Lua scripting interface, for which I chose to use luabind. I'm using Lua 5 and luabind 0.9, both statically linked and compiled with MSVC++ 8. I am now having trouble binding functions with luabind when they are defined in a derived class, but not its parent class. More specifically, I have an abstract base class called 'IPlugin' from which all plugin classes inherit. When the plugin manager initialises, it registers that class and its functions like this: luabind::open(L); luabind::module(L) [ luabind::class_("IPlugin") .def("start", (void(IPlugin::*)())&IPlugin::start) ]; As it is only known at runtime what effective plugin classes are available, I had to solve loading plugins in a kind of roundabout way. The plugin manager exposes a factory function to Lua, which takes the name of a plugin class and a desired object name. The factory then creates the object, registers the plugin's class as inheriting from the 'IPlugin' base class, and immediately calls a function on the created object that registers itself as a global with the Lua state, like this: void PluginExample::registerLuaObject(lua_State *L, string a_name) { luabind::globals(L)[a_name] = (PluginExample*)this; } I initially did this because I had problems with Lua determining the most derived class of the object, as if I register it from the StreamManager it is only known as a subtype of 'IPlugin' and not the specific subtype. I'm not sure anymore if this is even necessary though, but it works and the created object is subsequently accessible from Lua under 'a_name'. The problem I have, though, is that functions defined in the derived class, which were not declared at all in the parent class, cannot be used. Virtual functions defined in the base class, such as 'start' above, work fine, and calling them from Lua on the new object runs the respective redefined code from the 'PluginExample' class. But if I add a new function to 'PluginExample', here for example a function taking no arguments and returning void, and register it like this: luabind::module(L) [ luabind::class_("PluginExample") .def(luabind::constructor()) .def("func", &PluginExample::func) ]; calling 'func' on the new object yields the following Lua runtime error: No matching overload found, candidates: void func(PluginExample&) I am correctly using the ':' syntax so the 'self' argument is not needed and it seems suddenly Lua cannot determine the derived type of the object anymore. I am sure I am doing something wrong, probably having to do with the two-step binding required by my system architecture, but I can't figure out where. I'd much appreciate some help =)

    Read the article

  • Is derived table executed once or three times?

    - by AspOnMyNet
    Every time you make use of a derived table, that query is going to be executed. When using a CTE, that result set is pulled back once and only once within a single query. Does the quote suggest that the following query will cause derived table to be executed three times ( once for each aggregate function’s call ): SELECT AVG(OrdersPlaced),MAX(OrdersPlaced),MIN(OrdersPlaced) FROM ( SELECT v.VendorID, v.[Name] AS VendorName, COUNT(*) AS OrdersPlaced FROM Purchasing.PurchaseOrderHeader AS poh INNER JOIN Purchasing.Vendor AS v ON poh.VendorID = v.VendorID GROUP BY v.VendorID, v.[Name] ) AS x thanx

    Read the article

  • Derived template override return type of member function C++

    - by Ruud v A
    I am writing matrix classes. Take a look at this definition: template <typename T, unsigned int dimension_x, unsigned int dimension_y> class generic_matrix { ... generic_matrix<T, dimension_x - 1, dimension_y - 1> minor(unsigned int x, unsigned int y) const { ... } ... } template <typename T, unsigned int dimension> class generic_square_matrix : public generic_matrix<T, dimension, dimension> { ... generic_square_matrix(const generic_matrix<T, dimension, dimension>& other) { ... } ... void foo(); } The generic_square_matrix class provides additional functions like matrix multiplication. Doing this is no problem: generic_square_matrix<T, 4> m = generic_matrix<T, 4, 4>(); It is possible to assign any square matrix to M, even though the type is not generic_square_matrix, due to the constructor. This is possible because the data does not change across children, only the supported functions. This is also possible: generic_square_matrix<T, 4> m = generic_square_matrix<T, 5>().minor(1,1); Same conversion applies here. But now comes the problem: generic_square_matrix<T, 4>().minor(1,1).foo(); //problem, foo is not in generic_matrix<T, 3, 3> To solve this I would like generic_square_matrix::minor to return a generic_square_matrix instead of a generic_matrix. The only possible way to do this, I think is to use template specialisation. But since a specialisation is basically treated like a separate class, I have to redefine all functions. I cannot call the function of the non-specialised class as you would do with a derived class, so I have to copy the entire function. This is not a very nice generic-programming solution, and a lot of work. C++ almost has a solution for my problem: a virtual function of a derived class, can return a pointer or reference to a different class than the base class returns, if this class is derived from the class that the base class returns. generic_square_matrix is derived from generic_matrix, but the function does not return a pointer nor reference, so this doesn't apply here. Is there a solution to this problem (possibly involving an entirely other structure; my only requirements are that the dimensions are a template parameter and that square matrices can have additional functionality). Thanks in advance, Ruud

    Read the article

  • C++: How to require that one template type is derived from the other

    - by Will
    In a comparison operator: template<class R1, class R2> bool operator==(Manager<R1> m1, Manager<R2> m2) { return m1.internal_field == m2.internal_field; } Is there any way I could enforce that R1 and R2 must have a supertype or subtype relation? That is, I'd like to allow either R1 to be derived from R2, or R2 to be derived from R1, but disallow the comparison if R1 and R2 are unrelated types.

    Read the article

  • C++ require that one template type is derived from the other

    - by Will
    In a comparison operator: template<class R1, class R2> bool operator==(Manager<R1> m1, Manager<R2> m2) { return p1.internal_field == p2.internal_field; } Is there any way I could enforce that R1 and R2 must have a supertype or subtype relation? That is, I'd like to allow either R1 to be derived from R2, or R2 to be derived from R1, but disallow the comparison if R1 and R2 are unrelated types.

    Read the article

  • Implicit constructor available for all types derived from Base excepted the current type?

    - by Vincent
    The following code sum up my problem : template<class Parameter> class Base {}; template<class Parameter1, class Parameter2, class Parameter> class Derived1 : public Base<Parameter> { }; template<class Parameter1, class Parameter2, class Parameter> class Derived2 : public Base<Parameter> { public : // Copy constructor Derived2(const Derived2& x); // An EXPLICIT constructor that does a special conversion for a Derived2 // with other template parameters template<class OtherParameter1, class OtherParameter2, class OtherParameter> explicit Derived2( const Derived2<OtherParameter1, OtherParameter2, OtherParameter>& x ); // Now the problem : I want an IMPLICIT constructor that will work for every // type derived from Base EXCEPT // Derived2<OtherParameter1, OtherParameter2, OtherParameter> template<class Type, class = typename std::enable_if</* SOMETHING */>::type> Derived2(const Type& x); }; How to restrict an implicit constructor to all classes derived from the parent class excepted the current class whatever its template parameters, considering that I already have an explicit constructor as in the example code ? EDIT : For the implicit constructor from Base, I can obviously write : template<class OtherParameter> Derived2(const Base<OtherParameter>& x); But in that case, do I have the guaranty that the compiler will not use this constructor as an implicit constructor for Derived2<OtherParameter1, OtherParameter2, OtherParameter> ? EDIT2: Here I have a test : (LWS here : http://liveworkspace.org/code/cd423fb44fb4c97bc3b843732d837abc) #include <iostream> template<typename Type> class Base {}; template<typename Type> class Other : public Base<Type> {}; template<typename Type> class Derived : public Base<Type> { public: Derived() {std::cout<<"empty"<<std::endl;} Derived(const Derived<Type>& x) {std::cout<<"copy"<<std::endl;} template<typename OtherType> explicit Derived(const Derived<OtherType>& x) {std::cout<<"explicit"<<std::endl;} template<typename OtherType> Derived(const Base<OtherType>& x) {std::cout<<"implicit"<<std::endl;} }; int main() { Other<int> other0; Other<double> other1; std::cout<<"1 = "; Derived<int> dint1; // <- empty std::cout<<"2 = "; Derived<int> dint2; // <- empty std::cout<<"3 = "; Derived<double> ddouble; // <- empty std::cout<<"4 = "; Derived<double> ddouble1(ddouble); // <- copy std::cout<<"5 = "; Derived<double> ddouble2(dint1); // <- explicit std::cout<<"6 = "; ddouble = other0; // <- implicit std::cout<<"7 = "; ddouble = other1; // <- implicit std::cout<<"8 = "; ddouble = ddouble2; // <- nothing (normal : default assignment) std::cout<<"\n9 = "; ddouble = Derived<double>(dint1); // <- explicit std::cout<<"10 = "; ddouble = dint2; // <- implicit : WHY ?!?! return 0; } The last line worry me. Is it ok with the C++ standard ? Is it a bug of g++ ?

    Read the article

  • Name a Byobu session?

    - by Ashimema
    Is there a way to create identifiable Byobu sessions so that when I've got multiple sessions running, the byobu-select-session menu gives me a list of sessions I can recognize, as opposed to non-descript tmux port numbers? In an ideal world, it would be great to be able to both start a session giving it a name and to modify such a session to change a name if it's already running? Is this possible, how? Edit 1: Some further details: I'm using tmux as the backend and don't especially want to switch back to screen. I've now tried starting a session with byobu -S "Name" to no avail :-( Edit 2: Some discoveries: I've now discovered a partial answer in using tmux native commands: tmux rename-session <current-name> <new-name> renames an existing session and tmux new -s session_name creates a new names session. I'm surprised byobu -S "name" isn't liked to tmux new -s session_name for byobu with a tmux backend.

    Read the article

  • 2nd instance of Firefox does not obey GTK2 customizations

    - by Cocoro Cara
    Hi On Ubuntu 10.10 I started a 2nd instance of Firefox using the command: $ firefox -ProfileManager -no-remote & Created a new profile and everything works smoothly except for the fact that this instance of FF does not obey by GTK2 customizations that I have placed in ~/.gtkrc-2.0 Moreover, only SOME of the customizations are not obeyed. For example, the vertical scrollbars are supposed to be on the left, but they are on the right. The scrollbar arrows are together (Mac-like) as specified, so is the scrollbar width. The first instance obeys all customizations with scrollbars on the left. Any ideas?

    Read the article

  • How do I give a Byobu session a name?

    - by Ashimema
    Is there a way to create identifiable Byobu sessions so that when I've got multiple sessions running, the byobu-select-session menu gives me a list of sessions I can recognize, as opposed to non-descript tmux port numbers? In an ideal world, it would be great to be able to both start a session giving it a name and to modify such a session to change a name if it's already running? Is this possible, how?

    Read the article

  • Ikoula lance CloudStack Instances, sa nouvelle plateforme pour créer et déployer en toute liberté des Cloud Publics

    Ikoula lance CloudStack Instances sa nouvelle plateforme pour créer et déployer en toute liberté des Cloud PublicsLe catalogue CloudStack d'Ikoula s'est enrichi d'un nouveau service. Après le lancement en janvier dernier de CloudStack Server, solution de déploiement de Cloud Privés disponible en division Infogérance (IES), l'hébergeur informatique annonce la sortie de CloudStack Instances. CloudStack Instances est une plateforme de Cloud Public packagée, facilitant le déploiement et la gestion d'un réseau d'instances depuis une interface web en self service. Pour 19€/mois, la plateforme comprend : 1 routeur à 10Mb...

    Read the article

  • BindingFlags.DeclaredOnly alternative to avoid ambiguous properties of derived classes

    - by JoeBilly
    I'am looking for a solution to access 'flatten' (lowest) properties values of a class and its derived via reflection by property names. ie access either Property1 or Property2 from the ClassB or ClassC type : public class ClassA { public virtual object Property1 { get; set; } public object Property2 { get; set; } } public class ClassB : ClassA { public override object Property1 { get; set; } } public class ClassC : ClassB { } Using simple reflection works until you have virtual properties that are overrired (ie Property1 from ClassB). Then you get a AmbiguousMatchException because the searcher don't know if you want the property of the main class or the derived. Using BindingFlags.DeclaredOnly avoid the AmbiguousMatchException but unoverrided virtual properties or derived classes properties are ommited (ie Property2 from ClassB). Is there an alternative to this poor workaround : // Get the main class property with the specified propertyName PropertyInfo propertyInfo = _type.GetProperty(propertyName, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); // If not found, get the property wherever it is if (propertyInfo == null) propertyInfo = _type.GetProperty(propertyName); Furthermore, this workaround not resolve the reflection of 2nd level properties : getting Property1 from ClassC and AmbiguousMatchException is back. My thoughts : I have no choice except loop... Erk... ?? I'am open to Emit, Lambda (is the Expression.Call can handle this?) even DLR solution. Thanks !

    Read the article

  • MVC2 Modelbinder for List of derived objects

    - by user250773
    I want a list of different (derived) object types working with the Default Modelbinder in Asp.net MVC 2. I have the following ViewModel: public class ItemFormModel { [Required(ErrorMessage = "Required Field")] public string Name { get; set; } public string Description { get; set; } [ScaffoldColumn(true)] //public List<Core.Object> Objects { get; set; } public ArrayList Objects { get; set; } } And the list contains objects of diffent derived types, e.g. public class TextObject : Core.Object { public string Text { get; set; } } public class BoolObject : Core.Object { public bool Value { get; set; } } It doesn't matter if I use the List or the ArrayList implementation, everything get's nicely scaffolded in the form, but the modelbinder doesn't resolve the derived object type properties for me when posting back to the ActionResult. What could be a good solution for the Viewmodel structure to get a list of different object types handled? Having an extra list for every object type (e.g. List, List etc.) seems to be not a good solution for me, since this is a lot of overhead both in building the viewmodel and mapping it back to the domain model. Thinking about the other approach of binding all properties in a custom model binder, how can I make use the data annotations approach here (validating required attributes etc.) without a lot of overhead?

    Read the article

  • How to specialize template for type derived from particular type

    - by relaxxx
    I have class World which manages creation of object... After creation it calls afterCreation method and I the created object is user-defined type derived from Entity (eg. MyEntity), I want to call addEntity. I the object was something else, I want to do nothing. addEntity must be called with appropriate T, because it generates unique IDs for every derived class etc. Here is my solution: template <int v> struct ToType { enum { value = v }; }; template <typename T> void World::afterCreation(T * t) { afterCreation(t, ToType<std::is_base_of<Entity, T>::value>()); } template <typename T> void World::afterCreation(T * t, ToType<true>) { addEntity(t); //here I cant pass Entity *, I need the real type, eg. MyEntity } template <typename T> void World::afterCreation(T * t, ToType<false>) { } My question is - Can in be done better way? How can I simulate following code without ToType or similar? template <typename T> void afterCreation(){/*generic impl*/} template <typename T where T is derived from Entity> void afterCreation(){/*some specific stuff*/} "specialize" in the title is only to describe my intention, no need to solve problem with template specialization

    Read the article

  • static_cast from Derived* to void* to Base*

    - by Roberto
    I would like to cast a pointer to a member of a derived class to void* and from there to a pointer of the base class, like in the example below: #include <iostream> class Base { public: void function1(){std::cout<<"1"<<std::endl;} virtual void function2()=0; }; class Derived : public Base { public: virtual void function2(){std::cout<<"2"<<std::endl;} }; int main() { Derived d; void ptr* = static_cast<void*>(&d); Base* baseptr=static_cast<Base*>(ptr); baseptr->function1(); baseptr->function2(); } This compiles and gives the desired result (prints 1 and 2 respectively), but is it guaranteed to work? The description of static_cast I found here: http://en.cppreference.com/w/cpp/language/static_cast only mentions conversion to void* and back to a pointer to the same class (point 10).

    Read the article

  • polymorphism, inheritance in c# - base class calling overridden method?

    - by Andrew Johns
    This code doesn't work, but hopefully you'll get what I'm trying to achieve here. I've got a Money class, which I've taken from http://www.noticeablydifferent.com/CodeSamples/Money.aspx, and extended it a little to include currency conversion. The implementation for the actual conversion rate could be different in each project, so I decided to move the actual method for retrieving a conversion rate (GetCurrencyConversionRate) into a derived class, but the ConvertTo method contains code that would work for any implementation assuming the derived class has overriden GetCurrencyConversionRate so it made sense to me to keep it in the parent class? So what I'm trying to do is get an instance of SubMoney, and be able to call the .ConvertTo() method, which would in turn use the overriden GetCurrencyConversionRate, and return a new instance of SubMoney. The problem is, I'm not really understanding some concepts of polymorphism and inheritance yet, so not quite sure what I'm trying to do is even possible in the way I think it is, as what is currently happening is that I end up with an Exception where it has used the base GetCurrencyConversionRate method instead of the derived one. Something tells me I need to move the ConvertTo method down to the derived class, but this seems like I'll be duplicating code in multiple implementations, so surely there's a better way? public class Money { public CurrencyConversionRate { get { return GetCurrencyConversionRate(_regionInfo.ISOCurrencySymbol); } } public static decimal GetCurrencyConversionRate(string isoCurrencySymbol) { throw new Exception("Must override this method if you wish to use it."); } public Money ConvertTo(string cultureName) { // convert to base USD first by dividing current amount by it's exchange rate. Money someMoney = this; decimal conversionRate = this.CurrencyConversionRate; decimal convertedUSDAmount = Money.Divide(someMoney, conversionRate).Amount; // now convert to new currency CultureInfo cultureInfo = new CultureInfo(cultureName); RegionInfo regionInfo = new RegionInfo(cultureInfo.LCID); conversionRate = GetCurrencyConversionRate(regionInfo.ISOCurrencySymbol); decimal convertedAmount = convertedUSDAmount * conversionRate; Money convertedMoney = new Money(convertedAmount, cultureName); return convertedMoney; } } public class SubMoney { public SubMoney(decimal amount, string cultureName) : base(amount, cultureName) {} public static new decimal GetCurrencyConversionRate(string isoCurrencySymbol) { // This would get the conversion rate from some web or database source decimal result = new Decimal(2); return result; } }

    Read the article

  • Amazon EC2 spot instances - is there a catch ?

    - by gareth_bowles
    I needed to start a new EC2 instance today and decided to try out the new spot instances, where you can reduce your instance cost by bidding on the maximum per-hour price you're prepared to pay. Since today's spot price was only 35c / hour, compared with 85c / hour for an on-demand instance, I was wondering: if I just bid a really high price, say $1 / hour, can I effectively be sure of getting a much cheaper long-running instance than an on-demand instance (since the spot instances are only charged by the current spot price) ? I suppose it's theoretically possible for the spot price to go over the on-demand price, but as far as I can tell from the data on the AWS site, the spot price has always been well below that.

    Read the article

  • Amazon EC2 spot instances - is there a catch ?

    - by gareth_bowles
    I needed to start a new EC2 instance today and decided to try out the new spot instances, where you can reduce your instance cost by bidding on the maximum per-hour price you're prepared to pay. Since today's spot price was only 3.5c / hour, compared with 8.5c / hour for an on-demand instance, I was wondering: if I just bid a really high price, say 10c / hour, can I effectively be sure of getting a much cheaper long-running instance than an on-demand instance (since the spot instances are only charged by the current spot price) ? I suppose it's theoretically possible for the spot price to go over the on-demand price, but as far as I can tell from the data on the AWS site, the spot price has always been well below that.

    Read the article

  • Copying 500GB Data to EC2 Instances Local Drive

    - by iCode
    Please do not ask me why (they made me) but I have to copy 500GB data to the local drive every 200 node/instances that I am launching in EC2. For reasons beyond this post, this data must by on the local drive and not EBS drive so I can not benefit from snapshots. What is the fastest way that I can manage to this? Copying from S3 to each node takes a long time. I trying to attached an EBS volume to every node with the data and then copy the data from EBS to the local drive but that also take a long time (several hours_) Now, I am also thinking to use bit torrent but not sure how well it is going to be. What is the best way to copy 500GB of static data to each local drive of 200 ec2 instances? The 500Gb of data is composed several hundred of file with varying size but the biggest file is 20GB.

    Read the article

  • Dual-boot two instances of the same copy of Vista using same serial number

    - by fred.bear
    I have a single Vista OEM registration number which has been registered to the current hardware (single partition only), and I want to use it for two instances of dual-booted Vista... Because both Vistas will be running on the same hardware, (and obviously only one at any one time), will they both be recognized as genuine to Windows Update etc... ie will they both pass the Windows Genuine Advantage requirements? .. The only difference between the hardware involved will be the partition. Also, are there any special issues with dual (tripple?) booting two instances of Vista and also one Ubuntu OS?

    Read the article

  • Multiple MySQL instances via mysqlmanager under Debian

    - by Karolis T.
    Has anyone got multiple MySQL instances running on Debian with mysqlmanager? Problem is, Debian doesn't ship with init.d script that takes mysqlmanager into account. Oh, and it doesn't work for me. I'm trying to run 3 instances, here's what I get after starting mysqlmanager # mysqlmanager --defaults-file=/etc/mysql/my.cnf ... 090614 0:42:10 starting instance 'mysqld2'... 090614 0:42:10 guardian: starting instance 'mysqld1'... 090614 0:42:10 starting instance 'mysqld1'... 090614 0:42:10 starting instance 'mysqld3'... 090614 0:42:10 guardian: starting instance 'mysqld3'... 090614 0:42:10 guardian: starting instance 'mysqld2'... 090614 0:42:10 starting instance 'mysqld2'... 090614 0:42:10 guardian: starting instance 'mysqld1'... 090614 0:42:10 starting instance 'mysqld1'... ... It just keeps "starting" and "restarting", but no MySQL instance ever starts up.

    Read the article

  • File replication among EC2 instances

    - by Peuge
    I am pretty new to AWS so please excuse my ignorance. We are wanting to have a setup whereby we have a SQL DB instance + web server instance. However we would like the Web server to sit behind an ELB thus allowing us to use Autoscaling. My question however is how to we replicate the web app across instances? Say for example we have two web servers running and we need to make a critical update to the web app, ultimately we would only want to upload to one instance and not both. Is it even best practice to store your web app on the instance or are there better ways to store and share the app between instances?

    Read the article

  • Unique ID Defined by Most-Derived Class accessible through Base Class

    - by Narfanator
    Okay, so, the idea is that I have a map of "components", which inherit from componentBase, and are keyed on an ID unique to the most-derived*. Only, I can't think of a good way to get this to work. I tried it with the constructor, but that doesn't work (Maybe I did it wrong). The problem with any virtual, etc, inheritance tricks are that the user has to impliment them at the bottom, which can be forgotten and makes it less... clean. *Right phrase? If - is inheritance; foo is most-derived: foo-foo1-foo2-componentBase Here's some code showing the problem, and why CRTP can't cut it: (No, it's not legit code, but I'm trying to get my thoughts down) #include<map> class componentBase { public: virtual static char idFunction() = 0; }; template <class T> class component : public virtual componentBase { public: static char idFunction(){ return reinterpret_cast<char>(&idFunction); } }; class intermediateDerivations1 : public virtual component<intermediateDerivations1> { }; class intermediateDerivations2 : public virtual component<intermediateDerivations2> { }; class derived1 : public intermediateDerivations1 { }; class derived2 : public intermediateDerivations1 { }; //How the unique ID gets used (more or less) std::map<char, componentBase*> TheMap; template<class T> void addToMap(componentBase * c) { TheMap[T::idFunction()] = c; } template<class T> T * getFromMap() { return TheMap[T::idFunction()]; } int main() { //In each case, the key needs to be different. //For these, the CRTP should do it: getFromMap<intermediateDerivations1>(); getFromMap<intermediateDerivations2>(); //But not for these. getFromMap<derived1>(); getFromMap<derived2>(); return 0; } More or less, I need something that is always there, no matter what the user does, and has a sortable value that's unique to the most-derived class. Also, I realize this isn't the best-asked question, I'm actually having some unexpected difficultly wrapping my head around it in words, so ask questions if/when you need clarification.

    Read the article

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