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
gonadic io
Feb 16, 2011

>>=
hi, i'm gonadic io and im a terrible programmer.

Adbot
ADBOT LOVES YOU

gonadic io
Feb 16, 2011

>>=
currently i work in scala which annoys me every day, and my hobby stuff is micro-controllery rust.

i have programmed a LOT of haskell in my time and a little java. haven't done either in years.

gonadic io
Feb 16, 2011

>>=

eschaton posted:

use lots of these {}{}{}{}

gonadic io
Feb 16, 2011

>>=
I think the worst thing I've ever programmed is a model to forecast wind power generation in excel. It started off running into the nested formula limit, and so I gradually moved more and MORE of the logic into VBA.

gonadic io
Feb 16, 2011

>>=

gonadic io posted:

I think the worst thing I've ever programmed is a model to forecast wind power generation in excel. It started off running into the nested formula limit, and so I gradually moved more and MORE of the logic into VBA.

Or maybe a quiz thing that displayed questions with answer options to the user and scored their answers.

All answer_id's were hard-coded as the db primary key and the code would look compare the users answers to those hard-coded id's.

Like
If (user.q1AnswerId == 53) then user.score += 5 else if ( user.q1AnswerId == 55) then user.score += 10

gonadic io
Feb 16, 2011

>>=

Corla Plankun posted:

idk how to manually attribute that to cincy sorry

quote="terrible programmer"
in the opening tag

gonadic io
Feb 16, 2011

>>=

Bloody posted:

if theres one thing i want in a font its to make it even harder to distinguish (if x == 0) from (if x = 0)

lmao if your lang lets you mix the two up. one is a statement one is an expression jeeeez

gonadic io
Feb 16, 2011

>>=

JewKiller 3000 posted:

*does all laundry with a washboard* duhhhhhh i like the control

then i think about doing it with a lawnmower and suddenly feel good about the washboard. too bad there's no better option.

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

what's a greenfield project?

starting from scratch, no prior code. starting to building on an empty (green) field

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

ah. yeah i imagine that rough in c or c++

comedy option: this is how i Imagine lisp programming, working your way up from a pair of parentheses

class Main {
____public static void main(String[] args) {
________:ins:
____}
}



e: im dumb and couldn't figure out how to both preserve spaces and display the cursor smiley

gonadic io
Feb 16, 2011

>>=

BONGHITZ posted:

why do you program?

i really really like it. honestly it makes me feel smart when things come together and a problem is solved.
like a cross between a soduku puzzle and writing a novel. that's not something i'd admit irl but surely this safe space can accept my need to feel smart.

i prefer hobby programming because you can just do whatever interests you but work programming is fine

gonadic io
Feb 16, 2011

>>=
i starting using github desktop, but it has essentially no features and is a useless pile of Electron (pretty ui though)

gonadic io
Feb 16, 2011

>>=

Arcsech posted:

seriouspost a coworker of mine had to do some string mashing recently so he pulled out that famed scripting language, c++

just like, why

it's easiest to use whatever you're most experienced in or comfortable with :shrug:

gonadic io
Feb 16, 2011

>>=

log line posted:

Exception occured when processing request: [GET] /butts/123
Stacktrace follows:
<end of message>

please groovy. please

gonadic io
Feb 16, 2011

>>=

CRIP EATIN BREAD posted:

i had our front-end guys change all our error messages on the front-end to "your internet connection is not available" and it cut down like 90% of the bullshit we were dealing with.

pro tactic

gonadic io
Feb 16, 2011

>>=
is that in release mode?

gonadic io
Feb 16, 2011

>>=
`strip` and abort on panic will reduce it a bunch more since apparently even in release mode there's a bunch of debug symbols: https://lifthrasiir.github.io/rustlog/why-is-a-rust-executable-large.html

gonadic io
Feb 16, 2011

>>=
That's how you serialise a graph

gonadic io
Feb 16, 2011

>>=

quote:

Enter needle, a domain specific language for ASCII-fied arrow notation. A needle form of the above function looks like this:
code:
{-# LANGUAGE QuasiQuotes #-}

fNeedle :: (Int, Int, Int) -> (Int, Int, Int, Int)
fNeedle = [nd|
    }=={(+1)}=\==========================>
              \
    }===\     \             /============>
        \     \             /
    }=) \ (==={uncurry div}=/={negate}===>
        \
        \=={(*2)}========================>
|]
Hopefully this is a lot clearer. It is now obvious that we are dealing with a network, and we can clearly trace the paths of data.
:v:

gonadic io
Feb 16, 2011

>>=

PierreTheMime posted:

hey yospos, incredibly terrible programmer checking in

the engine i primarily write for has discontinued support for a java-compatible web service and has jumped to c#

which ide would you recommend for flinging simple poo poo at a screen

visual studio

failing that

visual studio code

no other options

gonadic io
Feb 16, 2011

>>=

CRIP EATIN BREAD posted:

and you don't need windows.

gently caress visual studio code that shits just atom for idiots

atom is also for idiots

i'm the c# IDE written in java

gonadic io
Feb 16, 2011

>>=

Ator posted:

the worst thing about visual studio is that the free vim plugin is utter garbage

probably intentional

gonadic io
Feb 16, 2011

>>=

oh no blimp issue posted:

i always use sublime text personally, but clion has come on leaps and bounds recently if you really loving love cmake

I used to use ST a lot, but I think VSCode is overtaking it now for everything except startup time

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

startup time and overall performativeness in large file (hundreds of MB or more) territory.

loving electron

gonadic io
Feb 16, 2011

>>=

i'm the e-note

gonadic io
Feb 16, 2011

>>=
speech marks are for strings and apostrophes are for chars. this isn't difficult, otherwise how do you tell the difference between a char and a string of length 1?

in b4 "there is no difference'

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

the hell if i know, im in this thread by birthright :v:

in python there genuinely isn't and you can happily do 'c'.charAt(0).charAt(0).charAt(0) because charAt returns a string of length 1.

in any non-plang a string is a sequence of chars. even if that sequence has length 1, one is a sequence (and has all the sequence methods defined) and one is not.

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

pycharm just pulled an out of memory crash, trashing a 30 minutes of voyage through settings :suicide:

e: okay something spooky is going on, it just crashed flat out while i did nothing special. it has crashed out of memory on me literally just once until now, and i routinely work with datasets exceeding my ram by several orders of magnitude

yesterday i had to change our build to do
"sbt compile && sbt test && sbt integration:test" instead of "sbt compile test integration:test" due to oom errors lol. sbt is good software u people!!

gonadic io
Feb 16, 2011

>>=
cjs:

gonadic io
Feb 16, 2011

>>=

HoboMan posted:

i am gonna be taking over our android development because we are dropping our contractor

help

I am currently writing angular 1

e: with sails.js and bootstrap

gonadic io
Feb 16, 2011

>>=

prisoner of waffles posted:

More like the "very good programmers thread," amirite?

there are no good programmers though. literally the entire point of programmig is to take shortcuts and be as lazy as possible to get comptuers to do work for us. also computers are so complex there's absolutely no way to actually understand what's going on unless you're writing in the rawest of assembly/most trivial peripheral bit twiddling so we just throw code out there and hope it looks like it works.

i honestly love it.

gonadic io
Feb 16, 2011

>>=
terrible programmer q: is there any advantage to making my local variables small int sizes/uints if i know they won't have any representation problems? i'm asking about rust specifically but i guess the question applies to any lang that has i8/u8/i16/u16.

i mean do they get aligned with wordsize anyway, so i might as well just use i/u size and call it a day? i'm getting pretty annoyed by the casting i need to do since all the library methods take usize/isize

gonadic io
Feb 16, 2011

>>=
super super terrible programmer q:
i have an array of 6 elements, (the neighbours of a tile) which contain a bool, and i'm writing a function that returns if any 3 consecutive neighbours are true. it also has to wrap around so the first element is next to the last one

