DeutschEnglish

Submenu

 - - - By CrazyStat - - -

7. November 2014

Amazon Instant Video and Error 1002

Filed under: Uncategorized,Windows — Tags: , , , , , — Christopher Kramer @ 20:40

Recently, when trying to watch a video in Amazon Instant Video, I only got Error 1002. I tried Firefox, Chrome, Opera and Internet Explorer and none of them worked. I reinstalled Silverlight and this also did not help.

Then finally I found the reason: Amazon still seems to use SSL 3 for Instant Video streams! Because Google recently reported security problems with SSL 3.0 (known as the POODLE security vulnerability), I disabled SSL 3.0 in all browsers including Internet Explorer. No matter what browser you use, Silverlight will use Internet Explorer’s settings and will not use SSL 3.0 any more. Re-enabling SSL 3.0 again in the Internet Explorer settings fixed the problem with Amazon Instant Video. As I am not really using Internet Explorer anyway, I don’t care much about this, but Amazon should really work on this to make Instant Video available without the need to enable SSL 3.0.

Happy streaming!

Recommendation

Try my Open Source PHP visitor analytics script CrazyStat.

29. October 2014

RabbitVCS on Ubuntu GNOME 14.04 Trusty Tahr

Filed under: Linux — Tags: , , , , , , , , , — Christopher Kramer @ 11:38

I installed RabbtVCS on Ubuntu GNOME 14.04 Trusty Tahr from the Ubuntu repositories (rabbitvcs-nautilus) and it did not integrate into Nautilus. It also seemed to cause other strange effects (mouse wheel not working any more, …?).

Installing the latest version from the RabbitVCS PPA fixed all this:

sudo add-apt-repository ppa:rabbitvcs/ppa
sudo apt-get update
sudo apt-get install rabbitvcs-nautilus3

Hope this saves somebody half an hour figuring out how to solve this 😉

13. August 2014

Icinga: Monitor refused mails in postfix mailqueue

Filed under: Linux,Server Administration — Tags: , , , , , , , , , , — Christopher Kramer @ 12:09

In case your server gets listed on blacklists, mails will get refused by destination servers and stick in the deferred mail queue for some time until the sender finally gets a mailer daemon.

As it takes some time until the sender gets the mailer daemon and informs the server admin, it would be better if you could directly get notified by Icinga/Nagios when a mail is in the deferred queue because the destination server refused it.

Therefore I wrote a small shell script which I want to share with you here. I am assuming Debian Wheezy with Icinga and a postfix mailserver.

Create the shell script with the actual plugin in

/usr/lib/nagios/plugins/check_mailq_blacklist :
#!/bin/sh
# detects if mails in mail queue were refused by destination server (because of blacklist?)
# From https://blog.christosoft.de/2014/08/icinga-monitor-refused-mails-postfix-mailqueue/
# Version: 2017-03-07

