methods

private methods using .net reflection. why??

Hi I used reflection many times before on public methods but never realized that private methods can be invoked too. See the link I am still thinking why is that allowed in the first place? Isn't that going to break the rule of "private" being "private"? puzzled AJ ...

Anyone has an alternative to using static methods in a C# interface?

I want to implement a collection, whose items need to be tested for emptiness. In case of a reference type, one would test for being null. For value types, one has to implement empty testing, and probably choose a specific value that represents emptyness. My generic collection of T should be usable for both value and reference type valu...

Threading.Timer invokes asynchronously many methods

Hi guys! Please help! I call a threading.timer from global.asax which invokes many methods each of which gets data from different services and writes it to files. My question is how do i make the methods to be invoked on a regular basis let's say 5 mins? What i do is: in Global.asax I declare a timer protected void Application_Start() ...

Why can't I save an object's methods as properties of another object literal

The code below is used to note some methods to run in particular circumstances so they can be called using a simpler syntax. var callbacks = {alter: SPZ.sequenceEditor.saveAndLoadPuzzle, copy: SPZ.sequenceEditor.saveAsCopyAndLoadPuzzle, justSave:SPZ.sequenceEditor.saveAndLoadPuzzle}; But the code keeps retu...

Faking method attributes in PHP?

Is it possible to use the equivalent for .NET method attributes in PHP, or in some way simulate these? Context We have an in-house URL routing class that we like a lot. The way it works today is that we first have to register all the routes with a central route manager, like so: $oRouteManager->RegisterRoute('admin/test/', array('CAdm...

How to get webpage source in asp.net c#

I say that How can i get HTML code of a page in c# asp.net Ex:- http://Google.com How i can get his html code by asp.net c# ...

iPhone SDK function/method with arguments

I'm creating an app in which I do the same thing multiple times. I'm going for as little code as possible and I don't want to repeat myself. I need the PHP equivalant of a reusable function, where I set an input, and the function will return the output. The app is a URL shortener, so the input as you may assume is a URL, and the outpu...

How to access the value of an object from inside a method of the same object in Javascript?

Hi, I'm trying to add a toBool() "method" inside the Object object using prototype... something like this: Object.prototype.toBool = function () { switch(this.toLowerCase()) { case "true": case "yes": case "1": return true; case "false": case "no": case "0": case null: return false; default: return Boolean(string); } } var int...

Dynamic method dispatch based on value of variable

Hi there, Long switch statments are often frowned upon. The solution is to use polymorphism. However what if the thing I'm switching on is not a type code? What I would like to do is replace the switch statement with something like this... public void HandleString(string s = "Hello") { ... } public void HandleString(string s = "Goodb...

How to get method count in a type (interface/class/enum) in Eclipse?

I want to know how many methods an interface declares or a class/enum implements. How to get that in Eclipse? ...

Calling methods in ObjC

hi all, I am having 8 methods in my application, and each one is calling a single method -(void)someFunction, How to know from inside the -(void)someFunction which one of those 8 methods called it ? All suggestions are appreciated. Thanks ...

Axapta: Validate Access to return value from display method

The Dynamics AX 2009 Best Practice add-in is throwing the following error on a display method override. "TwC: Validate access to return value from the display/edit method." Here is my display method. display ABC_StyleName lookupModuleName(ABC_StyleSettings _ABC_StyleSettings) { ; return ABC_Styles::find(_ABC_StyleSettings.StyleID...

Handling Multiple Exceptions within a Method

I am currently working on the maintenance of a piece of code that is a little bit "Exception Happy." Basically, ever method or anything throws Exception. I'm going to work to take care of that, but, in the meantime, I am wondering what is the best way to handle individual exceptions within a smaller block of code, such as a method. Is...

Is there a way to declare a method "friendly" in Java?

Hi, I know that attributes can be set public, friendly or private to specify its visibility. Is there a way I can declare a friendly method? I want it to be accessible only from objects of classes of the same package. Thanks you, a beginner here :(. ...

Scope of class help

Hi I'm trying to reuse some code i was pointed to earlier to run a 3rd party .exe inside of a my winform the code i was given was via Mr. Greg Young public class Native { [DllImport("user32.dll", SetLastError = true)] private static extern uint SetParent(IntPtr hWndChild, IntPtr hWndNewParent); public static v...

How do I check in PHP that I'm in a static context (or not)?

Hello, Is there any way I can check if a method is being called statically or on an instantiated object? Jamie ...

How in C# to pass a name of the object as a parameter to function?

I have the code that change the state of boolean property on mouseclick, depending on name of the clicked object: private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { FrameworkElement feSource = e.Source as FrameworkElement; switch (feSource.Name) { case "r1s1": ...

Need plan of action to upgrade graphics toolkit in company's applications

My job is to upgrade all of our applications that use OpenSceneGraph (an openGl toolkit) version 0.9.9 to the latest and greatest 2.8. Well quite a few caveats come with this task: 1.) After version .9.9 there was a major overhaul the the core OpenSceneGraph (OSG). Commonly used functions and classes were added and removed. Simply put, ...

running a method within another method. python

I am calling a method within another. and the error for this script i am getting is NameError: name 'mnDialog' is not defined Is there a reason for it? I think it has something to do with executing a command which isn't on the global level. (i didn't have the impression that python has a global and local variable declaration.) What i...

Using Generic Methods with a WebService like WCF or ADO.NET Data Services

Is it possible to use generic methods with WCF or ADO.NET DS? Or is it possible to create a generic WebService Repository with WCF or ADO.NET DS? ...