Feed aggregator

Experimenting with Bower and Flask

Status-Q - 1 hour 19 min ago

This is another of those “just in case you’re Googling for it” posts…

Background:

  • Flask is a nice lightweight Python web framework – a handy way to create small web apps when you don’t need the power of something like Django.

  • Bower is a package manager for web components – a really easy way to get the latest versions of jQuery, bootstrap and anything else you might want.

Bower will put the packages into a folder called bower_components, with the idea that your deployment process will use something like Grunt to move the static bits from there into their final location. This is all well and good, but it seems like overkill if you’re just experimenting on your own machine.

Wouldn’t it be nice if Bower could just put the packages somewhere that they could be served directly as static files by Flask?

Well, it turns out that it can. If you create a file in the top level of your app called .bowerrc containing the following:

{ "directory" : "static/bower_components" }

then Bower will put its components in a subdirectory of the static folder and Flask then knows how to serve them up. You might do:

bower install jquery bower install bootstrap

and then in your HTML you could use something like the following:

<link rel="stylesheet" href="/static/bower_components/bootstrap/dist/css/bootstrap.min.css" />

and for the Javascript:

<script src="/static/bower_components/jquery/dist/jquery.min.js"></script> <script src="/static/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

You could leave out the bower_components bit at each stage and make your URLs even tidier, but I felt it was still useful to separate those bits that were being managed by Bower from those that weren’t.

Hope that helps someone!

The march of progress

Status-Q - Fri, 17/10/2014 - 12:18

One of the things that has always been a challenge for developers is the ‘progress bar’. It can be very difficult to predict in advance just how long something is going to take: you work it out for, say, a typical operating system update on the typical machine and then you find that some users have 100,000 things in their Trash, or are in the midst of a backup to a slow external drive, or whatever…

Installing Mac OS X Yosemite this morning, the progress bar sat at ‘About one minute remaining’ for well over half an hour, so I went and did some Googling and found that I was not alone – many people waited much longer than that, but it always completed in the end. Of course, like a watched pot, it will never get there if you’re sitting waiting for it, so you have to go and do something else. Usually, it is just a mild annoyance for impatient enthusiasts like me, but occasionally it can be a more serious problem if you’re told something will take 30 mins, for example, and you therefore assume you can do it before your appointment in an hour’s time.

Anyway, watching the slowly-progressing pixels gave me an idea…

There are tens of millions of people who will be going through this process over the next few months: surely you could improve the accuracy of their progress bars by uploading the timing information at the end of each installation, along with basic information about the system and then using that to give more accurate estimates to those with similar machines, similar disk usage, etc?

Why Privacy Matters

Status-Q - Sat, 11/10/2014 - 17:49

By nature, I’m somebody who probably errs on the side of openness rather than paranoia when it comes to privacy. I’m also very aware of how fortunate I am, though, to live in a country and under a government and legal system where I can afford to take this view.

Glenn Greenwald’s excellent TED talk gives some other reasons for caring about privacy.

Direct link

There is, though, I think, a balance to be struck here; it’s also worth mentioning that complete privacy and anonymity doesn’t always bring out the best in human nature. There’s a reason why people wear hoodies, and there’s a reason why newsgroups that allow anonymous posting are often filled with trolls (at best), and vicious bullies (at worst). It is important that many of our activities are subject to some peer review, at least, if not legal or governmental review. Also, investigative journalists, of course, tend to assume that they and their commercial backers are somehow entitled to monitor people’s private activities, where other commercial interests or democratically-elected governments are not. Overall, though, I think he’s on the right track.

He also hints at something I hadn’t previously considered: that my religious upbringing might make me more accepting of constant invisible surveillance than I might otherwise be! Now, getting some real statistics on that would be an interesting sociological study…

Social Commentary

Status-Q - Fri, 10/10/2014 - 13:37

I hadn’t come across Kate Reddy before, but they interviewed Allison Pearson, her creator, on Radio 4 this morning, about her return to the Telegraph. The piece is, I think, quite splendid.

Now I know what I’ve been missing by not being a parent.

Tilly! Tilly! Put that camera down! Drop it! DROP IT!

Crystal showers from Matki

Status-Q - Fri, 10/10/2014 - 10:06

Update: I’ve had a phone call from one of the directors of Matki – see the end of the post.

In the small hours of yesterday morning, one of the curved panels of our expensive and otherwise perfectly-adequate Matki shower enclosure exploded.

Most of the glass ended up on the floor; in fact, I first knew something was amiss when I couldn’t open the bathroom door because of the glass fragments jammed underneath it. My first thought was ‘Who broke a windscreen in my bathroom?’

