I have asp.net mvc site, my action generate the page, using master page. on master page included widgets by RenderAction helper. How can i use one database connection in page controller and in widget controller?
...
So Objective-C has these nice functions NSClassFromString() and NSProtocolFromString(), which return a class or protocol from a passed string name. Is there any way to do this with an object?
...
I am wanting to know if there is any extra overhead of using an Object in PHP instead of using a static method based on my examples below?
Sesseion object from Session class
$session = new Session;
$session->set(user_id, $uswer_id); //set session var
$session->get(user_id); // get session var
VS
Static methods from ...
I've an object with a certain state. The object is passed around and it's state is temporarly altered. Something like:
public void doSomething(MyObject obj) {
obj.saveState();
obj.changeState(...);
obj.use();
obj.loadState();
}
In C++ it's possible to use the scope of an object to run some code when constructing and di...
Assume, I have an object x of MyClass. What method is called, when I do puts x? I need to override it with my own one.
I thought it was .inspect, but somehow overridden inspect isn't being called.
For example, I have a class Sum:
class Sum
initiazlie a, b
@x = a + b
end
end
And I wanna access the result like this:
s = Sum...
Out of curiosity i disassembled mscorlib.dll to check the implementation of System.Object class.
I found something weird in that.
1).
public class Object {
...
protected override void Finalize(){}
...
}
How come a base class has an overriden method in it?
2) public class Employee {
public void InstanceMethod() {
...
I have a static function in a class that needs to be called from several child classes. I need a constant from the calling child class to be available in that function. To have these constants available in other places, the child classes have a function that returns the value of that constant (php 5.2.9).
However, when in the parent cla...
I have a List of objects in an asp.net page. when the page loads in the browser for the first time, I fetch data from the database, create objects with those data and populate the list. All these are done inside the page load event handler. Now when the page is posted back to the page, the previous list is gone, since the variables were...
I am developing an e-commerce website that utilises db4o as the backend. All was well until last week when I came across a problem that I have been unable to solve. The code below is quite straight forward. I open a database file, save an object and then try to retrieve it. However I get nothing back. The "users" variable has a count...
Hello,
Well, I keep improving my form generation classes and stuck in returning all the country elements in country_data array. Only first two elements is displaying on dropdown options.
Here is dropdown class:
//drop down form class
class DropDown
{
function __construct ($form, $field_label, $field_name, $field_desc, $dropdown_da...
I am finding that performance degrades after one or more screen rotations, and I presume that this is likely to be because an App's main Activity is destroyed and recreated each time the screen is rotated and that my app must be leaking memory when that happens.
I have read that, contrary to what one might expect, not all the objects cr...
Hi all. I have a Silverlight Usercontrol where I have a tabcontrol which uses a couple of tabitems. Now each tabitem is another Usercontrol. I was wondering if there is a way to access an object of one of these usercontrol tabitems.
For example if I have a xaml in my main usercontrol:
<controls:TabControl x:Name="TabControl" Grid.Row="...
I know this is not great practice, but I need a definition in order to get my real question answered.
I have an object like this:
class Car
{
public $wheel;
public $engine;
so on..
}
I instantiate and edit values like thus:
myCar = new Car();
myCar->wheels = 4;
myCar->engine = V8;
What is it called when I do this?:
myCar...
My latest idea for do settings across my php project I am building was to store all my settings in a config PHP file, the php file will just return an array like this...
<?php
/**
* @Filename app-config.php
* @description Array to return to our config class
*/
return array(
'db_host' => 'localhost',
'db_name' => 'socialnetwor...
Can someone explain me
what is Object Cloning in php?
When should i use clone keyword in php?
...
Is there a shortcut in MooTools for telling if an object is an object or an array?
...
Hey guys,
I have a really strange problem right now.
markers is an array of objects.
0
content (String)
coords (Object)
gMarker (Object)
1
content (String)
coords (Object)
gMarker (Object)
2
content (String)
coords (Object)
gMarker (Object)
So far, so good.
The problem:
console.d...
how do is sort this object by 'pos' in php?
Array (
[0] => stdClass Object ( [str] => Mondays [pos] => 170 )
[1] => stdClass Object ( [str] => Tuesdays [pos] => 299 )
[2] => stdClass Object ( [str] => Wednesdays [pos] => 355 )
[3] => stdClass Object ( [str] => Thursdays [pos] => 469 )
[4] => stdClass Object ( [str] => Fridays [pos] =>...
Hello,
I'm just putting together a little 'hello world' type plugin to add a widget to the dashboard. The plugin is initialising and everything is fine with that i'm just having a problem adding content to the widget. Here's the code:
/*
* Setup the class
*/
if(!class_exists("SampleClassSeries")){
class SampleClassSeries {
...
When the page loads, I have a JavaScript function that needs to analyze the JSON. But, this JSON must be present when I load "something.html"
I know how to do this, but I don't know how to combine them together.
return HttpResponse(thejson, mimetype="application/javascript")
...