class

Determine Final Destination of a Shortened URL

I'm trying to find the best way (in code) to determine the final destination of a shortened URL. For instance http://tinyurl.com redirects to an eBay auction. I'm trying to get the URL for the eBay auction. I'm trying to do this from within .NET so I can compare multiple URLs to ensure that there is no duplicates. TIA ...

Static classes with iPhone

I was just wondering if this is possible... if I have a "Static class" (a class with a bunch of static methods) is it possible to have a class variable and access it through one of the static methods? I am getting a warning of "instance variable accessed in class method". I maybe just not getting it. Is there anyone that can answer this...

Questions about Lists and other stuff in Clojure

Hello everyone, I have a few questions concerning Lists, classes and variables in clojure. This may seem quite stupid but how do I access elements in a List ? I'm coding a program that allows you to manipulate a phonebook; You can add an entry, delete one or print the information about one. This leads me to two questions : Is the...

What's the quickest way to navigate to the top of a class in Visual Studio

If I'm editing deep within the body of a class, what would be the quickest (ie. fewest keyboard shortcuts) way to navigate to the top of the class declaration (the line that contains "class ClassName" ...

getting only name of employee by his ID. So one static class with only one method?!

Hi I need to get name of an employee by his ID by querying to DB. It seems that need a class. But a class with only one method.....is it good idea or what else do you suggest? ...

CSS class priorities

Hi All, I have a question about the priority of CSS classes after encountering a problem today. The situation is as follows: I have an unordered list which has a class associated with it. The LI tags has some styles defined too. I want to change the styling of the LIs after a click (a "selected" class) but the added class's styles are...

Localization in Class Library

Hello I would like to localize my c# class library The library will output a .dll file, which I will distribute to .net application bin folders. I want localization in the class library but I do not want to have to recompile the DLL each time a localization change is required. So ideally.... have c# class with resx files outside the...

How do I properly create an HTML class?

I'm working on an HTML class in PHP, so that we can keep all our HTML output consistent. However, I'm having some trouble wrapping my head around the logic. I'm working in PHP, but answers in any language will work. I want the class to properly nest the tags, so I want to be able to call like this: $html = new HTML; $html->tag("html...

c++ templatized interface

This is best described in pseudo-code: class Thing {}; interface ThingGetter<T extends Thing> { T getThing(); } class Product extends Thing {}; class ProductGetter<Product> { Product getThing() { // Some product code } } class SpecialProductGetter extends ProductGetter { Product getThing() { p = Produ...

Using parent variables in extending class

Hi, I have three classes MainClass, Member, and Project. Member and Project extend the MainClass. First I create a MainClass object, then a Member object and execute the function setMember: $mainclass = new MainClass(); $member = new Member($id); $mainclass->setMember($member); When the $member variable is set to the current member ...

Proper Use of a Class Instance

I'm using Access 2003 VBA to process recursive data for manufacturing BOMs. I built a class module to let my main tables have static scope. This seems to simplify recursion -- it sets me free from counting levels down and up again as I traverse a BOM. I'm not opening the same recordset redundantly; I'm filtering a lot instead. Afte...

Need ways to speed up PHP methods

I ended up creating my own HTML class, mainly to keep all our output consistent. The code is below. <?php /** * A class to generate html tags * @author Glen Solsberry */ class HTML { private $isOpen; /** * holds all information about tags * @var $tags array */ private $tags; private $current_tag = 0;...

Javascript this does not point to right object

Sample code: function TestClass() { this.init = function() { this.updateHeader(); // <-- error line }; this.updateHeader = function() { console.log("Works"); }; }; var test = new TestClass(); $(document).ready(test.init); When I run that in Firefox 3.5, Firebug gives me an error, saying that this.updateHeader is not a valid fun...

In PHP can you extend a class to the same name?

I'm trying to find out weather I can do this or not. I have a class called Template. and I want to extend that classes functionality in another file, but I don't want to change the name. Do I declare it as class template extends template { // code here function foo() { } } or do I just declare it like this? class ...

How to create an instance of two classes at the same time?

Hello, This is my problem - shortly: var c1:TClass1; c2:TClass2; begin c1 := c1.Create; c2 := c2.Create; //<<Exception; end; Both classes inherit from TObject.If they don't inherit then I can't use the debugger in the class so I have to use TObject. My real problem is that I have to create the instance of the second class inside...

PHP 5.3 Late Static Binding - is there a shorter way?

Is there a better/shorter way to write the whoAmI method in the following code? It seems a bit unnecessary to create a new object just to get the static class' name. <?php abstract class baseClass { static function whoAmI() { echo get_class(new static); // Making a new class just to get its name??? } } ...

Creating a decorator in a class with access to the (current) class itself

Currently, I'm doing it in this fashion: class Spam(object): decorated = None @classmethod def decorate(cls, funct): if cls.decorated is None: cls.decorated = [] cls.decorated.append(funct) return funct class Eggs(Spam): pass @Eggs.decorate def foo(): print "spam and eggs" ...

Abstraction in Delphi

Hello, If I have child class,the child class inherits all methods from the parent,but how do I use functions from the child class in the parent class? Is that what abstraction is? How do I accomplish it? My code: type cParent = class(TObject) private function ParentFunction:byte; function ChildFunction:byte;virtual;abstract; end; ...

CSS2 Multi Classing

I have the following HTML: <DIV class="foo bar"></DIV> I'm trying to create a CSS class declaration that matches said element. Looking through the specs on section 8.2.3, I imagine this should've work: DIV.foo.bar { border-color: black; } But I've tested on IE and Safari, both doesn't affect the element. Any tricks how to make this...

Extension methods versus inheritance

Are there rules of thumb that help determine which to use in what case? Should I prefer one over the other most times? Thanks! ...