« first day (475 days earlier)      last day (3545 days later) » 

8:01 PM
:)
 
er
is there a readonly field in Java?
 
final?
 
@DanPantry final is what you want
 
that's it
any clues why maven test isn't running this jUnit test?
it's inside src/test/java and named PlayerKillHandlerTests.java
 
Do you have 1) A test class name ending on Test and 2) a test method starting with testXXX and 3) it annotated with @Test?
Where the third option is the most imporatnt one
 
8:09 PM
2) a test method starting with testXXX - no |:
I would have assumed that having something annotated with test would have been enough
that's rather annoying
prepending test to the method name didn't make a difference
sure enough renaming the file to say test rather than tests fixed it
that's... |:
 
try renaming your class. Tests --> Test
 
I think JUnit actually is fine with calling things only @Test, but IDEs seem to differ
 
I don't know Maven's logic for searching for test classes though
 
Nah you are right
renaming the class from tests to test fixed it
 
And I hope you imported the correct Test annotation
 
8:12 PM
I did
Now to find out how to force Eclipse to always run maven test -e
 
^ How is that helpful?
 
I'll say good night for now
 
nn
:)
 
'night @sim
 
> 2. Java is a great language to learn programming because the time it takes the garbage-collection to complete you can learn other programming languages
4
 
8:21 PM
Anyone here worked with SE chat for a chat bot?
If so, on openid.stackexchange.com/account/login is there a way to call openid.stackexchange.com/account/login/submit ? It is giving me a 404
 
POST it?
 
That's what I'm attempting
 
if you try and GET submit it will likely fail but POST should work
oh
 
Wondering if they forced users to use a web client or some sort of
 
I would doubt that
agh, wait
no, I know why
they probably have a authentication token in the form
if the authentication token isn't found when you submit the form it would either return 404 or 401?
probably bsing here but MVC uses a similar system
there you go
That's generated on every request
If you want to POST the form you will need to get that authentication token from the GET request and POST it with your form.
 
8:27 PM
ah okay, was thinking something like that, but confirmation is nice :)
 
that might not be 100% it, but it's at least 1 step of the way
by teh way, if you use chrome
Postman is an incredibly helpful chrome addon if you don't have it already
 
thanks again @Santa! +105 today! ..and only 41 short of 20K now!
 
0
Q: Mockable adapters

VoiceOfUnreasonThe inspiration for this question comes from a talk by IanCooper; in particular, this remark: Never mock somebody else's interface... you want to mock your abstraction of how you call the third party I'm implementing a monitor for our hadoop cluster; something that examines TaskCompletionEv...

 
Stack Overflow is nuts, in my opinion. Python question remains closed, despite upvotes on my Meta analysis. And a moderator is quibbling about subjectivity.
7
Q: Should we treat questions asking for idiomatic versions of code snippets as primarily opinion-based?

jojoOften people ask for language specific versions of some code snippets. For example a term that seems to be found rather frequently in questions with a python tag is "pythonic" and people ask for pythonic version of some (often already working) code. Personally I never considered this type of que...

 
haha
> Code Review critiques actual code from a real project, in its natural habitat
+1'd :)
 
8:40 PM
Great, it works @DanPantry
fkey = b3f6d6df-9bce-4526-8381-b06442d78527
HTTP/1.1 302 Found
 
@skiwi good job :-)
 
Now onto figuring out whether I am actually logged in :P
I guess subsequent command will just error out
 
Thanks @Santa! (again!)
 
grumble grumble
java isn't all that bad
grumble grumble
 
19,994
 
8:42 PM
Even javac is written in Java, it cannot be that bad.
 
w00t!!
 
You're welcome :-)
 
whistles
 
(mentally prepares for vote reversals)
 
@Mat'sMug Why, why am I out of stars.
 
8:43 PM
[mentally preparing intensifies]
 
user image
8
 
:)
 
Figuring I should create an account for my chatbot...
 
Grats!
 
