« first day (625 days earlier)      last day (3383 days later) » 

12:00 AM
[skiwi2/HearthMonitor-LogReader] 1 commits. 0 issues opened and 0 closed
[retailcoder/Rubberduck] 3 commits. 5 issues opened and 0 closed
[rolfl/StackMonkey] 7 commits. 2 issues opened and 1 closed
 
What's special about this site is that it's hard to get down votes. Sure, you might not get a ton of votes(or no votes at all), but you'd have to ask a really bad question/answer to get downvotes.
 
0
Q: Find files with similar contents

OEPI'm not normally a C programmer but thought I'd take a shot at making something useful. This is a C utility I wrote to judge how similar several files are using the algorithm I think diff traditionally uses. I'm interested in general feedback. I don't write C usually but I do read it from time to...

 
12:17 AM
@SirPython To be fair, that question truly appears to be trolling...
 
0
Q: Make JOptionPane repeat several times

Ana Duro import java.awt.*; import java.util.*; import javax.swing.JOptionPane; public class Test { public static void main(String[] args) { String[] names = new String[5]; Integer[] grades = new Integer[5]; names[0] =( JOptionPane.showInputDialog(null,"Insert first name")); grades[0] = Integer.parseInt(...

 
/**
 * Stand back kiddies, this is how a real
 * programmer does things.
 *
 **/
 
Is that a comment you left on your code for the future kiddies looking at the code @Phrancis
 
Hahah, no it's in that stupid PHP troll question
 
seriously : ))))
he is Pull Hof Phit
 
12:23 AM
Ain't that the truth
 
@200_success I wish we could exclude some tags in this query. It recommends some questions which have tags such as facebook and all that I have never done before... :) but quite an interesting tool
@Phrancis are you familiar with OpenID by any chance?
 
Can we have that awful question just nuked?
It doesn't include the last brace, so does that make it stub code?
It looks on topic, but incredibly basic.
2 close votes before I commented: codereview.stackexchange.com/questions/77933/…
Not nice for the user.
 
12:54 AM
@SirPython There's a history in that question too... It was targeted as a reversal by hngrif, and pimped.
 
@rolfl Why hasn't it been deleted?
 
Aug 20 '14 at 0:49, by nhgrif
This, though, is still 1 vote away from 1 vote away: http://codereview.stackexchange.com/questions/10167/how-could-i-optimize-this-sc‌​ript/60435#60435
A comment (deleted answer too) on that question is:
> Remove the comments, extra spaces, and CRLF, and PHP interpreter will read the script faster. Consider shorter names for functions and variables. – Michael Mar 20 '12 at 5:24
 
Hey CR!
 
Hey Alex
 
0
Q: Efficiently execute models in parallel?

davidI have various models and I was executing those models sequentially one by one so now I am executing those models in parallel in multithreaded way using ExecutorService. I will have around 200 models maximum. Below is my code where I am executing those models in parallel and it is working fine -...

 
1:15 AM
My question hasn't received the attention I was hoping for, and it seems it's attracted few! A little self-promotion is in order
3
Q: Order a delicious pie here

Alex LFor a quick summary: I've created this internal web application, and I've hit a point where I can really see the mess I've made. I need some help separating the logic, the view, and the data. More detail: Over the past few months, I've been doing all I can to learn more about JavaScript built we...

 
0
Q: Reading separate components of 8.3 filename into proper filename in C

user966939I need to read an archive file format which stores filenames as 8 characters for the name (null-terminated if less than 8 characters, not otherwise), immediately followed by 3 characters for the extension (i.e. without a dot). So basically, I need to read the components and add a dot between the ...

1
Q: How to avoid of nested code when parsing

SauvageI'm trying to parse an estimated travel duration and distance between two waypoints using google directions api. Tap on this to see an example of data received. private class func parseTravelData( data: AnyObject!, mode: ESTMode, completion: (NSDictionary?) -> Void) { var rec...

 
@AlexL I don't know JS, but why don't you create an Order class?
 
