Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!

Bob Winter

Ranch Foreman
+ Follow
since Apr 18, 2020
Cows and Likes
Cows
Total received
6
In last 30 days
6
Total given
0
Likes
Total received
29
Received in last 30 days
23
Total given
10
Given in last 30 days
9
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bob Winter

Well, sorry to say, but I guess it fits it's me posting this reply:
If you have a project and a deadline most likely it was given to you by someone who's convinced that you have the required skills to get it done in time. Your post on the other hand shows that you seem to lack the required skills; and also to search for helpful information on the net.
Reading a given site is a matter of copy'n'paste existing solutions, you only have to define the base structure of what you want to crawl. Storing what you crawled is even simpler.

Sorry to say, but when you want someone else to do your job for who knows who and what you're at the wrong forum. IIRC there's a section here you can offer payment - but if you fail to do your job you do for a living please don't ask someone else to do it for you for free.

If you want me to do it pay me and all profit you make with it - it's my code, I keep the copyright and ask for any profit that's made by using it. I guess others may have the same way of looking at it although not writing it that clearly.
1 day ago
It's pretty obvious from the posted code even without the getIdOnly() method:

vs

It's obvious right away that you have some sort of generic collection but with a different type. If the second one works, but as generics can't be primitives, it had to be some like Collection<Number> - try a contains(String) was just asking for an "unexplainable error".

Aside from all that, the way more severe issue you should fix ASAP: Move your database stuff out of the EDT! What you constructed is what most users know as "the program froze" - you block the EDT with something that can potential takes up a lot of time. As the EDT is the essential part for GUIs in Java it always has to be ensured it runs without any time consuming blocks.
If you have to do something like a database query triggered by the UI you have to de-couple it - and pay attention to re-couple the modification of the UI to only happen back in the EDT:
1 day ago
Another bad way would be using reflections:
1 day ago
Sorry, but: uhm, what?
May let me suggest you to re-phrase your question?
It's not really clear what you're asking.
If you want to check if you have access to database connectivity you could check if modules like mysql/i/nd or pdo are present - if they're not loaded one may think of implement a mysql driver by using fsockopen - and I'm sure someone already has done it.
The other way would be: On whatever server you want to run your code one, unless you're its admin, you can always ask the admin if php, any database (there'Re more than just mysql/mariadb) and the required connector are installed.

This question somehow reminds me of what I got once from someone:
"Yea, we'd like to develop some sort of firewall-breaking proxy code ... blah blah blah" - I just replied: "Well, if you have your software run at some remote location and it requires a connection back to your server tell the admin to set up a VPN - or at least open the required firewall ports." - We argued about this for about 1 or 2 weeks and then I said: "Well, k, I don't even know my way around DotNet / C# and I think your approach doesn't seem doable - aside from all of the security issues - I'm out". TLDR: If you have some requirements don't try to figure out a away around it - talk to the admins to check if the requirements are met and demand what you need. That's a way to go within hours instead of wasting weeks on something doomed to fail.
2 days ago
PHP
Aside from CTS - did you solved your problem? If so: It would be nice for others might want to learn from it to post your final code as an example.
2 days ago
off-topic: pwllgwyngyll - it doesn'T even have a vowel in it ... strange folk those welsh ...
4 days ago

Barto John wrote:Eh... Stil... I can't decrypt. Could you help me? someone ? What should be the result? And maybe I'll find my mistake.


As I already wrote: Just show us what you got so far and someone (maybe me?) here surely will be able to help you along ...

In fact: You're given all you need, it's really not that hard. You may struggle a bit at first, but once you got it working you'll see it comes down to just a few lines.
4 days ago
First: Your edit should had rather been a reply. Also it should had contained where you found what you looked for. So let me help you on this one:

Any resources about Googles APIs can be found here: https://developers.google.com/
If you look for an implementation many of them can be found on Github: https://github.com/googleapis

As for why? Well, I guess because it's an already existing platform allowing for easy collaboration. I myself have some fixes in now official releases of some of the APIs - although only very minor ones so not really worth noting. I guess it's because so easy to be part of: If you found the API you have an issue with or even some fixes you can just fork the tree - implement your fixes - and file a pull request to get it merged into the official releases.
Also: When you want to ask something you'll find yourself on the StackOverflow platform - cause Google chose it over providing their own forum/board/what ever.

Is it because Google couldn't had provided it all on their own? No, I don't think so, but rather because re-use of already existing platforms. Someone here remember Google Code? Never got that big because other platforms existed before it and are way more popular. It's quite easy to think about why someone thought: Ok, just lets use what all those devs already use ...
4 days ago
When you want to post code the editor helps you with the CODE button - as you're new here let me help you with this:


As you're new here you're may not familiar with how to use this forum. Hence I'd like to point out, that it may not be the way to just post a few lines of codes without any information or question. Just using the threads title is not the best way.

