methods

Information on Rojiani's Numerical methods C textbook

Hi, having taken a look at a few textbooks that discuss numerical methods and C programming, I was gladly surprised when browsing through "programming in C with numerical methods for engineers" by Rojiani. I understand of course it's important that one need to have a solid background in numerical methods prior to try implementing them on...

what does "do" do here? (java)

I saw this bit of code on the interents somewhere. I'm wondering what the do is for. public class LoopControl { public static void main(String[] args) { int count = 0; do { if (count % 2 == 0) { for (int j = 0; j < count; j++) { System.out.print(j+1); ...

Rails "NoMethodError" with sub-resources

Hi. I'm a newbie Rails developer who is getting the following error when trying to access the 'new' action on my CityController: undefined method `cities_path' for #<#<Class:0x104608c18>:0x104606f08> Extracted source (around line #2): 1: <h1>New City</h1> 2: <%= form_for(@city) do |f| %> 3: <%= f.error_messages %> 4: 5: <div clas...

WebView not responding when called from a method

I have an app with tabbar and webview. I'm trying to make the app come back to default url each time user taps the bar. Right now I'm intercepting taps and launching a method, however it's not affecting my webview (it's not loading the page). The method works properly when called from the class, but not when it's called from my app deleg...

javascript. is it posible for one member of an object to access another member of that object without explicit reference to the object itself?

For example: var myObj={ myValue="hola", asMember=function(){ alert( this.myValue ); } }; myObj.asMember(); // will work fine var asGlobal=myObj.asMember; // global alias for that member function asGlobal(); // won't work in javascript (will work in AS3, but i need js now) So the question is, can I rewrite asMember so that i...

Getting bizarre "expected primary-expression" error.

Hi, I'm getting a really strange error when making a method call: /* input.cpp */ #include <ncurses/ncurses.h> #include "input.h" #include "command.h" Input::Input () { raw (); noecho (); } Command Input::next () { char input = getch (); Command nextCommand; switch (input) { case 'h': nextComma...

What's an easy way to set up object communication in Obj-C?

I am trying to send a slider value from a controller object to a method of a model object. The later is implemented in the separate file and I have appropriate headers. I think the problem is that I am not sure how to instantiate the receiver in order to produce a working method for the controller. Here is the controller's method. -(I...

Find who's calling the method

Hi, I'd like to somehow find out which CFC is calling my method. I have a logging CFC which is called by many different CFC's. On this logging CFC there's a need to store which CFC called for the log. Whilst I could simply pass the CFC name as an argument to my log.cfc, I find this to be a repetitive task, that might not be necessary, ...

What is wrong with this c# method?

I use this method to get file extension, public string ReturnExtension(string fileExtension) { switch (fileExtension) { case ".doc": case ".docx": return "application/ms-word"; } } When i compile it i got the error BaseClass.ReturnExtension(string)': not all code ...

When is it better to use a method versus a property for a class definition?

Partially related to an earlier question of mine, I have a system in which I have to store complex data as a string. Instead of parsing these strings as all kinds of separate objects, I just created one class that contains all of those objects, and it has some parser logic that will encode all properties into strings, or decode a string ...

Concrete Types or Interfaces for return types?

Today I came to a fundamental paradox of the object programming style, concrete types or interfaces. Whats the better election for a method's return type: a concrete type or an interface? In most cases, I tend to use concrete types as the return type for methods. because I believe that an concrete type is more flexible for further use ...

C#: considering parent- child win forms, how much code should we put in the parent form?

hi consider we have 2 data entry win forms : form1 (parent) and form 2 child of that parent. As all we know, we can simply declare virtual methods in order to be overridden by any child in future. my question is how to construct blueprint of the parent form methods? I mean every method should be virtual? or what? Thank you ...

Retaining Form data after POST in Ruby on Rails

I need to retain the Form data submitted in one view to be used in another view. I'll be using POST method to submit the data. Is there anyway I can retrieve data from the POST method in Ruby, like in PHP I would use $title=$_POST["title"]. Any ideas? Thanks and Cheers ! ...

How to override a class method of the gem in rails Application ?

Hi, Best practice to Override a class method of the gem in rails Application ? . I need to override the behaviour of the find method of a gem. following is the code in the gem module Youtube class display attr_accessor :base def find(id, options = {}) detailed = convert_to_number(options.delete(:detailed)) ...

Java: Easy way to get method stub out of class files within a JAR file? Reflection?

Hi, I'm searching for a way to get a list of method stubs of all classes within a jar file. I'm not sure where to start... May I use Reflection or Javassist or some other tools of which I've not heard yet!? At least it may be possible to unpack the jar, decompile the class files and scan with a line parser for methods, but I think that ...

How to read a Dependency property from a method

XAML: <my:Control ItemsSource="{StaticResource MySource}" A="true" /> Assume a Control with a dependency property A with a default value false; and a method to handle the Source Collection: protected override void OnItemsSourceChanged(System.Collections.IEnumerable oldValue, System.Collections.IEnumerable newValue) {} in which you...

What Could be the example scenarios to declare any class or any method as "final"?

What Could be the example scenarios to declare any class or any method as "final"? When do we need to do this? Please give me some example to understand the practical use of "final"... please elaborate your answer.... please guide me as I am a beginner in OOP ...

[PHP] Weird problem with dynamic method invocation

Hi everyone, this time, I'm facing a really weird problem. I've the following code: $xml = simplexml_load_file($this->interception_file); foreach($xml->children() as $class) { $path = str_replace('__CLASS_DIR__',CLASS_DIR,$class['path']); if(!is_file($path)) { throw new Exception('Bad configuration: file '.$path.' not f...

Get current UIViews?

is there a way to get the current UIView object, which i defined in - (void)viewDidLoad to use/change them in another method in the same .m file? thanks ...

Using php's magic methods outside a class

Is it possible to use PHP magic methods (specifically __get()) outside a defined class? I'm wanting to use it in a configuration file for quick loading. The configuration file has a single array, $config, with many keys. Therefore, I'd like to override __get() to return the key in the array. ...