« first day (1496 days earlier)      last day (3439 days later) » 
05:00 - 14:0014:00 - 00:00

2:00 PM
So, I figured out how to get rid of all that browser web client stuff from the JavaBot
I just replaced it with HTTP calls.
 
Now you have the problem with cookies, caching, keeping the websockets alive with your own handling and error-prone handlers, and eventually it all becomes spaghetti code. :P
Then you'd quietly sigh and wished we stuck with the library.
 
Well, cookies are taken care of. I'm using the Apache HTTP library.
As for websockets, our current code isn't even using them, as far as I can tell.
I tried to get them to work using a Java websockets library, but wasn't successful.
 
You're going to ignore the headers? :O
 
I looked more closely at how it's able to login and interact with the chat.
To login, you have to:
1) Send a GET request to the login page. Then, parse out a hidden form variable called "fkey".
2) Send a POST request to the login page with your user, pass, and fkey.
 
Or use ajax.
Most of the POST will come with 403 Permanently Redirected though.
Well, to be honest that's how HTTP works, you GET and POST everything and the server works out most of the things.
 
2:11 PM
Yes. Everything boils down to HTTP requests and responses.
If a browser can do something, then it's possible to do it programmatically. It may be difficult, but it's possible.
 
Famous last words...
 
xD
 
:D
 
Ajax is just a fancy word for "give Javascript the ability to send HTTP requests"
 
Ajax is essentially "asynchronously run javascript"...
 
2:15 PM
Not necessarily.
 
Ah wait, I messed that up with something else.
 
More like "asynchronously run HTTP requests"
Which means that your browser won't lock up while it's waiting for the HTTP response from the server.
So you can run other Javascript code while it's waiting for the response.
You can't run Javascript code asynchronously. Javascript is single threaded.
 
:O
My whole life is a lie
 
xD
For instance, you can't, say, sort two arrays at the same time.
Javascript is event-based, which means it keeps a queue tasks to complete.
 
What if you push them to your server with ajax?
 
2:19 PM
Push what?
 
The arrays and the instruction to sort
 
Then that's up to the server as to how to handle the request and generate the response.
The server could be running Java, C#, Node.js, it doesn't matter to the client.
So, Javascript would send the request to the server, then continuing handling tasks from its event queue.
 
Cool!!
 
For example, the user might click a button, which adds an event handling task to the queue.
Then, say, while in the middle of handing the push button event, the HTTP response comes in.
The response gets added to the event queue and it waits there until Javascript is done handling the push button event.
 
:D
 
2:24 PM
@Michael Do you mean, javascript first handles all the events, keeps queuing the responses and when all events are done, then it starts poping responses from the queue?
 
@Mr.777 No, an HTTP response is considered an event, so it gets added to the same queue.
 
Okay, so suppose there are 3 events, first event occured, and right now it's handling second event while the response to first received and added to the end of queue, so when second & third events are done, the response (which is also considered an event) will be handled?
 
@Mr.777 Correct.
It's kind of awesome. No need to worry about making things "thread safe".
 
@Michael I agree
 
