With C++ there is ways of handling optional function parameters or overloading functions to handle different amounts of parameters, obviously within C these abilities do not exist. However if we wanted to handle a variable list of parameters then C and C++ would work the same.
Let’s see how we’d do that:
#include <stdarg.h>
#include <stdio.h>
int Adding(int cnt, ...) { /* the three ... indicate a variable list */
int add, tmp, i;
va_list args; /* make a va_list */
va_start(args, cnt); /* variable list starts after 'cnt' */
for(i = 0; i < cnt; i++) {
tmp = va_arg(args, int); /* grab the next */
add = add + tmp; /* add to the sum */
}
va_end(args); /* finished using variable list */
return add;
}
int main( ) {
int a;
a = Adding(2, 1, 2);
printf("%u\n", a); /* Outputs 3 */
a = Adding(3, 1, 2, 3);
printf("%u\n", a); /* Outputs 6 */
return 0;
}
So the first argument indicates how many variables we are going to pass and the rest are summed together. The function Adding() would be identical in C++.
Sometimes when people are using Linux they will find that they come across a simple security check that confirms the authenticity of the RPM/Deb files that they are installing. Every so often the key is missing but that is easy to remedy. Here I will use an example with the YUM install of Adobe Flash:
[root@marine]# ls
adobe-release-i386-1.0-1.noarch.rpm
[root@marine]# yum localinstall adobe-release-i386-1.0-1.noarch.rpm
Loaded plugins: fastestmirror, priorities
Setting up Local Package Process
Examining adobe-release-i386-1.0-1.noarch.rpm: adobe-release-i386-1.0-1.noarch
Marking adobe-release-i386-1.0-1.noarch.rpm to be installed
Loading mirror speeds from cached hostfile
* addons: anorien.csc.warwick.ac.uk
* base: anorien.csc.warwick.ac.uk
* centosplus: anorien.csc.warwick.ac.uk
* contrib: anorien.csc.warwick.ac.uk
* extras: anorien.csc.warwick.ac.uk
* rpmforge: fr2.rpmfind.net
* updates: anorien.csc.warwick.ac.uk
588 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package adobe-release-i386.noarch 0:1.0-1 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
adobe-release-i386 noarch 1.0-1 /adobe-release-i386-1.0-1.noarch 1.9 k
Transaction Summary
================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total size: 1.9 k
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID f6777c67
Public key for adobe-release-i386-1.0-1.noarch.rpm is not installed
As you can see it attempted to install but because the key was missing it refused to install. So what do we do to find that key? First we must download the key from somewhere, there is various key servers around the world, some of the most popular are (note hkp is the HTTP keyserver protocol):
- hkp://subkeys.pgp.net
- hkp://pgp.mit.edu
- hkp://keys.gnupg.net
- hkp://wwwkeys.uk.pgp.net (where UK can be replaced by any country code)
So lets search for the missing key:
[root@marine]# gpg --keyserver hkp://wwwkeys.uk.pgp.net --recv-keys f6777c67
gpg: requesting key F6777C67 from hkp server wwwkeys.uk.pgp.net
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key F6777C67: public key "Adobe Systems Incorporated (Linux RPM
Signing Key) " imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
So now we have the key and see that it is indeed Adobe’s key. Now all we need to do is add into RPM:
[root@marine]# gpg --armor --export f6777c67 >tmp-gpg.key
[root@marine]# rpm --import tmp-gpg.key
Simple as that, the install will work now!
This post is a refreshed look at a previous post on the same matter.
So it has been a while since I posted last and I felt like updating and cleaning stuff up. The tags and categories have been improved and reduced to help with clarity. I have switched to a new theme, although it is still created by the previous designer.
I have also added a Google CSE to assist with searching for a particular post, although I don’t exactly have too many.
I am very impressed with how WordPress has improved over recent times. The automatic upgrade is impressive and will surely ensure that less WP installs are hacked. The theme/plug-in search is quick and very easy to use, thus insuring that people will not be stuck with one design, or missing a vital plug-in. These two can be upgraded on the fly. Overall a real improvement proving that WP is a mature and stable piece of software.
There is only one minor annoyance and that is the speed at which pages are served, I do feel it could be slightly quicker.
Hope you all enjoy the updates that I applied!
I was recently pointed to the English and Polish pages for the MS Business Productivity. The most striking thing about the difference between the pages is that one depicts a white individual in place of a black individual. What could be the purpose of altering the image, surely it isn’t racism, after all the Chinese individual is still in place.
Strange what goes through the brain of MS Business Productivity.

Polish Alternative

English Alternative
So I came across a great game a few days ago. It is one of those puzzles that turn up now and then that make your brain pop. Fantastically simple but frustratingly tough. Finishing this on your own would be nearly impossible. Fortunately the creator of this puzzle added the ability to merge puzzles with your friends, genius!
I highly suggest that you give it a go first on your own and see how far you get. I was completely stumped on some of the stuff and others quickly sliced through them.
Have a go at the Funny Farm puzzle.
Read more…