thanks!
CR now has 7 20K users!
 
8:45 PM
Great job Mug!
 
:-)
 
That's a big milestone!
 
Wow. @Santa's been busy. Thanks.
 
PCG 20K users: 0
 
@RubberDuck well you and Mug answer each other's VB questions a lot lol.
 
8:48 PM
@Phrancis that's why we need more VBA reviewers :)
 
Or we need less VBA in general ;p
 
VBA is great. Especially after you've got a IUnitOfWork and IRepository and SqlCommand and List and Enumerable and .... and... and...
 
Don't forget the Domain Name Service library and improved Win Registry library.
Good grief we abuse that poor language.
 
0
Q: UniqueList Class in VBA

ptwalesI often find myself abusing dictionary objects just for the exist method like this, For Each x in Something If Not dict.Exists(x) Then dict.Add x, False Next x Then just exploit the .Exists(x) method. It happens often enough that I thought it merited it's own class. Instead of composing...

 
@CaptainObvious I love you!
 
8:52 PM
welcome to the kingdom of nouns ft. my crappy code
 
86 questions!
ok 85, one is closed
15 more to badgeability!
 
lol
 
You should really come to the 2nd Monitor sometime. I really enjoy seeing your questions. — RubberDuck 8 secs ago
 
So, type erasure: what implications does this have for me as a C# developer who is used to doing things like class TypeRepository : IRepository<Type>?
 
@DanPantry what do you mean?
 
8:59 PM
well, in c# i do stuff like IRepository<T,K> and have generic methods like T Get(K key)
would that be affected in Java? tldr are there any substantial idistinctions between type erasure and C#'s generics?
distinctions
 
oh that's a Java question
right?
 
I'm asking about the difference between Java type erasure and C# generics, yeah
 
