Search Results

Search found 56661 results on 2267 pages for 'class library'.

Page 10/2267 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Is it legal to extend the Class class?

    - by spiralganglion
    I've been writing a system that generates some templates, and then generates some objects based on those templates. I had the idea that the templates could be extensions of the Class class, but that resulted in some magnificent errors: VerifyError: Error #1107: The ABC data is corrupt, attempt to read out of bounds. What I'm wondering is if subclassing Class is even possible, if there is perhaps some case where doing this would be appropriate, and not just a gross misuse of OOP. I believe it should be possible, as ActionScript allows you to create variables of the Class type. This use is described in the LiveDocs entry for Class, yet I've seen no mentions of subclassing Class. Here's a pseudocode example: class Foo extends Class var a:Foo = new Foo(); trace(a is Class) // true, right? var b = new a(); I have no idea what the type of b would be. In summary: can you subclass the Class class? If so, how can you do it without errors, and what type are the instances of the instances of the Class subclass?

    Read the article

  • Function returning a class containing a function returning a class

    - by Scott
    I'm working on an object-oriented Excel add-in to retrieve information from our ERP system's database. Here is an example of a function call: itemDescription = Macola.Item("12345").Description Macola is an instance of a class which takes care of database access. Item() is a function of the Macola class which returns an instance of an ItemMaster class. Description() is a function of the ItemMaster class. This is all working correctly. Items can be be stored in more than one location, so my next step is to do this: quantityOnHand = Macola.Item("12345").Location("A1").QuantityOnHand Location() is a function of the ItemMaster class which returns an instance of the ItemLocation class (well, in theory anyway). QuantityOnHand() is a function of the ItemLocation class. But for some reason, the ItemLocation class is not even being intialized. Public Function Location(inventoryLocation As String) As ItemLocation Set Location = New ItemLocation Location.Item = item_no Location.Code = inventoryLocation End Function In the above sample, the variable item_no is a member variable of the ItemMaster class. Oddly enough, I can successfully instantiate the ItemLocation class outside of the ItemMaster class in a non-class module. Dim test As New ItemLocation test.Item = "12345" test.Code = "A1" quantityOnHand = test.QuantityOnHand Is there some way to make this work the way I want? I'm trying to keep the API as simple as possible. So that it only takes one line of code to retrieve a value.

    Read the article

  • Music library clean up tool

    - by thegreyspot
    I wanted to know if there were any music library clean up tools. I am using Winamp so if it was capable the better. I'm looking to clean out duplicate songs and finding missing tags and album art. PS. make sure its free :)

    Read the article

  • How does GCC compile applications that reference a static library

    - by technobrat
    I've read that the gcc compiler can perform certain optimization when compiling an application that references a static library, for instance - it will "pull" in only that code from the static library that the application depends upon. This helps keep the size of the application's executable to a minimum if portions of the static library are not being used by the app. 1) Is this true? 2) How does GCC know what code from the static library the application is actually using? Does it only look t the header files that are included (directly and indirectly) in the application and then pull code accordingly? Or does it actually look at what methods from the static library are being called?

    Read the article

  • Netbeans Editor Library?

    - by Jeremybub
    Netbeans seems to say in several places that it supports a library to just host the "Netbeans editor" widget in some other program. It has some weird documentation that seems to say a lot, but doesn't really say much about how to use it: http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-lib2/architecture-summary.html I can't seem to find any download for the "Netbeans editor library" (1 or 2), and the documentation they provide says to download the entire mercurial repository, which doesn't really help me, since it doesn't tell me what is part of this "library" and what is not. If someone could point me to a download for this library, or some minimal documentation about how to use it, that would be great. I've already seen the blog post here, but it doesn't really help with getting the library, and it seems to be talking about classes which I can't find in the Netbeans sources I downloaded (Maybe a different version?)

    Read the article

  • Newly created Document library are not visible on sharepoint using webservices

    - by Royson
    Hi, I am able to create Document library. Lists listService = new Lists(); listService.PreAuthenticate = true; listService.Credentials = new NetworkCredential(username,password,domain; String url = "http://YourServer/SiteName/"; listService.Url = url @ + /_vti_bin/lists.asmx"; XmlNode ndList = listService.AddList(NewListName, "Description", 101); It is working successfully. But Problem i am facing is: New Document library are not visible in site. I tried with comparing Field Value of Both Visible and No-Visible Document library. Difference i found is : Visible Library (Created Manually) doesn't contain Version value. were as it it present in library which are created by this code. Can you help me out in this?

    Read the article

  • Eclipse, Android ndk, source files, and library project dependencies

    - by Android Noob
    In Microsoft Visual Studio 2010, it is possible to create a Solution with multiple projects and set dependencies between projects. I'm trying to figure out if the same thing can be done using Eclipse via the NDK. More specifically, I want to know if it is possible to create C source files in an ordinary Android project that can reference C header files in an Android library project. For example: Android library project: Sockets Ordinary Android project: Socket_Server Sockets contains all the C header/source files that are needed to do socket I/O. Socket_Server contains test code that makes calls to the functions that are defined in Sockets library project. This test code requires a header file that contains the function declaration of all API calls. I already set the library dependencies between the projects via: Properties > Android > Library > Add

    Read the article

  • Variables in static library are never initialized. Why?

    - by Coyote
    I have a bunch of variables that should be initialized then my game launches, but must of them are never initialized. Here is an example of the code: MyClass.h class MyClass : public BaseObject { DECLARE_CLASS_RTTI(MyClass, BaseObject); ... }; MyClass.cpp REGISTER_CLASS(MyClass) Where REGISTER_CLASS is a macro defined as follow #define REGISTER_CLASS(className)\ class __registryItem##className : public __registryItemBase {\ virtual className* Alloc(){ return NEW className(); }\ virtual BaseObject::RTTI& GetRTTI(){ return className::RTTI; }\ }\ \ const __registryItem##className __registeredItem##className(#className); and __registryItemBase looks like this: class __registryItemBase { __registryItemBase(const _string name):mName(name){ ClassRegistry::Register(this); } const _string mName; virtual BaseObject* Alloc() = 0; virtual BaseObject::RTTI& GetRTTI() = 0; } Now the code is similar to what I currently have and what I have works flawlessly, all the registered classes are registered to a ClassManager before main(...) is called. I'm able to instantiate and configure components from scripts and auto-register them to the right system etc... The problem arrises when I create a static library (currently for the iPhone, but I fear it will happen with android as well). In that case the code in the .cpp files is never registered. Why is the resulting code not executed when it is in the library while the same code in the program's binary is always executed? Bonus questions: For this to work in the static library, what should I do? Is there something I am missing? Do I need to pass a flag when building the lib? Should I create another structure and init all the __registeredItem##className using that structure?

    Read the article

  • How to install custom c library?

    - by arijit
    I just wanted to add a c library to Ubuntu which was created by Harvard University for cs50 course. They provided instructions for how to install the library which is listed below. Debian, Ubuntu First become root, as with: sudo su - Then install the CS50 Library as follows: apt-get install gcc wget http://mirror.cs50.net/library/c/cs50-library-c-3.1.zip unzip cs50-library-c-3.1.zip rm -f cs50-library-c-3.1.zip cd cs50-library-c-3.1 gcc -c -ggdb -std=c99 cs50.c -o cs50.o ar rcs libcs50.a cs50.o chmod 0644 cs50.h libcs50.a mkdir -p /usr/local/include chmod 0755 /usr/local/include mv -f cs50.h /usr/local/include mkdir -p /usr/local/lib chmod 0755 /usr/local/lib mv -f libcs50.a /usr/local/lib cd .. rm -rf cs50-library-c-3.1 I did exactly as directed. But the compiler reported “Undefined reference to a function”--the function was Get String. So, I searched for a solution and found one. It said to use the -l switch. Now when I compile I use something like: gcc –o hello.c hello –lcs50 (I don’t remember the exact command.) However, I cannot use the make command, which is easier to use. I understand that there is some problem with linking the library. What is a good solution to this problem?

    Read the article

  • Gathering IP address and workstation information; does it belong in a state class?

    - by p.campbell
    I'm writing an enterprisey utility that collects exception information and writes to the Windows Event Log, sends an email, etc. This utility class will be used by all applications in the corporation: web, BizTalk, Windows Services, etc. Currently this class: holds state given to it via public properties calls out to .NET Framework methods to gather information about runtime details. Included are call to various properties and methods from System.Environment, Reflection details, etc. This implementation has the benefit of allowing all those callers not to have to make these same calls themselves. This means less code for the caller to forget, screw up, etc. Should this state class (please what's the phrase I'm looking for [like DTO]?) know how to resolve/determine runtime details (like the IP address and machine name that it's running on)? It seems to me on second thought that it's meant to be a class that should hold state, and not know how to call out to the .NET Framework to find information. var myEx = new AppProblem{MachineName="Riker"}; //Will get "Riker 10.0.0.1" from property MachineLongDesc Console.WriteLine("full machine details: " + myEx.MachineLongDesc); public class AppProblem { public string MachineName{get;set;} public string MachineLongDesc{ get{ if(string.IsNullOrEmpty(this.MachineName) { this.MachineName = Environment.MachineName; } return this.MachineName + " " + GetCurrentIP(); } } private string GetCurrentIP() { return System.Net.Dns.GetHostEntry(this.MachineName) .AddressList.First().ToString(); } } This code was written by hand from memory, and presented for simplicity, trying to illustrate the concept.

    Read the article

  • class __init__ (not instance __init__)

    - by wallacoloo
    Here's a very simple example of what I'm trying to get around: class Test(object): some_dict = {Test: True} The problem is that I cannot refer to Test while it's still being defined Normally, I'd just do this: class Test(object): def __init__(self): self.__class__.some_dict = {Test: True} But I never create an instance of this class. It's really just a container to hold a group of related functions and data (I have several of these classes, and I pass around references to them, so it is necessary for Test to be it's own class) So my question is, how could I refer to Test while it's being defined, or is there something similar to __init__ that get's called as soon as the class is defined? If possible, I want self.some_dict = {Test: True} to remain inside the class definition. This is the only way I know how to do this so far: class Test(object): @classmethod def class_init(cls): cls.some_dict = {Test: True} Test.class_init()

    Read the article

  • Derive abstract class from non-abstract class

    - by Jehof
    Is it OK to derive an abstract class from a non-abstract class or is there something wrong with this approach? Here´s a little example: public class Task { // Some Members } public abstract class PeriodicalTask : Task { // Represents a base class for task that has to be done periodicaly. // Some additional Members } public class DailyTask : PeriodicalTask { // Represents a Task that has to be done daily. // Some additional Members } public class WeeklyTask : PeriodicalTask { // Represents a Task that has to be done weekly. // Some additional Members } In the example above i do not want to make the class Task abstract, because i want to instantiate it directly. PeriodicalTask should inherit the functionality from Task and add some additional members but i do not want to instantiate it directly. Only derived class of PeriodicalTask should be instantiated.

    Read the article

  • Building iPhone static library for armv6 and armv7 that includes another static library

    - by Martijn Thé
    Hi, I have an Xcode project that has a "master" static library target, that includes/links to a bunch of other static libraries from other Xcode projects. When building the master library target for "Optimized (armv6 armv7)", an error occurs in the last phase, during the CreateUniversalBinary step. For each .o file of the libraries that is included by the master library, the following error is reported (for example, the FBConnectGlobal.o file): warning for architecture: armv6 same member name (FBConnectGlobal.o) in output file used for input files: /Developer_Beta/Builds/MTToolbox/MTToolbox.build/Debug-iphoneos/MTToolbox.build/Objects-normal/armv6/libMTToolbox.a(FBConnectGlobal.o) and: /Developer_Beta/Builds/MTToolbox/MTToolbox.build/Debug-iphoneos/MTToolbox.build/Objects-normal/armv7/libMTToolbox.a(FBConnectGlobal.o) due to use of basename, truncation and blank padding In the end, Xcode tells that the build has succeeded. However, when using the final static library in an application project, it won't build because it finds duplicate symbols in one part of build (armv6) and misses symbols in the other part of the build (armv7). Any ideas how to fix this? M

    Read the article

  • Java - abstract class, equals(), and two subclasses

    - by msr
    Hello, I have an abstract class named Xpto and two subclasses that extend it named Person and Car. I have also a class named Test with main() and a method foo() that verifies if two persons or cars (or any object of a class that extends Xpto) are equals. Thus, I redefined equals() in both Person and Car classes. Two persons are equal when they have the same name and two cars are equal when they have the same registration. However, when I call foo() in the Test class I always get "false". I understand why: the equals() is not redefined in Xpto abstract class. So... how can I compare two persons or cars (or any object of a class that extends Xpto) in that foo() method? In summary, this is the code I have: public abstract class Xpto { } public class Person extends Xpto{ protected String name; public Person(String name){ this.name = name; } public boolean equals(Person p){ System.out.println("Person equals()?"); return this.name.compareTo(p.name) == 0 ? true : false; } } public class Car extends Xpto{ protected String registration; public Car(String registration){ this.registration = registration; } public boolean equals(Car car){ System.out.println("Car equals()?"); return this.registration.compareTo(car.registration) == 0 ? true : false; } } public class Teste { public static void foo(Xpto xpto1, Xpto xpto2){ if(xpto1.equals(xpto2)) System.out.println("xpto1.equals(xpto2) -> true"); else System.out.println("xpto1.equals(xpto2) -> false"); } public static void main(String argv[]){ Car c1 = new Car("ABC"); Car c2 = new Car("DEF"); Person p1 = new Person("Manel"); Person p2 = new Person("Manel"); foo(p1,p2); } }

    Read the article

  • VIrtual class problem

    - by ugur
    What i think about virtual class is, if a derived class has a public base, let's say, class base, then a pointer to derived can be assigned to a variable of type pointer to base without use of any explicit type conversion. But what if, we are inside of base class then how can we call derived class's functions. I will give an example: class Graph{ public: Graph(string); virtual bool addEdge(string,string); } class Direct:public Graph{ public: Direct(string); bool addEdge(string,string); } Direct::Direct(string filename):Graph(filename){}; When i call constructor of Direct class then it calls Graph. Now lets think Graph function calls addedge. Graph(string str){ addedge(str,str); } When it calls addedge, even if the function is virtual, it calls Graph::edge. What i want is, to call Direct::addedge. How can it be done?

    Read the article

  • Virtual class problem

    - by ugur
    What i think about virtual class is, if a derived class has a public base, let's say, class base, then a pointer to derived can be assigned to a variable of type pointer to base without use of any explicit type conversion. But what if, we are inside of base class then how can we call derived class's functions. I will give an example: class Graph{ public: Graph(string); virtual bool addEdge(string,string); } class Direct:public Graph{ public: Direct(string); bool addEdge(string,string); } Direct::Direct(string filename):Graph(filename){}; When i call constructor of Direct class then it calls Graph. Now lets think Graph function calls addedge. Graph(string str){ addedge(str,str); } When it calls addedge, even if the function is virtual, it calls Graph::edge. What i want is, to call Direct::addedge. How can it be done?

    Read the article

  • PHP: require_once library -> failed to open stream

    - by matt
    I might be a bit confused and may need your help with this. I'm inside inc/newsletter.php and want to include a library that is inside lib/mailchimp-api-class How do I refer to this class file? I thought it should be … require_once '../lib/mailchimp-api-class/MCAPI.class.php'; However, this doesn't work …  Warning: require_once(../lib/mailchimp-api-class/MCAPI.class.php) [function.require- once]: failed to open stream: No such file or directory in /Users/myname/htdocs/wr/ wp-content/themes/mytheme/inc/newsletter.php on line 6

    Read the article

  • Python overriding class (not instance) special methods

    - by André
    How do I override a class special method? I want to be able to call the __str__() method of the class without creating an instance. Example: class Foo: def __str__(self): return 'Bar' class StaticFoo: @staticmethod def __str__(): return 'StaticBar' class ClassFoo: @classmethod def __str__(cls): return 'ClassBar' if __name__ == '__main__': print(Foo) print(Foo()) print(StaticFoo) print(StaticFoo()) print(ClassFoo) print(ClassFoo()) produces: <class '__main__.Foo'> Bar <class '__main__.StaticFoo'> StaticBar <class '__main__.ClassFoo'> ClassBar should be: Bar Bar StaticBar StaticBar ClassBar ClassBar Even if I use the @staticmethod or @classmethod the __str__ is still using the built in python definition for __str__. It's only working when it's Foo().__str__() instead of Foo.__str__().

    Read the article

  • Flash AS3 - Dispatching Events from Parent Class to Child Class

    - by John Russell
    I think this is a pretty simply problem but I do not seem to be able to pull it off. Basically I have a parent class A, and a child class B. Class A instantiates class B with addChild. There is a shared object which is being updated from a java server (red5) that has an event listener attached to it in class A. I have a function in class A which will pass certain, specific updates from this shared object to class B. The problem occurs is that when class B is instantiated, the event listener from class A doesn't work anymore. I have not removed the event listener from A. Any thoughts?

    Read the article

  • Override bits of a CSS class while inline?

    - by larryq
    I have an html img that is being styled by a CSS class. I would like to override the width and height values used in that class under some circumstances. I'm building this img tag using something called a TagBuilder class, provided by Microsoft for the .Net system, which allows developers to assign attributes to an html element. In this case a CSS class has been assigned to the img tag, and I can assign width and height attributes individually, but they're not taking precedence over the values set in the CSS class. My tag looks like this currently: <img alt="my link" class="static" height="240" id="StaticImage" src="http://imageserver.com/myImage.jpg" width="240"> The static CSS class has width and height values of 300 each, and as you can see I'm trying to override them with 240. It's not working in this instance but can I do it without a second CSS class?

    Read the article

  • python class attribute

    - by chnet
    Hi, i have a question about class attribute in python. class base : def __init__ (self): pass derived_val = 1 t1 = base() t2 = base () t2.derived_val +=1 t2.__class__.derived_val +=2 print t2.derived_val # its value is 2 print t2.__class__.derived_val # its value is 3 The results are different. I also use id() function to find t2.derived_val and t2.class.derived_val have different memory address. My problem is derived_val is class attribute. Why it is different in above example? Is it because the instance of class copy its own derived_val beside the class attribute?

    Read the article

  • Python Class inherit from all submodules

    - by Dhruv Govil
    I'm currently writing a wrapper in python for a lot of custom company tools. I'm basically going to break each tool into its own py file with a class containing the call to the tool as a method. These will all be contained in a package. Then there'll be a master class that will import all from the package, then inherit from each and every class, so as to appear as one cohesive class. masterClass.py pyPackage - __ init__.py - module1.py --class Module1 ---method tool1 - module2.py --class Module2 ---method tool2 etc Right now, I'm autogenerating the master class file to inherit from the packages modules, but I was wondering if there was a more elegant way to do it? ie from package import * class MasterClass(package.all): pass

    Read the article

  • cast operator to base class within a thin wrapper derived class

    - by miked
    I have a derived class that's a very thin wrapper around a base class. Basically, I have a class that has two ways that it can be compared depending on how you interpret it so I created a new class that derives from the base class and only has new constructors (that just delegate to the base class) and a new operator==. What I'd like to do is overload the operator Base&() in the Derived class so in cases where I need to interpret it as the Base. For example: class Base { Base(stuff); Base(const Base& that); bool operator==(Base& rhs); //typical equality test }; class Derived : public Base { Derived(stuff) : Base(stuff) {}; Derived(const Base& that) : Base(that) {}; Derived(const Derived& that) : Base(that) {}; bool operator==(Derived& rhs); //special case equality test operator Base&() { return (Base&)*this; //Is this OK? It seems wrong to me. } }; If you want a simple example of what I'm trying to do, pretend I had a String class and String==String is the typical character by character comparison. But I created a new class CaseInsensitiveString that did a case insensitive compare on CaseInsensitiveString==CaseInsensitiveString but in all other cases just behaved like a String. it doesn't even have any new data members, just an overloaded operator==. (Please, don't tell me to use std::string, this is just an example!) Am I going about this right? Something seems fishy, but I can't put my finger on it.

    Read the article

  • Getting the name of a child class in the parent class (static context)

    - by Benoit Myard
    Hi everybody, I'm building an ORM library with reuse and simplicity in mind; everything goes fine except that I got stuck by a stupid inheritance limitation. Please consider the code below: class BaseModel { /* * Return an instance of a Model from the database. */ static public function get (/* varargs */) { // 1. Notice we want an instance of User $class = get_class(parent); // value: bool(false) $class = get_class(self); // value: bool(false) $class = get_class(); // value: string(9) "BaseModel" $class = __CLASS__; // value: string(9) "BaseModel" // 2. Query the database with id $row = get_row_from_db_as_array(func_get_args()); // 3. Return the filled instance $obj = new $class(); $obj->data = $row; return $obj; } } class User extends BaseModel { protected $table = 'users'; protected $fields = array('id', 'name'); protected $primary_keys = array('id'); } class Section extends BaseModel { // [...] } $my_user = User::get(3); $my_user->name = 'Jean'; $other_user = User::get(24); $other_user->name = 'Paul'; $my_user->save(); $other_user->save(); $my_section = Section::get('apropos'); $my_section->delete(); Obviously, this is not the behavior I was expecting (although the actual behavior also makes sense).. So my question is if you guys know of a mean to get, in the parent class, the name of child class.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >