class

implicitly pass parameters to class

I am writing a class in Android that requires certain parameters from the class that calls its functions. For Example my class is called "DoStuff" DoStuff has 3 functions: public static doThis(canvas, tick, toggle, something); public static doThat(canvas, tick, toggle, something, something); public static doTheOther(canvas, tick, togg...

Share the code in a secure way Objective-C

Hello! Just I'm curious. I have created a lot of convinient categories to the Objective-C classes (NSObject, NSDictionary, NSString...), as long as very interesting subclasses that makes a lot of popular task in the iPhone/iPad programming, to be as easy as putting only one line of code or firing a method. I'd like to share this code w...

Designing a HTML tag class in PHP

I've recently learned OOP in PHP,.. and I though I'd try to write a class in PHP that generates tags for forms i.e. something that lets you generate forms. Its probably been done a billion times before/ or isn't a very good idea. I'm just doing it as an exercise. Anyway, how would I go about planning this? $form = new Form_Class($for...

Why is this not allowing any more method calls Ruby

When game.load is called and then game.addHit is called the ruby page stops loading at all yet if I don't call add Hit it doesn't and if I rename game.load to game.loadGame that doesn't load either. #!/usr/bin/ruby require 'rubygems' require 'mysql' class Game attr_accessor :id, :name, :urlName, :description, :hits, :categorys, :wid...

I have a method in program.cs that I want to transfer to its own class

I'm new. I'm trying to take the pigTalk() and transfer it into its own class Thanks for any help using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace FunctionTest { public class Program { public static void pigTalk(string sentence) { try { ...

Multiple redefinition error

After learning more about classes and pointers, I refactored a program I had and wiped out > 200 lines of code, in the process creating two other classes, Location and Piece. The problem is, after getting everything to compile, the linker complains that the constructor for Piece is defined multiple times, with a load of errors: In funct...

How do I make a java.io.File into a java.lang.Class to run it?

I have a program that lets a user select any .class or .jar file and run it. The problem is that, to run it, I need to use something other than a java.io.File, which is what a JFileChooser returns. How can I make a java.io.File into a java.lang.Class or java.util.jar.JarFile? ...

AS3 Loader Class - Load Silenty & Error

Hello, I'm using the as3 loader class as follows: var l:Loader = new Loader(); l.addEventListener(Event.COMPLETE, onComplete); l.load(new URLRequest(e.target.data)); function onComplete(e:Event){ addChild(e.target.content); } But it's not loading???? I've imported the loader class, and it works without the event listener but not wi...

Eye Detection Using Opencv

I am working on object detection (eyes) using OpenCV. Following is the code as it is not able to identify an eye object (exactly or near by). Can anyone help me solve this problem? if(imageView.image) { cvSetErrMode(CV_ErrModeParent); IplImage *image = [self CreateIplImageFromUIImage:imageView.image]; // Scaling down IplImage ...

C# GUI Application, Another class from another thread updating the UI

Hello I've been researching on how to do this for about a week and I'm still not sure about the correct approach, in some examples I see the Thread class is used in others I see Invoke is used which has confused me a bid. I have a GUI program in c# which contains a textBox which will be used to give information to the user. The proble...

Beginner template compile error - Having trouble passing function as arg

Hello everyone, Most of my classes have lists as private data members. As such, most of them also have adder/remover public members. I noticed I was writing basically the same thing for each of the adders, so I thought I'd turn it into a template. Here's what I've got: template <class N, class I> void add(N element, std::list<N> & con...

Adding validation to a class in PHP.

Hello people, I have several classes (for a Form generator class thing I'm making...I know sad.. :( ),anyway, the hierarchy is as follows: class HTML_Form accepts abstract class FormElement objects (using type hinting). FormElement class has several children classes such as Textbox, Password, Radio .etc How would I add validation ...

C++ template class

#ifndef ECORE_H #include "../database.h" #define ECORE_H Database *base_provider; // ecore.h: error: expected initializer before ‘*’ token template <class S, class T> class ecore { // error: expected class-name before ‘{’ token public: ~ecore(void){delete base_provider;}; ecore(vo...

Declare before use in C++

I'm wondering why the declare-before-use rule of C++ doesn't hold inside a class. Look at this example: #ifdef BASE struct Base { #endif struct B; struct A { B *b; A(){ b->foo(); } }; struct B { void foo() {} }; #ifdef BASE }; #endif int main( ) { return 0; } If BASE is defined, the code ...

C# Multithread multiclass gui app, am I doing this right?

Hello I created the following project to show you guys how I plan to do things. But my main project will be bigger and will have multiple classes. I'm just trying to get this to work properly so I know I'm using good practice when coding. ok, lets begin :), so my form has a button called "button1" and a text box called "textBox1" and I...

Learning By sample code? And general Programming worries

Ill try not to make this a subjective question, but Im wondering if anyone else ran into this problem or had this feeling, because it's something I can't help to shake. Im going on my last semester of college for my B.S. in CS (comp sci) but I feel like.....the last 2 semesters of college has been mostly "ideas" rather than actual codin...

Not calling base class constructor from derived class.

Say I have a base class: class baseClass { public: baseClass() { }; }; And a derived class: class derClass : public baseClass { public: derClass() { }; }; When I create an instance of derClass the constructor of baseClass is called. How can I prevent this? ...

C++: "Class namespaces"?

If in C++ I have a class longUnderstandableName. For that class I have a header file containing its method declaration. In the source file for the class, I have to write longUnderstandableName::MethodA, longUnderstandableName::MethodB and so on, everywhere. Can I somehow make use of namespaces or something else so I can just write Metho...

Wrap <a> tags around <img /> with href = img src?

Trying to wrap an tag around an image, addClass and input src of img as href of tag: $(document).ready(function() { $(".new img").each(function() { var src = $(this).attr('src').addClass('image'); var a = $('<a/>').attr('href', src); $(this).wrap(a); }); }); My HTML: <img class="new" src="pic0.png" title="Image_Title"/...