Change the user agent string in PHP

Most of PHP’s file functions can be used to open local files as well as remote files via HTTP etc. By default the user agent string passed when making an HTTP requestis an empty string but it is possible in PHP to change the user agent string to something else. This post looks at how to do this.

Categories PHP

Return information from PHP print_r instead of displaying it

print_r is a useful PHP function for displaying the values of an array or object when debugging etc. Having been a PHP programmer since the days of PHP 3.x I didn’t realise this function had added the capability to return the information as well as print it from PHP 4.3.0 and only discovered this in the last few days. This post gives a brief overview of PHP’s print_r function.

Categories PHP

Kyum graphical frontend for Yum on KDE with screenshots

While installing Yum on openSUSE I discovered there was graphical frontend to Yum for KDE called KYum, so I installed that as well. This post has some screenshots of KYum to show it working in action. After starting up, KYum looks like in the screenshot below. In this example I have clicked the “List Updates” …

Read more

C++ compiler cannot create executables on Ubuntu

If you get the following error message when trying to compile some software application on Ubuntu (or Kubuntu or Xubuntu or similar) then you need to install the “build-essential” packages.

C++ compiler cannot create executables

This is simply a matter of opening up a command line prompt (but then you were already there if you were trying to compile something) and issue the following command:

sudo apt-get install build-essential

You’ll get some output like this, after which you should be able to continue trying to compile your software package:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  dpkg-dev g++ g++-4.1 libstdc++6-4.1-dev patch
Suggested packages:
  debian-keyring g++-multilib g++-4.1-multilib gcc-4.1-doc libstdc++6-4.1-doc diff-doc
The following NEW packages will be installed:
  build-essential dpkg-dev g++ g++-4.1 libstdc++6-4.1-dev patch
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/3995kB of archives.
After unpacking 14.6MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Selecting previously deselected package libstdc++6-4.1-dev.
(Reading database ... 86000 files and directories currently installed.)
Unpacking libstdc++6-4.1-dev (from .../libstdc++6-4.1-dev_4.1.2-16ubuntu2_i386.deb) ...
Selecting previously deselected package g++-4.1.
Unpacking g++-4.1 (from .../g++-4.1_4.1.2-16ubuntu2_i386.deb) ...
Selecting previously deselected package g++.
Unpacking g++ (from .../g++_4.1.2-9ubuntu2_i386.deb) ...
Selecting previously deselected package patch.
Unpacking patch (from .../p/patch/patch_2.5.9-4_i386.deb) ...
Selecting previously deselected package dpkg-dev.
Unpacking dpkg-dev (from .../dpkg-dev_1.14.5ubuntu16_all.deb) ...
Selecting previously deselected package build-essential.
Unpacking build-essential (from .../build-essential_11.3ubuntu1_i386.deb) ...
Setting up patch (2.5.9-4) ...
Setting up dpkg-dev (1.14.5ubuntu16) ...
Setting up libstdc++6-4.1-dev (4.1.2-16ubuntu2) ...
Setting up g++-4.1 (4.1.2-16ubuntu2) ...
Setting up g++ (4:4.1.2-9ubuntu2) ...

Setting up build-essential (11.3ubuntu1) ...