but no parallel programming :(
Well forget parallel programming, javascript is a script language lol.
 
2:39 PM
@Unihedron Yep, can't take advantage of multiple cores.
 
I have dabbled a bit with JS in the past couple of days, and I have learned something: I have learned to hate the language :-(
 
can anybody help me for regular expression
 
What do you need help with, @Swap-IOS-Android?
 
i tried repalceall
but it won't work
msg.replaceAll("\\{TEST\\}","{VAR}");
 
> but it won't work
No problem, no help.
 
2:46 PM
Hello! :D
 
hiya
 
i want to replace string between {TEST} to something else with curly braces
 
Hey @Lee!
 
@Michael hello.. guess its been a while since you popped here?
 
Your code doesn't do that. Do you even know what the regex does?
 
2:47 PM
@Unihedron sorry i dont understand
 
@Swap-IOS-Android The String class is immutable, which means it can't be changed.
 
Then why did you use it?
msg = msg.replaceAll("\\{TEST\\}","{VAR}");
 
@Unihedron yes i tried patter matcher
 
^ LOL
 
@Swap-IOS-Android look at my edited message
 
2:48 PM
@Unihedron i remember you posting me a bad commitstrip of guessing use cases .
 
@Michael okay
 
@Swap-IOS-Android Remember, that the modified string is returned.
 
Also, FFS, please don't use a regex
 
i thought it will work
 
@Unihedron why??
 
2:49 PM
msg = msg.replace("{TEST}", "{VAR}")
^ @Swap-IOS-Android
 
Yea, you don't need to use a regular expression to do what you need to do, @Swap-IOS-Android.
 
@Unihedron why is regex for FFS not recommended for use?
 
@LeeJeong You know how regex works right?
 
NOPE. but i use it on cases that "google" throws in such solutions. xDD
 
Ok, FYI, regex was regular, and hence it goes through a finite state machine; But Java regexes (and most new regex standards) are non-regular, and the computation is way worse than parsing.
 
2:50 PM
Regexes can be very useful @Uni. :P
 
Unihedron, Earth, Alpha Centauri
5.7k 9 20 41
^ I have a regex tag badge!
 
Oh. I see. xD
 
@Unihedron @Michael thank you..
 
V8 can compile regexes to native code. Similar system for java would be really cool
 
What .replace() does over regex is that it looks for the char sequence with linear search and performs better than regex. Most of the time.
 
2:51 PM
@Unihedron oh so do you have any alternatives for it?
 
thank you for information
 
.replace! ok. ill keep that in my notes! :D
 
@kiheru I think \Q\E triggers linear search for the subpattern when used in a pattern.
 
i should come this room often to improve my java skills
 
That's the only JIT resurrection for regex performance I know of.
@Swap-IOS-Android Small talks are welcome as well. Y'know, talk to someone else who likes good code.
Yay!!!
 
2:54 PM
I don't know any details. Just that it can use the jit engine for regexes. (At least some lisps used to do some native compilation as well, but I have no idea about the performance)
 
i am working with java from last year but i dont have very good understanding of oop
 
@kiheru AFAIK, it does for \Q\E - When the pattern execution comes upon quoted literals, it jumps into fastpath and tells the Interpreter to use linear search for the subpattern for that pattern object in the future.
 
any suggestion to improve object oriented concepts
 
@Swap-IOS-Android Yeah, write mode code. Write them good. And read good code - people hardly improve when they only have themselves to learn from.
Do open source stuff.
 
@Swap-IOS-Android Do you know about inheritance?
Or polymorphism?
 
3:02 PM
"what are the three pillars of OOP?" - asked by the interviewer last monday...
 
What did you answer?
 
i only answered inheritance and polymorphism.. encapsulation should be the third one. is that right?
 
Those three and abstraction
Not sure how it became three, should be four :)
 
Could be that abstraction is counted with polymorphism
 
3:04 PM
abstraction is the concept of being able to extract methods and data from another blunter class?
 
@Michael yes i know concept
 
5
Q: Why are inheritance, encapsulation and polymorphism not the pillars of OOP?

Jesus ChristOne day I went to a Stack Overflow chat and saw a phrase, that was stating that inheritance, incapsulation and polymorphism are the pillars of OOP (in the sense that they are fundamental, a construction sole). Also, there's a similar question, that I have been asked very often on college exams a...

Cool, Stack Exchange does have all the answers!
 
i used in android app like extending class
 
cool!
 
@Swap-IOS-Android Cool, so you don't deal with object oriented analysis and design?
Like you do as little as possible object-design-wise, and put most attention onto the functional programming stuff?
 
3:13 PM
^ sounds trouble
 
Well I was waiting for a well-expected "Yeah" so I could link to a tutorial, but here we go, PLAN B
 
@Unihedron And that was oodesigns?
 
@Mr.777 No it's not.
 
So, what is it then?
 
oodesigns has prerequisites that you know basic objects, just never turned it into designs.
 
3:16 PM
Everyone working in java has to work with objects somehow
 
I started my real learning in OOP using headfirst books : Java, OOA&D, Design Patterns..
*waiting for reaction of @Unihedron. xD
 
me likes
 
Head First has, let's say, a non-traditional teaching style, but they're good. xD
 
The best way to learn coding is to learn by reading code. Unless you're a book person.
So far most text books for programming (as much as I've seen) deals with programming in a straightforward manner, where one easily gets lost when chapters references earlier chapters.
 
i learned a lot from headfirst, but i learned solidly from experience from those BIG errors in your face when you write code and googling solutions.. when reading solutions, you will know that what you are reading is either good or bad code
 
3:29 PM
@Unihedron yes
 
Yay debugging!
 
Dang it. My Eclipse crashes every time I try to rename a variable. xD
 
my coding style is kind of functional
i will start reading other codes
to improve and include oops
 
Good luck!
 
3:47 PM
Anyone want to help me port some Javascript to Java?
 
fge
Weee
Why not; pastebin?
 
@fge When the link dies the transcript will be broken.
 
fge
Hmm, that's a good use case for URI templates
 
They exist??
TIL!
 
fge
Of course they do
There's another Java project than mine
But yes, that's even an RFC -- RFC 6570
 
3:51 PM
Wow, that's amazing!
 
fge
Hmmm, I guess I should put more examples of templates
Reading an RFC is, well... Reading an RFC
 
4:25 PM
*unghosting avatar
xD
you still up guys?
 
OakBot Online.
Oak Bot by Michael. Build date: TODO
 
##help
 
oh shit.. its here
:D
 
**help
@Vogel612 I am JavaBot, maintained by Uni, Vogel, and a few others. You can find me on github.com/Vincentyification/JavaBot
 
##hepl
 
4:27 PM
**help
 
##help
 
@Lee Jeong I am JavaBot, maintained by Uni, Vogel, and a few others. You can find me on github.com/Vincentyification/JavaBot
 
**highfive
^LOL.
 
will not do a thing yet..
 
**eval:"Eek too many bots!"
 
4:28 PM
but alas...
: Eek too many bots!
just two e, huh?
**eval:"E"+"e"*5+"k, too many humans!!!"
: Eeeeeek, too many humans!!!
 
Hmm it's not working right...
 
**eval:"Gr"+"oo"*10+"vy sucks."
 
: Groooooooooooooooooooovy sucks.
 
fge
**eval: Files.exists(Paths.get("/usr/bin/java"))
Meh
 
> No such property: Files for class: UserScript
 
4:32 PM
OakBot Online.
 
>>help
Err...
 
**eval:File.exists(Paths.get("/usr/bin/java"))
 
> groovy.lang.MissingPropertyException: No such property: Paths for class: UserScript
 
hi, too lazy to google.. but does a value lose some precision when you convert a BigDecimal to a double?
 
**eval:File.exists(Path.get("/usr/bin/java"))
@LeeJeong make a guess?
 
4:35 PM
OakBot Online.
 
YES!
*socratic way.. always punches you in the face. Why do i even have to consider double in this situation..
 
congrats, that was obviously correct maybe, I don't use big* numbers.
 
fge
@Unihedron: Paths.get()
 
@LeeJeong true that.. floating point arithmetics are not 100% precise in higher order calculations.
 
@fge I don't think paths exists... :/
 
fge
4:37 PM
Meh, it's a standard class in JDK 7
Does that mean that Groovy only knows about JDK 6?
 
:O
We should ditch groovy.
Or at least implement something that works with .8
 
fge
Well, this is a Java channel to start with, so it'd be strange if the bot could evaluate things in other languages than Java...
Bah, not my call
 
Groovy is kind of Java though.
 
@Unihedron @Vogel612 i wonder if i should change my instance variables to BigDecimals since i originally made them as doubles
 
fge
Except for the syntax!
 
4:39 PM
@LeeJeong depends on what you're doing..
 
currencies... so its BigDecimal?
 
fge
@LeeJeong if this is for monetary purposes you certainly should, yes; also, maybe you want to have a look at apfloat
It performs much better than Java's Big{Decimal,Integer}
 
apfloat??
 
can you give me a summary of apfloat on why i would choose it over BD/I?
 
4:41 PM
@fge I agree. We do need an actual java engine... !!java doesn't seem to work over groovy java class compilation either.
JavaCompiler time!
 
@Unihedron feel free..
 
\o/
 
please hide it in the ScriptRunner or a dedicated class please ;)
 
Of course ;)
 
