I've got a few DOM elements, say text-field input A, B, C, and all of them have the property of 'onclick'. How do I find to which object a particular 'onclick' belongs?
HTTPService has a property resultFormat which can be set to any of the following: array e4x flashvars object text xml
I looked at the documentation to understand the difference, but still couldn't understand when to use each. I'm looking for the lightest weight of all of them.
P.S. I'm consuming output from my own server, so can change the output format as needed to make it compatible with each.
Is it safe to access asp.net session variables through static properties of a static object?
Here is what I mean:
public static class SessionHelper
{
public static int Age
{
get
{
return (int)HttpContext.Current.Session["Age"];
}
set
{
HttpContext.Current.Session["Age"] = value;
}
}
public static string Name
{
get
{
return (string)HttpContext.Current.Session["Name"];
}
set
{
HttpContext.Current.Session["Name"] = value;
}
}
}
Is it possible that userA could access userB's session data this way?
If I have an arithmetic expression as a string ("2+3*4/5"), is there a way to get this computed with the Javascript Math object without parsing that entire string to separate everything out?
See title. To be more specific, I am trying to return the mutableCopy of an object, however it's returned with a retainCount of 1 and I am worrying that it will leak.
Hello,
I am writing a method that will set the properties of an object passed as a parameter. The method accepts one parameter of type interface and the return type of the method is the same interface. I was wondering if there is some kind of a naming convention for such methods. I was thinking of something like:
FillInInterfaceTypeData or InitInterfaceTypeData but both sound clumsy to me. How do you think?
program runs fine. When I put a breakpoint a segmentation fault is generated. Is it me or GDB? At run time this never happens and if I instantiate only one object then no problems.
Im using QtCreator on ubuntu x86_64 karmic koala.
I like to insert all members of a object automatically, so I dont need to type them (or even click them). Ctrl+J gives me the dropdown, but I like them all in code with a default value,
MyObject.Member1=0;
MyObject.Member2="";
MyObject.Member3=0;
Any Add-In or existing shortcut that can help me with that?
As per the title, I'm trying to parse an XML file containing an xs:duration data type. I'd like to convert that into a Python timedelta object, which I can then use in further calculations.
Is there any built-in way of doing this? If not, what is the best way to achieve this?
Hi all:
Basically what I mean is like this:
List<String[]> routes = (List<String[]>)application.getAttribute("routes");
For the above code, it tries to get an attribute named "routes" from the JSP implicit object - application. But as everyone knows, after this line of code, routes may very well contains a null - which means this application hasn't got an attribute named "routes".
Is this "casting on null" good programming practice in Java or not?
Basically I try to avoid exceptions such as java.io.InvalidCastException
I reckon things like this are more as "heritage" of Java 1.4 when generic types were not introduced to this language. So I guess everything stored in application attributes as Objects (Similar to traditional ArrayList). And when you do "downcast", there might be invalid casts.
What would you do in this case?
Update:
Just found that although in the implicit object application I did store a List of String arrays, when I do this :
List<double[]> routes = (List<double[]>)application.getAttribute("routes");
It doesn't produce any error... And I felt not comfortable already...
And even with this code:
out.print(routes.get(0));
It does print out something strange :
[Ljava.lang.String;@18b352f
Am I printing a "pointer to String"? I can finally get an exception like this:
out.print(routes.get(0)[1]);
with error :
java.lang.ClassCastException: [Ljava.lang.String;
Because it was me to add the application attribute, I know which type should it be cast to. I feel this is not "good enough", what if I forget the exact type?
I know there are still some cases where this sort of thing would happen, such as in JSP/Servlet when you do casting on session attributes. Is there a better way to do this?
Before you say:"OMG, why you don't use Servlets???", I should justify my reason as this: - because my uni sucks, its server can only work with Servlets generated by JSP, and I don't really want to learn how to fix issues like that. look at my previous question on this
, and this is uni homework, so I've got no other choice, forget all about war, WEB-INF,etc, but "code everything directly into JSP" - because the professors do that too. :)
I have an object file, which I'd like to make into a Mach-O binary(I'm on Mac OS 10.6). Running ld source.o produces the following output:
Undefined symbols:
"_printf", referenced from:
_main in source.o
ld: symbol(s) not found for inferred architecture x86_64
How can I reference libSystem(or whatever library includes printf) using ld?
Hi ,
After I do a JNDI look up , what I get is a reference to the Home of EJB Object.
But when I do an API call on Home/Remote , how does it find the URL/port of the server ?
Thanks
J
I have a json string in an action of MVC controller. I want to send it to view as a JSON object. How can I solve this?
public JsonResult Json()
{
... some code here ...
string jsonString = "{\"Success\":true, \"Msg\":null}";
return new JsonResult() { Data = jsonString, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
hi,
How can I get the width of my LinkButton object ?
myLinkButton = new LinkButton();
myLinkButton.label = "blabla";
myLinkButton.setStyle("fontSize", 24);
myContainer.addChild(myLinkButton);
trace (myContainer.width); //this doesn't work because I haven't directly set the attribute
thanks
I need to return two values at a time, so I have:
class IterableObject(object):
def __iter__(self):
for item in self.__dict__:
return self.__dict__[item + 1], self.__dict__[item]
So I can have:
myObj1, myObj2 = IterableObject()
value = myObj1.balance - myObj2.balance
Of course it did not work. What am I doing wrong? I think I can not add value on item like that.
When you call remove(object o) on an arraylist in java, how does it compare the objects to find the correct one to remove? does it use the pointer? or does it compare the objects using the interface Comparable?
Hi,
While replacing or inserting into an nsmutable array, I am getting exception as
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '* -[NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable object'
[list replaceObjectAtIndex:indexRow withObject:editcontacts];
//or
[list insertObject:editcontacts atIndex:indexRow];
please help me.
Madan,
Thank You.
Is there a possibility to create any python object that will be not sortable? So that will be an exception when trying to sort a list of that objects?
I created a very simple class, didn't define any comparison methods, but still instances of this class are comparable and thus sortable. Maybe, my class inherits comparison methods from somewhere. But I don't want this behaviour.
I have a string in my db I want to pull into my page and convert to a json object.
[
{id: 1,title: "Long Event",
start: new Date(2009, 5, 6, 14, 0),end: new Date(2009, 5, 11)},
{id: 2,title: "Repeating Event",
start: new Date(2009, 5, 2)},
{id: 3,title: "Meeting",
start: new Date(2009, 5, 20, 9, 0)},
{id: 4,title: "Click for Facebook",
start: new Date(2009, 5, 27, 16),end: new Date(2009, 5, 29),
url: "http://facebook.com/"}
]
How can I do this using JQuery?
I'm totally new on this so I want to start with something simple.
I have just an object in my Visio document and I want to display a Hello World! message whenever it's clicked.
In Python 2.x, using backticks to get decimal string from int object is Horrible?
Because backticks are repr(), not str()? I have noticed that when I answering this question.
In Python source, they have same function in Python source, intobject.c
(reprfunc)int_to_decimal_string, /* tp_repr */
....
(reprfunc)int_to_decimal_string, /* tp_str */
What do you think?
So for example we have real life photo. how to get (relativly to image dimentions for example) the distance from wall to girls, from girls to trees if all we know ts this picture?
Any papers with algorithms or Open Source programs doing this would be appreciated.
So How to detect how far the object on photo is from another objects on that photo?
Let say I have a object. I'm assigning that to an integer.
MyClass obj1 = 100;//Not valid
Let's say, I have a parameterized constructor which accepts an integer.
MyClass(int Num)
{
// .. do whatever..
}
MyClass obj1 = 100;//Now, its valid
Likewise on any circumstance, does the vice-versa becomes valid?!.
eg) int Number = obj1;//Is it VALID or can be made valid by some tweeks