Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
AbrahamLincolnLog
Oct 1, 2014

Note to self: This one's the shitty one

Jo posted:

I can see this happening and advise strongly in asking your professor if he's hosting the missing file somewhere. Email him NOW and CC a TA.

I have; I sent him a message yesterday but it's gone unread so far. Figured I'd post here and see if that was a legitimate possibility, or if I was just totally missing something.

This is the same professor who earlier in the semester hosed up and switched assignments around, leading to us getting assignments which required JavaFX nine weeks before "Intro to JavaFX", so it's possible.

Adbot
ADBOT LOVES YOU

PierreTheMime
Dec 9, 2004

Hero of hormagaunts everywhere!
Buglord

AbrahamLincolnLog posted:

I have; I sent him a message yesterday but it's gone unread so far. Figured I'd post here and see if that was a legitimate possibility, or if I was just totally missing something.

This is the same professor who earlier in the semester hosed up and switched assignments around, leading to us getting assignments which required JavaFX nine weeks before "Intro to JavaFX", so it's possible.

As someone who just finished their own COP2805 course I can guarantee that's the case. My professor did this for 8 of 14 assignments and it drove me mad.

If it takes a while for them to respond ask for an extension if they don't offer it upfront for the delay.

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice

AbrahamLincolnLog posted:

So, I'm going to preface this with the point that this is potentially a very dumb question, but I have to be honest and say that I'm just totally stumped.

Yesterday I logged into my COP 2805 online class to see my final assignment. The instructions are as follows:


The assignment comes with a ComplexClass.java which is all fine and dandy. But where the gently caress do I get GenericMatrix from? There's no GenericMatrix class in the given files; attempting to just extend it gives me a "class not found error" (obviously). With some extensive googling, all I've found is people who have had the exact same assignment, with one catch: they're all using a different textbook, which included code for a GenericMatrix class. My textbook is an e-book and I've searched it for "GenericMatrix" and there's no results. As far as I can tell, my professor has ripped this assignment out of another text book that we aren't using and only included part of the code.

Am I missing something? Is there a GenericMatrix in Java somewhere, and I'm just missing it (or are too dumb to know how to import it)? The rest I can kind of figure out, but I have no idea where I'm supposed to be getting this GenericMatrix stuff from, and I wanted to double check to see if I was just loving up, or if I'm right and I'm missing part of the assignment.

Big thanks in advance for any help. My grade is high enough that I should still get a B if I "fail" the final, but I'd rather keep the A.

http://www.cs.armstrong.edu/liang/intro9e/html/GenericMatrixWithLineNumber.html is this it? Still, I would hit up the professor.

AbrahamLincolnLog
Oct 1, 2014

Note to self: This one's the shitty one

PierreTheMime posted:

As someone who just finished their own COP2805 course I can guarantee that's the case. My professor did this for 8 of 14 assignments and it drove me mad.

If it takes a while for them to respond ask for an extension if they don't offer it upfront for the delay.


That's good to hear. At least now I know it likely isn't my fault. Just have to wait and see what he says.


Possibly! I found that too when I was searching; but again, that's from "Introduction to Java Programming, Ninth Edition", which is not our textbook. Every answer relating to a "GenericMatrix" class always comes from that textbook, which is what made me so confused.

Hughlander
May 11, 2005

What's the current go-to webframework for small dumb projects that should better be done with something stupid like NodeJS? I just want to have a quick website where you can drag/drop images to upload and get saved, and then add tags. Thinking a little bit Ajax, autocomplete known tags, stupid backend to show tags by count, show images matching the tag etc... I swear I did something like this awhile back in Django but no idea where the source is. Was thinking Spark, but thought there was something else that people were recommending for tiny things like this but didn't see anything in 10 minutes of googling.

Jo
Jan 24, 2005

:allears:
Soiled Meat

Hughlander posted:

What's the current go-to webframework for small dumb projects that should better be done with something stupid like NodeJS? I just want to have a quick website where you can drag/drop images to upload and get saved, and then add tags. Thinking a little bit Ajax, autocomplete known tags, stupid backend to show tags by count, show images matching the tag etc... I swear I did something like this awhile back in Django but no idea where the source is. Was thinking Spark, but thought there was something else that people were recommending for tiny things like this but didn't see anything in 10 minutes of googling.

I'm in a similar boat. Would like to expand my horizons. Let me know if you find an answer to this.

Volguus
Mar 3, 2009

Hughlander posted:

What's the current go-to webframework for small dumb projects that should better be done with something stupid like NodeJS? I just want to have a quick website where you can drag/drop images to upload and get saved, and then add tags. Thinking a little bit Ajax, autocomplete known tags, stupid backend to show tags by count, show images matching the tag etc... I swear I did something like this awhile back in Django but no idea where the source is. Was thinking Spark, but thought there was something else that people were recommending for tiny things like this but didn't see anything in 10 minutes of googling.

There is no project that should better be done with nodejs. However, from the java side there are quite a few frameworks that can get you up and running fast:


One thing you may want to look into is to have that crap generated for you: jhipster (https://jhipster.github.io/) can generate a simple Spring Boot CRUD application in minutes (many minutes in my case since i didn't have nodejs installed and didn't want to give that little poo poo my root password to install global packages, so i had to do some reading first).

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
How come nobody recommends Vert.x? Is it obscure, lovely, or both?

Volguus
Mar 3, 2009

Fergus Mac Roich posted:

How come nobody recommends Vert.x? Is it obscure, lovely, or both?

Personally I've heard about it but I have never used it (while i did use at least a little bit the others). So it could be that it is obscure or that I simply am not aware of it (ignorance). The same way for javascript frameworks (on the client). By default go to angular these days (1.5.x, gently caress 2.0) even though Vue did get some quite positive reviews and it may as well be as awesome as some say it is. One of these days I'll give that a try as well though, if i don't forget.

meatbag
Apr 2, 2007
Clapping Larry
Whats the best option if I want to read an Excel file and make objects out of rows?

Zorro KingOfEngland
May 7, 2008

Apache POI is the library I've always used - https://poi.apache.org/

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice

Zorro KingOfEngland posted:

Apache POI is the library I've always used - https://poi.apache.org/

This is the only answer for Excel imho.

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

poemdexter posted:

This is the only answer for Excel imho.

It's great. PSA though: the Apache POI libraries work with the old binary Excel File format, and also with the new multi-file XML file format, but NOT with the Excel 2002 single file XML format:

https://msdn.microsoft.com/en-us/library/aa140066(office.10).aspx
https://en.wikipedia.org/wiki/Microsoft_Excel#File_formats

That last one is still in use in some odd corners so could be a gotcha.

geeves
Sep 16, 2004

Hughlander posted:

What's the current go-to webframework for small dumb projects that should better be done with something stupid like NodeJS? I just want to have a quick website where you can drag/drop images to upload and get saved, and then add tags. Thinking a little bit Ajax, autocomplete known tags, stupid backend to show tags by count, show images matching the tag etc... I swear I did something like this awhile back in Django but no idea where the source is. Was thinking Spark, but thought there was something else that people were recommending for tiny things like this but didn't see anything in 10 minutes of googling.

We were talking about Jersey. Check my post history. It was only a few weeks ago this came up.

It sets up and runs quickly with tomcat, jetty and grizzly.

AbrahamLincolnLog
Oct 1, 2014

Note to self: This one's the shitty one

AbrahamLincolnLog posted:

At least now I know it likely isn't my fault. Just have to wait and see what he says.

Professor responded. As everyone here suggested, he hosed up and didn't give us all of the code we needed for the assignment. It's now been uploaded.

Thanks for the help, everyone!

smackfu
Jun 7, 2004

Has anyone had any luck slowly updating a legacy code base to newer technologies? The old code has SQL mixed in with controllers all over the place. It's pretty easy to pull out repositories and modes and such but it would be nice to stick in Hibernate and some kind of dependency injection framework but without breaking all the other existing code that we aren't touching yet.

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice

smackfu posted:

Has anyone had any luck slowly updating a legacy code base to newer technologies? The old code has SQL mixed in with controllers all over the place. It's pretty easy to pull out repositories and modes and such but it would be nice to stick in Hibernate and some kind of dependency injection framework but without breaking all the other existing code that we aren't touching yet.

I took something from old Spring to new Spring so we could get off the xml config. I also swapped it to Groovy so we could use that. src/main/java turned into src/main/groovy and the file extensions went from .java to .groovy with a couple @StaticCompiles where needed. If you have all of your business logic contained in a decent way, it might be easy to hop on Spring but I dunno. Depends on the codebase size and how messy it is. Good luck!

Woebin
Feb 6, 2006

I realize this isn't strictly a Java question, but I'm in a course that throws us headfirst into a new language every two weeks and gives an assignment in that language, and right now we're doing Clojure which at least runs in the JVM so I figure asking here might not be completely out of line. The current assignment is:

quote:

The first part of this assignment is to write a macro called safe that is intended
to function similarly to try in Java 7, and using in C#. It should be possible
to have a binding form (i.e. [variable value]) that binds to an instance of a
closable.

REPL interaction is supposed to go like this:
code:
user> (import java.io.FileReader java.io.File)
java.io.File
...
user> (def v (safe (/ 1 0)))
user> v
#<ArithmeticException java.lang.ArithmeticException: Divide by zero>
user> (def v (safe (/ 10 2)))
user> v
5
user> (def v (safe [s (FileReader. (File. "file.txt"))] (.read s)))
user> v
105 ; first byte of file file.txt
user> (def v (safe [s (FileReader. (File. "missing-file"))] (. s read)))
user> v
#<FileNotFoundException java.io.FileNotFoundException:
missing-file (No such file or directory)>
With that, me and my coursemate have got something that handles basic expressions well enough, but stumbles over the FileReader examples, throwing an error about s not being defined. Other people have hinted that we need to use let, but I'm pretty sure we're doing it wrong - to be honest, there's been insufficient time for me to really grasp this language, and I've been banging my head against this problem for several days now

Current state of our code:
code:
(defmacro safe
  "Does a thing while checking for exceptions."
  ([to-safe]
   `(try ~to-safe
         (prn ~to-safe)
         (catch Exception ex# (prn ex#))))
  ([variable expression]
   (let [s (first variable) fr (second variable)]
     `(try ~expression
           (prn ~expression)
           (catch Exception ex# (prn ex#)))))
  )

(import java.io.FileReader java.io.File)

(def v (safe (/ 1 0)))
v
(def v (safe (/ 10 2)))
v
(def v (safe [s (FileReader. (File. "valid-filepath.txt"))] (.read s)))
v
(def v (safe [s (FileReader. (File. "missing-file"))] (. s read)))
v
(I know those print statements would be superfluous when running it in REPL, but that's another problem: there's been no help setting up a development environment within the course, so I've ended up going with Cursive but there doesn't seem to be a single guide to configuring it all the way so I simply don't have a working REPL)
This gives, in order, a properly printed divide by zero error, the number 5, and finally the bane of my existence:
code:
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: s in this context, compiling: ([...]\IdeaProjects\safe\src\safe.clj:20:80)
We also searched StackOverflow, of course, and found a couple of people who seem to have taken the same course a couple of years ago asking their own questions. Unfortunately, I don't understand the code that turns up in their answers (here and here).

I know I probably sound like a dumbshit to anyone with any grasp of Clojure or Lisp in general and, well, I kind of feel like one too. If anyone feels like they can give any hint at all towards figuring this out I'd be eternally grateful (and not to offer up bribes exactly, but if that someone would like a forums upgrade or avatar change in return I'd be happy to spring for it).

pigdog
Apr 23, 2004

by Smythe

smackfu posted:

Has anyone had any luck slowly updating a legacy code base to newer technologies? The old code has SQL mixed in with controllers all over the place. It's pretty easy to pull out repositories and modes and such but it would be nice to stick in Hibernate and some kind of dependency injection framework but without breaking all the other existing code that we aren't touching yet.

Why introduce Hibernate to codebase that used to be, mercifully, spared of it?

:negative:

I mean it's one thing to start off with it, but introducing it to a legacy application seems like asking for a bad time.

ToxicSlurpee
Nov 5, 2003

-=SEND HELP=-


Pillbug
What's wrong with Hibernate? I actually kind of like it.

The Laplace Demon
Jul 23, 2009

"Oh dear! Oh dear! Heisenberg is a douche!"

Woebin posted:

macro questions

When writing macros, I find it's easiest to write a few examples of how I think it should work. Try figuring out how the following s-expressions could look after the safe macro is expanded. Write an algorithm that transforms these examples to macroexpanded form.
code:
(safe [] (/ 1 0))
(safe [s (FileReader. (File. "file.txt"))]
  (.read s))
(safe [a (Closeable.)
       b (Closeable.)]
  nil)
Then look at your macro definition. Write code that runs your algorithm on the arguments:
code:
(defmacro safe
  ([body] your-code-goes-here)
  ([bindings body] your-code-goes-here))
When you define a function with multiple arities, it's good style to implement the lower arities as calls to the higher arity. For example, I'd expect the safe macro called with only one argument to be equivalent to a two argument call with empty bindings:
code:
(safe (foo)) ; behaves the same as (safe [] (foo))

Volguus
Mar 3, 2009

pigdog posted:

Why introduce Hibernate to codebase that used to be, mercifully, spared of it?

:negative:

I mean it's one thing to start off with it, but introducing it to a legacy application seems like asking for a bad time.

What ORM would you prefer? I found other ORMs to be quite young/unstable compared to hibernate. Hibernate is old, true, but is also very stable and mature.

pigdog
Apr 23, 2004

by Smythe

Volguus posted:

What ORM would you prefer? I found other ORMs to be quite young/unstable compared to hibernate. Hibernate is old, true, but is also very stable and mature.

Hibernate is nice and fast to hit the ground running, and to take care of simple data persistence in scenarios where the code drives the database. It's the whole concept of 1:1 mapping between in-memory objects and database that is ultimately awkward and problematic, IMHO.

I really like JOOQ which takes care of some boring bits of JDBC, while giving the user the full power of SQL without an intermediate language, and best of all can provide typesafety with regards to your database types right in the IDE.

It's not very well known because it's not free to use with commercial databases, but it's free for open-source databases, like Postgres.

Volguus
Mar 3, 2009

pigdog posted:

Hibernate is nice and fast to hit the ground running, and to take care of simple data persistence in scenarios where the code drives the database. It's the whole concept of 1:1 mapping between in-memory objects and database that is ultimately awkward and problematic, IMHO.

I really like JOOQ which takes care of some boring bits of JDBC, while giving the user the full power of SQL without an intermediate language, and best of all can provide typesafety with regards to your database types right in the IDE.

It's not very well known because it's not free to use with commercial databases, but it's free for open-source databases, like Postgres.

I looked some time ago at that library and at most I can say that is a joke. ORMs are not perfect by any means, and different implementations have their own quirks, but jqqq brings nothing to the table that you don't get from ORMs. It looks like a solution in search of a problem. It is better than JDBC , that's for sure, but it makes no sense to use it instead of an ORM.

Gravity Pike
Feb 8, 2009

I find this discussion incredibly bland and disinteresting.
My team uses JOOQ, and we love it. It's like writing postgresql, but with type-safety.

Can you explain the draw of a heavy-weight ORM to me? I've never had a good experience with one; it's only been another layer that I have to fight against when I want to do anything complicated. It's been my experience that ORMs like Hibernate are trying to solve the problem "database access isn't Object-Oriented enough," which is the wrong solution to something that isn't really a problem.

Volguus
Mar 3, 2009

Gravity Pike posted:

My team uses JOOQ, and we love it. It's like writing postgresql, but with type-safety.

Can you explain the draw of a heavy-weight ORM to me? I've never had a good experience with one; it's only been another layer that I have to fight against when I want to do anything complicated. It's been my experience that ORMs like Hibernate are trying to solve the problem "database access isn't Object-Oriented enough," which is the wrong solution to something that isn't really a problem.

Ease of maintenance. Ease of refactoring. After you write "select bla from foo" 5 times ... it gets old fast. Lazy fetch when you want it, eager fetch when you don't. HQL makes writing complex sql queries easy. If you really have to, writing native SQL statements is trivial, for all those 2-3 native queries you have to write in a huge project. I personally never had to fight ORMs since I've discovered hibernate back in 2003, so ... no idea what are you doing there. Do you know what you're doing there? Develop the project locally with h2, test with real DB in QA and with deploy to prod. That makes development environment setup a non issue (git clone, run, done). And a billion other little things. When i want plain JDBC , Spring JDBC is around the corner, and that offers everything that jqqqqq offers and more, if I really really don't want to bring hibernate into the mix.

But hey, whatever floats your boat. I like going home in the evening. Some don't and I understand that.

Paul MaudDib
May 3, 2006

TEAM NVIDIA:
FORUM POLICE

Gravity Pike posted:

My team uses JOOQ, and we love it. It's like writing postgresql, but with type-safety.

Can you explain the draw of a heavy-weight ORM to me? I've never had a good experience with one; it's only been another layer that I have to fight against when I want to do anything complicated. It's been my experience that ORMs like Hibernate are trying to solve the problem "database access isn't Object-Oriented enough," which is the wrong solution to something that isn't really a problem.

That's great buddy but I can't get my boss to pay $150/year for IntelliJ, how in the world am I going to get him to pay $450 per developer seat per year for a freaking ORM?

Woebin
Feb 6, 2006

The Laplace Demon posted:

When writing macros, I find it's easiest to write a few examples of how I think it should work. Try figuring out how the following s-expressions could look after the safe macro is expanded. Write an algorithm that transforms these examples to macroexpanded form.
code:
(safe [] (/ 1 0))
(safe [s (FileReader. (File. "file.txt"))]
  (.read s))
(safe [a (Closeable.)
       b (Closeable.)]
  nil)
Then look at your macro definition. Write code that runs your algorithm on the arguments:
code:
(defmacro safe
  ([body] your-code-goes-here)
  ([bindings body] your-code-goes-here))
When you define a function with multiple arities, it's good style to implement the lower arities as calls to the higher arity. For example, I'd expect the safe macro called with only one argument to be equivalent to a two argument call with empty bindings:
code:
(safe (foo)) ; behaves the same as (safe [] (foo))
Hey, thanks for this. I'm not quite grasping it yet but I'll spend some more time trying with your advice in mind. Let me know if you'd like some sort of reward for effortposting on my behalf!

Volguus
Mar 3, 2009

Paul MaudDib posted:

That's great buddy but I can't get my boss to pay $150/year for IntelliJ, how in the world am I going to get him to pay $450 per developer seat per year for a freaking ORM?

That's a problem with the boss, to be honest. One of his/hers duties is to make sure the developers have everything they need to do their job and are more efficient at it. Even if that means that sometimes you get something that simply makes them happier. The boss should simply demand a logical argument (bullet points, everyone loves bullet points) why technology X is better than what you're using now and how he (the boss) will benefit from it. While I don't personally believe that either intellij nor jqqqq provide any benefit (to the contrary), one should be open to arguments that could change their mind.
If one of the arguments against ORM (pro jqqqq) is, like Gravity Pike said: "ORMs are too drat hard" (paraphrasing), then the boss should simply invest in an ORM/JPA/Hibernate course. Like with any complicated enough technology, you can use it wrong, therefore negating any benefit that it may provide.

pigdog
Apr 23, 2004

by Smythe

Paul MaudDib posted:

That's great buddy but I can't get my boss to pay $150/year for IntelliJ, how in the world am I going to get him to pay $450 per developer seat per year for a freaking ORM?

Ask him why he's paying $2k - $25k per core for SQL Server or Oracle, then. For open-source databases like Postgres or MySQL it's free.

pigdog
Apr 23, 2004

by Smythe
edit: nevermind

pigdog fucked around with this message at 19:38 on Dec 18, 2016

The Laplace Demon
Jul 23, 2009

"Oh dear! Oh dear! Heisenberg is a douche!"

Woebin posted:

Hey, thanks for this. I'm not quite grasping it yet but I'll spend some more time trying with your advice in mind. Let me know if you'd like some sort of reward for effortposting on my behalf!

Hmm, realized I never actually explained how or why you'd write a macro. Macros are code transformations. Normally when you call a function, the arguments are evaluated before the function call, for example:
code:

(defn  f [a b] (+ a b)) 
(f (dec 0) (inc 0))
; before we can evaluate the outer function call to f, we need to evaluate the inner function calls to dec and inc
; => (f -1 1)
; now we can call f. it receives -1 for a and 1 for b. function application is equivalent to substituting the definition of f at the call site
; => ((fn [a b] (+ a b)) -1 1)
; which is equivalent to a let expression binding a and b to the argument values
; => (let [a -1 b 1] (+ a b))


In general, function application takes place from the innermost function call to the outermost. Functions apply to values.

Macros invert this behavior. They evaluate from the outermost macro call to the innermost, before function application begins. Instead of taking values as arguments, they take the unevaluated blocks of code. Instead of returning a value, they return a new block of code in its place that is evaluated instead. The simplest macro is comment, which takes code and replaces it with nothing.
code:

(defmacro comment* [body] nil)
(comment* (println "Hello, world!")) 
; think of comment* as executing like this:
(eval (let [body '(println "Hello, world!")] nil)) 
(eval nil) 
nil


The macro can make arbitrary edits to the code it receives:
code:
 
(defmacro butts [body]
  (list (first body) "Farts.")) 
(butts (println "Hello, world!")) 
; transform to eval + let:
(eval (let [body '(println "Hello, world!")]
  (list (first body) "Farts."))) 
(eval (list println "Farts."))
(eval '(println "Farts."))
(println "Farts.")


The equivalence between function calls and let means we could implement our own let with function application:
code:
 
(defmacro let** [bindings & body]
  (let [arguments (take-nth bindings 2)
        expressions (take-nth (rest bindings) 2)]
    (list* (list* fn (vec arguments) body) expressions)))
(let** [a (dec 0) b (inc 0)] (+ a b))
; transform to eval + let
(eval (let [
    (list* (list* fn (vec arguments) body) expressions))))
; combine the lets
(eval
  (let [bindings '[a (dec 0) b (inc 0)]
        body '((+ a b))
        arguments (take-nth bindings 2) ; => '(a b)
        expressions (take-nth (rest bindings 2))] ; => '((dec 0) (inc 0))
    (list* (list* fn (vec arguments) body) expressions)))
; substitute the let, rewrite as a quoted form
(eval '((fn [a b] (+ a b)) (dec 0) (inc 0)))
((fn [a b] (+ a b)) (dec 0) (inc 0))

Hope an actual example of a code transformation helps. There's some additional syntactic sugar for a few common tasks, but this should be enough for your homework problem.

Here's good documentation for standard library functions, grouped by their usage: https://www.conj.io/
Here's a site with small Clojure exercises to help get used to its syntax: https://www.4clojure.com/

Woebin
Feb 6, 2006

The Laplace Demon posted:

More macro help
Thank you so much for replying at length! The deadline was tonight and we didn't solve it on time, so I'm letting my brain take a break from Clojure for now and looking back into it at a later point (I'll have to make up for not passing this assignment anyway). Will keep your replies in mind for when I do that.

Paul MaudDib
May 3, 2006

TEAM NVIDIA:
FORUM POLICE

pigdog posted:

Ask him why he's paying $2k - $25k per core for SQL Server or Oracle, then. For open-source databases like Postgres or MySQL it's free.

Actually we don't pay a dime for Oracle. It's our client's database, they pay for it, we are considered "developer" seats and those are free on their license. Oracle charges by the production-server core, JOOQ charges by developer seat, totally different model.

As for the client - yeah it's stupid but (a) they want someone they can call up when poo poo breaks, and (b) switching would require them admitting they're throwing away money.

Our DBA was telling me that one of the enterprise-grade Postgres derivatives has a wrapper that basically makes Postgres look like Oracle and we might be able to move forward like that.

Really they aren't doing anything that actually needs Oracle (which is probably a common story - CTO gets talked into fancy enterprise poo poo they don't need). We have maybe 50 million table rows in total, spread across ~25 tables. Our DBA spends so much time tuning queries and poo poo, and I think Postgres would probably just do it automatically just fine. Between a few poorly-designed tables that slow everything way down and the fact that Oracle's query planner is terrible and needs constant hand-tuning they think they need the big fancy enterprise products though.

I don't know how you get a join to a primary key column to take 300 seconds, but that's a thing I've experienced thanks to Oracle.

Paul MaudDib fucked around with this message at 02:10 on Dec 19, 2016

JewKiller 3000
Nov 28, 2006

by Lowtax

Paul MaudDib posted:

I don't know how you get a join to a primary key column to take 300 seconds, but that's a thing I've experienced thanks to Oracle.

In my experience, you get it by believing things like this:

Volguus posted:

Ease of maintenance. Ease of refactoring. After you write "select bla from foo" 5 times ... it gets old fast. Lazy fetch when you want it, eager fetch when you don't. HQL makes writing complex sql queries easy. If you really have to, writing native SQL statements is trivial, for all those 2-3 native queries you have to write in a huge project. I personally never had to fight ORMs since I've discovered hibernate back in 2003, so ... no idea what are you doing there.

Paul MaudDib
May 3, 2006

TEAM NVIDIA:
FORUM POLICE

JewKiller 3000 posted:

In my experience, you get it by believing things like this:

No I mean I went into a database client and types in SELECT * FROM TABLE_X JOIN TABLE_Y ON TABLE_X.FKEY = TABLE_Y.PRIMARYKEY LIMIT 50 and it took 300 seconds to come back. Dafuq.

It obviously had to be attempting some kind of full table scan but that still shouldn't take 300 seconds with like 1M records in each table.

Paul MaudDib fucked around with this message at 02:48 on Dec 20, 2016

Volguus
Mar 3, 2009

JewKiller 3000 posted:

In my experience, you get it by believing things like this:

Oh yes, because you just gotta pepper every single sql query with hints, otherwise everything will always do a full table scan no matter what. There is nothing one can do to make the RDBMS choose an optimal execution plan. If you're not writing 5 pages worth of text for every sql statement you're obviously doing it wrong ....

pigdog
Apr 23, 2004

by Smythe

Paul MaudDib posted:

No I mean I went into a database client and types in SELECT * FROM TABLE_X JOIN TABLE_Y ON TABLE_X.FKEY = TABLE_Y.PRIMARYKEY LIMIT 50 and it took 300 seconds to come back. Dafuq.

It obviously had to be attempting some kind of full table scan but that still shouldn't take 300 seconds with like 1M records in each table.

Depending on what the tables contain (100 megabyte blobs?), maybe it's the SELECT * part? Since

JewKiller 3000 posted:

In my experience, you get it by believing things like this:


...

Anyhow, I've encountered an Oracle query that took 100 seconds to run on a table of a few thousand (small) rows. The contractor who had built the query hadn't bothered putting indexes on such a small table, yet Oracle's CONNECT BY somehow managed to do a full table scan for each relationship on each row. So the query ran at roughly O(n2) time. Putting an index on the column resulted in a cool 1000x speedup :c00l:

geeves
Sep 16, 2004

I like hibernate for the simple ORM that it gives you for the everyday CRUD operations. I also write plenty of straight SQL with it and use their transformers for the more complex queries into custom objects that are used for our REST interface.

All of our queries have their own method each usually grouped into a manager class in some categorized way (usually based on the main table from which they are questioning).

Adbot
ADBOT LOVES YOU

Exigent
Jan 2, 2015

Is the OP still accurate? Should I watch that video series to begin focusing more on Java?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply