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.
 
  • Locked thread
~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Shaggar posted:

I like joining collections

I know you probably mean Join but the other day I did
code:
Enumerable.Repeat("intzone", 1).Union(elementVariables).Union(slopeVariables)
felt good but I wonder if there's a more expressive way than using Enumerable.Repeat

Adbot
ADBOT LOVES YOU

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Luigi Thirty posted:

and now i've screwed up the atmega knocking the USB cable out while it was programming, now it won't reset or connect to my programmer anymore. welp

maybe i should just buy a pi so i don't have to constantly flash the drat thing

do you have a JTAG device or some other bit-banger? you should be able to rescue your ATMega with something like a bus blaster or bus pirate or whatever

fritz
Jul 26, 2003

MALE SHOEGAZE posted:

nah, it's always functional

pepito sanchez
Apr 3, 2004
I'm not mexican

Symbolic Butt posted:

I'm actually not minding node for now

I mean, it's javascript and I'm already familiar with the typical clown parade that it entails



but man today I looked at some angular

wtf how can angular be so bad :gonk:

node is okay until you realize a month from now it's probably going to be something completely different. that's all that pisses me off about it right now. i don't even care much about the cons arguments of i/o blocking or callback hell. that's JS.

as for angular. learn typescript. it's cool. a controller:

code:
interface IButtsModel {
		fart: string;
		showButt: boolean;
		butts: any[];
		showButts(): void;
	}
	
	class buttsController implements IButtsModel {
		fart: string;
		showButt: boolean;
		butts: any[];
		
		constructor() {
			this.fart = "pffffft";
			this.showButt = false;
			this.butts = [];
		}
		showButts():void{
			this.showButt = !this.showButt;
		}
	}
	
	angular.module("buttsApp").controller("buttsController", buttsController);
transpiles to valid ES5 with the right config (or ES6 but thats not very much supported yet), and after setting up your typescript for angular vs-code enforces strong typing no matter what you're doing. and it has normal VS intellisense!!! this makes doing javascript suck a lot less. typescript also very cool for doing all of your node/express/mongoose stuff if you work with that.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

jony neuemonic posted:

had a former employer do a mysql -> postgres port because mysql got so painful to use that suffering through a port was better than going forward with it.

the only database ports I've ever really heard of in significant number have been

SQLite → MySQL/PostgreSQL
MySQL → PostgreSQL
MySQL/PostgreSQL → MSSQL/DB2/Oracle

and of course the

Access/FileMaker/FoxPro → SQLite or anything that runs on a server

comedy option too

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Vanadium posted:

Also I bet we'll never migrate off either Delphi 5 or Interbase so all that stuff is completely academic. There's basically no way because there's like a dozen of us, sitting on a huge pile of code that seemingly only ever had stuff added to it in the past 20 years..

not even to RemObjects Oxygene? (that's their implementation and extension of Delphi that runs on the CLR and in native code)

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

eschaton posted:

the only database ports I've ever really heard of in significant number have been

SQLite → MySQL/PostgreSQL
MySQL → PostgreSQL
MySQL/PostgreSQL → MSSQL/DB2/Oracle

and of course the

Access/FileMaker/FoxPro → SQLite or anything that runs on a server

comedy option too

i've seen a lot of oracle to sql server too

oracle to anything can be pretty brutal though, loving oracle joins everywhere :barf:

Shaggar
Apr 26, 2006
sql server is the best

triple sulk
Sep 17, 2014



i should use vs more than i presently do especially considering i can use it 100% of the time

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

triple sulk posted:

i should use vs more than i presently do especially considering i can use it 100% of the time

vs + resharper is great

pepito sanchez
Apr 3, 2004
I'm not mexican

Shaggar posted:

sql server is the best

imagine doing sqlite's insert or replace to sql server's merge

Shaggar
Apr 26, 2006
ive never used SQLite. sql server merge works pretty well tho

pepito sanchez
Apr 3, 2004
I'm not mexican
don't get me wrong sql server is what i use and like, but insert or replace is something that sql server could learn from.

Bloody
Mar 3, 2013

I should get work to buy me vs2015 and resharper

compuserved
Mar 20, 2006

Nap Ghost

eschaton posted:

the only database ports I've ever really heard of in significant number have been

SQLite → MySQL/PostgreSQL
MySQL → PostgreSQL
MySQL/PostgreSQL → MSSQL/DB2/Oracle

and of course the

Access/FileMaker/FoxPro → SQLite or anything that runs on a server

comedy option too

Netezza → Vertica for OLAP

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

Cold on a Cob posted:

vs + resharper is great

resharper is loving magical

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Bloody posted:

I should get work to buy me vs2015 and resharper

yes you should, but there's actually a free version of vs2015 if you work in a small business too

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Shaggar posted:

step 1) use stored procs. all ur problems then go away. that's it. theres no more steps

So cause I'm a dumb web developer whom cut their teeth on Django I've never really worked without an ORM or statement mapper, but writing stored procs for all data access sounds pretty appealing. That said though, what's the right way to go about managing that code base, I mean I assume the stored procs get written + updated during your schema updates, but are there documented approaches to organising it all when it gets to non-trivial sizes?

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

~Coxy posted:

I know you probably mean Join but the other day I did
code:
Enumerable.Repeat("intzone", 1).Union(elementVariables).Union(slopeVariables)
felt good but I wonder if there's a more expressive way than using Enumerable.Repeat

literal arrays implement IEnumerable, so you can just write elementVariables.Union({"intzone"}).

I did something awful like that once, I wanted to concat through Aggregate but couldn't guarantee the collection wouldn't be empty
code:
myTextLines.
 Union({"", ""}).
 Aggregate(Function(line1, line2) line1 & Environment.Newline & line2)
and yeah I could have assigned the whole LINQ to a variable and then called String.Join(Environment.Newline, myTextLines.ToArray) but I derive sexual pleasure both from long functional concatenations and from avoiding declaring variables that will only be used once.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Shaggar posted:

ive never used SQLite. sql server merge works pretty well tho

i like a lot of stuff about sql server but merge is probably the worst and most awkward of all upsert implementations

jesus WEP
Oct 17, 2004


Shaggar posted:

sql server is the best
oracle is cool for writing apps against because your package spec mirrors your c# interface, its p neat

otoh then you have to write pl/sql

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Maluco Marinero posted:

So cause I'm a dumb web developer whom cut their teeth on Django I've never really worked without an ORM or statement mapper, but writing stored procs for all data access sounds pretty appealing. That said though, what's the right way to go about managing that code base, I mean I assume the stored procs get written + updated during your schema updates, but are there documented approaches to organising it all when it gets to non-trivial sizes?

there are no good ways to do this

(which is why having a lot of logic in SQL is bad)

my current idea is to have one file per sproc/function/table and a script that runs them all in the right order. at least this way you can look at changelogs per file and diff them.

Stringent
Dec 22, 2004


image text goes here

Maluco Marinero posted:

So cause I'm a dumb web developer whom cut their teeth on Django I've never really worked without an ORM or statement mapper, but writing stored procs for all data access sounds pretty appealing. That said though, what's the right way to go about managing that code base, I mean I assume the stored procs get written + updated during your schema updates, but are there documented approaches to organising it all when it gets to non-trivial sizes?

that's a great question

distortion park
Apr 25, 2011


~Coxy posted:

I know you probably mean Join but the other day I did
code:
Enumerable.Repeat("intzone", 1).Union(elementVariables).Union(slopeVariables)
felt good but I wonder if there's a more expressive way than using Enumerable.Repeat

I've added an extension method to object called .Yield() in my project, which does exactly what it sounds like and is perfect for situations like this

Vanadium
Jan 8, 2005

NihilCredo posted:

maybe you could start some project with SQLite? IIRC it's 99% standard SQL with only a few custom additions, like the pretty amusing likely() and unlikely()

idk, sqlite seems to be a lot more liberal about what you can get up to in terms of subqueries, it feels way different than ~interbase~

Shaggar
Apr 26, 2006

Maluco Marinero posted:

So cause I'm a dumb web developer whom cut their teeth on Django I've never really worked without an ORM or statement mapper, but writing stored procs for all data access sounds pretty appealing. That said though, what's the right way to go about managing that code base, I mean I assume the stored procs get written + updated during your schema updates, but are there documented approaches to organising it all when it gets to non-trivial sizes?

theres no really good way to do it, no. the problem is that Microsoft refuses to acknowledge the idea that the schema belongs to the database and not the application. this means there are no tools or extensions in sql server for doing schema versioning. you basically have to use external tools to manage schemas in source control and then make sure everyone puts their changes into source control after they enter them. its a lovely system but its the best you can do.

I really wish they would add versioning directly to sql server so the server would version schema elements any time they're changed automatically. otherwise you're relying on your team to follow the process and that's always bad.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Shaggar posted:

theres no really good way to do it, no. the problem is that Microsoft refuses to acknowledge the idea that the schema belongs to the database and not the application. this means there are no tools or extensions in sql server for doing schema versioning. you basically have to use external tools to manage schemas in source control and then make sure everyone puts their changes into source control after they enter them. its a lovely system but its the best you can do.

I really wish they would add versioning directly to sql server so the server would version schema elements any time they're changed automatically. otherwise you're relying on your team to follow the process and that's always bad.

Why doesn't a SSDT project satisfy your requirements? If you're worried about coworkers manually editing the schema, you just don't give them the credentials to do so and instead set up a publish action in the CI process, so that the only way for them to alter the schema is to commit a change to the Sql project.

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


NihilCredo posted:

i like a lot of stuff about sql server but merge is probably the worst and most awkward of all upsert implementations

i feel like merge should be a lot better than it is but it's still better than the hilarious "delete 2 million rows and insert new ones from stage in one transaction" approach one of our former devs used before i changed it

jony neuemonic
Nov 13, 2009

NihilCredo posted:

i like a lot of stuff about sql server but merge is probably the worst and most awkward of all upsert implementations

postgres still doesn't have it at all sooooooo.

(i think it's coming in 9.5).

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
postgres is the poo poo

jony neuemonic
Nov 13, 2009

it's good, but no upsert was a real pain. at least it's a non-issue pretty soon.

Vanadium
Jan 8, 2005

it's one of those things that sqlite has and so i took it for granted, and now it turns out...

cowboy beepboop
Feb 24, 2001

Vanadium posted:

it's one of those things that sqlite has and so i took it for granted, and now it turns out...

even mysql has it

Shaggar
Apr 26, 2006

NihilCredo posted:

Why doesn't a SSDT project satisfy your requirements? If you're worried about coworkers manually editing the schema, you just don't give them the credentials to do so and instead set up a publish action in the CI process, so that the only way for them to alter the schema is to commit a change to the Sql project.

We don't do per application databases because most of our applications exist to service the data model which is designed by the business. This means per application db projects don't work cause we don't have per application db objects.

I've never actually tried importing the entire db schema into a project so maybe i'll give that a try. in general I've found it to be not as featured as sql management studio but maybe that's changed.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
the pitch NeXT used to make for EOF was that you should also be designing frameworks to interact with your data at a higher level, so that you can build applications faster than by putting all of the logic for all of the applications in the database

brap
Aug 23, 2004

Grimey Drawer
for god's sake if you're going to go ahead with this "stored procedures as the API to your database" thing and have multiple apps connecting to the same database then please don't let any fuckheads write code in their apps that queries the tables raw.

It seems pretty common for organizations to end up with databases that are unchangeable because some legacy apps contain magic query strings that hit tables directly

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Often it's better to write an API around the database and forbid applications from hitting the database directly. Need to query some new stuff? Come up with a sane way to add that info to the API.

So basically stored procs, except handled by your own code instead of being tied up in the database. Another bonus is that you can relatively easily add authentication etc. to externalize it for client applications, third-party developers and so on.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





wrappers around databases are the best justification for microservice architectures

distortion park
Apr 25, 2011


Jabor posted:

Often it's better to write an API around the database and forbid applications from hitting the database directly. Need to query some new stuff? Come up with a sane way to add that info to the API.

So basically stored procs, except handled by your own code instead of being tied up in the database. Another bonus is that you can relatively easily add authentication etc. to externalize it for client applications, third-party developers and so on.

After reading this it looks obviously correct, but I'm dumb so you're probably wrong

Adbot
ADBOT LOVES YOU

Vanadium
Jan 8, 2005

This is all hilarious to me because in our code base, the most random code hits the database to retrieve some obscure values, almost every utility function has a reference to the database somehow, etc. The size of that API around the database would be ridiculous. :(

  • Locked thread