fge
@LeeJeong performance, for one
 
4:42 PM
I'll keep everything as is, with an added !!eval-javac: command.
 
@fge is already included in the standard JDK?
 
This will be a great break from JCE, too
 
fge
@Unihedron if you are interested I have code using this API; however it lacks anything security-related since I only ever compile the class but never execute anything out of it
@LeeJeong no
 
oh.. i see.. too lazy to import. HAHA. :D maybe i'll just use it on another project..
got so many things *learned here.. so glad.
 
@fge :o we have the security manager established already though
 
4:45 PM
OakBot Online.
 
=help
 
OakBot Command List
about     Short description of this bot.
help      Displays this help message.
javadoc   Displays class documentation from the Javadocs.
shutdown  Terminate the bot (admins only).
 
=javadoc hashmap
 
@Michael java.util.HashMap: Hash table based implementation of the Map interface. This implementation provides all of the optional map operations, and permits null values and the null key. (The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.) This class makes no guarantees as to the order of the map; in particular, it does...
not guarantee that the order will remain constant over time.
 
Yay! :D
 
4:46 PM
:D
 
=about
 
Oak Bot by Michael | Source code | Built: TODO
 
#javadoc TimeUnit
@JavaBot 404...
 
=shutdown
 
@LeeJeong Only admins can shut me down.
 