if mailq | grep -qP "(refused to talk to me(?!(.*out of connection slots)))|(unsolicited mail originating from your IP)|(temporarily deferred due to user complaints)"
then
  mails=`mailq | grep -oP "(refused to talk to me(?!(.*out of connection slots)))|(unsolicited mail originating from your IP)|(temporarily deferred due to user complai$
  echo "$mails mail(s) were refused, check mailq!"
  if [ "$mails" -le 10 ] && [ "$mails" -gt 1 ]; then
    # 2-10 mails -> warning
    echo "\nWarning. | refused=$mails;2;11;0"
    return 1;
  fi
  if [ "$mails" -gt 10 ]; then
    # more than 10 mails -> critical
    echo "\nCriticial! | refused=$mails;2;11;0"
    return 2;
  fi
  return 1;
else
  echo "Ok, there seems to be no refused mail in the mailq | refused=0;2;11;0"
  exit 0;
fi

This will check for the texts “refused to talk to me” (not followed by “out of connection slots”) and “unsolicited mail originating from your IP” in the mailq output. These are the most common errors you get when the destination server has your server’s IP blacklisted.  In case at least one mail was refused, this causes a warning state in icinga. If more than 10 mails were refused, it causes a critical state.

Now you need to make this script executable:

chmod +x /usr/lib/nagios/plugins/check_mailq_blacklist

Now create the config file for the plugin in

/etc/nagios-plugins/config/mailq_blacklist.cfg :
# 'check_mailq_blacklist' command definition
define command{
        command_name    check_mailq_blacklist
        command_line    /usr/lib/nagios/plugins/check_mailq_blacklist
}

So now we have the command and need to define a service that uses it. Let’s say we use this locally for localhost. In

/etc/icinga/objects/localhost_icinga.cfg

add:

define service{
        use                             generic-service
        host_name                       localhost
        service_description             Mail Queue Refused Mail
        check_command                   check_mailq_blacklist
        }

This is it, just restart icinga and you are done:

service icinga restart

I hope this is of use to somebody.

Of course it is also useful to monitor in Icinga, if you are on some of the most used blacklists. A script to do this can be found here.

24. June 2014

Inkscape: Problem importing PDF

Filed under: Windows — Tags: , , , , , , , , — Christopher Kramer @ 18:39

I just had problems importing a PDF into Inkscape. The PDF was an image of a graph generated by igraph for R. When importing, the circles of the vertices got replaced by the letter “q”.

I found the following workaround: I printed the PDF into a new PDF using FreePDF. The resulting PDF could then be imported into Inkscape without problems.

My original problem was that I wanted to include the graphs from igraph for R in Powerpoint as a vector graphic. As Powerpoint cannot include PDFs as graphics, I wanted to save the graphs as emf-Files. But the emf-Files exported by igraph for R look completely messed up when imported in Powerpoint. The PDFs exported by igraph for R are fine, so I wanted to import them into Inkscape and save them as emf. A bit of a long way, but it works and it does not result in an ugly pixel graphic.

Maybe somebody has similar problems and finds this useful.

9. June 2014

Windows 7: On a multi-screen setup, place windows at one half of a screen

Filed under: Windows — Tags: , , , , , , , — Christopher Kramer @ 11:08

With Windows 7, you can easily move windows on one half of the screen by dragging them to the left or right edge of the screen. This is called “Snap” and is very handy. Watch Microsoft’s video on Snap if you don’t know it yet.

But on a multi-screen setup with two screens side-by-side, you can only place a window at the right half of the right screen or the left half of the left screen with Snap. You cannot place a window at the left half of the left screen because there is no “magic edge” there. Of course you can move and resize it manually. But there is a faster way:

[Windows-Key] + [Left arrow]

This places the window at these positions:

  1. Left half of left screen
  2. Right half of left screen
  3. Left Screen
  4. Left half of left screen
  5. Right half of right screen
  6. Right screen

Just press [Windows]+[Left] again to move it to the next position listed above. You can press [Windows] + [Right arrow] to move it the other way round (starting to the right half of right screen).

I don’t know if any other Windows version supports this as well, I guess at least Windows 8 supports it as well (in desktop mode).

Happy window-moving! 🙂

27. May 2014

Debian Linux: Update packages automatically

Filed under: Linux,Server Administration — Tags: , , , , , — Christopher Kramer @ 20:50

Here is how you configure automatic (security) updates on Debian:

aptitude install unattended-upgrades

Here you can configure it:

nano /etc/apt/apt.conf.d/50unattended-upgrades

This could look like this:

Unattended-Upgrade::Origins-Pattern {
        "origin=Debian,archive=stable,label=Debian-Security";
};
Unattended-Upgrade::Package-Blacklist {
// add packages here that need manual steps like this:
//        "vim";
}
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
Unattended-Upgrade::MinimalSteps "true";
Unattended-Upgrade::InstallOnShutdown "false";
Unattended-Upgrade::Mail "root";
Unattended-Upgrade::MailOnlyOnError "true";
Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::Automatic-Reboot "false";
Acquire::http::Dl-Limit "200";

Now create the following file:

nano /etc/apt/apt.conf.d/02periodic

With this content:

// Enable the update/upgrade script (0=disable)
APT::Periodic::Enable "1";

// Do "apt-get update" automatically every n-days (0=disable)
APT::Periodic::Update-Package-Lists "1";

// Do "apt-get upgrade --download-only" every n-days (0=disable)
APT::Periodic::Download-Upgradeable-Packages "1";

// Run the "unattended-upgrade" security upgrade script
// every n-days (0=disabled)
// Requires the package "unattended-upgrades" and will write
// a log in /var/log/unattended-upgrades
APT::Periodic::Unattended-Upgrade "1";

// Do "apt-get autoclean" every n-days (0=disable)
APT::Periodic::AutocleanInterval "7";

Of course the server needs to be able to send mails so it can send mails in case of problems.

You can test it like this:

# mail -s test mail@example.com
My testmail
.
EOT

Hope this helps somebody.

Update: Some updates caused dpkg questions about changed config files and therefore failed.

For example php5-fpm did ask this:

Setting up php5-fpm (5.4.4-14+deb7u10) ...

Configuration file `/etc/php5/fpm/pool.d/www.conf'
 ==> Deleted (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** www.conf (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing php5-fpm (--configure):
 EOF on stdin at conffile prompt

This caused PHP5-FPM to stop and all PHP sites to show an Internal Server Errror…

So you don’t run into this problem, create /etc/apt/apt.conf.d/local with this content:

Dpkg::Options {
   "--force-confdef";
   "--force-confold";
}

This tells DPKG to keep the old config file. It will create .dpkg-dist files with the package distributer’s version. More information on this can be found here.

16. May 2014

Inkscape: Dialog windows do not open on multi-screen setups

Filed under: Windows — Tags: , , , , , , — Christopher Kramer @ 17:06

I am using a multiscreen setup with one small landscape screen and one big portrait screen.

When I try to open a dialog like the Inkscape settings or the document settings in Inkscape, it does not open. Or more precisely, I cannot see it because it is positioned outside the visible area. I have this problem with current Inkscape 0.48.4 on Windows 7 Professional 64bit.

The bug is known for some time but unfortunately not fixed.

But I found a great and easy workaround which I want to share with you here: Whenever you cannot see a window because it is offscreen, press [Windows-Key] [arrow-up-key]. This shortcut maximizes the current window and you can use it normally. This probably only works on Windows 7 and newer.

You can also use the left or right arrow-key to position the window on the left or right half of the screen.

Happy drawing! 🙂

9. May 2014

Updating to PHP 5.4 causes missing Text

Filed under: PHP,Server Administration — Tags: , , , , , , — Christopher Kramer @ 14:29

After updating from PHP5.3 to PHP 5.4, on some sites text was missing. No error could be found in the error log so I had to dig into the code to find out what was going on.

The root cause is that with PHP5.4, the default character set expected by htmlentites(), htmlspecialcharacters() and html_entity_decode() changed from ISO-8859-1 to UTF-8. So if a script passes ISO-8859-1 characters like German “Umlaute” (öäüÖÄÜß) to one of these functions without specifying the charset with the corresponding parameter, these functions will return an empty string. And unfortunately, with PHP 5.4, they also removed the error message that PHP 5.3 recorded in the logfile in this case. This makes finding the problem a lot more difficult.

So what can you do about it? You could

  1. Use PHP 5.3 😉
    Here is a blog post on downgrading to PHP 5.3. on Debian Wheezy
  2. change the used charset to UTF-8
    This might require changing the character set in files, databases or config files, depending on what is used on the site.
    I explained in a blog post how to change the charset in Typo3 to UTF-8 back in 2012.
  3. Provide ISO-8859-1 as a parameter to all calls of htmlspecialcharacters() etc.

So for the third option, what you have to do is find places like this:

htmlspecialchars($string);

And replace them with something like:

htmlspecialchars($string, ENT_COMPAT | ENT_XHML, 'ISO-8859-1');

The problem is that it’s hard to do this automatically. What is easy to do, is replace all htmlspecialchars()-calls with calls to htmlspecialchars_PHP5-3() etc. and place these functions there:

function htmlspecialchars_PHP5-3($string, $ent=ENT_COMPAT, $charset='ISO-8859-1') {
    return htmlspecialchars($string, $ent, $charset);
}

function htmlentities_PHP-5-3($string, $ent=ENT_COMPAT, $charset='ISO-8859-1') {
    return htmlentities($string, $ent, $charset);
}

function html_entity_decode_PHP-5-3($string, $ent=ENT_COMPAT, $charset='ISO-8859-1') {
    return html_entity_decode($string, $ent, $charset);
}

So just do a search & replace over all files and make sure that all scripts have a file included that contains these functions.

10. April 2014

Inkscape: Change Arrowhead color

Filed under: Linux,Uncategorized,Windows — Tags: , , , , , — Christopher Kramer @ 18:55

In Inkscape, a great open source vector graphics program, when you change the stroke color of a path, the arrow heads still remain black. But there is a way to change their color, although quite unintuitive.

This is how it looks like:

Inkscape: arrows with same arrowhead color as the path

Inkscape: arrows can have the same arrowhead color as the path

And this is how its done:

  1. Mark the Path you want to change the color of the arrowhead
  2. “Extensions”
  3. “Modify Path”
  4. “Color Markers to Match Stroke”

That’s it!

inkscape_arrows_color

Update: Inkscape 0.91

In Inkscape 0.91, this problem is “fixed”: The arrowhead automatically gets the Stroke-color assigned and the extension mentioned above is gone. But:

Sometimes when I change the stroke color, the arrowhead does not get updated. In this case, you can adjust the arrowhead color like this:

Select the arrow, double click the color next to “Stroke:” on the lower left of the screen, it opens the window to adjust the stroke color and without doing anything in this window, it magically adjusts the color of the arrowhead.

Update: Inkscape 0.92

Unfortunately, I still have issues with the arrowhead color in Inkscape 0.92 and the workarounds above do not seem to work anymore. However, these problems only occur in old documents that I try to edit. In new documents, the arrowhead color works as expected. My current workaround is to create a new document, create the arrow I want there and then copy it into the old document. This way, I get arrows where I can edit the arrowhead color by editing the stroke color as expected.

1. April 2014

Outlook 2010/2016: Nachrichtenkopfzeilen (Header) anzeigen

Filed under: Uncategorized,Windows — Tags: , , — Christopher Kramer @ 18:15

So kann man sich in Outlook 2010/2016 die Header anzeigen:

  • Nachricht öffnen (doppelt anklicken).
  • Bei “Kategorien” (Office 2010) bzw. “Markierungen” (Office 2016) auf den kleinen Pfeil unten rechts klicken
    outlook_header
  • Unter “Internetkopfzeilen” finden sich die Header:
    outlook_header2

“Kategorien” / “Markierungen” wäre das letzte, wo ich danach gesucht hätte (bzw. habe). Ich finde das extrem unintuitiv platziert, wahrscheinlich ist aber vor allem die deutsche Ãœbersetzung hier besonders schlecht.

Vielleicht verkürzt dieser Beitrag ja jemandem die verzweifelte Suche.

« Newer PostsOlder Posts »