Thoughts on Ubuntu 11.10

Finally the new Ubuntu is here.

I was really impressed with Ubuntu 11.04 as it brought a couple of fresh ideas and software Packages, The best things actually where:

  • Libre Office instead of OpenOffice
  • Banshee instead of Rythmbox

It also brought a new UI, called Unity. Actually I did not like that very much cause I personally prefer Gnome Classic.

Now the 11.10 has completely kicked the Gnome Classic Desktop. I guess it didn't even survive an hour on my test.pc before downgrading to 11.04 again.

If you really head for 11.10 you just have 3 Options

  • Using Unity
  • Using Gnome 3
  • Using Gnome Fallback Mode

The Fallback mode was meant to give you a look and feel of the classic gnome desktiop. It's giving you your top-bar with the menüs and some information panels. But it simply looks awfull with the Ubuntu Theme. Maybe this will improve over time.

The really really bad thing is, that currently Gnome-DO or Kupfer isn't really working with Gnome3. Ok it is working but it is really really really slow for now.

So that was enough reason for me to downgrade again, cause I'm used to my Gnome environment and having Gnome DO.

If you are open for a new Desktop environment, take a look at things like Fluxbox, Xfce ... for the windows guys KDE

So please please make a good looking gnome-fallback mode or provide a Gnome 2 desktop.

Just my 2cents

 

 

Multiple Scanf's

 

The problem

As you might have noticed, theres a problem using more scanf's in a row.

 

for example something like:

char a;
char b;
printf("Please enter letter A: ");
scanf("%c", &a);
printf("Please enter letter B: ");
scanf("%c", &b);

won't work.

This is because of buffering. So if you enter a letter and hit enter, the letter will be taken for the first scanf, but your "enter-keystroke" is still in your buffer. This causes the second scanf to think that its input is just the enter remaining in the buffer.

What can you do about this ?

First solution:

Using fflush(stdin), which is supposed to flush your keyboardbuffer. Anyway this doesn't work everytime, especially it doesn't work on Linux machines.

The better Solution

you could use something like this:

char value;
do  
{ 
  scanf("%c",&value); 
} 
while( getchar() != '\n' );

this is just repeating scanf until you really hit enter again.

So as you probably want to do that more often than once in your programm it might be usefull to write a function doing that.

Your function could look like this:

//---------------------------------------------------------------------- 
/// 
/// Prompts the user for input and reads input
/// 
/// @param value Where the value read is stored
/// @param prompt The prompt given for a specific input
/// 
/// @return void
//
void readChar(char* value, char* prompt) 
{ 
  printf("%s", prompt); 
  do  
  { 
    scanf("%c",value); 
  } 
  while( getchar() != '\n' ); 
}

It's not perfect but it works. You could improve it by backchecking if the entered value is really a character or a number.

HTH

 

Setting up your workspace

Linux

Just download and install the gcc package from your distributions package management system. It should be available there.

Windows

cygwin

Cygwin emulates a Linux environment. Please note that the gcc version in cygwin is not up to date

You can get it over here:

http://www.cygwin.com/

MinGW

Provides basic open source development tools in windows. Please note that MinGW is using the Windows C-runtime environment so it is not running under a POSIX environment or emulating this.

Download it over here:

http://www.mingw.org/

Virtualbox

You can, what i recommend, set up a virtual machine, running a linux distribution of your choice.

Get Virtualbox here:

Read more: Setup and Editors
 
You are here:   Home
| + -

Who's online

We have one guest and no members online

Statistics

Articles View Hits
34780