Anyway, as the subject was long enough to fit your whole question, let me answer it: Basically yes, it is possible, but not with the code you posted.
You see, as classes in Java has to have unique names having more than one class with the same name is never a good idea. You can get along with it by using different packages, but when you look at java.util.Date vs. java.sql.Date and you want to use both within the same code you encounter the inconvenience to always have to specify the full classname including the package, which can make code sometimes hard to read. Also: Using the keyword "class" can lead to issues any hence should be avoided (as any reserved keywords) So, first of all, let's rename your classes to help to clarify some things up a bit:


The next issue you encounter with this example is access: Sure, there is a way to get the code print the message to the output - but it requires some modification (there're several ways to do it, but I stick to the very basic ones here). To work this out you first has to figure out which class knows what other class and which class has what access to what other class.
In your given example the class Main only has access to the class Outer, but not directly to the class Inner. Why is that so? Well, first of: The class Inner is missing the static keyword. An inner class without the static modifier always requires an instance of the outer class, just like any other member, there's no way around that. This now comes down to the cocept of the nested classes: Does the inner class make any sense without an instance of the outer class? Why is it an inner class in the first place? What's it used for and what does it hide?
An example would be the inner interface Map.Entry: It represents one Entry in a Map - so it's easy: No, an entry in some map doesn't make sense without the map itself. Hence the inner interface Map.Entry does not have the keyword static, it can't be used without a Map. You want to have a Map.Entry? Well, then you first need a Map.
The exact opposite of that would be an inner builder class. I don'T know if you'Re already familiar with that pattern, but let me give you a very brief example:

In this case having something to plan and build your house does make sense without the House itself - hence the inner class House.Builder is static: it can be used without an instance of the outer House class. To build a house one may do this:
House house=(new House.Builder()).addFloor().addRoom().addRoom().addRoom().addFloor().colorADino().build();
This way one would end up with a house having 3 floors, 4 rooms and it be painted rainbow.

To come back to your code: To figure out a way how to modify the code so you can get the text printed you first have to figure out if the inner class can be static or not as this decides what modifications can be done. A valid way would be this: The Inner class can't be alone but always require the Outer class, then a valid solution may look like this:

Your main class would then become this:

This is just one example - if you want to get more information please try to specify what it is that you want to achieve. From there one can figure out what style may fit better than others.
6 days ago

Alejandro Barrero wrote:I am getting an error message [...]
"Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release."


No, you don't. This is not an error. It's not even a warning. It's just an information that the JVM was given some (old) CLI parameters that were now marked as deprecated - and may (or may not) removed in a later major version like Java15 (or some even later one).
If you want to "fix" it just remove those CLI parameters. Otherwise: just ignore it.
6 days ago
"It doesn't work" unfortunately isn't that much of an information. Unless the Exception is silently suppressed there's a rather helpful IOException telling you the issue. Most likely either a no route to host meaning the dns resolution failed or a connection refused which often means the firewall is blocking (unless the server isn't running at all).
So, to help us to help you to figure out the issue it's best to show us the error message (please post text output as text rather than taking a screenshot as it's hard to read on a mobile device).
I'm sure one here can spot the issue and give you some advice.
1 week ago
Well, if List is used further on in the code I may suggest to stick to it to follow the example. Construct some wild spaghetti code isn't what a beginner should try to wire up.
1 week ago
As a small hint: The JavaDoc for the class lists common cipher suites and their modes as a String that you can pass to the Cipher.getInstance() method. The one you're looking for is in the middle.
About the key: For someone not used to Javas crypto framework it may look easy as "Just use XXX as input.", but be aware: Unfortunately it's a bit more tricky than that. It depends on how the key is encoded to get some useful SecretKey instance.
As you're supposed to use an operation mode without padding it may can get a bit complicated to figure out the correct way to do it as there is no way to check if the key was valid cryptographically - as each output of ECB without padding is at least somewhat valid. This way it depends on knowledge about what the output should look like. But as you given at least some information about the key and the output it should be rather obvious when you got it right - as when you mess something up at least part of the output will not be right.
In addition to all that: The mode you're supposed to used is what's known as a block cipher. Using a block cipher means that you have to operate on the data with a fixed blocksize. DES for example uses a blocksize of 64 bits, or 8 bytes. As your given ciphertext is way longer than just 8 bytes you can't just give it as a whole as input and get one big output out of it but you have to come up with a way to process the data in chunks.
When you first got your head around it all this makes sense and becomes way more clear. Just don't give up if your first tries fail - crypto is hard.
1 week ago
Just as an idea: Isn't a Map<String, Integer> better suited for your task?

//edit: spelling error
1 week ago
Well, that looks pretry straight forward. You have the cipher, its mode and the key. Now you just have to use javax.crypto.Cipher to do the magic.
Show us what you got so far and where you struggle. I'm sure we can help you to get this working.