1:52 AM
0
Q: Ruby Soduku X-wing solution

ajn123I have written a sudoku solver, for the euler problem and also packaged it into a ruby gem. In my solution strategies I do alot of iteration (double/triple nested loops, I am coming from Java/C). One method in particular has a lot of if checks and iteration. Would it be better to package this ...

 
@Hosch250 Hi and thanks for the welcome. I have included the most interesting parts of the code. — OEP 3 mins ago
Please reopen this question.
 
@Hosch250 Done
 
Thanks.
 
How do you vote to reopen a question?
 
You have to have enough rep to do that.
 
1:56 AM
Ah. Thanks.
 
@Hosch250 That would be a possibility, however I'm looking for something more fundamental, such as an architecture or paradigm to follow
 
500 rep
 
But can't everybody vote to close down a question?
 
@AlexL OK.
I need to kill a zombie.
 
2:02 AM
@SirPython No, you can flag it wit a close reason.
 
I see - so basically a new user's flags do nothing?
Or do they notify a moderator?
 
They earn you badges, for one.
Also, somebody gets notified.
Not sure if it is moderator only, or if it acts as a regular close vote.
 
I need to learn more about these new-fangled JavaScript libraries - I can hardly understand half these zombies...
 
You flagging the post with the close-reason will put the question in the close review queue, at which point, people with enough rep will see and vote ont he Q.
Your name will not appear as one of the closers.
 
I noticed that once - I thought for some reason my flag didn't reach the server.
 
2:07 AM
0
Q: A thread-safe initialization guard

me--I have written a type with the following public API: public sealed class InitializationGuard { public bool IsUninitialized { get; } public bool IsInitializing { get; } public bool IsInitialized { get; } public InitializationTrans...

 
No, you can see your flags in your account.
 
> off-topic – SirPython Jan 13 at 22:00 helpful
 
What is that from?
 
That is from your profile.
 
Am I able to see this?
 
2:09 AM
you flagged a question as a close question. It hit the close review queue, and other people agreed with you.
 
Yes, you can see it.
 
@SirPython Yes, only you, and moderators can see your page: codereview.stackexchange.com/users/flag-summary/59481
Youc an access it from your profile by clicking on the numbers next to your 'flags' entry.
 
Oh - I didn't realize that that 2 was a link.
 
Only you get to see most of those private details though in your profile (and moderators).
 
Can someone confirm something for me? On this post it seems as though the user is just trying to convert a JavaScript object to JSON. Is that correct, or am I just seeing things?
Wait
Nevermind
 
2:17 AM
@SirPython That would be a good flag.
 
The link you just posted?
 
You get badges for your flagging.
Yup.
 
Would the "code that you maintain" flag be suitable?
 
The second option under off-topic, I think.
The one about other people's code.
 
Yeah.
I put that down.
 
2:19 AM
If he wrote that code, he would understand it (I assume).
 
True. Although, would it still be off-topic if it was written by a peer on a project they were both working on?
 
Yes, "written by another person."
 
I see.
 
Explanations are off-topic. We review, not explain.
 
Is it bad that I posted a comment directing him to an answer on another SE site?
 
2:21 AM
That is for the moderators to say.
Some think so.
 
I think I remember rolfl saying not to do that... I'll take it down.
 
It is already down.
Was that you, or a mod?
 
Me.
 
OK.
2 more to go.
CV's, I mean.
 
I thought I had enough rep to see how many votes there are.
Oh - on my own questions.
 
2:24 AM
You can see your privileges from your account too.
Seeing CV votes comes with the CV privilege, I think.
I found me a nice zombie.
I'm going to do it later. I've school to do tomorrow, and dishes to do right now.
 
-2
Q: Cannot understand how this Javascript function() is working

Abrar Shariar Galibfunction multiplier ( factor ) { return function ( number ) { return number * factor ; }; } var twice = multiplier (2) ; document.write ( twice (5) ) ; /* is return function(number) defining a new function?? if so, then where is its name defined?? and what is actually happening when the paramet...

 
@CaptainObvious Feeling a little sick today?
 
@Heslacher I hadn't been paying attention lately. Congratulations on passing 10k!
3
 
Starred for +1
 
2:39 AM
Congrats!
 
3:30 AM
@Mehrad Negative
 
3:46 AM
@Phrancis thanks :D
 
4:17 AM
This was a tough zombie, old too: codereview.stackexchange.com/a/77947/34073
 
 
1 hour later…
5:23 AM
Went some OleDb related zombie hunting on SO. Was quite good :D haven't answered questions for a while... need to add to this rep.
 
5:36 AM
0
Q: Generate random url for my opensource pastebin tool?

user3090104I'm a student and still studying. I just made my own pastebin tool to generate source code. As well i've contributed this project as an Open source. You could see this project from here-> https://github.com/rajendraarora16/pastebin-tool-opensource-project If you wish to see the demo, you could v...

 
5:50 AM
0
Q: Build Failed for old C based Blaster code in Visual Studio C++

user3441801I am trying to build a solution for Blaster code. It was running properly and building solutions but for some reason its not building solutions anymore. Looks like something has changed on my system. I can't figure it out. It must be either a header file or some library. Please find the code belo...

 
@200_success Thanks
Monking @all
 
morning morning @Heslacher
 
 
1 hour later…
7:05 AM
monking @all
 
Morning to @chillworld
 
it's snowing here
 
7:21 AM
-1
Q: Code taking hours to calculate, how would I get the same results with fewer loops?

Patrick NobbeI'm trying to implement Knuth's Five-guess Mastermind algorithm in my own version of Mastermind, but when running step 6 it takes my code hours to actually run through everything to get the neccesary information. I was wondering if any of you would know a better way to obtain the same results? H...

 
8:00 AM
0
Q: For loop with threads

Nejc GalofI want make my code parallel with threads. I try soo many options, but my program not work fine. I want my for loop make with threads. If my st= 4, I have 4 threads for each i in loop. This program make options of words. First thread for one character, second for two characters... If Preveri func...

 
8:14 AM
-2
Q: How create a exist list in class, how scan id and check if it is in the exist list?

JohnnyCreate ten accounts in a list with the ids 0, 1, ..., 9, and an ini- tial balance of $100. The system prompts the user to enter an id. If the id is entered incorrectly, ask the user to enter a correct id. Once an id is accepted, the main menu is displayed as shown in the sample run. You can enter...

0
Q: How to reduce or eliminate helpers with composite pattern?

lauthiamkokAccording to this question and answers, Helper classes are usually a sign of lack of knowledge about the Model's problem domain and considered an AntiPattern (or at least a Code Smell) by many. Move methods where they belong, e.g. on the objects on which properties they operate on, inst...

0
Q: Design patterns for PHP - visitor pattern vs servant pattern

lauthiamkokI find these two patterns are similar (and the most of other behavioral patterns) visitor pattern, interface Visitor { public function visit(Visitable $Visitable); } interface Visitable { public function accept(Visitor $Vsitor); } class ConcreteVisitable implements Visitable { pu...

 
hey @chillworld
 
8:37 AM
0
Q: Print last Sunday of each month in a given year

Joshua SniderI'm an experienced programmer trying to learn OCaml. I figured a good way to do that would be to pick a simple task on Rosetta code that didn't yet have an OCaml example and do it myself. With that in mind, I wrote this program to find the last sunday of each month in a given year. It works by us...

 
9:00 AM
0
Q: Bootstrap Tabs With SammyJs

McKabue+is there a better way to implement bootstrap tabs routing with summyjs besides this? <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <link href="lib/bootstrap.min.css" rel="stylesheet" /> <script src="lib/jquery-1.8.2.min.js" type="text/javascript"></script> <...

 
9:22 AM
0
Q: Adam Drake's Hadoop criticism code

tripleeeI came across this blog post from around a year ago which suggests simple shell scripts to replace massive Hadoop jobs: http://aadrake.com/command-line-tools-can-be-235x-faster-than-your-hadoop-cluster.html While I contest his assertion that "one especially under-used approach for data processin...

0
Q: Minimixing a background image annimation

3gwebtrainI am doing a background image animation using the function. it works, but I think I am doing more coding than what it requires. Can anyone please help me to minimize it? Don't recommend the CSS animations, I am working for IE9. var call = function () { var x = 0; return function () { ...

 
9:52 AM
0
Q: Convert a Sympy Function into a Julia function

OxinaboxSymPy has a Julia wrapper. SymPy defines its own mathematical functions. I would like to be able to convert them into Julia functions. Even if they take multiple arguments. I also would like to find the Jacobians of those functions, in Julia forms -- which serves as a good nontrival test for th...

 
Monking
 
hey @skiwi
 
10:23 AM
hey @Heslacher
 
10:38 AM
0
Q: Is this merge sort following good coding standards? What are some improvents I can make to make it cleaner?

OrestisCode: public final class MergeSort { private MergeSort() { // prevent instantiation } private static Object[] temp; public static <T extends Comparable<? super T>> void sort(List<T> array){ Object[] a = array.toArray(); temp = new Object[a.length]; sort(a, 0, a.length - ...

 
11:33 AM
BUILD STOPPED (total time: 4,275 minutes 49 seconds)
 
@Pimgd That's like 3 days
Why what how where?
 
@skiwi Supporting other processes; Keeping a network tunnel open and if it closes, reopening it; By checking if the tunnel is still open constantly, and if not, reopening it, alternatively, by leaving my pc on; At the office.
 
0
Q: Efficient Traversal and Manipulation of the DOM with Native JavaScript Using For/In Loop

purefusionWith native JavaScript, I intend to traverse a collection of elements in the DOM that contain a link and an image (and possibly other elements). The image may or may not be inside the link—in most cases the image will be in the link, but in some cases it may be directly adjacent to the link, or i...

 
12:07 PM
0
Q: Here is my C soln for sherlock and queries @ hackerrank. How should i optimize it as its showing teminated due to time out?

Ashutosh Pandeyinclude int main() { int n,m,i,j; scanf("%d %d ",&n,&m); long int a[n+1],b[m+1],c[m+1]; for(i=1;i<=n;i++) scanf("%ld",&a[i]); for(i=1;i<=m;i++) scanf("%ld",&b[i]); for(i=1;i<=m;i++) scanf("%ld",&c[i]); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { if(j%b[i]==0) ...

0
Q: Dependency Injection With Unity in MVC 5 without repository and unit of work

user3132179I want to use dependency injection with Unity in my application. I am not following repository pattern and unit-of-work(and Don't want to). Also i have ViewModel in my controller action method. Please review my code and add your comments . public class ProductCatagoryController : Controller { ...

 
heh, interesting hot network question
17
Q: I have installed 12 GB of RAM onto my computer, but only 7.96 GB is usable

charrevI have recently upgraded a Windows 7 Home Premium PC with 12 GB of RAM. For some reason once I looked in the System tab it said only 7.96 GB of 12 GB of RAM is usable. I have already tried to go into the msconfig to see if the Maximum Memory was ticked, which it wasn't. Is there a solution to th...

 
So, I was hoping that Cities: Skylines would fill the void that the terrible excuse for a game called SimCity(2013) left... But it is somehow an exact clone.
At least they cloned it well enough for me to know better than to waste money on it.
 
12:29 PM
0
Q: 'Bad' triangles when doing affine texture mapping

user2875871I already asked this on the gamedev stack exchange(http://gamedev.stackexchange.com/posts/92467/edit). I am really clueless about what i must do. I wrote a function to do affine texture mapping, but i get in most situations 'bad' triangles. I really didn't want to ask this question as it probabl...

 
12:44 PM
@nhgrif Did they also clone all bugs?
 
1:10 PM
Maybe, but SimCity's problem wasn't bugs quite as much as design flaws.
 
1:23 PM
And by the way, "working as designed"... Let's not use this phrase. Everything works exactly as it was designed. The question is whether you designed what you intended to design.
 
@nhgrif If it wasn't branded as a SimCity game, it wouldn't have been so awful.
Legions of fans wanted an updated version of SimCity2000 and we got... I don't know exactly what it is that we got.
Some crap game where I'm some mix of a governor and micromanaging Nazi.
 
1:38 PM
@nhgrif I like: works as intended
2
 
Oh. We're having a serious conversation? I thought we were just talking about EA's failure.
Any one want to object to this?
0
A: Is the [comments] tag too meta?

RubberDuckYes. This tag is too meta and should be removed. Any possible use for this tag would indicate an OP's concern with the code, not the code itself.

 
0
Q: Stack Implementation

PradyotHi I would like comments on my implementation of a stack. template <class T> class Stack { public: void pop(T& element); void push(const T& element); Stack(); private: int elementCount_; int stackTop_; static const int MAX_ELEMS = 10; T elementArray_[M...

 
1:57 PM
115
Vi and vim

Proposed Q&A site for people using vi and vim

Currently in definition.

^^^ Just a reminder that if youa re following it, you need to get some more questions to score 10.
 
0
Q: Cursor index on textbox onClick event without highlighte/selected content

user63345Scenario : User makes just onClick on a textbox/textarea with some content(somewhere between the content). The code snippet used : var range = document.selection.createRange(); //Here I get MSSSelection and TextRange with just click opn(no selection by draggging) range.text='|'; ..... var pos...

 
@janos you around?
(Monking to everyone else)
 
2:17 PM
Exactly @rolfl intended is the right phrase, but I've seen designed a lot lately.
 
-1
Q: Math program code

dan0117Was given this code by someone a couple weeks ago however i can't seem to fill in the blanks, was wondering if someone could help me! import operator import random OPERATIONS = [ ('+', operator.add), ('-', operator.sub), ('*', operator.mul), ] def random_question(binary_operations,...

 
2:33 PM
LOL
> To steal an old quote: "There are 2 hard things in computer science. Naming, cache invalidation, and off-by-one errors".
15
A: Commenting and naming variables in Python

YuushiTo steal an old quote: "There are 2 hard things in computer science. Naming, cache invalidation, and off-by-one errors". That being said, there is room for improvement here. Firstly, I'm assuming the class name, PPM, is short for Portable Pixmap Format. However, this isn't immediately obvious, ...

 
3:17 PM
0
Q: JOptionPane in java codes

Ana Duroimport java.awt.*; import java.util.*; import javax.swing.JOptionPane; public class Test { public static void main(String[] args) { String[] names = new String[5]; Integer[] grades = new Integer[5]; names[0] =( JOptionPane.showInputDialog(null,"Insert first name")); grades[0] = Integer.parseInt(J...

1
Q: Throttling commands

PeterI have a scenario where my BaseRepository gets a lot of commands in a short time period. At other moments, this doesn't happen. What I want to achieve is to throttle these commands. I.e., when a command must be executed, wait for a short period (0.2s) for any other calls. If none are made, execut...

 
3:42 PM
For anyone using databases - real-world-feedback.....
I wrote some code in 2005 that has a database component (OK, there's a massive database, and I wrote code that processes a chunk of the data in it, in the order of millions of records).
Using JDBC to connect, etc.
The expectation is that it is a batch process that takes up to 15 minutes to run.
 
expectation != reality?
 
That was when I was working in a company that IBM bought, but I still keep in touch with those guys..... and I got a message that the code was running slowly.
How slowly? 15 hours!
The client was in crisis mode, and things were a real problem.
 
worked at a financial institution before--ETL batch jobs running that long were commonplace
for the most insane reasons too
 
Was there anything I could think of that would help? I suggested some special diagnistics I had built in to the code, including just debug level messages.
They ran it again on the diagnistics setting and discovered it took 15 hours for the first record to be returned from the database.
A quick check by them showed the database statistics were out of date.
An update-statistics, and the process ran in 7 minutes.
2
NEVER FORGET YOUR STATISTICS!
 
3:48 PM
Would the database not be smart enough to figure out by itself that it needs to update its statistics?
 
sadly most of the stuff I encounter is not even that "obscure"...it's more of the old "open connection, write row, close connection, open connection..." and repeat 100000 times
 
@skiwi In bigger environments it gets complicated.
There's always a reason for the DBA's to do things differently, or non-standard.
 
I understand it's probably not straight-forward
 
Modern databases almost all have a mechanism available for keeping the statistics automatically up to date, but with big databases, you can run in to problem swith the statistics update slowing down the 'real' work.
Also, it's often the case that some tables are very volatile, small or empty at some times, and millions of rcords the next.
 
usually it's a hidden side effect of something else that was done (for arguably necessary reasons)
 
3:50 PM
If the auto-update has been turned off, or it runs at the wront time, it can have dire consequences.
@moarboilerplate yes, that. There's always a reason, sometimes the right one.
 
Typically, if the system is big enough to have a dedicated DBA or two, then the statistics should become a manual process, and managed by people paid to do the job.
They should, if well disciplined, be better than the auto-systems.
 
@rolfl agreed. though that depends on if the company runs its IT dept. as a software company's IT department or as an IT department that exists for "doing the website"
 
The software that I wrote is part of a system that typically goes for contracts in the $million-per-year ballpark. The systems inevitably have dedicated resources, and little empathy for their inability to do what's considered basic database management. I expect this problem to happen once or twice, though, so this is their 'grace' time.
 
Is it using an ETL technology on top of the database? If so sometimes the maintenance focus becomes primarily on that tech instead of the underlying datasources..not really excusable, but an explanation
 
3:59 PM
No, this process itself is not an ETL process, it's a pre-processor for another batch operation that does massive computational analysis (what becomes an 8hour daily job).
There is an ETL aspect, but it is surprisingly small for the amount of data that gets processed daily.
 
Ahh, I see.
 
Put differently, there is a huge historical data component, and a small incremental one. The batch process requires the complete history.
The code I wrote that was running slow is part of the setup for the subsequent tasks, essentially scheduling what data will be processed where, and ensuring nothing is missed.
 
Right right. So having a job that takes 15 hours to set up data for a more complex 8-hour batch is...counterintuitive at best
 
I am not sure about this client in particular, but when I first wrote the software it was to support processing the data on a 400-way dual-processor triple-rack of blade-servers.
 
Monking
 
4:08 PM
@Phrancis Yo
 
Yo too
 
Is JDBC a pretty good / reliable / secure DBC?
 
yes, yes, and yes. It has issues, and some usability and legacy problems, but, compared to others, yes.
it is pretty low-level as Java goes, which, depending on your background is a good/bad thing.
 
I've heard ODBC was crap, was just wondering how much better JDBC was
 
well if you have a .NET client you don't have much choice
 
4:17 PM
Compared to ODBC? JDBC is a rolls-royce.
 
0
Q: Is this tic tac toe game easy to understand

proengmy life dream is to become a professional programmer. I have written a Tic tac toe application with the focus of clear design and easy to read code. https://github.com/proeng/TicTacToe/ The curent algorithms are very crude, i also want to seperate them using interfaces. Any tips on improving the...

 
but for a straight up java stack it works great
 
There are a number of abstraction layers that sit on top of JDBC to make things accessible at a conceptually higher level if you want.
Hibernate, for example.
 
@Phrancis what is your use case?
 
My personal career is such that I grew up with low-level database layer coding (procedures, etc.) with very simple interface to database-side code. The client-side was very light on database processing.
I have never made it all the way to the modern extreme of putting everything in abstraction layers.
 
4:20 PM
But, you're still open to using technologies like Hibernate, and understand that there's a place for them, instead of having classes littered with SQL strings, it sounds like
 
3 mins ago, by moarboilerplate
well if you have a .NET client you don't have much choice
Isn't that what Linq is for?
 
well you wouldn't be using entity framework with anything but ODBC
or you would have a specific NHibernate driver
as far as I know...
 
Meh, it has been so long since I used ODBC that it is probably very different to what I recall.
 
if you have a .NET client generally you are working with a very highly-customized driver or you are using ODBC as a "bridge" solution for something like DataStage
 
You can hook a JDBC layer to ODBC though, so I guess there's some similarity somewhere.
 
4:23 PM
the added abstractions just add more layers of organization, but the underlying interop problems still exist and have to be addressed with either relying on ODBC or having a client-specific driver
all of that said, however, if you have a choice to use JDBC, it is a fine tech
 
Man it would be useful if my teacher could program better.
3
I should put the exam up for a code review if I ever manage to get it to work
He used no less than 8 different classes to model this json structure: reddit.com/r/funny.json
Aptly named Data, Listing, Data, Listing, ListingData, ListingElement SubReddit and SubRedditData
That's right. The first two he used twice.
Of course he gave us a pre-defined structure that's missing random pieces of code
Up to you to find out what that structure looks like
Luckily we had helpful comments like /* The intent is stored here */ Intent intent;
2
Who cares the program won't run until you're 80% done writing code?
 
And..... with that, you have learned a lot, right... what not to do... ;-)
 
What do you mean, "returning null isn't a good idea for stub code? Why would I ever want to use NotImplementedException()?"
2
 
@moarboilerplate I got a local PL/pgSQL and want to learn Java so I can make an application that uses it
 
But it's fine. We had 2 hours to interpret this gigantic structure of crap, find out what code snippets were missing, figure out what libraries he used and then try to piece everything together which we, in fact, did 10 times nicer on our own as practice the day before
 
4:32 PM
Then eventually host the DB somewhere so it can be used as a tool for our little media business. Mostly stuff like invoicing and projects, clients, basic stuff
 
@rolfl I could write a book about this exam alone
 
Find the learning opportunity in there, and learn from it.
 
@Phrancis I'd keep it simple with an ORM like Hibernate, but you could go lower-level and directly use JDBC
 
There's only so much you can learn from bad code. But yes, I'll try to put this experience into a positive light
 
Funny, and this is what I mean, that for me, keeping it simple means usig JDBC, and complicated means JDBC && Hibernate. It all depends on your experience.
 
4:34 PM
Agreed.
Actually, it could be argued that the simplest thing for @Phrancis's use case would be a Django/Python client :D
 
@Phrancis - what you should know, is that, if you use Hibernate, or any other abstraction Object-relational-mapper, that you design the application, and the database follows, but, if you design the database, and then try to install an ORM on top of it, you will likely struggle.
If you go the hibernate route, expect to have to rebuild your database.
 
The DB is already designed, except for stored functions
 
I would say that depends on the complexity of the app and the willingness of the ORM to adapt to schema changes
 
Postgres already has a number of built-in procedural languages but not for Java, AFAIK so I would likely have to roll my own. I wonder if there are any questions on CR about this...
Oh wait, look at this!
 
Unless you're really invested in Java, if your motivation is to consume a Posgres DB, you really may want to consider using Python
 
4:41 PM
Well OK. My motivation for learning Java is mostly to work on an unrelated project (Cardshifter game) so I figured why not kill two birds with one stone :)
 
the plot thickens!
 
Ugh, all the links on that PL/Java page are broken.
 
There should be little need to embed the Java in to your database.
That's a red-herring.
 
good call
considering that the functionality in question is located in Chapter 39
 
0
Q: How about an interesting newsletter?

retailcoderThe weekly newsletter is rather simplistic. We get "Top questions last week" and "Can you answer these?", and from my understanding the top questions are taken from the "This Week" tab, and the "Can you answer these?" section consists in a random selection of unanswered questions. Nice, but pret...

 
4:46 PM
@rolfl So the Java can just stand on its own and use something like JDBC to connect to the DB, eh?
 
Yes, and if you need to crunch a lot of data without it traveling the network, then write a procedure for it.
 
Ok. So Java is mostly the GUI client for input and output, and it just calls a function/proc in the DB and the DB does the rest then?
This made me LOL ^^
 
@Phrancis No, Not quite.
Java is a very capable processing engine, as well as a capable GUI.
Most applications are built with Java doing both the GUI and compute functions.
Sometimes though, when the vlume of data needed to perform the compute is massive, and the computations small, then you get better performance by doing the compute on the database.
This happens more often than you realize, like any time you do an aggregating SQL, etc.
 
Ok. So unless dealing with a ton of data, which I likely won't, just use the DB to store the data, and let Java do the rest?
 
yes. That.
The only time you need worry, is when network performance becomes a limiting factor.
 
4:54 PM
Do you have an example anywhere of what a Java function calling a DB might look like?
 
public void connectToAndQueryDatabase(String username, String password) {

    Connection con = DriverManager.getConnection(
                         "jdbc:myDriver:myDatabase",
                         username,
                         password);

    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM Table1");

    while (rs.next()) {
        int x = rs.getInt("a");
        String s = rs.getString("b");
        float f = rs.getFloat("c");
    }
}
That can be improved in a code-review, with closing connections, and statements, etc. but the basics are there.
 
I see
SQL injection a concern with JDBC, or does it sanitize the data pretty well by itself?
 
