« first day (395 days earlier)      last day (3613 days later) » 

11:00 AM
No. @Jamal made an edit that OP appearently doesn't like.
This one has a history of editing comments into his question.
 
Monking all.
 
Monking @rolfl
 
Monking @rolfl
 
@Jamal you might want to avoid editing that question further.
@ckuhn203 I've edited the post and removed that part. Thanks for notifying.
 
Flags, flags! Nom Nom Nom
2
 
11:05 AM
wimp.com/monstercovers (Cookie Monster singing "Call me maybe", just something random)
 
@ckuhn203 lol it was the question, I was looking at your answer :)
@SimonAndréForsberg why do you tease me so hard? =>

PAGINA GEBLOKKEERD





Spijtig genoeg kunnen wij u geen toegang verlenen tot wimp.com.
http://www.wimp.com/monstercovers/

Rubriek: Media Streams
I gues even non dutch people can understand ^^
 
lol, as usual it's blocked for you. Does youtube works for you?
 
lol no, media stream ;)
but facebook is ;)
 
Well, in that case you're screwed @chillworld :)
 
11:20 AM
I am off, bye all
 
@SimonAndréForsberg well yeah, but the java tag badge I receive today makes it already better :p
 
Thanks @SimonAndréForsberg.
For the record, "Share it Maybe" was the best start to my day in ages.
 
hey Simon, I did renew the mine solution to the highest sum subarray question
still an n*n solution, but this is how I would solve it
 
@chillworld link?
 
0
Q: Fluent Nhibernate. Are mapping correct?

Oleg DobraHello im very beginner in NHibernate and DB. I have three tables which are connected with many to many relationship. Here are the tables creation Script: create table PATIENT_INFO(patient_Code int not null identity(1,1) PRIMARY KEY, PATIENT_NAME VARCHAR(30), PATIENT_ADRESS VARCHAR(30), PATIENT...

 
11:34 AM
6
A: Find the subarray with the max sum

chillworldIt's hard to say but if I get this with an interview, you will not pass. On the other hand, I'll find it good you come to here to learn. Number 1 is really red flags. Let's start with the review. 1. No public static void main(String args) with logic. I removed the comment lines to point it ou...

and I added the never use an int for counting ints together to :)
 
It's time that google understands what FXML is, and that it doesn't think it's XML.
 
@chillworld I have already upvoted though so I don't know what else I can do :)
 
@SimonAndréForsberg just tell if that should pass an interview test :p
 
monking
 
It was more for myself that I did added the "mine solution"
@BenVlodgi monking ben
but now we can see @skiwi 's question :)
 
11:48 AM
@chillworld I've never interviewed anyone so I have no idea :P It's a pretty decent OOP approach, it's probably not very effective but it gets the job done. Considering the rest of your answer, I'd hire you.
Hi @BenVlodgi
 
Whyyyy can this textfield not get focus :(
 
@SimonAndréForsberg thx, nice to hear.
@skiwi, click with your mouse in it :p
 
lol, share it maybe
 
Oh, both I and @Mat'sMug have passed @konjin's reputation now! Didn't even notice that.
 
@chillworld That's... ugly
 
11:53 AM
@skiwi :D
 
monking
 
@DarinDouglass monking
 
This solution is also rather ugly
root.getChildrenUnmodifiable().stream().filter(node -> node.getId().equals("TextField")).forEach(Node::requestFocus);
 
new user with a great question
1
Q: Fluent Nhibernate. Are mapping correct?

Oleg DobraHello im very beginner in NHibernate and DB. I have three tables which are connected with many to many relationship. Here are the tables creation Script: create table PATIENT_INFO(patient_Code int not null identity(1,1) PRIMARY KEY, PATIENT_NAME VARCHAR(30), PATIENT_ADRESS VARCHAR(30), PATIENT...

feed him
monking @DarinDouglass
 
@BenVlodgi indeed, very nice question
 
12:02 PM
Monking @Vogel612
 
@BenVlodgi He didn't capitalize his sentences #imdone
 
@skiwi Do you use something else then streams? :p
2
Monking @Vogel612
 
Monkig...
 
@chillworld Now I do...
I just fixed issue
 
lemme just do that stuff for work that I need to do even though I got holiday...
 
12:05 PM
FXML is awesome
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<BorderPane xmlns:fx="http://javafx.com/fxml/1" id="BorderPane" prefHeight="300" prefWidth="1200" fx:controller="com.skiwi.gui.simple.console.ConsoleController">
    <center>
        <TextArea fx:id="textArea" editable="false" />
    </center>
    <bottom>
        <TextField fx:id="textField" onKeyReleased="#handleTextFieldOnKeyReleased" />
Finally proper indentation, instead of building UI's via Swing or JavaFX using pure Java code
 
@skiwi that's why we use zk framework :)
example :
<?xml version="1.0" encoding="UTF-8"?>
<?page title="e-Bulletin" contentType="text/html;charset=UTF-8"?>
<?meta http-equiv="X-U-Compatible" content="IE=8" ?>
<?link rel="icon" type="image/x-icon" href="/img/favicon.ico"?>
<?link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico"?>
<?taglib uri="http://security/util" prefix="sec" ?>
<?init class="be.mil.cccis.web.util.WindowDataBinderInit"?>
<?init class="org.zkoss.zk.ui.util.Composition" arg0="/WEB-INF/webpages/ebulletin/user_template.zul"?>
 
Looks more difficult :P
Also, this is the complement of the code, last big thing I"ll be posting here :P
public class ConsoleController implements Initializable {
    @FXML
    private TextArea textArea;

    @FXML
    private TextField textField;

    @Override
    public void initialize(final URL location, final ResourceBundle resources) {
        Platform.runLater(textField::requestFocus);
    }

    @FXML
    private void handleTextFieldOnKeyReleased(final KeyEvent keyEvent) {
        switch (keyEvent.getCode()) {
            case ENTER:
                textArea.appendText(textField.getText() + System.lineSeparator());
 
damn chat, doesn't take the intendations
 
You need to press the buttno next to upload
then indentation works
 
well he's a little unfriendly...
 
12:10 PM
Fixed font or something?
 
ha thx
actually very simpel framework, MVC or MVVM approach
 
Does anyone else sometimes have trouble getting code blocks to format correctly? No matter what I do it wants to put it as plain text when I indent it.
 
in chat or on questions?
 
q & a
 
well the trick for me is : putting in netbeans
format code (alt shift f)
ctrl a (select all)
tab
and copy the whole thing
 
12:14 PM
You need to ensure that all code you paste has 4 leading spaces
 
haha.... it's just weird. I had to indent 8 spaces instead of four.
 
@ckuhn203 just copy - paste, and then press <kbd>Ctrl</kbd><kbd>K</kbd>
 
@chillworld Well, @skiwi does use Lambdas also...
 
meh..
 
@ckuhn203 if it's directly below a list item, you need 8 spaces.
 
12:15 PM
@ckuhn203 you sure you didn't use tabs???
 
@SimonAndréForsberg hits the nail on the head! Thanks
 
@SimonAndréForsberg aha never sawn that in skiwi, a Lambada dancer :p
2
 
@skiwi How far have you read in the AI book?
 
If it's under a list, you can also use --- to create a horizontal line
@SimonAndréForsberg Not that far unfortunately... More unfortunately as it's actually course material
 
@skiwi I'm at chapter 2 now, so I'm not far either.
 
12:17 PM
Current chapter is about "Quantifying Uncertainty"
(Chapter 13)
Need to prepare, with 3 other students, a lecture about that for Thursday.
 
well that's much further than I am :)
can I attend? lol
 
Well... if you travel :P
 
@skiwi then it breaks the list numbering...
 
@Vogel612 Ah... in a list it's 8 spaces, yes
 
@skiwi Has reading the book helped you in your steps towards making a game AI for your TCG? (or another interesting game?)
 
12:29 PM
@SimonAndréForsberg Not yet, haven't gotten to making an AI :(
 
@skiwi But did you get any ideas on how to make one in the future?
 
Not concretely yet, thoug there are interesting examples for sure
 
I'm trying to figure out how to combine my TCG with a MVC-approach
 
Ah, nice :)
 
12:33 PM
Let's say I have a ConsoleController, should the controller itself then start the game?
It is a controller after all
 
I'm not sure if how I do it is "correct" MVC though, but I have more or less stopped caring about the minor details. Some say logic should not be stored in Model, some say it's fine to have logic in Model, I say I have stopped caring about that :)
@skiwi What's the difference between the ConsoleController and the ConsoleView? (Assuming there is a ConsoleView)
 
Well the model is the FXML file, then controller = the controller, and view is CSS I suppose?
 
@skiwi controller should definitely not instantiate the game-class, but he may start it IMO.
 
I have no ConsoleView
 
Morning @Mat'sMug (226 bottles)
 
12:36 PM
What would a ConsoleView do in a regular MVC app?
(without specific framework)
 
@skiwi You call the Model the FXML file? I'd call the FXML file a part of your view. The Model is your CardGame classes IMO
 
@SimonAndréForsberg That could also be.. Then FXML = view and what you said
 
could it be that nobody really knows how MVC works??
3
 
nope :P
 
some colleagues of mine have the view and only the view as MVC pattern...
 
12:38 PM
@skiwi The class that holds your FXML is also your view I believe, and I think that is where you should instanciate your game model.
@Vogel612 I'm starting to see a resemblance between MVC and Programmers.SE...
 
@SimonAndréForsberg How you mean, holds my FXML? ^^
 
@skiwi The class which contains @FXML annotations, that's a part of the view.
Your main form that shows up when you start up your JavaFX app, that's where you should instanciate your game I believe
 
@SimonAndréForsberg That's the Controller
 
@SimonAndréForsberg I'd rather decouple that even further and just expose some API inside the Application and have something like:
 
4 mins ago, by Vogel612
could it be that nobody really knows how MVC works??
3
 
12:44 PM
I think it's really meant to be done in the controller...
 
public static void main(String[] args){
     GameModel model = new GameModel();
     View view = ViewFactory.getForDisplayType(DisplayType.CONSOLE);
     Controller controller = new GameController(model, view);
     Game game = new Game(controller);
     game.start();
}
 
When the application starts up, I create console.fxml, which in turns instantiates the ConsoleController, which shoudl then manage everything?
 
@Vogel612 Yes, that's a good solution. But what's the exact difference between Game and GameModel ?
@skiwi Do whatever works for you. I think no two programmers have the same understanding of how to structure code "correctly" into "MVC"
 
Game is a "manager" for all the stuff that needs to happen. GameModel would be stuff like: Cards, Monsters, Spells, Board, Player and Game is just ~ Program.java
 
12:47 PM
 pulbic class Game {
       //main method here
       public void start(){
            //startup logic, then move control to controller and wait to terminate
       }
   }
 
I didn't know you made a Swing version :o @SimonAndréForsberg
 
I don't understand the use for the Game class
@skiwi I have, but it's not at all as pretty as the GWT version.
The Swing version just contains a bunch of buttons on a bunch of JPanels
2
 
@SimonAndréForsberg sonewhere you can catch top-level exceptions and handle them...
 
Organized in a quite chaotic way
 
IMO the View doesn't even need to know the Model....
 
12:50 PM
I go by the motto: The View can know about the Model, but the Model should not know about it's View.
Personally though, I'm not even sure if I have a Controller or not, or what that Controller is, if I have one...
 
@SimonAndréForsberg You might wanna take a look at my question then,...
I think that's pretty nice Controllers I have put there,,,
 
I'm still confused by JavaFX... At least I was intending to seperate the GUI from the TCGGame, but seems like that is not the goal in JavaFX
 
4
Q: Show Details of an Object while allowing interactions with it and dependent objects

Vogel612Description To make it simple, this code is the Controller Packet corresponding to a View with multiple tabs. All but one of these tabs are showing a list of dependent entries. This Construction was once a single class, that did everything and I thought "Why not refactor that thing?" So I began...

 
@skiwi I don't think JavaFX limits you in separating GUI from the TCGGame.
 
12:54 PM
I think I should just stop thinking that I can reuse non-model code for both the console-version and the real-gui-version
 
Hey, I recognize this question format.... It's my review-preparer in action! :)
 
yep ;)
you maybe remember I ha problems with the java-version..
 
@skiwi Yes. Non-model code has to be rewritten. (At least I haven't shared any non-model code between my Swing and GWT versions)
Ah, yes. You tried using Java 6 :)
 
exactly...
 
Couldn't handle all new features in Java 6?
 
1:01 PM
@skiwi nope, ReviewPrepare wanted 7, even though It told me that the version number was invalid
 
This also probably means I should store cards and player related data in some space
Should I prefer public final attributes in a class or a singleton enum with getters to hold all my data? (The cards, etc.)
 
@skiwi Doesn't your game already hold that?
@skiwi Give me everything except a singleton or give me death!
Although I considered using an enum for cards in my game (one of them).
 
@SimonAndréForsberg Nope... Unless a Collection<Card> defined adhoc counts
 
I would have used enum if it would have worked with GWT...
@skiwi If the Collection<Card> is inside your game class, then that counts I'd say
 
@SimonAndréForsberg But it takes up precious lines
Which I don't care about :p
 
1:06 PM
@SimonAndréForsberg something against singletons?
 
@chillworld I rarely think that they're needed. I prefer to make things flexible. Singletons restricts flexibility.
 
public final class with all static methods?
perfect to make sigleton
 
But what is the class used for?
 
and for the rest I mostly use enums
example : search the subarray with max sum :p
 
And what's the harm in instantiating it twice (or more), other than the performance aspect of creating an object?
 
1:09 PM
monking!
 
mem aspect
 
Monking @Mat'
 
I see no need in creating an object just to call a method on it (a method that doesn't have any side-effects)
 
monking @Mat'sMug
 
@SimonAndréForsberg told 'ya!
I can only catch up another 90-105 rep today before I hit the cap... and you seem to be at cap-70 - the cap keeps the gap wide open! :)
 
1:13 PM
@SimonAndréForsberg don't take me wrong, some people are using singletons to much, other to less. I find they are needed at correct places. (and I put enums under sigletons)
 
@ckuhn203 Debug.Assert has no effect on production code, but it will break in the debugger if the assert fails.
 
Cool @Mat'sMug. I wasn't sure.
 
an abstract factory could be a singleton.
@ckuhn203 congrats, you've earned my last vote for the day!
 
in abstract factory pattern you NEED a singleton
 
hahaha. Thanks.
 
1:15 PM
@chillworld I find singletons quite useful for logging and storing application-wide factories (to have one regular EventExecutor and one EventExecutorGWT for example - true story), other than that, I don't see the need for singletons.
 
@chillworld why do you NEED a singleton?
 
I take it I'm giving decent answers then? I hope so. I came here because I have never had or given a code review before.
(No. We do not have code reviews at my office. It's atrocious.)
 
I can relate to that
@all, is this a decent answer from a new user? ;)
1
A: "Scripting.FileSystemObject" Replacement module in VBA

ckuhn203Once you've fixed the things that could potentially crash your code and added some proper error handling you should go back and take a look at some style & readability issues. Remove the underscores from your variable names. Style conventions say to use camelCase. file_path should be filePath, ...

I think so :)
 
@Mat'sMug oke I shut up :) Just search the pattern up and they are not speaking of singletons in it. On the other hand, they teached me with the singletons :)
 
What Q started the single discussion anyway?
 
1:19 PM
@chillworld the Design Patterns Bible (GoF) does mention singleton usage with abstract factories.. but it's not an obligation ;)
it makes sense to only have a single instance of an abstract factory, but only from a "don't spawn instances you don't really need" standpoint.
IMO
 
I had once seen a nice variant of the factorypattern
 
@ckuhn203 dunno.. to me this would be the continuation of yesterday night's chat about singletons :)
 
using enums
 
Java enums are weird
 
That's why I was asking. It's been on topic here for some time now.
 
1:21 PM
and the enum contains for example FORD, AUDI
and only she had to do was a variable of the enum .buildCar()
and she had a car of type Ford or audi
 
gotta work a bit, or I'm going to get in trouble here.. catch you later!
 
@Mat'sMug Why?
 
"It's compiling" or "I'm waiting for this query to finish running" are always good stand bys.
 
@ckuhn203 I have found something better now => looking for memory leak in a hprof file (takes approx 7 min for each click to load again)
 
1:33 PM
0
A: Asking a user to take money from a checking account and move it to a savings account

Eric LippertIn addition to all the other good points mentioned: This code massively mixes up presentation logic, business logic, and back end database implementation details. Those are three separate things; they should be kept far apart in the code. This code has "sql injection attack" written all over i...

@skiwi Java enums are a totally different things than what I learned an enum was. How are they different from classes in Java, if they can implement some logic?
 
@Mat'sMug Cool, I didn't know how banks exactly worked
@Mat'sMug They are very similar to enums in other languages, just added more on top of it
 
lol I meant to say "look, Eric Lippert is among us!"
 
enum Color { RED, GREEN, BLUE }
Is understandable, right? ^
 
yup
although enum Color { Red, Green, Blue } looks much better ;)
 
No, it doesn't!
Well, matter of style I guess
 
1:37 PM
@Mat'sMug no enums always capital
 
I do thinkt he way generics and enums play together is very interesting
 
indeed
 
as enum Color is actually enum Color extends Enum<Color>
Hence(?) you cannot manually extend an enum
2
 
^^ that
 
1:38 PM
@Mat'sMug Do you write public const int VALUE = 42; or public const int Value = 42; ?
 
So if you want a method to only accept enums... <T extends Enum<T>>
 
public const int Value = 42; ...the IDE makes it very in-your-face easy to tell a constant from any other public member
 
0
Q: Callback on AlertDialog

JonesVI am using an AlertDialog in Android, asking the user for some input. I would like do run some code when the user has finished entering her input. Since an AlertDialog is asynchronous, my code is not waiting for it. Therefore, I decided to use a callback, as in the following sample code: This i...

 
@skiwi is that a generic type parameter constraint?
 
@Mat'sMug In Java, the convention is to use static final int VALUE = 42; Enums are essentially a class that is not instanciable, as all it's possible instances are already public static final members of the enum class.
 
1:41 PM
@Mat'sMug Yes as in...
 
The big difference is that in Java, enums can contain methods. (Ha!)
 
public <T extends Enum<T>> T passthroughForEnums(final T enum) {
    return enum;
}
 
