« first day (1477 days earlier)      last day (3463 days later) » 

8:31 AM
1
 
fge
9:12 AM
Moo
 
meow
 
9:46 AM
@Unihedron hi
i need your help
for the answer given here:
0
Q: Query on clarification about RunLengthEncoding() constructor

overexchangeFor the Part III assignment given in link, Part III: Converting an Ocean to a Run-Length Encoding write a RunLengthEncoding constructor that takes an Ocean object as its sole parameter and converts it into a run-length encoding of the Ocean. To accomplish this, you will need to implement ...

And an abstract factory which will build objects from a String like so:

"." = Empty
".2" = 2 x Empty
"F.2F" = Fish, Empty, Empty, Fish
"S2,2.FS3" = Shark (hunger 2), Shark (hunger 2), Empty, Fish, Shark (hunger 3)
i know how to convert String to another type
but i did not get, what is abstract factory
how do i implement this?
currently my code returns string like this..
String obj; obj = nextRun();
now obj points to one of the string examples given above
 
i have separate Shark Fish Empty claass that inherit Critter
am at a stage where i understand only abstraction encapsulation polymorphism
i used these concepts in my assignment till now
do you think am jumping directly to something non-obvious
?
called abstract factory
 
fge
@overexchange remember that design patterns are not an exact science
They are tools
You cannot implement a given design pattern "to the letter"; you have to understand code examples and do it yourself
 
@fge i got u
am checking an example and let me check how this fits to my code.
thank u
 
10:35 AM
What these terms mean - DAO, POJO, Model ?
 
@SunilSharma Have you googled, dear wanderer?
If you would like to see a (new) feature implemented in the chat bot, please submit a new ticket in this issue tracker.
 
@Unihedron dear i have Googled but i think it is better to obtain knowledge live. Coz my cross question will be resolved at the same moment .
 
@Unihedron I have java String like "E4" or "S2,2" or "F3" where i need value immediately next to first element which is always character, what can be the regex to apply if i need to use String.split()?
 
10:51 AM
@overexchange Huh?
 
"E4" should give 4
 
Can you give test cases with their expected outputs for the regex? Since the specification is not very clear.
 
"S2,3" should give 2
"F3" should give 3
 
So... Is the "number" always the first number occurence?
 
fge
10:53 AM
That ocean stuff again?
Regex is not the solution here
 
@fge yes
Can't we use existing method of String class that can fetch this number?
 
I was thinking the same, but you can use: string.replaceFirst(".*?(\\d).*", "$1")
 
fge
11:08 AM
@Unihedron I thought we agreed that Suppliers.ofInstance() was wrong here?
 
@fge Fixed on local untracked dev branch, I'll push with the next commit when I finish the cherry pick sequence :)
 
fge
Hmm OK
No need for me to open a pull request then :p
 
Actually, not doing that will be a great idea, since that means it's one less commit for me to cherry-pick.
 
fge
Hmm, lambda abuse detected!
 
15% complete..
@fge Lambda? Where? :P
 
@fge Isn't it such an accurate and appropriate use of chained lambda expressions? :P
Anyway, I'll have to ditch that line so I can work with non-chat message events as well.
 
fge
@Unihedron do you really want me to tell? :p
Anyway, I can't really help since I don't know the chat protocol at all
I could RE it but it'd be better if it were documented
 
@fge xP
@fge Me neither.
 
fge
11:42 AM
@Unihedron I take it the chat code is not yours?
 
@fge Partially.
How I really should resolve merge conflicts:
* Create new branch
* Test changes
* Confirm that it still works; Merge
How I actually resolve merge conflicts:
* Discard parts of files, merges and hopes it works
 
fge
Hmwell, git merge --abort exists
 
... :O
 
fge
And also git reset --hard if you cherry-pick
Still, the better way is always to have short commits ;)
You can also rebase instead
 
Well, I constantly reset when I mess up a pick.
What's rebase?
 
fge
11:57 AM
@Unihedron instead of merging two branches, apply all commits from a given branch on top of another
git will of course be smart enough to determine the common ancestor by itself
@Unihedron it is generally a good idea to rebase your local branches onto the main branch regularly, this makes for less conflicts to resolve when you eventually decide to merge
But do not rebase a "published" branch!
 
Oh I see! Thanks for the explanation, it's very concise.
 
12:32 PM
test
test... ?
!!eval: "Hello World"
... test?
test
t
 
1:18 PM
 
2:07 PM
so few people here today
 
:(
weekends..
I'll tell a story: I don't edit tag wikis on weekdays because I rather do something more productive, like coding. Therefore, I submit tag edit batches on weekends, when the pool of robo-reviewers are the smallest.
Which is unfortunate because on weekends tag wiki edits takes like an hour to go through, each...
Also, if you have some time @Gemtastic :P
4 hours ago, by Unihedron
If you would like to see a (new) feature implemented in the chat bot, please submit a new ticket in this issue tracker.
 
Well, I'd probably be sleeping still if it weren't for the neighbour blasting music and tv loud enough for us to well enough hear every word and chord
we were up 'til 5am playing a game :P
 
2:22 PM
Lol, really? :P
 
yeah, my better half and I started playing Divinity original sin :P
the game is as old as our relationship, but it's fun and kinda long.
 
2:37 PM
White hurts my eyes, but I have to turn off the inverted colors environment to be able to mess with CSS :(
 
Wut O.o
 
 
1 hour later…
3:51 PM
@Gemtastic If you're curious, it's done! :D meta.stackexchange.com/q/243259/266094
 
 
1 hour later…
5:03 PM
:O
 
fge
Hmm, interesting to know the answer: why does the parameter type T of Collections.max() is declared as T extends Object & Comparable<? super T>
(why Object, in short)
 
@fge When specifying an interface in ? extends clause, it is a matter of code style to use Object & Interface so that the interface is put after the & clause.
Keeping interface after &, if you shall.
 
fge
@Unihedron that's not the reason
 
Oh, really?
 
fge
But yes indeed, in A1 & A2 & ..., A2 and further must be interfaces
 
5:06 PM
Hmm, let me guess, so this can eliminate use of lambdas implementing functional interfaces?
 
fge
@Unihedron this is for two reasons; the first is backwards compatibility, the second is type erasure
 
:O
 
fge
@Unihedron the type erasure in T extends First & Second & Etc is First; and pre 1.5, this method didn't expect anything "better" than Objects as members of a Collection
Hence why Object first
 
cute :)
 
fge
Otherwise it would mean that pre 1.5, this method would have had to return a Comparable
 
fge
5:18 PM
Other question (don't google!): is is true that Float.NaN == Float.NaN?
 
noo
but Float.isNaN(Float.NaN) is true
I think
 
fge
@Unihedron yes, true; however, there is another way: Float.compare()
 
:O
 
fge
Float.compare(Float.NaN, Float.NaN) is 0
 
:P
 
fge
5:22 PM
Hence, in objects where you have float fields, on .equals() you should use Float.compare() instead of == to compare the fields, since the result is reliable
 
Clever!
 
fge
Same for Double, and (yes) with BigDecimal you should also use its .compareTo() method if you want numeric equality
(because new BigDecimal("1") is not equal to new BigDecimal("1.0"))
 
hmm...
 
fge
Anyway, enough idle talk
 
HmmMMMmmm...
Night!
5
Q: How to trigger calls to .serializeWithType() of a class implementing JsonSerializable in Jackson?

fgeThis is Jackson 2.2.x. I have a class implementing JsonSerializable; there are two methods to implement for this interface, serialize() and serializeWithType(). I want to test {de,}serialization of this class, and I can trigger calls to serialize() easily; not, however, serializeWithType(). Th...

me plans to write a book
 
fge
5:36 PM
Ah yeah, this one
I have yet to try the mentioned solutions
 
Wait until tomorrow ;)
Tomorrow is good
Night!
 
fge
5:56 PM
There are still many people mistakenly assuming that SO is a free coding service, it seems
 
6:09 PM
PLZ code for me, my boss needs it by tomorrow!
 
pls send teh codez
i want to make box for sql query is it possible if so i need that code.
what is teh codez to get rows from a column in htnl table with text in it.
i want to match if str string is a number pls help me write twh code
this ascii triangle code is broken, what should i do, pls give me the code thanks in advance
URGENT HELP NEEDED my boss wants me to mail this code by an hour, plz code it for me
I'm done.
 
fge
Sure, pay me $1k
Heh
 
I used to paste the link to freelancer.com in a comment, now I flag them as VLQ
 
fge
freelancer.com sucks
 
They get declined sometimes, but the automated dowbvote is good
Like they deserve more. :P
 
fge
6:20 PM
Hmm, I just figured that it is possible to use the FileSystem API to program a "file system" over an entire SNMP tree
 
Huh, I found an easter egg on Chrome for Android.
If you scroll up in the tabs list when you're already on the top for too much, it flips a 360.
 
fge
6:38 PM
Heh, learned something again
Since 1.8, Iterator's .remove() has a default implementation which throws UnsupportedOperationException
This is so in line with what custom iterators are usually written
 
:D
 
fge
7:03 PM
I wonder; are InterruptedExceptions correctly handled everywhere?
 
7:18 PM
@fge not really...
well de facto the problem really is in the HtmlDocument, but given the fact there's a wrapper around Links I was expecting to be able to call methods without gettting unfixable exceptions thrown into my face...
 
fge
@Vogel612 oh, you're talking about my reply on the github issue
 
yep ;)
 
