Win a copy of Emmy in the Key of Code this week in the General Computing forum!

Kristina Hansen

Ranch Foreman
+ Follow
since Oct 16, 2019
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kristina Hansen

The exceptions says that "Q3'19" is not a valid representation for a number.
Why you even want to convert it into a number in the first place? You deal with a point in time - wich is commonly known as a date - so converting it into a date might be a better solution.
1 week ago
According to doc:

The following will accumulate strings into an ArrayList:

    List<String> asList = stringStream.collect(Collectors.toList());

1 week ago
If a device has an ethernet port chances are that you can communicate with it over some protocol - consult the manual how to do so.
For any other types of connections (serial or usb - or maybe even some more exotic) it may not be so easy as some additional drivers are needed, and some libs to enable Java to use these ports if you run it on Windows (Linux has the advantage that mostly anything can be mapped to a "file" wich then Java can read from and write to - the low-level stuff is done by the kernel drivers).
As this seem to be very device specific good starting point would be to consult the manual or contact the vendor for how to communicate with the device from your pc.
That's why it's recommended to always use parentehsis even for single statement blocks. Have a look:


When one stick to the second exampmle it becomes way,less frequent to make this typo. Reason might be mzscle memory: The first way is like a method call so muscle memory makes ; by itself - the other is like a method header wich muscle memory doesn't hit ; - at least for me it's this way.
2 weeks ago
I don't know if it was already mentioned in the linked thread, but as it wasn't mentioned here:

Don't use if(bool==true/false). It's error prone and hard to debug. Use this instead:
Also: it's recommended to always use parenthesis, regardless if it's just a single statement. This sure doesn't help when putting a ; after a one liner like if, for, while, but it makes it easier to read and understand and therefore to spot this mistake.

2 weeks ago
Maybe I didn't got the overall background - but sharing private keys sounds a very bad idea.
Private keys should, as thier name implies, be kept private to the one created them and never shared. When you want to use a-symmetric cryptography as some way of authentication or to exchange data, you should do it the PKI way: each party creates a key pair, let a trusted third party cofirm that a public key belongs to it's creator by issue a certificate and use these certificates to exchange a pre-master secret of wich the derived master secret then be used to exchange data securely.
Sharing private keys always comes with the negative that each signature is already broken and each crypto can be decrypted - that's not what a-symmetric crypto should used for.
Also: distributing encypted data along with the key is the same as distribute the data in plain.

I guess I really don't get what OP's asking - maybe OP / someone can lighten me up?
2 weeks ago
Well, although accessing your config via Fila, it might be better to use getResource / getResourceAsStream.
Reason: Your IDE splits the real paths into a few logical ones.
Your source is in src, your compiled classes in bin. To work, your IDE sets the classpath to the bin directory so anything gets resolved with this as root. In addition, to access your resources, the rsc / resource directory gets added to the classpath so it can also be accessed when seen as root for your resources. So, when you have your configfile in rsc/ you can load it by access getResourceAsStream("/").
2 weeks ago
The output is correct. In your example there are in fact no differences.
A good idea to understand basics and understand why it might be wrong is to use a piece of paper and a pen and unroll the loop by hand.
Why do you think what you get is wrong and what should be correct according to your knowledge?
Hint: read up what post-increment/-decrement really does.
3 weeks ago
Well, I have to admit this is my limit. Now you need help from someone familiar with sping. I've hoped to see more from the code, but as it's all that framework magic happen in the background controlled by this xml, wich is as to the tutorial, there's not much to see what's failing why.
I can only asume that either something is wrong with your xml config here: or with the key material you try to use.
Sadly, the exception "Null or emptry transform" isn't helpful - but that's fault of the dev written that cipher implementation.
As you postet, this exception is thrown in an if-else statement. So, one could look what's that if looking for and why it evals to false. Maybe this could give a clue if and what input parameter is wrong or missing.
Sorry, but I can't help you anymore on this topic - that's for someone knowing the framework you use. Just wait until hopefully someone comes around.

3 weeks ago
These are helpful. The following is just a wild guess by how application servers work and based on name:

Why these two lines?
All that comes before it (below) is just the invocation by the client thread, all that comes after it (above) is the framework and some XML stuff ("marshal" mostly has some to do with XML).
Also, as .MK is the TLD for North Macedonia it fits your name.

So suspect the two classes


are part of the servlet executed on the application server when access some URL poiting to it. So, somewhat in those two classes may have to do with the exception.

Also: As the overall exception says that some Cipher specific is missing, it could be likely that you miss some dependency library or have a wrong version of it.

So, to try to get further, have a look at the two classes and thier depencies. This way you should be able to figure out, if it's some missing dependency, a version conflict, or just some wrong usage. It could also be an issue with the XML policy file you posted earlier. Maybe try consider consult the manual of the used library how to set it up and use it. Maybe some error slipped in there.

Hope this helps.

3 weeks ago
Well, I try to be polite here, but taking computer science class and not know how to ask simple questions doesn't go well together. There's a high risk of failure without basics like these.
Just posting homework questions without showing at least some effort isn't the way a forum works. We're here to help you to help yourself, not to do your homework for you. Sorry if this sounds harsh, but it's your job as the student to put the effort into it to learn what you teacher taught you to solve the problems given to you. And from what I've learned over the years is that every teacher will teach the basics needed to solve questions - there's just no thing like "we weren't taught" - it mostly boils down to "I didn't payed attention / didn't asked when I should had".

I highly advise you to contact your teacher if hes willing to give you additional lessons as it seem you lack the needed basics. Without this effort from your side, failure is to be expected.

Aside from not really needed, but let me try to explain why its important that you learn the stuff yourself: Imagine you manage to pass and get a job in this topic - so then it's your job to develop something out of your own imagination. You just can't go to a forum and ask poeple: "Hey, boss gave me this order - please do it for me." - you would spend what you earn on others doing your job. That's not a way of life one should aim for.
3 weeks ago
What's your question?
What's that Turtle class?
Just posting code without explaination or question isn't helpful. Also, the topic title doesn't give any clue about what you try to ask.
3 weeks ago
Wow - that's some interesting history lesson. Who'd know that this beviour goes all the way back to how core memory physically worked. More interesting: Why is the Java stack implemented in that way? It could had been just in the way that the constructor would return the pointer to be pushed back onto the stack. Or creating an object doesn't pop the pointer but just peekt it.
You should get a cow for this (sadly I can't or I don't know how).

3 weeks ago
Let me give you another example:
In I've posted some crypto stuff. As it uses AES-256 it fails with anything lower than Java 8 update 161 (as 161 was the update when oracle finally dropped the restriction on crypto). So it fails with this stacktrace:

This tells me: ok, in line 29 of my code I call something else wich in the end failed. In my code this is a call to a helper method to store an encrypted keypair. In this helper method I use AES-256. As this is executed with Java 8 update 144 I'm not allowed to use AES-256 as 144 is restricted to only AES-128.
The line causing this issue:

The issue: AES-256-OFB - not allowed with 8u144 causing the stacktrace.

So, to maybe get more into your problem, we need the complete stacktrace you get. Then we can try to identify the class in wich the exception is caused and from there we can work your code up until the call goes to the lib and try to figure out if its something wrong with what you wrote, if it's an error with the lib or maybe an issue with the environment its run on.
The few information you gave us until now aren't enough to help.

Hope this gets you further.

3 weeks ago