(function () {
function User() {
//some properties
}
//private fn 1
User.prototype._aPrivateFn = function () {
//private function defined just like a public function,
//for convetion underscore character is added
}
//private function type 2
//a closure
function _anotherPrivateFunction() {
// do something
}
//public function
User.prototype.APublicFunction = function () {
//call private fn1
this._aPrivateFn();
//call private fn2
_anotherPrivateFunction();
}
window.UserX = User;
})();
//which of the two ways of defining private methods of a javascript object is better way, specially in sense of memory management and performance.
i like to drag this object vertically instead of horizontally, which is doin it now:
(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
if (CGRectContainsPoint(myObject.frame, location)){
CGPoint xLocation = CGPointMake(location.x, myObject.center.y);
myObject.center = xLocation;
}
}
How can I get the session from within a command object?
I have tried:
import org.springframework.security.context.SecurityContextHolder as SCH
class MyCommand {
def session = RCH.currentRequestAttributes().getSession()
}
This throws
java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
{"names": [
{"patientName": "Ratna"},
{"patientName": "raju" },
{"patientName": "krishna"},
{"patientName": "kishore"},
{"patientName": "Kishore1"},
{"patientName": "mahesh"}
]}
this is the JSON object i'm getting from Ajax call
so now i want to add all patientName values to select box through jquery
can any one tell me how to accomplish this ??
here i'm using $.ajax() function for ajax call
thanks in advance
I would like to be able to add a click event to a entity generated in the code behind. Currently I'm doing it like this:
TableRow row = new TableRow();
row.Attributes.Add("onclick", "clickFunction(this)");
Is there a way to do this using the object initializer? I am doing a lot of control creation/initialization and if it matched the rest of the code it would be nice
Hi Everyone,
I'm specifically using the Google Contacts API at the moment, but this could be true of other scinarios as well.
I have the following code:
Contact newContact = new Contact();
When I let the code run without any breakpoints, I get a NullReferenceException on all of the properties of this object. However, if I put a breakpoint just after this line, I can see all of the properties have been initialises and the rest of my code executes fine.
Any idea's would be greatly appreciated
when i connect to database by ado.net. As for sqlconnection object, it has a function:BeginTransaction with 3overload. I dont know how to use it and what's its function for? Help me plz!
I like the ease of using @Resource annotation to get a DataSource, but as far as I know, it's not possible to use it in a regular JavaBean. Would it be considered a bad practice if I pass the DataSource object from a servlet to a bean along with the other data to avoid having that lookup code in the bean?
What .NET method has this error message: "Object cannot be cast from DBNull to other types"
The stack traces have been stipped from my logs so I'm looking for a starting point.
I have code that looks like this:
public class Polynomial {
List<Term> term = new LinkedList<Term>();
and it seems that whenever I do something like term.add(anotherTerm), with anotherTerm being... another Term object, it seems anotherTerm is referencing the same thing as what I've just inserted into term so that whenever I try to change anotherTerm, term.get(2) (let's say) get's changed too.
How can I prevent this from happening?
i.e. would cause the object to be released immediately and not have to be released by the pool if I did this?
[[NSArray arrayWithCapacity:100] release];
Can't find a clear explanation in the docs about this.
Is it possible to modify the Codec List Object in an ASF file? In particular, I would like to edit the codec name and description. I realize that this won't actually change the content of the video, but it's necessary for the video to be verified by an external tool.
Does anyone know of a tool that will allow me to do this? If not, does anyone have any suggestions about how I might go about doing it using the Windows Media Format 11 SDK?
Hey,
I want to use a method of an object.
Like $myObject->helloWorld().
However there are a couple of methods so I loop through an array of method names and call the method like this:
my $methodName ="helloWorld";
$myObject->$methodNames;
This works quite nice but some objects don't have all methods.
How can I tell wether $myObject has a method called helloWorld or not?
Hello,
I have the following:
Class 1 (Text, State, Level)
Class 2 (Text, State, Level, Ident)
Is there a way for me to cast an object of Class 2 into into Class 1, and not having to do the usual cast code (Text = c.Text, State = c.State etc.)? Possibly by identifying the property names of each class and copying the value over?
I was trying to execute the below code in my javascript and got some exception
var now3 = new Date();
now3.addDays(-4);
Error throwed is
Microsoft JScript runtime error: Object doesn't support this property or method
I m using jQuery 1.3.2 in my page .
Whats wrong with this? Please help
So I've been reading through the book PHP Solutions, Dynamic Web Design Made Easy by David Powers. I read through the short section on Object Oriented PHP, and I am having a hard time grasping the idea of the - operator. Can anyone try to give me a solid explanation on the - operator in OOP PHP?
Example:
$westcost = new DateTimeZone('America/Los_Angeles');
$now->setTimezone($westcoast);
Also,a more general example:
$someObject->propertyName
Thanks
I got script what read from database and manipulate it so on the end I got $result array...
on one server
is it possible to serialize this object and pass it to other script so this $result array could be available for other script on second server...
I got on first server:
return serialize ( $results );
and on second:
$data = unserialize ( file_get_contents ( 'http://www.......com/reader.php' ) );
...but there is no communication between ....
What I am doing wrong ?
Bensiu
Hi
I am Serialing an object using
GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("string1",subobject1);
info.AddValue("string2",subobject2);
}
what will be stored in stream? do the strings also store?
I tried to upload xml file using xmlhttprequest object on Javascript.
It works perfectly well on Firefox.
However, it fails on IE 8.
I tried several machines.
Same result......
any insights?
I want to pass an object array to the setTimer function in Javascript.
setTimer("foo(object_array)",1000);
am getting error on this code.
Note:Sorry ! some correction in my question : Is it possible in setInterval() function.
In most MVC based framework I see a router object. If I look at it splits up the uri and decides what controller should be used, and which action should be fired.
Even though this makes a lot of sense, I can not give this a place in the MVC patern. Is splitting up the uri not the job of the controller. And then the controller should just decide which class and function to run.
I want to map the Name column from the Child table into the Parent object. How do you do this (using Fluent NHibernate)?
public class Parent
{
public int Key { get; set; }
public string ChildName { get; set; }
}
Tables
+--------------+ +------------------+
| Parent | | Child |
+--------------+ +------------------+
| Key INT | +--->| Key INT |
| ChildKey INT |-----+ | Name VARCHAR(20) |
+--------------+ +------------------+
hey all
i am trying to aggregate form elements into object and then send it via ajax here is the code that i start using but i cant figure out how to do the rest
$('.jcart').live('submit', function() {
});