so [t, f, t, f, t, t] is true and [f,t,f,t,t,f] is false and [f,t,f,t,t,t] is true

the only way i can think of is to loop from 0 to 5 (and then to 0 again) and increment a counter if true and reset the counter if false. then return (counter >= 3).

e: poo poo but that doesn't work in the case of [t,t,t,f,f,f,f]. maybe early return if it's 3 or longer at any step?

gonadic io fucked around with this message at 16:24 on Oct 29, 2017

gonadic io
Feb 16, 2011

>>=
god this is awful:
code:
fn has_seq_3_or_longer(neighbours: &[bool]) -> bool {
    let mut seq_length = 0;
    for neighbour in neighbours {
        if *neighbour {
            seq_length += 1
        } else {
            seq_length = 0
        }
        if seq_length >= 3 { return true; }
    };
    if neighbours[0] {
        seq_length += 1
    } else {
        seq_length = 0
    };
    return seq_length >= 3;
}

gonadic io
Feb 16, 2011

>>=

Fiedler posted:

Is there some reason that this shouldn't be generalized to sequences of an arbitrary length? Why is three special?

it's a lovely little game i'm writing so there's no need to generalise unless it'd improve the code.

gonadic io
Feb 16, 2011

>>=
haskell has the built in group which groups by equality and i've never seen any use for until now

code:
neighbors3 :: [Bool] -> Bool
neighbors3 xs = any (\ys -> length ys >= 3) (filter head (group xs'))
	where xs' = xs ++ take 2 xs

gonadic io
Feb 16, 2011

>>=

akadajet posted:

code:
POST /api/deleteItem
{
  id: "foo"
}

I didn't realise that we worked together

gonadic io
Feb 16, 2011

>>=
code:
if (arr[0]) {
    if (arr[1]) {
        if (arr[2]) {
            return true;
        }
    }
} elif (arr[1]) {
    if (arr[2]) {
        if (arr[3]) {
            return true;
        }
    }
} elif (arr[
:suicide:

gonadic io
Feb 16, 2011

>>=

Sweevo posted:

instead of using an array of bools use an integer variable and bit masking to set/clear individual bits. then you can just test for a match to the six values

code:

switch(varname) // assume the six neighbours are in the lower six bits
{
    case 0b111000:
    case 0b011100:
    case 0b001110:
    case 0b000111:
    case 0b100011:
    case 0b110001:
        <code for match goes here>
        break;
    default:
        <code for non-match goes here>
}
this won't work for 111100 which contains 3 concurrent 1s. sorry.

Adbot
ADBOT LOVES YOU

gonadic io
Feb 16, 2011

>>=
code:
macro_rules! butt {
    ($arr:expr, [$($x:expr),+]) => {
        $($arr[$x%6] && $arr[($x+1)%6] && $arr[($x+2)%6])&&+
    }
}

fn has_seq_3_or_longer(neighbours: &[bool]) -> bool {
    butt!(neighbours, [0, 1, 2, 3, 4, 5])
}
code:
> cargo rustc -- -Z unstable-options --pretty=expanded
        fn has_seq_3_or_longer(neighbours: &[bool]) -> bool {
            neighbours[0 % 6] && neighbours[(0 + 1) % 6] &&
                neighbours[(0 + 2) % 6] ||
                neighbours[1 % 6] && neighbours[(1 + 1) % 6] &&
                    neighbours[(1 + 2) % 6] ||
                neighbours[2 % 6] && neighbours[(2 + 1) % 6] &&
                    neighbours[(2 + 2) % 6] ||
                neighbours[3 % 6] && neighbours[(3 + 1) % 6] &&
                    neighbours[(3 + 2) % 6] ||
                neighbours[4 % 6] && neighbours[(4 + 1) % 6] &&
                    neighbours[(4 + 2) % 6] ||
                neighbours[5 % 6] && neighbours[(5 + 1) % 6] &&
                    neighbours[(5 + 2) % 6]
        }

gonadic io fucked around with this message at 22:14 on Oct 29, 2017

  • Locked thread