Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

The Too-wide Web

For some reason, computer monitors have been getting wider and wider for years. This puzzles me, since like most people, when I'm working, I tend to use tall narrow documents, both to read and to edit. Sometimes I can arrange things so that I have two panels on the screen, which restores them to a more sensible shape, but the Web is a problem. Web pages seem to have begun adapting to wide monitors by adding wider and wider margins, often filled with ads and/or navigation materials. For me, these margins are often too wide for me to use a two-panel setup (it's just a laptop) but often they leave so much width when used full-screen that the text is tiresomely long. Typesetters have a rule of thumb that you shouldn't put more than about twelve words on a line because it's hard to read. Fortunately, I found a Chrome hack that lets me solve the problem.
The RepRap wiki is too wide.



Full post

Breaking out of iTunes

Since I got my "new" hand-me-down smart phone, I've been listening to a lot of podcasts. The phone is smart enough to use only my home wifi to update and download episodes, and the player keeps track of which ones I've read. This is so useful, in contrast to the music player, that I found it works better to keep my audiobooks on my home server and write a quick hack to serve them up as podcast feeds. But mostly I use podcasts like radio programs. Unfortunately, some podcasts are available only through iTunes. This makes sense if they cost money, but, for example, the NASA Lunar Science Institute has a free podcast which is only available through iTunes.

Fortunately it seems that the way these places get the data to iTunes is by serving up a standard RSS feed, which iTunes then wraps up in its proprietary glop. But Michael Sitarzewski helpfully put together a script that can extract the location of the original RSS from iTunes. So, for instance, you can subscribe to the NLSI podcast here. Very nice.


Full post

ssh shenanigans

I use ssh all the time, from simple terminal connections to VNC sessions controlling telescopes to rsyncing terabytes of data to serving my music and video library. Most of the time, the machine I actually want to connect to is not visible from the open internet, and in some cases there are two layers of machines to go through to get to the one I want. I have used various ad-hoc combinations of ssh connections, but I just found a brilliant library that solves several of my problems: paramiko.

(Also, the name is from Esperanto, and the releases are named after gashlycrumb tinies. This is some serious nerdery, here.)


Full post

ipython notebooks: second impressions

I've kept working with ipython's notebook mode; it really is very well suited to my python-as-a-scratchpad style of figuring certain things out. So I've come up with a few more comments:
  • SVG plots work fine and look better, at least for modestly-sized output (thousands of points on a plot, megapixel images). They're also bigger on the screen, for some reason.
  • Be careful with commands that generate a lot of output; they can make your browser grind to a halt while it tries to render the output of that debugging print statement in that inner loop. During this time you also can't save your document. It might be nice if ipython noticed giant output and collapsed it.
  • It would sometimes be nice to be able to collapse blocks down to a little plus sign. For example, the first block normally needs to be the imports and maybe some ipython boilerplate (setting SVG mode, for example). It'd be nice to be able to hide it while working on the rest of the document.
  • It'd be nice to be able to break up class definitions into multiple blocks (for example to be able to have rendered math explanations for each method).
  • In PNG mode, the images are included using data URIs. This doesn't work on the very old web browser I have at work.
  • If you start pushing the memory limits of your machine it can be very hard to interact with the browser enough to kill the kernel.
For me, the most important of these is embedding the output in a blog post. It already sort of works: SVG is embedded in the output HTML, and PNG is encoded in a data: URI, so it's almost enough to strip out all the contents of the body tag and paste them into an HTML editor. Of course proper display depends on CSS, but I've added all the CSS that seemed relevant into the "custom CSS" field of my blog. The output still has some weird spacing issues; in particular, input blocks are all the same height for some reason.

Edited to add: notebooks have improved a lot since this review. I'm going to write another soon.

Full post

A captcha problem

Hmm. Think it would cope with \( M_2(\mathbb{Z})\tilde m \)? Or $M_2(\mathbb{Z})\tilde m$? Or just plain M_2(\mathbb{Z})\tilde m? In principle it might, since recaptcha is crowd-sourced; if I came up with the same LaTeX representation all previous recaptcha users had, all would be fine...

Full post

Mathjax

When looking at the ipython notebook interface, I came across a neat tool: mathjax. It's designed to allow embedding math in web documents. Now, MathML was supposed to do this, but support for MathML is still very spotty, and it's also really nasty trying to write MathML manually. So mathjax allows you to simply enter TeX format math and have it look okay in supposedly all browsers: both inline as \(e^{i\pi}=-1\) and displayed as $$\int_{-\infty}^{\infty}f(t)e^{2\pi i f t}dt. $$

The way that it does this is kind of amazing to me: it's essentially a TeX renderer written in javascript and running in your browser. I'm used to thinking of TeX as a batch-mode compiler that takes an appreciable time to run, but TeX has become the de facto standard way to write mathematics, and there are now several reimplementations of its renderer. Matplotlib has one, for example, though it can also call out to real TeX if you ask it to. But javascript!

