« first day (1146 days earlier)      last day (3168 days later) » 
00:00 - 17:0017:00 - 00:00

17:01
0
Q: Simulating a random packet routing algorithm and printing packet statistics in Java

coderoddeI have this short program for simulating a random packet routing algorithm: Packet.java package net.coderodde.simulation.network; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /** * This class implements a ...

0
Q: Spreadsheets keys converter - follow up

MORTALBased on previous question , I have implemented all suggestions. also, i have fixed all unnecessary copies for std::string objects in the code. Is there any thing else can be done to this code? #include <iostream> #include <string> #include <regex> #include <cctype> #include <limits> #include <...

I'm sorry, you've included pictures, not code. Reviewers are likely to spend anywhere between 30 and 120 minutes going over your code - the very least you can do is spend a minimal effort to make a decent post. — Mat's Mug ♦ 9 secs ago
hell no
that's literally an insult to anyone reading
and the best part:
> Please don't provide copy paste answers as i need to include these in my Mtech Thesis
@Mat'sMug imgur is blocked at work (but not reddit but that's another topic) even if I could help this poster, I can't even see the code!
and this is why we don't review pictures when the code can be pasted into the post from the IDE
@JHache Everything I have ever wanted to know that would have been on-topic for Stack Overflow has been (A) obvious/interesting enough that it's already been asked and I found it via Google, or (B) so obscure that my question on it gets ignored/nobody knows the answer/gets closed as "too specific."
there are languages that make it impossible though. but when you post Java code, you have no reason not to include it as code blocks.
17:06
I'm tempted to write "Can you give me instructions on how to run your code?"
Step 1: Download this visual text recognition package.
Step 2: ...
It's correct. However, this is kind of too broad or too localized for Stack Overflow. You could have easily tested this yourself. If you know it works and just want it reviewd, I would suggest using Code Review. — Cᴏʀʏ 15 secs ago
0
Q: Memory Game using Pygame and Python

Sruthi KuradaI am trying to create a memory game using python and pygame. There is one main problem. When I try to flip a card over it doesn't work. I'm sure it's something silly I did. Could you please help me with this. Here is my code: import pygame as py import random py.init() FPS = 30 display_width = ...

0
Q: Knights Tour - Improved Refactored Recursive Breadth First Search for

pacmaninbwThis development and testing was done on a Dell M6400 Laptop (Intel Core 2 Duo) running Centos 7, g++ compiler, compiler switches -O3 -std=c++0x -D__cplusplus=201103L. (machine bought August 2009 with Windows XP ). This is a refactored version of the code I presented in Recursive Breadth First S...

I don't think this question should not be posted on Stack Overflow. It belongs in Code Review. — Ishan M 32 secs ago
Thank you Cory, I was not aware of the code review sub-domain, I will use it in the future for similar questions. — erasmo carlos 6 secs ago
@Duga I don't think this question should not... that hurt my head
17:21
woot! "sub-domain" that's a new one, and heck it's accurate for once!
3
@MosesKoledoye The following are *all* Off-Topic on Code Review: Code that does not work as intended. Example Code. Hypothetical Code. Pseudo-Code. Stub Code. Code that the OP didn't write or does not own. Code review has a tightly-defined scope: "Code that works as intended, that the OP understands, that they want general feedback about". Anything and everything else, including specific questions E.G. "How to reduce memory-usage in this algorithm" are Off-Topic and/or better asked elsewhere. — Zak 55 secs ago
Something technically correct can't be wrong ^^
Zak
Zak
In response to that:
@user2357112 OP is seeking for opinion about their code, which is always subjective. I assume it will find an audience there. — Moses Koledoye 38 mins ago
I was just going to go "You assumed wrong" but I felt like venting.
0
Q: Data structure to store large numbers of runtime-dependent arithmetic types

EraZ3712Warning: lots of code. This is my first time posting on Code Review, so I apologize in advance if anything is unusual or could have been written better. Context The program in which I am using this data structure is a DAQ to CSV conversion tool. Put simply, the goal is to read from binary and ...

17:33
@Mat'sMug I wanted to give you 1000 upvotes on your comment but unfortunately I can't :-(
0
Q: i need to change my form process into OOP

ashrafthis is my currently process.php how can i change this into OOP? im still trying to learn OOP and i could not figure it out.i also need to sanitize the $_POST and get it into OOP class somehow. if possible i want to change from mysqli to pdo too. /* if(!defined('INCLUDE_CHECK')) die('You are ...

@CaptainObvious perhaps. but you also need a title that tells us what your code does
Meh, too broad
If you can edit this post to be only about improving the code towards a more OOP approach, and change the title to tell us what the code does, then we'll happily reopen it. Cheers! — Mat's Mug ♦ 14 secs ago
17:51
@EBrown Can only be done if you got the professional version.
1
Q: calculate loan rate based on payment and duration in months

Uncle IrohSo I have the following code which works well-ish. Looking for ideas on how to improve it. public void testItAll() { System.err.println(determineRate(226.34, 25.00, 12)); System.err.println(determineRate(5800.00, 29.00, 31)); System.err.println(determineRate(4000.00, 25.00, 460)); ...

@jrh No, leave them in and notify whatever is behind them is not up for review and not public. It will have to do. A small description of what's being called would help though.
@EBrown Did you had time to play Halo 5 a bit ?
@Mast I have a version that supports it, but that's not what I'm having an issue with.
@Marc-Andre Yeah, but I still have to do that 35GB update.
Sometimes, you need to put things in perspective:
Why are they designed that way? They were designed earlier than 1910 near the birth of the electric light bulb. They had bigger things to worry about in those days than sticking your finger in the socket accidently - things like getting electricity to the home so they didn't have to use gas or kerosene lighting with open flames and the possibility of accumulating gas which could explode when you tried to light them.. — davidbak yesterday
17:56
It's literally going to take 26 hours to download on my internet connection.
So far I'm enjoying the campaign.
@EBrown oh god! You played the campaign ? I'm not sure you can do anything else withouth the update
And there will be a new patch soon too
@EBrown Is there a reason you're on an ancient internet connection?
@Marc-Andre Yeah, I'm playing the campaign atm. I need to get that update downloaded here soon.
@Mast Location location location.
@EBrown Yea, you want to do it for all versions at once. I'm not sure how to do that. If all devices would run on the same OS, it would've been easier.
That's my internet connection.
17:59
Oh Lord...
And what's the distance towards the router that thing is pointing at?
It isn't satellite I hope?
That's expensive as heck...
That's my backyard.
Oh.
@Mast About 1.5 miles.
@Mast Nope, antenna-to-antenna.
18:01
it might be faster to drive into town and download the patch from a place with free wifi
Probably...
@DanLyons Drive into town, with my TV and Xbox?
Going a bit off the reservation here, but if that's all the code review said, I'd ask for a bit of clarification. Whoever made that comment probably has something in mind and, if not made apparent by other comments on the review, you ought to ask them what it is. — user4581301 8 secs ago
What town?
No, with a laptop and HDD.
18:02
There's nothing in town.
Implement RFC 1149 and send a carrier pigeon with a USB key off to somewhere with good bandwidth :)
2
@EBrown have you considered IPoAC?
@Mat'sMug I have, not an option here.
@DanLyons gah, beat me to it lol
We only have IPoHC. And hawks are deadly.
2
18:04
Hawks count as avian carriers I'd think
I tried IPoFC (finches) but they're unreliable.
They also fly a lot faster and can carry more weight. I see increased bandwith.
Cardinals are the state bird, so clearly they cannot be used as they're protected.
And hummingbirds have a much shorter range.
I've exhausted my avian carrier options.
So, we use IPoWAC.
The problem, is that bandwidth is limited.
@CaptainObvious Ew
well that's comforting. I was comparing my speedtest.net results with Aussie folks last night, it's depressing
18:06
I think it's called WISP.
That's my ISP's website.
The last 3 digits of my rep currently are 666
Time to do some devilish things
@syb0rg you could post a cobol question
2
Zak
Zak
Work:
18:11
dayum
Holy carp... that's a wall of code if I ever saw one — syb0rg 10 secs ago
Zak
Zak
@Mat'sMug Now if only my PC was powerful enough to keep up with it ^^
@syb0rg Evidently never seen some of my questions ^^
2
7
Q: Class: 2D Variant Array

Zak Note: Yes. It's big. I'm not expecting commensurately long/detailed answers (though if anyone wants to write one, you'll definitely be receiving a substantial bounty). This class is going to be used a lot in my VBA development so any reviews at all would be immensely helpful. Even if it'...

Y'all need to break up your code
in VBA Rubberducking, 27 mins ago, by Duga
[rubberduck-vba/Rubberduck] build for commit 56334460 on next: AppVeyor build failed
on it
@Zak ಠ_ಠ
18:13
@EBrown What's the closest city with a free Wi-Fi spot of any decent speed near you?
0
Q: HTML5 canvas snake game

ConfettimakerMy most recent project is this simple snake game, and I would like to know what you guys think of it and if you have any suggestions. All feedback is welcome, constructive criticism is appreciated. var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); var keys = ...

@Mast An hour away.
yikes
@Mat'sMug Why was I pung?
44down/52up at work
18:14
As long as it's double your own speed, it's worth a drive very fast.
@EBrown it's depressing that that's only slower than 82%
@syb0rg "break up your code" ..oh wait, you didn't mean "break" that way did you
@Mast Yeah, but I can't DL this update on anything except my Xbox.
@DanLyons I think the rest uses the same technique :P
@Mat'sMug Oh I thought you wanted me to help you fix it haha
18:15
@Mast I suspect there's still a non-trivial number of people on dial-up
nah, kidding actually. that's just AppVeyor randomly choking on nuget
@EBrown Hopefully you can after you get an answer on that Q.
@Mast Not likely, it's a game update for Halo 5 on the Xbox One.
@DanLyons dial-up, as in, 14.4Kb/s??
it can get up to 53.3k, but yeah
or was it 53.2 - I don't remember now :/
18:16
DSL at < 1Mbps is pretty common here.
Otherwise known as 56k, but never exactly 56k.
I don't know of any 14.4k connections still in use.
there was a time when I could tell what speed it was going to be based upon the handshake tones
Zak
Zak
@Mat'sMug Do you have any idea how much money AoL still makes from Dial-Up?
(Clue: their number of Dial-Up subscriptions is in 7 figures)
AOL is still alive??
faints
I wonder...if it's possible to do dial-up over a cellular line.
Zak
Zak
18:19
Hell, there are still highly profitable telegram companies operating around the world.
@EBrown two words: WiFi. HotSpot.
Zak
Zak
IIRC, AoL's Dial-Up Unit makes over $100,000,000 in Revenue every year.
hi @MosesKoledoye!
brb need to apply for telegramer job
telegrammarian?
Zak
Zak
@N3buchadnezzar that's! not even in the top 10%. Damn, I need to emigrate.
Expensive af though. Well I am a student so we have free access, but normally it costs blood.
@N3buchadnezzar Yup
Hah, Necromancer badge get.
If you're interested in constructive feedback on any/all aspects of the code, feel free to edit your working code into the question. This is what this site is about =) — Mat's Mug ♦ 6 secs ago
OP fixed their code, just not in the question
18:34
Yeah, if he fixes that it should open again.
-1
Q: Java: Prime Number Search

Khaled ZehadI am very new to java and I was trying to create a simple program that finds the amount of prime numbers less than or equal to a certain integer that is inputted by the user. this is the code import java.util.Scanner; public class Main { public static void main(String[] args) { int N; ...

@Mat'sMug Hi @Mat'sMug
Welcome to The 2nd Monitor! =)
Yep, thank you :)
Read your guide. Oh my!
the guide you posted rather
oh, I had nothing to do with it.. but it's an awesome post nonetheless
while you're here:
26
Q: Welcome to The 2nd Monitor!

PhrancisSo, you have found your way to the Code Review main chat room, The 2nd Monitor, perhaps for one of these reasons: You were invited or "pinged" by a site moderator or other user to discuss a post on the main Code Review site; You visited Code Review for the 1st or Nth time, and noticed the chat ...

(might as well!)
Zak
Zak
18:47
@MosesKoledoye Hey. Sorry if I went a bit overboard earlier.
Just very, very tired at the deluge of inappropriate recommendations we get from SO, and your post was unfortunate to catch me at a point where I felt like venting.
@Zak haha, I can empathize with people
I found this chatroom through one of your profiles
Avoid select. If code works fine, ask on code review. — findwindow 33 secs ago
@Duga this guy should rename himself @foundcr
Zak
Zak
@Duga Yay. More VBA!
Not that I write much these days. My mind is full of SQL Server stuff.
@Zak yeah you thoroughly nailed that last VBA review there dude
Zak
Zak
18:51
@Mat'sMug cheers!
@Mat'sMug If only I had a star left ^^
spidey senses tell me that JHags OP is our keep-losing-my-credentials friend
lol, Private Sub GenerateComplaint_Click() has a compile error
Looks like it works... I mean, it generates a [compiler] complaint right? </dad-joke>Mat's Mug 1 min ago
I should stop doing that
in VBA Rubberducking, 15 secs ago, by Hosch250
@Mat'sMug @SlowLearner @FreeMan We're about 1.5 days from the next release--what do you want fixed the most?
@Zak ^
Been a while since I answered an SO question: stackoverflow.com/a/37999784/1937270
"a while" == 1 minute?
19:06
@Mat'sMug Psh before that one I just anwered, I posted one in December
that'll count for "a while" I guess
poor kids. "daddy are we there yet?" "in a little while" (arrives 6 months later)
You might want to move this to a more appropriate StackExchange forum. SO is more about programming problems than about the design level of things. For instance, they might give you better response in CodeReview. — Prune 28 secs ago
0
Q: What is the best way to design this UI?

user1429322I am trying to make the classes as close to representing the UI as shown below in python. I have made the class inherit accordingly. Any suggestions to improve this design? I am skeptical of this design as I think there is something wrong. The main purpose of this is for each section to have thei...

@CaptainObvious Hmmmmm.........
nope
> This is just the design here and the syntax may not be the correct one
and Class A/B/C/D ...I mean, nope.
19:22
That explains it! Hey thanks man, I've seen your github btw, I like Khronos — JohnDoeYo 1 min ago
Lol, I love that side comment
love the "well where's your frakkin' GitHub star then" reply =)
I did look for it lol
@Mat'sMug Is that the same guy as J Hache who was here earlier?
@syb0rg seems like an interesting tool
@mast if he is, he's an impostor
@JHache Khronos? Yes, hopefully
Trying to make him a bit more portable currently (curse you Windows)
19:34
@JHache Well, that clears that up :-))
@syb0rg yeah, I like that you're building a tool with your own tritium. giving yourself more work hahah
@Mast hahaha, I do agree with the original side-comment
@JHache Well, I didn't really like the other speech synthesizers
@syb0rg it's all part of your master plan isn't it c god?
@JHache I also had to fork this since the project seemed to be abandoned: github.com/syb0rg/PortAudio2
Problematic compilation with that on Windows ^^
And its starting to break on Mac
Zak
Zak
DB Schema draft 2 is now done. Awesome.
19:37
@syb0rg I should probably start to use linux more, considering our platforms at work
all of it is built on windows ran on linux
Zak
Zak
Now I can go on holiday and forget the whole thing
6
@Zak yay! enjoy your weekend. I'm finally leaving work. See you guys soon
0
Q: Adding free function to replace ReverseLetters in Palindrome

KristineFor this I'm needing to remove the 2nd list (ReverseLetters), and incorporate the remove space and other non letters using the free() function. To where I only have 2 lists. The getPhrase and compare. Just need to know where to get started. #include <stdio.h> #include <stdlib.h> #include <ctype.h>...

@JHache All of us here at OSI use Windows machines, to which we SSH into Linux machines to develop on those instead
19:38
@Zak Looks good!
Monking!
@Phrancis Hello!
@Zak And of-course your drawing was bigger than the field available to you.
Gotta keep up tradition.
Zak
Zak
@Mast You know me, never saw a size limit I didn't want to break ^^
4
Writing an actual application for the first time, it's a lot of work but I've been learning so much!
19:42
@Phrancis "Actual"?
Yeah, instead of just scripts or practice/book stuff
It's a Java 8 client to interact with a SQL Server business DB
GUI and all
Ohhhh, noice
Not bad.
It's ugly (cuz Swing) but it works good, so far, albeit doesn't do much yet. Working on the Manage Persons parts now
19:47
@Phrancis Can you not use JavaFX?
Don't really wanna, TBH
Understandable
Seems like overkill
0
Q: Database query with Eloquent

Alexandr DadykinI have got two tables articles and tags in the database. My goal was to retrieve all fields from articles table and one category field from tags table with Eloquent. I couldn't do this so instead I came up with the following method in my controller. public function showCategory($category){ $...

Been tinkering with JTable for a few hours, finally got the thing to work OK
Zak
Zak
19:57
This looks much clearer now.
I'm just hacking through PortAudio2 right now trying to get it to build
Zak
Zak
And now I actually will go on holiday
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Reduce a string using grammar-like rules
If you have a method that returns something, can you return in a try block and execute a finally still?
(e.g. return a result set from a database connection, but still try to close the connection)
definitely
finally runs regardless of whether or not an exception was thrown
in C# you wrap a disposable with a using block, which is syntactic sugar for a try...finally block
20:12
So I could just use try-with-resources, which I believe is Java's equivalent of using
there's nothing like IDisposable in Java?
@Phrancis that sounds like a good fit
I'm not sure what an IDisposable is, I would assume there is though
Oh Java has AutoClosable interface, that's probably the equivalent of IDisposable
I doubt that wait yeah, seems you're right.
0
Q: WebGL performance with ~5000 movable rectangles (ivanK)

Urban KristanMy runnable code in webpackbin (drag the little rectangles) (the code for dragging could probably be more concise, but this is just what I hacked together) ivanK graphics library Basically, I need a drawing of circa 5000 draggable rectangles, keeping the dragging relatively smooth. For drag ha...

25
A: Should Closeable be used as the Java equivalent for .NET's IDisposable?

Paul GrokeI'm sure most people are aware of it, but since this question is still among the top results when searching for "IDisposable Java" (#2 result for me just now), and it's still not mentioned here... Things have changed with Java 7: there now is AutoCloseable. Which isn't tied to streams and suppor...

try-with-resources would be it
20:18
Not tested, but I think this should work
    static ResultSet execute(JdbcConnectionCredentials credentials, String sqlQuery)
    throws SQLException, ClassNotFoundException {
        DatabaseConnector connector = new DatabaseConnector(credentials);

        try (Connection connection = connector.getJdbcConnection()) {
            Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            return statement.executeQuery(sqlQuery);
        } finally {
            connector.closeJdbcConnection();
I should probably pass this method a Statement or PreparedStatement instead of a String, though
90% of the way to a Windows DLL of PortAudio2
@CaptainObvious NONONONONONO
@syb0rg is it really broken? Or is it a "must include code to be reviewed" case?
@Phrancis Just include the code
Whoops, I did the wrong close reason
class SelectQueryExecutor {
    static ResultSet execute(JdbcConnectionCredentials credentials, PreparedStatement sqlQuery)
    throws SQLException, ClassNotFoundException {
        DatabaseConnector connector = new DatabaseConnector(credentials);

        try (Connection connection = connector.getJdbcConnection()) {
            return sqlQuery.executeQuery();
        } finally {
            connector.closeJdbcConnection();
        }
    }
}
Looks a bit better :)
20:34
Gosh Java makes this confusing. </rant>
Although, you can't prepare a statement without a connection... which the caller won't have (yet)... so passing it a prepared statement... might prove difficult
Preparing the statement in another way isn't an option?
btw... Statement is AutoCloseable, too
@Mast preparing a statement by definition requires you to connect to the db
@Phrancis this shouldn't actually work. Your PreparedStatement internally has an associated connection
> SQLException - if a database access error occurs or this method is called on a closed connection
Ah, ok
How about this? (untested, maybe I should test something already)
    static ResultSet execute(JdbcConnectionCredentials credentials, String sqlQuery)
        throws SQLException, ClassNotFoundException {

        DatabaseConnector connector = new DatabaseConnector(credentials);

        try (Connection connection = connector.getJdbcConnection()) {
            try (PreparedStatement statement = connection.prepareStatement(sqlQuery)) {
                return statement.executeQuery();
            }
        } finally {
            connector.closeJdbcConnection();
No parameters?
20:40
WOOO I BUILT IT
2
sounds right. You can actually reduce the level of nesting once
3/5 Khronos dependencies built for Windows
@Mat'sMug The caller will take parameters and pass the built query to this method
also if you're running arbitrary SQL, you can just use a Statement, since you're not using any benefits of PreparedStatement
@syb0rg What's the other 2?
20:41
@Phrancis that's not how this works
@Mast LibSndFile and tritium
How many lines of code so far?
You don't assemble the SQL yourself. Just don't...
@Vogel612 This is all new to me lol
LibSndFile I can just do some hackery with to make it work most likely
20:42
But the server should be dealing with cmd parameters, not the client code concatenating user input into a cmd string... this isn't MS-Access!
tritium I'm actually going to have to build in support
@N3buchadnezzar For?
To be fair, all the SQL is going to be is calling stored procs, no arbitrary queries
and storedprocs don't have parameters?
Some do some don't
Do you even need that thing you're doing there?
20:43
You can still screw up a SP if your params aren't processed server-side
@Phrancis Khronos?
because it seems to me you're prematurely trying to address something that doesn't need fixing for your usecase
@Vogel612 Hmm maybe not, I meant this to be kind of a utility so I don't have to keep repeating the same code over and over, but now that I look at it, it's really not that much code
it's basically those two try-with resources-statements. And everything in between those will most likely be different depending on which SP you're calling
Better just scratch this for now, and address it if it becomes a problem, thanks for the sanity check @Vogel612 :)
20:45
@N3buchadnezzar I think you meant to ping me haha
Khronos alone has ~1k LOC
Khronos's dependencies are the LOC hogs
If you have working code which merely needs improvements then you're probably in the wrong place with this post. Code Review is where they handle existing / working code and do their upmost to improve it in terms of speed, security, sustainability, and longevity. Give it a try. They're good! — Ralph 54 secs ago
Only problem is I solved the problem, but not within PortAudio2's git branch
So now I have to replicate all of the fixes
Then push them off to GitHub
Iterating an array will be faster because of less overhead (no spreadsheet interactions), but will still be O(n). If your ID's are unique, you can easily make that O(1) with a proper data structure - try storing the ID's as Collection or Scripting.Dictionary keys. And yeah, take this to Code Review ;-) — Mat's Mug 49 secs ago
20:52
@Duga I like that this is an auto-comment
@Vogel612 @Mat'sMug what do you think of this one? gist.github.com/Phrancis/ea0268a535534aa3b5f94f08e0e38974
looks like usual java database layer code
OK, good
you should be able to wrap the PreparedStatement into a try-with-resources, too
Wouldn't that get a bit clunky if I had a query with a good number of parameters?
20:58
eh? why?
you have to set those after you created the statement anyways.
try(Connection connection = connector.getJdbcConnection();
  PreparedStatement statement = connection.prepareStatement("execute PsychoProductions.usp_GetAllPersons;")) {
    return statement.executeQuery();
} finally {
    connector.closeJdbcConnection();
}
So, something like try(PreparedStatement st = conn.prepareStatement(execute usp_MyProc ?,?,?,?,?) { /*set the params here*/ } ?
correct
Oh, that's not too bad
1
Q: Random distribution in Ruby

Joseph WeissmanBelow is a Ruby implementation of a random statistical event, based on a hash with the actual observed counts of outcomes. I'd be interested in feedback in particular on what techniques I might use to avoid a loop-based accumulator in the RandomEvent#predict! method. I'm also very curious as wel...

1
Q: Performance of .asc parser

Jeremy WeirichI've written a quick script for a coworker to split a large CAN log into smaller chunks. (If you're not familiar with CAN, it's a communication protocol used by the ECUs in many cars.) I know where to split because I've inserted dummy CAN messages (with ID 0x00) at the start of each section, an...

21:15
possible answer invalidation by imoteb on question by imoteb: codereview.stackexchange.com/posts/132440/revisions
0
Q: Concurrent Bidirectional Dictionary C#

SidneyOk, so I've been agonizing over this for an hour or two. I require a bidirectional dictionary that was thread safe. From what I understand about dictionaries, they're thread safe when being read from, but no so much when being written to. I've tried to write this code snippet to my understanding ...

@Duga wat??
I'm running into another problem where a ResultSet object is closed (and thus inaccessible) returning from the method, probably because the connection is closed... Does it seem like I should move the try-with-resources for the connection to the calling code, and just keep the prepared statement in that method and pass the connection along with the parameters?
I wonder whether you can do that :/
sometimes I hate scoping
21:30
Well, this clearly isn't going to work as-is, so I guess I'll try moving the connection code to the caller...
You have to use the resultset while the connection (and the PreparedStatement) are active
And try-with-resources will close either of those once it's done...
yeap
I have a utility method to transform a ResultSet into a String[][] so maybe I should just have those return that instead
and when you return the ResultSet from the method, you can't keep a reference to those two, which results in resource leakage
21:33
(I need a String[][] anyways to put it in a Swing table)
eurgh Swing...
yea, just doing that sounds about right
possible answer invalidation by Szilard Magyar on question by Szilard Magyar: codereview.stackexchange.com/posts/132065/revisions
jrh
jrh
I guess the tour kind of answers that question, whoops
@jrh I daresay it doesn't fit Programmers
you could try to formulate it for CR again, but I don't expect too much insight out of it, unless you can explain the data structure's necessity and design well enough
jrh
jrh
@Vogel612 Could you explain why it doesn't seem to be a good fit for programmers? The tour mentions data structures programmers.stackexchange.com/tour
though it might generate discussion or be opinion based?
21:40
@jrh they'll probably refer you to us instead
the tour gives a "gist" of the site, the rules are in their help center though.
it says there they answer "conceptual questions about software development"
depending on how you frame the question you may very well be on-topic there
but I'm not a regular over there :/
jrh
jrh
that helps, thanks; I've never posted there either
PHEW finally got it working, that try-with-resources has gotten pretty ugly @Vogel612 gist.github.com/Phrancis/2d26bdf19eae5fb0637b3f378f354a6b
Maybe you could ask in their main chatroom
@Phrancis that's only because of the options :D
You can actually static import your convert method to get that ugly classname out of the return statement
@Vogel612 Yeah, it breaks without them though (THANKS JDBC DRIVER)
aside from that it looks good though
lol... insta 5 valid flags when cleanup-flagging comments on an answer invalidation.
I should do that more often :D
21:45
@Vogel612 how do you do that?
import static utility.ResultSetToString2dArray.convert;
sidenote: name the method after what it does
and group related methods into one utility class
import static utility.ResultSetUtil.print;
import static utility.ResultSetUtil.toString2dArray;
Good idea!
^^ this makes static import methods look significantly cleaner. and if you don't static import them, the classnames still add significant context instead of being a methodname :D
sometimes I wish java would support free-form functions
and not make me jump through that static import hoop
Opening 200 rep bounty on my latest question
monking
monking :)
21:50
monking
it's friday today :D
\o/
@Vogel612 Java could definitely use a bit of a FP touch
possible answer invalidation by justthom8 on question by justthom8: codereview.stackexchange.com/posts/132802/revisions
good monking to you too @Duga
@Duga rollbacked and commented. also removed edit scars in original revision
22:09
monking
monking
Full statement by Comodo CEO on company forum about LetsEncrypt trademark and business model https://t.co/ulQH39sCYQ
22:30
@Quill omg
@SwiftOnSecurity wont someone please think of Comodo's business model https://t.co/0IcA0NRbyR
1
Q: Calculating protein mass

MastThis question is part of a series solving the Rosalind challenges. For the previous question in this series, see A sequence of mistakes. The repository with all my up-to-date solutions so far can be found here. Problem: PRTM In a weighted alphabet, every symbol is assigned a positive real ...

22:55
did anyone try to link to boost (c++ libraries collection) libraries? I found bins but linker says that it can't resolve some symbols
@OlzhasZhumabek You might have an old or incompatible version.
@Mast, I just downloaded and build it ... I feel I'm missing something really simple
I feel like first challenge of trying any new library/programming language is to build and run first example
That's usually a good idea, yea.
Could be a linking step set-up incorrectly, or assuming system variables you don't have or have differently.
I haven't used Boost in forever.
it has 3 libs folders inside, each with .lib files ^^ tried all, no luck
What do the docs say? That's more important.
23:04
it doesn't work with way mentioned in docs
want to master asio, heard that server programming is really bountiful
23:19
0
Q: Max difference between two array elements

onedayCan I get feedback on below code ? Problem statement is Maximum difference between two elements such that larger element appears after the smaller number Please Comment on - Would this solution be still considered O(n) for time complexity ? I know I do one additional pass but I found this way to...

0
Q: pokémon style game using java, having some issues getting it to display the health on JButtons "health" and "useHealth",

paperclip150import java.awt.BorderLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public ...

@CaptainObvious broken
00:00 - 17:0017:00 - 00:00

« first day (1146 days earlier)      last day (3168 days later) »