« first day (224 days earlier)      last day (2103 days later) » 

12:00 AM
@rolfl I understand you are not a fan of Maven, then...
 
@rolfl Yes, I run Java. My half robot part of me runs C though.
 
@SimonAndréForsberg @rolfl I think I managed to create a project, but the IDE does nothing... is there anything like a "Solution Explorer" or whatever, a tree-like view of the project?
oh nevermind
just had to close the welcome screen
 
"Package Explorer" they call it.
 
Window -> Show View is your friend. And Ctrl + F7
yup
 
12:04 AM
So do I create all the classes under the "src" folder?
 
What if I don't?
 
inside packages. Don't use 'default' package
then the code won't compile
 
Falls under "good to know" :)
 
unless you add additional source directories to your project
 
12:05 AM
Can I create a folder under "src", like "src\abstract" and "src\concrete"?
or I'm trying to run before I can walk?
 
@retailcoder use packages
 
Ah, "new folder"
packages?
 
more preferably, "new package"
yes, it's like namespaces
more or less
 
you're reading my mind!
 
all files start with a package declaration, then import statements, then the class itself
for example:

package rpsls.main;

import java.util.ArrayList;
import java.util.List;

public class RPSLS {
}
If you use the New Class "wizard", you can specify the package name there
Now either @retailcoder is crying over Eclipse, using a lot of bad words for it, or is completely stuck experimenting with it :)
 
12:16 AM
@SimonAndréForsberg actually changing my twins' diapers and tucking them in bed, but close :)
 
<kdb>Ctrl</kbd>+<kdb>Shift</kbd>+<kdb>o</kbd> automatically puts all the imports you need into your code and organizes them for you.
All that hard typing for nothing...
2
 
lol
 
@syb0rg still on your phone?
oh.. "Abstract" isn't a recommended name, should start with lowercase... and then "abstract" is illegal. I already miss .net namespaces...
 
@retailcoder Yes. Unfortunately.
 
12:20 AM
@retailcoder abstract is a keyword in Java
for unimplemented methods
 
as it is in C# :p
But C# is smart enough to tell a namespace from a keyword!
 
lol
In Java, you can't have a String that contains "abstract" either, since it's a keyword
 
Is "ISudokuSolver" ok for an interface name?
 
(really hopes retailcoder understands that was a joke)
 
@SimonAndréForsberg you're shitting me
(did)
 
12:22 AM
yup, that's fine
 
The Egyptian braces are already annoying and all I have is an empty interface!!
 
Egyptian?
you mean { not on a separate line?
 
C#:
public interface ISudokuSolver
{
Java:
public interface ISudokuSolver {
blablabla {
}
 
if you really really want them separate, you can configure that somewhere. Although I recommend getting used to it :)
 
^^ egyptian braces
I'll get used to it. Actually it's one reliable way to tell Java from C# code!
Oh.. it actually enforces one type-per-file?!
 
12:26 AM
only one public type per file
although you can use inner types
 
interesting
 
for example:

public class A {
public class B {
}
public interface C {
}
}

^^ that's perfectly fine
But this is not OK:

public class A {
}
public class B {
}
 
If C is closely related to B and B intimately close to A, yeah
I think I hate inner types
Except private enums, maybe
 
I find inner types quite useful very often
 
I'm starting to think that now
@SimonAndréForsberg Is there anything like a struct in Java, or all types are classes?
 
12:43 AM
All types are classes.
 
k thanks!
 
( @SimonAndréForsberg has to be getting sleepy).
 
I could see a constructor in Java being compared to a struct in C.
 
@rolfl Not entirely true, an interface isn't a class :)
 
OK, back in an hour ..... Dinner
( SHOUTING .... thanks hon... there in a moment !!!).
 
12:50 AM
Would this be how I'd create a "Digit" property?

public int get_Digit() {
return _digit;
}

public void set_Digit(int digit) {
_digit = digit;
}
 
yes, but don't use _digit
simply use digit
and the methods getDigit and setDigit
 
so more like public void setDigit(int value) { ... } right?
 
yes, or

public void setDigit(int digit) {
this.digit = digit;
}
 
but the underscore isn't illegal?!
and what's the keyboard shortcut for "Rename"?
 
nope, but it's C# practise and not Java :)
Alt + Shift + R
 
12:52 AM
yeah just noticed that "Refactor" menu
 
@retailcoder It's uncommonly used among Java programmers.
 
I'm uncommonly programming in Java :)
 
The underscore
 
Actually there's no consensus about that underscore in C# either, but I prefer a convention with private fields named _privateField than having to refer to this.privateField
 
@retailcoder the Alt + Shift + R is very commonly used among all programmers I believe :)
 
12:55 AM
But just to avoid irritating the CR Java community I'll try real hard to not do it :)
and in VS with ReSharper it's Ctrl+R+R
 
@retailcoder there's almost a convention in Java about using mDigit for that
I never follow that myself :P
 
ugh..
the day a language forces me to prefix a name with a letter, that day I drop that language..
like aParameter and mField and whatsnot
 
lucky for you, Java doesn't force you to do it
 
@SimonAndréForsberg how's your C# Sudoku solver coming along?
 
it's said to be a convention for fields to start with m and static non-constant variables to start with s, but it's not exactly used everywhere...
 
12:57 AM
the person that started that, should be shot.
 
The answer isn't accepted yet, so I can't start :)
 
lol I can't accept it yet, SE won't let me
 
@retailcoder I love camel case though :/
 
@syb0rg me too... but not for methods. My submission might include a number of case-typos..
 
@SimonAndréForsberg @retailcoder Who knows? Maybe opinion mining will take the lead!
 
12:59 AM
@syb0rg sorry, too late already :)
4
A: CR Weekend Challenge

retailcoderWeekend Challenge #3 Proposals here: Weekend Challenge #3 Winning proposal: Sudoku Solver (9 votes) Entries can be submitted as of 2013-12-14.

 
 
2 hours later…
2:58 AM
0
Q: Caesar Cipher that takes an arbitrary offset

red_eightThis Caesar cipher can take any integer and it will wrap around the correct number of times and still perform the encryption/decryption. Let's say we have a text file named dog. ~$ cat dog The quick brown fox jumps over the lazy dog... If the user enters a normal offset (1-26), it will ...

 
 
5 hours later…
7:30 AM
0
Q: New features for Processing game/desk accessory

felixphewI have written a simple desk accessory in Proccessing called Trip, you can find it here. It is working, but it is very simple, and needs more features. I would appreciate any new ideas for features, particularly Easter egg-style secret features.

 
7:44 AM
0
Q: Is this a good parser?

DemetriIs this a good C program for splitting a command line without doing any expansion on it? Don't worry too much about main() and the output -- those are for testing. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <assert.h> void pullwhitespace(char **input);...

 
 
2 hours later…
9:14 AM
0
Q: Python sudoku solver using simple deductions and brute-force guessing

200_successHere's my attempt at Weekend Challenge #3. Key characteristics of this Python entry are: The strategy is to alternate between "autocomplete" (making simple deductions such as naked singles and hidden singles) and recursive guessing. The puzzle state is stored in a Sudoku object, which has a mu...

 
 
3 hours later…
12:40 PM
Hi there, @Jeffy
 
 
1 hour later…
1:56 PM
1
Q: How can I refactor / make this code more pythonic?

Ben OsmentI have a small program which makes uses of pycparser to parse C header files. The code, unfornatuley, kinda sprawls out everywhere to handle the different cases (example below). What's the best way to make this more Pythonic? I thought about case-statements, but those don't exist in Python. Is s...

 
 
2 hours later…
3:45 PM
0
Q: In-memory data cache architecture for data transfer

Dmitri ZaitsevI am writing a cron job to manipulate and transfer remote data. I need to cache data from a table, process it, merge with previous table, iterate the process, and eventually send the result data to remote database. Here is a basic in-memory cache storage with thin simple CRUD type API. It has to...

0
Q: PYTHON: Is this way of mounting via SSHFS efficient?

Joe#!/usr/bin/python3 # Description: Python script that will mount FTP-Server via SSHFS protocol import sys import os import subprocess def mount(): #Function for mounting the networked drive if os.path.exists('/home/user/MNT/MEDIA/'): print('Network drive is mounted') un = i...

0
Q: cleaning up and increasing performance of js code

user3102494I would like to increase my performance of js code write a clean code... can you tell me how to do it... providing my fiddle below with js code... http://jsfiddle.net/YYg8U/ var myNumbersToSort = [-1, 2, -3, 4, 0.3, -0.001]; function getClosestToZero(numberSet) { var i = 0, positiveSet = [...

 
4:26 PM
0
Q: Common factor in some cases

ValI have a java code switch (c) { case '-': break; case '0': e = expr(j).reduce(C1); e=not(e); a = and(a, e); break; case '1': e = expr(j).reduce(C1); a = and(a, e); break; default: throw new Exception("Unexpected cube value, " + c); } The cases 0 and 1 are only different by not...

0
Q: How would I use parallelism or threads to improve this code?

JohnHow would I use threads or any other python parallel function to make parallel the following code? It takes 8 seconds to execute, and I want to cut that down. for pol in range(100, 2100): for x1 in range(24): d[x1] = go(x1 + 1, pol, False) x[x1][pol - 100] = d[x1]

 
4:38 PM
0
Q: I need help with python

LuBoBI am just beginner in python and so I need to know how can I write 'wildcard' in python. Is that similar like in 'C' ? I will be grateful if you can help me. Thanks.

 
4:59 PM
0
Q: Save answers as draft

tomdemuytI am only active in SO and Code Review, and I find that Code Review answers can take a bit of time, especially when fiddling around with a Plunker or JSFiddle sample or finding some reference as to why one approach is generally accepted to be better than another approach. Right now, I actually k...

 
@SimonAndréForsberg - nice answer:
1
A: Listing groups by ID and name

Simon André ForsbergI have to admit that I don't know much about JavaFX, but I do know Java so I can help you with the things I can come up with: If by "more compact" you mean "less number of lines" there are several things that you can do: Use Java coding conventions and don't put { on a new line. That alone wil...

 
@rolfl Thanks
@rolfl Do you know a better solution for this zombie spawner? codereview.stackexchange.com/questions/37357/…
 
5:17 PM
@SimonAndréForsberg - I can play with it a bit.....
 
@rolfl also see this question from the same user: codereview.stackexchange.com/questions/19042/…
kinda feels like he's asking about the same thing again... I'll have to take a closer look
 
He must be keeping this in an exceptionally tight loop for this to be concern....
 
I'm leaning towards closing the question as a duplicate
it's essentially the same question, and it seems like he's gotten the same answer
 
0
Q: reverse a string “He is the one” should be “one the is He”

SumeetI have to reverse the string "He is the one" to "one the is He". Written some programs in java but looking for other best solution .Suggest if current program can also be minimized . First Approach: class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...

0
Q: Image loader/writer design (no API, pure C++ on Windows)

PnDsSo, I have an image loader, now only for bitmaps. I'm a little confused because I want to split my code to different classes, one for writing a BMP data to a file (WRITER), one for loading BMP data from file, or from pre-generated dataset (1) and storing it in its private members.( (1) like a noi...

 
5:37 PM
@rolfl I've voted to close that Java zombie as a duplicate
 
I have never done anything like a Sudoku solver before. Heck, I don't even have much practice with the actual game...
 
@Jamal Then it's about time you get some :)
2
 
(that's what she said!)
 
^^ ts
even though I could do RSA on your comment; it's not worth it
 
First rolfl, then you. I really need to be careful...
 
5:46 PM
you mean with RSA?
 
...
 
6:02 PM
0
Q: Caching a Flask function view for a day

4m1nh4j1am writing a flask app that I will deploy it on Heroku to test it . There is a page that will generate daily photos and information based on a json file. The view is valid for 24 hours beginning from 00:00 to 23:59 of everyday. I am thinking about using cache otherwise the app will consume unnec...

 
6:13 PM
@SimonAndréForsberg - answered:
0
A: Common factor in some cases

rolflFollowing on from Simon's answer (which I believe will be more than great for 99.99% of users)..... ... actually, I have looked though the code, and I don't understand enough of it to make sense of the right answer: why do you do the map-reduce at all if a = and(a,e) will be 'false' if a start...

Probably made things worse.
 
@rolfl ((c - '0')) >> 1 != 0, nice one :)
I'm upvoting because of what you've written, not only the code
 
@SimonAndréForsberg - had to think about that one ... ;-)
It does reduce cyclomatic complexity... ;-)
 
indeed it does
I've given the question a downvote because it really isn't a very good question, it seems like he's expecting a whole lot from us but whenever we expect something from him he just says "NO, that's not possible. Please just help me with my problem"
 
6:35 PM
Unanswered count down to 817. :-) We may be getting close to 93%.
5
 
ditto
@SimonAndréForsberg I am supposed to be distracted with both work, and with Sudoku, and you are supposed to be fielding the Java questions .... so, where are the answers... huh?
You're letting them slip past!
 
And I'm supposed to be on break. Oh wait... this is how I want to spend my break. :-)
 
@rolfl you've mixed up true and false in your answer
 
