For simple getters/setters, like the one below, what's the best way to document it?
public float getPrice()
{
return price;
}
I'm pretty strict about coding standards, so my IDE warns me about any undocumented public/protected methods.
Option 1:
/**
* Get the price field.
*
* @return
*/
Option 2:
/**
* @return Price
*/...
Floating point values are inexact, which is why we should rarely use strict numerical equality in comparisons. For example, in Java this prints false (as seen on ideone.com):
System.out.println(.1 + .2 == .3);
// false
Usually the correct way to compare results of floating point calculations is to see if the absolute difference agains...
I currently have a method that receives a byte array of an excel file. It worked great, and I had it differentiating the file types (.xls, and .xlsx) based on the first two bytes in the file. If it's an .xlsx it started with a PK. Unfortunately, now I am getting .xlsm files sent, and I don't know what byte differs to tell them apart. ...
Hi guys,
I wanted to find out other ways to do Asynchronous Observer Pattern without using Message Queue. Ideas and examples are mostly welcomed. :-) (Think of this as a brainstorming session).
PS Language preference is up to you.
...
I have an equation for a parabolic curve intersecting a specified point, in my case where the user clicked on a graph.
// this would typically be mouse coords on the graph
var _target:Point = new Point(100, 50);
public static function plot(x:Number, target:Point):Number{
return (x * x) / target.x * (target.y / target.x);
}
Thi...
I'm working on a project where I have to take data from one source and translate/tweak it so that it can be properly consumed by a different source, in this case, the database. I imagine this is a fairly common problem, and while I believe I'm off to a good start, I'm stuck as to how best to implement the middle part of the solution tha...
Ruby has "method_missing", Tcl has "unknown", and most highly dynamic languages have an equivalent construct that is invoked when an undefined method is called.
It makes perfect sense to add such functionality; something needs to happen, and there's no reason not to allow that something to be redefined by the programmer. It's rather triv...
I have a facebook app page, and a separate facebook business profile page.
The business page was created, but not by me, some time before the app and its page were created. Is there any way to connect the two pages, or import the content and friends from one to the other?
The older profile page has some content; a set of friends an...
I have many T arrays to read.
Each T array can represent data of type A, B or C.
A: A list of T
B: A single T
C: Exactly three T
When I read a T array, I will be able to get a list of T, and determine by reading the first T in the list whether it's of type A, B or C.
I thought of two possible approaches and would like to know their meri...
In my template-matching code I need the user to pass a floating-point parameter, which specifies whether the algorithm should concentrate only on the best matches (thus work faster) or analyse even low-probability areas (making it slower).
The parameter is linear and normalized such that possible values are in range <0, 1>. It doesn't m...
Two years after does-the-jvm-prevent-tail-call-optimizations, there seems to be a prototype implementation and MLVM has listed the feature as "proto 80%" for some time now.
Is there no active interest from Sun's/Oracle's side in supporting tail calls or is it just that tail calls are "[...] fated to come in second place on every feature...
Hi,
Im writing a compiler for university project, and I would like to transform my Abstract Syntax Tree into a Control Flow Graph(CFG).
Im thinking that the nodes(V) in the CFG should be nodes from the AST. I know algorithmically how to construct the edge set (G=(V,E)) but Im having a hard time writing the process a bit more formally
...
I want to create an application similar to cacti.
I would like to store time-series data in a MySQL database (that is rotated on schedule).
Where does cacti (nagios, zenoss) store polled data?
a) in a MySQL database
b) in a RRD database
c) both?
How does cacti (nagios, zenoss) make room for more data when it runs out of space?
Ho...
Given an arbitary peg solitaire board configuration, what is the most effecient way to compute any series of moves that results in the "end game" position.
For example, the standard starting position is:
..***..
..***..
*******
***O***
*******
..***..
..***..
And the "end game" position is:
..OOO..
..OOO..
OOOOOOO
OOO*OOO
OOOOOOO
.....
I was thinking of the multiple ways which security could be implemented in a Plugin-based system. Now when I say 'Security', what I mean is this:
a) How developers of a Plugin system can ensure that plugins are secure and safe to use on the Core platform.
b) How developers of a plugin can ensure that the plugins being used on their Plat...
I was originally going to make this a longer question, but I feel like the shorter I make it, the better you'll understand what I mean.
The MVC architectural pattern has 3 dependencies. The View depends on the model. The Controller depends on the View and Model. The Model is independent.
The Layers architectural pattern defines N - 1 d...
Possible Duplicates:
which data structure is appropriate to query all points within distance d from point p
Storing objects for locating by x,y coordinates
I have a list of items, each with a location in 2D space (specified using euclidean geometry, i.e. as an (x, y) coordinate pair).
How should I store this list (e.g. hash...
Hello,
This is a problem I would think there is an algorithm for already - but I do not know the right words to use with google it seems :).
The problem: I would like to make a little program with which I would select a directory containing any files (but for my purpose media files, audio and video). After that I would like to enter in...
I need to intercept method invocations... please suggest a ready-made solution.
It's necessary to block access to some methods (so calling them will generate an exception)
...
I've been researching how different languages manage organization of source code. It appears most modern languages use some form of named abstract container. What its called and how its implemented varies from one language to the next but it boils down to a programming construct that operates beyond file boundaries to group related code....