@SimonAndréForsberg the big advantage ;)
 
as in DoSomething<T>(T value) where T : enum (I don't think this compiles in C#)
 
@Mat'sMug Ha!
and... more funky stuff
 
1:42 PM
@chillworld Indeed, the big advantage. I missed that feature when I wrote my Sudoku solver in C#
 
public <T extends Enum<T> & Serializable> T passthroughForSerializeEnums(final T enum) {
    return enum;
}
Or from a real program of mine... Though the bug has been fixed in a library, so tomorrow I'll get rid of this method ;)
static <T extends Enum<T> & IntValuedEnum<T>> T getEnumValueFromPointer(final Pointer<IntValuedEnum<T>> pointer, Class<T> enumClass) {
    IntValuedEnum<T> pointerValue = pointer.get();
    T[] enumConstants = enumClass.getEnumConstants();
    return enumConstants[(int)pointerValue.value()];
}
Note that IntValuedEnum and Pointer are objects from the library
 
@SimonAndréForsberg you could write extension methods to extend an enum type...
 
Ahhhhh, the joys of programming @chillworld.
 
public static void Foo(this System.Drawing.Color color)
{
    // stuff all the logic you want here, any System.Drawing.Color can use it now!
}
 
this and a type in one parameter declaration?
 
1:47 PM
syntax for a C# extension method
 
I'd love that on arrays in Java...
 
can enums in c# implements interfaces?
 
not that I know of.. wouldn't make sense...
 
I would think not
 
1:49 PM
In java they can :D
 
@Mat'sMug Extension methods are only local to one class I suppose?
(Unless imported?)
 
@chillworld what can you do with that?
 
@skiwi to a namespace. typically you'd put them in some .Extensions namespace and then with using MyProject.Extensions; all extended types have access to the extension methods
e.g. using System.Linq; unlocks a bunch of IEnumerable<T> extension methods ;)
 
