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
Luigi Thirty
Apr 30, 2006

Emergency confection port.

MALE SHOEGAZE posted:

also please keep posting updates in this thread. i think your posts are eventually going to inspire me to get into lower level stuff.

i'll keep working on it as long as i'm autistic for 68k code

seeing as i just fixed my atari st and it can read ms-dos floppies this might be a while

Adbot
ADBOT LOVES YOU

Sweevo
Nov 8, 2007

i sometimes throw cables away

i mean straight into the bin without spending 10+ years in the box of might-come-in-handy-someday first

im a fucking monster

for some reason that xor thing used to show up in every lovely online pascal tutorial back in the 90s, and pascal programmers used to go :aaaaa: over it.

the only time it's actually useful if if you're targeting some 8-bit micro with only a few dozen bytes of ram and you have to make every one count.

Bloody
Mar 3, 2013

nah its only useful if you are somehow starved for registers. your temp swap-holder is never hitting memory.

Bloody
Mar 3, 2013

the only hypothetical ive come up with is if:
* you're on a platform without shadow registers/banked registers
* your register usage is highly optimized
* you have extremely sensitive hand-coded interrupts that might interrupt this function
* this one instance will cause you to use one more register than anywhere else in interruptable code
* your isr needs all of the registers
now your isr can save one fewer register on the stack at entry and restore one fewer at exit

and, somewhere out there, there's a code base with exactly this for some reason

HoboMan
Nov 4, 2010

Space Whale posted:

So in multiple parts of this JS app there's loving loopy lookups and additions all over the place of ABigFuckingArray™ of various financial infos over a length of months for a whole deal, and products in the deal.

poo poo like

code:
for (var i = 0; i < arrayLOL.length; i++) {
    if arrayLOL[i].someProp = "someValue";
    this.FuckingGlobal += arrayLOL[i].someOtherProp;
}
// Imagine a dozen of these loving for loops each making GBS threads into another global! 
Can't you just go over the whole array once , making buckets as necessary based on unique values of someProp, and summate things accordingly?

In some places it's loving O(n^2) :psyduck:

a few pages ago, but is this a design pattern or something? because i found some js code here that does exactly the same thing

VikingofRock
Aug 24, 2008





Oh god, what does it say about me that I don't find this that horrifying by C macro standards?

Sweevo
Nov 8, 2007

i sometimes throw cables away

i mean straight into the bin without spending 10+ years in the box of might-come-in-handy-someday first

im a fucking monster

Bloody posted:

the only hypothetical ive come up with is if:
* you're on a platform without shadow registers/banked registers
* your register usage is highly optimized
* you have extremely sensitive hand-coded interrupts that might interrupt this function
* this one instance will cause you to use one more register than anywhere else in interruptable code
* your isr needs all of the registers
now your isr can save one fewer register on the stack at entry and restore one fewer at exit

and, somewhere out there, there's a code base with exactly this for some reason

* and you're using an architecture that lacks a dedicated register<->register swap/exchange instruction

Space Whale
Nov 6, 2014

HoboMan posted:

a few pages ago, but is this a design pattern or something? because i found some js code here that does exactly the same thing

No, it's "i can't grok into hash"

Are you working for an isp near some big mountains by chance?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Bloody posted:

the only hypothetical ive come up with is if:
* you're on a platform without shadow registers/banked registers
* your register usage is highly optimized
* you have extremely sensitive hand-coded interrupts that might interrupt this function
* this one instance will cause you to use one more register than anywhere else in interruptable code
* your isr needs all of the registers
now your isr can save one fewer register on the stack at entry and restore one fewer at exit

and, somewhere out there, there's a code base with exactly this for some reason

even then it seems like temporarily spilling a register is still better. 1 op to spill, 2 ops to read the values you're swapping, 2 ops to write them back swapped, 1 op to read back the thing you spilled. c.f. some xor bullshit where you have to re-read the same locations over and over.

the underhanded-c entry that used an "optimised" xor swap to surreptitiously weaken encryption was pretty cool though

JawnV6
Jul 4, 2004

So hot ...
hackbunny: your whitespace is consistent and pleasing

xor swap: the real danger is taking references and zeroing out a single element passed to both

longjmp: i didn't understand why it passed the arg back out and seeing the #def for RAISE() made it clear and disheartening

hobbesmaster
Jan 28, 2008

well all hack exceptions into c macros are incredibly ugly.

at least everyone I've seen (which is to be honest not all that many)

Bloody
Mar 3, 2013

