David Go

Greenhorn
+ Follow
since Mar 30, 2019
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 David Go

Hey all I have the code below that changes the background of a cell to either RED or GREEN. It seems that when I comment out the GREEN else code that my excel sheet has all red for each cell box in row 1. Likewise, if I do the opposite and comment out RED and un-comment GREEN then all the cells in row 1 are green.

I'm not understanding what in the code below is making it color all the cells the same color even though the first 2 cells should be RED while all the others should be GREEN. I already checked my logic and its going to the first IF 2 times and then the rest is going to the else so that's correct.

My code:


I'm sure I am just looking over something quite obvious but at this time I'm not able to find what that may be.

Any help would be great!

Note: Also posted to the following forums:

codeguru
Stackoverflow
1 month ago

Dave Tolls wrote:The method setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment) in the type CellStyle is not applicable for the arguments (org.apache.poi.sl.usermodel.VerticalAlignment)

You've imported the wrong VerticalAlignment (I know, they are stupidly close in their package names).
You want the ss one, not the sl one.



It looks like "Middle" is not part of the SS?
2 months ago
Hey all I am trying to get my cell to vertical line instead of just being aligned by the left side using POI.

This is my java code:


However, the line headerCellStyle.setVerticalAlignment(VerticalAlignment.MIDDLE); has an error of:

The method setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment) in the type CellStyle is not applicable for the arguments (org.apache.poi.sl.usermodel.VerticalAlignment)

How can i go about getting this to work if I have already defined it as an static CellStyle headerCellStyle = workbook.createCellStyle();?
2 months ago
The // between Local Apps is said to take care of the space between the names. I was using something and it kept saying "cant find dir \Local"
3 months ago
Hey all I am trying to change directories and then run my command with parameters.


It runs without errors but outputs nothing. However, this is what shows up after it finishes:

<terminated, exit value: 0>C:\Local Apps\IBM\SDP\jdk\bin\javaw.exe (Jul 22, 2019, 11:21:37 AM)


The expected output should be:



So am I doing this correctly?
3 months ago

Stephan van Hulst wrote:You should break up the input string in parts depending on how they're delimited. For instance, the time at the start (including the milliseconds) is delimited by whitespace, So you first want to match as many non-whitespace characters as possible, followed by at least one whitespace character. Use capturing groups for the parts that you're interested in, and use non-capturing groups for delimiters or fluff. That means that the regex for the first part could look like this:

This means: capture zero or more non-whitespace characters, and then match one or more whitespace characters.

For parts of the input string that are enclosed in braces, you would do something like this:

This means: match a '[' and then capture zero or more non-']' characters, and then match a ']' character.

Then you have to compose your entire regex of patterns like this, and then escape all the characters that have a special meaning in strings. I can promise you this will become incredibly messy and unmaintainable. Instead, you will probably want to use java.util.Scanner to process the input string in bits. Have you already looked at its API documentation?



Yeah even with your suggestion(s) I am unable to come up with even a charater being reconized.

I also noticed that the SSH log(s) are not all the same format:


So that above is different form:


So in my opinion this is totally out of my realm of Regex knowledge - even if regex can split all of these up regardless of form.
6 months ago

Stephan van Hulst wrote:You would use a regex to get specific information out of a string. What information are you looking for? Do you want to get EVERY piece of information out of the string, or just a few particular parts?

I'm assuming that by the crosses in the input string you mean ANY character, but you just censored out the actual characters.


Yes you are correct Stephan. I am wanting to get every peice of information - just split into the sections of the pattern.
6 months ago
I am terrible at trying to figure out this Regex! It's, like everyone else, doesn't make much since.

The string looks like this:

The pattern looks like this when breaking the above up:

Any help with this crazy pattern would be great! I've been told that using [.*?] would help with the X in brackets but it's still over my head and I don't know how to go about this the LONG LONG way around (.replace, .contains, .indexOf) but I know using Regex is much cleaner.
6 months ago
Hey all I have created a Swing Java Application with setUndecorated. This is what I am wanting but it seems to take away the drop shadow of the jFrame.

I have been looking a lot for code to do this but all seem to have the drop shadow **INSIDE** the application itself.



In this linked stackoverflow post the user has an image like I am wanting to do (though the image is from a .NET winform):



I also ran across this stackoverflow post that *may* be what I am looking for but I am unable to apply the backdrop to my jFrame because this seems to only draw borders around the jFrame:



I also read over this staackoverflow post that seems to also be something I *may* be looking for but when I tried the code it didn't do anything in the background of the jFrame. This seems to be using the **SwingX** but I can not seem to get it to work with my jFrame?:


Lastly I looked at this [stackoverflow post][6] and it is somewhat what I am looking for but it messes up (makes my component's on the frame go random places) once I get the code onto my swing application and plus its not **all around** the jFrame.



So masters of Swing - how can I accomplish this?
6 months ago
Hey all new to Java some I'm sure this is something simple but just can not get it correctly in order for it to work.

The original java code for this runnable class:

The thread code that I created is this:

The only 2 errors I have out of all of that code above is:

Handler cannot be resolved to a type



on


and

Return type for the method is missing



on


So what do I need to change in order to replace Handler so that it will work with the thread code I created?
7 months ago
Hey all I am at a loss as to why its doing this. If I just run the server and standalone client it works just fine. However, once I use my code for the client it seems to get stuck...

It does fine until it gets to the "NAMEACCEPTED" else if condition and it just steps out of the while loop and then nothing happens. No error of any kind. It just doesn't how the swing frame!
If I comment out:

and run it the swing frame loads up just fine. But my Socket (which I am wanting in my swing app) keeps it for some reason passing.

To sum all this up - the above code hits the window = new UFTtrack(); and placeChatOnScreen() but after it exits the While loop in the placeChatOnScreen() it never continues to createTable(); What's the deal???
7 months ago