Prepared statements are core to JDBC too, and an established best practice.
 
Above looks like a prepared statement, right?
 
Sure, people do string concatenation occasionally, but they should not.
The above is not a prepared statement, no.
Prepared statements, for when you get there: docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html
People only use prepared statments when there are parameters to include.
I gotta run, meeting.
 
5:00 PM
Ok thanks for all the info :)
 
5:13 PM
0
Q: How to determine the longest increasing subsequence using dynamic programming with nlogn complexity

user62726I am trying to find the longest increasing subsequence(LIS) of a given set of numbers with nlogn complexity. I am following the algo http://stackoverflow.com/questions/2631726/how-to-determine-the-longest-increasing-subsequence-using-dynamic-programming I could able to implement the length of ...

 
5:54 PM
I'm skeptical of the use of the tag in this question:
1
Q: Shell script vs hadoop to count chess game outcomes

tripleeeI came across this blog post by Adam Drake from around a year ago which suggests simple shell scripts to replace massive Hadoop jobs. While I contest his assertion that "one especially under-used approach for data processing is using standard shell tools and commands", his blog post is an intere...

especially in light of the self-answer and this decision
8
A: Is the [Linq] tag appropriate if the code doesn't use Linq?

rolflNo, the tags should describe the features of the code, and not the desires of the asker. If the code uses Linq, then go ahead and tag it. If the asker thinks the code could be done better with Linq, then they are turning the linq tag in to a meta-tag, it's a feature of the request, not a feature ...

 
I don't know
 
This case is slightly different IMO because OP is not asking for a solution in hadoop that he hasn't provided
 
0
Q: Is it bad practice to fake a pass method in ruby?

RSidRuby doesn't have a pass method to 'do nothing' the way Python does - if I want a ternary statement to do something on true, but nothing on false (as in the code below) is it bad practice in Ruby to fake it this way? beverage_links = [] beverage_info.each do |bvg| self.is_menu_item?(bvg) ? b...

 
There is no code in the code to be reviewed.
 
I agree with that statement
but, in light of the LINQ decision you posted, it differs from that example
Jury's out for me
 

« first day (625 days earlier)      last day (3383 days later) »