classname

getting the name of a class through an instance of that class

I have a function that takes as parameters 2 instances of a (custom) class. But they can each be one of several classes, and I need to then call another function based on what type they are. I'd like to do something like this: function any_any(inst1, inst2) { this[inst1.classname + "_" + inst2.classname] (inst1, inst2); } function C...

Getting name of the class from an instance

Hi everyone I have the following problem: I get an instance of a class passed and want to know the name of the class of this instance. Any guess how to get this? Thank you very much! ...

C# .cs file name and class name need to be matched?

In Java the file name must be the public class name defined in that java file. Does C# has similar requirement? can I have a A.cs file which only defines a public Class B inside? thanks, ...

What does _Default keyword mean in c#

For example, I have created a webpage and it has _Default keyword in it. public partial class _Default : System.Web.UI.Page What does that keyword do in here? What is the point ? ...

PHP: Get class name of passed var?

I have a function that gets a class passed to it as a parameter. I would like to get the class name of the passed class as a string. I tried putting this method in the passed class: function getClassName() { return __CLASS__; } but if the class is extended I assumed this would return the name of the subclass but it st...

jQuery - replace loop by className

function loadTextboxes() { var textareas = document.getElementsByTagName('textarea'); for(var i=0; i < textareas.length; i++) { if (textareas.item(i).className == "richtextbox") { richtextbox(textareas.item(i)); } } } //window.attachEvent('onload',loadTextboxes); $(document).ready(fu...

How can I find a Qt metaobject instance from a class name?

Is there a way to find the QMetaObject instance of a class, given the class name? what I like to do is to load objects from disk, but for this to happen, I need a way to retrieve a QMetaObject instance using the name of a class, in order to use the QMetaObject to create an instance. ...

What characters are widely supported in CSS class names?

As detailed here among other places, the only valid characters in a html/css class name is a-z, A-Z, 0-9, hyphen and underscore, and the first character should be a letter. But in practice, what characters are in fact supported by most browsers? More specifically, I wonder what browsers properly understands a slash (/) in a class name, a...

How can I easily get a Scala case class's name?

Given: case class FirstCC { def name: String = ... // something that will give "FirstCC" } case class SecondCC extends FirstCC val one = FirstCC() val two = SecondCC() How can I get "FirstCC" from one.name and "SecondCC" from two.name? ...

How do I get element's className inside loop of elements?

I am trying to create a function that given a divid, and a list of classes, will then do some text replacing inside them. Having learned of how Firefox Dom is handling text nodes differently, I read that I had to use javascript to loop through the elements, sibling to nextSibling. The last obstacle I had in my script, of which you see...

Delete table in all the rendering pages of a single page in Javascript

I am having a table like: <table id="toc" class="toc" border="1" summary="Contents"> </table> in many pages. All these pages are rendered in a single page. When I apply the javascript to delete that using on load with the below: var tbl = document.getElementById('toc'); if(tbl) tbl.parentNode.removeChild(tbl); Only one table is del...

How to set incremental CSS classes in each Table Cell with jQuery?

I have a table populated via a DB and it renders like so (it could have any number of columns referring to "time", 5 columns, 8 columns, 2 columns, etc): <table id="eventInfo"> <tr> <td class="name">John</td> <td class="date">Dec 20</td> <td class="**time**">2pm</td> <td class="**time**">3pm</td> <td class="*...

How do I fire a click event with a checkbox in jquery using the validator

Hi guys, How do I trigger validation (using the validate plugin) from a group of checkboxes using jQuery, without using the name of the checkbox (this is controlled by the serverside app)? The validation message is currently displayed only once -(when you press the submit button) and I need it to be fired everytime a checkbox gets trigg...

Is it poor form to use CLASS attributes with no corresponding CSS rule?

For example if I wanted to select some elements with a certain class using jQuery, and for that reason only, is it always expected that those classes SHOULD be defined in the css?. <div class="xyz"> something </div> <div class="xyz"> something else </div> //with example jQuery $(".xyz").hide(); //is it wrong no element 'xyz' is defin...

Code don't work, can't read property 'className' of undefined

What is wrong with this code? var divarray = []; var articleHTML = []; var absHTML; var keyHTML; var bodyHTML = []; var i = 0; divarray = document.getElementById("yui-main").getElementsByTagName("div"); for ( var j in divarray) { if(divarray[i].className == "articleBody"){ articleHTML = divarray[i]; for( var k in art...

What to name an array of flags?

I have a project where lots of the objects hold state by maintaining simple boolean flags. There are lots of these, so I maintain them within a uint32_t and use bit masking. There are now so many flags to keep track of, I've created an abstraction for them (just a class wrapping the uint32_t) with set(), clear(), etc. My question: Wha...

fullCalendar className to multiple eventSources

I am trying to setup my fullCalendar event sources. instead of pulling all of my events through 1 source, I would like to use multiple sources (ie: google, and local json) Here is what I have so far (In short): eventSources: [ //CA HOLIDAYS $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/en.canadian%23holiday%40group.v....

Creating object based on string parsed in

Suppose I have a class Image. At some point in parsing, "Image" is read in at the appropriate time, meaning I want to create an object of class Image. What I'm considering is mapping these strings to a constructor call to the appropriate class, but I'm not sure how to accomplish this. I.e. container.push_back( some_map[stringParsedI...

How to retrieve a element by class name by its position

How do you translate the following into jQuery? document.getElementsByClassName('x')[5] $('.x')[5] does not seem to work. i could go with a $('.x').each(){function(i){ if(i==5) return $(this) }) but there must be an easier inline way. ...

Ambiguous Class Namespace Issue

I... feel really silly asking this, but I'm not sure how to resolve the problem. This is a little snippit of my code (Objective-C++): #include "eq/eq.h" namespace eqOther { class Window : public eq::Window //<-- Error occurs here { public: Window( eq::Pipe* parent ) : eq::Window( parent ) {} void popup(); ...