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
Powerful Two-Hander
Mar 10, 2004

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


for fucks sake another afternoon wasted trying to work out what is configured wrong only to find that its actually that visual studio has actually just poo poo all over its temp files and lost the ability to load debug symbols again

edit: turns out it was the project settings fffffffuck

Powerful Two-Hander fucked around with this message at 16:31 on Sep 6, 2016

Adbot
ADBOT LOVES YOU

HoboMan
Nov 4, 2010

what if someone wrote a program using only SQL queries?

Powerful Two-Hander
Mar 10, 2004

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


now I've unfucked my solution..... is there a web graphing library that isn't a total pain to use?

the default .net mvc one is simple but looks disgusting and chart.js has the usual godawful configuration settings and lovely documentation all javascript libraries seem to love....though it does at least work.

Space Whale
Nov 6, 2014
Spent a month refactoring shitcode before I could do what I was supposed to do. But then it was easy.

Architect basically said "do it you gotta do it this isn't maintainable".

Whoa.

gonadic io
Feb 16, 2011

>>=

HoboMan posted:

what if someone wrote a program using only SQL queries?

I've seen it, and had to rewrite it. Something like 20k lines of bash and stored procs that took an hour to run, replaced with 500 lines of scala that took 10 secs. I'm pretty sure that I posted about it in this thread if you want more details

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

HoboMan posted:

what if someone wrote a program using only SQL queries?

I've seen dynamic sql "programs" that basically are stored procedures that write their own sql and it had all kinds of weird poo poo. Debugging it was horrible and it was pretty much impossible to maintain because no one really knew how it worked. It had like 40-50 stored procs and several of those were 1000+ lines. Granted, a lot of that was just giant blocks of setting up variables and select params, but it hurts my brain just thinking about it again

(that was financial sector stuff, btw)

HoboMan
Nov 4, 2010

yeah i asked because basically our dba did this. i don't really blame them though, they're a fukkin' dba of course they're gonna want to use sql. i blame the madman who decided to have the dba make "software".

Powerful Two-Hander
Mar 10, 2004

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


Finster Dexter posted:

I've seen dynamic sql "programs" that basically are stored procedures that write their own sql and it had all kinds of weird poo poo. Debugging it was horrible and it was pretty much impossible to maintain because no one really knew how it worked. It had like 40-50 stored procs and several of those were 1000+ lines. Granted, a lot of that was just giant blocks of setting up variables and select params, but it hurts my brain just thinking about it again

(that was financial sector stuff, btw)

I've done this but only for one specific proc one where it was the 'easiest' way to pivot data from n columns per row to 3 columns of n rows. or it was on whateve sql server version we had.


i have heard that there is a team at work that have written an xml import process in sql. unsurprisingly it fucks up all the time

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

Powerful Two-Hander posted:

i have heard that there is a team at work that have written an xml import process in sql. unsurprisingly it fucks up all the time

hopefully they managed to wrap the whole thing in a transaction and can rollback when it fucks up

jesus WEP
Oct 17, 2004


YeOldeButchere posted:

hopefully they managed to wrap the whole thing in a transaction and can rollback when it fucks up

code:

EXCEPTION
    WHEN OTHERS THEN
        commit; --yolo 

Powerful Two-Hander
Mar 10, 2004

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


YeOldeButchere posted:

hopefully they managed to wrap the whole thing in a transaction and can rollback when it fucks up

ha ha ha, wrong. they insert the data anyway and crash the dependent processes

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal
of course it does, why would i expect anything else from a sql db

HoboMan
Nov 4, 2010

i added transactions to our calling-a-dozen-stored-procedures-for-one-operation poo poo to be in our next release
this poo poo is ten years old

Luigi Thirty
Apr 30, 2006

Emergency confection port.

lol I was assigned to remove the transactions from our calling a dozen stored procedures for one operation poo poo because they don't know what row level locking is

LordSaturn
Aug 12, 2007

sadly unfunny

suppose for a minute that you're concerned about the performance of pthreads on Windows. "this poo poo's too slow," you think, "probably because it's just an emulation of POSIX threading on Windows threading primitives"

how insane do you need to be to then decide "well I guess I'm gonna make a #define cross-compiling library that exposes all the pthreads interfaces on Unix but reimplements them using Windows threading primitives on Windows"

like is there a way that this isn't literally just reimplementing exactly the same thing as already exists and you don't like

GameCube
Nov 21, 2006

LordSaturn posted:

suppose for a minute that you're concerned about the performance of pthreads on Windows. "this poo poo's too slow," you think, "probably because it's just an emulation of POSIX threading on Windows threading primitives"

how insane do you need to be to then decide "well I guess I'm gonna make a #define cross-compiling library that exposes all the pthreads interfaces on Unix but reimplements them using Windows threading primitives on Windows"

like is there a way that this isn't literally just reimplementing exactly the same thing as already exists and you don't like

yeah but yours is going to be better, because you wrote it.

NihilCredo
Jun 6, 2011

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

Finster Dexter posted:

I've seen dynamic sql "programs" that basically are stored procedures that write their own sql and it had all kinds of weird poo poo. Debugging it was horrible and it was pretty much impossible to maintain because no one really knew how it worked. It had like 40-50 stored procs and several of those were 1000+ lines. Granted, a lot of that was just giant blocks of setting up variables and select params, but it hurts my brain just thinking about it again

(that was financial sector stuff, btw)

dynamic sql is an untyped abomination that belongs exclusively in one-off queries and should never ever touch production in any way, shape or form

but don't tar all of sql code with the same brush. often enough you can gain a ton of safety, encapsulation and/or performance by moving some of your logic from application code to triggers, sprocs and views.

HoboMan
Nov 4, 2010

GameCube posted:

yeah but yours is going to be worse, because you wrote it.

distortion park
Apr 25, 2011


NihilCredo posted:

dynamic sql is an untyped abomination that belongs exclusively in one-off queries and should never ever touch production in any way, shape or form

but don't tar all of sql code with the same brush. often enough you can gain a ton of safety, encapsulation and/or performance by moving some of your logic from application code to triggers, sprocs and views.

I'm writing dynamic SQL right now at work. It just inserts it as a sproc though so that a human can check it and fill in the bits which require specialised logic.

GameCube
Nov 21, 2006


everybody else is an idiot, and i am the best programmer ever. only 3 days into my first job out of school, i could tell that the codebase was a huge piece of crap, and it'd be better if we just started over. i can't believe nobody else ever thought to do that, but i guess that's what makes me the best.

GameCube
Nov 21, 2006

in unironic terrible programmer news: someone on my team insisted this morning that any multi-byte characters in our utf-8 encoded xml files should be escaped, in case someone opens the files with the wrong editor and fucks them up. i argued that in the year 2016, that is not something we should be concerned about. which of us is the idiot? turn your monitor upside down to find out.

answer: ˙sᴉɥʇ ƃuᴉpɐǝɹ ɹoɟ 'noʎ oslɐ puɐ 'sn ɟo ɥʇoq

Jerry Bindle
May 16, 2003
wouldn't that make a multi-byte characters not display correctly in editors that support utf-8? if so lol

Powerful Two-Hander
Mar 10, 2004

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


Luigi Thirty posted:

lol I was assigned to remove the transactions from our calling a dozen stored procedures for one operation poo poo because they don't know what row level locking is

simple solution: SET TRANSACTION ISOLATION LEVEL: READ UNCOMMITED


always be reading dirty

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo
python best language

