Search Results

Search found 17501 results on 701 pages for 'stored functions'.

Page 37/701 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • 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

  • How to call wordpress functions in custom php script

    - by sid.sri
    I have a Php script I want to use for creating a new blog in WPMU. I am having trouble calling wordpress functions like "wpmu_create_user" and "wpmu_create_blog". My hope is to get this script running as a cron job from command line and pick up new blog creation requests from an external db, create a new blog using the wordpress functions and update the db with new blog info. Any help/suggestions are highly appreciated. Sid.

    Read the article

  • Sql Profiler Scan Started to execute a stored procedure

    - by Lieven Cardoen
    Does SqlServer has to start a Scan to execute a stored procedure? In Sql Profiler I can see this: RPC Starting ( exec sp_Edu3_SelectExamSession @ExamSessionId=N'AccessCode39361814' ) Scan:Started Scan:Started Scan:Started RPC Completed ( exec sp_Edu3_SelectExamSession @ExamSessionId=N'AccessCode39361814' ) Can I somehow see what's happening in the Stored Procedure? Different queries are done in that SP, but they do not seem to appear in Sql Profiler (maybe I need to check some more events?) The Scan:Started are probably scans by the queries in the sp? Or not?

    Read the article

  • stored procedure for importing txt in sql server db

    - by Iulian
    I have to insert new records in a database every day from a text file ( tab delimited). I'm trying to make this into a stored procedure with a parameter for the file to read data from. CREATE PROCEDURE dbo.UpdateTable @FilePath BULK INSERT TMP_UPTable FROM @FilePath WITH ( FIRSTROW = 2, MAXERRORS = 0, FIELDTERMINATOR = '\t', ROWTERMINATOR = '\n' ) RETURN Then i would call this stored procedure from my code (C#) specifying the file to insert. This is obviously not working, so how can i do it ?

    Read the article

  • Php - please help to find two alternatives for ereg functions

    - by Guanche
    ereg and eregi functions will be deleted from Php. Please help to find alternatives for the following ereg functions: 1) To allow IP addresses only for specific ranges: $targetAddr = "60.37..*..*"; if (!ereg($targetAddr, $_SERVER['REMOTE_ADDR'])) { die; } 2) To replace series of points like ....................... $message = ereg_replace("[.]{3,}", "... ", $message);

    Read the article

  • php functions new php developers should be aware of

    - by John
    Can people suggest a list of common or popular php functions that new/junior programmers should be aware of so that they don't "re-invent-the-wheel" so to speak? For example, I've seen a lot of new coders try to write their own date parsing functions when a combination of date(), strtotime() and time() can do everything their looking for. Any other ones you guys want to add to this list? Thanks

    Read the article

  • Recognizing Tail-recursive functions with Flex+Bison and convert code to an Iterative form

    - by Viet
    I'm writing a calculator with an ability to accept new function definitions. Being aware of the need of newbies to try recursive functions such as Fibonacci, I would like my calculator to be able to recognize Tail-recursive functions with Flex + Bison and convert code to an Iterative form. I'm using Flex & Bison to do the job. If you have any hints or ideas, I welcome them warmly. Thanks!

    Read the article

  • Entity Framework + stored procedure with paging

    - by Eatdoku
    I am using Entity Framework now and using a stored procedure to populate my entity. Where there is no problem with populating my entity, but when i trying to bind the result to a gridview control with "Enable Paging" set to true, it gives an error saying "The data source does not support server-side data paging." I am using stored procedure because one of the table column is FullTextIndexed, and there is a requirement to be able to search on that field. Can anyone tell me how the paging would work in this situation?

    Read the article

  • javascript add prototype method to all functions?

    - by salmane
    Is there a way to add a method to all javascript functions without using the prototype library? something along the lines of : Function.prototype.methodName = function(){ return dowhateverto(this) }; this is what i tried so far but it didnt work. Perhaps it is a bad idea also if so could you please tell me why? if so can I add it to a set of functions i choose something like : MyFunctions.prototype.methodName = function(){ return dowhateverto(this) }; where MyFunctions is an array of function names thank you

    Read the article

  • Providing the path to an image stored on the server, not in the application files

    - by twal
    I need to display images on my ASP.NET MVC page that will be stored on the server i have an apphelper class that I can use to provide the path like this public static class AppHelper { public static string ImageLowResPath(string imageName) { } } How can I get the file path that is stored on the c: drive of the server here? In my view I will get the filepath like this img src='<%=AppHelper.ImagelowResPath("10-1010.jpg") %' Thank you

    Read the article

  • Stored procedures vs. parameter binding

    - by Gagan
    I am using SQL server and ODBC in visual c++ for writing to the database. Currently i am using parameter binding in SQL queries ( as i fill the database with only 5 - 6 queries and same is true for retrieving data). I dont know much about stored procedures and I am wondering how much if any performance increase stored procedures have over parameter binding as in parameter binding we prepare the query only once and just execute it later in the program for diferent set of values of variables.

    Read the article

  • Passing delimited string to stored procedure to search database

    - by rs
    How can i pass a string delimited by space or comma to stored procedure and filter result? I'm trying to do something like - Parameter Value -------------------------- @keywords key1 key2 key3 Then is stored procedure i want to first find all records with first or last name like key1 filter step 1 with first or last name like key2 filter step 2 with first or last name like key 3

    Read the article

  • How can fill a variable of my own created data type within Oracle PL/SQL?

    - by Frankie Simon
    In Oracle I've created a data type: TABLE of VARCHAR2(200) I want to have a variable of this type within a Stored Procedure (defined locally, not as an actual table in the DB) and fill it with data. Some online samples show how I'd use my type if it was filled and passed as a parameter to the stored procedure: SELECT column_value currVal FROM table(pMyPassedParameter) However what I want is to fill it during the PL/SQL code itself, with INSERT statements. Anyone knows the syntax of this?

    Read the article

  • Go through a number of functions in Python

    - by Asaf
    I have an unknown number of functions in my python script (well, it is known, but not constant) that start with site_... I was wondering if there's a way to go through all of these functions in some main function that calls for them. something like: foreach function_that_has_site_ as coolfunc if coolfunc(blabla,yada) == true: return coolfunc(blabla,yada) so it would go through them all until it gets something that's true. thanks!

    Read the article

  • Dynamic Dispatch without Virtual Functions

    - by Kristopher Johnson
    I've got some legacy code that, instead of virtual functions, uses a kind field to do dynamic dispatch. It looks something like this: // Base struct shared by all subtypes // Plain-old data; can't use virtual functions struct POD { int kind; int GetFoo(); int GetBar(); int GetBaz(); int GetXyzzy(); }; enum Kind { Kind_Derived1, Kind_Derived2, Kind_Derived3 }; struct Derived1: POD { Derived1(): kind(Kind_Derived1) {} int GetFoo(); int GetBar(); int GetBaz(); int GetXyzzy(); // plus other type-specific data and function members }; struct Derived2: POD { Derived2(): kind(Kind_Derived2) {} int GetFoo(); int GetBar(); int GetBaz(); int GetXyzzy(); // plus other type-specific data and function members }; struct Derived3: POD { Derived3(): kind(Kind_Derived3) {} int GetFoo(); int GetBar(); int GetBaz(); int GetXyzzy(); // plus other type-specific data and function members }; and then the POD class's function members are implemented like this: int POD::GetFoo() { // Call kind-specific function switch (kind) { case Kind_Derived1: { Derived1 *pDerived1 = static_cast<Derived1*>(this); return pDerived1->GetFoo(); } case Kind_Derived2: { Derived2 *pDerived2 = static_cast<Derived2*>(this); return pDerived2->GetFoo(); } case Kind_Derived3: { Derived3 *pDerived3 = static_cast<Derived3*>(this); return pDerived3->GetFoo(); } default: throw UnknownKindException(kind, "GetFoo"); } } POD::GetBar(), POD::GetBaz(), POD::GetXyzzy(), and other members are implemented similarly. This example is simplified. The actual code has about a dozen different subtypes of POD, and a couple dozen methods. New subtypes of POD and new methods are added pretty frequently, and so every time we do that, we have to update all these switch statements. The typical way to handle this would be to declare the function members virtual in the POD class, but we can't do that because the objects reside in shared memory. There is a lot of code that depends on these structs being plain-old-data, so even if I could figure out some way to have virtual functions in shared-memory objects, I wouldn't want to do that. So, I'm looking for suggestions as to the best way to clean this up so that all the knowledge of how to call the subtype methods is centralized in one place, rather than scattered among a couple dozen switch statements in a couple dozen functions. What occurs to me is that I can create some sort of adapter class that wraps a POD and uses templates to minimize the redundancy. But before I start down that path, I'd like to know how others have dealt with this.

    Read the article

  • Calling functions from main() in c++

    - by Supriyo
    Hello. I have a programme that has about 100 classes and more than 1000 functions spread over 20 header and source code files. What I want to know is that how I can pass arguments to so many functions in so many files? What is the procedure adopted for this in main()? Regards, Supriyo

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >