I'm trying to change the behaviour of a Django model to allow me to access a foreign key's properties directly from the parent, e.g.
cache.part_number
vs
cache.product.part_number
I've tried overriding the __getattr__ method as follows, but I get a recursion error when I try to access the foreign key's properties
class Product(mo...
I want to use the lang variable in my code, and give the value in the if command.
Is the below code possible in .jsp page ?
<%
String language = "EN";
EN lang;
if (language.equals("EN")){
lang = new EN();
}
else if (language.equals("FR")){
lang = new FR();
}
%>
// html ...
<% out.print(lang.variable1); %>
i got thi...
the code below is not giving me the answer i want, i don't know where is the problem?
FR is the translation of EN (exactly like .properties file)
i want to read the translation from the FR.java file if
i want to reach the hello variable of fr.java or en.java from the index.jsp page. but code i wrote gives me the value from Lang.java
St...
is there any way to print top used N classes on the current java application programmaticly?
sample output: N=10
num #instances #bytes class name
--------------------------------------
1: 23 4723136 [I
2: 19 4718928 [J
3: 18 4718880 [D
4: 73925 1774200 java.lang.String
5: ...
Hi,
I have a simple php structures.
class Ingredient and class Ingredients, i have this code:
class Ingredient
{
public function objectIsValid()
{
return $validate[0];
}
}
class Ingredients
{
public $ingObject;
function __construct(){ $ingObject = new Ingredient(); }
public function validateData()
...
I have a .click() on several buttons. Each .click() calls a function. The function needs to know which button called it so that it can show or hide different content and change the styles of the other buttons. The function has an event object passed to it.
Is there a way I can get the current class that the event object has?
...
I have a problem when making flash applications with more than one frame that has symbols placed on it in that I can't declare all of the event listeners for the objects at the same time and I have found that even if I put them all on the first frame, add the event listeners, then click through to the next frame then the buttons won't wo...
I know there are solved questions related to this issue, but I still can't figure out how to resolve my problem.
I have something like this:
class Base
{
static Base* createBase()
{
Base *b = new Base();
... //does a lot of weird things
return b;
}
}
class Child : public Base
{
static Child* createChild()...
#include <iostream>
using namespace std;
class base
{
public:
void f() {cout << "base" << endl;}
virtual void v() {cout << "base (virtual)" << endl;}
};
class deriv : public base
{
public:
void f() {cout << "deriv" << endl;}
void v() {cout << "deriv (overridden)" << endl;}
};
int main()
...
Hi,
I'm new to OOP and i'm trying to get a grasp on it. What i'm trying to do is return all of the data in the table. There is only 2 rows right now, but i'm not sure how to put all the data in an array and then return it all the way back to the $results variable.
Please help.
<?php
include('dates.php');
$events = new dates();
echo...
I'm building a library where I've got a pattern like the following:
public class Foo : Foo_Impl
{
}
public class Foo_Impl
{
}
I don't want other developers to accidentally use the Foo_Impl class. What options are available to me to hide this? I'd also like to hide it from other classes in the same assembly it's defined in. Ideally...
I'm trying to implement a paymentgateway (Ewire, a danish payment gateway), and it works fine locally, but when I'm putting it online, it says I'm missing an assembly reference.
I am sure that I'm using all the assembly references I need, since it works offline, and I'm also sure that the public class is registered (it's in my masterpag...
public class A {
static class B {
}
}
public class C {
void m(X x) {
if (x instanceof A.B) { ... } // not working
}
}
Is there a way to verify if some object (x) is actually the inner class (B) of some class (A) in this scenario?
I'm getting this error, but I unfortunately have no control over the classes A and B....
Ok,
I have been browsing some php source code and need to know how the following class and sub methods use works:
<?php
$me = new Person;
$me->name("Franky")->surname("Chanyau")->phone("+22", "456 789");
?>
I have pretty solid knowledge of OOP so I don't want a 101. I just need to know how to make the above code possible.
Cheers
Fra...
Hello everyone
I have some curly question..
I can define alias for the class at top of my document, Such as
using MyName = Bla.Bla.ClassName
But can I define something like this in the method?
...
Hi guys I have this code in my css file from the @fontsquirrel generator
/// changed the code to how it is now ///
@font-face {
font-family: 'AdLibRegular';
src: url('../fonts/adlib-webfont.eot');
src: local('☺'), url('../fonts/adlib-webfont.woff') format('woff'),
url('../fonts/adlib-webfont.ttf') format('truetype'),
...
Hi,
I have a Silverlight 4 application where I am making use of shared classes. In the .Web project, I have a class called "X.Shared.cs". This class has three string properties. When I build the application, it gives an error saying "The type 'X' already contains a definition for 'Y'". It seems that the properties in the generated code ...
I have two classes, TProvider and TEncrypt. The calling application will talk to the TProvider class. The calling application will call Initialise first to obtain the handle mhProvider. I require access to this handle later when i try to perform encryption, as the TEncrypt class donot have access to this handle mhProvider. How can i get ...
Im trying to create a class called Record, though when I try to use it, something goes wrong. Im sure im overlooking something simple. Does anyone mind taking a look?
class Record:
def __init__(self, model):
self.model= model
self.doc_date = []
self.doc_pn = []
pri...
So I have 3 classes in this situation.
Connection.php
Engineer.php
Status.php
Both Engineer and Status classes actually use connection. Hasn't been a problem but now that I'm using both classes in a page I'm getting
Fatal error: Cannot redeclare class Connection
Is there a way round this? In both classes I need db access from the c...