Jabor posted:

even then it seems like temporarily spilling a register is still better. 1 op to spill, 2 ops to read the values you're swapping, 2 ops to write them back swapped, 1 op to read back the thing you spilled. c.f. some xor bullshit where you have to re-read the same locations over and over.

the underhanded-c entry that used an "optimised" xor swap to surreptitiously weaken encryption was pretty cool though

yeah im not even sure it would save a register. probably uses fewer registers in the temp stash too, but there's so much platform-dependence in the hypothetical that who knows

HoboMan
Nov 4, 2010

Space Whale posted:

No, it's "i can't grok into hash"

Are you working for an isp near some big mountains by chance?

no, i'm not even in the same industry. that's why i asked if it was a pattern, because it is exactly the same goddamn thing here. maybe they both got the same terrible consultant at some point. :iiam:

GameCube
Nov 21, 2006

lol no it's just the product of lovely hacker school grads who were taught only How To Code

HoboMan
Nov 4, 2010

So I'm going through the database API we had our DBA write for some godforsaken reason.
C# code:
public class Dbo_InsertJSONAuditRecord: DataClass
{
    public static int Execute(SqlConnection conn, string json)
    {
        DataSet ds = DBAccess.ExecStoredProcedure("dbo.InsertJSONAuditRecord", conn: conn, json: json);
        return 1;
    }
}
:allears:

GameCube
Nov 21, 2006

HoboMan posted:

So I'm going through the database API we had our DBA write for some godforsaken reason.
C# code:
public class Dbo_InsertJSONAuditRecord: DataClass
{
    public static int Execute(SqlConnection conn, string action, string json)
    {
        DataSet ds = DBAccess.ExecStoredProcedure("dbo.InsertJSONAuditRecord", conn: conn, action: action, json: json);
        return 1;
    }
}
loving hell

100% success rate. looks good to me

HoboMan
Nov 4, 2010

the DBAccess.ExecStoredProcedure method is lifted wholesale from the datalayer for the website and we purposely made it very flexible and general so it's easy to use as a main method of communicating with the database no matter the scenario, but no let's make an entire separate file containing only a single class containing only a static "Execute" method as a wrapper for every single individual stored procedure you might call.

yeah that thing i posted was an entire file minus the usings at the top

hobbesmaster
Jan 28, 2008

GameCube posted:

lol no it's just the product of lovely hacker school grads who were taught only How To Code

and then the people that say that "everyone needs to learn to code!!!!!" complain that there are no qualified engineers

HoboMan
Nov 4, 2010

wait some of these use a different method invilving a bespoke DataTable class

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
https://software.intel.com/en-us/python-distribution

this is cool

python is good

Bloody
Mar 3, 2013

actually python is bad

echinopsis
Apr 13, 2004

by Fluffdaddy
don't project your ineptitude onto the language you can't remember how to use while you're using it

Luigi Thirty
Apr 30, 2006

Emergency confection port.

MALE SHOEGAZE posted:

also please keep posting updates in this thread. i think your posts are eventually going to inspire me to get into lower level stuff.

before: after:

:)

tef
May 30, 2004

-> some l-system crap ->

Bloody posted:

actually python is bad

python's ok

- the docs are pretty comprehensive in a lot of places, but there's very little guidance on what api you should be using
- requests is nice, but urllib2 and many of the net stdlib is god drat awful, sorry
- it works very well on windows, osx, and linux
- python 3.5 finally has stuff going for it, and there's a typechecker, and a jit coming too
- jupyter/numpy/conda/nltk, the specialists have enough going for them to help them do some heavy lifting

i can see people moving away from python or not using it for loads of reasons

- the whole white space thing sucks horribly in a repl
- they've used python packaging in the past without recent versions of pip or virtualenv
- python2 made unicode handling possible but not pleasant
- you can do a lot of the web dev related things in node, there's enough equivalents, and it's easier to piss around with http stuff

and i can see more python people picking up swift than go

but python's ok, and it has lots of very bad bits, but it sorta makes up for it with, docs, community, and the occasional specialist library or tool

but i've put up with some awful poo poo

tef
May 30, 2004

-> some l-system crap ->

HoboMan posted:

So I'm going through the database API we had our DBA write for some godforsaken reason.
C# code:
public class Dbo_InsertJSONAuditRecord: DataClass
{
    public static int Execute(SqlConnection conn, string json)
    {
        DataSet ds = DBAccess.ExecStoredProcedure("dbo.InsertJSONAuditRecord", conn: conn, json: json);
        return 1;
    }
}
:allears:

like, this is one of the reasons i like python, you can use as little of the language as you need to get something done

i've seen a bunch of smart people really struggle with learning java without learning some sort of simplified scripting language first, without such an emphasis on objects. i mean the "public static void main" thing and then suddenly you're looking at 20 static methods you don't know what is happening but boy does it compile

it's hard to teach people why local functions are good practice without letting them use globals badly, it's hard to teach objects without doing some whole "all the functions in one mess" first. when you force good behaviour on beginners they will handwave their way out of it. experts too.

(aside: in python2 i've uniquely encountered chains of encode().decode().encode() trying to hammer the bad input out. in a lot of other languages it's "utf-8 is fine, it's just big ascii" and it accidentally works for webdevs)

this is why i mostly like python, it's a teaching language

it teaches you that programming is bad

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i think the main reason i dislike python is because the repl is bad. REPLs are really the main selling point of a dynamic language (for me, at least) and having a bad one just makes it feel pointless.

i kind of dislike everything else about it too but i think that's mostly discomfort.

e: also the fact that python is like, semi compiled (?, i don't actually really understand what python does here, what are .pyc files?), means that your debugger feels more like a C debugger than a nice REPL. maybe I'm just not familiar enough with its debugging tools.

DONT THREAD ON ME fucked around with this message at 04:40 on Aug 19, 2016

fritz
Jul 26, 2003

MALE SHOEGAZE posted:

i think the main reason i dislike python is because the repl is bad. REPLs are really the main selling point of a dynamic language (for me, at least) and having a bad one just makes it feel pointless.

are you using the stock repl or ipython

Series DD Funding
Nov 25, 2014

by exmarx
.pyc files are what the python interpreter actually executes, they're not too much more complicated than the python AST compressed into binary

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

fritz posted:

are you using the stock repl or ipython

probably the stock repl. i've never used python for more than a week or so at a time so i've never gotten very deep into the tooling.

Bloody
Mar 3, 2013

i dont like ipython

Bloody
Mar 3, 2013

and idk why. something always feels counterintuitive about the interface or something and my notebooks turn into huge messes and its gross

Star War Sex Parrot
Oct 2, 2003

i'm using python right now

it's whatever

Luigi Thirty
Apr 30, 2006

Emergency confection port.

i use python

i also use pycharm

:getin:

also



i can run programs (with an entry point of $800000) now :toot:

Luigi Thirty fucked around with this message at 05:02 on Aug 19, 2016

tef
May 30, 2004

-> some l-system crap ->

MALE SHOEGAZE posted:

i think the main reason i dislike python is because the repl is bad. REPLs are really the main selling point of a dynamic language (for me, at least) and having a bad one just makes it feel pointless.

tbh, i like that python insists on well indented code, it fits with bits like "" / '' aren't multiline

but after using ruby for ~2 years, i can see the convenience of an explicit `end` like syntax rather than relying on when the whitespace goes missing

maybe just for the whole "copy paste often destroys whitespace and ugh i am tired of asking people to wrap in tags to preserve structure"

i guess explicit is better than implicit, who knew

quote:

e: also the fact that python is like, semi compiled (?, i don't actually really understand what python does here, what are .pyc files?), means that your debugger feels more like a C debugger than a nice REPL. maybe I'm just not familiar enough with its debugging tools.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
another thing i dislike about python is that it uses syntactic indicators to warn you against metaprogramming and special class programming stuff ('_', I think maybe '@', cant remember).

i think that's all well and good, but I see a ton of metaprogramming in python and all of it screams 'HEY THIS IS A SPECIAL THING DONT DO THIS' even though it's super commonplace. the language should either give those features better support, or get rid of them.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

CPython compiles your source to bytecode (the .pyc files) for a virtual machine written in C

Jython does the same but with Java and IronPython the same with the .net CLR

bomb
Nov 3, 2005


numpy and scipy are king

Mao Zedong Thot
Oct 16, 2008


Python is pretty okay actually. Only assholes write giant systems in it but then again assholes write giant systems in ruby and Java and c# and etc

gonadic io
Feb 16, 2011

>>=

Luigi Thirty posted:

CPython compiles your source to bytecode (the .pyc files) for a virtual machine written in C

Jython does the same but with Java and IronPython the same with the .net CLR

i feel like ironpython should be the Rust backend

Adbot
ADBOT LOVES YOU

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum
irony python

  • Locked thread