methods

asp.net detailsview update method not getting new values

Hi all, I am binding a detailsview with objectdatasource which gets the select parameter from the querystring. The detailsview shows the desired record, but when I try to update it, my update method gets the old values for the record (and hence no update). here is my detailsview code: <asp:DetailsView ID="dvUsers" runat="server" Height=...

In what situations is static method a good practice?

I have read the following discussions: http://stackoverflow.com/questions/538870/java-static-methods-best-practices , and http://stackoverflow.com/questions/658407/static-methods It seems that people in general would accept static methods, but are a little bit skeptical about it, for the following 2 reasons: They are hard to test. Th...

Python instance method making multiple instance method calls

Here is some snippet code. I have tested the methods listed and they work correctly, yet when I run and test this method (countLOC) it only seems to initialize the first variable that has an instance method call (i = self.countBlankLines()). Anyone know the obvious reason I'm obviously missing? def countLOC(self): i = self.count...

Why exactly are non-DB related functions in SQL Server so much slower?

I always hear that non-DB related functions (e.g. string comparison, loops) in SQL Server are slow because, well, it's a database. But why exactly does that fact make these methods crawl in comparison to full programming languages? ...

Which overload will get selected for null in Java?

Hello, If I write this line in Java: JOptionPane.showInputDialog(null, "Write something"); Which method will be called? showInputDialog(Component parent, Object message) showInputDialog(Object message, Object initialSelectionValue) I can test it. But in other cases similar to this, I want to know what happens. Martijn ...

Pointer to class method

Hello! I'm trying to have pointer to class methods, so I have something like: class foo { public: static void bar() { } }; void (foo::*bar)() = &foo::bar; That doesn't compile :( I get: > error: cannot convert ‘void (*)()’ to > ‘void (foo::*)()’ in > initialization ...

Adding to local namespace in Python?

Is there a way in Python to add to the locals name-space by calling a function without explicitly assigning variables locally? Something like the following for example (which of course doesn't work, because locals() return a copy of the local name-space) where the print statement would print '1'. def A(): B(locals()) print x def B...

How can I validate a function passed to a method in Ruby?

I'm writing a library to humanize bytes in Ruby (e.g. to turn the byte count 1025 into the string 1.1K), and I'm stuck on one element of the design. The plan is to extend Numeric with ahumanize method that returns a human-friendly string when called on a number. After looking at the source of Number::Bytes::Human (a Perl module that I ...

Same method that takes a different parameter type?

I know there are very similar questions but im not sure that any of them are exactly what i need. I have 2 methods that do exactly the same thing (so i dont need to override or anything) the only difference is the parameter and return types. public List<List<TestResult>> BatchResultsList(List<TestResult> objectList) { } public List<...

Javascript - get class owner of a function(method)

Hi, there is a way to know what class own a function? Example: function globalFunc(){ //alert MyObject } function MyObject(){ } MyObject.prototype.test=function(){ globalFunc(); } var o=new MyObject(); o.test(); //alert MyObject Now im using this workaround: function globalFunc(){ alert(globalFunc.caller.__class__); } function...

Using String methods instead of Regex

hello as i am not very familiar with regex, is it possible (whether its hard to do or not) to extract certain text inbetween symbols? for example: <meta name="description" content="THIS IS THE TEXT I WANT TO EXTRACT" /> thank you :) ...

PHP OOP, perform a function once a certain variable has been set

How can i perform a function once a variable's value has been set? say like $obj = new object(); // dont perform $obj->my_function() just yet $obj->my_var = 67 // $obj->my_function() now gets run I want the object to do this function and now having to be called by the script. Thanks EDIT my_var is predefined in the class, __set ...

finding objects within radius.

looking for a light weight way to find objects within a radius. so far the answer that is obvious to me is go through each object, comparing its x and y position, with the center of the radius. example: Turret - looking for targets in radius. TargetArray - array of possible targets. WithinRangeArray - array we push applicable targets...

Call the methods in mootools class

Dear friends I have a question about calling other functions in a mootools class. For example: var f = new Class('foo', { test1: function(){ var table = new Element(........); .... ... $(table).getElements('input').each(function(input) { input.addEvent('change', function() { **// how c...

Private methods using Categories in Objective-C: calling super from a subclass.

Hello folks, I was reading how to implement private methods in Objective-C (Best way to define private methods for a class in Objective-C) and a question popped up in my mind: How do you manage to implement protected methods, i.e. private methods that are visible to subclasses? Suppose I have a MySuperClass with a Category containing ...

Why is method overloading not defined for different return types?

In Scala, you can overload a method by having methods that share a common name, but which either have different arities or different parameter types. I was wondering why this wasn't also extended to the return type of a method? Consider the following code: class C { def m: Int = 42 def m: String = "forty two" } val c = new C val...

jQuery plugin that takes user method

I am working on a jQuery plugin and I would like for the user to pass in a method name to be executed after a flag (in the code) is set to true. I already have the flags working as needed, I just need a way to execute the method that is passed. For example: (function(jQuery){ $.fn.extend({ pluginName: function(options) { var ...

What are guard methods/classes?

i just noticed the guard method/class mentioned in this question and i don't really get the concept from the answers. And alas, Jon Skeet's link to an MS site never loaded. A few quick Google searches seemed to yield only products, not software engineering concepts. Any explanation and/or samples would be appreciated. (Especially from t...

C# Method Wait For User Click

Hello, I am trying to write a method that loops and repeatedly calls other methods. There is a single place inside the loop that I need to pause and wait for a user to click one of several buttons on the GUI. I have done this with command line code before, but I'm not sure how to wait and check it any buttons have been clicked. If som...

Generic Method Executed with a runtime type.

I have the following code: public class ClassExample { void DoSomthing<T>(string name, T value) { SendToDatabase(name, value); } public class ParameterType { public readonly string Name; public readonly Type DisplayType; public readonly string Value; public ParameterType(st...