« first day (3036 days earlier)      last day (2129 days later) » 

00:00
"I am an optimist. It does not seem too much use being anything else...." -Winston Churchill (source)
 
4 hours later…
03:54
farts
 
3 hours later…
07:13
Can we use Lambda expressions in java 6 using Retrolambda?
07:51
docs claim we can but I am getting classDefNotFound for function's interface Consumer
08:33
morn
morn
08:50
\o
o/
huh?
pseudohuman gone huh
o/
hansuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
hey cf
08:51
oh wait
nothing much at work
lmao that was awesome hans
lots of tasks
geis would be proud
08:51
in IT support tasks never come to an end
ah i see
xD
anyway have to go to a meeting for the next 2 hours
later cf
09:33
Hi guys, can I ask how do you normally reverse a LinkedList efficiently under the best time complexity? There are algorithmic courses that always implement the LinkedList using nodes, but is there anything written that already supports LinkedList reversal in Java that is rather efficient?
There seems to be a reverse method under Collections class but I dont know if that is efficient too
10:16
Unless Java cheats somehow (which is entirely possible), I don't see how you can do it in under O(n)
hmm
by cheats you mean compiler optimization voodoo shit?
is the manual implementation using nodes equally as faster compared to the Java implementation. I know there's this talk about time complexity of O(2n) and O(n) being like the same after dropping the constant, but I'm unaware how scripts use for examinations trigger a TimeLimitException
will the constants in front of O(n) matter? Or will only a higher order of O(n^2) trigger the alarm
I'm currently doing an algorithms course but the learning language is Java. While I'm learning theory and implementation, the practical exams are still done in Java, so it's strange how what I'm learning is really done the same way in Java
@PrashinJeevaganth Let me put it this way, Big O notation won't tell you how long it'll take for the program to run
it's not a benchmark, it tells you how it grows with more data
so the constant is meaningless in that regard
Hmm, so if I'm trying to code for an optimal runtime, I not only have to care about the order, I also have to somehow care about the constant because the constant itself might still incur some kind of overhead?
Hmm, you don't ever really have to worry about the constant
If you want to test it for performance, use benchmarks
10:31
now I have an issue printing a string that is a result of a loop

it will print String1,String2,String3 on the same line

but I usually like to use StringBuilder to concatenate them so that I could "keep track of things" and print it one shot at the end of the loop

The other way is just to print the moment you get the String you need.

This concern also feels like about "constants"
If your program performs fairly well now with 1000 lines, and you want to know how this might change once you'll have 5000 lines, Big O notation is important
well as these things usually go, it's all about tradeoffs
@PrashinJeevaganth The tradeoff here is performance vs being able to have immediate feedback throughout
it's better to just use StringBuilder unless you have reason to believe it might fail halfway through or something and you'll be left without feedback
I could understand the tradeoffs between space and time, or just the time between different operations, but now as I'm using Java implementation already done for some script with unknown time limit, I don't know how to approach this problem of coding verbosely to my understanding vs runtime
ah alright
I'm back
I love StringBuilder haha
what do you mean by coding verbosely?
10:34
I mean the programming assignment requires me to sometimes print things on the same line, sometimes on different lines
its quite irritating to track, and StringBuilder just solves this issue of tracking right away
but I'm concerned about the runtime
ah, well once you program professionally, you'll rarely have to call printf instead of println
well now the problem is enduring to the curriculum's needs
for an algorithmic course, we learn implementations of LinkedList(coding with Nodes etc) and such, and there are programming problems concerning these data structures themselves.

Well, you don't see these functions being implemented in Java, and even if you do, you see them implemented in the interface instead of the data structure to be concerned with.

