« first day (1622 days earlier)      last day (3316 days later) » 

2:10 AM
morning
 
2:39 AM
morning.
 
'sup? :)
 
Still studying hard...

Is there an easy method to print the code and also the result?

I'm trying to remember math methods

My code is something like

System.out.println(Math.abs(-26.7));
System.out.println("Math.abs gives you the absolute value - how far away from zero the number is ");

Is there quick code that will show the code and also the result?

I know I could write

System.out.println("Math.abs(-26.7) = " Maths.abs(-26.7) )

But that seems like there could be a better way.
 
2:55 AM
I'm not sure what you mean
 
No - I think I confused myself too :)

I want to make a cheat sheet type thing. Is my code the best way to show the code and also the output?

http://pastebin.com/GZR76y8S

Thanks
 
3:36 AM
Gems - you here? Or anyone else?
 
Well, I can't say that I know of any better method.
 
3:57 AM
Great. Thanks
Done it now.
I know I could have easily copy/pasted a cheat sheet from the net but was good practice remembering braces etc :)
 
While you're still learning, never ever copy-paste. Your fingers need the practice of writing it. Even if you copy it straight off syllable by syllable, still write it manually.
 
4:23 AM
They do. After a while, even remembering braces comes as second nature.

What's wrong with this?

System.out.println(secondarray[0][1][2]);

How can I print a range from the array? Thanks
 
You're printing a 3D array. Is that what you're trying to do?
 
I've made a simple array.

int secondarray[] = {9,543,478,65};

System.out.println(secondarray[0];

^^ works okay

But how can I print out, say, the first three variables in the array?
 
You make a simple for() loop
 
Okay.
 
when you add [] to an array you're adding a dimension to it. int[] is a one dimensional array, int[][] is a 2D array and will print like a rectangle.
Like this:
[][][]
[][][]
 
4:32 AM
Right. So this is a 2D array.
With the For loop, can secondarray be the variable eg

For (int secondarray =0; secondarray<=2; secondarry++)
 
Actually, no
change secondarray to i
and then you put System.out.println(secondarray[i]); in the loop
and make sure you don't typo in the real code ;)
 
yup.
Do I change secondarray to i when I initialise the array or only in the For loop?
 
In the for loop; you're not incrementing the array, that won't work
You increment the number symbolizing the index of the array
the [] symbolize the index of the array
 
So

int secondarray[] = {9,543,478,65};

For (int i = 0; i <=2; i++)

System.out.println(secondarray++)
 
so secondarray[0] == the first entry in the array.
No, do not increment the array
I already showed you exactly what to print
 
4:40 AM
Ah yes. Sorry!

System.out.println(secondarray[i]);
 
That's it :)
 
Eclipse is (not responding). I hope it sorts itself out as I can't remember when I last saved my work :(
 
Also, don't forget the {} on the for loop. in one line code you don't have to have them, but it's bad practice to not put them there
The longer you go without saving, the more likely a crash will be.
 
Yep. That's in Eclipe. It's written better there :) formatted and everything since Unihedro gave me that lecture lol
 
Please for the future, whenever you don't cite a single statement, please put the entire code in your snippet
 
4:42 AM
will do.
I really appreciate the help you and other give here. I'm doing an unsupported (no lectures etc) online degree and when it's just you and a book, a few minutes of help makes a massive difference.
 
I can't say please too many times because it's very important that you do if you want us to help you
Always read the book before coming to us.
 
I will.

I need to go to collect my boy from school. Thanks again.
 
ASR
good morning all.
 
Morning ASR
 
fge
Moo
 
4:44 AM
Morning fge
 
good morning
 
ASR
5:00 AM
@Gemtastic do you know Liferay?
 
@ASR Nope
I only know JavaSE and a little JavaFX
Enough to make a working GUI at least
 
ASR
nice
@Gemtastic liferay is a java portal frame work, easy to build websites, uses JSR 168 and 286, opensource
 
Ah. Well, I only know a little Jersey and Spring on that part
And the no frameworks way
 
fge
There are too many frameworks
Way too many
 
ASR
yes
 
fge
5:09 AM
Spark is another one, and then you have dropwizard...
 
ASR
is it a web service frame work?
 
fge
Well, define "web service"
Even there there are a s*load of protocols
And then there is REST, which is not really a protocol but a norm...
 
ASR
hmm , yes.
 
fge
Web programming is an entire discipline by itself and I'm no good at it, at all
<--- "server side" guy
 
ASR
yes true,
are you working on spark?
 
fge
5:12 AM
No
I wanted to work with it, though, but I stumbled upon a very annoying limitation
Two, in fact
 
ASR
ok. good. now you are working on which technology?
 
fge
I'm working on a SonarQube plugin which I parse using my own project
(becase SonarQube's SSLR just can't do it)
s,plugin,language &,
 
ASR
@fge really nice.
what are the technologies you know?
 
fge
Not that many, in fact
Given what I do I'm more focused on the core languages and libraries than "technologies" :p
 
@ASR it is possible that you can get better answers in the webdeveloper chat, since they specifically work with it regardless of language, there migth be a java fox in there
 
ASR
5:28 AM
:)
how java.lang package is imported by default, even we did not use?
 
fge
I wonder whether there is one single font having symbols for all of these
@ASR because The JLS Says So(tm) :p
But the JVM will only ever load the classes you need, not all classes
 
ASR
@fge nice info :) about symbols
 
fge
@ASR that's only a little less than 6000 code points among the 240000+ defined by Unicode...
Those guys are crazy
 
ASR
yes
 
fge
My favorite code point remains this one :p
 
ASR
5:35 AM
nice
where did you learn java?
 
fge
On the fly
 
ASR
@fge :) means?
in school level
 
@ASR it means he didn't go to school; he's self taught
 
ASR
oh really?
 
Some people are awesome like that ;)
 
5:45 AM
hi Everyone...
 
ASR
yes its true,
 
6:06 AM
@SecondRikudo there ?
 
fge
Hey, I did go to school
I just didn't learn Java there
(nor anything computing for that matter)
 
ASR
:) ok
 
fge
Other than that I'm an imbecile
But a persistent imbecile
I try until I succeed
 
ASR
thats great , I like it.
 
6:27 AM
o/
 
@fge "The master has failed more times than the novice has even tried"
 
Everyone is already here
 
fge
Yeah, big day of work today
Parsing more of that darn language :p
 
Not working on the debugger-web anymore?
 
fge
sigh I need to start anew
My initial plan was not good
I'm not sure I'll use spark anymore; just plain jetty will be good enough, and it will not have the limitations I found with Spark
But my lack of knowledge of producing interfaces is killing me
And the JavaScript ecosystem is a complete unknown to me at the moment
ReactJs looks good for what I want to do... Just not sure
AngularJs looks nice, and so does Knockout...
And then there's the design part, at which I suck so much it's not even funny
I'd need @SecondRikudo to teach me a lot
 
6:45 AM
Good morning, Java!
 
fge
Good morning too
 
7:10 AM
Good morning everyone ^^
 
@fge I see.
<-- Little to no knowledge in JS
Need to sneak into @SecondRikudo teaching and grasp knowledge :P
 
@ItachiUchiha Why sneak? Just ask
@fge Server and client are made in a way so that they can be built completely independant of one another
 
fge
I know that
 
Hi, I've written the code http://pastebin.com/vECjcvsA

A simple For loop to output from an array.

One thing I want to check is, why write

For (int i = 0;.....)

instead of declaring it at the start with
int i;
and then, inside the loop,

For (i=0;...)


Thanks a lot
 
So like I said, ignore the client-side for the moment
 
fge
7:17 AM
Well, no
 
Imagine that you're writing a server to a Java client
 
fge
I need to get it started eventually
 
The Java client has the same requirements
I will request data with HTTP, get JSON and do something based on that
You don't care what your client does with your data, or how it does it. Yet.
 
fge
Again: the server side is not the problem for me
I can do it any time
 
So do it :P
For the moment the problems I hear you have are with spark, of all things.
 
fge
7:20 AM
But I need to start coding some stuff client side and I am completely stumped; I need the initial layout and I just don't know where to start
Yeah, that problem is "solved"; I'll go with jetty instead
 
@ItachiUchiha I was sure I pinged you with it afterwards, sorry
@fge As for frontend, start small, divide your tasks
Are you going for React? Angular?
 
fge
I don't even know yet :/ I need to practice, find some tutorials etc
And should I manage to inject the data, the hardest part awaits
Layout!
 
Hmm... Interesting...
 
fge
The JS landscape is vast and growing constantly, which doesn't help
I quite like angular; its "HTML" files look to be purely declarative, a little like FXML
But then I'll start with it only next week; right now I have another task to do which is more important ;)
@SecondRikudo have you played a little with the debugger? In particular, have you tried and opened a zip which is not a trace file? This is some behavior I'd like in the web interface too
 
7:27 AM
How does one create a new entry into a table with unique key on both tables, no ID, with Jooq? .store() doesn't work...
 
Can I post a long error here?
 
fge
@dtxd no, use a pastebin
 
@fge I didn't have the chance
What happens? It errors out?
 
fge
@SecondRikudo it displays a popup (modal?) window with the exception text and an appropriate error message
 
pastebin.com/PGUVQ8U6 Any suggestion for this? It didn't seem to harm.
 
fge
7:29 AM
@Gemtastic unclear; can you give more details about what you want to do?
 
@fge Well, then in your case all you need to do is to respond with HTTP error 400 (Bad Request), and display the same error in HTML format or whatever
 
I want to create a new entry into my certifications table. That table only has two columns and a unique constraint on them. No primary key in the shape of an ID
 
@mikeeustace the variable will just live for that looptime. if you would declase it before that, the variable would live for the entire method
 
Code:
 
That's why the MVC approach is strong, you can make the model throw an exception if the file isn't valid, and the JavaFX view will interpret that into putting a popup, and a web view will interpret that into responding with an HTTP error code :)
 
7:30 AM
newCert = create.newRecord(CERTIFICATION);
            newCert.setEmployee(t.getEmployee());
            newCert.setMake(t.getMake());
            newCert.store();
^that doesn't work
.store() is red
And it says "cannot find symnol"
 
fge
@Gemtastic it's because it's not an UpdatableRecord
 
So how do you do it then? You may refer to the part of the manual stating this because I can't find it :(
 
fge
You should (my guess) create.insert(newCert)
Well, I don't use mapped record that much, to be honest
 
@fge it doesn't find the symbol on that one either
 
fge
Well then go the full SQL way
create.insertInto(CERTIFICATION).xxx()
For some xxx
I'm sure there's a shortcut
Generally I just don't use them at all
Try and see what create has
It has a s*load of methods
 
7:34 AM
Indeed
Too many to be easily browsed
 
fge
Well then limit it
 
I tried but meh. I'll keep trying
 
fge
Start with ins and complete
You should find your "salvation"
My knowledge is really on the reading part, I don't update/insert that much
 
Well, It's a kinda vital part of my app :P
 
fge
Well, don't forget to google about as well :p
As far as I see, this should work: create.insertInto(CERTIFICATION).values(newCert.getEmployee().getId(), newCert.getMake().getId()).execute()
But I'm sure there's more simple, and I'm sure section 5 has the answer :p
(I still prefer section 9, though -- obligatory GitS-SAC reference)
 
7:41 AM
Hello, I have a question, but not about Java code, but Java technologies for my project
 
tell your question
 
I want to make buisness application (my first one on this scale), for ordering food. I want to make it in Java with REST
but there are so many technologies and frameworks that i dont know where to start...
what frameworks would you reccomend to me, to keep it clean, manageable, simple and expandable easy ?
 
try with apache cxf
 
8:00 AM
it seems very interesting to me, I will try it, thanks
 
Hey guys, I have a question. Its got nothing to do with Java but how communication works.
Not sure if there is a room for that so I came here.
 
fge
Define "communication"?
 
Sending and receiving messages
 
fge
Over what?
 
either over the internet or within a LAN
 
fge
8:04 AM
Well, in both case that is bound to be TCP/IP at the network level and then some other protocol above it
 
because I'm not sure how this would work between 2 computers over the internet or LAN
 
fge
Well, a network connection is established and then the protocol above it defines the semantics
No difference between Internet or the LAN here
Those two are simply words over what a "network" is
 
I see.. But what about a sort of a chatroom between two or more users? Would sockets be involved?
 
Good Morning
@JoelSeah could be.
alternatively the client just repeatedly rerequests some data
which is a less useful way of implementing this..
 
Good Morning
 
8:10 AM
Good morning, also if I will make it like this, will it work for example on Android devices automatically ?
 
But isn't sockets only used between 2 users? If I want a 3rd user to join in the chatroom, using that same socket. Would that work?
 
you have a central server.
and WebSocket != TCP/UDPSocket
 
Hmmm would it be the same for a P2P chatroom?
 
@JoelSeah Just connect the clients to the same server socket and let the server share the messages. Default connectionlimit would be 50 but you can change that.
 
fge
@JoelSeah always
@Vogel612 sorry but no; websockets work over UDP or TCP
 
8:17 AM
@RamkumarRaghu will it work on Android devices also ?
 
fge
You have no choice in the matter -- you do need to communicate between the two machines below the protocol
 
But a TCP Socket allows only a single connection (afaik)
then again I never worked with that stuff...
 
fge
Yes you do
Every day
But you don't know it
websockets just define a protocol over the network protocol
 
@Juce That sounds like a client/server chatroom. Or is it that your "server" is referring to the client that hosts the chatroom in a P2P system?
 
fge
Just like HTTP does
And SSH, and FTP, and... And... And...
 
8:19 AM
@JoelSeah ah sorry ^^ postet the answer too late it was not to the P2P i meant this one
 
