methods

Point-free style with objects/records in F#

I'm getting stymied by the way "dot notation" works with objects and records when trying to program in a point-free functional style (which I think is a great, concise way to use a functional language that curries by default). Is there an operator or function I'm missing that lets me do something like: (.) object method instead of objec...

Method Calls in C++ with JNI?

Hey Folks, So i have been looking into JNI calls so i can interact with some pre written C++ programs, i dont know any C++ but am trying to learn some basics. I have just been trying to do a simple call to a method outside my JNI method but always get the following error: error c3861 'myMethod': identifier not found #include <stdio.h>...

What to do when Net-SSH complains about exec! method missing?

This is driving me crazy. I run into this every now and then on a new ubuntu/debian server. Basically I can't do a exec! through net-ssh. Note, that I can require 'net/ssh' perfectly fine. sample code require 'rubygems' require 'net/ssh' Net::SSH.start('my.random.box', 'myuser', :forward_agent => "true") do |ssh| #output = ssh.exec...

Encapsualting an event into a method?

Let's say, I can not modify class A. I have this in class A<T>: There is a JumpNext() method: public void JumpNext(); It fires an event in class A<T>, called Next And this in my class B: public T Next() { instanceofA.JumpNext(); //instanceofA.Next += something; // wait for event // someting(object sender, AEventArgs...

Edit an image in java

hello, I have an image a map, The image must be contained in a JFrame and asked whether there are any java method that given coordinates (x, y) must make a kind of water mark or repaint the picture only in the specified coordinate anyone knows how to do or any idea how it would try to do ?? ...

C# - How do I Pass a delegate into another method?

I'm writing a class for managing my threading. How do I pass my method that needs threading into my helper class? All that I'll be doing is creating a new thread and passing the method I've passed through into a new ThreadStart(). Thanks in advance. ...

Is there a way to see what the values of the arguments that are sent into a method in Java?

Hey, I am currently working on a debug/error handling tool for my Java project. This is a long-shot, but is there a way to print out the values of the arguments that are sent into a method? The JVM must have them stored when calling the method. Anyway I can just grab hold of those values? My goal is to just call on my own printArgumen...

methods vs. functions

I keep on getting confused about this design decision a lot of the time when I'm writing programs, but I'm not 100% sure when I should make a function to be a member function of a class, when to leave it as a normal function in which other source files can call the function when the function declaration is exposed in a header file. Does ...

How do I call a dynamically-named method in Javascript?

I am working on dynamically creating some Javascript that will be inserted into a web page as it's being constructed. The Javascript will be used to populate a listbox based on the selection in another listbox. When the selection of one listbox is changed it will call a method name based on the selected value of the listbox. For examp...

How do I properly encapsulate methods in sub-modules in Ruby? My methods won't appear anywhere!

I've written a very basic finance module in Ruby to ease my own calculations, as sometimes it's just a lot easier to enter irb and start calling functions. But the odd thing is, that in my module I have a submodule with a method called future_value (Finance::CompoundInterest.future_value) ... but according to irb it doesn't exist? It's...

Property or Method?

Possible Duplicate: Properties vs Methods When is it best to use a property or a method? I have a class which is a logger. When I create this class I pass in a file name. My file name for the log is fairly simple, basically it just gets the application path and then combines it with myapp.log. Now instead of having the log fi...

rails models

i have a model named test.rb and when i use @tests=Test.new in my controller i get the following error. Can someone temme how can i resolve this? "undefined method `new' for Test:Module" ...

Add an event to a class method?

OK, I've tried but I just don't get it. I have two classes logger and class1. I have a method called logger.Write(string) and method called class1.Execute(). Now in my application I want to have logger.Write(class1.ToString()) run when class1.Execute() is called. I presume you need to add delegates and events, but I just can't get my...

Calling a method from another method in the same class in C++

I wrote a method (that works fine) for a() in a class. I want to write another method in that class that calls the first method so: void A::a() { do_stuff; } void A::b() { a(); do_stuff; } I suppose I could just rewrite b() so b(A obj) but I don't want to. In java can you do something like this.a(). I want to do obj.b() wher...

f# Method Definition Syntax

I have a method (static in this case) and i can't quite figure out the exact syntax for defining it. static member FindPath : Queue<Node> startNode : Node endNode : Node nodes : List<Node> = //this method will call two other to be constructed methods and return a //queue that is the return value of one of them return new Q...

Java Synchronisation - Do I need it for this simple method?

Hi All, I have a simple method which is called from multiple threads; @Override public Bitmap getFullBitmap(Filter f, ProgressCallback<String> pc) { // Requires synchronisation? Bitmap bitmap = fullMap.get(f.id); if(bitmap == null){ f.setProgressCallback(pc); bitmap = f.e.evaluate(currentBitmap); fullMap.put(f.id, bitmap); } ...

JSomething something = new JSomething().somethingelse;

I could swear I saw an object being created this way. What does somethingelse do? ...

nested methods

add and GetContentPane are methods Does this code access a method in a method? What does this code do? frame.getContentPane().add(BorderLayout.SOUTH, b); ...

Does Java support default parameter values?

I came across some Java code that had the following structure: public MyParameterizedFunction(String param1, int param2) { this(param1, param2, false); } public MyParameterizedFunction(String param1, int param2, boolean param3) { //use all three parameters here } I know that in C++ I can assign a parameter a default value. F...

(noob) C# Programming practice Question

i want to update a control based on a value e.g if (StringName == StringName2) ListBox1.Items.Add("send data"); else if (StringName3 == StringName4) DifferentListBox.Items.Add("send data"); else if (StringName5 == StringName3) AnotherListBox.Items.Add("send data"); // or do...