Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.

Prasad Saya

Rancher
+ Follow
since Jun 05, 2009
Prasad likes ...
Java Notepad
Cows and Likes
Cows
Total received
15
In last 30 days
0
Total given
0
Likes
Total received
83
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Prasad Saya

Closing a topic is not an end to anything really. George G. can always solve the way he perceives it. He can try to understand whats posted by the ranchers and figure the solution. May be there is another way. Sometimes pausing little bit can clear things up.

Perhaps there are many thoughts and ideas to focus on. May be its little overwhelming (it can be sometimes when there is pressure to figure a solution on time, etc.). Can't say what are the factors affecting. Over years I have come to know that the most deterring factor in solving an issue in software field is human and his intervention; its never a technology or hardware or software.
2 months ago
Good to know you are finishing your code without any issues  . While posting the code make sure its properly indented (and do remove the commented code). Also, if code comments (saying what it does) are placed strategically helps others to read the code and respond with a comment or a suggestion.
2 months ago
RandomAccessFile has mechanism called file pointer which allows access to data from a known particular position in a file. But, I don't know if it can be used with a file with serialized objects.

In case you choose to use a List collection to store and then retrieve objects from it, one can navigate thru a list using a ListIterator - an iterator for lists that allows traversal of the list in either direction.

But what i want in my project is to get first object , last object, previous etc. ...

3 months ago

Prasad Saya wrote:I think, first you may have to write the code without streams API (functional-style programming) using pre-Java 8 constructs and find the solution. And, then translate or refactor it into using the streams API.



Enthusiasm to do functional-style programming is not enough. It requires study and effort. Switching from OO style programming to functional-style requires understanding of why functional style, what are the differences, advantages and disadvantages, use cases, etc. Learning or browsing thru the API's is not sufficient, one needs to know how the provided features can be used and in the right situations.

A way to learn (other than books, tutorials, tests, etc) is to actually take some non-functional code and convert it. One can immediately see the differences - like the compactness of the code, the self-documentation, the new features and the efficiency.
3 months ago
I think the GO command need to be studied and list out the use cases. Then, work how these cases can be handled within this application.
3 months ago

Stephan van Hulst wrote:

Prasad Saya wrote:I think, first you may have to write the code without streams API (functional-style programming) using pre-Java 8 constructs and find the solution. And, then translate or refactor it into using the streams API.


I don't agree with this advice. People don't learn functional programming by translating imperative programs. It's good to get into a functional mindset straight away.



Then one should learn functional-style Java programming. One should put some effort, in a professional manner.
3 months ago
I think, first you may have to write the code without streams API (functional-style programming) using pre-Java 8 constructs and find the solution. And, then translate or refactor it into using the streams API.
3 months ago
I just used most of your code and refactored it like this (as I had explained earlier) and you may have to figure some details:

3 months ago
The main method does this:

- from the original code: creates the Dictionary reader = ... using the two files Text.txt and Text2.txt (or more files)
- create a list of your 10-12 input files (A, B, C,...)
- process each file in a loop: processDocument
3 months ago
The GO command of sql server and its usage: http://www.sqlines.com/sql-server/sql_batch_go

You need to figure how to create batches of queries and how the GO affects the way the batched sql statements will be executed.
3 months ago

Would the dictionaries values be reset to 0 after each call?



Yes. The value part of the map.

But would that not overwrite the pre-existing vector(s)? If so, would this guarantee each vector would be different?



Yes, it overwrites.

You need to create another static variable List<Vector> myVectors = ....
-and-
for each call store the vectors in that. So, at the end of processing all the 10-12 files you will be left with myVectors list with the output of those 10-12 input files/documents.
3 months ago
You can try this.

Define "dictionary" as a static variable. Store the 10-12 file names to be processed in an ArrayList and process each file in a for-loop in a new function called processDocument or processInputFile:

3 months ago
I am not familiar with SQL Server; but it looks like you have to execute sql statements as a batch. Look for something like JDBC execute batch on Google search.
3 months ago
What is he SQL script you are trying to run?
3 months ago


This above statement doesn't create a file; its a File object, but not an actual physical file in a directory. The file gets created when you do this:



Then this tempFile can be renamed to the inFile, as you intended to.
3 months ago