Hosting Grumpydev Imageflair locally ended with two issues left: an empty image and my wish to include more complete StackExchange bits like the current StackExchange flair does.
I thought fixing the empty image would take a rainy day. It actually took a few rainy hours.
The drawback of having fetchmsttfonts is that the original Microsoft versions of these fonts are downloaded from corefonts.sourceforge.net each time the fetchmsttfonts package is updated, potentially overwriting newer versions of the fonts in that directory. If you don’t want that, use the trick at (not yet archived at the WayBack machine) font handling – install fetchmsttfonts, copy fonts, rpm -e fethmsttfonts, copy fonts back.
Having the fonts installed, I thought the only thing I needed to fix were the multiple references in config.php from that pointed to Arial.TTF. I took the poor man’s approach and just did this being in the directory of config.php:
cp /usr/share/fonts/truetype/arial.ttf Arial.TTF
Filled Imageflair
That didn’t work either: still no text showed.
So I decided to run imageFlair.php from the command line after setting $imageflair_debug = true; in config.php which then resulted in all sorts of warnings like
PHP Warning: imagettftext(): Could not find/open font
After reading I decided to build a small php-gd.tester.php script containing phpinfo(); and gd_info showing these portions for PHP GD (non-relevant bits stripped):
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Well, I need to do that propertly another time as the first thing I bumped into was this:
PHP Fatal error: Call to undefined function imagecreatefrompng() in /srv/www/vhosts/pluimers.com-ssl/stackoverflow/imageFlair/imageFlair.php on line 42
For now I’ve fixed the first by installing php5-gd (although an SO answer suggests php-gd, openSuSE uses the php-version number for installing modules).
First of all, apparently I didn’t have all the required apache modules installed. The not-so-easy part is that apache uses two different aliases for modules: the ones listed by apache2ctl -M 2>&1 | sort are in a different format than the ones you mention in .htaccess and .conf files. Oh and of course the -M (nor the -t -D DUMP_MODULES) aren’t listed ore hinted in the apachectl documentation: that would be too easy. They are listed in the httpd2 documentation.
The .htaccess file needs mod_rewrite and mod_expires, but apache2ctl names them rewrite_module and expires_module.
Enabling these was easy, but you have to remember that a2enmod strips the prefix/suffix of the module name (I already had expires_module (shared) installed so this only shows how to enable mod_rewrite):
a2enmod rewrite
rcapache2 stop
rcapache2 start
rcapache2 status
NB: mod_rewrite wasn’t enable by default and before enabling it, read about the risks of mod_rewrite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
It also requires language-restructuredtext (which is convenient anyway as it adds reStructuredText syntax highlighting to Atom)
Pandoc is an almost universal converter between various file formats (input/output including reStructuredText, Markdown, LaTeX, docx, html, docbook, epub, etc. PDF output requires LaTeX)
Tables are always a hard thing in any markup. Luckily truben.no/table/ has a good table editor (it’s the same as table-editor.com) and can emit reStructuredText, Markdown, HTML and other formats.
More in the future
Give me some time, and I will post more about using the format and how it compares to my Markdown past.
Note that pandoc does not fully support reStructuredText (for instance not all table features are supported), but docutils rst2html.py does and also gives better warning/error information when parsing.
Here are some links about the reStructured syntax and how they can be rendered by rst2html.py:
The idea is that you solve a task and learn from that, or learn by seeing how others have solved tasks or draft tasks.
So in a sense it is similar to the Rosetta stone: it has different languages phrasing the same tasks.
There are already a whole bunch of languages on RosettaCode (of which a few are in the categories below), and you can even suggest or add your own languages.
When you want to solve tasks, be sure to look at the list unimplemented tasks by language that leads to automatic reports by language (for instance two of the languages I use most often: C# and Delphi).
Just discovered the online Cyber-Dojo by Jon Jagger. It is an online manifestation of a Coding Dojo. Both have been there for years, and I think both are brilliant.
They take the concept of a Dojo as being a place to practice sports like martial arts in a pair or group setting with a series of Katas or practices.
Katas in a Dojo are a means for performing deliberate practice in order to learn new things. For instance, acquire new movement techniques, learn about your balance, gain strength, all in both a physical and mental way.
The aim is to learn, and part of that is to first un-learn and open you to new thoughts. That’s why it is so cool that the Cyber-Dojo provides you with:
You’d think they speed you up, but that is not their aim. Like a regular Dojo it gives you an pre-set environment and gives you piece of mind to get started.
The Cyber Dojo does without a Sensei, whose purpose in a Coding Dojo is to ask questions in order to guide the participants.
That’s why it is good to use the Cyber Dojo as part of a Coding Dojo: basically the Cyber Dojo provides a standardizes set of tools to quickly setup a Coding Dojo.
Array initializers can be specified in field declarations (§17.4), local variable declarations (§15.5.1), and
array creation expressions (§14.5.10.2).
The array initializer can end in a comma, which makes some things way easier (boy, I wish I had this in other programming languages).
From Nick’s answer:
It has no special meaning, just the way the compiler works, it’s mainly for this reason:
[FlagsAttribute]
public enum DependencyPropertyOptions : byte
{
Default = 1,
ReadOnly = 2,
Optional = 4,
DelegateProperty = 32,
Metadata = 8,
NonSerialized = 16,
//EnumPropertyIWantToCommentOutEasily = 32
}
[/language]By comment request: This info comes straight out of the ECMA C# Specification (Page 363/Section 19.7)
“Like Standard C++, C# allows a trailing comma at the end of an array-initializer. This syntax provides flexibility in adding or deleting members from such a list, and simplifies machine generation of such lists.”
Bill Karwin (twitter, new blog, old blog, Amazon) is famous for much work in the SQL database community, including InterBase/Firebird, mySQL, Oracle and many more.