oop

PyGTK: Parent window wait until child window is showed

Hi, I'm learning PyGTK and I have a parent window and a child window. Inside of a parent window's method, i create the child window and then I refresh a treeview... something like that: def add_user(self, widget, data = None): save_user.SaveUser(self.window) self.load_tree_view() But, when it's running, the child window appear...

What books to buy? Objective-C biased...

I'm trying to learn Objective-C, specifically with regard to iPhone programming. I've done programming at A level, which was 6 years ago now, and I dabble with some stuff every now and then. I was wondering what books people recommend to teach myself - I don't have a very good grasp of OOP, things like KVC/KVO (is this just ObjC?), and r...

.NET refactoring, DRY. dual inheritance, data access and separation of concerns

Back story: So I've been stuck on an architecture problem for the past couple of nights on a refactor I've been toying with. Nothing important, but it's been bothering me. It's actually an exercise in DRY, and an attempt to take it to such an extreme as the DAL architecture is completely DRY. It's a completely philosophical/theoretic...

Trying to write a Javascript class to handle dynamically adding more data to my HTML. Need some guidance

Here's what I'm aiming to achieve: HTML <fieldset id="addmore"> <p>blah</p> <a class="remove">remove me</a> </fieldset> <a class="add">add more fieldsets</a> Javascript var addmore = new AddMore($('fieldset')); addmore.buildCache(/*this will pull the innerHTML of the fieldset*/); // bind the buttons addmore.bind('add', $('a...

Benefits of Inner class in server side application

What is the use of an inner class in a Java server side application? Please explain the benefits other than Swing component containment hierarchy using inner class. ...

Help me understand how is $this used in PHP...

In plain English, how is $this used in PHP? It's such a simple concept to me in JavaScript, but for some reason in PHP I can't get my head around this variable and its function. What, at any given point, is it referring to exactly? I have only tertiary experience with OOP, and I suspect that's why it's hard for me to understand its usag...

Variable variables in OOP

Hi everyone I'm having a little struggle on this one and would appreciate some help. In PHP variable variables can easily be defined like this $a = "myVar"; $$a = "some Text"; print $myVar; //you get "some Text" Now, how do I do that in a OOP enviroment? I tried this: $a = "myVar"; $myObject->$a = "some Text"; //I must be doing some...

c# Extension method

Hello, Im trying to test my extension method that converts a list of strings in a string comma separated: public static class Extensions { public static string ToCommaString<T>(this IList<T> input) { StringBuilder sb = new StringBuilder(); foreach (T value in input) { sb.Append(value); ...

[Symfony2] Incompatible Kernel method signature

Hi, I'm encoutering a problem, but really don't understand why! I get this error when launching Symfony ( via front controller or CLI ) PHP Fatal error: Declaration of ECommerceKernel::registerContainerConfiguration() must be compatible with that of Symfony\Framework\Kernel::registerContainerConfiguration() The problem is the overr...

Subtle oop differences between java and php

I found this case ** php example ** abstract class class1{ function test(){} } abstract class class2 extends class1{ abstract function test(); } This oop concept works in Java, in PHP it doesn't. What other subtle differences there are between Java and PHP oop ? ...

Can I invoke base for overriden method.

Hi, Is it possible to invoke method A.F() from instance of B class except of using refactoring. Thanks.. class Program { public class A { public virtual void F() { Console.WriteLine( "A" ); } } public class B : A { public override void F() { Console.WriteLine( "B" );...

What is the major difference between abstract class and interface ?

In context of recent trends in interviews i have noticed that this question arises every time. But when one answers the general definition then the interviewer says everyone knows it... tell something different. Further scenarios are asked where which one will be used and be beneficial and why So kindly share any new insight into this t...

What is the best (designwise) way to pass an NSArray of model objects to a view object?

I have a BankAccount model class that contains data like account number, bank name, transactions, etc. The transactions are each instances of the Transaction class and contained in the transactions NSArray. I also have a BankAccountView that displays all this in a single view. Right now I'm passing all the data as separate variables (ie...

Initializing an object in Perl

Hi everyone, So, i'm a bit of a perl newb. Although I had something much more complicated going, i all of a sudden hit a roadblock and cannot figure out wtf is wrong with the code. I've simplified it so greatly that it's only a very small fragment of code. Test.pl package Test; sub new { my ($class) = shift; my $self = { _att...

How to pass data from a QDialog?

In Qt, what is the most elegant way to pass data from a QDialog subclass to the component that started the dialog in the cases where you need to pass down something more complex than a boolean or an integer return code? I'm thinking emit a custom signal from the accept() slot but is there something else? ...

How to reference the instantiating class

Currently I have my controller instantiating a model class. Every time I create this class I need to set the logged in user's info in the model. I feel like there is a more elegant way of doing this, but I'm not sure how to do it :-( Here is an example of the code: $leadModel = new Application_Model_DbTable_Leads; $leadModel->user = ...

Assigning an ID to a new object

I've got a simple domain object, Movie, with the following constructor: public Movie(string title, int year = 0, Genre genre = Genre.None, int length = 0, IEnumerable<string> actors = null) { ... } There is no ID parameter, as there couldn't be a way to know up front what the ID would be. Movie does have an int Id property. This obje...

Dependency Injection and AppSettings

Let's say I am defining a browser implementation class for my application: class InternetExplorerBrowser : IBrowser { private readonly string executablePath = @"C:\Program Files\...\...\ie.exe"; ...code that uses executablePath } This might at first glance to look like a good idea, as the executablePath data is near the code ...

Android; Pulling out contact info, should you map to custom domain class or is there one provided?

When picking out contact details, is there a built in domain class they can be mapped to? Or, do you have to create your own? For example I do the following : ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); String s = null; if (cursor.getCount() >...

Would you write this code the same way using OOP PHP ?

Hello everyone, I'm trying to go oop with one of my scripts. It's a contact script which deals with encodings when sending an email through jQuery's ajax function. I wanted to make the user able to use the same script with two forms in the same page and making it an easy job. Now I've made a prototype of how it's going to be rewritte...