fge
@Vogel612 maybe then you want to keep a reference to the "root URI" and .resolve() the result of .href()
But honestly, Java's URL sucks
 
the call to .href() blows up already..
 
fge
URI is better, but still "not really there", shall we say
 
7:22 PM
I didn't do anything, really...
that thing is supposed to return a URL, but I can't even Log it properly..
that said, even submitting the login form blows up with the same error now.,
 
fge
Well, I don't know mechanize but it seems to either suck or have very bad documentation
 
mhm,.. looks like both here...
there's no javadoc in the maven-packed dependency...
and stuff just blows up in your face..
 
hi all..
 
fge
Hmm, that reminds me of TWA: Try With Another
:p
 
looks like it..
I think I'll just drop the current status into a branch... and get back on track to HtmlUnit T.T
 
fge
7:31 PM
Still, htmlunit seems like the wrong tool to me
Maybe I make too much a fuss about the "unit" suffix
 
yes you do..
 
fge
OK, googling it
 
now I also understand how you got onto the testing Track...
gargolyesoftware...
 
fge
Eh?
Well, OK, I just read the first paragraphs of the homepage, so I was indeed biased, sorry for that
But still, you shouldn't have the need to "emulate browsers", what you really need is HTTP support, right?
 
I need someone to keep track of the cookies and add the correct http headers...
else the requests for new messages (and for chat-events containing "recieved" messages) will get rejected
sure I could write a browser from scratch doing that for me, but that's simply overkill
also at least the chat-login is https: even though the chat isn't...
 
fge
7:45 PM
Well, all of these don't require any specific browser support
 
oh great.. the error even shows up in forms that have a relative url as action..
 
fge
8:47 PM
@Vogel612 well, I don't know the purpose of your library, but maybe mechanizer is not what you want
 
@fge hmm... maybe..
that said, the guy who has made it work gave me a few hints maybe I can get it running without having to hack too much...
 
