The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for the ‘Pingback’ Category

Oops! Something Bad Happened – Stack Overflow

Posted by jpluimers on 2017/05/02

Each time you hit an error URL, you get a different picture.

They are cool!

Source: Oops! Something Bad Happened – Stack Overflow

Posted in Development, Pingback, Stackoverflow | Leave a Comment »

Hosting Grumpydev Imageflair locally – part 2 – trying to get the text and images to display

Posted by jpluimers on 2017/04/12

Blank imageFlair

Blank imageFlair

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.

No text

The culprit is that I didn’t have the Microsoft Core Fonts for the Web installed. Which was no coincidence as the free download of those from Microsoft terminated in 2002. The upside is that because of their licenses, they are available as open source and most linux distributions have a script package that will download these fonts. OpenSuSE has fetchmsttfonts for this.

Alternatively, you can use the web.archive.org to download manually, but that’s a tad tedious. But if you love tedious: Free downloads – TrueType core fonts for the Web.

zypper install fetchmsttfonts

That installs the fonts in:

/usr/share/fonts/truetype

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):

Additional .ini files parsed /etc/php5/conf.d/ctype.ini,
/etc/php5/conf.d/dom.ini,
/etc/php5/conf.d/gd.ini,
/etc/php5/conf.d/iconv.ini,
/etc/php5/conf.d/json.ini,
/etc/php5/conf.d/mysql.ini,
/etc/php5/conf.d/mysqli.ini,
/etc/php5/conf.d/pdo.ini,
/etc/php5/conf.d/pdo_mysql.ini,
/etc/php5/conf.d/pdo_sqlite.ini,
/etc/php5/conf.d/sqlite3.ini,
/etc/php5/conf.d/tokenizer.ini,
/etc/php5/conf.d/xmlreader.ini,
/etc/php5/conf.d/xmlwriter.ini

gd

GD Support enabled
GD headers Version 2.1.1
GD library Version 2.1.1
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.6.3
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 8
PNG Support enabled
libPNG Version 1.6.21
WBMP Support enabled
XPM Support enabled
libXpm Version 30411
XBM Support enabled
WebP Support enabled

And the gd_info dump:


<?php
echo "<h1>gd_info</h1>";
$gdInfo = gd_info();
echo "<table>";
foreach($gdInfo as $key=>$value) {
echo "<tbody>";
echo "<tr>";
echo "<td class='e'>" . $key . "</td>";
echo "<td class='v'>" . $value . "</td>";
echo "</tbody>";
}
echo "</table>";
?>

GD Version 2.1.1
FreeType Support 1
FreeType Linkage with freetype
T1Lib Support
GIF Read Support 1
GIF Create Support 1
JPEG Support 1
PNG Support 1
WBMP Support 1
XPM Support 1
XBM Support 1
WebP Support 1
JIS-mapped Japanese Font Support

Too bad though: no information on where it sources the fonts from.

No image

Having no solution for the font rendering yet, I focussed at the lack of profile picture.

In the past, the images were generated with gravatar information in the JSON, but now that is empty. See for instance the output of http://superuser.com/users/flair/1.json versus his image http://superuser.com/users/flair/1.png


{
"id": 1,
"gravatarHtml": {
},
"profileUrl": "http:\/\/superuser.com\/users\/1\/jeff-atwood",
"displayName": "Jeff Atwood",
"reputation": "14,561",
"badgeHtml": "<span title=\"24 gold badges\"><span class=\"badge1\">&#9679;<\/span><span class=\"badgecount\">24<\/span><\/span><span title=\"79 silver badges\"><span class=\"badge2\">&#9679;<\/span><span class=\"badgecount\">79<\/span><\/span><span title=\"109 bronze badges\"><span class=\"badge3\">&#9679;<\/span><span class=\"badgecount\">109<\/span><\/span>"
}

view raw

1.json

hosted with ❤ by GitHub

That reveals quite a change in the JSON that imageFlair expects. Actually there is a lot of HTML in there.

So decided to try http://superuser.com/users/flair/1 in addition to http://superuser.com/users/flair/1.json with this result:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
.valuable-flair .userInfo .username a, .valuable-flair .mod-flair
{
color: #1086A4;
}
</style>
<link rel="stylesheet" href="//sstatic.net/flair-Default.css" />
</head>
<body>
<div class="valuable-flair">
<div class="gravatar">
<a title="See my profile on Super User" target="_blank" href="http://superuser.com/users/1/jeff-atwood"><div class="gravatar-wrapper-50"><img src="https://www.gravatar.com/avatar/51d623f33f8b83095db84ff35e15dbe8?s=50&amp;d=identicon&amp;r=PG&quot; alt="" width="50" height="50"></div></a>
</div>
<div class="userInfo">
<span class="username"><img src="http://superuser.com/favicon.ico&quot; width="16" /><a href="http://superuser.com/users/1/jeff-atwood&quot; target="_blank">Jeff Atwood</a><span class="mod-flair" title="moderator">&#9830;</span></span>
<br />
<span class="reputation-score" title="reputation score">14,561</span>
<br />
<span title="24 gold badges"><span class="badge1">&#9679;</span><span class="badgecount">24</span></span><span title="79 silver badges"><span class="badge2">&#9679;</span><span class="badgecount">79</span></span><span title="109 bronze badges"><span class="badge3">&#9679;</span><span class="badgecount">109</span></span>
</div>
</div>
</body>
</html>

view raw

1.html

hosted with ❤ by GitHub

Two downsides here:

  1. This doesn’t work for the combined stackexchange flair: http://stackexchange.com/users/flair/1.png works, but http://stackexchange.com/users/flair/1 gives a 404.
  2. Rendering HTML servers side to PNG requires a lot of work.

Time for another rainy day (:

–jeroen

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, Development, Linux, openSuSE, PHP, Pingback, Power User, Scripting, Software Development, Stackoverflow, SuSE Linux | Leave a Comment »

Windows batch file – setting space as delimiter when parsing files

Posted by jpluimers on 2017/01/04

for /f "tokens=* delims= " %%f in (myfile) do

If you put delims as the last parameter, then an ending space will be included as delimiter (at the start or in the middle it won’t).

A great tip by jeb and Joey in an answer for windows – Batch file FOR /f tokens – Stack Overflow

–jeroen

Posted in Batch-Files, Pingback, Scripting, Software Development, Stackoverflow | Leave a Comment »

Stack Exchange – Android Apps on Google Play

Posted by jpluimers on 2015/11/18

I missed when the StackExchange App for Android was finally launched, but I totally agree with Paul Lammertsma:

Exceeds expectations This was a long time coming, but it didn’t disappoint. It’s a great aid for a regular on Stack Overflow like me!

–jeroen

via Stack Exchange – Android Apps on Google Play.

Posted in .NET, Delphi, Development, Pingback, Power User, Software Development, Stackoverflow | Leave a Comment »

StackPrinter: StackOverflow in printable way

Posted by jpluimers on 2014/12/05

Will one day come in handy: About – StackPrinter.

Especially their deleted questions section (if you have 10k + rep that is).

–jeroen

Posted in Pingback, Power User, Stackoverflow, Web Browsers | Leave a Comment »

Instantly save a web-page to the Wayback Machine (Internet Archive: www.archive.org)

Posted by jpluimers on 2014/11/24

Saving a web page for posterity is really easy: just prepend http://liveweb.archive.org/ in front of the URL in your browser, then open the page.

The Wayback Machine (Internet Aarchive) wil instantly archive it.

See this great answer by Jeff Atwood quite a while ago:

One thing that the ineffable Jason Scott just pointed out to me on Twitter:

if you give the url of the page to http://liveweb.archive.org and wait five minutes, it will archive that page. How about that?

Also you can enter http://liveweb.archive.org/http://www.website.com/page to have it happen without visiting the page.

So if you want to ensure that a popular soon-to-be or may-possibly-be deleted question gets archived by the Internet Archive, manually feed them to the URL above.

I suppose for already deleted questions, we could also undelete, wait 5 minutes, let it archive, then re-delete.

–jeroen

via: Building an archive of deleted questions – Meta Stack Overflow.

Posted in Chrome, Firefox, Internet Explorer, Opera, Opera Mobile, Pingback, Power User, Stackoverflow, Web Browsers | 1 Comment »

StackOverflow/StackExchange: two queries to help me improve my questions and answers

Posted by jpluimers on 2014/09/05

On the StackExchange network, I try to keep track of the questions I asked, and answers I gave in order to see if they need follow up.

For instance, questions with answers that have no accepted answer usually indicate there is room for improvement.

On my own questions, it means I could accept an answer, or give out more information on how to better answer that question.

On mu answers to questions from others, it might mean I need to improve my answer, or comment on his question to explain it better.

The first category can be queried easily by the built in search capabilities:
http://stackoverflow.com/search?q=user%3ame%20is%3aanswer%20hasaccepted%3ano

The second category requires the Stack Exchange Data Explorer (SEDE) to execute some SQL:
My answers to questions that have no accepted answer – Stack Exchange Data Explorer.

  • Replace the ‘me’ with your StackOverwlow user ID
    (for StackOverflow.com, you can get that from http://stackoverflow.com/search?q=user%3ame as it will be listed in the search box there)
  • replace stackoverflow with a mnemonic obtained from the main SEDE page (click on the icon you are interested in, then copy that part into the query)

Note some questions (like Wiki: Current state of the art of Delphi 3rd party TCP/IP components libraries – Stack Overflow) are not suited to have one ‘best’ answer.

Note the SEDE can be addictive. If it is starting to become that way, perform a Jon Skeet comparison.

Note the SEDE data is usually at least a few days older than the live data.

--jeroen

Posted in Development, Jon Skeet, Pingback, Power User, SocialMedia, Software Development, Stackoverflow | Leave a Comment »

Where to watch for StackOverflow / StackExchange downtime status: @StackStatus, @TechCrunch, @HNTweets

Posted by jpluimers on 2014/02/17

Basically, stackstatus.net is not actively updated when severe things like DDoS happen. So the best way to be kept up to date is watch these links:

–jeroen

Posted in Pingback, SocialMedia, Stackoverflow | Tagged: , | Leave a Comment »

Windows Timer Resolution: Megawatts Wasted (via: Random ASCII)

Posted by jpluimers on 2013/07/11

Don’t increase your Windows Timer Resolution. And keep an eye on programs that do:

Raising the Windows timer frequency is bad. It wastes power and makes your computer slower. Routinely doing this in all sorts of programs that end up sitting idle for hours really needs to stop.

You can use ClockRes to monitor the time resolution and what programs changed it.

–jeroen

via: Windows Timer Resolution: Megawatts Wasted | Random ASCII.

Posted in .NET, Development, Opinions, Pingback, Power User, Software Development, WPF | Tagged: , , , | Leave a Comment »

c# – What’s the hardest or most misunderstood aspect of LINQ? – Stack Overflow

Posted by jpluimers on 2013/05/07

It is such a pity that StackOverflow is not the place any more for questions like these:

c# – What’s the hardest or most misunderstood aspect of LINQ? – Stack Overflow.

These questions and answers historically got me most of the insight from SO.

Alas, no more.

–jeroen

Posted in .NET, Development, LINQ, Opinions, Pingback, Software Development, Stackoverflow | Leave a Comment »