Author Archives: mike

content management systems report

Again the question, which CMS should I learn or use for my pages? My colleague loves Joomla, and I prefer wordpress. He thought, that Joomla has a higher market share than wordpress … I haven’t agreed with him, so I searched for a trustful report. Here we are: w3techs has really good report!

Oh, surprise WordPress is currently on top 😀

problems with missing link to maxima files

hey folks,

if maxima is complaining about missing files e.g. for the draw package, check your homedirectory and delete those old compiled files …

rm -rf $HOME/.maxima/binary

and then load it again … maybe it is also useful to check the workdir 😉

load(draw);
maxima_userdir;

happy maths!

retrieve javadoc with wget

hey folks,

sometimes the API documentation is not provided in a downloadable format, so I was a little bit frustated … here is a easy wget command to download the API from a URL:

wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains DOMAIN --no-parent http://DOMAIN/javadocs/

I’ve found it here!

Resizing linux filesystem without lvm

Hey,

if you need to resize your virtual harddisk in your virtual guest system and you are not using LVM, then this tutorial may help you: Extending a root filesystem in Linux without LVM

Here are the important steps for fast forward how-to:

  1. expand harddisk in vmware
  2. reallocate partition table with fdisk and restart your guest
  3. resize it with resize2fs

Be aware that fdisk takes the same starting block, otherwise you will mess up your partition table!

Happy working 😉

stm32f3-discovery – unknown chip id

hey folks,

have you ever got this error message? relax, here [1] you will find further informations.
After looking up the pin information in the user manual of the discovery board I was searching for the R36 to shorten it to VDD … yeah, here it is:

r36_stm32f3so, take a screwdriver or something similiar, reset the board and start st-flash erase
et voila, it works again!

[1] https://github.com/texane/stlink/issues/107

PHP, where do you go?

Couple of days ago my colleagues and me were discussing the future of programming languages – PHP was also a topic and we were trying to find arguments for our decision should we stick to it or switch to Python. Therefore I am appriciating the hackernews link from today: Frank Karlitschek wrote a very good post on his side concerning the pros and cons of PHP, have a look at it. I like the listings for shortcomings and possible improvements:

A few of the obvious shortcomings are:

  • Security. PHP in itself is not insecure and it is obviously possible to write perfectly fine and secure applications with PHP. But PHP decided to implement an quite naive approach about security and doesn´t support the developer too much in writing secure code. To be fair everybody was naive about web security in the 90s. So there are a not a lot of features available in PHP that actively support you with writing secure code. The database situation is a mess so a lot of people still don´t use prepared statement which leads to possible SQL injection. And filtering incoming data for XSS and other problems has to be done relatively manually. There are extensions and libraries available to help with all this problems but they are not part of the language/runtime core or are incomplete.
  • compile time / runtime configuration. Just for fun call the ./configure script to compile php yourself and look at all the compile options. And now look at all the options that can be set in php.ini by the server admin. On one side this is cool because an admin can enable and disable a ton for core features in PHP in a very fine granular way. But as a developer of an PHP application that should run on all available PHP servers this is a nightmare. You never know which feature is enabled and available. In ownCloud we have a lot of code that checks the environment and the runtime to see if everything works as expected and adapts to it as needed. This is unfortunately not what you call a stable platform and a good OS abstraction.
  • There are some inconsistencies in the function and class namings. Sometimes unerscores are used and sometimes camel-case. Some features are available in a procedural style and some have an OO API and some even have both. There is a lot that should be cleaned up.
  • Static typing. This is totally a question of taste but sometimes I would really love to have a bit more static typing in PHP. Guess what this following code does if you have a file named “1” in your directory: while ( ($filename = readdir($dh)) == true) $files[] = $filename;

Here are a few ideas for improvements that I would love to see:

  • Security. Kill the _GET and _POST and _SERVER arrays and introduce a proper API that can be used to filter all incoming data.
  • Database. PHP support a ton of different database API. Some of them are very old but they are inconsistent to use. Everything should be standardized so that only one OO interface exists. I personally would use PDO as a starting-point here.
  • 32bit / 64bit. Anyone who ever tried to write a PHP application that runs on 32bit or 64bit operating-systems will recognize that variables especially integers behave differently. I understand that this is a reminiszense to C/C++ but this is seriously a bad idea. I don´t want to have different code paths which have to be tested independently.
  • kill save_mode, open_basedir and other acient concepts
  • Remove most of the compile and runtime config options. All PHPNEXT runtime environments should be as similar and stable as possible.
  • Typing. It would be cool if PHP would introduce optional static typing. So that a variable can be declared as, for example, bool or int. An exception should be thrown if used otherwise.
  • Always use unicode strings

 

mounting a software raid-1 member

if you want to mount a raid-1 member in a external system, you should install mdadm and checkout those commands:

# Connect harddisk to auto-plugable controller/system
# Check which device name was assigned to the pluged-in harddisk
tail /var/log/syslog
fdisk -l /dev/sdb
mkdir /mnt/data
mdadm --examine /dev/sdb3
mdadm -A -R /dev/md0 /dev/sdb3
mount -o ro /dev/md0 /mnt/data
# Read, what you want to read ;)
umount /mnt/data
mdadm -S /dev/md0
# Remove the harddisk

that is it. thnx Milosz for your help and saving my time 😉

Corrupted ODS-File

I have had the exact same problem as Azman did, and he found the solution and described it here [1]. After reading his post I’ve decided to take the shortcut and install the xmlindent package first. So here is my approach:

# cp FILE.ods BACKUP_FILE.ods
# unzip -p FILE.ods content.xml | xmlindent > content.xml
# vim content.xml
# zip FILE.ods content.xml

Thanks Azman, it helped me a lot!

[1] http://blog.my1matrix.org/2011/12/libreoffice-tragedy-corrupted-ods-file.html

SATA hotplug

Have you ever hotplugged a SATA Drive? With new mainboards udev will recognize the new harddisk with no effort, but if you use older hardware maybe you should check your BIOS (switch from IDE to AHCI mode) and type following command in your shell after replacing your SATA drives:

echo "- - -" >> /sys/class/scsi_host/host[2|3|4]/scan

For more information and a safe unmount script look here: http://www.makestuff.eu/wordpress/sata-hotplug-in-ubuntu/