I want to convert my Resultset to List in my JSP page. and want to display all the values. This is my query:
SELECT userId, userName
FROM user;
I have executed that using preparedstatement and got the Resultset. But how to convert it as a List and want to display the result like this:
userID userName
------------------
1001 user-X
1006 user-Y
1007 user-Z
Since document databases store records in tree like structures the fields will never be at set positions. Does this make querying a document database inefficient, or would indexes just be used as with a normal relational database?
I have created a record like this:
(defrecord User [user-id email])
:but when I try to access it from another name-space I get the error:
(User. "name" "email")
java.lang.IllegalArgumentException: Unable to resolve classname: User
It works when I do:
(oe.model.modelcore.User. "name" "email")
: I know I will need to import the Java class, but is there any way for clojure to do this automatically when I do:
(use 'oe.model.modelcore :reload)
I have been learning the mapreduce algorithm and how it can potentially scale to millions of machines, but I don't understand how the sorting of the intermediate keys after the map phase can scale, as there will be:
1,000,000 x 1,000,000
: potential machines communicating small key / value pairs of the intermediate results with each other? Isn't this a bottleneck?
I have an erlang program which runs a server on a local machine and I would like it to start a local web browser and point to itself on startup. How can I do this in a portable way across Windows XP. Vista, and Windows 7?
I'm writing some Erlang code and I'm very unsure whether I should let everything fail fast. One problem I find with fail fast is that for the developer/user the exception generated is pretty meaningless. Any idea what I should return which would not give esoteric and hard to read stack traces?
I'm using Emacs on different environments and unsure of which version to use so that they all behave the same as I hear there are differences between XEamcs, Emacs, and some other versions. Which should I use?
For example, to denote a String I could use:
{string,"hjggjhhggJ"}
and a list would be:
{list, [1,2,3]}
: I guess I have found that I am running into situations where I need types, for example to distinguish between strings and lists and I am not sure how to proceed. I do however want to use whatever technique I choose everywhere in my Erlang application for consistency, and not just for strings and lists. Any advice?
I have recently seen alot of activity saying that "if" statements should be banned. However in some of the alternatives people are just doing an "if" statement but discussed as a "case" statement, or as an overloaded function in pattern matching languages. Is it really such a clean solution to replace a well understood concept with a more obscure one?
I have a paramterised module in Erlang in which I wish to call a function A from within function B of the same parameterised module. How can I do this?
I am writing a program that can have either a list or a string as an argument. How can I tell the difference between a string and a list programmatically in Erlang. Something like:
print(List) -> list;
print(String) -> string.
I know you can do something like this:
readlines(FileName) ->
{ok, Device} = file:open(FileName, [read]),
get_all_lines(Device, []).
get_all_lines(Device, Accum) ->
case io:get_line(Device, "") of
eof -> file:close(Device), Accum;
Line -> get_all_lines(Device, Accum ++ [Line])
end.
: Is there a one liner BIF that can do this too?
I'm trying to find out how I can iterate over the final results of a map reduce operation, so I guess there must be some sort of index into the map reduce results?