But I use the word ‘exploded’ advisedly, because it clearly didn’t just collapse. Some of the glass was flung further afield.

There were even some pieces in the toilet pan, which has no direct line-of-sight from the original panel, so I guess they must have been thrown against the opposite wall with sufficient force to have bounced off and back across the (admittedly small) room into the loo.

All of which makes me wonder what this would have been like had anyone been in the room, or in the shower, at the time.

The shower was installed just under a year ago by a careful and seasoned professional, according to the included instructions, and has had nothing but normal use since then. So I called Matki, assuming that it would be replaced immediately under guarantee with profound apologies and that they’d send someone round to sort it out promptly. After all, they might have had a rather nasty law suit on their hands if someone had been blinded by flying glass.

However, I forgot two things – firstly that we’re in Britain, where such gestures are not common, but secondly, I suppose, that any such action might be taken as an admission of culpability. Is the law enough of an ass that a gesture to make an otherwise disappointed customer into a happy customer is likely to backfire? Anyway, this customer stayed disappointed, though they did give me a modest discount on the replacement panel.

I get to spend a couple of hours in my pyjamas clearing up glass. I get to pay my plumber to fit the new unit. I get to pay Matki 140 quid for the new panel. I get a shower I can’t use for two weeks. Ah, well. Matki, in exchange, get this blog post.

Update, Mon 13th Oct

I thought it only fair to inform Matki of this post, and give them the chance to respond. This morning I received a call from one of the directors, Des Rocks, who struck me as a very fine and very rational fellow. He was most apologetic, and we had a good discussion about both glass manufacture and social media!

I mentioned to him that the customer service person I had spoken to seemed polite, efficient and businesslike, but that his hands had clearly been tied by the company’s policy. I was informed that they were changing some of their policies now to allow a little more flexibility. They’re also sending someone to fit a replacement panel, and will not be charging me for it.

All of which means that I’m now once again a happy Matki customer, and remain impressed with the company and its products. It’s sad that I had to resort to a blog post to get to this point, but I’m willing to give them the benefit of the doubt and assume that these events are very rare, and that getting them fixed is less likely to be a problem for customers in the future. All’s well that ends well.

Over-quantified self?

Status-Q - Thu, 09/10/2014 - 23:42

According to the Tesco website, the Samsung Galaxy S4:

detects your face and motions

I think the latter may be taking personal computing a bit too far.

I told Rose, and she asked, "Can it detect them from the expression on your face?"

The Great Beyond

Status-Q - Thu, 09/10/2014 - 20:31

Tilly, captured on her afternoon walk by my iPhone 6. It’s a pretty good camera in the right conditions, given the size of the lens. Click to see more detail.

If this shot looks vaguely familiar, you might have seen this one a couple of years ago.

100% proof in the supermarket

Status-Q - Mon, 29/09/2014 - 10:06

I remember, a few years ago, seeing some Aberdeen Angus beefburgers in my local supermarket labelled as “Not less than 100% beef!”. I turned them over to look at the list of ingredients. Yes, there was a list. You’d think they might not need a list for something that was really 100% beef.

This week, I spotted a bottle of shampoo.

Just what do people think they mean by ‘up to 100%’? Are they trying to reassure us that it isn’t more than 100% effective?

Readers will know that posts on Status-Q are up to 100% accurate and insightful, and, my friends, I think we should be bothered by such things. At first I was concerned that advertising executives have so little grasp of numbers. But not all advertisers are stupid, which led me to the far more worrying conclusion that this kind of thing must work on the populace as a whole. Scary.

Now, the more observant of you will have spotted the little asterisk on the bottle, indicating a footnote. So I turned this item over, too, and found it.

* visible flakes from a distance of 2 feet, with regular use

I guess this is their abbreviated way of saying, “we consider an absence of visible flakes at a distance of 2 feet to be 100% effective treatment, and we offer something between this, and no effect at all”. Presumably, also, the treatment appears more effective the further away you get?

Ah well, at least I don’t generally suffer from dandruff, which is perhaps why I’ve been rated, by up to 100% of those asked, as ‘amongst the handsomest men in the world’*.

*when viewed in a crowd of handsome men, from distances greater than 2km.

Mysterious Trees III

Status-Q - Sun, 28/09/2014 - 12:30

Mysterious Trees II

Status-Q - Sun, 28/09/2014 - 08:30

Mysterious Trees I

Status-Q - Sat, 27/09/2014 - 19:22

On my last day in California, the fog rolled in, as it tends to around San Francisco. I was up in the Mt Tamalpais area fairly early in the morning, and got a few interesting photos. Here’s the first.

Syndicate content