fge
@Vogel612 by any chance, is it a "general purpose SO chat" library? @Unihedron hinted me earlier that in fact there wasn't one, and that the "chat protocol" was not documented either
(probably because they don't want bots swarming in there)
 
nope there isn't..
yes probably..
the StackExchangeAPI only exposes sites' posts and users..
 
fge
So, uh, JavaBot is basically an "undercover effort"?
Not that I have anything against it, mind, I was just wondering
 
well it's not even really undercover.
there's some other bots running around...
for one there's the Phammilator, and the good old JS-Bots, that are uncountable already.
 
fge
8:53 PM
Hmwell, in that case, coming up with a generalized API in Java would be OK, right?
 
then there's smokey that's written in python IIRC
why not?
I'd reconfirm with the team thogh..
 
fge
Not sure how far the effort went with JavaBot (I don't know the protocol, cannot tell) but it'd be a good opportunity to "compartimentalize" the code there
 
yea I tried before I got sucked into this hole...
a part of getting sucked into the hole I am currently in was the intention to properly hide the implementation details for communication against the chat-"API"
 
fge
OK well, just one thing because I have to step AFK for a little while... Why isn't there a class for instance for a SO chat room?
Also, you may be interested in this: github.com/fge/uri-template
Although this is not the only implementation of RFC 6570 out there
But if you want to build URIs...
 
um... the problem is mostly that the host-part isn't known when the request is sent..
and no implementation of RFC-6570 could ever hope to help that...
 
fge
9:23 PM
But when you receive a chat message you have sufficient information to know what chat room it comes from, right?
 
@fge sure I do have...
the problem's just the sending..
on chat.se domains mechanize doesn't log in properly
on chat.so domains something's ... fishy...
because it doesn't even recieve messages there
 
fge
Something is off here; you don't need to log in each time, right? You must have a cookie or something telling the other party that you are logged in already?
 
yes... that cookie isn't getting set properly
because the code doing the requests for that blows up
 
fge
Uhm, so how does JavaBot work at all in this case? Also, isn't there a builder/factory for outgoing messages?
Sorry, I'm unfamiliar with the code
 
why would there be??
a message going out is simply text..
you send a post with two params against http://chat.stackexchange.com/rooms/{roomnumber}/messages/new and that's it
 
fge
9:31 PM
Why?
Simple: a factory can retain the common elements
You'd just have to factory.withText(theText).generate(), and this would give you a fully authenticated message, with the correct content etc
 
well then the MessageRelay we have is exactly that... just that it isn't built in a chained way..
 
fge
Ah yeah, I was quite dismayed when I saw that code :p
 
because: factory.withText(theText).generate() is simply overkill for params.put("text", theText); params.put("fkey", fkey);
 
fge
I don't think so
 
why that?
 
fge
9:34 PM
Well named methods convey the intent
And that makes for clearer code, and more modular code
What if, tomorrow, the name of the parameter has to change, or the way the text is encoded is different?
 
MessageRelay.sendMessage(SESite site, int chatId, String message) {
 
fge
Well, yes, this, imho, is not OK
 
@fge I fail to see the point you're trying to make in your last question
you still have a centralized place where the messages are "assembled".
and if that changes, the factory would also have to change
especially since the concept of a Message does not exist...
 
fge
That was but an example
Ultimately that makes the code more modular and more easily modifiable/extensible
 
while that's correct, you still have to write params.put("text", theText); params.put("fkey", fkey); somewhere
where you do that is completely irrelevant actually
 
fge
9:37 PM
Yes, that would be part of the message builder
I mean, the key is linked to the room anyway
 
and hiding it under n layers of abstraction doesn't help anyways..
ohhh waait
 
fge
Yes it does
;)
 
okay back back back
Message is not the thing the bot sends..
but the thing the bot parses
 
fge
You mean to say it does not dispatch properly?
 
It's completely and utterly impossible to decouple the process of sending a message from the agent instance that is in the chatroom.
what now?
The bot properly parses messages coming from outside.
 
fge
9:39 PM
Well, there has to be a set of invariants
 
It just can't "send" messages.. which probably is what you mean by dispatch..
 
fge
And that set of invariants must be able to properly identify the room it originates from and how messages should be sent back
 
I think that assumption is incorrect
this set of invariants is nonexistant
 
fge
Sorry, I can't take that
It has to exist
 
there are at least two such invariant sets..
 
fge
9:41 PM
Either a socket, or on a received network payload, part of that payload telling where it comes from, and from whom
 
you're jumping through abstraction layers here
 
fge
It has to exist, otherwise it would be impossible to program a bot at all!
 
keep in mind all this happens on HTTP
 
fge
Yes, so what?
HTTP payloads have data
 
sure somewhere there is sockets, but not in the code we're talking about
 
fge
9:42 PM
And they even have to go through sockets
Yes, sockets are often abstracted away in higher level abstractions
But they are there nevertheless
 
right...
what is your point concerning the JavaBot now?
 
fge
Well, my point is that if you have trouble sending/receiving messages, it means one of two things, or both: 1. the set of invariants are not correctly identified; or/and 2. abstractions over that set of invariants, and processes associated to them, are incorrect
 
I am currently mostly thinking 2...
 
fge
From what I've seen of the code so far, I suspect 2 as well
 
but you were mixing up the sets of invariants so I couldn't follow..
for a sent (bot)message it's irrelevant where the (user)message it is the result of came from.
 
fge
9:46 PM
Another point: the code doesn't look like it's testable
 
point taken
it isn't...
 
fge
Well, OK, at this moment I'm all talk, but if there is something in particular you need help with, just ask
I can turn the code into a "testing monster" little by little, using TestNG, AssertJ and others :p
 
Usually, I'm all talk here. I don't take these rooms TOO seriously, mostly because the conversation is over my head.
 
fge
@Vogel612 here is the kind of test that I write: github.com/fge/json-schema-core/blob/master/src/test/java/com/…
(OK, this one tests a rather complex class -- but it shows decomposition, mockito usage etc)
@Joe'sMorgue feel free to chime in with questions
@Joe'sMorgue stupid questions are questions which you don't ask ;)
 
10:07 PM
@Fge How do you chime? :P
 
fge
@Joe'sMorgue just post a message
Something bugging me:
1
Q: Where do I go wrong handling thread interruptions in this code?

fgeThis code is code written on a whim to help $someindividual asking for such a thing on $somechatmedium; what is needed is a way, in Java, to provide an Iterator over Path objects which must only be directories, recursively, and where the number of returned instance number in some sufficient quant...

I am sure I am getting something wrong there; can someone hit the nail on the head?
 
Hello
 
10:58 PM
hmm
 
'sup joe?
 
Nada. My daughter got an Axolotl today
 
A what?
 
It's like a lizard that lives under water
 
11:08 PM
A mudkip!
 
The axolotl (/ˈæksəlɒtəl/; etymol. Nāhuatl āxōlōtl /aːˈʃoːloːt͡ɬ/ (singular) or āxōlōmeh /aːˈʃoːloːmeʔ/ (plural) "water monster"), also known as a Mexican salamander (Ambystoma mexicanum) or a Mexican walking fish, is a neotenic salamander, closely related to the tiger salamander. Although the axolotl is colloquially known as a "walking fish", it is not a fish, but an amphibian. The species originates from numerous lakes, such as Lake Xochimilco underlying Mexico City. Axolotls are unusual among amphibians in that they reach adulthood without undergoing metamorphosis. Instead of developing lungs...
Ours is white with blue eyes
I tried to write a program to put him in his new tank, but I couldn't figure out how to interface it with my daughter's arm...
[Now it's java related]
 
11:30 PM
Yep, that's a mudkip alright!
(I know what it is I just for some reason mixed it up with some new flashy electronics)
(mudkips are inspired by the axolotl)
 
11:47 PM
Your attaching flashy electronics to an axolotl?!?!?!!?!
 
No, but it is a nice name for a cool device
Like a ring with holograms coming out of it. "Check out my new axolotl! It can scan your face and 3D print it!"
 
fge
Hmm
 
fge
How is this Java?
 
Axolotl runs on java?
 
11:50 PM
We have to write code for the device...That could be java
Gem would decide, it's her invention...
 
Today, code the JavaBot
 
fge
Oh yeah? Java isn't really suited for VLSIs
 
Tomorrow, software for the Axolotl
 
fge
/me feels a topic slip
 
Monday, We do what we do every day, we try to take over the world!
 
11:51 PM
We'll buld a java OS
;P
 
Zoinks!
 
fge
@Gemtastic laugh about it, but it may be achieved
 
I know
Only the mind is the limit
 
fge
@Gemtastic you'd have to run a JVM as PID 0; with indy and a few native bindings, you could achieve a pretty darn decent OS, even in term of speed
 
Now I'm scared!
 
11:53 PM
:)
 
There are Java OS's already!
 
We know who's on the task of developing the OS ;P
 
fge
Mind you, the basic API of the JDK would need some modifications, in particular the Process API which is useless
(btw, indy == invokedynamic)
 
I've seen 500 invokedynamics!....
 
fge
@Joe'sMorgue as in 500 lambdas (since lambdas require indy)?
 
11:57 PM
No, as in the Indy 500
:P
 

« first day (1477 days earlier)      last day (3463 days later) »