Wikipedia:Reference desk/Archives/Computing/2013 June 25

= June 25 =

Is there a cable modem + wireless router that'll stay running in a power outage?
I appreciate that my laptop will still run, but in a power outage, I'm out an internet connection.

Is there any modem + wireless router that'll have some sort of battery backup? Any kind of mechanism that'll keep it running when the power's out? Hopefully. Thanks. --70.179.161.230 (talk) 02:46, 25 June 2013 (UTC)


 * Look at getting a UPS to keep your modem running. Of course, that only helps if the cable company's equipment also does not lose power.  RudolfRed (talk) 04:51, 25 June 2013 (UTC)


 * Here's an article outlining uninterruptible power supply use. --Yellow1996 (talk) 15:58, 25 June 2013 (UTC)


 * If all else fails, you can get cheap 12 volt to 110v inverters for in-car applications in most stores that sell car parts (WalMart has them here in the USA) - you can charge a car battery and use that to power your modem/router for a L-O-N-G time. This is a good general solution because you can also power things like desk lamps, peripherals like printers and so forth.  If you need more battery life - wire up multiple car batteries in parallel.  Don't forget to recharge them once in a while.
 * Of course it's possible that the cable will go out at the same time as your power.
 * SteveBaker (talk) 13:50, 27 June 2013 (UTC)

Converting Currency to Text in Excel without losing formatting
Hi there,

I've got a bit of a conundrum. I've got an enormous excel sheet with lots of columns, many of which are formatted as currency. So essentially, the actual data that's in the fields is "7", "8.5", etc. However, the way they display in Excel is "£7.00", "£8.50", etc.

The trouble is, when I try and merge them into Word (2010 - same version of Excel), it loses all the formatting - and so my figures will display as "7" or "8.5" (or indeed "5.125") rather than "£7.00", "£8.50" or "£5.13"). I've attempted to use the "Confirm file format conversion on open" options on Word but they're not working for me.

Is there a way I can convert the Currency columns to Text columns without losing the currency formatting, and then import them directly as text into Word?

thanks

Seal Boxer (talk) 12:25, 25 June 2013 (UTC)
 * This is discussed in a Microsoft knowledgebase article here, and also here, which explains how you can use formatting codes in the merge fields to control how the amounts appear. Alternatively you could use the formula =TEXT(amount,"£#,##0.00") (in the spreadsheet) to convert the values to text in the right format first. AndrewWTaylor (talk) 13:34, 25 June 2013 (UTC)

Calculating text length tin SVG
I'm writing a program that puts out an xml file containing SVG. It contains variable text and I have to check if the text fits in a certain space (think of a box) or not. Googeling, I can see many people asking questions about that but haven't seen an answer (just workarounds). 77.3.170.153 (talk) 15:03, 25 June 2013 (UTC)
 * I don't think it is possible to do that using the SVG file alone, if that's what you're asking for. You can't calculate the width without knowing the detailed structure of the font, and that information is not included within an SVG file, at least not by default.  What programming environment are you working in? Looie496 (talk) 15:12, 25 June 2013 (UTC)
 * Currently I'm using perl (module SVG), but I won't necessarily stick to that. And I need to calculate the text length when the SVG is still incomplete. With SVG there seems to be somthing like getComputedTextLength, but I need this beforehand, not in the final SVG file. 77.3.170.153 (talk) 15:59, 25 June 2013 (UTC)


 * As Looie496 says, text doesn't really have dimensions in abstract - those dimensions only exist in the context of a concrete font in a real render. To do this kind of thing you need an offscreen rendering context (whether that's a Cairo context, a browser widget, an invocation of imagemagick, or whatever) into which you do a temporary render of the text, and from which you can then extract the size of the resulting objects. Naturally if you're doing this a bunch, you want to try to keep that context around for a bit so you can reuse it, as much of the cost of this is generating the context in the first place. And I'm sure you're aware that the SVG you generate might not render with those dimensions on someone else's system (e.g. in someone else's browser), particularly if they don't have exactly that font. -- Finlay McWalterჷTalk 16:17, 25 June 2013 (UTC)


 * (ec) As I am the one generating the SVG I do have some control on which fonts should be used by a client rendering the picture. OK, I can have a half-baked file sent to another program to check the length, but this is not exactly what I have in mind. Ideally, the generating program (perl, or whatsoever) should have a function that returns the bonding-box for a given font and text. 77.3.170.153 (talk) 16:34, 25 June 2013 (UTC)


 * Of course one way around this is to use a fixed-width font, if that's possible. Or to use the maximum character width for the font. Looie496 (talk) 16:28, 25 June 2013 (UTC)


 * Unfortunately I need some astrological symbols and I'm pretty sure they are not part of any widespread fixed width font. 77.3.170.153 (talk) 16:34, 25 June 2013 (UTC)


 * Fixed width (monospace) only fixes the size of characters with respect to others in that same font (at that size). Rendering the same string on my machine with Cairo produces the following sizes for all the monospaced fonts:

Andale Mono (129.0, 15.0) Webdings (108.0, 13.0) DejaVu Sans Mono (130.0, 15.0) TlwgMono (131.0, 13.0) PixelCarnageMonoTT (118.0, 11.0) Liberation Mono (130.0, 15.0) Courier 10 Pitch (130.0, 12.000000000000002) Nimbus Mono L (131.0, 13.0) Consolas (119.0, 14.000000000000002) Inconsolata (108.0, 13.0) Tlwg Typo (131.0, 13.0) Courier New (131.0, 13.0) FreeMono (131.0, 13.0) Ubuntu Mono (109.0, 15.0) Monospace (130.0, 15.0)


 * ...which shows the folly of relying too closely on these kind of metrics when one wants to know how something will render on someone else's machine. For example, if the OP were to decide to use Consolas and lay things out accordingly, if someone viewed it on a machine without Consolas, which instead substituted Ubuntu Mono, the resulting text object would be 20% wider than they'd anticipated. -- Finlay McWalterჷTalk 17:45, 25 June 2013 (UTC)


 * For Cairo (which has a php binding), here's a simple program that does it (I wrote it in Python, but it's just a matter of syntax changes to make it php):


 * -- Finlay McWalterჷTalk 16:38, 25 June 2013 (UTC)


 * Thanks to you and curse on Murphy, I have seen and used many languages, but python and php are one of the few I haven't used before. I guess and hope cairo is available for perl and/or java, too. I'll have a google and a try. Thanks again. 77.3.170.153 (talk) 16:45, 25 June 2013 (UTC)
 * Ah, what a nice day today, there actualy is such a module for perl: http://search.cpan.org/~xaoc/Cairo-1.103/lib/Cairo.pm So I thanky you again and calll ths question resolved (don't know how to produce this nice button here). I'm happy. 77.3.170.153 (talk) 16:54, 25 June 2013 (UTC)


 * If you wanted to do it in Java, you can use Java2D instead of Cairo:


 * -- Finlay McWalterჷTalk 17:21, 25 June 2013 (UTC)


 * Regrettably, no. I need the SVG output. A rasterized image won't do. 77.3.170.153 (talk) 18:10, 25 June 2013 (UTC)


 * You can still do Java2D for the measurement (with all the caveats I've already harped-on about) and emit an SVG by another means. But the nice thing about Cairo is it can render  to an SVG context (see the 2nd example here). -- Finlay McWalterჷTalk 20:08, 25 June 2013 (UTC)