class

why does extending PDO causes me a memory overflow?

i have a class that extends the PDO class. it's called Database. but in a particular function, the commit() function, it gets an memory overflow error. Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261900 bytes) in C:\wamp\www\igadgets\application\includes\base\classes\database.php on line 130 the fu...

How to change variable values between namespaces / classes?

Hello! I have a main form with a textBox1 with string value : asd namespace Crystal { public partial class MainForm : Form { //here is a textBox1 with text "asd" } } I want to change this textBox1 text from this class: namespace Crystal.Utilities { public class Logging { //textBox1.Text = "dsa"; } ...

pythonic way to wrap xmlrpclib calls in similar multicalls

I'm writing a class that interfaces to a MoinMoin wiki via xmlrpc (simplified code follows): class MoinMoin(object): token = None def __init__(self, url, username=None, password=None): self.wiki = xmlrpclib.ServerProxy(url + '/?action=xmlrpc2') if username and password: self.token = self.wiki.getAut...

Using HTML markup instead of classes in a JavaScript drop-down menu

Hello, I got a piece of JavaScript from a training video, but I do not like how the HTML that associated with it is built. It's an accordion-style drop down menu, and it uses classes on each of the menu items that initiate the drop-down effect. I'll post my code and explain after... <script type="text/javascript"> window.onload = initA...

How to prevent inheritance for some methods?!

Hi How can I prevent inheritance of some methods or properties in derived classes?! public class BaseClass : Collection { //Some operations... //Should not let derived classes inherit 'Add' method. } public class DerivedClass : BaseClass { public void DoSomething(int Item) { ...

UIButton in class method calls wrong buttonClicked function

I am dynamically creating buttons in a class that holds all my functions named Functions.h and .m. So I basically call my function from the class like this passing in a scrollview: [Functions buildMyCarousel:SCROLLVIEW] in that function I then call a buildButton function The problem is when I set the button up like this: [button a...

error: using typedef-name after class

I can't figure out what the actual problem is with this. typedef struct _actor { ... } _actor, Actor; class Actor { ... }; I get this weird error message actor.cpp:31: error: using typedef-name ‘Actor’ after ‘class’. Any idea what I did wrong here? Thank you :) ...

Using data from a specific class in python

storage = [] ... after running program storage = [ <main.Record instance at 0x032E8530> ] inside the instance of Record are: "Model No." "Standard: Part Number" "Standard: Issue Date" "Date of Declaration" "Declaration Document Number" Question: How do I use specific data from within the Record? ...

Use class method from another class

Hello there! Iam trying to use a method in class, from another class. namespace Crystal.Utilities { public class Logging { public static void Log() { //dostuff Crystal.MainForm.general_log_add_item("Hello World"); } } } namespace Crystal { public partial class MainForm : Form { ...

"Unresolved External Symbol" errors when creating object in C++

I'm a pretty seasoned programmer but I'm just now diving into C++ and it's... well... more difficult than PHP and Python. I keep having unresolved external errors when trying to create an object from some classes. It's broken up into multiple headers and files but here is a basic idea from one of my classes: die.h: #ifndef DIE_H #defin...

Python: How use constants for multiple clasess?

Hi! I want use a constant in Python for 2 classes. Which is the better way? Thanks in advance! MY_COLOR = "#000001" # <-------- Are correct here? BLACK = "#000000" # <-------- Are correct here? class One: MY_FONT = "monospace" def __init__(self): if MY_COLOR == BLACK: print("It's black") if sel...

what does $this mean within a class definition?

As I continue to try and improve myself as a junior PHP developer, I have started to try break down other peoples work. I find it helps me understand, as well as giving me ideas. Two things I do not get, in a PHP class, what $this means, and what array($this,'some_function') means when I would expect a function name in it's place. Many...

how to write proper method?

class Mycompute def initialize(str) @str=str end def values @@result=@str end def up @@result.upcase end end irb(main):012:0> Mycompute.new("Abc").values => "Abc" irb(main):013:0> irb(main):014:0* Mycompute.new("Abc").up => "ABC" irb(main):015:0> Mycompute.new("Abc").values.up NoMethodError: undefined me...

C#: Does Serializable() attribute prevent passing a class instance to another form?

C#: Does Serializable() attribute prevent passing a class instance to another form? I have the following classes, and is trying to build a settings module for my application. But when i try to access _configurator in settingForm method i get an exception: "object reference not set to an instance of an object". Why? [Serializable()] pub...

c2955 error on my Double Link List project

Okay, I'm making a project that implements a Double Linked List using classes, templates and structures. I constantly get the error: doublelinklist.h(21) : error C2955: 'Node' : use of class template requires template argument list when declaring the head and tail of a node in the LinkedList class. DoubleLinkList.h: #ifndef DOUBLEL...

Dynamically create classes in Java

I would like to create a class in Java based on the fields defined in my XML config file: For example: if the XML file contains (the syntax has been maligned for posting): <property name="agent_host"></property> <property name="subsystem"></property> then internally it will create a class Event such as Event(String agentHost, String s...

How can I replace the class by monkey patching?

How can I replace the ORM class - so it should not cause recursion !!! Problem: original class has the super call, when its got replaced - it causes self inheritance and causes maximum recursion depth exceed exception. i.e. class orm is calling super(orm, self).... and orm has been replaced by another class which inherits original orm.....

How to reference a function from one .m file in another?

Hi, this is a bit of a newbie question but I can't seem to find it anywhere. I have defined a class in a set of .h/.m files and have a separate .h/.m for drawing. What I'm trying to do is create an array of objects from this class, and draw them sequentially to the screen. Of course, I'm getting a 'squares' undeclared (first use in this...

How unload a ViewController class when switch to other view

Hi Everyone, How can i unload a viewController class when i switch to another view, so the class file won't run in the background anymore? Thanks for help! ...

PHP Class Logic

My question is rather simple, given: class MyClass{ function a(){ echo "F.A "; } function b(){ echo "F.B "; } } $c=new MyClass; $c->a()->b()->b()->a(); So that it will output: F.A F.B F.B F.A What changes to code need to be made for this to work, or should it work as is or even just what this is called...