methods

"each" method in extjs data store

So, I got a data store in my code that I'm loading in a function. In that store I want to use the each method to append each record to the body of a panel in a certain format. What I'm trying to figure out is how to use this "each" method. Has anyone ever had to use it before? I'm relatively new to functions and programming in general s...

Pseudo-dicts as properties

I have a Python class C which should have two pseudo-dicts a and b. The term pseudo-dicts means that the dictionaries don't actually exist and that they are “recomputed” each time a key is accessed. In pseudocode this would look like this: class C: def a.__getitem__(self, key): return 'a' def b.__getitem__(self, key): ...

how to pass parameters to an alias method in ruby

Hi All, I want to create a alias method in ruby and pass parameters to this. I managed to do the following class User def say_name puts "I'm sameera" end end class User alias :tell_name :say_name def say_name puts "I'm sameera gayan" tell_name end end user = User.new user.say_name and it gives me the out put a...

Rails find conditions... where attribute is not a database column

I think it's safe to say everyone loves doing something like this in Rails: Product.find(:all, :conditions => {:featured => true}) This will return all products where the attribute "featured" (which is a database column) is true. But let's say I have a method on Product like this: def display_ready? (self.photos.length > 0) && (...

PyGTK: Parent window wait until child window is showed

Hi, I'm learning PyGTK and I have a parent window and a child window. Inside of a parent window's method, i create the child window and then I refresh a treeview... something like that: def add_user(self, widget, data = None): save_user.SaveUser(self.window) self.load_tree_view() But, when it's running, the child window appear...

string patterns in findInLine method in Java

What are the string patterns that we can use with findInLine() method. For example if input is an email address e.g [email protected], how do i find only "vinny.kinny" from the input using the findInLine() method in java. ...

How to reach UIViewcontrols method from subview?

Hi all, i have 3 viewcontrollers in each tab. i want to add a subview on top of each viewcontroller. there is a button in subview (i made an UIView with a button) when i press the button in subview, how to call a method in ViewController? here is the layout: ViewController1 has method1 ViewController2 has method2 ViewController3 has m...

Prohibit an Instance from calling Shared/Static Method?

Is it possible to prohibit an instance of a class from calling a shared/static method? For example: I want to allow this: ClassName.MethodOne() But I want to disallow this: Dim A As New ClassName A.MethodOne() The reason this is desirable is that in this case it is semantically confusing if an instance can call the method. ...

When fine tuning performance, what is the best way to call Javascript methods multiple times?

Hello, I have been researching Javascript performance. I've learned that when accessing more than once, it is usually best to copy closure variables and class members into local scope to speed things up. For example: var i = 100; var doSomething = function () { var localI = i; // do something with localI a bunch of times v...

iPhone CoreData properties: changes to managedObjects are too slow

Hi, I have a CoreData model in my iPhone app, which is linked to a SQL Database with more than 50k records. When I generate the records classes, Xcode uses the @dynamic directive for properties. I have a property named "ISFAV", NSNumber type (CoreData does not use BOOL or Integer, it uses object types). Being short, I change the ISFAV pr...

Static method Causes problem

Dear all, I have a static method as following: public static void writeArticle(TypeA typeA, TypeB typeB) { AWriter writer = AFactory.getWriter("aWriter"); Article article = writer.newArticle(); /* PARAMETER WRITE START */ article.set("title", typeA.getTitle()); article.set("author", typeB.getName()); article.set("age", t...

When does it pay off to use S4 methods in R programming

Hi all, I program regularly in R in a professional context, and I write packages for clients or co-workers as well. Some of the programmers here have a Java background and insist on doing everything the object-oriented way, using S4 methods. My experience on the other hand is that S4 implementations often perform worse and cause a lot m...

How can I make a regular variable accessible in files included by a class method?

I have a php site which flows as shown below. Please note I'm leaving out most of the code (wherever theres an ellipses). index.php include template.php ... $_template = new template; $_template->load(); ... template.php class pal_template { ... public function load() { ... include example.php; ... } example.php ... global ...

android, Method invoke problem when getting result

Hi all, I am try to use reflection to invoke the "List Camera.Parameters.getSupportedFocusModes()" function with the following codes: Camera.Parameters params = mCamera.getParameters(); Method method = params.getClass().getDeclaredMethod("getSupportedFocusModes", (Class[]) null); Object o = method.invoke(params, (Object[]) null); the ...

php global variables

I have a global variable $config, now i have a class and i want to use a value from config as a default argument for a class method like function f(var=$config['val']){} will this assignment work? ...

Check reference parameter value or return bool?

Hi, I am using a method that has the following signature: public static bool TryAuthenticate(string userName, string password, string domainName, out AuthenticationFailure authenticationFailure) The method declares: bool authenticated = false; then goes on to authenticate the user. Whenever authenticated is set to true or fals...

Why are C# interface methods not declared abstract or virtual?

C# methods in interfaces are declared without using the virtual keyword, and overridden in the derived class without using the override keyword. Is there a reason for this? I assume that it is just a language convenience, and obviously the CLR knows how to handle this under the covers (methods are not virtual by default), but are there...

Set maximum number of email ids in the rule and message - multiemail validation in jquery?

Please see the folowing HTML and give your recomondation <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Multi Email Validation</t...

PHP - Zend say avoid Magic Methods?

I was reading this page - http://www.hm2k.com/posts/50-php-optimisation-tips-revisited And one of the recommendations was to avoid using Magic Methods, cited from a Zend Performance PDF which gives no reason for its recommendation to avoid them. After some Google searching (and winding up here to an unrelated question) I wondered if an...

Rails show X image if Case reference is M10-XXX?

Hi Everyone, I currently have a model that the user can upload a thumbnail to the record which is then shown on the show view page. This thumbnail was originally intended so the user could easily find the case when searching through the index view table of records. It has become apparent that users are only using this function to uplo...