« first day (13 days earlier)      last day (21 days later) » 
00:00 - 06:0006:00 - 00:00

12:44 AM
@retailcoder - probably better to move in to here ....
@rolfl properties... they're just a getter and a setter method, right?
1:00 AM
@SimonAndréForsberg over here
is there anything like a Nullable<int>?
alternatively noted as int? in C#
@retailcoder you could use Integer, but it doesn't exactly behave the same as Nullable in C#
wait, Integer is a class?
and int is a primitive type?
/value type
in Java, each primitive type has a non-primitive type correspondant
1:03 AM
crazy Java people I'm telling you!
Does that not incur boxing?
Integer i = 42;
int j = i;
^ that's perfectly fine though, they get auto-boxed and auto-unboxed

Integer i = null;
int j = i;
^ this would throw NullPointerException on the second line
And do classes have a default parameterless constructor?
unless you specify one of your own
ClassName varName = new ClassName();
same as C# there.
can't be chained can they?
chained how?
1:06 AM
public SudokuDigit() : this(null) {

public SudokuDigit(Integer value) {
this.digit = value;
I guess that's redundant in this case
public SudokuDigit() {

public SudokuDigit(Integer value) {
this.digit = value;
this.digit would be null anyway
^^ that's how you do it in Java
1:07 AM
^^ lame.
^^^ much more logical to me :)
so how do you call a base class (superclass?)'s constructor then? explicitly from the constructor?
super(parameters, params, 42);
public SudokuDigit(Integer value) {

^^ for example
that's what I thought. So this means a derived type isn't garanteed to call the base constructor then?!
base constructors are always called
if there is an empty constructor available, that's called implicitly
otherwise, you MUST call one explicity or you'll get compiler error
1:11 AM
I'll stay away from inheritance for now
^^^ good to know
it's not that dangerous actually :)
meh.. I don't have a prospect for now :)
would this be a valid comment at the top of a constructor:

/// creates a new, empty value
depends on if you want to use "javadoc", which is a good way of commenting methods and stuff
1:14 AM
that was the intent..
javadoc begins with /** and ends like normal comments with */
/** creates a new, empty value
public SudokuDigit(Integer value) {
or you can of course put it on the same line, but it must end with */
works. Thanks!
@SimonAndréForsberg how do I throw new InvalidOperationException();?
otherwise it's correct
(bitches at lack of auto-complete)
Ctrl + Space
I believe there's a way to auto-activate it as well
among all the million Eclipse settings :)
1:19 AM
Missing setting: "Make my IDE work like VS"
I'll probably miss the setting "Make VS work exactly like Eclipse" in VS :)
So far so good?

/** Sets the current value of the digit.
* Specify Null for no value.
* Throws UnsupportedOperationException if value is not valid.*/
public void set_Digit(Integer value) {
if (!validateDigitValue(value)) throw new UnsupportedOperationException();
this.digit = value;

private Boolean validateDigitValue(Integer value) {
return value == null || (value >= 1 && value <= 9);
validateDigitValue can return primitive boolean
ugh. at first I was returning bool but it didn't like it..
thanks, that was the intent :)
otherwise it's quite good :) not 100% Java conventions, but I gotta save something for the review ;)
although please rename method to setDigit
1:26 AM
Done ;)
Gotta make some coffee!
Window -> Preferences -> Java -> Editor -> Content Assist
there's your settings for auto-complete, @retailcoder
Amazing! I learned my entire VB6 with IntelliSense!
(and MSDN)
for Java, Oracle's documentation will be your friend:
the java.util package contains a whole bunch of classes you'll probably look for sooner or later
1:38 AM
uh, Sudokudigit[9,9] isn't legal??
SudokuDigit[][] varName = new SudokuDigit[9][9];
So all multidimensional arrays are jagged arrays?
yup, unfortunately
I'm being a PITA right?
You really want me to respond to that, @retailcoder?
Current Weekend Challenge: Sudoku Solver
^ time to change the pinned message
and perhaps time to remove that you and Jamal can pin them? :P
1:42 AM
Thanks, forgot about that
Still can't accept the answer on WC#3
then it's still not time for me to start coding :P
time for me to take a shower though, then I'll be back for a short while and then it's bedtime
so if I want to get the length of SudokuDigit[][] digits, I go digits.lengthand that gives me the length of the 1st dimension; and then I go digits[i].length to get the length of each "row"
1:47 AM
2:12 AM
@retailcoder oh, what's the problem?
Any last-minute questions for me?
hmm anything other than jagged arrays for a 9x9 thing?
this is my hello world
I need to start with arrays
yes, you need to start with arrays
I'm so abusing UnsupportedOperationException
Ignorance is bliss!
or you could use ArrayLists I suppose :) But you can definitely expect @rolfl to comment on that in the review, if you do :)
2:16 AM
why are you abusing it? Writing all the signatures for your methods first and just throwing it until you bother writing the actual implementation?
public SudokuDigit[] getRow(int row) {
if (!validateGridIndex(row)) throw new UnsupportedOperationException();
return this.digits[row];
^^ this
I should just let it throw some "out of range" exception right?
either skip the check and let it throw ArrayIndexOutOfBounds automatically, or you could use IllegalArgumentException
Yeah I'll skip the check. It's not like me to put guard clauses everywhere like that
I expect that you're smart enough to avoid that that happens anyway
you won't call getRow(42) anyway, will you?
Bottom line, don't do in Java what you wouldn't do in C#
2:20 AM
^^ flip that & remember it when you do your C# :)
Should the current weekend challenge be shown in VERY BIG LETTERS somehow in this question? Like at the top of the question or something?
oh yes, I will :)
Although I'm not so sure it applies for C#... In Java, I wouldn't use LINQ... In C#, why not?
Oh you would if Java had it!
So an array is nothing special in Java right?
Yeah, I suppose :)
I mean, it's not an object that implements some IEnumerable interface
2:25 AM
depends on what you mean by "special"
^^ that
no, but you can use for-each on it
that just made my day
for (SomeClass obj : array) {
wait, that's a foreach?
2:26 AM
I don't get the syntax
simple, huh? :)
SomeClass[] array = new SomeClass[42];
for (SomeClass obj : array) {
so obj is your iteration instance!
couldn't be easier :)
putting that in practice just right now (implementing getColumn)!
2:29 AM
just out of curiosity, do you use digits[row][column] or digits[column][row]?
/** Sets the value of specified grid coordinates. */
public void setDigit(Point coordinates, Integer value) {
this.digits[coordinates.x][coordinates.y] = new SudokuDigit(value);

/** Sets the value of specified grid coordinates. */
public void setDigit(Point coordinates, SudokuDigit value) {
this.digits[coordinates.x][coordinates.y] = value;
(I'll end up deleting one of the two, just not sure which one yet)
I got it reversed?
ok, you use [x][y] at least, same as I do
your methods look fine :)
what's funny then? :/
2:31 AM
that you are not sure which one to delete :)
.oO(I'll probably delete the Integer overload)
...no... I'll probably delete the SudokuDigit overload
I'm honestly not even sure myself which one to keep
small suggestion though: One of them should call the other
right. that's what C# me would do :)
Then I think your Java you should do it also
So much better!
/** Sets the value of specified grid coordinates. */
public void setDigit(Point coordinates, Integer value) {
setDigit(coordinates, new SudokuDigit(value));

/** Sets the value of specified grid coordinates. */
public void setDigit(Point coordinates, SudokuDigit value) {
this.digits[coordinates.x][coordinates.y] = value;
2:36 AM
Look mama, I'm coding in Java!!
talk about a super-sophisticated and over-engineered Hello, World!
@Jamal ^^
@SimonAndréForsberg another thing: if I do SudokuDigit[] result = new SudokuDigit[9];, have I just created a 10-slots array?
nope, you will have indexes 0 1 2 3 4 5 6 7 8
9 slots
yeah, can't do that in C#, can you? </sarcasm>
lol I'd never even initialize a feakin' array in C#!
2:41 AM
oh, ok :)
LINQ dude, LINQ!!
I'll probably totally forget about that when starting C#
(miss it already!)
It's ok, I'll remind you when I review your code!
Well, C# doesn't have guava I believe :)
pffft. it's in the core libs.
2:42 AM
When used correctly, Guava is quite powerful. Although not as powerful as the upcoming Java 8 features of lambda expressions of course
you just gotta be aware of them I guess
Just so you know, LINQ is a set of extension methods (C# 3.0+) that extend any type that implements IEnumerable - that includes all arrays, List, Dictionary, and pretty much anything that can be iterated.
Works with lambdas
yeah, I'm aware that it works with Lambdas
will be interesting
gotta sleep for now
3:45 am. Dammit.
well thanks!
blames the fact that @retailcoder is learning Java
good night!
3:19 AM
3:52 AM
@retailcoder still alive?
Just set my Ding!
You planning on being up for a while?
@rolfl ding!
loud and clear.
yeah, although I don't think I'll finish tonight :)
3:53 AM
Watched a 3 episode Mentalist marathon with my wife.
HUsbandly duties done.
Free to help now.
So you do have a life!
Maybe I will start a Sudoku project.
Time to close down three other eclipse environments (bye-bye.... watson).
If you want my attention, make it ding, otherwise I'll probably not pay attention here.
@rolfl (ding!) why do I get an error here in `public class GridValidator implements ISudokuValidator`:

public boolean hasAllDigits(SudokuDigit[][] region) {
// TODO Auto-generated method stub
return false;
^^ it says "method must override or implement a supertype method".. wtf?
4:02 AM
Not sure, what's...
Ahh, the @Override annotation indicates this method overrides an inherited method.
If the interface does not have a method with that signature, then you can't use Oberride.
The genius IDE put that in automatically...
It probably means you changed something's name/type ....
how do I implement an interface then?
You appear to have done it right:

    public class GridValidator implements ISudokuValidator {
        public boolean hasAllDigits(SudokuDigit[][] region) {
            return false;
But ISudokuValidator needs a method:
public boolean hasAllDigits(SudokuDigit[][] region);
ugh.. ISudokuValidator wasn't saved.
4:05 AM
^^^ 'abstract method'.
And that's a smart IDE??!
Actually, yes ;-)
Ctrl-Shift-S saves all.
note to self: hit Ctrl+S like a paranoid fearing an imminent power outage.
You don't do that when editing something in Word?
nope. And I don't do that in VisualStudio either (and it did bite me more than once!)
4:34 AM
@rolfl is this normal?

import java.util.HashSet;
import java.util.Set;
import concrete.SudokuDigit;
import interfaces.ISudokuValidator;
Not really, no.
what is?
For this challenge, I expect you to use just one package.
Let me explain...
An import is only needed when the resource you need is in a package that is not your own package.
4:36 AM
could I just import java.util;?
Type Ctrl-Shift-O
It will 'organize imports'.
What's left?
package concrete;
import interfaces.ISudokuValidator;

import java.util.HashSet;
import java.util.Set;
This task is not likely going to be more complicated than will need to fit in one package.
import java.util; doesn't work
A package typically has a 'unique-to-the-person' name, like com.ibm..... or com.oracle....
No, that will not work, but: import java.util.*; will.
4:39 AM
I would expect your ISudokuValidator and your SudokuDigit and all the classes you create to be in just one package.
Simething like 'retailcoder.sudoku
ok I'll move them then. It's just this habit I have of starting a C# project with creating, say, a RetailCoder.Sudoku.Abstract namespace for abstractions, and a RetailCoder.Sudoku.Concrete namespace for implementations.
You can easily move classes in eclipse by being in the class and 'Alt-Shift-V' (v-for-moVe)
lol. obviously!
In that fialog it will even let you create a package.
It will make things easier for you if you have all your code in one package
4:41 AM
I guess so
but if I do import java.util.*; and then ctrl+shift+o it replaces it with the specific ones I'm using.
Here's a picture of My Package ;-)
@retailcoder - yes, it will. It is 'best practice' to import only what you need.
how do I know if the project still builds?
If you use Eclipse's autocomplete (Ctrl-space) it will automaticlaly add anything to the imports.
There's no red X's like I have on my Grid.
If there's nothing in "Problems" there's no problem anywhere in the project?
ah ok I see it
Problems can be configured.... by default it is workspace-wide... but you can change it to be on whatever-is-selected, and it's children.
4:47 AM
@rolfl ^^ what I have so far :)
Great... no warnings or errors.
You will probably want to remove the 'Sudoku' from the start of all your classes ... but that's purely cosmetic.
Everything in retailcoder.sudoku is something Sudoku.
yeah makes sense.. if I want to write a test, I just create a class with a void main()that calls my code?
is there not something more.. structured?
Officially I should recommend jUnit for tests.
You may just want to start with a main-method anyway.
and officiously?
actually... start right!
OK, follow along:
Right-click on our project 'SudokuSolver'.
Choose the 'new Source Folder'.
Type 'tests'.
you shoul dnow have src and tests ... right?
4:52 AM
new junit test case?
OK, in tests, create a package retailcoder. .... uh-huh!
you got it.
exactly why do I need a "package"?
It's a namespace.
but then why can I add a "loose" class/interface/enum/whatever in there?
So that both you and I can have a class called Sudoku, and they're different.
That's the default package .... bad practice.
4:54 AM
(although it is convenient when you are doing quick things without an IDE.
Create a package in your tests source folder... can be the same as your other package (should be the same).
oh.. I called it retailcoder.sudoku.tests :)
That's OK, but there can be some advantages to using the same package name.
You won't need to lnow that for a while though.
not gonna ask about UI stuff, but is there a Console I can output to?
It's on the bottom there, bottom right....
Maybe not shoing yet, @retailcoder
Window-show view-> console.
4:57 AM
It is output an input.
well I'd hope so!
I can't rename the test namespace to retailcoder.sudoku, says it conflicts with the other one...
Package 'retailcoder.sudoku' already exists in this project in folder 'src'
..but it allows me to 'continue'.. not sure it's a good idea
^^ @rolfl
no, not a good idea?
typing ... wait.
when you create package a.b.c.d you automatically also create a.b.c, a.b. and a
The question is just how you find them in eclipse.
5:00 AM
bah, I'll just keep it as is, no harm done.
hi @Jamal
learning Java, I am :)
Wait, this isn't the general room...
5:02 AM
I just saw "5s" on there (indicating that someone is talking now), and I joined the room.
There is no general room anymore - it's The 2nd Monitor now :)
Whatever. :-P
OK, @retailcoder... see this picture
My free-hand sucks.
drop that down, choose 'filters',
Un-check the 'Empty Parent Packages'
what does that do?
Have a look at your tests area now.
5:04 AM
Now you can 'easily' create tests in your retailcoder.sudoku package
and I deleted the .test and it wiped everything but the default package.. then I recreated retailcoder.sudoku under tests and ...no complaints :)
When you create a JUnit test, create a class called TestXXXXX where XXXX is the name of the class you want to test, and then also select that class in the dialog too.
Is a JUnit Test Case actually a class?
It will create test-stub methods matchin all the methods in the class you want to test.
yes it is.
It is a class with naming conventions (and annotations) that the JUnit test harness understands.
It can 'inspect' the class and automatically find the tests to run.
5:12 AM
Ugh. Is "testClassNameMethodName" a convention of some kind, or I can name my tests as I want them? I don't want just 1 test per method!
You can name thenm whatever you want.
Do you have the @Test annotation above?
(above the method?)
@retailcoder ?
OK, that's JUnit 4, which is good.
The only thing you need is that.
Whatever is marked with that will be tested.
wow I'm such a noob!
note to self: stop thinking in .net!!
That's OK, sersinsly.
5:16 AM
^^ is that a typo or it's another word I need to lookup?
5:32 AM
room topic changed to CR Weekend Challenge: A room to discuss weekly code challenges to be posted as CR questions for review [addicted-to-cr] [fun] [get-it-done-fast-trap] [weekend-challenge]
5:54 AM
Let's see if this works....
║   │   │   ║   │   │   ║   │   │   ║
║   │   │   ║   │   │   ║   │   │   ║
║   │   │   ║   │   │   ║   │   │   ║
║   │   │   ║ 3 │   │   ║   │   │   ║
║   │   │   ║   │   │   ║   │   │   ║
║   │   │   ║   │   │   ║   │   │   ║
@SimonAndréForsberg @rolfl I see what you mean with Eclipse being a great IDE: I see lots of functionalities that I use with ReSharper in Visual Studio. And VS without my R# feels... I see what you mean.
@retailcoder in one of your classes, type Ctrl-shift-F (for format) ... it will re-format everything in standard Java conventions .... (if you don't like it, type Ctrl-Z to undo).
00:00 - 06:0006:00 - 00:00

« first day (13 days earlier)      last day (21 days later) »