class

Javascript - if statement not working?

I'm trying to set a class to active depending on the url. I'm trying to use the code below, but in every case, it activates the active class for the second tab. var pathname = window.location.pathname; if(pathname = '/learn/subsection2') { $("ul.tabs li:eq(1)").addClass("active").show(); //Activate second tab ...

C# Beginner: Where has my IList.Where() method gone?

Hi guys I've got another simple one (I think) that's stumping me. I have written a method in one of my controls that gets the latest version of a file in a CMS given it's filename (i.e. regardless of what folder the file resides in). I found it useful enough that I thought I'd chuck it in my CMSToolbox class, but when I do this I can no...

Best practice: ordering of public/protected/private within the class definition?

I am starting a new project from the ground up and want it to be clean / have good coding standards. In what order do the seasoned developers on here like to lay things out within a class? A : 1) public methods 2) private methods 3) public vars 4) private vars B : 1) public vars 2) private vars 3) public methods 4) private methods C :...

In what order are the different parts of a class initialized when a class is loaded in the JVM?

Imagine a Java class which has most features that you can find in a class. For example: it inherits from another class, implements a couple of interfaces, includes some 'static final' constants, some final constants, some static variables, instance variables, a static block, an unnamed code block (just code in {}), constructors, methods...

Loading .swc assets into array, in pure Actionscript 3 project

Hello, I know how to get Flash CS4 symbols into Flash Builder via .swc. The class names become available in the main class, but I can only instantiate those one by one, writing each name into the code. How can I loop through the .swc and load its assets in an array without mentioning their name, then obtain and use these names for inst...

Python nested classes scope

Im trying to understand scope in nested classes in python. Here is my example code : class OuterClass: outer_var = 1 class InnerClass: inner_var = outer_var The creation of class does not complete and I get the error : <type 'exceptions.NameError'>: name 'outer_var' is not defined trying inner_var = Outerclass...

How to make a Small system to comment on a individuals in a group in PHP?

I am building a team roster application. It takes a team class (this is a quick mockup not the actual class as my question does not pertain to it) class Team { function __construct($teamName, $roster){ $this->setName($teamName); $this->setRoster($roster); } I didn't include the set functions because this class is ...

(javacript) what are prototypes?

What is a prototype for a javascript class? In other words, what is the different between Example.prototype.method {} and Example.method{} when defining the Example class? edit: for those interested, i found a great explanation (in addition to the answer below) here for the difference between class methods and constructor methods...

how to store an hashtable or object in cookie

How to store object or hashtable in cookies? I am trying to store multiple values in hastable/class to the cookie in my asp.net mvc (C#) application. How to do it? ...

Class attribute evaluation and generators

How exactly does Python evaluate class attributes? I've stumbled across an interesting quirk (in Python 2.5.2) that I'd like explained. I have a class with some attributes that are defined in terms of other, previously defined attributes. When I try using a generator object, Python throws an error, but if I use a plain ordinary list c...

Nested Class In Signed Java Applet

I'v been playing with java applets recently. In the one im writing now I have a static nested class. It works fine in the viewer, but when I compile it I get 2 class files. classname.class and classname$nestedclassname.class. I've never encountered anything like this (started java a week ago) and I don't how I would jar/sign them. Also, ...

Save/Load Properties to file or databse provider

I need to save and load properties of a Class dynamicly, but what is the best practis for this ? I have for now, two classes that I need to save. public abstract class BaseComponent { protected int ComponentID { get; set; } protected string ComponentName { get; set; } protected Dictionary GetAllProperties{) { /* Reflection *...

C#: Inheriting separate static members for derived classes.

My problem in brief: class A { /* Other stuff in my class*/ protected static staticMember; } class B : A { /* Other stuff in my class*/ // Will have A.staticMember but I want B.staticMember (same type) } class C : A { /* Other stuff in my class*/ // Will have A.staticMember but I want C.staticMember (same type) } ...

An error with Haskell classes I fall all the time and can't understand

Hi, there's an error I come across all the time but can't understand how to make it right. An example of code that gives me this error is: class Someclass a where somefunc :: (Num b) => b -> a -> a data Sometype = Somecons Int instance Someclass Sometype where somefunc x (Somecons y) = Somecons (x+y) The error message is: ...

Method accessing protected property of another object of the same class

Should an object's method be able to access a protected property of another object of the same class? I'm coding in PHP, and I just discovered that an object's protected property is allowed to be accessed by a method of the same class even if not of the same object. In the example, at first, you'll get "3" in the output - as function r...

Java: Getting the properties of a class to construct a string representation

Let's say I have a class like this (and also further assume that all the private variables: public class Item { private String _id = null; private String _name = null; private String _description = null; ... } Now, if I want to build a toString() representation of this class, I would do something like this inside ...

Python data structure/object to model static multidimensional table

I'm just getting back into coding after a few year hiatus and I'm trying to model multi-tiered static forms in a way that lets me grab and perform operations on a specific form level or an entire sub-tree. Example Form hierarchy: MyForm Question 1 Part 1 Question 1.1 Part 2 Question 2.1 SubPart 1 Question 2.1.1 Question 2.1.2 Q...

Does a Facebook wrapper class written in PHP exist? like Twitter wrapper class written in PHP.

Where can i get a similiar http://code.google.com/p/php-twitter/ class for facebook? The above class is very easy if i need to update my status on twitter i just do $twitter->updatestatus("blabla"); i need a similiar class for facebook where can i get it? ...

jquery: Toggle class on mouseover/mouseout of element, but keep class if click inside element?

Hi, suspect I'm trying to be too clever for my own good with this one! I'm working on a jQuery plugin function that will toggle a class on/off on an element when you hover in/out, but doesn't remove the class if you click inside the element before hovering out and doesn't toggle if the element already has that class before hovering in. ...

call member function by reference php

Please stop me if i am doing something wrong. It works but somehow it doesn't appear the right way to me... Look at the member function call in talks.php. Does this look right to you? Is there a better way to solve that? Thanks. show.php I am passing my user class by reference: $talks = new talks($comments, $user); talks.php: [.....