Fixed.
Excellent, the weekly progress meetings with the big, big, big bosses have been cancelled for the next three weeks... I was half-expecting them to still happen...
That takes a bit of pressure off (a few hours a week of powerpointing!).
 
6:49 PM
The remaining old zombies are hard ones. There's a lot of questions about libraries and stuff I've never heard of. There are some I think I can answer, I just need to make myself time to answer them also :)
 
@SimonAndréForsberg - there is one in particular I have been planning on tacking for a while now.... and just been too busy.
Bet you answer it before I get to it.
 
which one?
 
Not telling ... ;-) (I think that's a good plan ....)
If I snooze I loose...
If you answer it first because you made the time, then you deserve the cred for it too.
 
Hi!
@SimonAndréForsberg how's your C# coming along?
 
@retailcoder WHERE HAVE YOU BEEN? I've been needing you
 
6:54 PM
lol
Morpheus
what's up?
 
I'm starting to make sense of it, but you have no idea how much I miss some key shortcuts from Eclipse
 
I see you learned that null actually means null :)
 
yeah, took me a while to figure out my problem just because of that null thing
what's the shortcut for renaming things?
 
oh.. I guess so.. I actually use the R# keyboard shortcuts, the VS ones... I'm never sure..
Try F2
Or Ctrl+R,R
 
thanks, there it is
and if there's a compiler error on a line, how do I open the menu for quick-fixes?
 
6:57 PM
You get a R# license :)
 
License Schmicense...
 
what's R#?
 
That's what I was saying yesterday, about Eclipse being a nice IDE
ReSharper, from JetBrains. A plug-in
 
6:58 PM
they put the brains in VS...
you've been spoiled my friend
 
is there any shortcut like Eclipse's F3 key to go to the declaration of stuff?
And now you will be spoiled too :)
 
F12
Or right-click anything and "Go to declaration"
With R# you also get "Go to implementation" which is awesome
 
F12, THANK YOU!
@retailcoder I have to say I like the LINQ stuff, although it's a bit difficult to know how to use it sometimes
@retailcoder Now for example, I have used group by to get a grouping, is there any way I can transform that to a bool[] in some efficient way using LINQ?
 
Probably.. what do you mean "transform"?
 
the grouping is a grouping of <int, SudokuTile>, can I make that become a bool[] where the ints are indexes in the bool array, and the values are for whether or not that int has at least one SudokuTile?
or am I expecting too much from LINQ here?
 
7:07 PM
You were probably expecting too much ... it's an MS thing... ;-)
 
where the ints are indexes in the bool array => that sounds like you want .ToDictionary
 
but a Dictionary<int, bool> feels strange when you can use a "simple" array instead
 
Depends how you managed to get a grouping with an int that has a null SudokuTile... doesn't make much sense to me, like, your grouping shouldn't have any null tile, no?
 
no, I don't think it does
 
you can break and find out at run time
 
7:10 PM
for example, I have the tiles 0 0 0 1 2 1 0 0 0, and then I do:
var groupedByValue = tiles.GroupBy(tile => tile.Value);
 
BTW I won't be able to get much done today, gotta leave already.. might resume tomorrow with my Java thing
 
that will give you a grouping; typically you select from your grouping after
 
tiles.GroupBy(tile => tile.Value).Select(group => group.Key).ToList();
(the .ToList() materializes the "query" into an actual List<Tile>)
otherwise it remains an IEnumerable<Tile>
And you don't want to enumerate that more than once
also the grouping will have a Key being the property or anonymous type you've put in your GroupBy delegate
like, you could do tile.GroupBy(tile => new { tile.Name, tile.Value }); your grouping key would be an anonymous type with a Name and a Value :)
 
7:23 PM
Seems like I have some things to learn about this LINQ usage
 
@SimonAndréForsberg - if you don't mind, do you think you could share your overall impressions with VS, and whether you will continue using it? (when you are done with this...)
 
Short answer: Eclipse - VS: 1 - 0.
(will add more details)
 
K... it was probably a bad request ... ;-) No way to be objective.
 
VS as an IDE isn't very impressive compared to Eclipse. As @retailcoder said, I've been spoiled by Eclipse. I will probably use it if I decide to do some C#, C++ or VB.
 
OK, that's interesting, so you distincly separate the C#/VB from the VS environment... i.e. you will consider using C# but not in VS?
 
