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
MononcQc
May 29, 2007

As a toaster programmer who loves to deal with 16k of memory, I think that your script to read a weather database for a desktop widget is...

As a server programmer who has 64GB of memory and 18 cores for a single app, I don't see why you couldn't use these 7 frameworks for different layers when writing a phone app because...

and so on

Adbot
ADBOT LOVES YOU

MononcQc
May 29, 2007

Way to get the point.

MononcQc
May 29, 2007

A few years ago I've used php to write a minimalist website on the cheapest hosting possible for a friend's relative, then spent more time listening to people telling how bad of a decision it was to use PHP than it took me to write the website. Nobody has had to maintain it and it was in retrospect 100% the right decision.

v:shobon:v

MononcQc
May 29, 2007

I don't disagree with that. But it's a p-lang that did the job at what it was targeted for and likely came much cheaper for hosting than asp / jsp for a few hours' project for a friend. Aka using PHP was the right decision and context is king.

MononcQc
May 29, 2007

What's your general feeling about Forth? Most criticism I've heard of it for very small projects was that it loving owns, but it may be very close to write-only.

MononcQc
May 29, 2007

Forums Terrorist posted:

would it be a bad idea to learn erlang for fucks

:getin:

MononcQc
May 29, 2007

Welcome to the world of Rubber Ducking.

MononcQc
May 29, 2007

Talking things out loud (or writing them down) -- and generally thinking about them in a way that forces you to boil down abstract thought to something explicit and tangible -- is often a good way to figure out where your mental abstract model is disconnected from the real world expectations you have about it. Also see subvocalization as an interesting related topic.

MononcQc
May 29, 2007

The only DBA I remember dealing with shrugged it off when we found our DB password leaked on some Russian site and said "who cares it was a MySQL 4 password anyway, it is poo poo hashing" and then never changed the password.

He lost his job a few weeks later.

MononcQc
May 29, 2007

rsjr posted:

i got a job offer doing erlang backend for a telephone company

it pays ~20% more than what i currently make. what should i do.

"i don't know erlang at all"

"you're really smart it's cool, u'll learn"

"woah you guys are pretty cool i am smart"

Learn Erlang dude. Come 'round here, I've got good stuff. Erlang is weird looking, but fun.

MononcQc
May 29, 2007

gucci void main posted:

monocqc you should do one of those video series things that are popular these days, but for erlang

would subscribe

I wouldn't really know how to go about it, and hate my voice on recordings too much to edit it.

Even when I do a talk at a conference or something, I'll tend to transcribe it in text form and redirect people there instead.

MononcQc
May 29, 2007

Socracheese posted:

im setting up an amazon ec2 linux vm just for fuckin around on erlang, seems like u can put it on osx but its clearly for a linux

It works fine on OSX and you can grab pre-built packages at https://www.erlang-solutions.com/downloads or you can build it from source with Wx and use some graphical apps like observer or whatever (the packages should work with it too, and it works on all platforms in general).

MononcQc
May 29, 2007

Socracheese posted:

ok i have dived into this for a lil' bit and erlang is some voodoo poo poo. currently trying to get this thing listening on port 80 instead of 8080

e: aww yiss got hello world workin. trip report erlang is weird but p cool

If you get Recon you can start tracking your most active connections over time and see where all the precious bandwidth goes :toot: (use recon:port_info/1 to get details about each connection then)

MononcQc
May 29, 2007

Nomnom Cookie posted:

i ran erl today

code:
Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V5.10.3  (abort with ^G)
1> help
1> a
1> ;
1> ;
1> ;
1> ;
1> '
1>
1>
1>
1>
1> '
1>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution
^G
Eh?

you use '.' to end an expression and get it to run.

code:
Erlang R16B02 (erts-5.10.3) [source] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.3  (abort with ^G)
1> "read your tutorial carefully".
"read your tutorial carefully"

MononcQc
May 29, 2007

Also I gotta try this thing soon:

MononcQc
May 29, 2007

coffeetable posted:

thing is, i have no damned clue whether this is a good design, or if the specific way i've implemented the pipeline (with each generator accepting a generator of the previous type as a constructor argument, so a dependency injection framework can pull it all together) is a good implementation.

the received wisdom seems to be "you're just gonna have to gently caress up and learn from your mistakes", but anything that could accelerate that process would be welcome

In my (relatively short) experience, prototyping is where you test ideas real quick and see what kind of hurdles you're gonna hit with your design.

It's purposefully lovely code where you throw stuff at the wall to see what will stick and that will highlight flaws in how you thought things out. It's a rough draft you make to gently caress up and make your mistakes early.

Then the big risk is having that prototype making it to production.

MononcQc
May 29, 2007

I wanted to write a commit hook that would add in whitespace dicks at the end of files so that people who don't pay attention or diff without whitespace end up not seeing all the poo poo being added. Never found the time or motivation to actually do it though.

MononcQc
May 29, 2007

Elixir's spaces for function application, combined with its eager evaluation, and its use of different namespaces for closures and literal functions can be confusing. I wouldn't consider it to have a neat syntax, or at the very least, not the best semantics around so far.

So for example, the pipe operator (|>) allows to transform something like f(g(a,1),2,3) into a |> g(1) |> f(2,3), or with spaces: a |> g 1 |> f 2,3 . That's fine. Now if g is instead a closure, then it works a bit like lisps-2 and you need a different syntax: f(g.(a,1),2,3), and a |> g.(1) |> f 2,3 (closures do not allow the parens-less calling syntax).

Similarly to standard lisp-2 shenanigans, you can have both g() and g.() calls happening and referring to two different functions within the same scope. The former refers to the literal 'g' function, while the latter refers to the closure within the 'g' variable.

Here's where it gets fun with spaces for function application. Let's say I use this g combo and use it in an expression such as g |> something(x). It isn't clear whether I just called g() and passed its result to something(_, x), or if I passed in the variable itself.

Then the |> macro has problems of its own, namely that it's impossible to call a function and use its result in a pipe sequence: g |> (f()) isn't valid as far as I know.

Elixir has nice-looking syntax, but warts hiding around it, and you have to be careful about it. I remember finding a bug with its pattern matching assignment/reassignment where poo poo was left unspecified:


x = 3
{x, ^x} = {5,5}


It was undefined whether the pattern matching would take place left-to-right or not, and whether the re-assignment of 'x' would take place before its fixed matching on a previous value (^x). In one case the expression works, in the other, it fails and errors out. I think this has now been specified into the language, but you just know there's plenty of that stuff lurking in.

I know I would instantly remove the parens-free calls given how confusing it is in Elixir.


E: just asked José Valim. The variable is always prefered in g |> f, and nullary function calls will only happen if there is no scope ambiguity.

MononcQc fucked around with this message at 15:57 on Jan 9, 2014

MononcQc
May 29, 2007

I'm a terrible OO programmer, I end up using classes as modules/interfaces and end up writing in a nearly functional style :sigh:

MononcQc
May 29, 2007

Valeyard posted:

also said that "computer scientists are the gods of the future" and asked if anyone wanted to disagree with him, they did not

everyone learned their first lesson: ignore the sperg with a toxic attitude

MononcQc
May 29, 2007

Print statement debugging has been my bread and butter of debugging. Languages that allow tracing make that easier. When all else fails, I get a piece of paper and pencils and I think really hard.

MononcQc
May 29, 2007

Posting Principle posted:

is there a way to configure lager to email me on certain log levels, because that would be rad as hell and i would like it very much

Probably would have to make a custom error handler and using something like gen_smtp to make it work. I don't know of any known library to do it directly otherwise off the top of my head.

MononcQc
May 29, 2007

Awia posted:

does anyone know a good book on algorithms/algorithmics or whatever its called
im trying to become a less bad programmer

I liked The Algorithm Design Manual by Steven Skiena (PDF). It reads easily and will be a good intro to basic algorithms in many categories, and can be used as a stepping stone if you need to dig in deeper later on.

MononcQc
May 29, 2007

whenever it's big enough to need its own file

MononcQc
May 29, 2007

Dark on light is also the best for presentations and working outdoors.

Solarized light looks decent for this too.

MononcQc
May 29, 2007

Also modal editing is a good thing. And vim commands are multiple but are structured in a logical way to be composable together.

MononcQc
May 29, 2007

Shaggar posted:

another rule of thumb is to avoid anything popular amongst academics or idiot college kids because neither group understands anything.


http://redmonk.com/sogrady/2013/04/04/academia-and-programming-languages/

MononcQc
May 29, 2007

dang them professors always teaching in languages they hate

MononcQc
May 29, 2007

it's computer science vs. software engineering debate time!

MononcQc
May 29, 2007

MeruFM posted:

can't newer routers just slowly seed in alternative transport layers with fallback to tcp/udp

maybe once IPv6 is there

MononcQc
May 29, 2007

Valeyard posted:

Erlang

(sorry Mono)

eh?

MononcQc
May 29, 2007

Currying also reduces the need for parens.

In strict languages I tend to still prefer them to properly delimit everything, and argument-free parens-free calls are the worst thing.

MononcQc
May 29, 2007

MeramJert posted:

are those like properties in python?

They're like properties in python (given you can do the __get and __set dance) except imagine that all methods that take no argument (other than self) in python are now properties also. object.prop == object.prop() in terms of what it does or gives.

Also functions so that if you do 'x = f', it isn't obvious if 'f' represents the variable 'f' or the function call 'f' (equivalent to 'f()').

MononcQc
May 29, 2007

I don't think functional is intrinsically superior, but it's a model that meshes a bit better with how I think than OO does, which just never really meshed well with me.

MononcQc
May 29, 2007

raruler posted:

did they replace erlang with php for facebook chat or are people just lying to me?

They wrote the first version in Erlang then went "wait we got tons of C++ people and like 2-3 Erlang devs" so they rewrote it in C++. Then they bought Whatsapp and now they have 30something Erlang guys.

MononcQc
May 29, 2007

Bloody posted:

sounds bad

It's not necessarily that bad. I couldn't do it, but that thing's one way to do it directly in ASM, with lots of docs, and that's 2300 LOCs

MononcQc
May 29, 2007

object1 (ˈɒbdʒɪkt)

1. to express or feel disapproval, dislike, or distaste; be averse.
2. informal a ridiculous or pitiable person, spectacle, etc

MononcQc
May 29, 2007

suffix posted:

the right proportion of ingredients depends not just on serving size, but also on the composition of the flours, which can vary between countries

don't allow recipes with flour, problem solved

MononcQc
May 29, 2007

'(lisp is a lot simpler)

Adbot
ADBOT LOVES YOU

MononcQc
May 29, 2007

apt gangbang posted:

why isnt ocaml's map tail recursive

for most map operations on lists and whatever finite data structure, no matter the language (as long as it's immutable and strict), it may be faster to use a body-recursive version.

Basically, the cost on stack will likely be little more than the duplication of pointers for the function you're using to map, and the pointer to the data structure you're mapping over. The data structure you're passing in basically limits how deep the stack goes. So you get two lists: the original one, and the mapped one. You've had an overhead of a couple pointers per list element to go with it, along with wherever the function returns.

OTOH, a tail recursive map will need to generate a second list anyway, and do it in a reverse-manner by prepending to the head of the list if immutable, to avoid the cost of rewriting the list on every traversal.
The end-result of this is that you then need to reverse the list at the end, creating a total of 3 lists: the original one, the intermediary one, and the final one (reversed intermediary).

The tail-recursive map may overall have required more memory than the body-recursive one, potentially triggering GC and whatnot.

That's super dependent on the language and its implementation, of course, but there are definite cases where a tail-recursive map can be seen as worse than a body-recursive one. You can benchmark them under different circumstances and see.

  • Locked thread