|
|
| scottpedia [scottpedia!~black@user/scottpedia] has joined #java |
[12:02]
|
| _ht [_ht!~Thunderbi@28-52-174-82.ftth.glasoperator.nl] has joined #java |
[12:06]
|
| scottpedia [scottpedia!~black@user/scottpedia] has joined #java |
[12:07]
|
| metalmaniac [metalmaniac!~metalmani@user/metalmaniac] has joined #java |
[12:39]
|
| boB_K7IQ [boB_K7IQ!~boB_K7IQ@c-71-231-175-1.hsd1.wa.comcast.net] has joined #java |
[12:55]
|
| salparadise [salparadise!~salparadi@129.146.145.125] has joined #java |
[01:00]
|
| qu4nt1n [qu4nt1n!~qu4nt1n@78.198.214.34] has joined #java |
[01:01]
|
| qu4nt1n [qu4nt1n!~qu4nt1n@78.198.214.34] has joined #java |
[01:04]
|
| acidjnk [acidjnk!~acidjnk@p200300d6e7072f30f5f19602a84c17f0.dip0.t-ipconnect.de] has joined #java |
[01:28]
|
| Square2 [Square2!~Square4@user/square] has joined #java |
[01:30]
|
| llanhmod parted the channel: |
[01:56]
|
| llanhmod [llanhmod!domhnall@user/domhnall/x-2887755] has joined #java |
[01:57]
|
| slidercrank [slidercrank!~slidercra@user/slidercrank] has joined #java |
[02:15]
|
| slidercrank [slidercrank!~slidercra@user/slidercrank] has joined #java |
[02:16]
|
| node1 [node1!~bipul@user/node1] has joined #java |
[02:16]
|
| node1 |
Hello |
[02:16]
|
| node1 |
How to generate JNI header file from java source file? in Java17? |
[02:16]
|
| node1 |
I have tried using javac -h . foo.java but did not getting foo.h in my present directory. Any help would be highly appreciated |
[02:19]
|
| rvalue [rvalue!~rvalue@user/rvalue] has joined #java |
[02:21]
|
| BluesBoy |
node1: is foo.java in some package ? |
[02:28]
|
| node1 |
Yes it's |
[02:28]
|
| BluesBoy |
from the doc: If the class is part of a package, then the compiler puts the native header file in a subdirectory that reflects the module name (if appropriate) and package name. The directory, and any necessary subdirectories, will be created if they do not already exist. |
[02:28]
|
| node1 |
can you link me the doc? if you know some working example please show |
[02:29]
|
| BluesBoy |
<a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html" target="_blank">https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html</a> |
[02:29]
|
| node1 |
And if it's not the part of package or some library then ? |
[02:32]
|
| node1 |
BluesBoy, Let suppose if it's not the part of package or some library then ? |
[02:33]
|
| BluesBoy |
if I have com/test/TestJni.java with public native void func(); and do javac -h . com/test/TestJni.h I get com_test_TestJni.h in current folder |
[02:37]
|
| node1 |
Your doing package. |
[02:42]
|
| BluesBoy |
you said your java file is in some package |
[02:43]
|
| node1 |
Yes i said that, and you have answered for the package i believe. Now i have asked again another question, what *if* instead of package some library then? |
[02:45]
|
| BluesBoy |
library ? |
[02:45]
|
| node1 |
<a href="https://en.wikipedia.org/wiki/Java_Class_Library" target="_blank">https://en.wikipedia.org/wiki/Java_Class_Library</a> |
[02:46]
|
| BluesBoy |
do you get any errors when you do "javac -h . foo.java" ? If you get errors, .h will not be generated |
[02:48]
|
| node1 |
I don't get the header file |
[02:50]
|
| BluesBoy |
but do you see any compile errors ? |
[02:51]
|
| node1 |
Nothing, can you show me how foo.java would looks like? |
[02:56]
|
| node1 |
NO compilation error |
[02:56]
|
| node1 |
? |
[03:00]
|
| enoq [enoq!~enoq@194-208-133-121.lampert.tv] has joined #java |
[03:03]
|
| BluesBoy |
my test class: public class TestJni { public native void func(); } |
[03:05]
|
| dev4449 [dev4449!uid564338@id-564338.tinside.irccloud.com] has joined #java |
[03:08]
|
| accord [accord!uid568320@id-568320.hampstead.irccloud.com] has joined #java |
[03:15]
|
| llanhmod parted the channel: |
[03:16]
|
| node1 |
Maybe native methods declared in the Java code |
[03:29]
|
| node1 |
is required. |
[03:29]
|
| ernimril |
node1, consider putting a test case in pastebin: that is your java source and then also the command lines you give in the terminal and the output of your javac |
[03:31]
|
| node1 |
Maybe the native method declaration is required in the Java code |
[03:31]
|
| ernimril |
node1, if you do not mark the method with "native" it should not be in the header, yes |
[03:32]
|
| node1 |
yes correct. |
[03:33]
|
| BluesBoy |
if there are no native methods declared then no .h will be generated |
[03:36]
|
| Matthijs [Matthijs!~quassel@161.35.149.49] has joined #java |
[03:48]
|
| xa0s [xa0s!~xa0s@ma.sdf.org] has joined #java |
[03:49]
|
| AMG [AMG!ghebo@user/amg] has joined #java |
[03:51]
|
| FabioPort [FabioPort!~FabioPort@host-195-120-87-13.business.telecomitalia.it] has joined #java |
[03:54]
|
| APic [APic!apic@apic.name] has joined #java |
[04:26]
|
| scottpedia [scottpedia!~black@user/scottpedia] has joined #java |
[04:33]
|
| Matthijs [Matthijs!~quassel@161.35.149.49] has joined #java |
[04:34]
|
| node1 |
okay thank you. |
[04:38]
|
| node1 |
) |
[04:38]
|
| OverCoder [OverCoder!uid55568@user/overcoder] has joined #java |
[04:43]
|
| gareppa [gareppa!~xan@user/gareppa] has joined #java |
[04:46]
|
| maryo [maryo!~Maryo@user/maryo] has joined #java |
[04:59]
|
| llanhmod [llanhmod!llanhmod@user/domhnall/x-2887755] has joined #java |
[05:00]
|
| rvalue [rvalue!~rvalue@user/rvalue] has joined #java |
[05:14]
|
| joev [joev!~joev@user/joev] has joined #java |
[06:12]
|
| joev [joev!~joev@user/joev] has joined #java |
[06:28]
|
| Matthijs [Matthijs!~quassel@161.35.149.49] has joined #java |
[06:32]
|
| TheCatCollective [TheCatCollective!NyaaTheKit@user/calculuscat] has joined #java |
[06:59]
|
| Matthijs [Matthijs!~quassel@026-237-099-087.dynamic.caiway.nl] has joined #java |
[07:24]
|
| dreamreal [dreamreal!~dreamreal@about/java/dreamreal] has joined #java |
[07:26]
|
| markong [markong!~markong@82.129.66.34] has joined #java |
[07:50]
|
| aspirin [aspirin!~aspirin@user/aspirin] has joined #java |
[08:11]
|
| jakenelson [jakenelson!~Username@82.2.21.4] has joined #java |
[08:18]
|
| jakenelson |
Hi everyone, can anyone help me fix a memory leak in my Java program? |
[08:18]
|
| dreamreal |
depends on what you mean and need |
[08:19]
|
| jakenelson |
It looks like after my scraper runs it achieves 800 per second. It then drops to 0. The memory usage creeps, then is garbage collected every 10 second or so, but increases more each time, then flatlines when the scraper drops to 0. |
[08:19]
|
| jakenelson |
I just can't figure out why |
[08:20]
|
| ernimril |
if it is a memory leak then hook up a memory profiler and find out what you are keeping in memory |
[08:20]
|
| ernimril |
profiler |
[08:20]
|
| ernimril |
A profiler is a tool to find performance bottlenecks. VisualVM is a free profiler available from <a href="https://visualvm.github.io/" target="_blank">https://visualvm.github.io/</a> (included with OpenJDK up to Java 8); JProfiler and YourKit cost money but usually have free eval periods or time-limited betas. Java Flight Recorder and Java Mission Control were recently opened sourced under OpenJDK. |
[08:20]
|
| jakenelson |
I have jprofiler and VisualVM both downloaded, the biggest class type use looks like "byte" |
[08:20]
|
| ernimril |
a common problem is failing to close streams/resources |
[08:20]
|
| jakenelson |
I think the library AsyncHttpClient is bugged out. |
[08:21]
|
| jakenelson |
It seems that the future consumer doesn't close properly |
[08:21]
|
| ernimril |
if you can calculate the retained sizes then that will probably show you the owner of the memory |
[08:21]
|
| dreamreal |
jakenelson: well, look at the LESSER quantities; if you're scraping, you probably are allocating huge byte arrays. Look at what's using those. |
[08:21]
|
| jakenelson |
dreamreal, I think it's within the httpasyncclient library. Would you mind taking a quick look? |
[08:22]
|
| dreamreal |
yes, I would |
[08:22]
|
| dreamreal |
unfortunately |
[08:22]
|
| jakenelson |
ernimril, are you free for 5 mins? |
[08:22]
|
| ernimril |
I am here trying to help, do with it what you want. |
[08:23]
|
| jakenelson |
<a href="https://imgur.com/a/E6dC2Qj" target="_blank">https://imgur.com/a/E6dC2Qj</a> |
[08:24]
|
| jakenelson |
Okay, so this is what JProfiler looks like for the program |
[08:24]
|
| ernimril |
memory usage seems to be very low, almost no gc activity... |
[08:25]
|
| jakenelson |
My apologies in the last screenshots, consumer count and maximum cocurrency were reduced very low as a comparison |
[08:25]
|
| jakenelson |
even at a low memory usage, the amoutn of objects creeps out suddenly |
[08:26]
|
| ernimril |
well, if you still think this is a memory leak the calculate the retained memory size to find the _owner_ of the memory |
[08:27]
|
| ernimril |
I have not used jprofiler in many years, so not sure where it has a button/menu item to do that |
[08:28]
|
| ernimril |
in visualvm you have such a button "Compute retained sizes" in the heapdump tab |
[08:29]
|
| ernimril |
you can also run netstat or similar to see if you have too many open sockets (as I said, failing to close streams/resources will cause memory problem) |
[08:29]
|
| jakenelson |
Trying it now |
[08:32]
|
| jakenelson |
I'll post results, thanks |
[08:32]
|
| MonsterAbyss [MonsterAbyss!~amit@gateway/tor-sasl/monsterabyss] has joined #java |
[08:33]
|
| ernimril |
jprofiler seems to have the option (as expected): <a href="https://www.yourkit.com/docs/java-profiler/2023.5/help/sizes.jsp" target="_blank">https://www.yourkit.com/docs/java-profiler/2023.5/help/sizes.jsp</a> |
[08:34]
|
| ernimril |
ernimril's title: "YourKit Java Profiler help - Shallow and retained sizes" |
[08:34]
|
| jakenelson |
ernimril Does this look at all useful? <a href="https://imgur.com/a/ZKWZ1PV" target="_blank">https://imgur.com/a/ZKWZ1PV</a> |
[08:39]
|
| jakenelson |
Sorry wrong screenshot |
[08:39]
|
| jakenelson |
<a href="https://imgur.com/a/l7ZXcP6" target="_blank">https://imgur.com/a/l7ZXcP6</a> |
[08:39]
|
| ernimril |
first seems to be a lot of threads, that looks like a thread leak |
[08:40]
|
| ernimril |
so I guess io.netty are not your classes, nor org.asynchhttpclient, so that leads to com.scrapium, why do you have 5608 handlers in memory? is that something you ought to have closed/disposed? |
[08:42]
|
| jakenelson |
And the merged references <a href="https://imgur.com/a/mg7qRSh" target="_blank">https://imgur.com/a/mg7qRSh</a> |
[08:42]
|
| ernimril |
you probably want to open the tree and see the owners so that you find _your_ classes |
[08:42]
|
| jakenelson |
handler is a future for AsyncHttpClient and overrides an abstract class |
[08:43]
|
| ernimril |
well, so far we have: 1) many threads, 2) many handlers in memory, but all I have to go on is a few images so quite hard to look around |
[08:47]
|
| GreenResponse [GreenResponse!~tomek@r-45-155-148-237.gpon.bialnet.pl] has joined #java |
[08:57]
|
| joev [joev!~joev@user/joev] has joined #java |
[09:01]
|
| wedr [wedr!~tom_mai78@pool-108-20-225-194.bstnma.fios.verizon.net] has joined #java |
[09:05]
|
| jakenelson |
ernimril it looks like there are less than 25 threads, some are timers for AsyncHttpClient, they are opened in addition to my program threads |
[09:10]
|
| jakenelson |
Which is quite a bit, but I'm assuming they are minimal |
[09:10]
|
| jakenelson |
allowing for switching |
[09:10]
|
| jakenelson |
I've viewed the whole log for 40 minutes, and it doesn't look like any threads have been blocked for a significant amount of time |
[09:10]
|
| jakenelson |
<a href="https://imgur.com/a/hyJPTjY" target="_blank">https://imgur.com/a/hyJPTjY</a> |
[09:11]
|
| jakenelson |
It's strange, but this is the new memory graph running for 40 minutes straight <a href="https://imgur.com/a/2jhORLd" target="_blank">https://imgur.com/a/2jhORLd</a> |
[09:12]
|
| ernimril |
jakenelson, so what were all the FastThreadLocalThread you did show then? |
[09:12]
|
| jakenelson |
Good point, let me check |
[09:12]
|
| ernimril |
heap memory go up and then is gc:ed every now and then, memory profile looks fine. Threads seems stable (as you say): also fine. cpu usage seems to be quite low, so io througput is probably a bit slow |
[09:13]
|
| jakenelson |
It looks like that screenshot was about references. I'm on retained references now, and don't see any still listed |
[09:14]
|
| ernimril |
all in all: seems fine, but can probably do more if you can parallelize the scraping a bit more |
[09:14]
|
| jakenelson |
However the scraper count has just dropped to 0, and the memory usage flatlined at 20% of total |
[09:14]
|
| jakenelson |
I don't see how it could be a memory leak |
[09:15]
|
| jakenelson |
<a href="https://imgur.com/a/pwWbQM0" target="_blank">https://imgur.com/a/pwWbQM0</a> |
[09:15]
|
| ernimril |
well, it is you who said "I think I have a memory leak", if you no longer think so then I am happy |
[09:16]
|
| aspirin [aspirin!~aspirin@user/aspirin] has joined #java |
[09:16]
|
| jakenelson |
I'm just lost to be completely honest |
[09:21]
|
| dreamreal |
leak of other resources? file handles, network sockets, cpu? |
[09:21]
|
| ernimril |
jakenelson, did you try netstat or similar to see if you leak sockets? |
[09:22]
|
| dreamreal |
doesn't even have to be leaks, could be contention |
[09:23]
|
| joev [joev!~joev@user/joev] has joined #java |
[09:30]
|
| acidjnk [acidjnk!~acidjnk@p200300d6e7072f30f5f19602a84c17f0.dip0.t-ipconnect.de] has joined #java |
[09:35]
|
| jakenelson |
Checking file handles and network sockets now |
[09:44]
|
| qu4nt1n [qu4nt1n!~qu4nt1n@78.198.214.34] has joined #java |
[09:44]
|
| Para |
jakenelson: Are you sure the server just isn't throttling you because you're hammering it with requests? |
[09:46]
|
| jakenelson |
The file handles and sockets don't seem to change dramatically, they drop after requests finish |
[09:53]
|
| jakenelson |
I know the server can handle it. It's httpforever.com that I'm making test requests to |
[09:54]
|
| jakenelson |
Any other suggestions? |
[09:54]
|
| jamezp [jamezp!~jamezp@redhat/jboss/jamezp] has joined #java |
[09:55]
|
| enoq [enoq!~enoq@2a05:1141:1f5:5600:b9c9:721a:599:bfe7] has joined #java |
[10:04]
|
| Matthijs [Matthijs!~quassel@161.35.149.49] has joined #java |
[10:17]
|
| qu4nt1n [qu4nt1n!~qu4nt1n@78.198.214.34] has joined #java |
[10:20]
|
| ernimril |
jakenelson, grab several stack traces when process is hanging |
[10:21]
|
| jakenelson |
ernimril, makes sense, what should I look for in it? |
[10:21]
|
| jakenelson |
I've just taken one |
[10:22]
|
| mizi [mizi!~mizi@user/mizi] has joined #java |
[10:23]
|
| qu4nt1n [qu4nt1n!~qu4nt1n@78.198.214.34] has joined #java |
[10:29]
|
| ernimril |
jakenelson, you want to take several with a few seconds time separation. That way you can see if you have threads stuck waiting for soemthing |
[10:29]
|
| ernimril |
jakenelson, how used are you to reading stack traces? |
[10:29]
|
| jakenelson |
Badly |
[10:29]
|
| ernimril |
how many threads do you see? how many are runnable? how many are waiting? how many are blocked? |
[10:30]
|
| jakenelson |
If you have any resources to learn more they would be really appreciated |
[10:31]
|
| jakenelson |
around 6 worker threads, one producer |
[10:31]
|
| ernimril |
feel free to put it in a pastebin |
[10:32]
|
| ernimril |
paste |
[10:33]
|
| ernimril |
Please paste your code and any errors online. For runnable classes, try <a href="https://ideone.com/" target="_blank">https://ideone.com/</a> . For general code and errors, use <a href="https://gist.github.com" target="_blank">https://gist.github.com</a> or <a href="https://dpaste.org/" target="_blank">https://dpaste.org/</a> |
[10:33]
|
| Iarfen [Iarfen!~Iarfen@2800:300:6f51:3380::2] has joined #java |
[10:33]
|
| jakenelson |
The heap, or the code? ernimril? |
[10:40]
|
| ernimril |
jakenelson, the stack traces |
[10:40]
|
| jakenelson |
Okay, let me wait until it crashes |
[10:40]
|
| ernimril |
crash? I heard about slowdown, but not really crash |
[10:42]
|
| cheeser |
it's a quiet quitter |
[10:42]
|
| yates_work [yates_work!~user@fv-nc-f7af8b91e1-234237-1.tingfiber.com] has joined #java |
[10:44]
|
| yates_work |
i am apparently confused about java's importing and class mechanism. |
[10:47]
|
| yates_work |
i want to use the Address type defined here: <a href="https://ghidra.re/ghidra_docs/api/ghidra/program/model/address/Address.html" target="_blank">https://ghidra.re/ghidra_docs/api/ghidra/program/model/address/Address.html</a> |
[10:47]
|
| yates_work |
however, this does not compile: <a href="https://bpa.st/OAEUC" target="_blank">https://bpa.st/OAEUC</a> |
[10:48]
|
| rvalue [rvalue!~rvalue@user/rvalue] has joined #java |
[10:48]
|
| ernimril |
yates_work, yes, there is no "getAddress" method in _your_ class |
[10:49]
|
| ernimril |
yates_work, your import also seems odd "import ghidra.program.model.address;" |
[10:49]
|
| yates_work |
<a href="https://bpa.st/VVETM" target="_blank">https://bpa.st/VVETM</a> |
[10:50]
|
| ernimril |
yates_work, you import classes or you import everything in a package (*-imports) |
[10:50]
|
| ernimril |
yates_work, there is no line 36 in your paste, but as I said: there is no getAddress method in _your_ class |
[10:51]
|
| yates_work |
then how do i access the ghidra.program.model.address's getAddress()? |
[10:52]
|
| yates_work |
(line 36 is the pastebin line 9 - i cut out some proprietary comments) |
[10:52]
|
| ernimril |
yates_work, it is an instance method, so you have to have an Address instance and call it on that one "yourAddressInstance.getAddress("whatever")" |
[10:52]
|
| yates_work |
how do i obtain an Address instance? |
[10:53]
|
| dreamreal |
yates_work: how would we know? Check the docs |
[10:53]
|
| ernimril |
yates_work, looking at the javadoc for Address there are a few static methods that seems to return Address instances. I do not know ghidra so I do not know if there are other ways |
[10:53]
|
| jakenelson |
It completely crashes |
[11:02]
|
| ernimril |
jakenelson, ok, do you get a crash stack trace? |
[11:02]
|
| jakenelson |
the memory plateaus and no new requests are made |
[11:02]
|
| jakenelson |
Still working on it, upping the thread count now |
[11:03]
|
| ernimril |
jakenelson, uhm? stopping handling connections is not the same as a crash. In my point of view a crash means that the program will exit. What is your definition of crash? |
[11:03]
|
| yates_work |
ernimril: where do you see "a few static methods that seem to return Address instances"? i am looking at the doc and so not see it. |
[11:04]
|
| ernimril |
yates_work, the max and min methods as well as the static instances NO_ADDRESS, EXT_FROM_ADDRESS |
[11:05]
|
| ernimril |
yates_work, you can click on the "Static Methods" header to filter out only the static methods you know. In this case there is two |
[11:06]
|
| jakenelson |
It doesn't crash at all, ernimril. But the requests drop to 0, this might be because there is no fillable concurrency left |
[11:06]
|
| ernimril |
jakenelson, ok, no crash, but instead stalls. Then at least we have what I thought the whole time, good |
[11:06]
|
| ernimril |
jakenelson, so grab some stack traces when it stalls/stopps |
[11:07]
|
| jakenelson |
Sure |
[11:07]
|
| jakenelson |
What do you believe the problem is? |
[11:07]
|
| yates_work |
ok thanks ernimril. i am looking. my book on java doesn't arrive til tomorrow, so i'm scrambling to fill in gaps in my knowledge. |
[11:07]
|
| ernimril |
jakenelson, to many things that could be the problem to say. You said it was a scraper, so it could be network related. It could be thread related. It could be how you deal with the result (store something in file or database) |
[11:09]
|
| ernimril |
yates_work, not sure why you need a book, the tutorials are good and online |
[11:09]
|
| yates_work |
i'm also new to the ghidra java API, so i'm doubly blind |
[11:09]
|
| yates_work |
i'm a luddite |
[11:10]
|
| yates_work |
i like hardcopy |
[11:10]
|
| dreamreal |
This is just java, not an API |
[11:10]
|
| dreamreal |
you'd have the same problem anywhere: getAddress() needs to be called in the context of an object that has that method |
[11:10]
|
| dreamreal |
Address is an interface, not an object, so... |
[11:10]
|
| qu4nt1n [qu4nt1n!~qu4nt1n@78.198.214.34] has joined #java |
[11:10]
|
| yates_work |
dreamreal: perhaps you missed my first statement: "i am apparently confused about java's importing and class mechanism." |
[11:11]
|
| yates_work |
more generally, i'm trying to understand java |
[11:12]
|
| yates_work |
i come from C++. if there is no analog, then i'm stuck |
[11:12]
|
| dreamreal |
learn to program, then, C++ was never "all that" |
[11:14]
|
| dreamreal |
but imagine that an interface is a class with nothing but pure virtuals |
[11:14]
|
| yates_work |
in C++, to create an instance of a class MyClass, you'd "MyClass* myclass = new MyClass();" |
[11:14]
|
| dreamreal |
... you wouldn't expect those calls to work |
[11:14]
|
| dreamreal |
Okay, and? |
[11:14]
|
| dreamreal |
I mean, java isn't C++, so naturally it'll have different syntax. You don't use myclass->foo() in java either. |
[11:15]
|
| yates_work |
yes, i get that. i did not know what an "interface" is until you just described it. |
[11:15]
|
| dreamreal |
yates_work: seriously, find a tutorial. If it's dead-tree, that works, too, but ... you need basic java to write java |
[11:15]
|
| dreamreal |
trying to write Java as if it were a rough C++ analog is going to be... unfortunate. |
[11:16]
|
| dreamreal |
Java doesn't reify, either, so that's a nasty surprise until you make the connection. |
[11:16]
|
| tete_ [tete_!~John@85-195-252-107.fiber7.init7.net] has joined #java |
[11:16]
|
| yates_work |
so is it a pre-requisite in this channel to KNOW JAVA COMPLETELY before asking questions? if so i'll get off. |
[11:17]
|
| tete_ |
hi, i try to package an application but it fails when i try to generate the jre with jlink. it complains about module java.rmi not found, but --list-modules shows it. |
[11:17]
|
| dreamreal |
yates_work: god no |
[11:17]
|
| dreamreal |
yates_work: but you'll do a lot better with some rudimentary and easily available knowledge, because otherweise you're asking stupid stuff the tutorial addresses in the first few pages |
[11:18]
|
| tete_ |
thats my script: <a href="https://pastebin.com/pKhNsQZJ" target="_blank">https://pastebin.com/pKhNsQZJ</a> |
[11:18]
|
| jakenelson |
ernimril, I can take a jprofiler snapshot once it levels out if you like? |
[11:18]
|
| dreamreal |
"What's the java compiler executable name?" ... I mean, you can ASK that, but ... why? It's almost literally page 1 of the tutorials, if it is NOT literally page 1 |
[11:19]
|
| jakenelson |
What can I give you that will help? |
[11:19]
|
| ernimril |
jakenelson, whatever works for you. I do not know how you run your program. I tend to just press ^\ in console to get a stack trace, but if you run remote and have a profiler, then that works fine too |
[11:19]
|
| yates_work |
i do not share your optimism about on-line tutorials, generally. i have found many to be garbage. hence my proclivity to learn from a book. |
[11:19]
|
| dreamreal |
yates_work: imagine that someone asks you constantly how many "+" signs make the postinc operator... |
[11:19]
|
| dreamreal |
yates_work: Sure. But the java tutorial is actually pretty well battle-tested. |
[11:19]
|
| jakenelson |
ernimril, it's all ready to run as soon as you start the program, just need t open the project in an ide with gradle |
[11:19]
|
| yates_work |
THE java tutorial? |
[11:19]
|
| jakenelson |
everything is in-memory |
[11:19]
|
| dreamreal |
We don't refer people to materials we don't trust, because that would only lead them to asking more poor questions |
[11:20]
|
| dreamreal |
tutorial |
[11:20]
|
| dreamreal |
The Oracle tutorial for Java is probably your best starting point, at <a href="https://docs.oracle.com/javase/tutorial" target="_blank">https://docs.oracle.com/javase/tutorial</a> (skip the NetBeans bits). An updated version of it can be found at <a href="https://dev.java/learn/" target="_blank">https://dev.java/learn/</a> . Another option: <a href="https://www.ktbyte.com/java-tutorial" target="_blank">https://www.ktbyte.com/java-tutorial</a> - <a href="https://hackr.io/tutorials/java" target="_blank">https://hackr.io/tutorials/java</a> has a list of others as well. |
[11:20]
|
| dreamreal |
^^^ THE JAVA TUTORIAL |
[11:20]
|
| jakenelson |
Should I send a GitHub link? |
[11:20]
|
| ernimril |
jakenelson, sure. I tend to make sure that I can either ^\ or "kill -QUIT <pid>" to get the stack trace on any production system I deal with |
[11:21]
|
| MonsterAbyss [MonsterAbyss!~amit@gateway/tor-sasl/monsterabyss] has joined #java |
[11:21]
|
| jakenelson |
ernimril <a href="https://github.com/Scrapium/scrape-tweets-dev-2/tree/main" target="_blank">https://github.com/Scrapium/scrape-tweets-dev-2/tree/main</a> |
[11:22]
|
| jakenelson |
jakenelson's title: "GitHub - Scrapium/scrape-tweets-dev-2: Development repo for scraping tweets and market data via RDS. Using optimisations techniques such as (Threading, asynchronous I/O, non-blocking I/O - ConcurrentLinkedQueues, and runnable tasks for mak..." |
[11:22]
|
| tete_ |
oh, i had the jmods package not installed :P |
[11:24]
|
| joev [joev!~joev@user/joev] has joined #java |
[11:24]
|
| ernimril |
jakenelson, uhm, ok, that is a bit too much for now. Looking at the source there is sql in there so as I said, the problem could be with storing the results |
[11:24]
|
| jakenelson |
Ah, it's not used at all |
[11:25]
|
| jakenelson |
Just legacy from when I added MySQL. |
[11:25]
|
| ernimril |
jakenelson, can you just pastebin a full thread stack dump when it hangs? |
[11:25]
|
| jakenelson |
Nothing is needed but the dependencies |
[11:25]
|
| dreamreal |
jakenelson: this is why I backed out early - performance problems tend to be a rat's nest of issues, and they require painstaking analysis if they'r enot glaringly obvious |
[11:26]
|
| jakenelson |
Ah damn |
[11:26]
|
| jakenelson |
Okay, program has just crashed, 0 requests per second |
[11:27]
|
| jakenelson |
"crashed" |
[11:27]
|
| ernimril |
jakenelson, great, now grab a full thread dump and put it in a pastebin |
[11:28]
|
| jakenelson |
I've got it in hprof format |
[11:28]
|
| ernimril |
hprof is for memory dumps, not stack dumps |
[11:29]
|
| yates_work |
dreamreal: you're information is good, but you are a bit "black-and-white." |
[11:29]
|
| ernimril |
paste |
[11:29]
|
| ernimril |
Please paste your code and any errors online. For runnable classes, try <a href="https://ideone.com/" target="_blank">https://ideone.com/</a> . For general code and errors, use <a href="https://gist.github.com" target="_blank">https://gist.github.com</a> or <a href="https://dpaste.org/" target="_blank">https://dpaste.org/</a> |
[11:29]
|
| yates_work |
s/you're/your/ |
[11:29]
|
| jakenelson |
"Stack dumps, however, are not explicitly handled by JProfiler as it is more oriented towards dynamic profiling rather than static snapshots of thread states. " |
[11:30]
|
| jakenelson |
Because it hasn't technically crashed, I don't have one |
[11:30]
|
| dreamreal |
yates_work: how do you mean? |
[11:31]
|
| ernimril |
jakenelson, a full thread stack dump looks like: <a href="https://dpaste.org/9CtV6" target="_blank">https://dpaste.org/9CtV6</a> |
[11:31]
|
| ernimril |
ernimril's title: "dpaste/9CtV6 (Plain Text)" |
[11:31]
|
| jakenelson |
I know, this will sound stupid, but how do I create one. The code hasn't technically crashed |
[11:32]
|
| jakenelson |
Ohh just control c |
[11:32]
|
| ernimril |
jakenelson, how do you start your program? do you run it from a terminal? |
[11:32]
|
| jakenelson |
Haha, sorry yep |
[11:32]
|
| jakenelson |
I'm being stupid |
[11:32]
|
| ernimril |
jakenelson, windows or linux? |
[11:32]
|
| jakenelson |
Damn, the scroll back isn't big enough |
[11:33]
|
| dreamreal |
logs |
[11:34]
|
| dreamreal |
channel logs can be found at <a href="https://javabot.evanchooly.com/" target="_blank">https://javabot.evanchooly.com/</a> (Select the channel from the list on the left-hand side.) |
[11:34]
|
| jakenelson |
ubuntu 22.04 ssh / windows |
[11:34]
|
| ernimril |
jakenelson, if you have the terminal window open you press C-\ (or ^\ or Ctrl+\ depending on how you are used to reading that). On windows systems you press Ctrl+[break] (the break key is typically on the upper right part of the keyboard) |
[11:34]
|
| jakenelson |
Yup, but the scroll history isn't long enough |
[11:34]
|
| jakenelson |
I only have a snippet. I can run it again and wait till a crash + a pipe operator to a file? |
[11:34]
|
| ernimril |
jakenelson, if you have a gnome terminal you can configure the scrollback buffer length in the application properties |
[11:35]
|
| jakenelson |
Ah sadly not, I'm on windows. I will try my method with a pipe |
[11:35]
|
| ernimril |
jakenelson, you can just reconfigure it and grab a new stack trace |
[11:35]
|
| avu |
if increasing the scrollback size in your terminal emulator is not an option, you could pipe the output to tee to get it into a file as well as onto STDOUT. Or pipe it to a pager like less. Or start it in something like tmux to use its output buffer instead. |
[11:36]
|
| ernimril |
jakenelson, ok, yeah, ok, then you probably have to restart. You can probably start your program with a tee to have output in file and console |
[11:36]
|
| jakenelson |
Yup, that's what I'm about to do |
[11:36]
|
| jakenelson |
it looks like jvisualvm has a lot more features. |
[11:36]
|
| ernimril |
jakenelson, you can attach with jcmd or similar as well |
[11:37]
|
| MonsterAbyss [MonsterAbyss!~amit@gateway/tor-sasl/monsterabyss] has joined #java |
[11:46]
|
| ivdsangen [ivdsangen!~ivo@86-95-161-96.fixed.kpn.net] has joined #java |
[11:48]
|
| mixfix41 [mixfix41!~sdeny9ee@user/mixfix41] has joined #java |
[11:49]
|
| jakenelson |
Sorry ernimril nearly there, going to attach jstack instead. I think it's having a hard time as there are multiple threads. |
[11:51]
|
| ernimril |
jakenelson, the reason I prefer the raw output is that several tools miss some parts of the data (monitor locks or thread status or similar) |
[11:54]
|
| jakenelson |
Okay, so how do I pipe all output including errors into a file? |
[11:54]
|
| ernimril |
java -jar your.jar | tee /tmp/output.txt |
[11:55]
|
| ernimril |
or just redirect "java -jar your.jar > /tmp/output.txt" |
[11:55]
|
| jakenelson |
Got it, seems to be working, trying again with a full stack trace |
[11:59]
|
| joev [joev!~joev@user/joev] has joined #java |
[12:06]
|
| junyx [junyx!~junyx@user/junyx] has joined #java |
[12:07]
|
| _ht [_ht!~Thunderbi@28-52-174-82.ftth.glasoperator.nl] has joined #java |
[12:22]
|
| jakenelson |
Hi ernimril, just checking whether you're still there. I've restared the VM, and it's been running for 29 minutes without a crash. Maybe this is part of the cause |
[12:30]
|
| ernimril |
I am here on and off. I have a large scrollback buffer though and the channel is logged :-) |
[12:36]
|
| ernimril |
jakenelson, for now I will be away eating a bit |
[12:37]
|
| jakenelson |
ernimril okay, stack trace it ready |
[12:38]
|
| jakenelson |
ernimril <a href="https://dpaste.org/2p0M4" target="_blank">https://dpaste.org/2p0M4</a> |
[12:39]
|
| jakenelson |
jakenelson's title: "dpaste/2p0M4 (Plain Text)" |
[12:39]
|
| jakenelson |
in a bit |
[12:39]
|
| metalmaniac [metalmaniac!~metalmani@user/metalmaniac] has joined #java |
[12:41]
|
| ernimril |
jakenelson, seems like almost all your threads are AsyncHttpClient-X-Y and waiting for select to return something. So you are waiting for network data to come in |
[12:43]
|
| jakenelson |
correct |
[12:43]
|
| ernimril |
jakenelson, it is a bit odd, normally you use _one_ selector to wait for traffic on multiple sockets, you (or asynchttpclient) seem to use one selector per thread |
[12:43]
|
| jakenelson |
Is there a solution, async means it's the odd can hang until data is received and compute other tasks |
[12:44]
|
| jakenelson |
So the code has multiple processes, which each create 100s of asynchronous requests separately |
[12:44]
|
| ernimril |
jakenelson, I do not know the libraries you use so hard to recommend anything about it |
[12:45]
|
| ernimril |
guess you will have to check the code you have and see what you can come up with. Try talking to a senior developer who wrote the code or something |
[12:46]
|
| jakenelson |
the library is a public github repo designed for performance |
[12:46]
|
| jakenelson |
If I try a different request library it may be slower, but more stable, I will give it a shot. |
[12:46]
|
| jakenelson |
So you believe the issues are from their code? |
[12:47]
|
| ernimril |
uhm? what library do you mean here? the scraper or the asynchttpclient? |
[12:47]
|
| ernimril |
I would guess that the http handling is fine, but that maybe you are using it wrong, but again I do not know that http library so hard for me to say |
[12:47]
|
| ernimril |
and to be clear: my guess will always start with the problem being in the code you wrote, not the underlying libraries you use |
[12:48]
|
| ernimril |
but there will of course be times when the problem is not in your code, it is just that that is rare |
[12:49]
|
| jakenelson |
I'm talking about the AsyncHttpClient library <a href="https://github.com/AsyncHttpClient/async-http-client/issues" target="_blank">https://github.com/AsyncHttpClient/async-http-client/issues</a> |
[12:53]
|
| jakenelson |
jakenelson's title: "Issues · AsyncHttpClient/async-http-client · GitHub" |
[12:53]
|
| jakenelson |
To be honest, the documentation is lacking |
[12:54]
|
| ernimril |
well, with modern java I would use the http client that is part of the api, but you use whatever fits your program |
[12:56]
|
| ernimril |
see java.net.http.HttpClient if you want to check it out, it can be used both blocking and asynch |
[12:58]
|
| magla [magla!~gelignite@62.27.193.118] has joined #java |
[01:00]
|
| Betal [Betal!~Betal@user/betal] has joined #java |
[01:02]
|
| dreamreal |
hey, java's back on slashdot: <a href="https://developers.slashdot.org/story/23/06/26/018234/34-of-ap-cs-students-couldnt-solve-this-java-based-2d-array-question" target="_blank">https://developers.slashdot.org/story/23/06/26/018234/34-of-ap-cs-students-couldnt-solve-this-java-based-2d-array-question</a> |
[01:06]
|
| Para |
It's the last question of a 1,5 hour exam - maybe people just ran out of time? |
[01:12]
|
| dreamreal |
based on the question, I sure hope so |
[01:32]
|
| dreamreal |
although using arrays for that seems ... cruel |
[01:32]
|
| peas [peas!~peasfulto@user/PeasfulTown] has joined #java |
[01:35]
|
| slidercrank [slidercrank!~slidercra@user/slidercrank] has joined #java |
[01:45]
|
| LtHummus [LtHummus!~lthummus@user/LtHummus] has joined #java |
[01:47]
|
| enoq [enoq!~enoq@194-208-133-121.lampert.tv] has joined #java |
[01:53]
|
| Iarfen [Iarfen!~Iarfen@2800:300:6f51:3380::2] has joined #java |
[01:55]
|
| joev [joev!~joev@user/joev] has joined #java |
[01:59]
|
| LtHummus [LtHummus!~lthummus@user/LtHummus] has joined #java |
[02:01]
|
| joev [joev!~joev@user/joev] has joined #java |
[02:07]
|
| aspirin [aspirin!~aspirin@user/aspirin] has joined #java |
[02:27]
|
| DoofusCanadensis [DoofusCanadensis!~DoofusCan@66.244.246.98] has joined #java |
[02:31]
|
| tang^ [tang^!~DoofusCan@66.244.246.98] has joined #java |
[02:35]
|
| junyx [junyx!~junyx@user/junyx] has joined #java |
[02:43]
|
| dreamreal [dreamreal!~dreamreal@about/java/dreamreal] has joined #java |
[02:44]
|
| qu4nt1n [qu4nt1n!~qu4nt1n@78.198.214.34] has joined #java |
[02:45]
|
| Iarfen [Iarfen!~Iarfen@2800:300:6f51:3380::2] has joined #java |
[02:49]
|
| OverCoder [OverCoder!uid55568@user/overcoder] has joined #java |
[02:51]
|
| s747lc [s747lc!~s747lc@user/s747lc] has joined #java |
[02:52]
|
| llanhmod [llanhmod!llanhmod@user/domhnall/x-2887755] has joined #java |
[02:57]
|
| boB_K7IQ [boB_K7IQ!~boB_K7IQ@152.44.147.180] has joined #java |
[03:00]
|
| mizi [mizi!~mizi@user/mizi] has joined #java |
[03:09]
|
| WAR10CK [WAR10CK!~WAR10CK@14.223.183.107] has joined #java |
[03:15]
|
| natewrench [natewrench!~josh@user/natewrench] has joined #java |
[03:16]
|
| natewrench [natewrench!~josh@user/natewrench] has joined #java |
[03:18]
|
| Iarfen [Iarfen!~Iarfen@2800:300:6f51:3380::2] has joined #java |
[03:30]
|
| junyx [junyx!~junyx@user/junyx] has joined #java |
[03:57]
|
| whaley [whaley!~whaley@2603-6080-a301-33d1-60a6-fbbd-ce9b-845e.res6.spectrum.com] has joined #java |
[04:02]
|
| mwnaylor [mwnaylor!~user@2601:5ce:4300:9700::7c34] has joined #java |
[04:22]
|
| node1 [node1!~bipul@user/node1] has joined #java |
[04:27]
|
| node1 |
Hello |
[04:27]
|
| node1 |
Can bidirectional communication be achieved between a Java method called in a C program using JNI? |
[04:27]
|
| cheeser |
you pass things to methods which return a thing |
[04:28]
|
| dreamreal |
depends on what you mean, but ^^ |
[04:28]
|
| cheeser |
that call in to JNI is blocking until the native function returns |
[04:28]
|
| node1 |
Is it possible to use a method from a Java class, such as "foo.java" having method let say bar() , in a C program? |
[04:30]
|
| cheeser |
are you asking if you can call a java method from a C function? |
[04:30]
|
| cheeser |
if so, yes. |
[04:30]
|
| node1 |
yes. |
[04:30]
|
| node1 |
How? |
[04:30]
|
| cheeser |
¯\_(?)_/¯ |
[04:31]
|
| cheeser |
i don't do jni |
[04:31]
|
| dreamreal |
found via google: <a href="https://stackoverflow.com/questions/28042285/calling-a-java-method-from-the-native-code-using-jni" target="_blank">https://stackoverflow.com/questions/28042285/calling-a-java-method-from-the-native-code-using-jni</a> |
[04:31]
|
| dreamreal |
the google query: how to call a java method from a jni function |
[04:31]
|
| cheeser |
what? you can search for things now? when did that happen? |
[04:32]
|
| dreamreal |
it's crazy, you think "what's my question, exactly? 'how do i call a java method from a jni function'? LET ME TYPE THAT IN..." |
[04:32]
|
| cheeser |
intriguing. that's gonna take off. i just know it. |
[04:33]
|
| node1 |
I see he has used native keyword in the foo.java program |
[04:33]
|
| cheeser |
that's pretty common in JNI scenarios. |
[04:33]
|
| dreamreal |
that would be how to create a handle for the JNI function dispatch... |
[04:33]
|
| node1 |
maybe that's the problem i though getting native into python required native keyword. |
[04:34]
|
| node1 |
maybe that's the problem i though getting native code to Java required native keyword.* |
[04:35]
|
| dreamreal |
native to java does not |
[04:35]
|
| node1 |
sorry i am out of sense |
[04:35]
|
| dreamreal |
java to C does |
[04:35]
|
| whaley [whaley!~whaley@2603-6080-a301-33d1-60a6-fbbd-ce9b-845e.res6.spectrum.com] has joined #java |
[04:35]
|
| node1 |
I guess the word native implied to executable file written in low language. And these native keyword meant for this purpose only |
[04:36]
|
| dreamreal |
in that SO page, nativecall() is a C function. So to call it *from java* means that you need "native void nativecall();" |
[04:36]
|
| node1 |
ok |
[04:37]
|
| dreamreal |
to call callback() *from JNI* (i.e., from nativecall()) all you'd need is the env pointer, through which y ou can get the method id, which you can call with (*env)->Call____Method() |
[04:37]
|
| node1 |
ok |
[04:38]
|
| Techcable [Techcable!~Techcable@user/Techcable] has joined #java |
[04:40]
|
| bookman_ [bookman_!~WAR10CK@183.27.233.190] has joined #java |
[04:41]
|
| peas [peas!~peasfulto@user/PeasfulTown] has joined #java |
[04:51]
|
| joev [joev!~joev@user/joev] has joined #java |
[04:53]
|
| node1 |
dreamreal, I was trying to do this <a href="https://pastebin.com/raw/vyQz4w6v" target="_blank">https://pastebin.com/raw/vyQz4w6v</a> |
[04:54]
|
| ernimril |
node1, ok, what happens when you run that? |
[04:56]
|
| node1 |
Core dump error |
[04:56]
|
| ernimril |
node1, so debug it and see where it crashes |
[04:57]
|
| node1 |
<a href="https://pastebin.com/raw/UJCBxwNH" target="_blank">https://pastebin.com/raw/UJCBxwNH</a> |
[04:57]
|
| ernimril |
that link is a 404 |
[04:57]
|
| dreamreal |
you do realize that starting a JVM from C is nontrivial, too |
[04:58]
|
| node1 |
yes it's complicated. |
[04:59]
|
| ernimril |
node1, on what line does it crash? |
[05:00]
|
| node1 |
Maybe tomorrow will use to find inside gdb |
[05:00]
|
| node1 |
i have the log file generated |
[05:00]
|
| node1 |
let me pastebin |
[05:00]
|
| ernimril |
well, running your program in gdb or some other debugger will take a whole of 3 minutes? |
[05:01]
|
| dreamreal |
ddd > gdb (it wraps gdb in such a way that the UX is sane) |
[05:03]
|
| ernimril |
perhaps, I have not done C/C++ in many years so not sure what I would use today. I used to run gdb inside emacs when I did C and jni though, seemed to work fine |
[05:04]
|
| dreamreal |
it wqorks. it's a pain to use compared to ddd. |
[05:04]
|
| joev [joev!~joev@user/joev] has joined #java |
[05:18]
|
| peas [peas!~peasfulto@user/PeasfulTown] has joined #java |
[05:26]
|
| veegee [veegee!~veegee@ipagstaticip-469c2903-2b07-6dc3-3bc2-98748da5ca77.sdsl.bell.ca] has joined #java |
[05:34]
|
| llanhmod parted the channel: |
[06:02]
|
| Henryx [Henryx!~ebianchi@94.198.98.141] has joined #java |
[06:13]
|
| llanhmod [llanhmod!llanhmod@user/domhnall/x-2887755] has joined #java |
[06:20]
|
| Square3 [Square3!~Square4@user/square] has joined #java |
[06:29]
|
| natewrench [natewrench!~josh@user/natewrench] has joined #java |
[06:43]
|
| markong [markong!~markong@82.129.66.34] has joined #java |
[06:43]
|
| llanhmod [llanhmod!llanhmod@user/domhnall/x-2887755] has joined #java |
[06:44]
|
| dreamreal [dreamreal!~dreamreal@about/java/dreamreal] has joined #java |
[06:59]
|
| yates_work |
i noticed that if i "import ghidra.program.model.address;", the type "Address" is not recognized. however if i "import ghidra.program.model.address.Address;", it is. what is the difference between these? |
[06:59]
|
| ernimril |
imports |
[07:00]
|
| ernimril |
importing is the process of flattening namespaces in Java, *not* like other language's "include" features. think of imports as a namespace trouser press, allowing you to use shorthand class names instead of fully-qualified ones. <a href="http://download.oracle.com/javase/tutorial/java/package/usepkgs.html" target="_blank">http://download.oracle.com/javase/tutorial/java/package/usepkgs.html</a> |
[07:00]
|
| ernimril |
yates_work, ^^^ read that |
[07:00]
|
| Tenchi[m] [Tenchi[m]!~tenchim]@2001:470:69fc:105::f42] has joined #java |
[07:00]
|
| yates_work |
ok |
[07:00]
|
| ernimril |
yates_work, you can import all types in a package with a *.import: "import foo.bar.*;" |
[07:01]
|
| ernimril |
yates_work, now, most here will say that you do not want to do that, you want to import the types you care about, but it is still an option |
[07:01]
|
| yates_work |
aha. so "import ghidra.program.model.address.Address;" is specifying that the Address type in the ghidra.program.mode.address class can be used directly. |
[07:02]
|
| marcel7717223249 [marcel7717223249!~marcel@user/marcel] has joined #java |
[07:02]
|
| yates_work |
..and hopefully it doesn't collide with a preexisting definition of the same type.. |
[07:04]
|
| yates_work |
so i COULD also declare tblBase as "ghidra.program.model.address.Address tblBase = parseAddress("0x42902e40");"? |
[07:05]
|
| ernimril |
yates_work, imports make it possible to use the short name ("Foo") for the type, yes. The class files will always have the fully qualified type name ("some.package.Foo") and you can always use the FQN if you want or need |
[07:06]
|
| ernimril |
if you use both java.awt.List and java.util.List for example, you can only import one of them and will be forced to use the FQN for the other |
[07:07]
|
| ernimril |
it is rare to have to though |
[07:07]
|
| dreamreal [dreamreal!~dreamreal@about/java/dreamreal] has joined #java |
[07:07]
|
| yates_work |
ernimril: right, but it is legal |
[07:08]
|
| yates_work |
where are tye types defined in this package? <a href="https://ghidra.re/ghidra_docs/api/ghidra/program/model/address/package-summary.html" target="_blank">https://ghidra.re/ghidra_docs/api/ghidra/program/model/address/package-summary.html</a> |
[07:08]
|
| yates_work |
yates_work's title: "ghidra.program.model.address" |
[07:08]
|
| yates_work |
doesn't an "interface" consiste of both methods and types? |
[07:09]
|
| yates_work |
consist |
[07:09]
|
| ernimril |
yates_work, the types are the classes, the interfaces, the enums, the records, the annotations, the exceptions |
[07:09]
|
| ernimril |
yates_work, this package seems to have only classes, interfaces and exceptions though |
[07:09]
|
| yates_work |
so in java, all types other than the primitive types are classes? |
[07:11]
|
| yates_work |
or rather, all types other than the primitive types are interfaces? |
[07:14]
|
| ernimril |
no |
[07:14]
|
| ernimril |
primitives are just that. The rest are complex types or containers of methods and fields |
[07:15]
|
| ernimril |
you do realize that a lot of your confusion could be fixed by actually spending _one_ hour doing the online java tutorial. It does explain what types and primities are, it explains interfaces and enums and other things as well |
[07:16]
|
| ernimril |
it is indexed so you can pick the tracks you want to learn more about |
[07:16]
|
| ernimril |
but whatever I will go sleep now, good luck with gidhra |
[07:16]
|
| yates_work |
i have read <a href="https://docs.oracle.com/javase/tutorial/java/concepts/interface.html" target="_blank">https://docs.oracle.com/javase/tutorial/java/concepts/interface.html</a> at least twice. |
[07:18]
|
| yates_work |
yates_work's title: "What Is an Interface? (The Java? Tutorials > Learning the Java Language > Object-Oriented Programming Concepts)" |
[07:18]
|
| yates_work |
i don't see how a "type" (i.e., "Address") can be an interface. |
[07:19]
|
| dreamreal [dreamreal!~dreamreal@about/java/dreamreal] has joined #java |
[07:21]
|
| yates_work |
ok i think i do now. |
[07:24]
|
| yates_work |
terminology. |
[07:24]
|
| yates_work |
an interface IS essentially a class. it is evidently equivalent to C++'s abstract base class. and class's define types |
[07:26]
|
| jmdaemon [jmdaemon!~jmdaemon@user/jmdaemon] has joined #java |
[07:27]
|
| creechy |
java has abstract classes too, which are different than interfaces. |
[07:30]
|
| yates_work |
creechy: ok, thanks for the heads up |
[07:32]
|
| yates_work |
it seems to me the term "interface" is ambiguous. A "simple" class declaration (e.g., without a "implements SomeInterface") can define methods. those methods are indeed an "itnerface" to the class. |
[07:33]
|
| yates_work |
so what's the difference? |
[07:33]
|
| yates_work |
this is in the tutorial: <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/classdecl.html" target="_blank">https://docs.oracle.com/javase/tutorial/java/javaOO/classdecl.html</a> |
[07:34]
|
| yates_work |
yates_work's title: "Declaring Classes (The Java? Tutorials > Learning the Java Language > Classes and Objects)" |
[07:34]
|
| dreamreal [dreamreal!~dreamreal@about/java/dreamreal] has joined #java |
[07:41]
|
| creechy |
yates_work, as Java defines it, the term "interface" is *not* ambiguous. Its a specific construct that allows you to define method signatures which any class that implements the interface must "implement" (write the concrete implementation for). |
[07:44]
|
| yates_work |
that statement is assuming there is some inheritance involved. if you have a very simple class with no derived classes, then the methods are directly the interface, no? |
[07:48]
|
| yates_work |
it's ok, i can deal with it. i'm just trying to get my mind around the semantics and definitions. |
[07:51]
|
| Square [Square!~Square4@user/square] has joined #java |
[08:10]
|
| Square |
Looking at java.time.DateTimeFormatter doesn't list a time format that contains zone wo current offset to UTC. |
[08:11]
|
| Square |
Shouldn't current diff be resolved from time + zoneId |
[08:12]
|
| Bebef [Bebef!sbreit@phobos.bebef.de] has joined #java |
[08:12]
|
| creechy |
Square, looks like "z" contains the zone w/o offset, ya? |
[08:14]
|
| dreamreal [dreamreal!~dreamreal@about/java/dreamreal] has joined #java |
[08:15]
|
| Square |
creechy, you mean if you roll your own format? |
[08:16]
|
| creechy |
Square, what are you looking for? Are you asking for a "standard" format that does or does/not contain offset? |
[08:18]
|
| Square |
creechy, yeah |
[08:20]
|
| creechy |
Ah, I was looking at SimpleDateFormat, which does provide a "z" pattern. |
[08:20]
|
| creechy |
Square, I'm not that familiar with the ISO/RFC standards but it does appear they all have an offset. |
[08:25]
|
| dostoyevsky2 [dostoyevsky2!~sck@user/dostoyevsky2] has joined #java |
[08:26]
|
| random-jellyfish [random-jellyfish!~random-je@user/random-jellyfish] has joined #java |
[08:33]
|
| peas [peas!~peasfulto@user/PeasfulTown] has joined #java |
[08:47]
|
| junyx [junyx!~junyx@user/junyx] has joined #java |
[08:56]
|
| Laborratte5 [Laborratte5!~Laborratt@p508e5dc5.dip0.t-ipconnect.de] has joined #java |
[09:11]
|
| WAR10CK [WAR10CK!~WAR10CK@183.27.233.250] has joined #java |
[09:11]
|
| victori [victori!~victori@139.68.213.149] has joined #java |
[09:21]
|
| lockdown [lockdown!~lockdown@user/lockdown] has joined #java |
[09:31]
|
| jamezp [jamezp!~jamezp@redhat/jboss/jamezp] has joined #java |
[09:41]
|
| Bahhumbug [Bahhumbug!jrd@libera/staff/jrd] has joined #java |
[10:07]
|
| joev [joev!~joev@user/joev] has joined #java |
[10:21]
|
| nsaunders [nsaunders!~nicholas@172.103.152.184] has joined #java |
[10:34]
|
| boB_K7IQ [boB_K7IQ!~boB_K7IQ@c-71-231-175-1.hsd1.wa.comcast.net] has joined #java |
[10:38]
|
| wedr |
Does anyone know a bit of SAML 2.0 single sign on? If so, could someone explain to me what Step 3 is all about? Like, do I need to send a POST request with a body/payload to the single logout (SLO) URL? <a href="https://docs.spring.io/spring-security/reference/servlet/saml2/logout.html#_runtime_expectations" target="_blank">https://docs.spring.io/spring-security/reference/servlet/saml2/logout.html#_runtime_expectations</a> |
[10:51]
|
| wedr |
wedr's title: "Performing Single Logout :: Spring Security" |
[10:51]
|
| LtHummus [LtHummus!~lthummus@user/LtHummus] has joined #java |
[11:00]
|
| yates_work |
does java have a "this" pointer? |
[11:03]
|
| wedr |
There is a "this" keyword |
[11:03]
|
| wedr |
"this" references the current class object the code execution pointer is at. |
[11:03]
|
| yates_work |
wedr: ok thanks. |
[11:04]
|
| wedr |
You typically see it being used like: this.myClassMemberVariable = localVariable; |
[11:04]
|
| yates_work |
right! |
[11:04]
|
| yates_work |
is there no way to declare aother class BClass in a file AClass.java? |
[11:08]
|
| yates_work |
(in addition to AClass?) |
[11:09]
|
| llanhmod |
sounds like a package |
[11:11]
|
| wedr |
yates_work, you can, but it will be a deep rabbit hole. I discourage you for now. |
[11:13]
|
| yates_work |
i like to live dangerously.. |
[11:22]
|
| joev [joev!~joev@user/joev] has joined #java |
[11:27]
|
| joev [joev!~joev@user/joev] has joined #java |
[11:36]
|
| cheeser |
nested classes |
[11:39]
|
| cheeser |
nested classes are classes that are members of other classes. They come in two flavors - "static nested classes" and "inner classes". The latter requires a reference to the outer class to work. See <a href="http://is.gd/kaM0" target="_blank">http://is.gd/kaM0</a> [sun.com] for more info. |
[11:39]
|
| cheeser |
inner classes |
[11:40]
|
| cheeser |
inner classes are nested classes which aren't static. See "~nested classes" and the inner classes tutorial at <a href="http://bit.ly/cG3W4q" target="_blank">http://bit.ly/cG3W4q</a> [oracle.com] for more information. |
[11:40]
|
| yates_work |
i am passing the value 0x100 to a method parameter of short, but i'm getting "ndexToStringId.java:55: error: incompatible types: possible lossy conversion from int to short |
[11:40]
|
| yates_work |
tableStringId[1] = new TableStringId(0x429024e0, 0x100, "A70259");" |
[11:40]
|
| cheeser |
0x100 is an int |
[11:41]
|
| yates_work |
the error is indicating the 0x100 is the problem |
[11:41]
|
| cheeser |
why are you using hex notation? |
[11:41]
|
| yates_work |
why not? |
[11:41]
|
| yates_work |
but right you are |
[11:41]
|
| cheeser |
because unless you're doing bit masking is pointless douchebaggery in code form |
[11:41]
|
| yates_work |
thanks for your opinion. |
[11:42]
|
| yates_work |
been programming for 40+ years and never heard hex being questioned. |
[11:42]
|
| cheeser |
how is 0x429024e0 any better than 1116742880 ? |
[11:42]
|
| cheeser |
or 0x100 better than 256? |
[11:43]
|
| yates_work |
i have good reason. |
[11:43]
|
| cheeser |
decimal numbers are more semantically meaningful to humans than hex numbers typically are. |
[11:43]
|
| cheeser |
outside of bit patterns i've never found using hex numbers in source to useful in any meaningful sense. |
[11:44]
|
| cheeser |
anyway. it's your code i should shut the fuck up. :) |
[11:45]
|
| yates_work |
why is everyone focused on subjective opinions? it wastes eveyrone's time. |
[11:45]
|
| cheeser |
all opinions are subjective. :) |
[11:46]
|
| yates_work |
cheeser: i am working in the reverse engineering field. i am using tools like ghidra and idapro, both of which report addresses and other inforamtion using hex. |
[11:46]
|
| cheeser |
ugh. |
[11:46]
|
| yates_work |
how many weeks have you been programming? |
[11:46]
|
| cheeser |
3 |
[11:47]
|
| cheeser |
but i just got past BASIC |
[11:47]
|
| yates_work |
evidently |
[11:47]
|
| cheeser |
don't make too many assumptions there. |
[11:47]
|
| yates_work |
insane. |
[11:49]
|
| yates_work |
people are actually going insane. this is incredible. |
[11:49]
|
| yates_work |
but thanks anyway for the correction (re: int) |
[11:52]
|
| cheeser |
all fixed point literals are ints and floating point literals are doubles. |
[11:53]
|
| cheeser |
you can coerce the type (42L is a long and 42.0f is a float) or cast it to the type you want (long)42 |
[11:53]
|
| yates_work |
ah. |
[11:54]
|
| yates_work |
thanks for that. |
[11:54]
|
| cheeser |
and the results of mathematical operations tend to follow the same rules as well. |
[11:54]
|
| cheeser |
so a byte + byte == int |
[11:54]
|
| cheeser |
e.g. |
[11:54]
|
| yates_work |
by "literal" you mean something like 0x100? |
[11:55]
|
| cheeser |
exactly |
[11:55]
|
| cheeser |
in your case you'd have to cast |
[11:55]
|
| yates_work |
right |
[11:55]
|
| qu4nt1n [qu4nt1n!~qu4nt1n@78.198.214.34] has joined #java |
[11:57]
|
| yates_work |
you assume i'm human. :) |
[11:58]
|
| cheeser |
<kratos>i leave such questions to the gods.</kratos> |
[11:59]
|