« first day (542 days earlier)      last day (3476 days later) » 

12:10 AM
6 accepted answers yesterday. that's a personal record
barely reaching the cap with that many accepts... that's another record
being here to see it, also one
I guess I'm trying to say: ttgtb
 
12:21 AM
Thanks, Santa! Almost to 19.4k.
 
20K in sight!
 
Still need more answers... passes out
 
you'll get there by prom night I'm sure :)
 
I still need a date! D:
 
lol
I'm going with my mug ;)
 
12:32 AM
What's the corsage? A coaster?
 
hmm hadn't thought of that
 
using visual studio to debug visual studio... what could go wrong
 
12:56 AM
0
Q: Optimization of Python Code

Vishwa IyerSome backgound info here: This is a small fun project I made utilizing Steam APIs and Web Scraping This is the first time I've ever used Python, so I'm not very familiar with the langauge I used Flask in conjuction with this code (google Flask if you don't know what I'm talking about) The cod...

0
Q: A Better way to create a BST?

SilverSidewalkStewI have created a BST like many others. I am curious to if there is a better way to write it. It seems pretty straight forward, but I feel like it can be improved on a bit. //MRBST.h #ifndef MRBST_H #define MRBST_H #include <iostream> template <class T> class MRBST { private: struct t...

 
Are close votes piling up on this question just because of the wording of the last bit?
I don't know about the form not loading. It loads for me. I added the County class and the Form class which should at least help in loading the program into Visual Studio. I didn't realize that's what you guys would try to do. I just thought you guys would just look at code and offer pointers on what to change. Thanks for your help. — Mike 6 mins ago
Wow. That's a lot of information. Thanks and I'll be looking into all this. — Mike 2 mins ago
 
1:36 AM
monking
 
1:49 AM
monking!
 
2:18 AM
Palindrome of note.
4
 
2:40 AM
0
Q: Comparing two implementations of smoosh()

overexchangeIn this question, the suggested solution for smoosh() is as shown below, public static void smoosh(int[] a) { int originalPos = 0; int targetPos = 0; while (originalPos < a.length) { // Copy (and remember) one element to the correct position: int currentElement = a[ta...

 
 
1 hour later…
3:52 AM
0
Q: Patterns about bean management in Spring Boot

NingLeeI have some events and corresponding eventHandler in Map<EventType,EventHandler>. An event can be splitted into many tasks, one task may contains the DB operation. Every task has its corresponding ItemHandler according the TaskParam, this was saved in Map<String, ItemHandler>. In ItemHandler.p...

0
Q: Structuring my MongoDB application documents

Jason LarkeI'm just starting out on an application and I've heard some good things about MongoDB so I thought I'd give it a crack in this new project to see how well it works. Please bear in mind that prior to this I've only ever really used RDBMSs like MySQL, Oracle, etc. so it's been quite an adjustment...

 
4:57 AM
0
Q: Reflection and Project Euler

Brendan LesniakI have made a Project Euler runner in order to facilitate the running of the various problems. I have never used reflection before, and I believe that I have found a good use for reflection within this project. My question boils down to this: Is this an appropriate use of reflection? Or am I...

0
Q: skipping whitespaces when reading file

CeleritasIn reading a file, I found blank lines (even at the bottom) crash the program. To fix this I added the following if statment string line; while(getline(inFile, line)) { if(line.length() < 1 || (line.length() == 1 && isspace(line.at(0))))//this was added continue; string result = ...

 
 
1 hour later…
6:04 AM
Anyone on?
 
I am
 
Is it ok to ask a question about this site here?
 
Sure. What is it?
 
I've just begun programming (7 weeks into it or so) and I was referred here to post my code for review, but when I look at the site and questions asked, it looks like you're supposed to post parts of your code and have those reviewed, not an entire program. Did I understand that right?
 
It depends on the size of the program. If it has hundreds of lines or tons of files, then it would be too much for us (and there is a character limit). Otherwise, posting the program would be preferred, as there's more context.
 
6:10 AM
Do I have to have a specific purpose when I post the code, or is "What about this code can be made better?" acceptable?
(I feel as if asking these dumb questions is better than posting something bad)
 
You must give a title that specifies the purpose of your code, while the post body can contain any specific requests. The code must be from some project or "dummy" program, not example code or pseudocode. The latter two are off-topic.
 
I have a finished program, but I'd like to know what can be improved, and how does it relate to the common practice.
Since I'm a newb it's a very small very simple thing though so I think it'll fit. I just wanted to know if that is onT or not.
 
Then that should work. Go ahead and post it, and if there are still problems, they'll be mentioned.
 
Allright, thanks :)
 
You're welcome. :-)
 
6:14 AM
Now to the fun part of making a good title for it :S
 
As long as it states the purpose of the code, it should suffice. Otherwise, someone else can try to improve it, provided that there's enough info about the program's purpose.
 
It's a blackjack game based off ofa programming by doing assignment so it's pretty simple :P
 
6:34 AM
monking
 
0
Q: Text-based BlackJack game: How does this code compare to common practice?

GemtasticFirst off: This code has a recursive call back to main, I have understood that that is bad and I understand why, so you needn't bother with that. I am a new programmer (I've been doing Java for about 7 weeks) and I am of the type who wants to get it right straight away, so I wonder how this code...

 
:O
 
6:51 AM
Looks good now! It should receive some answers not too long from now. There are many great Java reviews here.
 
Yay! :)
Once again, thanks for the help ^^
 
:-)
 
0
Q: Dividing a number half into words and half number:

user2822178The desired result is: For any number convert the first half of the number (on the left before the comma) into numbers and the rest into words. Example: If I have a number 1000 - I first put commas (In English Standard) that makes it: 1,000. Second I split the above at the first comma: I ge...

 
7:18 AM
is perl 5.10 now widely distributed ?
 
^^^ maybe @200_success can chime in about that
 
yup
@200_success is perl 5.10 now widely distributed ?
 
0
Q: Port-scanning on a website

ScarlI've assembled code in Java to do port scanning on a website and I'd like to have the code reviewed. I got the basic point for the code on Google but I changed it to display the port, its name and it being in use. I have a method that will read the host's name. public static void main(String[] ...

 
^^ broken but not sure if I should VTC
 
7:35 AM
0
Q: Producer/Consumer Program Opinions

Tyler WeaverI am a semi-new Java programmer that tends to be a perfectionist. What I'd like to know about my code: How it compares to common practice. Is it readable? Are my comments appropriate? Any improvements that could be made? I'm not asking to bog down your time to do an in depth review, just off ...

 
Hi, I have a small question, I am developping an android appliation and I would like to create a property file (to store stuff like the URL of a server), how should I do that in the android world? This property is to be used by the service layer :). Thanks a lot!
 
@JaDogg Perl 5.10 was released December 2007.
 
8:03 AM
Monking
 
8:23 AM
@200_success good I can use given and say without worrying then
 
9:05 AM
0
Q: Correct way of implementing thread safe factory with caching?

WernseyI have a ConnectorFactory that creates Connector objects based on parameters like URLs, username and passwords. The Connector object itself implements a HTTP connection pool internally, and can handle multiple HTTP requests concurrently. I would like to do is modify my factory to cache the Con...

 
10:01 AM
0
Q: Create an Array with n values that is able to use Array methods instantly

KooiIncAs it is impossible to use Array methods on new Array(n), e.g. new Array(5).map(/* [some callback] */), I deviced this pseudo static method: Array.create = function (n, mapCB, method, initial) { method = method in [] ? method : 'map'; var nwArr =...

 
10:24 AM
0
Q: LiveTime Object Literal

Kid DiamondI have a website that retrieves time data from any given location on the world live. I wanted to be able to automatically change the time and not deal with the hassle of local client times. It's fairly simple, but since I'm not that good with JS, I'd like to know if there is anything I could im...

 
Monking
 
10:36 AM
halp
0
A: Text-based BlackJack game

Pimgd To other reviewers: I've tackled design and the use of arrays. I didn't touch much on the actual code, although I do hint at things. Recursive Main and Design You can easily remove the recursive call to main by having main consist of the following: public static void main(String[] args){ ...

I can't stop typing words
 
> Players get 1 card per turn
False statement
you can ask the dealer for as many cards as you like until you either bust, double or stand
double means you double the bet and then get a last card before stand
this is done for each hand, and then dealer plays his hand
if you split, you play out your first hand and then your second.
But it's a very nice and through review ;)
 
0
Q: How to Add Loading in Jquery the following

Vizo IDPlease Anyone Help $(document).ready(function() { $('#content').load('content/home.php'); $('ul#nav li a').click(function() { var page = $(this).attr('href'); $('#content').load( page + '.php'); return false; }); });

0
Q: Algorithm to create custom ConcurrentHashMap?

M SachI tried to look into concurrent HashMap source code to look in to how it is implemented. To me it looked very difficult to understand((In no way i am saying its not required :))). I thought if i need to implement it myself and how should i go about it. Here is brief algo about it :- 1) Maintain ...

 
Damnit @Pimgd this is why I don't get distracted most of the way through writing a review :P
 
