Consider the following method signatures:
public fooMethod (Foo[] foos) { /*...*/ }
and
public fooMethod (Foo... foos) { /*...*/ }
Explanation: The former takes an array of Foo-objects as an argument - fooMethod(new Foo[]{..}) - while the latter takes an arbitrary amount of arguments of type Foo, and presents them as an array of Fo...
We recently had a problem where, after a series of commits had occurred, a backend process failed to run. Now, we were good little boys and girls and ran rake test after every check-in but due to some oddities in Rails' library loading, it only occurred when you ran it directly from mongrel in production mode.
Tracked the bug down and i...
I have never seen a way to do this nicely, i would be interested in seeing how others do it. Currently i format it like this:
public Booking createVehicleBooking(Long officeId,
Long start,
Long end,
String origin,
...
I have a page that is hitting a webservice every 5 seconds to update the information on the page. I'm using the DynamicPopulateExtender from the Ajax Control Toolkit to just populate a panel with some text.
What I was wanting to do, is if a certain condition is met, to refresh the page completely.
Am I going to be able to do this in t...
I'm working on a project in C#. The previous programmer didn't know object oriented programming, so most of the code is in huge files (we're talking around 4-5000 lines) spread over tens and sometimes hundreds of methods, but only one class. Refactoring such a project is a huge undertaking, and so I've semi-learned to live with it for no...
What is the difference between anonymous methods of C# 2.0 and lambda expressions of C# 3.0.?
...
Hey
I'd like to know how to - if even possible - reflect what method calls are executed inside the method during execution. I'm especially interested in either external method calls (that is, methods in other classes) or calling some specific method like getDatabaseConnection().
My intention would be to monitor predefined objects' acti...
I want to sort members by name in the source code. Is there any easy way to do it?
I'm using NetBeans, but if there is another editor that can do that, just tell me the name of it.
...
A client asked me if I knew anything about the HOME development method. I, together with wikipedia and acronymfinder, drew a complete blank.
Has anyone here heard about a development method called HOME?
...
What's better practice when defining several methods that return the same shape of data with different filters? Explicit method names or overloaded methods?
For example. If I have some Products and I'm pulling from a database
explicit way:
public List<Product> GetProduct(int productId) { // return a List }
public List<Product> G...
I'm wondering if it is possible to add methods in main program to an existing class defined in header file.
For example:
There is class CFun defined in file CFun.hpp, but in our party.cpp we want to add a method void hello() {cout << "hello" << endl;};without editing CFun.hpp
Obviously (unfortunately) construction:
#include "CFun.hpp"
...
The code at the end produces a compile error:
NotApplicable.java:7: run() in cannot be applied to (int)
run(42);
^
1 error
The question is why? Why does javac think I am calling run(), and does not find run(int bar)? It correctly called foo(int bar). Why do I have to use NotApplicable.this.run(42);?...
This question is a follow up to:
Why can’t I call a method outside of an anonymous class of the same name
This previous question answer why, but now I want to know if javac should find run(int bar)? (See previous question to see why run(42) fails)
If it shouldn't, is it due to a spec? Does it produce ambiguous code? My point is, I t...
Hi
I have created a base class A and a class B is a derived class inherited from class A. Both classes are marked as Serialized. When I try to return an object of type B through a web method i am getting following error:
System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to proce...
I've noticed in many places in Java (C# included), that many "getter" methods are prefixed with "get" while many other aren't. I never noticed any kind of pattern Sun seems to be following. What are some guidelines or rules for using "get" in getter method names?
...
I have a requirement to get the contents of every method in a cs file into a string. What I am looking for is when you have an input of a cs file, a dictionary is returned with the method name as the key and the method body as the value.
I have tried Regex and reflection with no success, can anyone help?
Thanks
...
Hello everybody,
I have two Java classes : B, which extends another class A, as follows :
class A
{
public void myMethod()
{ /* ... */ }
}
class B extends A
{
public void myMethod()
{ /* Another code */ }
}
I would like to call the A.myMethod() from the B.myMethod(). I am coming from the C++ world, and I don't know ho...
Hi,
Is there a way to pass null arguments to C# methods (something like null arguments in c++)?
For example:
Is it possible to translate the following c++ function to C# method:
private void Example(int* arg1, int* arg2)
{
if(arg1 == null)
{
//do something
}
if(arg2 == null)
{
//do something else
...
I've been thinking of ways of providing syntactic sugar for a framework I have been working on. I want to deal with Immitable objects exclusively.
Say I have an immutable object and wish to create a modified version of it. Would, in your view, a non-instantiable class with a single static factory method break OO principles ?
As an...