Here are some notes and resources related to both web development and website development.
HTML Entities
This section discusses HTML entities, which are special codes that tell browsers how to display characters that you can't ordinarily type; for example, '¢'.
The cent sign, ¢, is just one example of a plethora of special characters that are not on the average computer keyboard, but which you might well want to put on your web page. For each entity, there are two representations, whose syntax is either &entity_name;
or &#entity_number;
, respectively.
There are some symbols for which no entity name pattern exists—they have only an entity number pattern. I should also note that, supposedly, there is better support in various browsers for the entity number patterns than for the entity name patterns. However, for the special characters that I use on my own web pages: (1) I have never wanted to use a symbol which doesn't have an entity name pattern; and (2) I have never found an entity name pattern not to display properly in the most popular browsers.
The lists below are meant to serve as a one-stop place where I can find the HTML entities for the special characters that I use the most. Hopefully other people will find these lists equally useful.
For Common French Diacritics
Character | Description | Entity Name |
---|---|---|
ç | lowercase c-cedilla | ç |
à | lowercase a-grave | à |
â | lowercase a-circumflex | â |
è | lowercase e-grave | è |
é | lowercase e-acute | é |
ê | lowercase e-circumflex | ê |
ù | lowercase u-grave | ù |
For Other Diacritics
Character | Description | Entity Name |
---|---|---|
Ç | uppercase c-cedilla | Ç |
À | uppercase a-grave | À |
 | uppercase a-circumflex |  |
ë | lowercase e-umlaut | ë |
È | uppercase e-grave | È |
É | uppercase e-acute | É |
Ê | uppercase e-circumflex | Ê |
ö | lowercase o-umlaut | ö |
Ö | uppercase o-umlaut | Ö |
ñ | n tilde | ñ |
For Miscellaneous Characters
Character | Description | Entity Name |
---|---|---|
< | less than; left angle bracket | < |
> | greater than; right angle bracket | > |
½ | one-half symbol | ½ |
⅓ | one-third symbol | ⅓ |
¼ | one-fourth symbol | ¼ |
& | ampersand | & |
£ | British pound | £ |
€ | Euro | € |
¢ | cent sign | ¢ |
÷ | division sign | ÷ |
× | multiplication sign | × |
∪ | union symbol for sets | ∪ |
∩ | intersection symbol for sets | ∩ |
✔ | heavy check mark | ✔ |
¹ | superscript 1 | ¹ (or use <sup></sup> tags) |
₁ | subscript 1 | ₁ (or use <sub></sub> tags) |
• | bullet | • |
→ | right arrow | → |
— | em dash | — |
© | copyright | © |
non-breaking space1 | |
¹ Non-breaking spaces are useful when you DON'T want the browser to collapse multiple spaces. By "collapsing multiple spaces," I'm referring to the fact that, normally, browsers will turn five spaces into a single space. Use a non-breaking space character instead of the ordinary space character when you want five space to be rendered as, literally, five spaces.
errno on Linux vs. Windows
We ran into an issue at work the other day which brought us head-long into the dark and dangerous world of programming in different operating systems.
After considerable grief we noticed that this snippet of Python code was behaving differently, depending on the OS.
except socket_error as serr: if serr.errno != errno.ECONNREFUSED: # Not the error we are looking for, re-raise raise serr
The exception was being thrown during a unit test which used a mock HTTP connection.
class MockHttpConnectionThrow111(MockHttpConnection): """ Throws connection refused exception. """ def request(self, method, url, body=None, headers=None): raise socket_error(111, 'Connection refused')
Thanks to the debuger, we learned that on Windows, the errno for "Connection refused" is 10061, whereas in Linux it's 111. Since the mock object was creating a socket error of type 111 in both Windows in Linux, the catch worked fine in Linux but failed in Windows.
The fix was clear enough—figure out how to raise a ECONNREFUSED exception in both Linux and Windows.
class MockHttpConnectionThrowConnectionRefused(MockHttpConnection): """ Throws connection refused exception. """ def request(self, method, url, body=None, headers=None): raise socket_error(errno.ECONNREFUSED, 'Connection refused')
Curious, I spent some time looking for anyone else who had run into this issue. But there wasn't a lot of discussion of it on the Internet—probably, as one of my colleagues noted, because it's not all that common to mix Windows and Linux in the same development shop. Eventually I found a post in Christopher Samiullah's blog. His problem was slightly different from mine. Still, it was good to see that someone, somewhere, was talking about the source of the issue: socket error numbers can vary according to your operating system. The constant is the "name" of the error, such as ECONNREFUSED.
Resources
Some of the most useful resources for building your own website.
CSS
An interesting discussion—with code!—of the H1, H2, H3, etc. scale in the modern world.
http://typecast.com/blog/a-more-modern-scale-for-web-typography
Selectors guide:
http://www.w3schools.com/cssref/css_selectors.asp
Bootstrap
As I write this, it looks as though a new version of Bootstrap has recently been released, with the result that there's been some shuffling of pages on their website. So some of these links may be bad or out of date. I provide links to both v. 3.3 and v. 4 documentation when useful.
The Basics
https://getbootstrap.com/docs/3.3/css/
https://v4-alpha.getbootstrap.com/getting-started/introduction/
Responsive Utilities/Test Cases
Click on the link below and resize your browser to see which Bootstrap elements are visible at which size.
https://v4-alpha.getbootstrap.com/layout/responsive-utilities/#test-cases
Jinja2
http://jinja.pocoo.org/docs/templates/#builtin-filters
http://jinja.pocoo.org/docs/dev/templates/
https://www.webforefront.com/django/usebuiltinjinjastatements.html
Markdown
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet