« first day (856 days earlier)      last day (3158 days later) » 

6:02 PM
@ambigram_maker I don't know.
 
Very happy to announce that I have now made my pet project open source, and it's gone live to GitHub now:
3
 
There just aren't enough people reviewing Scala on this site...
 
0
Q: Java basic AsyncCache implementation

DexterI wanted to use an async-cache to store URLs of images that I have to display in a list. The image URL is fetched (REST call) using a unique UUID associated with each item of the list. I store this URL locally and then use it to show images in the future. I came up with the following async-cache...

 
@ambigram_maker - "library" has no special meaning in Java.
 
@rolfl Ok. So what would you call java.lang.Math?
 
6:10 PM
@ambigram_maker strictfp is an interesting question on an academic level. Do you know what strictfp does?
 
Yep
But will rounding reduce the accuracy?
 
@ambigram_maker A "library", but other things are libraries too, like "java.util.*"
 
That means...?
 
library is just a convenient word that groups a bunch of related functioanlity in one reusable place. Being static, or not, is independent of how you collect the functions together.
 
Hmmm... right
 
6:12 PM
being "final" is independent too.
Anyway, you say you know what strictfp "does", but I am not convinced you are aware of what benefits it gives, and what drawbacks too.
 
strictfp is a keyword in the Java programming language that restricts floating-point calculations to ensure portability. The strictfp command was introduced into Java with the Java virtual machine (JVM) version 1.2 and is available for use on all currently updated Java VMs. == Basis == The IEEE standard IEEE 754 specifies a standard method for both floating-point calculations and storage of floating-point values in either single (32-bit, used in Java floats) or double (64-bit, used in Java doubles) precision, and, for intermediate calculations, also extended precision formats. Prior to JVM 1.2...
 
@Mat'sMug @200_success @janos @Jamal Is it okay if I make a tag? I plan on reviewing a lot of code related to that project
It'd follow in the lines of the project that was tagged
 
@ambigram_maker So, strictfp does nothing specifically to improve the accuracy of the results you get, right?
 
Yes... it ensures i get the same result everywhere
 
The same answer, but not the "right" answer.
 
6:16 PM
But is it really recommended?
No i guess
:-P
 
I have never seen it used in a system, and I have seen a lot of systems.
If your goal is to get reproducable results in many systems, then you can use it, but, it means you are (likely) no longer using the floating-point instructions native to your processor/system
 
So I should probably drop the idea right?
 
If you are looking for accurate, reproducable results, then the recommendation is to use BigDecimal, and manage your proceessses and procedures to ensure you always have the right capacities and contexts to store the results you need, and you manage the accuracy at each calculation.
 
Sadly, there is no library as easily accessible as Math.java for BigDecimal
 
"easily accessible" accurate decimal arithmetic is not possible anywhere.......
 
6:20 PM
@ambigram_maker I posted an answer on your float comparison question.
 
There should probably a support for BigRational though. ;-)
 
It is not possible to have accurate floating point arithmetic in any system/language that I know of. If you want predictable accuracy, you need to use systems that allow you to manage the precision/accuracy of each calculation. BigDecimal is Java's answer to that problem.
It is not easy, but it is right, which is actually about the best you can expect.
 
@EthanBierlein Your's is the best answer yet.
:-)
 
@ambigram_maker Thanks! :-)
 
But sadly, primitives == boxing/unboxing == extra overhead :-(
"No instances for you! ;P" is intended for me. No one else can get that message. :-)
 
6:23 PM
lol
 
(unless you try to inherit it) ;-)
 
Then the class should be final
 
TNumber .... ?
 
@itsbruce @Donald.McLean We manage.
 
@rolfl What?
 
6:24 PM
@EthanBierlein I'll make it.
 
@EthanBierlein exactly.....
 
@rolfl Well, do you have a better name? T?
 
@syb0rg Looks good!
 
@Mast Thank you!
I've spent a lot of time on it, although it may not look at it
 
@EthanBierlein Well, let me see, using your method signature, let me try: areEquals(new Integer(0), new Integer(0), new Integer(0)) ... and it will return false.
 
6:25 PM
It's had it's fair share of time as a backburner project
 
1
Q: Khronos: Project's primary CMake file

syb0rgSo recently I made a large project of mine open source: Khronos. I will be dissecting parts of it so that I can have it reviewed more easily here and so that the project as a whole will be improved. The first part I want to have reviewed is the CMake file involved with kicking off the building ...

 
I felt like it was getting harder for me to give time to the project, so I thought I'd let some other people have the ability to help me out
 
