Calling PHP Class
Is there any way to call a php class (eg. $var = new className) and have var store the value returned by the className function? Or, is there a way to call a class and not have it execute the function with the same name? ...
Is there any way to call a php class (eg. $var = new className) and have var store the value returned by the className function? Or, is there a way to call a class and not have it execute the function with the same name? ...
I have an unordered list. <style> #button1 { position:relative; z-index: 3; } #button2 { position:relative; z-index: 2; } #button3 { position:relative; z-index: 1; } </style> <ul> <li id="button1">Button 1</li> <li id="button2">Button 2</li> <li id="button3">Button 3</li> </ul> I am currently using css to give each id a d...
I am using c# express and would like to use a free tool to design my class diagrams. What do you recommend for a free tool? ...
I have this class: class TestClass { var $testvar; public function __construct() { $this->$testvar = "Hullo"; echo($this->$testvar); } } And this method for accessing: function getCurrent() { $gen = new TestClass(); } I get the following error: Notice: Undefined variable: testvar in /Users/myuser/S...
I'm working on a web mapping service and would like to provide my users with a Python API that they can use to create custom plugins. These plugins would be running on my server so I'm trying to lock down Python as much as possible. To ensure that users can't access files they are not supposed to, I'm planning on running the plugins ins...
I have read the docs and everything but I'm very confused. I never needed to create a class before and now I do. I want to have something like: TextDocument.Save("filepath", "contents of file to save"); and stuff like: Application.Create("filepath", "text/code to save"); and: Stylesheet.Save("filepath", "contents"); and have th...
I am wondering which way would end up being faster, selecting elements by: $('element[href=#my_link]'); or: $('element.my_class'); I don't like repeating myself when I write code, so I prefer to write it the first way for the most part because then I can add information to it like: <a href="#delete_1">Delete</a> $('a[href^=#dele...
$image='xiaofl.jpg'; $img=getimagesize($image); switch ($img[2]) { case 1: $im =imagecreatefromgif($image); break; case 2: $im =imagecreatefromjpeg($image); break; case 3: $im =imagecreatefrompng($image); break; } $word=imagecolorallocate($im,212,0,0); $str=iconv("gbk","utf-8","php100.com"); imagettfte...
I am working on a PHP library in which we will be supplying our clients with encrypted code. The code will include a main classes which they can instantiate that will handle license verification and expose methods for their use. The main class will instantiate several sub classes each contained in their own file. How can I prevent our...
I have been reading that creating dependencies by using static classes/singletons in code, is bad form, and creates problems ie. tight coupling, and unit testing. I have a situation where I have a group of url parsing methods that have no state associated with them, and perform operations using only the input arguments of the method. I ...
alright, so im making an irc bot, and im wondering a few ways that i could create a connection class, so that i can connect to multiple networks, i have it connecting to one server, i just dont know how to make that into a way to connect to more than one. basically my question is: how can i take the current bot i wrote, rewrite it, with...
Here's the gist of what I'm trying to do. I have a list of objects, and I know they have an instance method that looks like: def render(self, name, value, attrs) # Renders a widget... I want to (essentialy) decorate these functions at runtime, as I'm iterating over the list of objects. So that their render functions become this: d...
Okay, so i have this code i wrote: class Connection { public static StreamWriter writer; public static string SERVER; private static int PORT; private static string USER; private static string NICK; private static string CHANNELS; private Thread connection; private Thread ping; public Connection() ...
For a newsroom system I have a class that contains a single news story. Inside this class is a private variable holding a generic List of image classes. The idea being a single story can contain multiple images. The question is should I make the List variable public, so that I can add/remove images by addressing the List directly publi...
How do I self-instantiate a Java class? I should not use any file other than its class file. Also assume that after the line where I initialized the NAME variable, they don't know the name of the class during compile-time. Example: public class Foo implements Bar { public static final String NAME = "Foo"; private void instanti...
Is there a simple way to list the accessors/readers that have been set in a Ruby Class? class Test attr_reader :one, :two def initialize # Do something end def three end end Test.new => [one,two] What I'm really trying to do is to allow initialize to accept a Hash with any number of attributes in, but only commit the ...
I'm writing a state machine like object. Looks like Class A: vector<Actions> m_enter_actions; vector<Actions> m_exit_actions; public: ClassA.... ~ClassA SetEnterActions(vector<Actions> vector) SetExitActions(vector<Actions> vector) Is this the best way to handle this? I wonder if I should have like Class A: EnterActio...
I'm trying to map an interface and concrete class with fluentnhibernate. here's my interface / class: public interface IUser { int Id { get; set; } } public class User: IUser { public int Id { get; set; } public string Name { get; set; } public string Password { get; set; } } here's my mapping files: public class IUserM...
Hi What may be the problem if i get the following error. while i am extending a class i got this error example: class ModuleUser extends AbstractModule Fatal error: Class AbstractModule not found in (....PATH) ? I have done most of the possibilities... But i can't resolve the problem. any help will be thankful thanks n ad...
Hi guys, I'm trying to make a Ruby class that is very flexible as to its type and hopefully can inherit properties from a number of other classes depending on the values its initialized with: class Test def initialize(type,etc) case type when "stringio" inherit_from_stringio_with_data(etc) when "list" inherit_...