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
theadder
Dec 30, 2011


Symbolic Butt posted:

something like this I guess

code:
var largest = 0
var tracked_kind = ""
for (kind, numbers) in interestingNumbers {
    for number in numbers {
        if number > largest {
            largest = number
            tracked_kind = kind
        }
}
now what if your interestingNumbers contain only negative numbers? :iamafag:

thank u v much

Jabor posted:

you should post something that you've tried but isn't working - it's way more instructive to point out where your existing approach went wrong than it is to just give a solution (or a process to derive a solution) from nothing.

its difficult to explain but there is not much to paste that i have tried that isnt a big mess (also i deleted it all lol)

my problems are all with the syntax & i can read it but not write it

Adbot
ADBOT LOVES YOU

cinci zoo sniper
Mar 15, 2013




St Evan Echoes posted:

no because the variable is initialised as 0 so it would return 0
swift is hard
*opens turbo pascal*

Valeyard
Mar 30, 2012


Grimey Drawer

theadder posted:

its swift ta

Hmm, Swift syntax turns out to be a mix between JavaScript and Python lol

jesus WEP
Oct 17, 2004


lmao i didn't even realise it was an actual language, I thought it was pseudocode from a textbook or smth

edit i was still right because swift isn't a real language

faxlore
Sep 24, 2014

a blue star tattoo for you!

i kinda like swift i guess this is the thread for me then, heh.

theadder
Dec 30, 2011


thx all were makin serious progress now (to page 19)

Valeyard
Mar 30, 2012


Grimey Drawer
I'm looking for a video that demonstrates the kind of speed increase you would be looking at with a good implementation of multi threading for an appropriate task. Does anyone have any suggestions? Or even something simple I could code myself, I can't think of something simple but informative

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

depends heavily on the appropriate task, mate. for example, i've gotten extremely trivial 10x speedups on mass download scripts using multithreading. are you actually interested in parallelism or in concurrency?

cinci zoo sniper
Mar 15, 2013




is dvorak/colemak something to look into or not

theadder
Dec 30, 2011


kalstrams posted:

is dvorak/colemak something to look into or not

nooo

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

one time i got drunk and then decided to learn dvorak and spent 2 hours trying to touch type in dvorak with my eyes closed. when i sobered up i no longer had an interest in dvorak

qntm
Jun 17, 2009
so what does a good oo tutorial look like, if not "car extends vehicle"

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

is this a trick question? oo is bad

lord funk
Feb 16, 2004

qntm posted:

so what does a good oo tutorial look like, if not "car extends vehicle"

square extends rectangle, duh

cinci zoo sniper
Mar 15, 2013




fart simpson posted:

is this a trick question? oo is bad
wait, what is good now
thanks university education, in tyool 2015 i know pascal and think oop is what i should do next

MononcQc
May 29, 2007

Symbolic Butt posted:

now what if your interestingNumbers contain only negative numbers? :iamafag:

Then number kinds like 'primes' (by the usual definition), 'squares' and 'Fibonacci' kind of don't belong in the exercise anymore in the first place :shobon:

tef
May 30, 2004

-> some l-system crap ->
find the smallest least interesting number

Bloody
Mar 3, 2013

four

Bloody
Mar 3, 2013

wait, no, twelve

Bloody
Mar 3, 2013

twelve is the smallest uninteresting number. it's composite. it isn't an interesting power. its factors are interesting numbers on their own, but also factors of almost every number. twelve is the smallest uninteresting number.

gonadic io
Feb 16, 2011

>>=

Bloody posted:

wait, no, twelve

Nah it's 14

cinci zoo sniper
Mar 15, 2013




there isn't an objective definition to what constitutes an interesting number

Bloody
Mar 3, 2013

one is obviously interesting & lonely.
two is neat - it is the only even prime number!
three is the first odd prime number, so that's nifty.
four seems like a good candidate for boringness, but it's the first square, so that's right out.
five is prime, but not too interesting of a prime. it has some potential. being halfway to ten, a interesting number in the common base-10 scheme, though, is somewhat interesting.
six is the first number composed of 2 and 3, but is also the first perfect number, which saves it from boredom.
7 is a lucky number
8 is the first cube
9 is the first square of 3 which is getting to be a stretch for interestingness
10 is the first two-digit number! it's entire existence explains base-10 number representations. extremely important number.
11 is the first double-digit prime, and also two '1's in a row, and 1 is so interesting that 11 gets some of this by association.

Bloody
Mar 3, 2013

twelve, however, is not interesting.

tef
May 30, 2004

-> some l-system crap ->

wolffenstein posted:

what up thread its been a long while since i last posted in here. last time i shitposted about webdna, a lovely relic of a language no one's heard of. well after quitting that job without lining up another one first, i had a severe existential crisis and pretty close to committing suicide. a cross country move and several lovely months later, i am gainfully employed at a php dev shop. also i take sad brain medication and see a counselor so i don't repeat what i did. yet i still seem easily susceptible to giving a drat about doing my job right.

professional detachment takes time especially if you got the job from hobbying programming


quote:

so this dev shop was like three people for the longest time, then in the past year they hired on like crazy to try and keep up with the work coming in. well considering my last job was just my boss and i with no prospect for growth, this is already a step up. they use svn, which is better than no vcs so yay another step up.

and that's about it. every client's svn repo is the latest development snapshot with no branches or indication what production is running. development is done on a remote web server that may also be hosting the test environment and/or the production environment. debugging consists of var_dump, print_r, and die calls, and checking logs is next to useless because they turned off all error logging in php.ini. updating files on servers consists of ssh, using svn up only on the specific files you changed, and alter table queries from the mysql cli.

to save my sanity and resolve some long standing bugs i made a vagrant vm, cloned the svn repo into git, and made an orphan branch with rsync'd production code. i got an actual debugger installed and resolved a few issues within hours of setup.

my team thinks this is black voodoo magic and would take too much time to setup and train, so their solution is to make separate remote servers for every dev and just be sure to check svn before you work on a file.

yeah that sounds similar. the trick is usually small victories: aim for small improvements that are easy to sell to the rest of the team. work on some of the more stubborn people or those most likely to help or hinder improvements. you might find that it is easier to sell them on docker or heroku or digitalocean or whatever to manage your release/deploys

quote:

i guess i should jump ship but given my troublesome employment history, i think its best to stick it out for at least a year before moving. or finding a less sad brains-inducing career. i just wanna be like tef. thanks for reading.

well you've got the history of mental health issues so you're on track :v:

Careful Drums
Oct 30, 2007

by FactsAreUseless
twelve is cool because if you have twelve of something you can divide it amongst 2, 3, 4, _or_ 6 people. i feel sad if i have 12 things and i need them to divide amongst five.

tef
May 30, 2004

-> some l-system crap ->

Bloody posted:

one is obviously interesting & lonely.
two is neat - it is the only even prime number!
three is the first odd prime number, so that's nifty.
four seems like a good candidate for boringness, but it's the first square, so that's right out.
five is prime, but not too interesting of a prime. it has some potential. being halfway to ten, a interesting number in the common base-10 scheme, though, is somewhat interesting.
six is the first number composed of 2 and 3, but is also the first perfect number, which saves it from boredom.
7 is a lucky number
8 is the first cube
9 is the first square of 3 which is getting to be a stretch for interestingness
10 is the first two-digit number! it's entire existence explains base-10 number representations. extremely important number.
11 is the first double-digit prime, and also two '1's in a row, and 1 is so interesting that 11 gets some of this by association.

three, is an odd prime number, yes it is

jesus WEP
Oct 17, 2004


twelve is the lowest number that has more than three factors (not including 1 and itself) which is kinda interesting

MORE CURLY FRIES
Apr 8, 2004

-42

qntm
Jun 17, 2009
the smallest uninteresting number is currently 14228 and no, the fact that 14228 is the smallest uninteresting number does not make it interesting

Bloody
Mar 3, 2013

Careful Drums posted:

twelve is cool because if you have twelve of something you can divide it amongst 2, 3, 4, _or_ 6 people. i feel sad if i have 12 things and i need them to divide amongst five.

i can divide ten things among any of those numbers of people.

MORE CURLY FRIES
Apr 8, 2004

i reject the company of others to solve all these problems

qntm
Jun 17, 2009
2 is the only even prime number? 2 is the only prime number evenly divisible by 2?? you don't say

did you know that 3 is the only prime number evenly divisible by 3

and 5 is the only prime number evenly divisible by 5

qntm
Jun 17, 2009
1, 2, 4, 8, 15

Captain Pike
Jul 29, 2003

How to understand pointers:

If you do something and get a compiler error, just start adding "*" or "&" to stuff until the error goes away.

crazypenguin
Mar 9, 2005
nothing witty here, move along

MononcQc posted:

The quickcheck library wouldn't be much help unless you can figure out a property of your IO system you want to see, or find an alternative function (a model) to compare your implementation to.

Otherwise you'll be generating random-but-guided data and test cases, but you have no guarantee that your tests are relevant in any way.

quickcheck doesn't help with the DI part of it, but you can still quickcheck IO/stateful stuff like mad, it just takes a bit more work. You have to build a simple little state machine simulator, and randomly generate a list of actions to perform, and then verify the simulator and the real thing give the same results at every step. Possibly also checking invariants on the real thing at each step. It's pretty awesome actually.

I saw Hughes give a talk about quickchecking a database implementation and finding concurrency bugs. He did this cool live demo showing a quickcheck finding a concurrency bug that was open on some erlang db for months or years or something that nobody was able to reliably reproduce until he whipped his thing up. It was awesome.

DI stuff is slightly overused, imo. It's useful for unit testing business logic, and not much else. The special thing about business logic is that usually there's a crapton of state you have to set up like a rube goldberg machine to test the particular path you're interested in, and then it's better to just fake it than try to create that fragile mess. For the most part, I think actually just running the real thing is underrated, though I understand some databases (and other external services) can make it really difficult to do so.

qntm posted:

so what does a good oo tutorial look like, if not "car extends vehicle"

I have never seen a good OO tutorial. Inheritance is a really problematic feature, and every OO tutorial goes on about it from the start like it's important and what you should be doing all the time. Basically, the best OO code rarely uses inheritance and only uses interfaces, so they're instructing you on how to be a bad coder from the start.

Basically, fine read whatever, but there's a wikipedia article that describe I think the "circle ellipse problem" or something, which you should read and understand what's wrong. Though do not attempt to learn how to solve it from wikipedia, just understand what the problem is. The solution is to not loving use inheritance. Whatever commonality you actually need between a circle and an ellipse, just abstract out as an interface, and otherwise leave no relationship between them at all.

idk, I haven't read all the pages, has someone answered this before better than I have?

Careful Drums
Oct 30, 2007

by FactsAreUseless

crazypenguin posted:

quickcheck doesn't help with the DI part of it, but you can still quickcheck IO/stateful stuff like mad, it just takes a bit more work. You have to build a simple little state machine simulator, and randomly generate a list of actions to perform, and then verify the simulator and the real thing give the same results at every step. Possibly also checking invariants on the real thing at each step. It's pretty awesome actually.

I saw Hughes give a talk about quickchecking a database implementation and finding concurrency bugs. He did this cool live demo showing a quickcheck finding a concurrency bug that was open on some erlang db for months or years or something that nobody was able to reliably reproduce until he whipped his thing up. It was awesome.

DI stuff is slightly overused, imo. It's useful for unit testing business logic, and not much else. The special thing about business logic is that usually there's a crapton of state you have to set up like a rube goldberg machine to test the particular path you're interested in, and then it's better to just fake it than try to create that fragile mess. For the most part, I think actually just running the real thing is underrated, though I understand some databases (and other external services) can make it really difficult to do so.


I have never seen a good OO tutorial. Inheritance is a really problematic feature, and every OO tutorial goes on about it from the start like it's important and what you should be doing all the time. Basically, the best OO code rarely uses inheritance and only uses interfaces, so they're instructing you on how to be a bad coder from the start.

Basically, fine read whatever, but there's a wikipedia article that describe I think the "circle ellipse problem" or something, which you should read and understand what's wrong. Though do not attempt to learn how to solve it from wikipedia, just understand what the problem is. The solution is to not loving use inheritance. Whatever commonality you actually need between a circle and an ellipse, just abstract out as an interface, and otherwise leave no relationship between them at all.

idk, I haven't read all the pages, has someone answered this before better than I have?

unironically would like to subscribe to your possibly-existent newsletter for reason of this quality post

FamDav
Mar 29, 2008
it's a recurring post. inheritance is mixing up your utility code with your interface with your delegates and to boot it totally messed with your access hierarchy and it means you have to jump across multiple files to understand how anything works.

inheritance in most cases is the wrong thing to do, which is annoying because it's the first thing that's taught in most oop courses. if you discussed literally anything else it wouldn't be nearly as bad imo.

wolffenstein
Aug 2, 2002
 
Pork Pro

tef posted:

yeah that sounds similar. the trick is usually small victories: aim for small improvements that are easy to sell to the rest of the team. work on some of the more stubborn people or those most likely to help or hinder improvements. you might find that it is easier to sell them on docker or heroku or digitalocean or whatever to manage your release/deploys
i guess i'm stuck in the mentality of "here's examples of a through z dev shops doing exactly what i'm doing for reasons A through Z exactly why I'm doing it. ergo i must be more correct than you. please explain why you are wrong and continue to be so in spite of evidence to contrary." so whenever I try to explain why thing x is better than thing y, i get tripped up on the dumb assumptions made by colleagues and end up losing the argument.

also i feel like using a vagrant vm for dev is a very small improvement compared to the larger picture, so i don't know where else i can start. maybe creating a svn branch?

it also doesn't help that as a dev shop, we have multiple clients so it feels like any work i do can only apply to one and only one client's environment thanks to technical choices made at start of client's relationship. all production sites sit on the same server and use the same database instance, separated by hosts and logins stored in committed config files. I'm p sure web dev best practices say put production sites on individual servers which feels right to me, but to convince my team "hey great the production sites all work fine on the production server but this only multiplies how many sites are affected by a server issue or human error" seems like already a lost cause because we got enough poo poo to do already.

quote:

well you've got the history of mental health issues so you're on track
hopefully we can meet again and longer than five minutes at a conference where i didn't really learn much because none of it applied to my situation at the time.

Adbot
ADBOT LOVES YOU

leftist heap
Feb 28, 2013

Fun Shoe
inheritance is bad. just use mixins :downs:

  • Locked thread