@EthanBierlein oops. you missed .equals()
 
Good thinking... ;-)
 
(and used ==)
 
6:27 PM
@ambigram_maker / @EthanBierlein - and now, additionall, how about: ArrayList<Integer> foo = null; areEquals(foo, foo, foo);
 
Okay... I'm not sure where though...
 
@rolfl Do you agree with all the points in this answer:
3
A: Better Floating Point equality in Java

Peter Rader Please make the class final to let noone inherit the class. Nobody would expect a AsserationError if he can inherit the class. Everyone who inherit the class would have duplicate javadoc. Please throw a RuntimeException or an IllegalStateException because the javadoc matches better. ;P let ...

 
@ambigram_maker most of them, yes.
I would say there are bigger problems.... conceptual problems.
 
Specifically?
(Post an answer please)
 
The 'tolerance' is arbitrary..... and the use-case is limited in applicability.
 
6:31 PM
In layman's terms?
 
Only one piece of code can be using your library at any one time.... it's .... broken.
 
There, I've edited my answer. Did I get it right?
 
@syb0rg I'd love to help, but this is way above my level.
 
@EthanBierlein The specific use-of-primitive equals methods are important.
 
6:33 PM
Not yet: (d != numbers[i]) is wrong for objects.
 
You can't just box everything up and process int as Integer, for example.
@ambigram_maker A more meaningful answer would be given if you could describe the actual problem you are trying to solve.....
Are you trying to find all regions in an image with the same luminosity? Are you trying to check calculation results for mortgages, etc.
 
Oooh, should it be !d.equals(numbers[i])?
 
Maybe I should upload the code for Point first. Then people would understand.
@EthanBierlein Yes!!!!
 
Boxing man
Can't get around it
It's for primitives
2
 
Okay, there we go. Now it's fixed.
 
6:35 PM
@EthanBierlein But d needs to be not-null first.
 
Oh, right, a null check.
sigh
 
@EthanBierlein It would be better if you run your code. :-)
Like I did.
 
As much as you dislike duplicating the code, it is best, in Java's current versions, to duplicate the methods for each primitive type.
 
Except I don't have a Java IDE.
 
online then
 
6:37 PM
Future versions will/may reduce the primitive handling overheads.
 
So... should I upload Point? The usecase of Numbers will be clear then.
 
@ambigram_maker Is Point still from the 2014 question?
 
No.... waaaaay better :-)
But its Point two point oh
(Is that a valid question name?)
 
@Jamal The purpose was to get ideas on better implementation of case statement of ruby in my code.. The code posted above just has a method containing case statement to save data in a hash and is not wholly responsible for generation of spreadsheet... Hence I had edited the title.. — Sam Snoop 2 days ago
 
@Jamal nice edit!
 
6:43 PM
It may need another one since more errors were introduced.
 
lol
 
Ah, screw it. I'm just gonna get rid of the answer.
 
There's also a copy-paste mistake on that question, but since he needs to edit it anyway, I'm not going to touch it now.
 
Unless someone find value in it.
 
@Mast "copy-paste mistake"?
 
6:46 PM
2
Q: Finding unique values in an array with possible nested arrays

gfnogueiraI'm writing a function that receives an array and returns an object with the count of unique values, pretty much like other questions here or in StackExchange. Except that in my case, this array may contain a nested array, like: var array = [1, 2, 'a', 'b', [3, 'c', 1], 'd', 2, 'b']; Here is m...

 
@Mast Perhaps, but I still believe your help would be valuable
For instance, you could look at the command interface and try to create new commands
 
7:08 PM
@rolfl You there? I posted Point
 
0
Q: A Library Class : Point - Follow up

ambigram_makerThis is a follow up of this post Changes: I tried harder to make my code readable yet concise. All Point instances are immutable. New, useful features have been added (like reflection, rotation, translation, etc.) This class depends upon this class. Line will follow soon. For the time being ...

 
That's not a "library". That's a plain old class with static members and a private constructor. — Jeroen Vannevel 40 mins ago
 
so.. why do you keep using a term nobody else uses then?
 
0
Q: How do I make this line of Scala more readable?

OlofHere is a partial example of a text tokenizer, I'm looking for ways to improve one particular line in this code: implicit class textFile(val fileName: String) { def toDict() = { io.Source.fromFile(fileName).getLines.flatMap(_.split("\\\\r?\\\\n")).toList } } def filterComm...

 
7:17 PM
@JeroenVannevel sorry.. i guess.
@rolfl Yes, but doesn't my approach make life a little simpler?
@rolfl You are right about the hashCode. I was being an idiot.
 