7:35 PM
If I could use it in Eclipse, I would.
I have to say that I like the LINQ stuff that is available in C#
Unfortunately, since I do a lot of Android development, I don't have so much use for C#
Also, all the code I've previously done in Java isn't available in C# :P
Also unfortunately, I read yesterday that it's not likely that Android will support Java 8 :(
(In fact, Android currently doesn't even support Java 7)
 
@SimonAndréForsberg - yeah, OK, so it's unlikely you will migrate from java, and, thus, VS is not an option...
@SimonAndréForsberg - I have some code in the core android system, since jelly-bean... ;-)
 
in the long run, exactly. I would still like to increase my knowledge of the C# language and usage though
You've contributed to Android? Cool!
 
That's me ... :(
bug fixing, as usual, but anyone who uses jUnit with android will thank me.
 
Good work :)
 
As it happens, not the worst bug I have found ... I found an error in IBM's JVM implementation of Arrays.binarySearch(data[], from, to, key); If the from was > 0, and the value was not found, it returned -1 instead of -from - 1.... which required fixes to IBM's JDK, as well as the entire Jav compatibility test harness for all oracle-certified JVM's.
 
7:48 PM
@rolfl for "year" you have the tags but for "all" you have :)
 
Baahhh!
how does that happen?
 
No idea. It's very strange since you have only been a member for two months
perhaps different update periods?
 
You're the same,
java strings android in one, Java game strings in the other.
 
indeed I am
 
8:32 PM
think I am going to start work again on RPSLS
 
8:47 PM
No Sudoku for you, @Malachi?
 
who had the answer about putting the weapons in an array where the two before each one beat the selected weapon and the two after it lose to the selected weapon? I can't find it.
@SimonAndréForsberg no I am going to try and fine tune my programming skills and knowledge before I try to take on something more difficult.
 
As a special entertainment for you, @Malachi, here's a little special SQL statement I think you might enjoy: codecrap.com/content/1034
 
@SimonAndréForsberg that is bad
 
I know :)
That's why the site is called codecrap
@Malachi You are looking for Michael's comment to Jamal's question
bool defeats(Weapon2& a, Weapon2& b) { return ((5 + a - b) % 5) < 3; }
 
@SimonAndréForsberg now I just have to decipher that and turn it into C# code and figure out how to work it into my new code.
 
9:01 PM
@SimonAndréForsberg MY EYES, OH GOD MY EYES
 
lol @Corbin
 
9:27 PM
1
Q: How to Better Structure This Scala Program

tshauckI'm trying to make a scala interface to the spotify API. I'm using it to learn Scala... I come from mostly a python background. import dispatch._, Defaults._ trait Request { val name: String val endpoint: String } case class Track(name: String) extends Request { override val endpoint = ...

 
9:44 PM
Hi, @syb0rg
 
@SimonAndréForsberg Hello. :)
 
Will there be any Sudoku solver from you?
 
@SimonAndréForsberg I can try to program one, but I'm honestly not sure if I have the time.
This is the first time I've been on my computer in a few days.
 
Understandable. The latest challenges haven't been easy exactly.
oh
feels like you were here just yesterday
 
@SimonAndréForsberg I was on my phone then.
 
9:46 PM
ah, yes, that's right
 
0
Q: How would I optimize this code, if possible?

RobHow would one optimize this code? import java.util.*; public class VendingMachineAssignement { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); double item1 = 1.25; double item2 = .75; double item3 = .90; double it...

 
10:03 PM
0
Q: Best design pattern to approach http handler with multiple methods

Imri BarrI'm building an http handler at work which has about 6 methods and I'm trying to figure out what design pattern will work the best for my needs: What's done already (Only an example to make this more clear, methods are not real, but the main concept is there): #region interfaces public interfac...

 
I would appreciate if you guys would take a look at my latest answer:
0
A: Vending machine implementation

syb0rgThings I would fix: Don't do this: import java.util.*; It could be problematic for the compiler to import a bunch of packages at once. If two packages provide the same type, both are imported, and the type is used in the class, a compile-time error occurs. This is described in [JLS 6.5.5.1][1...

 
@syb0rg I like the answer, there's only one thing I would add: Arrays
Do you want to add more about that or should I? :)
 
@SimonAndréForsberg Add arrays because of all the double items?
 
@syb0rg Yes. His items could be one simple array: new double[]{ 1.25, 0.75, 0.9, 0.75, 1.5, 0.75 };
that would simplify his code a lot, no need for the switch statement either
I'm not sure he knows about arrays though
@syb0rg A new user just added an array answer
 
10:19 PM
@SimonAndréForsberg Kinda, he didn't go into great depth. I think I will still do a little section on it.
 
@syb0rg Good choice. That will make your answer even better
I think this question will have a lot of attention because it's such a "simple" task with horrible code.
 
@SimonAndréForsberg Should I recommend an Arraylist instead of a normal array?
 
@syb0rg Naah, it's a fixed amount of items so array seems to be enough
 
10:35 PM
@SimonAndréForsberg I'm also adding a section on while loops.
 
ah, good choice!
 
@SimonAndréForsberg For some reason I can't get the double values to subtract properly. Arg
 
double d = 0.42;
double o = 0.21;
System.out.println(d - o);
what is the problem? That they don't round correctly?
 
@SimonAndréForsberg Exactly.
Rounding errors
 
when working with money, never use doubles
 
10:41 PM
There's plenty of SO questions about that I believe
 
use ints and work with cents
 
Corbin also has a good point there
 
(actually when working with anything discrete always use ints, not just money)
 
One exception though: Calculating 256 nCr 51 :)
 
if space is an issue, then yes, the higher limits of doubles might be worthwhile, but... you give up quite a lot when you switch from ints to doubles.
there's a lot of pain in having a mismatch in discrete/continuous
 
10:48 PM
@SimonAndréForsberg Do you have a question on SO you can point me to? I can't find any that don't use BigDecimal.
 
hrmmm 256 choose 51 requires either 1 64 bit double, or a 181 integer.... so might actually be worth considering in that case lol
 
@syb0rg I think Corbin's suggestion of using ints is better
Although you could round the value when outputting it
 
@syb0rg the tl;dr of it is that floats are imprecise. they have a rather large precision, but 0.42 - .21 is likely something like 0.209999999999999997 rather than 0.21 exactly
the easy work around is to just use an epsilon to compare or output:

comparing: if (abs(x - y) < 1e-7) { /* "equal" */ }
output: x + 1e-7
 
@syb0rg Try with NumberFormat.getCurrencyInstance().format(number)
 
the problem is that in certain domains figuring out a proper epsilon can be very difficult. in the case of discrete values such as money, it's much, much, much, easier to just use an int than worry about a trillion corner cases
 
10:53 PM
@SimonAndréForsberg That returns a String
 
@syb0rg Wasn't it only an output problem?
 
@syb0rg it has to.
it comes back to the IEEE Floating point situation where certain values cannot be represented exactly. that means that a string is your only choice if you do want exact represenation
 
I'm still somehow getting an extra .5 somewhere...
Enter an item number: 1
Enter the amount paid: 1.25
Thank you for buying item 1, your change is $0.50. Please come again!
 
that doesnt sound like floating point... that sounds like it's just a bug. can you post the code in a gist or ideone or something?
or is this the code in your answer?
 
@Corbin - when working with money, it's always been BigDecimal ....
 
10:59 PM
@Corbin code is in answer. Let me make a quick update to it (with the bug in it temporarily).
 
@rolfl interesting. never heard that before. but, I'm also not very familiar with java these days. seems for any amount of money that's not very, very large, it would make more sense to just use a long. i suppose the precision in bigdecimal would never be a problem, but still.... something about using a decimal representation for money irks me, even if it is arbitrary precision
i suppose it is more natural to think of $2.50 though than 250 cents
interesting
(not to mention that bigdecimal makes other things much easier/safer like division)
 
@Corbin the moment you need to do things like 'Tax at 13%' you go beyond the realm of integer values.
Or any interest or other calculation.
 
yeah, good point
BigDecimal it is :)
 
I'm still not seeing where the extra .5 is coming from...
Found it
An off-by-one error (OBOE) is a logic error involving the discrete equivalent of a boundary condition. It often occurs in computer programming when an iterative loop iterates one time too many or too few. This problem could arise when a programmer makes mistakes such as using "is less than or equal to" where "is less than" should have been used in a comparison or fails to take into account that a sequence starts at zero rather than one (as with array indices in many languages). This can also occur in a mathematical context. Looping over arrays Consider an array of items, and items m throu...
Bug fixed, review finished.
I always have had a problem with off-by-one errors...
 
11:21 PM
0
Q: Does this look secure enough?

user2981256Does my PHP look secure enough for a sign up form? <?php $con=mysqli_connect("host","user","password","db_name"); $sql="INSERT INTO users values (?, ?, ?)"; if ($stmt = mysqli_prepare($con,$sql)) { mysqli_stmt_bind_param($stmt, "sss", $_POST["username"], $_POST["pwd"], $_POST["email"]); ...

 

« first day (224 days earlier)      last day (2103 days later) »