meh. "worked" as in "programmed a program going that deep into the layers"
 
fge
@Vogel612 a true end-to-end network protocol allowing several streams "natively" is SCTP
 
@10101101 , i think so
 
@Juce so in a P2P chat system, the host can only accept 1 socket connection whereas in a client/server chat system, the server can accept more than 1 socket connection?
 
@RamkumarRaghu I mean the end web application ofcourse
 
fge
8:22 AM
@JoelSeah no, that's not how server sockets work
@JoelSeah when an incoming request arrives on a server socket, it creates a new socket for this request and communicates with this socket
The server socket then gets back to sleep until another request arrives
 
@fge isnt it correct then? there 1 server socket connected to x client sockets or am i wrong?
 
fge
@Juce this is indeed incorrect
For more information, look up for the manpages of bind(2) and accept(2)
A server socket is never "connected" to anything
 
@RamkumarRaghu have you used this framework, I have also found a framework like Jersey, have you tried either of those ?
 
@fge then how does a P2P chat system work? Do you have any idea?
 
@RamkumarRaghu Like their adventages/disadventeges ?
 
8:33 AM
@fge ah ty think i got a clue now ^^ it really just accepts a connection. But 1 more question. If i close the server socket all clientsockets that were accepted until now aren't affected correct?
 
fge
@JoelSeah they generally negociate their network communication details using a third party and then use that
@Juce indeed they aren't
Now, sorry but I must get back to work :p
 
have a nice day ;)
 
@fge thanks ^^
 
This chat actually starts up by requesting JSON from a REST endpoint
 
morn
 
8:42 AM
o /
 
@Unihedro ~prod Pull request, Email for FGE, JCE, HTTP/2 ~requesting status
 
"I've never been as unproductive as this week. xD" http://chat.stackoverflow.com/transcript/message/22440146#22440146
What good should I do to the world today? I have a short break to work on things before I have to worry about exams again.
 
XD
 
fge
8:57 AM
MethodHandle ftw
 
hi
 
Anyone got succeeded making someone to april fool yesterday?
 
fge
I don't joke, so no
 
I did ;3 with and without code ;D
 
9:09 AM
I was going to prepare for a prank, but the release of StackEgg ruined it
 
ASR
@Unihedro do you know java script?
 
@ASR so?
Are you hiring?
 
BRS
Hi I have a small question. Can someone throw some light on it? The question is...Does DriverManager.deregisterDriver(Driver driver) callled in one web application cause the jdbc drivers registered by other web applications deregister?
 
ASR
@Unihedro :) no, need a small help
 

JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
 
ASR
9:18 AM
asked but no reply
 
BRS
@Unihedro Can you help regarding the question?
 
@BRS I haven't touched JDBC in months, and I encourage you to do so as well. Switch to JOOQ.
It's 2015.
 
BRS
Okay.
The issue is that I have a web application deployed along with other applications.
 
Oh?
 
@Unihedro awesome... you are IOT.... wanna be like you someday... :)
 
BRS
9:23 AM
In my application I am calling the aforesaid method. I doubt that DriverManager is per JVM. So it might affect the other applications as they are running in the same JVM(tomcat)
 
You're aware tomcat is just a servlet container, right?
 
BRS
Yes
 
Most of what you do with it affects what other instances get.
 
BRS
But tomcat runs on a JVM instance which hosts multiple apps. Right? Please correct me if I am wrong.
 
Eh, the keyword in my line was "most".
The manual should be the most of help here.
No idea about the JDBC part though.
 
9:27 AM
@BRS This call happens in the webapp level classl-loader and not at catalina level class loader, so there is very less to no chances of that happening.
 
^^
 
BRS
@Unihedro Thank you for the kind replies.
@ItachiUchiha. Sorry I didn't get you
 
Me and kind in the same sentence? ... Crazy.
 
Though if you are connecting using tomcat JNDI, the answer will be just the opposite :)
@BRS Go through the Trees of loaders section..
 
BRS
@ItachiUchiha Thank you
 
9:33 AM
hi all
 
Hi.
 
BRS
Hi
 
i need a small clarification about SavePoints
 
wtf is that?
 
Was just wondering the same, high five.
 
9:36 AM
what happens exactly when i give rollback() on savepoints
 
@Unihedro ~Prod
 
!!urban prod
... what exactly does a prod mean?
 
it's... the same as poke
^ thesaurus
> to push someone or something with your finger or a pointed object
 
I want to write on that MSE post about StackEgg, but I should invest my time somewhere better. :P
.......... ... Tomorrow. :P
Nah, I won't.
 
morning
 
9:49 AM
morning
 
hehehe
 
LOL
 

« first day (1622 days earlier)      last day (3316 days later) »