Hmmm..... here's another problem.... actually, I will edit my answer
edited
gone.
 
@rolfl Weren't you a moderator? Was that for a temporary period? I saw you don't have the diamond.
An upvote wouldn't hurt though (after all that work, a little consolation?) :-)
 
-1
Q: Add a C# function into my HTML/CSS org Chart

user3641680Good Afternoon everyone, well here is my problem... I'm making a Organizational Chart for an enterprise, they share their org chart, and i'm building a modern chart for their web. The problem is that they want to see the information of a selected user in the chart (like the C.E.O.), but the inf...

 
@rolfl Will it be better if I remove hashCode() completely?
Anyway... TTGTB. Bye.
 
7:34 PM
0
Q: Validating Card Number in Delphi

Jerry DodgeAs part of processing card payments, before even attempting to process, I need to check and validate the card number to make sure it's valid. For this, I've encapsulated this validation in a record called TCardNumber. It does the trick for what it needs to do, tested with a Visa card and an Amex ...

 
7:45 PM
There are a couple first posts in the queue.
 
@syb0rg Oh, sure, I can be your beta tester and expand on existing stuff. I'll take a very good look at it, I've always wanted to do such a thing :)
 
@ambigram_maker He was, but he stepped down. That is partially why we had an election (which he could have won if he wanted).
 
Thanks, it looks like that does. I need to do a bit more testing and then get your solution past a code review ;-) then I'll accept this as the answer. — Tim D 49 secs ago
 
7:58 PM
0
Q: Eulerian Tour in python

kharandziukA recursive algorithm implementation of Eulerian tour search def sub(visited, _cur, graph): if not graph: return visited + [_cur] for i, edge in enumerate(graph): cur, nex = edge if _cur not in edge: continue _graph = graph[:] del _gra...

0
Q: Rational Polynomial Factoring method

Dando18I have written a class containing methods to factor a polynomial equation using the p over q method. The method returns a string that is the factored equation. Here is the class (can also be found here): public class RPF { private RPF(){} public static String solve(int... a){ ...

 
@Hosch250 Actually, that is mostly why we had an election.
 
hi
 
8:29 PM
Oh, this question is just awful:
-12
Q: Has there ever been a paper written by three people with last names starting with the letter K?

user128063I'm collaborating with a two other people with last names with the letter K, and I'm excited -- the results are potentially cool too-- about referring to our paper with the three initials. I know this is dumb, but please indulge me. The reason I'm in academia is because I stopped maturing after ...

 
@EthanBierlein Wow... indeed
 
In your opinion is reviewing documentation on-topic?
I mean documentation included with the code
 
@Caridorc Yes.
I suppose you mean JavaDoc style comments?
 
@Mast I mean docstring style comments and doctests
 
Yea, definitely.
 
8:43 PM
1
Q: Simple stream cipher encryption/decryption function

ZenohmThis is a Python implementation of a stream cipher encryption algorithm. This implementation originates from the one displayed on the TI-Basic wikidot cryptography page. I am well aware that this code breaks the holy 80 character limit, so any suggestion on how to make the code more succinct wou...

 
As long as their is actual code going with it.
 
Here my answer is only about the clarity of the docs and the differences between them and the code
 
Totally on-topic.
 
@Mast, perfect, I had a feeling that it was on-topic, just wanted a confirmation
 
@EthanBierlein Downvoted and flagged.
I'll just leave this here since there is no site-business going on anyway: Posted the following on Travel, feel free to answer if you happen to know it. First time flying ^^
0
Q: Maximum size accessory

MastWhile trying to figure out the baggage regulations for my next flight (KL 897 Amsterdam -> Beijing and the KL 898 back), I looked for what I'm allowed to transport (standard Economy). What I could find, was that I'm allowed 1 check-in (23 kg, 158cm) and 1 hand baggage + accessory (combined weigh...

TTGTB
 
8:48 PM
Q: What am I doing wrong? A: WPF
0
A: How to check the content of the selected item in a ListBox - Visual Basic 2015 (Visual Studio WPF)

Mat's Mug What am I doing wrong? WPF. You're doing WPF wrong. This isn't WinForms, where everything happens with an event handler in code-behind. WPF should radically change the way you think about UI; the code you have here looks like WinForms coded against WPF objects. Your model should have a clas...

 
lol
 
8:59 PM
0
Q: EF Generic Repository + Unit of Work pattern with support for Async - Am I doing it right?

JoeI'm working on a generic repository using EF 6 code first and trying to following the Unit of Work pattern. Unity is being used to inject my repositories, and I'm trying to get everything supporting Async. Here is my EF configuration + context: public class CustomDbConfiguration : DbConfigurat...

 
0
A: Hibernate entity design with a Currency class

Gerold BroserI don't see too much of an advantage in separating like this. Especially when considering Basic Java Persistence API Best Practices, Access Fields Rather Than Properties: I prefer to specify object-relational mapping by annotating entity fields directly, rather than annotating get/set methods...

 
If you have a budget for code review and pen testing then go for it — Neil McGuigan 39 secs ago
 
9:16 PM
@EthanBierlein Redacted. Watch your language, please.
 
0
Q: Print the frequency of characters as a horizontal histogram

cody.codesWell, I've used some of the feedback from my last posting to improve how I wrote this program. Mainly using the void parameter in main, initializing my int array to zero without using a for-loop, and better naming of variables. If there are some issues that are going on with my code, or there's s...

 
@Mast It's not like I'm following any official style guide. Don't take Brainfuck too seriously.
3
 
9:44 PM
@Mast yeah, most flight companies have a specific height&width you've got to get under
otherwise, your creditcard will cry at the terminal
 
0
Q: Vigenère cipher in C

psychedelic_alexFor my second major project in C, I decided to write an implementation of the Vigenère cipher in C. My program has command line options (optarg), can read from both a file or from a string specified with the -s option, and does both encryption and decryption of text. It also does error handling a...

 
try giving the airline a call
 
hmm... cloning 14.5k objects takes longer than I thought..
 
aahh that song is referenced by Detroit Metal City?
 
9:49 PM
i wouldn't know
 
hmm.alrighty mono, let's retry that...
 
10:04 PM
I'm a bit afraid of the F5 button right now...
Goes on for 16K transactions like that
@Mat'sMug Cross your fingers for me? ;D
 
I hope you generated that code
 
Of course
 
for both of our sanity
 
user image
4
Here we go
And done in 1:02
Now the real moment of truth, the sanity check
 
10:14 PM
Phew, I can start breathing again, everything is good
 
Greetings
 
Hello
 
How's it going?
 
Good :D
 
Awesome
 
10:23 PM
Just resolved over a year's worth of manual exception handling in one big query.
 
That's awesome!
How did you do it?
Trash the code?
 
Carefully ;)
 
With bombs?
 
@IsmaelMiguel 'one big query'
SQL Power!
 
So, with a turtle?
 
10:27 PM
Now that was just 90 days worth of exceptions, the log goes all the way back to 2008
 
How many do you think you might have?
 
Let's find out... I guess
2008-09-09 00:25:06.830
 
Unless you crash it
 
Oldest record
 
That's almost 7 years
 
10:29 PM
2554 days to be exact
 
Isn't that a lot of garbage?
 
Hmm, about 75K records over that period
Not as bad as I thought.
 
And what do you do with those?
Delete?
 
Try to get a positive match to an episode, if so reconcile, otherwise mark as error (as opposed to exception)
 
That sounds slow
 
10:35 PM
Takes about 6 minutes to run the whole query including reconciliation, it's not bad really
BBL
 
Oh
I was expecting a slowmo query
 
0
Q: Using functions to separate code for Fahrenheit to celsius conversion

cody.codesI'm relatively new to programming, and I've been wondering with a problem such as this, how can I think about decomposing the code into its constituent functions? I went the simplest route I could, just putting the formula in it's own function. I believe this makes the code more readable, but the...

 
It's rarely slowmo when I write the code :)
 
Except those times when it is slowmo
 
I just earned 100 rep on Programmers.
 
10:47 PM
Thank me later dude
 
I wasn't thanking anyone.
I earned it in less than 24 hours. Fastest I've earned rep as a brand new user.
 
I ran out of votes (almost half were downvotes) and flags too.
 
I have 5 routines at the end of the query for doing the reconciliation, only one takes quite a while because it tries to do partial string matches on both sides of the join
 
That is really slow
But I'm kinda amazed that it is quite fast
 
10:56 PM
You haven't done much database work have you?
2
 
11:17 PM
0
Q: Shift positive integers in C

Michael ChavI would like to write a function in C that turns all negative values into zeros then shifts the positive numbers to the beginning of the array, maintaining the order of the positive integers in the array. void shift_positives(int values[], int num_values) { int i; int last_zero; int ...

 
11:36 PM
@Morwenn Know much about CMake?
 
11:59 PM
@Phrancis how'd it go?
 
2 hours ago, by Phrancis
Phew, I can start breathing again, everything is good
mods should read .... ;-0
 

« first day (856 days earlier)      last day (3158 days later) »