4:46 PM
^so bad
 
It's equals sign, @Uni xD
 
((: there you go!
 
=shutdown
 
@Vogel612 Only admins can shut me down.
 
dammit
 
4:47 PM
=javadoc TimeUnit
 
lol
 
@Unihedron java.util.concurrent.TimeUnit: A TimeUnit represents time durations at a given unit of granularity and provides utility methods to convert across units, and to perform timing and delay operations in these units. A TimeUnit does not maintain time information, but only helps organize and use time representations that may be maintained separately across various...
 
haha
 
contexts. A nanosecond is defined as one thousandth of a microsecond, a microsecond as one thousandth of a millisecond, a millisecond as one thousandth of a second, a minute as sixty seconds, an hour as sixty minutes, and a day as twenty four hours.
 
=javadoc TimeUnit 2
 
4:47 PM
@Vogel612 Sorry, I never heard of that class. :(
 
shame on you I wanted to keep reading ;)
 
:P xD
I should add that feature.
 
after all you requested it ;)
 
I also want to add an http command to give you a description of the HTTP status codes.
 
anyways, I am right in the middle of breakingly changing the ChatInterfaces structure
 
4:48 PM
I think I did, but still. :P
Feel free, until JCE is done... :o
 
but I am not sure whether I will actually go that far..
 
@Unihedron I haven't upload the code yet.
 
posted #21
 
Off to lunch. Later all.
 
4:52 PM
Nope doesn't onebox yet.
Nice lunchin'!
 
lol thanks. :)
 
Night!
 
fge
5:08 PM
@Unihedron want me to provide a link to my code in the issue?
It may help -- or not
 
5:54 PM
**shutdown
lel someone forked the bot from my repo..
anyways I'm heading home, cya guys
 
6:23 PM
@Unihedron I believe I would have won that match, what do you believe?
 
7:03 PM
@Unihedron are you ready for rematch ?
 
@Vogel612 sir you still up?
 
OakBot Online.
 
=about
 
Oak Bot by Michael | Source code | Built: TODO
 
I've uploaded the code to github. :)
=shutdown
 
7:12 PM
Shutting down. See you later.
 
=help
**help
 
OakBot Online.
 
=shutdown
 
Shutting down. See you later.
OakBot Online.
 
=help
 
7:21 PM
OakBot Command List
about     Displays a short description of this bot.
help      Displays this help message.
javadoc   Displays class documentation from the Javadocs.
shutdown  Terminates the bot (admins only).
@Michael I don't know that command. o_O
@Michael java.util.ArrayList: Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. (This class is roughly equivalent to Vector, except that...
it is unsynchronized.)
 
fge
7:38 PM
@Michael why not just provide a link to the javadoc?
 
Hi all, am I free to talk openly and ask any questions here? first time here. Thanks.
 
fge
7:57 PM
@user3437460 don't ask to ask, just ask
 
8:13 PM
@LeeJeong not sir, but yes..
@user3437460 obtw. more concise...
no need for fluff around here ;)
 
 
2 hours later…
10:09 PM
Helloooo How s everyone ??
 
 
2 hours later…
11:39 PM
I'm really gonna miss my teacher sigh
 
05:00 - 14:0014:00 - 00:00

« first day (1496 days earlier)      last day (3439 days later) »