code logs -> 2018 -> Mon, 21 May 2018< code.20180520.log - code.20180522.log >
--- Log opened Mon May 21 00:00:17 2018
--- Day changed Mon May 21 2018
00:00
< RchrdB>
mac, aka 'sum type', might also get called 'tagged union' in some places?
00:01
<&McMartin>
"Tagged Union" is the name I see for when you do it by hand in C.
00:02
< RchrdB>
'sum type' is usually the best name for it IMO, but you can have the same concept in dynamically typed languages - e.g. Prolog does!
00:04
<@mac>
celticminstrel: Perils of having this username.
00:05
<@celticminstrel>
I mean, you could go back to the longer one.
00:05
<@mac>
RchrdB: I'm familiar with unions in C - one bit of memory that can contain any of a variety of different datatypes.
00:05
<@mac>
celticminstrel: No, 'mac' is on my ping list no matter what my current nick, since it's the obvious and common short form of 'macdjord'.
00:06
<@celticminstrel>
Oh.
00:12
< RchrdB>
mac, okay say I've got `enum thingType {intThing, floatThing, stringThing}; typedef struct { enum thingType myType; union { int i; float f; char *str; } payload; } thing;`
00:13
< RchrdB>
mac, and I intend that, if (someThing.myType == intThing) then I should use someThing.payload.i, but if (someThing.myType == floatThing) then I should use someThing.payload.f
00:13
< RchrdB>
this is a tagged union - the field at the front of the struct which tells me which member of the union is safe to use is the tag.
00:13
<@mac>
Alright, got it.
00:14
< RchrdB>
now, the thing that sucks about this is that I can make a mistake, such as testing that (someThing.myType == intThing) but then falling through into the stringThing case because I missed a `break` in a switch
00:15
< RchrdB>
and now I'm reading and writing to `payload` with different types and... I'm probably going to get undefined behaviour if any of those types is some kind of pointer.
00:15
<@mac>
And a discriminated union is a language sgtructure that does that automatically and enforces type safety.
00:15
< RchrdB>
yeah
00:15
<@mac>
I can see the utility of that, yes~
00:16
< RchrdB>
on reading, the act of checking the tag and retrieving the payload are atomic
00:16
< RchrdB>
er "atomic" is the wrong word, I only mean the language presents these two things as a single step, nothing to do with concurrency
00:16
< RchrdB>
on writing, the acts of setting the tag and writing the payload are a single step
00:19
< RchrdB>
another way of looking at it is that enum values can have fields attached
00:22
<@celticminstrel>
I think "atomic" is still a good word there though.
00:23
<@mac>
'Integral'
00:23
<&McMartin>
That sounds like "made of integers"
00:24
< RchrdB>
Yeah. Just need to be clear that it's atomic as in "the language presents these two things as one concept" rather than atomic as in "the implementation promises it makes sense to do this in 2 threads"
00:34
<@celticminstrel>
Yeah
00:36 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds]
00:49
<@mac>
'Integrated', then.
00:53 mac is now known as macdjord
01:13
<&[R]>
WTF
01:13
<&[R]>
Looking at a 64GB SD card on Amazon. 30$
01:13
<&[R]>
Or, I could get a 2 pack of the exact same brand for 130$.
01:14
<&McMartin>
That's an inventory management AI subtley attempting to influence your purchase.
01:14
<&McMartin>
*subtly
01:15
<&[R]>
Maybe
01:15
<&McMartin>
Also hrm
01:15
<&McMartin>
I seem to have completely fallen off the Exercism treadmill.
01:16
<&McMartin>
Also, going back a bit, the other fun thing about sum types is that they are just about exactly as powerful as single-inheritance, and can (with a few caveats in terms of where the performance costs lie) be mechanically transformed from code-using-the-one to code-using-the-other.
01:33 RchrdB [RchrdB@Nightstar-qe9.aug.187.81.IP] has quit [Connection closed]
02:36
<&ToxicFrog>
aaaaaare you shitting me
02:37
<&ToxicFrog>
fprintf(3p): p -- The argument shall be a pointer to void. The value of the pointer is converted to a sequence of printable characters, in an implementation-defined manner.
02:37
<&ToxicFrog>
printf(3): p -- The void * pointer argument is printed in hexadecimal (as if by %#x or %#lx).
02:38
<&ToxicFrog>
printf("%p\n", (void*)0);
02:38
<&ToxicFrog>
(nil)
02:48
<&[R]>
Wow
04:09 Degi [Degi@Nightstar-46dag6.dyn.telefonica.de] has quit [Connection closed]
04:48 Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has joined #code
04:48 mode/#code [+qo Vornicus Vornicus] by ChanServ
04:49 Derakon is now known as Derakon[AFK]
05:03 celticminstrel [celticminst@Nightstar-9pn3il.dsl.bell.ca] has quit [Connection closed]
05:04 macdjord is now known as macdjord|slep
05:38 Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has joined #code
05:38 Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has quit [Ping timeout: 121 seconds]
07:20 Kindamoody[zZz] is now known as Kindamoody
07:48 McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has quit [Ping timeout: 121 seconds]
07:50 McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has joined #code
07:50 mode/#code [+ao McMartin McMartin] by ChanServ
08:03 Kindamoody is now known as Kindamoody|afk
08:52 Jessikat` [Jessikat@Nightstar-bt5k4h.81.in-addr.arpa] has joined #code
08:52 Jessikat [Jessikat@Nightstar-bt5k4h.81.in-addr.arpa] has quit [Connection closed]
09:07 Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
09:31 Jessikat` [Jessikat@Nightstar-bt5k4h.81.in-addr.arpa] has quit [[NS] Quit: Leaving]
09:47 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code
09:56 Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has joined #code
12:46 macdjord|slep is now known as macdjord
13:04
<&ToxicFrog>
Ok, I have a notforth program running on the board that lights up different LEDs depending on whether the button is pressed
13:05
<@TheWatcher>
\o/
13:05
<@TheWatcher>
Progress!
13:07
<&ToxicFrog>
(the program in question: https://github.com/ToxicFrog/notforth/blob/master/builtins/demo.nf )
13:23 Degi [Degi@Nightstar-46dag6.dyn.telefonica.de] has joined #code
14:59 Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has joined #code
14:59 mode/#code [+qo Vornicus Vornicus] by ChanServ
15:14 celticminstrel [celticminst@Nightstar-jocbi5.dsl.bell.ca] has joined #code
15:14 mode/#code [+o celticminstrel] by ChanServ
15:27 Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
15:32 mac [macdjord@Nightstar-grpbnp.mc.videotron.ca] has joined #code
15:32 mode/#code [+o mac] by ChanServ
15:34 macdjord [macdjord@Nightstar-grpbnp.mc.videotron.ca] has quit [Ping timeout: 121 seconds]
16:20 mac is now known as macdjord
17:20 Degi_ [Degi@Nightstar-46dag6.dyn.telefonica.de] has joined #code
17:23 Degi [Degi@Nightstar-46dag6.dyn.telefonica.de] has quit [Ping timeout: 121 seconds]
18:03 * abudhabi_ glares at this custom cloud solution.
18:04
<@abudhabi_>
There appears to be nothing installed. Like, zilch.
18:07 * abudhabi_ hikes up his sleeves and gets to installing apache.
18:11
<@abudhabi_>
Looks like I'll have to set up users, too, because I don't think I want to run the website from root. :V
18:12
<@abudhabi_>
May as well ask.
18:13
<@abudhabi_>
If you were handed root access to a shell server, and told to put up Wordpress on it, what would be the boxes you need to tick there?
18:14
<@abudhabi_>
I mean, I need to install some kind of HTTP server, PHP and MySQL.
18:15
<@TheWatcher>
You'll probably also want to put on imagemagick and the imagemagick engine if the site'll be getting image uploads
18:16
<@abudhabi_>
I probably want to make some sort of user besides root.
18:16
<@TheWatcher>
DEFINITELY
18:16
<@TheWatcher>
And you'll also want to get acme and certbot on there, unless you have https certs already provided
18:17
<@abudhabi_>
I think I'm going to bill many, many hours for this.
18:21
<@abudhabi_>
And the most horrible thing is that I'll probably have to install and configure some sort of mail server.
18:23
<@TheWatcher>
You aren't kidding about empty... does this actually have any kind of linux install /at all/ there? O.o
18:23
<@abudhabi_>
I'm verifying with tech support that they don't have any manual or FAQ.
18:24
<@abudhabi_>
There is a user already besides root, but I don't know what it's actually for. I don't have login credentials for that user, only for root.
18:25
<&[R]>
What distro?
18:25
<@abudhabi_>
Ubuntu.
18:25
<@abudhabi_>
Let's see.
18:25
<&[R]>
Is this a VPS or an internal server
18:26
<@abudhabi_>
I *think* it's a physical server.
18:27
<@abudhabi_>
But the quote doc doesn't outright say.
18:27
<@TheWatcher>
Also, the fact that said server lets you log in as root over a network is rather terrifying~
18:27
<@abudhabi_>
No kidding.
18:27
<@abudhabi_>
I should fix that! :V
18:28
<&ToxicFrog>
abudhabi_: if you're root, you can become that user with `su username` or `sudo su username`
18:31
<@TheWatcher>
abudhabi_: another thing that might be handy - if you go with apache, and have mod_rewrite enabled (as you should), I'd recommend this in the vhost or .htaccess: https://pastebin.starforge.co.uk/14 - helps to keep knobheads from trying to bruteforce your login/xmlrpc/admin pages.
18:31 * abudhabi_ checks aptitude. Yup. This is a ghost town package-wise.
18:32
<@abudhabi_>
Thanks.
18:33
<@TheWatcher>
And now, I must away to make waffles...
18:41 Derakon[AFK] is now known as Derakon
18:44
<@macdjord>
abudhabi_: Well, i suppose that's better than having it be full of pre-installed crud you don't need or want?
18:45
<@abudhabi_>
I think I'd take the crud, actually. ;)
18:45
<@abudhabi_>
But oh, well. The boss wanted a new server, the boss gets a new server, and gets to pay me to fix it up.
18:51
<&[R]>
<ToxicFrog> abudhabi_: if you're root, you can become that user with `su username` or `sudo su username` <-- `su - username` to mimic a login shell
19:05
<@abudhabi_>
Welp, that account is also empty.
19:13
<&[R]>
ls -a `getent passwd USERNAME | cut -d : -f 7` /etc/skel
19:13
<&[R]>
No major changes from skel?
19:14
<@abudhabi_>
What's that supposed to do?
19:15
<&[R]>
It'll list all (including hidden stuff) for that user's directory and the skel directory which is used to make a blank profile
19:16
<@abudhabi_>
. .. .bash_logout .bashrc .profile
19:18
<&[R]>
Yeah... so you may as well take over that or just delete it
19:19
<&[R]>
Check the crontabs though
19:19
<@abudhabi_>
Nothing in either root or that account.
19:57 Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has quit [Ping timeout: 121 seconds]
20:04
<&McMartin>
re: ghost town: How bare is Ubuntu Server Edition by default?
20:04
<&McMartin>
Maybe they just installed that off an ISO, and it made root and generic user account like disc setups do, and then that was what they had?
20:08 Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has joined #code
20:28
<&[R]>
My experience is it came with a full GNOME desktop
20:28
<&[R]>
However, I was never the one who installed it
20:29
<&[R]>
And the person who did the install was an idiot
21:14
<@abudhabi_>
No gnome desktop here, nor any other desktop.
21:34
<&[R]>
Are you at least free from NetworkManager?
21:54 Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has joined #code
21:54 mode/#code [+qo Vornicus Vornicus] by ChanServ
22:04
<@abudhabi_>
I'll check later. Sleep now.
22:07 Alek [Alek@Nightstar-o723m2.cicril.sbcglobal.net] has quit [Connection closed]
23:13 himi [sjjf@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds]
23:22 Alek [Alek@Nightstar-o723m2.cicril.sbcglobal.net] has joined #code
23:22 mode/#code [+o Alek] by ChanServ
23:36 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds]
23:48 Degi_ is now known as Degi
23:54 Kindamoody|afk is now known as Kindamoody
--- Log closed Tue May 22 00:00:28 2018
code logs -> 2018 -> Mon, 21 May 2018< code.20180520.log - code.20180522.log >

[ Latest log file ]