code:
(Pdb) lst = [[0] * 5] * 5
(Pdb) lst
[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
(Pdb) lst[0][0] = 1
(Pdb) lst
[[1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0]]

GameCube
Nov 21, 2006

Barnyard Protein posted:

wouldn't that make a multi-byte characters not display correctly in editors that support utf-8? if so lol

instead of
pre:
<fart>Pokémon</fart>
it would be
pre:
<fart>Pok\u00e9mon</fart>
you know, to be safe.

HoboMan
Nov 4, 2010

Flat Daddy posted:

python best language

code:
(Pdb) lst = [[0] * 5] * 5
(Pdb) lst
[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
(Pdb) lst[0][0] = 1
(Pdb) lst
[[1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0]]

lol
up until the last line i was all like "drat that's pretty cool"

Bloody
Mar 3, 2013

LordSaturn posted:

suppose for a minute that you're concerned about the performance of pthreads on Windows. "this poo poo's too slow," you think, "probably because it's just an emulation of POSIX threading on Windows threading primitives"

how insane do you need to be to then decide "well I guess I'm gonna make a #define cross-compiling library that exposes all the pthreads interfaces on Unix but reimplements them using Windows threading primitives on Windows"

like is there a way that this isn't literally just reimplementing exactly the same thing as already exists and you don't like

you just fire up linux on windows and have fast native pthreads

Luigi Thirty
Apr 30, 2006

Emergency confection port.

I'm mad I can't find anyone to sell me a compact flash card for my apple 2

VikingofRock
Aug 24, 2008




Flat Daddy posted:

python best language

code:
(Pdb) lst = [[0] * 5] * 5
(Pdb) lst
[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
(Pdb) lst[0][0] = 1
(Pdb) lst
[[1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0]]

I get why this happens, but wow that is surprising behavior

gonadic io
Feb 16, 2011

>>=

VikingofRock posted:

I get why this happens, but wow that is surprising behavior

do tell

LordSaturn
Aug 12, 2007

sadly unfunny


in case you're serious:

python's behavior is that all data is passed by reference at all times, but immutable types will make a new instance when you attempt to set them

integers are immutable so [x] * y makes a list of y distinct copies of integer x

lists are mutable so [a, b, c...] * y makes a list of y copies of a reference to [a, b, c...]

then when you subscript the mutable list and its mutable list child to set one immutable member, the correct operation is that the child list should replace the member with a newly-constructed immutable member. it just so happens that ALL the child lists are mutable references to the same data

EDIT: I bet I'm wrong about some of the details, like I know l1 = l2; l1 = [] will not delete l2. please pedant the poo poo out of my terrible post

HoboMan
Nov 4, 2010

Luigi Thirty posted:

I'm mad I can't find anyone to sell me a compact flash card for my apple 2

text me

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:

I'm mad I can't find anyone to sell me a compact flash card for my apple 2

are the CFFA cards really that hard to find now? you could always use a Floppy Emu instead

have you seen the dude who's making new TransWarp GS cards? he bought one, sent it to a reverse engineering co in China to get Garber files of the PCB (only $75/layer!) and is now making new cards so people can have a super zoomy IIgs

VikingofRock
Aug 24, 2008





Short version: the list multiplication operator effectively copies by reference for "mutable" types (such as lists), and by value for immutable types (such as ints). So the outer list is just five references to the same inner list.

Longer version: Don't think of python as having reference or value semantics, think of it as being more like pointer assignment. So when you say l1 = [1, 2, 3], think of l1 as now "pointing" at [1, 2, 3]. If you then say l2 = l1, l2 will "point" at that same list. If you then say l1 = [], l1 now "points" at an empty list, but l2 is still pointing at the original [1, 2, 3] list. If you then say l2 = l1 again that original list will get garbage collected since nothing is pointing at it. Now l1 and l2 are both pointing at the same empty list. If we say l1.append(0), that modifies the list being pointed at, so now both l1 and l2 will be pointing at a [0] list. This is only for "mutable" types though. For "immutable" types everything is just copied. Or at least that's how I understand it.

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

VikingofRock posted:

Longer version: Don't think of python as having reference or value semantics,

ok

VikingofRock posted:

think of it as being more like pointer assignment

wait, how's that different from having reference semantics? i mean, unless you specifically mean c++ style references that are themselves just immutable pointers, but i don't think that's what "reference" usually means in the general case

Luigi Thirty
Apr 30, 2006

Emergency confection port.

eschaton posted:

are the CFFA cards really that hard to find now? you could always use a Floppy Emu instead

have you seen the dude who's making new TransWarp GS cards? he bought one, sent it to a reverse engineering co in China to get Garber files of the PCB (only $75/layer!) and is now making new cards so people can have a super zoomy IIgs

oh no, i haven't. nice

i could just buy a floppy emu yeah

VikingofRock
Aug 24, 2008




YeOldeButchere posted:

ok


wait, how's that different from having reference semantics? i mean, unless you specifically mean c++ style references that are themselves just immutable pointers, but i don't think that's what "reference" usually means in the general case

I was thinking of it more in the C++ way. If this is how Java does it, than ignore that statement.

Soricidus
Oct 21, 2010
freedom-hating statist shill
wow both of you really overcomplicated your explanations by trying to introduce a non-existent distinction between immutable and mutable types.

the reason all the ints don't change isnt because python is magically making new ints, it's that you're not even trying to modify the ints. you're only modifying the lists.

python doesn't have any special concept of immutable types; the only reason things like tuples are immutable is because they don't implement any methods that modify them.

Soricidus fucked around with this message at 00:34 on Sep 7, 2016

skimothy milkerson
Nov 19, 2006

IS PYTHON BAD? [Y/n]

Adbot
ADBOT LOVES YOU

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

y

  • Locked thread