I only know about JAVA, sorry :/
(and C# generics ;)
 
yeah I don't write much Java
I thought it'd be the same between the two
 
9:02 PM
apparently there's a difference in that type erasure erases types at runtime
obviously that has implications for runtime inspection
 
Jun 30 at 20:35, by Jamal
@Mat'sMug brb synonymizing [JAVA] and
 
I'm out fellas. Have a good one.
 
later! (TTQW here)
 
Bye ducky!
 
@Phrancis TSG
 
9:05 PM
^ Meta Meta meme
 
@DanPantry I don't know exactly how C# works?
but in Java no type information is kept at runtime
 
@skiwi in C# if you create a generic parameter the information of that generic is retained at runtime. You can also do stuff like new Mock<T> which will generate a 'proxy' around T with all of it's methods and all that jazz
I guess that answers my question then - generic repositories won't work in Java. At least not with mock(Class<T>)
pft :(
 
> 13. Finding things about Java on the web is incredibly simple thanks to the “Yahoo! Toolbar” which gets re-/installed with every Java update.
 
@DanPantry A normal pattern in Java is to provide a Class<T> whenever needed
 
Sorry, just have to announce a question + answers with low votes:
3
Q: Android audio player

Ankit GargI want to implement basic audio functions like play, stop and pause. I have stuffed all the code inside onCreate method. Is this best practise to follow? public class MainActivity extends Activity { Button start,pause,stop; @Override protected void onCreate(Bundle s...

(Writing in my sleep, almost)
 
9:09 PM
@skiwi: that's fine, but what I am trying to do just won't work with type erasure
@skiwi: because what I was thinking of relies on having generic info @ runtime
 
@DanPantry Care to share?
Sharing is caring!
 
Hey, what's this? @Mat'sMug is finally at 20K? Congratulations! Not a day too soon!
 
@skiwi: mockito's mock(Class<T>) on a Class<T<K>>
ie, class I was trying to mock has a generic parameter of it's own
you CAN do this: (T<K>) mock(T.class) but that gives a compiler warning and it does feel hacky as well
the real scenario is that I was trying to mock a generic repository..
mock(IRepository<Rank>.class) is obviously invalid syntax
but, oh well :P
 
I'm so sick of seeing this zombie in Unanswered questions... it's so ugly
2
Q: Optimize web-scraping of Moscow grocery website

MubinThis code works fine, but I believe it has optimization problems. Please review this. Also, please keep in mind that it stops after each iteration of the loop foreach($mascow_sub_area as $subway). <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <?php set_time_limit(...

 
@DanPantry I'm afraid that scenario indeed gets hard.
 
9:12 PM
I'll just have to leave that class untested. To be truthful it was testing a 3rd party lib so not necessary anyway
 
Good work, @Mat'sMug. Now we have 7 more 20k users than Code Golf.
 
@skiwi obviously the right answer here is to have IRepository<T> have a non-generic implementor TRepository which you then mock
or ITRepositoryI should say
 
0
Q: The code is a simple data structure, I wonder what is the most optimal version would look like

RafazZI was told here that I should post my code here for review. The code is on uploaded on GitHUB to avoid long codes here. The code is not for any project, I just want to know the best coding practices. Thank you

 
@SimonAndréForsberg I got a little help from santa :)
@200_success thanks! (they'll never catch up!)
 
@200_success And, if calculating the percentages, we have infinite more % 20k users than Code Golf
 
9:15 PM
" The code is on uploaded on GitHUB to avoid long codes here. because I'm lazy and can't be bothered to read the guidelines."
 
9:30 PM
@200_success SCORE!
 
9:47 PM
0
Q: SwingWorker which gets paused by a Timer

Sillicon TouchI made a SwingWorker which is fetching tweets using the twitter4j API. The twitter API will allow 180 queries every 15 minutes, and then throw an exception with code 88 which says that the rate limit was reached. My worker is initiated from a toggle button, if the button is selected and no othe...

0
Q: More efficient and readable nested loop

WesleyI've created an algorithm which weighs the relevance of a list of articles against two lists of keywords that correlate to attributes of the article. It works great and is super efficient... but it's a mess. It's not terribly readable, so it's difficult to discern what's going. The operation in...

 
6pm YAY WEEKEND!
drops from chatroom for a while
 
10:14 PM
0
Q: Pausing a SwingWorker with a Timer

Sillicon TouchI made a SwingWorker which is fetching tweets using the twitter4j API. The twitter API will allow 180 queries every 15 minutes, and then throw an exception with code 88 which says that the rate limit was reached. My worker is initiated from a toggle button, if the button is selected and no othe...

0
Q: Tail recursive sort

CeleritasI read from here that quicksort can be tail optimized. I tested the code given and it didn't work: TAIL-RECURSIVE-QUICKSORT(A, p, r) while p < r q = PARTITION(A, p, r) if q < (p + (r-p)/2) TAIL-RECURSIVE-QUICKSORT(A, p, q-1) p = q+1 else TAIL-RECURSIVE-QU...

 
11:14 PM
0
Q: Creating New Scripts Dynamically in Lua

bazolaRight now this is just a crazy idea that I had, but I was able to implement the code and get it working properly. I am not entirely sure of what the use cases would be just yet. What this code does is create a new Lua script file in the project directory. The ScriptWriter takes as arguments th...

 
11:41 PM
@RubberDuck I think my not-so-clean cleanup is because I'm passing it to the presenter as a reference (ByRef). I'll test it with a copy (ByVal), I have a feeling that it should correctly update the reference counter under the hood, and release the uow instance.
UnitOfWork is a dependency of the Presenter class, not of the Repository ;)
Should I update the post with a Presenter implementation?
 
0
Q: Optimize the below C code and reduce time complexity

Debasish PatiQuestion with Explanation A Magic Fraction for N is one that has the following properties: It is a proper fraction (The value is < 1) It cannot be reduced further (The GCD of the numerator and the denominator is 1) The product of the numerator and the denominator is factorial of N. i.e. if a/b ...

 

« first day (475 days earlier)      last day (3545 days later) »