DeutschEnglish

Submenu

 - - - By CrazyStat - - -

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.

Recommendation

Try my Open Source PHP visitor analytics script CrazyStat.

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: Uncategorized — 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 reamain 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

 

1. April 2014

Outlook 2010: Nachrichtenkopfzeilen (Header) anzeigen

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

So kann man sich in Outlook 2010 die Header anzeigen:

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

“Kategorien” 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 (“Kategorien”) hier besonders schlecht.

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

27. March 2014

TeXworks: Compiling your main.tex from an included part

Filed under: Uncategorized — Tags: , — Christopher Kramer @ 18:31

In case you have split your LaTeX document (let’s say main.tex) into multiple parts (let’s say part01.tex, …) and use include or input to stick it back together, you cannot compile part01.tex because it misses all the header stuff. So you need to compile main.tex. But is there a way in TeXworks to compile it using the Play-Button or CTRL+T?

Yes, there is. Add this line at the top of part01.tex etc:

% !TEX root = main.tex

Then just compile your files normally. It will compile main.tex, show the main.pdf in the preview and you can even navigate nicely using the context menu from pdf to tex and back.

18. January 2014

Linux: get members of a group / get groups of a user

Filed under: Linux — Christopher Kramer @ 00:23

This might sound easy with /etc/group and /etc/passwd, but what if you use libnss-mysql for example and need to try if it works?

So just forget grepping config files. Here are the real commands:

Members of a group:

getent group GROUPNAME

Replace GROUPNAME with the group you want to check.

Groups of a user:

groups USERNAME

Replace USERNAME with the name of the user to check.

 

Checked on Debian, not sure if it works on any Linux/Unix.

23. December 2013

phpLiteAdmin: French localization available for download

Filed under: phpLiteAdmin — Christopher Kramer @ 23:05

I just received a French translation for phpLiteAdmin, the open source web gui for SQLite databases written in PHP.

Thanks a lot to Olivier Briat for his work translating phpLiteAdmin!

As always you find the localization file in the downloads section on google code.

After Arabic, Chinese, English, German, Italian and Russian, French is the seventh language that phpLiteAdmin is localized into. Thanks a lot to all translators. We would be very pleased to see more translations! Doing your own translation is very easy – just have a look at the wiki on how to translate.

Older Posts »