Wikipedia:Reference desk/Archives/Computing/2014 September 6

From Wikipedia, the free encyclopedia
Computing desk
< September 5 << Aug | Sep | Oct >> September 7 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.



September 6[edit]

Need a lightweight serial I/O library with good flow control.[edit]

I'm trying to fix flow control problems in a system with a BeagleBone connected to an Arduino computer via a serial port connection. The Arduino can be very slow (like it might be busy for minutes at a time) - and it has very little RAM memory available for serial buffers (at most 128 bytes). The BeagleBone is running Linux and at times is much faster than the Arduino and at other times, much slower.

So I need a robust flow-control scheme. Sadly, I can't use any out-of-band signalling via control wires or whatever because the Arduino's pins are all in use for other things.

What I need is a lightweight (implementable on Arduino!) serial port protocol with really robust flow control...preferably as an OpenSource library.

Any ideas?

TIA SteveBaker (talk) 04:43, 6 September 2014 (UTC)[reply]

By "serial" I'm assuming you mean RS-232. Even if you did have the wires for it, it seems the Arduino UART is set to never support hardware flow control, so you're stuck with XON/XOFF software flow control. From the Linux end, this is already supported in the serial port driver (this code has someone disabling it - you can do the opposite); it seems the rudimentary serial driver examples for the Arduino don't, so you may have to roll your own. One caveat, as it's in-band, is that if you're intending to send binary data, you'll have to byte-stuff your data to remove any XON (0x11) and XOFF (0x13) bytes with as scheme like:
 XON - > ESC 0x00
 XOFF -> ESC 0x01
 ESC  -> ESC ESC
I'm not sure, but I don't think, that the Linux serial driver will do that itself. -- Finlay McWalterTalk 10:24, 6 September 2014 (UTC)[reply]
Note that this is only as "robust" if one assumes the serial channel is perfect. In practice, if an XON is missed then the system deadlocks forever, and if an XOFF is missed then you get an overflow. But if reliability is necessary, then you end up having to implement framing, checksums, retransmission, and sequence numbers, and you've gone some way to implementing a rather half-baked TCP on SLIP. -- Finlay McWalterTalk 12:55, 6 September 2014 (UTC)[reply]
Yeah something as simple as XON/XOFF won't work - but I am sending ASCII data, so in-band signalling is OK. I was hoping to find something along the lines of a very lightweight TCP. (Although the tiny buffer size on the Arduino puts rather serious limits on how many messages it can hold for retransmission!) SteveBaker (talk) 18:38, 6 September 2014 (UTC)[reply]

Type of the S combinator[edit]

At Curry–Howard correspondence, the type of the S combinator is listed as "(α → (β → γ)) → ((α → β) → (α → γ))". I'm not seeing how this works. If interpreted as a function type, it describes a function from "(α → (β → γ))" to "((α → β) → (α → γ))", meaning it takes two arguments (a value and a function) and returns a function. But the S combinator takes three arguments. Can someone explain how this works? --Doradus (talk) 12:31, 6 September 2014 (UTC)[reply]

I think I may have just read a description that makes sense to me. Let me put it here so the experts can confirm I'm right, or point out errors. From this page I found a type signature for S of "(t3 → t4 → t5) → (t3 → t4) → t3 → t5". This one makes sense to me. From there, I only need to know that "→" associates right-to-left, so I can parenthesize this as "(t3 → (t4 → t5)) → ((t3 → t4) → (t3 → t5))" which is the same as "(α → (β → γ)) → ((α → β) → (α → γ))". --Doradus (talk) 13:29, 6 September 2014 (UTC)[reply]
That's correct. T → (U → V) is a function that takes an T and returns a function that takes a U and returns a V, which is the same as a function that takes an T and a U and returns a V. Applying it to its two arguments would look like (fx)y. For this reason → is normally taken to be right-associative and function application left-associative, so you can write T → U → V and fxy. -- BenRG (talk) 18:04, 6 September 2014 (UTC)[reply]

CSS Font Restrictions[edit]

Hi,
I have a font.
I would like to know how to add or remove CSS restrictions to a font?
Thank you. — Preceding unsigned comment added by 84.228.145.152 (talk) 19:56, 6 September 2014 (UTC)[reply]

The only restriction I'm aware of is that the font should be stored in the same 'domain' as the CSS that references it. So the simplest way to remove restrictions is to copy the font into the same web site directory as the files that are referring to it. Alternatively, you can use Cross-origin resource sharing (https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) to safely bypass that restriction.
SteveBaker (talk) 18:38, 7 September 2014 (UTC)[reply]
None of the current web typography standards has a digital rights management component (Microsoft's Embedded OpenType does, but isnt' widely supported). Some font foundries use Adobe's Typekit (or their own work-alike solution) which provides some rather rudimentary limits to trivial or accidental infringement of a font's licence. -- Finlay McWalterTalk 12:27, 8 September 2014 (UTC)[reply]

Time Machine greedy for space[edit]

This backup is too large for the backup disk. The backup requires 286.00 GB but only 194.04 GB are available.
Time Machine needs work space on the backup disk, in addition to the space required to store backups. Open Time Machine preferences to select a larger backup disk or make the backup smaller by excluding files.

(I'm still using Snow Leopard.) I never got such an error message before yesterday! Why doesn't TM simply delete old backups to make enough space, like usual? Is this because I recently started using the same disk to back up two computers? —Tamfang (talk) 23:19, 6 September 2014 (UTC)[reply]

Time Machine can only delete old backups if there are old backups remaining that are eligible for removal. Time Machine cleverly plays with UNIX hardlinks and copies to maintain different versions of the same hard disk quite efficiently (it only stores new copies of a file if it has been changed). But if you backup multiple disks or computers, then you need at least enough space to copy both disks once (for the initial backup), and some extra space for the incremental backups, and some working space. Above, you write that Time Machine wants 286 GB - that is an unusually large amount of space for an incremental backup, unless you work with and backup large video files. Is this the first time you try to backup the second machine? --Stephan Schulz (talk) 21:32, 7 September 2014 (UTC)[reply]
No, I had done it 15 times, before the error happened on the first machine. (The second one has less stuff.) Another oddity: backups before the error are in folder Baby (the first machine's name), and those after the error (after I cleared out a bunch of old stuff "by hand") are in another folder, Baby 895. —Tamfang (talk) 07:52, 8 September 2014 (UTC)[reply]
The 'Baby 895' sounds suspicious, unless that is the name of the other computer... I'm not sure that TM intends for you to go into the hard drive and delete stuff 'by hand', that may have caused it to start a whole new backup system for Baby, rather than writing to the previous system (because it could tell it might have been compromised). If 'Baby 895' appears complete, I'd recommend just scrapping the old Baby directory to free up space, unless you have a specific need for a backup from last year, as opposed to last week. If you don't get enough help here, you could try asking this question here [1]. SemanticMantis (talk) 18:07, 8 September 2014 (UTC)[reply]
I may just wipe the disk; I have two others. —Tamfang (talk) 23:00, 9 September 2014 (UTC)[reply]
Probably a good idea if you have backups elsewhere. It's not healthy to mess around inside the Time Machine folders. --Stephan Schulz (talk) 16:25, 10 September 2014 (UTC)[reply]