I am writing a simple program designed to correctly bin elements from a large text file and re-display them in an accessible way. When I run it in Eclipse, it appears to run fine (running a small test file reveals that no data is missing from the final bins), but the eclipse editor displays "Error: 16." Can someone tell me what this is? Thanks.
Edit:
Here is my complete console input. It is entirely test outputs during the run, with that error at the end:
0 4 7 1 0 2 3 4 6 7 6 7 6 7 6 1 1 1 1 3 3 3 2 2 2 2 2 1 1 1 0 0 0 8 8 9 9 9 9 9 9 9 9 9 9 95.80,
1.345345,2.3880140,2.43,
6.4.576,
74.5,34.58431,43.50,
67,23.080,
423,
456,
456.2,
6.5,2.8,
3153,29.6,
97.685,
56.821233,
745623482281234,7.64,
6788464,
86,
1.234234,
78.84321,
4.5688,
5672,
45.62,
41.5321,
3.45,56745848867,
4.5234523,
742,
528488,
34.58652,
2340852,243.52345,22.46246,4.35,
345.2347674567,
23452.14352435,
2.68488,2457537453,
2435.23452345,
4358,2.021564,
Error: 16
Related
How to calculate grade wise counts by semester and grade range.
I am having tables, fields and data as follows:
SEMETSER
SEMISTER_NO
NAME
1
FIRST
2
SECOND
STUDENT_SEMETSER
STUDENT_NO
SEMESTER_NO
SCORE
1
1
9.8
2
1
9.2
3
1
8.8
4
1
7.8
5
1
7.5
6
1
7.2
7
2
8.8
8
2
8.2
9
2
8.8
10
2
6.8
11
2
6.5
12
2
6.2
RESULTS Expected:
SEMESTER_NO
SCORE 10-9
SCORE 9-8
8-7
7-6
6-5
5-4
1
2
1
3
0
0
0
2
0
3
0
2
0
0
Using CASE-WHEN and PIVOT is one of the options:
SELECT *
FROM
(
SELECT semester_no,
CASE
WHEN SCORE>= 9 and SCORE<=10 THEN 'Score 10-9'
WHEN SCORE>= 8 and SCORE<9 THEN 'Score 9-8'
WHEN SCORE>= 7 and SCORE<8 THEN 'Score 8-7'
WHEN SCORE>= 6 and SCORE<7 THEN 'Score 7-6'
WHEN SCORE>= 5 and SCORE<6 THEN 'Score 6-5'
WHEN SCORE>= 4 and SCORE<5 THEN 'Score 5-4'
END AS score_cat
FROM student_semester
)
PIVOT
(
COUNT(score_cat)
FOR score_cat IN ('Score 10-9','Score 9-8','Score 8-7','Score 7-6','Score 6-5','Score 5-4')
)
ORDER BY semester_no
The CASE statement will categorize the score into different buckets (Modify as per your need) and PIVOT statement will transpose the data into desired level.
DEMO
This question already has answers here:
Using the non final loop variable inside a lambda expression
(3 answers)
Closed 3 years ago.
I have a list of ints like the following one:
1318 1065 0
1392 1109 0
1522 1114 2
1764 1134 0
1643 1172 0
1611 1141 0
1608 1142 4
1689 1180 0
1546 1144 0
1811 1121 1
1682 1144 0
1687 1203 0
1751 1138 0
1702 1227 0
My goal is to keep only entries where the third element is a 0.
I've tried a few things like:
for( int i=0; i<data_fin.size();i++) {
data_fin.removeIf(s -> !((data_fin.get(i)[2]) == 0));
}
I get the error 'Local variable i defined in an enclosing scope must be final or effectively final'.
Can anyone help me understand what I'm doing wrong? I'm quite new to Java and I'm probably using removeif wrong, so I would appreciate the help!
My goal is to keep only entries where the third element is a 0
You don't need a loop in this, all you need is :
data_fin.removeIf(a -> a[2] != 0);
I think Java doesn't provide much in their API about getting processes, is there a way that you could get a parent's process PID/ID in Java?
If you're running on Linux you can check procfs using /proc/self/stat.
Following from #Imz's answer, on Linux, grab the output of /proc/self/stat (it's a one-line file, so just read it like a normal file)
43732 (java) S 43725 43725 11210 34822 43725 4202496 127791 387073
4055 0 3188 79 4597 253 20 0 53 0 16217706 39231705088 188764
18446744073709551615 4194304 4196452 140735605394256 140735605376816
274479481597 0 0 2 16800973 18446744073709551615 0 0 17 13 0 0 0 0 0
The 4th field (in bold above) is your parent process id
I have a shared library placed in libs/armeabi folder. It is loaded using
System.loadLibrary("library_name.so");
The size of the library is around 3MB. The loading time is very long. It sometimes last almost 20 seconds. It blocks my GUI. I tried to put System.loadLibrary("library_name.so"); in a different thread but my GUI is still blocked. I know that others apps use even bigger .so files, but the loading time is not so big. What could be the problem?
EDIT
3MB was the size of the debug version. Release version is about 800KB, but the problem is the same. Some additional info:
.so contains my two c++ libraries which are circularly connected
running arm-linux-androideabi-nm -D -C -g library_name.so displays a lot of functions and variables
I don't use LOCAL_WHOLE_STATIC_LIBRARIES anymore
here are the section headers table obtained by using arm-linux-androideabi-readelf-tool:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .dynsym DYNSYM 00000114 000114 00b400 10 A 2 1 4
[ 2] .dynstr STRTAB 0000b514 00b514 015b0c 00 A 0 0 1
[ 3] .hash HASH 00021020 021020 004d1c 04 A 1 0 4
[ 4] .rel.dyn REL 00025d3c 025d3c 006e98 08 A 1 0 4
[ 5] .rel.plt REL 0002cbd4 02cbd4 000468 08 A 1 6 4
[ 6] .plt PROGBITS 0002d03c 02d03c 0006b0 00 AX 0 0 4
[ 7] .text PROGBITS 0002d6f0 02d6f0 08e6e0 00 AX 0 0 8
[ 8] .ARM.extab PROGBITS 000bbdd0 0bbdd0 00bad0 00 A 0 0 4
[ 9] .ARM.exidx ARM_EXIDX 000c78a0 0c78a0 005b80 08 AL 7 0 4
[10] .rodata PROGBITS 000cd420 0cd420 005cc0 00 A 0 0 4
[11] .data.rel.ro.loca PROGBITS 000d46d8 0d36d8 0006e4 00 WA 0 0 4
[12] .fini_array FINI_ARRAY 000d4dbc 0d3dbc 000008 00 WA 0 0 4
[13] .init_array INIT_ARRAY 000d4dc4 0d3dc4 00009c 00 WA 0 0 4
[14] .data.rel.ro PROGBITS 000d4e60 0d3e60 00384c 00 WA 0 0 8
[15] .dynamic DYNAMIC 000d86ac 0d76ac 000100 08 WA 2 0 4
[16] .got PROGBITS 000d87ac 0d77ac 000854 00 WA 0 0 4
[17] .data PROGBITS 000d9000 0d8000 000648 00 WA 0 0 8
[18] .bss NOBITS 000d9648 0d8648 047271 00 WA 0 0 8
[19] .comment PROGBITS 00000000 0d8648 000026 01 MS 0 0 1
[20] .note.gnu.gold-ve NOTE 00000000 0d8670 00001c 00 0 0 4
[21] .ARM.attributes ARM_ATTRIBUTES 00000000 0d868c 00002d 00 0 0 1
[22] .shstrtab STRTAB 00000000 0d86b9 0000d8 00 0 0 1
Try to reduce number of exported functions in your shared library. You can use
arm-linux-androideabi-nm -D -C -g library_name.so
and check if that list is unnecessarily long, and remove the ones that you don't use (declare them static). You can look up nm's manual by $man nm and read about how to use and interpret it.
If you need to use lots of functions, use RegisterNatives() to register your functions instead of relying on name mangling and lookup - that's what you do when you give your functions names like Java_your_path_YourClass_yourFunction.
You can also try to strip (arm-linux-androideabi-strip) your library, if it has symbols.
To avoid blocking UI, you can try to load your shared library early in a different thread and wait for it.
I wouldn't use LOCAL_WHOLE_STATIC_LIBRARIES, if exposing static libraries is not what I ultimately want.
LOCAL_WHOLE_STATIC_LIBRARIES
These are the static libraries that you want to include in your module without allowing the linker to remove dead code from them.
This is mostly useful if you want to add a static library to a shared library and have the static library's content exposed from the shared library.
Try to fix that problem instead of working around some build problem.
The problem is static initialization in some constructor which takes to much time to finishis
Within a java project I have the following code:
public static <return> method(<parameters>){
1 <any method call>
2 while( <conditions> ){
3 <any method call>
4 switch(<enum or integer>){
5 case 0:
6 <any method call>
7 break;
8 case 1:
9 <any method call>
10 break;
11 case 3:
12 <any method call>
13 break;
14 default:
15 <any method call>
16 break;
17 }
18 <any method call>
19 }
}
When stepping over with the debugger, the first time I enter the while, it jumps from 2 to 16.
I've been trying to replicate it with stripped out code without success, and to find what piece is responsible for this weird behavior, but and until now, just another weird thing found:
When I declare a dummy variable at 1 AND modify it at 18 (at 3 doesn't work), the behavior is the expected (enter line 3 just after 2)
Edit:
Attached java file and
disensambled code