Sun Feb 7 14:06:14 CET 2010
Pointer and Arrays
Hello. I would like to say 'hello again'. :-)
As some of you noticed, there is a little problem while creating an array and a pointer of it in C++. For doing that, you are supposed to write something like:
int data[50]; // declare an (static) array int *p_data = data; // make a pointer of it // declare a function, which gets the pointer of the data array void function(..., int* p_data, ...); // Call-by-reference function(..., p_data, ...)
If you don't want to have a static array but a dynamic one, you need
to ask the user for the length and then reserve some memory for it.
Thanks to:
Fred Swartz:
int* a = NULL; // Pointer to int, initialize to nothing.
int n; // Size needed for array
cin >> n; // Read in the size
a = new int[n]; // Allocate n ints and save ptr in a.
for (int i=0; i<n; i++) {
a[i] = 0; // Initialize all elements to zero.
}
... // Use a as a normal array
delete [] a; // When done, free memory pointed to by a.
a = NULL; // Clear a to prevent using invalid memory reference.
If you need it all over dynamic, to grow and shrink depending on what the user wants, you could use malloc and remalloc memory for an array (like you would do it in C). But you could also use std::vector (declared in vector.h) which does all what you need:
std::vector<int> data; std::vector<int>* p_data = &data; // declare a function, which gets the pointer of the data vector void function(..., int* p_data, ...); // Call-by-reference function(..., p_data, ...)
Sat May 9 11:09:42 CEST 2009
Pictures of Cologne
Last weekend I traveled across Cologne and made some pictures, which you can find in my gallery. Have a look and enjoy them! :-)
Sat May 2 14:51:21 CEST 2009
Pollerwiesen
Gestern war ich, zusammen mit meiner Mitbewohnerin und einer Schulkollegin von ihr und deren Freund und Freunde, auf den Pollerwiesen. Dort fand eine Art Elektrofestival statt. Die Musik war jedoch eher lau und der Eintritt von 10 EUR nicht gerechtfertigt. Also lagen wir uns auf eine Wiese und genossen die Stunden, bis wir beschlossen noch einmal in die Stadt zu schauen. Das Verkehrchaos war riesig.
Spaeter am Abend verschlug es uns in die Cuba Bar. Richtig nette Location mit leckeren Cocktails. ;-)
Sun Apr 19 19:43:05 CEST 2009
Smiley in the subway
Did you ever had this experience when somebody sits in the subway and
you look at this person? And the only thing you do is to smile?
Do you think that a smile to sombody in the subway can change his/her or even your own
life?
Sun Apr 19 19:01:14 CEST 2009
Hiroshima-Nagasaki-Park
Heute tat ich einen kleinen Spaziergang durch Koeln. Begonnen hab' ich ihn am Dom. Typisch fuer nicht Einheimische, denke ich mal. Danach lief ich zum Neumarkt, zum Rudolfplatz mit dem Ziel des Hiroshima-Nagasaki- Parks. Ein sehr idyllischer Ort mit Enten und vielen Liegemoeglichkeiten. Es war eine ueberaus entspannte Atmosphaere dort.
Danach lief ich zurueck nach Bayenthal. 11 U-Bahn-Stationen zu laufen ist allerdings nicht gerade um die Ecke. ;-)
Sat Apr 18 12:35:27 CEST 2009
Frage der Woche
Q: "Kann man mit einem Wochenendticket auch in Koeln fahren?" A: "Wenn gerade Wochenende ist!?"
Sat Apr 18 12:19:37 CEST 2009
Erste Tage
Ich werde diesen Blog in den naechsten Monaten mal ein wenig dazu missbrauchen meine Eindruecke von Koeln und meinem Praktikum hier zu beschreiben. Das ganze werde ich in Deutsch tun, falls jemand ein Problem damit haben sollte, so kann er sich gerne bei mir melden. Kommentare sind erwuenscht.
Angefangen hat alles mit der Anreise am Dienstag. Wir sind in einen elendlangen Stau geraten, der durch Nebel verursacht worden war. Nun standen wir dort und warteten 6 geschlagene Stunden.
In Koeln angekommen standen nun die WG-Besichtigungen auf dem Plan.
Leider wussten meine Favouriten nur zur Haelfte Bescheid und so
ueberrannte ich sie etwas mit meinem spontanen Einzug.
Dafuer sind hier alle super nett und ich freue mich wirklich
hier gelandet zu sein. Koeln-Bayenthal
ist auch eine wunderschoene, ruhige Gegend.
Mein Praktkikumsplatz fuer die naechsten Monate wird die undbitte entertainment GmbH sein. Es ist ein sehr angenehmes Arbeitsklima dort. :-)
Tue Mar 24 17:05:46 CET 2009
Singularity-Paper
Yesterday I published my paper about Singularity on paper.kickino.org.
Singularity is a Microsoft research project.
I wrote some notes about Singularity in an earlier blog entry.
The university marked it (together with a presentation) as 2.0. :-)
Fri Mar 20 17:18:30 CET 2009
Nagios
These days I played a little bit around with Nagios, which is able to check several hosts and services. With the support of a free vServer of EUserv I did a setup of such a system.
My highlight is that a downtime of a service will notify me via Twitter. Furthermore the Gentoo Nagios guide helped my very much. There exist several Nagios plugins to check ssh, jabber, irc and other tcp ports and many other things to monitor.
If somebody knows a free Nagios infrastructure I'll be interested in this. :-)
Mon Mar 16 00:40:46 CET 2009
Chemnitzer Linux Days 2009
The last days I was on the Chemnitzer Linux Tage 2009. It is a big event, where the open source and free software community meet each other. There you've get the chance to ask your questions and get in touch with GNU/Linux and the distributors.
There were a lot of talks of several difference topics. But don't forget
the social part of such events. I met several people, I never met before
in real life. It was really fantastic.
If you would like, you could have a look at
my pictures of the CLT09.