methods

Error CS0161: Not all code paths return a value

Hello. I have this error. Can anyone tell me why? In TA.cs public class TA { public TA() { } public static DataTable MergeTA() { DataTable myDT = new DataTable(); myDataTable.Columns.Add("AcadYear", typeof(string)); myDataTable.Columns.Add("NofGrp", typeof(System.Int16)); myDataTable...

Java : logging execution history as XML

For debugging purposes, I need to follow the execution of some piece of code, within a class. I would like to generate a log for all method calls, in XML, like : <call class='pack.age.MyClass' method='myMethod1'> <param name='param1'>param1.toString() value</param> ... <call>Call to other method within myMethod1; you get the...

Hiding GetHashCode/Equals/ToString from fluent interface classes intellisense in Visual Studio for C#?

I have a fluent interface for an IoC container registration process, and this contains some classes that are used to build up the registrations. For instance, I can do this: builder.Register<IFoo>().From.ConcreteType<Foo>(); However, at each step after a dot, intellisense pops up showing the four standard methods from the Object clas...

Generic Methods in C#

Generic Methods in general are new to me. Need a method that returns a Collection of a generic type, but also takes a collection of the same generic type and takes Expression<Func<GenericType, DateTime?>>[] Dates parameter. T throughout the following function should be the same type, so right now I was using (simplified version): ...

How to easy find unused public methods/properties

I have a .Net(C#) solution. The solution contains bunch of projects. The projects were implemented not by me. It is not a framework, it means that I need to have amount of public methods/properties as less as possible. My task is to identify methods and properties which are not used, but exist in the projects. Well, I can find private me...

Where do you get your PHP documentation from?

Most IDEs come with complete documentation that can be installed locally, but I have a particular problem with PHP, as even the Netbeans PHP IDE links to online docs. How do you manage yours? Is there a hidden downloadable docs for PHP somewhere? ...

how do i hide var passing info in the url if i have no form tags?

Hey guys - im using var passing links like this to jump around a site... <a href = "index.php?content=about.html"> ...problem is, i have all the ugly var info visible in the url. I would usually hide it by using the post method, but i dont have any form tags, so is it even possible? Thanks!!!!!!! ...

What are all the most common method/variable/class names that you use?

Most common method/variable/class names that you use often and that explain you intent clearly and precisely.Is there any pattern you follow to figure that out. ...

Why I cannot build a chain of methods? (method1.method2.method3)

If I have the following code: import sqlite sqlite.connect('tmp.db').cursor().close() I get the following error message: Traceback (most recent call last): File "searchengine2.py", line 13, in ? sqlite.connect('tmp.db').cursor().close() File "/usr/lib64/python2.4/site-packages/sqlite/main.py", line 280, in close if self.c...

Isolating Ruby methods from overriding in subclasses? (like Java's private methods)

In Ruby, I'd like to acheive something like this Java sample: class A { private void f() { System.out.println("Hello world"); } public void g() { f(); } } class B extends A { public void f() { throw new RuntimeException("bad guy");} } public class Try { public static void main(String[] args) { new B().g();} } ...

Java Getter and Setter Method

What are getter methods and setter methods in Java? What is their technical term in Java? ...

How can an Objective-C method refer to the object that invoked it?

This is so simple it's driving me crazy that I can't find an answer. How can a method refer to the instance that invoked it? Example: in some method of class alpha, I have "[bravo charley]" I want to have the charley method do "[alpha-instance delta];" with the particular instance of alpha that did the "[bravo charley]". But charley d...

NoMethodError in basic scaffolded View?

I created a basic scaffold for a Foo model with a single property - bar:String foos/new.html.erb: <h1>New foo</h1> <% form_for(@foo) do |f| %> <%= f.error_messages %> <p> <%= f.label :bar %><br /> <%= f.text_field :bar %> </p> <p> <%= f.submit 'Create' %> </p> <% end %> <%= link_to 'Back', foos_path %> But I ...

writelog.cs; error log.txt

I am creating a common class called writelog.cs This is to store the common method to call in all my programs (aspx page) After which, whatever error is produced, it will come out to an error log.txt This is my codes for writelog.cs And i got this error: The name 'Global' does not exist in the current context /// <summary> /// Summary ...

How do I run an object's method onEvent in javascript?

Hello, I just started using javascript and I'm missing something important in my knowledge. I was hoping you could help me fill in the gap. So the script I'm trying to run is suppose to count the characters in a text field, and update a paragraph to tell the user how many characters they have typed. I have an object called charCounter...

Unit testing private code

Hello all I am currently involved in developing with C# - Here is some background: We implement MVP with our client application and we have a cyclomatic rule which states that no method should have a cyclomatic complexity greater than 5. This leads to a lot of small private methods which are generally responsible for one thing. My ques...

Basic Ruby string handling question

Does giving a idea = gets.reverse print idea If user inputted 'dog' it would come out 'dog' But if you did this code... idea = gets.reverse! print idea Then the string variable being returned would be 'god', right? ...

Access modifiers on methods using Tuple in C#

On one hand, a tuple is versatile, but on the other, can be less clear. As a best practice, should tuple not be used for the return type of a public method? Similarly, should it not be used for the type of any parameter of a public method? In other words, should it only be used in declarations of protected, internal, and private me...

Java - Creating a string by selecting certain numbers from within a text file

I have a .txt file that has numbers 1-31 in it called numbers. I've set up a scanner like this: cardCreator = new Scanner (new File ("numbers")); After this, I'm kind of confused on which methods I could use. I want to set up a conditional statement that will go through numbers, evaluate each line (or numbers 1-31), and includ...

Calling a generic method from IronRuby

Hi How can I call a generic method (.NET 3.5 SP1) from IronRuby v0.9? Trying to do something as obj.method(:method_name).of(String).call seems not to work as "of" is an unknown method. Thanks a lot ...