So I have an idea, but I'm thinking I need to run it by StackOverflow before I do something stupid.
I want to have an associative array of class names => filepaths. If PHP ever runs into a fatal error where the class is not defined, it will check if the key exists in my array and then require_once the class. This will prevent unnecessar...
Is there a way to get a "prettier" exception rather than one prefaced with __main__MyExceptionTitle?
Example:
>>> class BadThings(Exception):
... def __init__(self, msg):
... self.msg = msg
... return
...
>>> class BadThings(Exception):
... def __init__(self, msg):
... self.msg = msg
... return
...
I write some code:
class A {
private $x = 1;
private $y = "z";
public function setX($x){
$this->x = $x;
}
public function getX(){
return $this->x;
}
}
$a1 = new A();
$a1->setX(2);
echo $a1->getX();
$a2 = $a1;
$a2->setX(666);
echo $a1->getX();
I have output:
2
666
But I set value "666" only for ob...
Hi everybody,
this is driving me nuts ;-) I have a string whith various span tags... I want to remove all span tags except the ones with classname XYZ... The problem is that i havent found a solution to leave the closing tag...
My starting point is this regex:
text = text.replace(/<\/?[^>]+(>|$)/g, "");
But everything i tried to sa...
Hi,
Directory.CreateDirectory(@"C:\test");
Works great. I'm able to create the folder. BUT code below doesn't work.
using System;
using System.IO;
class iolar
{
public static void klasorOlustur()
{
Console.WriteLine("Oluşturmak istediğiniz BİRİNCİ klasörün adı?");
string a=Console.ReadLine();
Console.WriteLine("oluşturmak i...
I have a java class as follows:
public class Query implements Serializable {
static Object[] o= new Object[8];
private long oid= (Long) o[0];
private double[] region= { (Double) o[1],(Double) o[2],(Double) o[3] };
private boolean filter= (Boolean) o[4];
private float[] vel= {(Float) o[5], (Float) o[6]};
private...
If I have a class like the following, how do I tell when an ancestor is a class vs. a module?
ActiveRecord::Base.send(:include, SomeLibrary)
class Group < ActiveRecord::Base
include SomeLibrary::Core
end
class SubGroup < Group
end
ancestor_names = SubGroup.ancestors.map(&:name)
puts ancestor_names.inspect
#=> [
"SubGroup", "So...
I want to create a timesheet application where I need an application that will collect data from the logged in user regarding the number of hours they worked on a specific date.
The user will be required to log into an application which will capture their credentials and employee ID.
Users will be presented with a form that will list ...
UPDATED: Added some sample code to help clarify.
Hi, Feel like this shouldn't be that complicated, but I think I just don't know the proper name for what I'm trying to do. I'm dealing with an ASP.net project.
The concept is pretty simple:
I have a library that supplies some ecomm functions.
One class in the libary contains functions a...
I’m fairly new to CodeIgniter and have a question. I’m a bit confused about Classes, Libraries and Objects.
Does CodeIgniter replace the normal PHP way of usings objects i.e. $var = new car(); with libraries i.e. $this->load->library('some_library'); $this->some_library->some_function(); ?
If both are valid, is there a difference? If s...
Hello,
Can you help me how to use class defined in CakePHP's /config/database.php file, for my custom scripts? I need to use defined array for db connection.
Tnx in adv!
...
Hi guys, How to determine if a Class in .NET is big or small? Is it measured on how many it's attributes or fields, datatype of its attributes/fields? or return type of methods? parameters of it's methods? access modifier of its methods, virtual methods? thanks..
class A
{
string x { get; set; }
}
class B
{
int x { get; set; }
}...
Hello,
I'm trying to make a simple Objective-C++ applicaiton. All of my code is compiling fine, including the use of C++ in Objective-C classes, until I try and add a C++ class to the mix. I've created a simple C++ class:
Test.h
class Test {
};
and included this file in a Objective-C class (with a .mm extension) and I get the fol...
I would like to create an apache redirect of all .php requests in a specific directory to index.php. In index php I would like to include the file and create an instance of the class.
for example:
mySite.com/directory/classname.php
would be re-directed to mySite.com/directory/index.php
index.php would automatically include_once class...
Hey, I'm fairly new to Django, and I'm looking to edit admin class variables dynamically (The full idea is to hide inlines on adding and only show on editing, but I'm distilling the issue here).
Could someone explain why this doesn't work?
class dbTablePermissionInline(admin.TabularInline):
model = dbPermission
class adminDbTable(...
Hi there,
I'm a newbee about jQuery's workflow and I would like to setup a javascript class that uses an internal method to make an AJAX request. When the request returns with success, the jQuery AJAX callback should invoke a method owned by the class itself. That's the code:
function IXClock()
{
this.m_intervalID = 0;
this.sta...
I'd like to instantiate a model (in Zend Framework) using a generic way. I have $type variable which contains the name of the model. I'd like to write something like this
$db = new Admin_Model_{$type}();
But it doesn't work, Is there any way to accomplish this?
...
I want to use imports inside a class that is then inherited by another class so that I don't have to manually define my imports in each file. I am trying it like this but its not working, any advice is appreciated:
class Djangoimports ():
def __init__(self):
from django.template import Context
print Context
class I...
Right now I have a class A that inherits from class B, and B does not have a default constructor. I am trying the create a constructor for A that has the exact same parameters for B's constructor, but I get:
error: no matching function for call to ‘B::B()’
note: candidates are: B::B(int)
How would I fix this error?
...
I've been researching how to do this and I can't figure out what I am doing wrong, I want to use import to import a class and then instantiate it and am doing it as so:
the class, from a file called "action_1", I have already imported / appended the path to this)
class Action_1 ():
def __init__ (self):
pass
how I am tryin...