Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!

Nina Milo

Greenhorn
+ Follow
since Jul 29, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nina Milo

Thanks Henry. I appreciate your answer the code snippet i have wriiten has nothing do with endian processing. I am working on something else which does requires the conversion from big endian to little endian and vice versa.
I wanted to know the I/O performance in general. Which is faster in reading/writing among Ascii and binary files?
10 years ago
Thanks for all your responses. Rob, i considered your reply and was able to get the 32bytes of char data .
My code snipped used:


Now i have one more question regarding the performance of read/write functions for a File. In reality whats the performance of reading and writing ASCII/ Binary files.
I felt handling binary files are little slower because of reading and reversing the bytes (endian format) will take more time compared to ASCII file. Please clarify this?

Thanks.
10 years ago
Thanks Henry.
Its confirmed the file is little endian format. As you said char 32 byte description in file is - ASCII character string representation of a
NULL-terminated string of 32 bytes. This field must consist of 31 numeric characters followed by a NULL char (0x00).

The file format:
#pragma pack(1)
struct DATA
{
unsigned long CODE; (32 bits)
unsigned short STACKER;
unsigned long COUNT;
unsigned short MONTH;
unsigned short DAY;
unsigned short YEAR;
unsigned short HOUR;
unsigned short MINUTE;
unsigned short SECOND;
char RUN_CODE[32];
};
#pragma pack

I have completed reading the entire data except char using datainputstream.
example for first field (32 bits length) i read:


So, My question is how do i read 32byte char data. Is it ok if i use above approach to readunsignedbyte for 8 times and then shift all the bytes. Please correct me if i am wrong .
10 years ago
Hi,
I am trying to read a binary file in java , which i get from a vendor who uses C++ to generate these files. So these files are ofcourse in little endian format.
Have been successful in reading some parts of this file but one part of file as 32bytes Char data. I am not sure how to read all 32bytes of char. I know DataInputStream provides method char readChar() , which is 2 bytes of data. So, do i need to loop reading 2 bytes for 16 times and adding up all those bytes? Also do i need to re-order the bytes if using reahChar() ?
I don't know if its good approach or not . Please provide any suggestions. Thanks for your time.





10 years ago
Hi,
I am trying to use <logic:iterate> tag to retreive values and keys from HashMap. Using 2 different HashMaps for display and below are declarations.
1) HashMap1 ----- HashMap<Integer , ArrayList >
2) HashMap2 ----- HashMap<Integer , HashMap >


I have to iterate and fetch the key from HashMap1 and check against to the Key from HashMap2 . If both keys are equal then i have to perform some functionality.
Its been successful iterating the hashmaps but i have a problem checking both the keys for equal condition. Not sure what iam doing wrong in the code when checking for equal. It never
executes. Is this the right way to check for keys. Please help with this.

Thanks.

code snippet
10 years ago
Yes, i can use JSTL but the part of the code was already implemented in struts so, i don't want to dig it now. If you have any ideas please share on this.
10 years ago
Hi,
I would appreciate if anyone could suggest some ideas on this. I am trying to use both JSTL and Struts tags in my JSP page.
short definition for Hashmap here is:
I am using jstl to iterate the hashmap, Values in hashmap is Arryalist. Can i set this arraylist as a page scope value and can be used further as a property in struts iterate tag? (I understand property in struts tag refers to FormBean property. )


Thanks,
Nina
10 years ago
Hi,
I have a question regarding how to fill the report with map datasource.
As known the fillreport uses the JRDatasource. The datasource could be JRBeanArrayDataSource , JRMapArrayDataSource , JRMapCollectionDataSource and many more other types.


My requirement is to use a LinkedHashMap<String,Integer> because of same insertion order i have to display on the report with key/value pairs. I am thinking to send this
as datasource to fillReport. The questions are :
1) Which datasources i have to use to send linkedhashmap ?
2) Is it possible to send the map as datasource in Jasper ?
3) I dont have any sub-reports in my Jasper report so , how do i get the key and value from datasource and display on the report itself.

I would really appreciate if someone could guide me on this.
I have an extended question to this post.
How could i draw a line border around the selected item instead of highlighting? I have implemented ListCellRenderer and have set the border with LineBorder but that does for each item and not only the last item in the list.
I need to have a border because some of the text in the Lists can have different colors and it gets hidden if selected by index as by default it sets the List background and foreground. It should look like the one i have in the attached file.

Thanks .
11 years ago
Thanks Rob.
After posting the question i was working and i did the same as you said . It worked.
11 years ago
Thanks for the answers.
I have solved the problem myself by doing :

This will automatically select the last recent item displayed in 4 Lists on the frame. But still i have one issue with on of the List's on the frame.

Please look at the attached file. Current working behavior is shown in Frame1 . The expected behavior is shown in Frame2.

In Frame1 :
The recent items are selected in List1 , List2, List3 and List4 as soon as the machine reads. But the last item in List4 is not selected as same number 10 is repeating several times. It selects the first occurrence and
i assume because DefaultListModel closely behaves as vector and the lastElement() returned for same numbers in the vector will be first occurrence. I have to make it work as in Frame2. Please suggest any ideas.

Thanks.


11 years ago
Please open the attachment before reading below.

I have displayed 4 JList's in a row , where each of the Lists has barcode getting
displayed from the input read through machine. Input read sequence is
For 1st piece read - List1,List2, List3 and List4 items are displayed
For 2st piece read - List1,List2, List3 and List4 items are displayed
For 3rd piece read - List1,List2, List3 and List4 items are displayed
:
:
Repeats for N pieces.

My question is how to automatically select or highlight the recent last item
getting displayed in 4 lists without user selecting the item. This is required for
the user to view and find which was the last piece read by the machine.

Any help is accepted and thanks for consideration.
11 years ago
Hi Sivaraman,
Thanks for the reply. I have tried setting the formula first but it doesn't work. It is still either 0 or 1

Thanks
I am trying to create a report in excel using apache POI 3.5 jar . I have almost completed writing the data details to excel. But only issue is
writing the percentage format. I have set the cellstyle dataformat to "0%" but the report generated displays 0 or 1 instead of some value. When i format the cell manually
i can see the expected values. Please provide an answer for displaying the % format in excel. Thanks for the help.

Hi,
I would like to know the procedure to read mutliple Tiff images from any given location on local drive. Actually i could read single image and paint on the component. Again i was wondering if i fetch multiple images and save in memory do i have any memory concerns like "out of memory". And images vary in size from 1MB to 4MB.

After reading the image i do apply some transformations. But i have to repeat this process for as many images coming in. So when the user submits "NextImage" button on the console , i should be able to display next image in queue. Please suggest me how to handle this.

Thanks.

This is simple code i am using to create a single buffered image
12 years ago