I don't know what is the worst? When the teacher asked us in what language we wanted to code, mine answer was C# and was pretty sure never to use java again. Look at me now, coding in java :D
@BenVlodgi in some rare cases its handy :)
 
@chillworld any example?.. I'm struggle-bussing
 
1:52 PM
@Mat'sMug What happens if you use two namespaces which both have extension methods that have conflicting methods?
 
it blows up
 
Interfaces in enums is quite important in Java
 
42
Q: Why would an Enum implement an Interface?

unj2I just found out that Java allows enums to implement an interface. What would be a good use case for that?

3
 
@Mat'sMug What if you really need to use both :)
 
@skiwi you can call the methods directly .Extensions.MyExtensionMethod(params)
the extension feature is just shorthand for calling that static method
 
1:53 PM
@BenVlodgi So introducing them doesn't generate compiler errors?
 
@BenVlodgi right, forgot about that. Extension methods are static methods after all!
 
if you have confliciting method names with identical parameters, what do you think will happen?
 
@skiwi no, using them in a way that the compiler can't resolve which method you mean to call, shouldn't build.
 
@Mat'sMug So if you have two libraries (packages), which you both need in one class, then you need to import one of them manually with the fully qualified name?
 
you can "import" both, and use them as static methods
 
1:56 PM
@Mat'sMug @BenVlodgi :
11
Q: Simple Postfix Calculator using Java 8

skiwiInspired by some older questions, I decided to create my own postfix calculator using Java 8. I'd like to have all aspects reviewed. public enum Operator implements DoubleBinaryOperator { PLUS ("+", (l, r) -> l + r), MINUS ("-", (l, r) -> l - r), MULTIPLY("*", (l, r) -> l * r), ...

Look at public enum Operator
 
I need to start playing with Expressions in .net
 
@Mat'sMug @skiwi ^^
so you just do this instead
Extensions.Foo(bar);
Extensionz.Foo(bar);
 

« first day (395 days earlier)      last day (3613 days later) »