Now I don't really know what I'm learning to optimise haha
Hey guys, I am writing a plugin and would like to access the package (whole path) name of the the project using the plugin. I've read a bit and it seems a bit tricky to get it right. Any ideas on doing this? I am interested in path.../workspace/projectX, where projectX is using a plugin that dersires to know this path.
10:53
@PrashinJeevaganth Well it's always important to know what you want to optimize :)
but generally speaking, optimize performance, not memory, unless you're actually having issues with memory
it's a bit difficult these days to run out of memory
and it's usually because you're doing something wrong
I'm not concerned about memory too, I'm thinking if what I'm doing causes computational time too
11:12
Is back porting in java not recommended?
@TBag back porting?
Didn't know you were into that sort of thing
@Neil yes back porting
I need some java 8's functinality in my java 6 application.
Yes java 6!
I don't see what's wrong with that, really
whats wrong with what?
Back porting.
11:18
I tried it with retrolambda and checked with a simple file containing lambda expressions but it threw no classDefFound for Consumer interface of util.function
what do you use for the same?
I found a solution here.
https://gist.github.com/rylan/1830430
However, just because it is open doesn't necessarily mean it is correct. Is there anyway to make sure that the plugin recieves the path of the program running it?
@TBag Oh I don't do back porting.
@Neil Then what do you do when you come across such a problem where you need some functionality which is only available in the later versions?
@TBag If I'm actively developing a program, I simply bump up the minimum java requirements
no need for fanfare
@Neil Sorry didn't get you
11:31
@TBag You're using java 6 on a program and decide you want to use features from java 8. Solution? Use Java 8. Done.
that's my case most of the time
hello all
@Prabhdeep Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
hello
@Neil I wish i could do that.
anyone here worked on websphere war deployment ?
11:36
@PriyankaW Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
@PriyankaW You poor soul.
i wanted to know if it is mandatory to compile and re-build war using ibm sdk if we want to deploy it on websphere ?
@PriyankaW No, I don't think so
It can be a valid war compiled using any sdk I think
@Neil hmm.. ok then i will move to next part where my jdk built war, after deployed on websphere causes it to hang !!! seriously why it isnt simple like tomcat
websphere is so complicated with respect to tomcat
I can tell you with certainty that you don't have to use their sdk, because I did it for years
though you will have to use their API's for updating/installing the war or use the console
11:44
okey... deploy project war on websphere - thats my task in my organization. no one knows how.. im alone devops, dev, qa, technical content writer for this project :)
figure I had a war that was roughly 750 MB in size (don't ask)
Tomcat deploys it without problems. Websphere cannot handle web applications of that size
So I had to deploy my web application without the jar libraries, and then add them in afterwards..
it was so much of a headache I swear
If it were up to me, we wouldn't have switched at all to websphere
its for customer ! BU managed to get approval from higher management for websphere support with promise to get 2 new customers for this project ....
so - even my war has jars in web-inf\lib. i guess i should remove them and try your way.
ohh - things getting complicated ! have to write new pom then.
well that applied to me only because it was too large
it should probably be okay for you, though I don't know why you're having that issue
will again go through ibm deploy enterprise app documentation and try to deploy(this will be my 5th attempt); if fails will follow your way. 1 big task ommitted is that i dont have to re-build using sdk !
my war is 35mb.
ok
@Neil lol
11:59
btw, in tomcat we have sun-jaxws.xml, in jboss we have jboss-deployment-structure.xml along with web.xml. do you know what xml should be there in case of websphere ?
Most experts agree that the plague was caused by Yersinia pestis (or Y. pestis), a bacillus carried by fleas that live primarily on rats and other rodents that were common in medieval dwellings. (source)
my websphere is 8.5.5.14. its developer free edition. not liberty.
@OakBot that info is not related to java.
@PriyankaW Type /help to see all my commands.
bots are bots ! no human touch
sometimes its better to leave the office for some minutes
instead of exploding on your co-workers
thankfully I did...
would not have ended well
12:11
@Hans1984 true.. but i need some help as ibm docs are overwhelming.. too much to read per topic
No I wasnt refering to you @PriyankaW
rather to my situation 10minutes ago..
okey...
Can't help you on your topic
again okey... and sigh
12:25
Any lads here ever done any plugin programming?
12:56
@sockevalley nope, sounds neat though
13:26
Could someone tell me the use of static objects in Java and when to use them?
3
Q: What is the purpose of creating static object in Java?

Ajay Khetanclass Demo { void show() { System.out.println("i am in show method of super class"); } } class Flavor1Demo { // An anonymous class with Demo as base class static Demo d = new Demo() { void show() { super.show(); System.out.println("i am in Flavor1D...

I have seen the answers to the above question^ but it doesn't really cover why static object is useful and when it should be used.
@Abcd well, you should probably only use them if you also use final keyword
so for like constants
and you should also avoid using them like singletons
I am talking about static objects not static variables.
what, like static classes?
Wait, let me share an example.
you mean like the example in the link you gave?
that's just a static variable
13:29
give me a minute.
take your time
like in the above program, why not declare all those objects in main() itself?
objects: isr, stdin, fileName
wait, my proxy filters these images, but I can see it on my smartphone
one sec
@Abcd that's an awful example of using static
don't learn from that example
You would put it directly in main()
I see.
@Neil What about the example in the program of the Question I linked above?
> static Demo d = new Demo()
well two things I would probably change about this
one is that there's no need for it to be missing the final keyword
if it doesn't get reassigned, it should be final
and second, Demo could be an interface (apparently here the point was to override method show, but normally you wouldn't bother)
13:37
@Neil OK, but why static object?
Why can't we again use main() for object creation?
yeah, you could
this is probably a bad example as well
it's just trivial, so it doesn't really matter
do you have a better example?
but yeah, you would put it in main
But assume for a second that it is correct that it isn't inside main
maybe because you use it in several different places
the fact that it's static means you don't need an instance of Flavor1Demo
otherwise, in main, you would have to do Flavor1Demo f1d = new Flavor1Demo(); f1d.d.show();
static means it's detached from any instance of that particular class
a better example of using static might be say, private static final Logger LOGGER = new Logger();
then you can use that instance throughout your class
more importantly, it's not really a state of your class, so it's probably okay to declare as static
you wouldn't want to hold state information in static variables
What do you think gets outputted here?
class A {
    private static int num = 0;
    public static void main(String[] args) {
        A a = new A();
        a.num++;
        System.out.println(new A().num == a.num);

    }
}
false
no, it shows true
num here refers to the same thing. It works independently of class instances
13:47
yes! Right!
used like this, not very smart
static members should be useful to the class, but only if it is to provide utility or constants.. not for holding state
What is state exactly?
If you made a class which represented fractions, then state for such a class might be the numerator and the denominator
For a string, it's the array of characters
it's what changes basically from instance to instance
this sort of thing should never be static
Okay
 
2 hours later…
16:01
@Abcd What the...
Who uses parens like that when creating new strings? xD
I never saw that before.
Also, that code is trash.
amen
They should not be catching the IOException if they are just printing it to stderr. The main method should throw the exception.
Also, where is the finally block?
its code from a book, what do you expect?
why finally block? why no try-with-resources?
I'm thinking that the book might be old.
Because they are not using Scanner.
Or the Console class
I'm thinking that the book might be old.
Because it is a frigging book.
16:07
And who puts spaces before semicolons?
they arent spaces, they are tabs ;)
Probably
1-length tabs
16:23
So that's how chocolate is made: old.reddit.com/r/gifs/comments/aqhe32/oh_my_cow
This is actually incorrect, chocolate is made from the milk of adult male cows.
17:17
I'm debugging a multithreaded file transfer program at work. Thread T1 handles getting files from the source machine and putting them in a file queue, T2 handles taking files from the queue and transferring them to the destination.
The failed file transfers have never occurred in debugging (that is, with breakpoints set and stepping through the code). I'm starting to think this is a concurrency issue, perhaps a race condition. The failed file transfer only happens with a single directory, and happens very often, but never during debugging if I set my breakpoint before a certain method.
Is it possible that race conditions do not appear during debugging?
That "certain method" leads to a whole lot of code, so it isn't easy to figure out where the problem is in all of that.
Race conditions are hard to debug using breakpoints. I would suggest to use println statements instead.
@ItachiUchiha oof. This is gonna take awhile. I'm guessing we're gonna ship with this bug and keep debugging. Are there any super duper clear indications of race conditions? As in someone named Bob tattoos "My name is Bob" on his forehead clear.
I'm new to concurrency, taking the class at uni now, so I know very little about all of this
17:42
I'm sure my bosses know that race conditions are hard to debug with breakpoints, but why is it hard? I was thinking that because execution is controlled by debugging that it's simply impossible for race conditions to occur because everything is restricted from racing.
 
6 hours later…
23:42
reads a book

« first day (3036 days earlier)      last day (2129 days later) »