@Captain both off-topic
 
Although I empathize so much with "I have many, many, many more words for those that make games to learn. I like such exercises."
 
10:53 AM
0
Q: RGB to HSL function

EdeniaThis is a function that converts RGB value passed as a struct to a HSV: void RGBtoHSL (RGB COLOR, double* h, double* s, double* l) { double red = COLOR.R/255.0; double green = COLOR.G/255.0; double blue = COLOR.B/255.0; double v; double m; double vm; double r2, g2, b2...

 
11:06 AM
0
Q: Improving sub select query on two tables without relationship

okenshieldI am trying to return the count of employees by salary band and can return data using the following sql but wondered if this was the most efficient way of achieving it? I know creating a join between the tables would be better but that is not possible in this instance. select *, (select count(...

 
11:17 AM
@Vogel612 I don't fully know how Blackjack works but I have played some
so that caused that
I'll fix it
@Yann I disagree with this statement:
> Since all that you are doing with the output of your whoWon method is printing out the name, returning a whole Player object is a little wasteful, and you might want to consider returning just a string containing their name.
 
Really?
How come?
 
Because it goes against the way I'd design these things
And maybe OOP too
 
What's wrong with it?
 
future extensibility... that's what all my thought arguments boil down to
also clever players.
Someone names themselves dealer.
Game turns strange.
You want to track statistics per player
 
OH, crap, I forgot to make it clear why I said dealer at 0
 
11:22 AM
suddenly you're using a string as object identity
 
And yeah, I see your point, I'll remove that
Although if players can name themselves dealer in this, since the toString is just playerName, the "game turns strange" happens anyway
 
yeah but an extension to what you're saying is if(whoWon().equals("dealer"))
 
How would you feel if it were an array index that was returned?
So pass the array to the method, and return the index of who won
 
really, really, really weird
 
It's a de facto unique ID
If the array is the only place that you're storing the player
 
11:29 AM
why do I need to show my game state to someone else, and then that someone else is going to tell me who won?
 
Because you might not be responsible for the game state at all??
additionally the best thing about blackjack is, that each game is separate from the others..
 
if BlackJackGame is not responsible for the game
then really fucked up things are happening
 
It's not someone else though. The array of players is in BlackJackGame
 
everybody may be playing against the same dealer,
but not against each other...
 
Ooh nice remark
 
11:31 AM
There should be a BlackJackTable with a single dealer and a Collection<BlackJackGame>
 
... I'd just make a class Hand
 
He wants to KISS, don't forget :P
 
then you can tell the games about what the dealer has, and the Games then evaluate themselves.
 
boolean beats(Hand otherHand)
hmmmh but that doesn't resolve the dealer > player issue
 
The Table evaluates the games by telling them about the dealer, and accordingly tells the players about their winnings or losses
 
11:33 AM
That is much nicer
 
alternatively that could be responsibility of the Game, and not the table
you open a game by betting,.
 
> Well, if I were designing this... I'd abuse a physical object. Blackjack comes with a table. And the dealer and the player join this table. That's when they're greeted. And then they can play hands. At some point, people leave and the hands end. So perhaps a class like BlackJackTable can be responsible for a lot of things. At the very least it could take the responsibility of passing messages around and handling the game's progression.
 
people don't have hands.
3
 
Yup, that'll do it
 
> To play Blackjack at a casino, you need to place a bet. When you're done playing, you can collect your chips and you just walk away. Sadly, you don't have a betting system, so there's no easy way of simply betting 0 and making that a way to leave the table. (Then again, card counters might favor just waiting a couple hands to get the better cards... and they do so by simply not betting.)
 
11:34 AM
the Table has Cards
and the Games get cards from the Table, depending on the Players' decisions
 
The table has a Deck, which has Cards
 
my blackjack termnilogldlsasdfsdf is bad
as is my sense of spelling
When I played blackjack the cards were mine to decide over
but others could bet on my cards too
 
eurgh.. yea I forgot about that..
I'd probably not allow that.
 
awww
 
Why are we suddenly modelling a casino?
 
11:36 AM
hang on you can't just ban a feature because your design clashes with it
It's not a casino, it's BlackJack PRO 2015
featuring retro text-based gameplay
no visuals to distract you
 
@Pimgd correct.... But for what it's worth, I doubt there's all that many blackjack games on the market that'd allow it.
 
just you, a couple others, the dealer and the cards.
 
a Table has Players, a Deck, and a Dealer, and the Casino has Tables, Dancing Girls and Booze
 
optionally add some OneArmedBandits
interestingly a Table in your design would allow different games to be played on it
--> Roulette, Dice, Poker, BlackJack
 
Tables are magical indeed
 
11:39 AM
but then Dealer is not a good name...
 
Handler? Employee?
 
I'd go for Bank
 
Crook if we're being cynical
Also, why don't people have hands?
 
makes no sense.. People have Games
and a Game has a Hand
it makes no sense to hold people responsible for Game-Internals
 
In the limited scope of blackjack game (assuming we're not making blackjack pro), people know what their hand is. How else?
 
11:43 AM
--> Roulette: a Game has a Bet. A Player / Customer (or MoneyBag) can have multiple Games
 
I'd like it to be Hand == Card**, but java
 
0
Q: Database update script

yasiri put this code to review it used for update database record . prevous thread Database insert script <?php function fetchTableFieldCount($mysqli , $databaseName , $tableName ) { $sql = "SELECT COUNT(`COLUMN_NAME`) AS FieldCount FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`= ...

 
--> BlackJack: a Game has a Hand and a Bet. A Player can have multiple Games
the structure is the same, it's just not a Roulette extends Game, but a BlackJack extends Game
 
But the game would need to keep track of multiple player's hands and who's they are
 
so how do you handle split
 
11:45 AM
@Pimgd you'd need to ask the table, and give him your internal state.
then you'd get two games back, and store them in your player
@Yann ?? no, that's the Table..
 
Don't you split your cards?
 
That's why you need to notify the table, giving your cards to it
the Table splits the cards for you, and gives you one more card each Game
 
ahhh okay
 
then you just continue playing with one game more..
 
Wrong words, correct intent, honest. I don't get why Table should keep track of a hand that "belongs" to a Player
 
11:48 AM
Here's another thing that might throw a spanner in the works
If a dealer gets blackjack...
don't they immediately reveal their card
or am I derp
 
I don't think so? They dont reveal til the end
 
@Yann he doesn't.
he just keeps track of the games that are played on him
and holds a Dealer, as well as a Deck
 
> The dealer deals cards from his/her left (the position on the dealer's far left is often referred to as "first base") to his/her far right ("third base"). Each box is dealt an initial hand of two cards visible to the people playing on it, and often to any other players.
> The dealer's hand receives its first card face up, and in "hole card" games immediately receives its second card face down (the hole card), which the dealer peeks at but does not reveal unless it makes the dealer's hand a blackjack.
So sayeth Wikipedia.
 
the Hand-management is done by the Game
 
And a Game, is that all of everyone's turns?
 
11:50 AM
and the Game also keeps track of it's player
no a Game is Player vs Dealer
 
Oh, a game just. Right
 
where the Dealer is managed by the Table
 
Ahhhhhh
 
and a Game needs to request stuff from the Table.
because the Table must manage it's own state
but the Game must also notify the Table of a Bust
the Game must prevent requests for more cards when busted.
the evaluation is done after the Dealer played, and the dealer follows simple AI rules.
 
can we call it a Round
 
11:52 AM
that would probably be more intuitive
 
yeah, that was tripping me up
 
Round is the whole game,
 
even though I'd call a specific Games - Dealer mapping a round...
 
Well when the dealer has blackjack
 
and a round would consist of multiple "Games" or Encounters
 
11:53 AM
all games in the round lose
 
Still can take that on Round by Round basis. The Round shouldn't care which Table it's played on
 
Now we can throw MVC at it =D
M = Cards, Table
C = Round
V = Player
You can either stick the Dealer in M or V
I think M since the dealer doesn't display and doesn't make choices
it just does
 
agreed
 
Game is also model
 
there is no Game...
 
11:56 AM
oh
we killed it off already?
 
yea...
either it gets a different name, or we kill it ;)
 
ah yeah okay
Well the player receives the Table and a Hand with cards when it's his turn
I mean you get to look at the table
and make a decision on your hand
probably an enum (Hit, Stay, Surrender, Split, Double Down, yadda yadda yadda)
they fitted it in a table using color codes, so I think enum is appropriate
 
I'd say: a Table* and a std::vector<Encounter>*
 
Java
 
Jaaava.
 
11:59 AM
okay oka.y..
a Table and a Set<Encounter>
 
JAVA?
 
No.
 
<meme meta post about JAVA vs Java>
Why Set
Set is unordered
 

« first day (542 days earlier)      last day (3476 days later) »