Anyway, as you can see above, I've added it to the template for this blog, so I'll be a little freer with math from now on. Though I'm willing to bet it doesn't work in the RSS feed. Let me know if you have any problems with it.

Full post

Reporting FAIL

There's currently an item in the news about a British boy who managed to damage his eyesight with a "laser pointer". The news articles generally imply that any laser pointer is a lurking risk to your eyesight ready to blind you with a single incautious glance. But there are the ordinary 1-5 mW laser pointers you can buy in dollar stores, and then there are the pocket lasers you can buy online that have powers up to 500 mW and that can burn a hole in a credit card. If this kid managed to damage his eye with the former, well, that's surprising and alarming. But the articles don't describe the laser at all, beyond the fact that he ordered it on the internet. If you go to the original one in the British Medical Journal, though, you still don't get the power rating, but you find out that it was "high-powered", i.e. almost certainly one of the high-power ones you can get online. Of course you can damage your eyes with these; I strongly doubt it would be possible to get one without being made aware of the danger. What's more, the high-power ones are already arguably illegal in many places, not that that stops online companies from shipping them there.

The key point I'm getting at is that all the media coverage is missing the essential information that this is not a normal laser pointer, and that those are basically not dangerous.

[Edit: I emailed the corresponding author of the BMJ piece. Unfortunately the boy's guardian destroyed the laser before the doctor could see it, but the doctor is certain that it was one of the high-powered lasers I describe above. It's too bad none of the reporters bothered to check that detail, but I guess it doesn't make good copy.]

Full post

Home Made Energy: Renewable Energy For The Rest Of Us

Google Chrome's ad blocking is unfortunately not as good as Firefox's, so occasionally I see ads on the web. I generally ignore them, but I do click on the occasional one either because it's interesting or because I don't like it (since my clicks cost them money!). On The Straight Dope today I came across "Home Made Energy: Renewable Energy For The Rest Of Us". This company sells a guide which purports to tell you how to run your house purely off wind and solar power for less than $200. I'm skeptical.

First of all, electricity costs something like twenty cents a kilowatt-hour, and they're talking about saving some hundreds of dollars a month. So let's say $100 a month - that's 500 kWh a month, or about 700 W. More credible sources cite about $10/watt for solar power, or $7000 for such a system. So is this guide really nonsense? Not necessarily.

Solar cells are expensive to make - think of making microchips the size of a solar panel. Not quite fair - they don't need the density of components, but they do need the extremely pure silicon and the high-vacuum manufacturing - but a sign that there's a good reason they aren't cheap. A solar system also needs some electronics for converting electricity to a useful voltage, and some way to deal with the fact that the amount of solar power varies in a way that has little to do with the demand for solar power.

I think a reasonable guide of this sort might be able to point readers at where to scavenge used or discarded parts for all of the above. The power electronics are definitely something a clever amateur could build out of scavenged parts (at some risk to their life!), but I think it would take incredible luck to obtain solar cells that worked and were that cheap. It's also possible that a guidebook could explain how to take advantages of government programs to encourage renewable energy, perhaps obtaining discounts or tax credits on the hardware.

The biggest way governments or energy companies could encourage renewable energy of this sort is to eliminate the need for energy storage. Since most of the people who'd be considering this sort of project already have a connection to the electricity grid, if the utility company is willing, you could simply sell them electricity whenever you make more than you need, and buy electricity when you need more than you buy.

Ideally, as a homeowner, you'd get paid the same price for the electricity you sell as you pay for the electricity you buy. Unfortunately, this is often not the case. There are good reasons electric companies would pay less for electricity they get from homeowners than they charge homeowners; for one thing, all those wires to distribute the electricity aren't free. More subtly, it's really difficult to store electricity on the scale that utility companies deal with, so they have to work quite hard to make sure that the amount of electricity fed into the grid in any given second exactly matches the electricity drawn out of it in that second. Having countless small generators outside their control is going to make that job much more difficult.

That said, persuading companies to act in a way that costs them money but benefits all people is a natural role of government. Paper mills have waste treatment systems not out of the goodness of their nonexistent hearts but because the government charges them massive fines or shuts them down if their effluent is too toxic. So if the government were to force (or fund) companies to pay consumers the same price for electricity they generate as they charge for electricity they use, suddenly a lot more small-scale power generation projects would become cost-effective.

Incidentally, another approach for storing solar power for when you need it is to let it charge your solar car (or plug-in hybrid). This has even been proposed as a scheme to help load-levelling in the power grid.

Anyway, the upshot of all this is that I think that yes, it is occasionally possible to scrounge together a cheap renewable energy system. But I suspect that the claimed $200 is only possible with in the best possible case - scavenged parts, government subsidies, living in a sunny desert, having a cooperative utility company, and incredible luck.

Full post