C Prog to change wallpaper in every 30 seconds.

I wrote a good length of description on the below but somehow my browser closed without saving that. So I am just putting the program below:

#include
#include
#include
#include
#include

int main(int argc, char ** argv)
{
DIR *dp;
struct dirent *ep;
char dirname[80];
GConfClient* client;
int s;

if (argc<=1)
{
printf(\”%d is argc\\n\”, argc);
fflush (stdout);
dp = opendir(\”.\”);
strcpy(dirname, \”.\”);
}
else
{
dp = opendir(argv[1]);
strcpy(dirname, argv[1]);
}
if (argc <=2 )
s = 30;
else if ( argc >2 ) s = atoi(argv[2]);
//g_type_init();
client = gconf_client_get_default();
//client = gconf_client_get_for_engine (gconf_engine_get_default());

if (dp != NULL)
{
while (ep = readdir (dp))
{
char buffer[80];
//printf(\”%s \\n\”,buffer);
if (ep->d_type == 8) {
sprintf(buffer, \”%s/%s\”, dirname, ep->d_name);
printf(\”%s \\n\”,buffer);
gconf_client_set_string(client,
\”/desktop/gnome/background/picture_filename\”,
buffer,NULL);
//gconf_client_suggest_sync(client, NULL);
sleep(s);
}
// else if (ep->d_type == DT_DIR) main(1, ep->d_name);
}
closedir(dp);
}
else
perror (\”Could not open directory\”);

return 0;
}

One click install for Linux systems.

There has been this concept for quite sometime that there should be one click install for the applications in Linux. This applies to the themes and widgets of wordpress too 🙂 and quite some applications are taking it seriously (like wordpress for example).

But how about the application to do one-click install, there are couple of issues with that but still there exists at least one way. A nice blog here.

If you want to know more about one click install, you can start here.

Pipeing linux commands and their output

As a system administrator, I always worry about certain things, like who\'s doing what, what processes are running, what the network traffic looks like, etc.  One day I decided to create a simple alias that would combine all the commands I wanted into one big chunk of information.  Then I realized that it wouldn\'t all fit into one screen.
Fortunately I knew how to group all of the commands together, so the \"more\" command could handle them as one set of input.

First, here\'s the wrong way to try to page a sequence of four commands:

     date; netstat -i; whodo; ps -ef | more

The only command that gets paged properly here is the \"ps -ef\" command --the rest of them scroll off the screen before you can read them.

Here\'s the correct way to page four commands so they\'re all controlled by \"more\":

      (date; netstat -i; whodo; ps -ef) | more

Once you find the commands you want to group together, you can combine them into an alias or shell program.  I recommend a shell program for this, because a few \"echo\" statements sure make it easier to see where one command ends and the next command begins!