Because Windows’ console interface is pathetic, users having Linux experience often find having to use the GUI makes even the most menial tasks a cumbersome process. Case-in-point: creating a directory. Having had enough of guiding the mouse pointer through the maze of context menus, I did some research and figured out a very easy keyboard sequence:
Shift + F10, w, f
“Shift + F10” opens the context menu, “w” takes you to the New directory, and “F” creates the directory!
Monday, 28 January 2008
Tuesday, 22 January 2008
GNU C __attribute__ format
This __attribute__ allows assigning printf-like or scanf-like characteristics to the declared function, and this enables the compiler to check the format string against the parameters provided throughout the code. This is exceptionally helpful in tracking down hard-to-find bugs.
There are two flavors:
* __attribute__((format(printf,m,n)))
* __attribute__((format(scanf,m,n)))
but in practice we use the first one much more often.
The (m) is the number of the "format string" parameter, and (n) is the number of the first variadic parameter. To see some examples:
/* like printf() but to standard error only */
extern void eprintf(const char *format, ...)
__attribute__((format(printf, 1, 2))); /* 1=format 2=params */
/* printf only if debugging is at the desired level */
extern void dprintf(int dlevel, const char *format, ...)
__attribute__((format(printf, 2, 3))); /* 2=format 3=params */
With the functions so declared, the compiler will examine the argument lists
$ cat test.c
1 extern void eprintf(const char *format, ...)
2 __attribute__((format(printf, 1, 2)));
3
4 void foo()
5 {
6 eprintf("s=%s\n", 5); /* error on this line */
7
8 eprintf("n=%d,%d,%d\n", 1, 2); /* error on this line */
9 }
$ cc -Wall -c test.c
test.c: In function `foo':
test.c:6: warning: format argument is not a pointer (arg 2)
test.c:8: warning: too few arguments for format
Note that the "standard" library functions - printf and the like - are already understood by the compiler by default.
There are two flavors:
* __attribute__((format(printf,m,n)))
* __attribute__((format(scanf,m,n)))
but in practice we use the first one much more often.
The (m) is the number of the "format string" parameter, and (n) is the number of the first variadic parameter. To see some examples:
/* like printf() but to standard error only */
extern void eprintf(const char *format, ...)
__attribute__((format(printf, 1, 2))); /* 1=format 2=params */
/* printf only if debugging is at the desired level */
extern void dprintf(int dlevel, const char *format, ...)
__attribute__((format(printf, 2, 3))); /* 2=format 3=params */
With the functions so declared, the compiler will examine the argument lists
$ cat test.c
1 extern void eprintf(const char *format, ...)
2 __attribute__((format(printf, 1, 2)));
3
4 void foo()
5 {
6 eprintf("s=%s\n", 5); /* error on this line */
7
8 eprintf("n=%d,%d,%d\n", 1, 2); /* error on this line */
9 }
$ cc -Wall -c test.c
test.c: In function `foo':
test.c:6: warning: format argument is not a pointer (arg 2)
test.c:8: warning: too few arguments for format
Note that the "standard" library functions - printf and the like - are already understood by the compiler by default.
Monday, 21 January 2008
Connect T-Mobile Wireless Internet Through Your Cell Phone
You can find a hardcopy of this walk through on my blog at this location.
I recently took on the challenge of getting an old PC up and running with Xubuntu 7.10. My father recently purchased the T-Mobile Internet package, which allows him to connect his computer to unlimited mobile Internet for $20 a month. Setting this up proved to be easier than I anticipated.
1. The first thing you need to do is change the USB configuration in your phone. On my phone (a Motorola K1) and many other T-Mobile phones, you have to change your USB configuration: make your default USB connection a data connection. By default, most phones are configured to be in “Memory Card” mode.
2. Next, you need to install a piece of software in Ubuntu called “wvdial”. To do this, click on Applications>Accessories>Terminal. Once your terminal window is open, type in the following:
Code:
sudo apt-get install wvdial
3. Edit your wvdial.conf file. Type
Code:
sudo gedit /etc/wvdial.conf
in a terminal window to do this.
Once you have your wvdial.conf file open, paste in the following text over all the contents of the file:
Code:
[Dialer Defaults]
Init1 = AT+CGDCONT=1,”IP”,”wap.voicestream.com”
Modem Type = USB Modem
Phone = *99#
Password = pass
Username = user
Modem = /dev/ttyACM0
Baud = 460800
Take note of the “ttyACM0″ part. This may not be the same on your PC. To find out what yours is, attach your phone to your PC, and then type the following into the terminal:
Code:
dmesg | fgrep acm
You should see something like this returned in the output:
[ 9168.949496] cdc_acm 2-3:1.0: ttyACM0: USB ACM device
This ACM device is your phone, and it is now an accessible piece of hardware. For wvdial to use it, you must make sure the above configuration file points wvdial to the right device name. If the above dmesg output produces a different ttyACM#, change it accordingly to match your PC. (Note, if you don’t get any dmesg results at all, try typing this in first: sudo modprobe cdc_acm).
After your wvdial.conf file is created and your sure your Modem = /dev/tty line is correct, save the file and close gedit. Then simply run wvdial from the terminal:
$ wvdial
Wvdial will then access your phone as it is directed to do so by the wvdial.conf file, and essentially dial T-mobiles Internet Service Provider. No real username or password is required for this, so leave the user/pass in the above config file as it is written. You’ll see some output on the screen that looks like this:
user@user-desktop:~$ wvdial
WvDial<*1>: WvDial: Internet dialer version 1.56
WvModem<*1>: Cannot get information for serial port.
WvDial<*1>: Initializing modem.
WvDial<*1>: Sending: AT+CGDCONT=1,”IP”,”wap.voicestream.com”
WvDial Modem<*1>: AT+CGDCONT=1,”IP”,”wap.voicestream.com”
WvDial Modem<*1>: OK
WvDial<*1>: Modem initialized.
WvDial<*1>: Sending: ATDT*99#
WvDial<*1>: Waiting for carrier.
WvDial Modem<*1>: ATDT*99#
WvDial Modem<*1>: CONNECT
WvDial<*1>: Carrier detected. Waiting for prompt.
At this point, the program will pause as it handshakes and establishes a connection using PPP. After about 10 or 20 seconds, the output will continue on and look similar to this:
WvDial: Don’t know what to do! Starting pppd and hoping for the best.
WvDial: Starting pppd at Thu Jan 17 17:50:28 2008
WvDial: Warning: Could not modify /etc/ppp/pap-secrets: Permission denied
WvDial: –> PAP (Password Authentication Protocol) may be flaky.
WvDial: Warning: Could not modify /etc/ppp/chap-secrets: Permission denied
WvDial: –> CHAP (Challenge Handshake) may be flaky.
WvDial: Pid of pppd: 13530
WvDial<*1>: Using interface ppp0
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: local IP address 10.38.225.200
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: remote IP address 192.168.100.101
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: primary DNS address 66.94.9.120
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: secondary DNS address 66.94.25.120
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
Congrats! You are now connected to the Internet using your cellphone. And all you have to do to establish a connection is open a terminal window and type wvdial.
To end your connection, you can simply close the terminal window containing the above mess, or hit CTRL-C while the terminal window is open. So be careful and don’t close the window by accident, or your connection will be dropped and you’ll have to run wvdial all over again. Oh, the agony of typing that one command over again!!
Anyway, enjoy your T-Mobile Wireless Internet connection! You should see a steady downstream of about 20 to 30 KB per second, which is about 5 times faster than dial up. And it’s unlimited! It’s not DSL or Cable, but that’s still not a bad deal for 20 bucks a month.
I recently took on the challenge of getting an old PC up and running with Xubuntu 7.10. My father recently purchased the T-Mobile Internet package, which allows him to connect his computer to unlimited mobile Internet for $20 a month. Setting this up proved to be easier than I anticipated.
1. The first thing you need to do is change the USB configuration in your phone. On my phone (a Motorola K1) and many other T-Mobile phones, you have to change your USB configuration: make your default USB connection a data connection. By default, most phones are configured to be in “Memory Card” mode.
2. Next, you need to install a piece of software in Ubuntu called “wvdial”. To do this, click on Applications>Accessories>Terminal. Once your terminal window is open, type in the following:
Code:
sudo apt-get install wvdial
3. Edit your wvdial.conf file. Type
Code:
sudo gedit /etc/wvdial.conf
in a terminal window to do this.
Once you have your wvdial.conf file open, paste in the following text over all the contents of the file:
Code:
[Dialer Defaults]
Init1 = AT+CGDCONT=1,”IP”,”wap.voicestream.com”
Modem Type = USB Modem
Phone = *99#
Password = pass
Username = user
Modem = /dev/ttyACM0
Baud = 460800
Take note of the “ttyACM0″ part. This may not be the same on your PC. To find out what yours is, attach your phone to your PC, and then type the following into the terminal:
Code:
dmesg | fgrep acm
You should see something like this returned in the output:
[ 9168.949496] cdc_acm 2-3:1.0: ttyACM0: USB ACM device
This ACM device is your phone, and it is now an accessible piece of hardware. For wvdial to use it, you must make sure the above configuration file points wvdial to the right device name. If the above dmesg output produces a different ttyACM#, change it accordingly to match your PC. (Note, if you don’t get any dmesg results at all, try typing this in first: sudo modprobe cdc_acm).
After your wvdial.conf file is created and your sure your Modem = /dev/tty line is correct, save the file and close gedit. Then simply run wvdial from the terminal:
$ wvdial
Wvdial will then access your phone as it is directed to do so by the wvdial.conf file, and essentially dial T-mobiles Internet Service Provider. No real username or password is required for this, so leave the user/pass in the above config file as it is written. You’ll see some output on the screen that looks like this:
user@user-desktop:~$ wvdial
WvDial<*1>: WvDial: Internet dialer version 1.56
WvModem<*1>: Cannot get information for serial port.
WvDial<*1>: Initializing modem.
WvDial<*1>: Sending: AT+CGDCONT=1,”IP”,”wap.voicestream.com”
WvDial Modem<*1>: AT+CGDCONT=1,”IP”,”wap.voicestream.com”
WvDial Modem<*1>: OK
WvDial<*1>: Modem initialized.
WvDial<*1>: Sending: ATDT*99#
WvDial<*1>: Waiting for carrier.
WvDial Modem<*1>: ATDT*99#
WvDial Modem<*1>: CONNECT
WvDial<*1>: Carrier detected. Waiting for prompt.
At this point, the program will pause as it handshakes and establishes a connection using PPP. After about 10 or 20 seconds, the output will continue on and look similar to this:
WvDial
WvDial
WvDial
WvDial
WvDial
WvDial
WvDial
WvDial<*1>: Using interface ppp0
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: local IP address 10.38.225.200
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: remote IP address 192.168.100.101
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: primary DNS address 66.94.9.120
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: secondary DNS address 66.94.25.120
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
Congrats! You are now connected to the Internet using your cellphone. And all you have to do to establish a connection is open a terminal window and type wvdial.
To end your connection, you can simply close the terminal window containing the above mess, or hit CTRL-C while the terminal window is open. So be careful and don’t close the window by accident, or your connection will be dropped and you’ll have to run wvdial all over again. Oh, the agony of typing that one command over again!!
Anyway, enjoy your T-Mobile Wireless Internet connection! You should see a steady downstream of about 20 to 30 KB per second, which is about 5 times faster than dial up. And it’s unlimited! It’s not DSL or Cable, but that’s still not a bad deal for 20 bucks a month.
Sopcast in Ubuntu
1) Download this, untar it and place sp-sc into /usr/local/bin/ :http://download.sopcast.org/download/sp-sc.tgz
2) Download the gtk-sopcast.deb and use gdebi to install it.
That should work out of the box. MPlayer wouldnt work for me, it may for others, but Kaffeine worked perfectly.
2) Download the gtk-sopcast.deb and use gdebi to install it.
That should work out of the box. MPlayer wouldnt work for me, it may for others, but Kaffeine worked perfectly.
AllTray
With AllTray you can dock any application with no native tray icon (like Evolution, Thunderbird, Terminals) into the system tray. A high-light feature is that a click on the "close" button will minimize back to system tray. It works well with Gnome, KDE, XFCE 4*, Fluxbox* and WindowMaker*
But, there is no drag 'n drop support .
http://alltray.sourceforge.net/
But, there is no drag 'n drop support .
http://alltray.sourceforge.net/
Are You Ready For Blu-Ray?
A Beta version of CyberLink’s BD/HD DVD Advisor has been made available for free download from their website. The diagnostic software analyses system resources to check if they will be able to support playback of the next-generation discs, and recommends upgrades or troubleshooting support if the PC isn’t up to scratch.
Among the components it checks the capabilities of are the processor, graphics card, Blu-ray/HD DVD drive, system memory, operating system and playback software. To find out more, or to download the software, head over to www.cyberlink.com.
Among the components it checks the capabilities of are the processor, graphics card, Blu-ray/HD DVD drive, system memory, operating system and playback software. To find out more, or to download the software, head over to www.cyberlink.com.
Running Windows, Linux And Mac Operating Systems
Avanquest UK has launched a virtual desktop product (created by Parallels Inc) that’ll allow you to run different operating systems and applications alongside Mac OS. Intel processor-based Apple Macs will therefore be able to run Windows, Linux and most other applications in Mac OS X without needing to reboot. Files will be shareable between Windows XP/2000 and Mac OS X by just copying and pasting them, which is useful.
Desktop for Mac will also come with Parallels’ Compressor, which allows Windows 2000, 2003 and XP virtual machines’ hard drive space to be reduced by 50% of more, so that Desktop for Mac isn’t constrained by memory and space requirements.
www.avanquest.co.uk
Desktop for Mac will also come with Parallels’ Compressor, which allows Windows 2000, 2003 and XP virtual machines’ hard drive space to be reduced by 50% of more, so that Desktop for Mac isn’t constrained by memory and space requirements.
www.avanquest.co.uk
Sunday, 20 January 2008
PowerTOP - Power Saver for GNU/Linux
Computer programs can make your computer use more power. PowerTOP is a Linux tool that helps you find those programs that are misbehaving while your computer is idle. The application that misbehaved the most was the Linux kernel. However, as of version 2.6.21, the Linux kernel went tickless, and no longer has a fixed 1000Hz timer tick. The result (in theory) is huge power savings because the CPU stays in low power mode for longer periods during system idle.
However... there are many things that can ruin the party, both inside the kernel and in userspace. PowerTOP combines various sources of information from the kernel into one convenient screen so that you can see how well your system is doing at saving power, and which components are the biggest problems.
PowerTOP has these four basic goals:
* Show how well your system is using the various hardware power-saving features
* Show you the culprit software components that are preventing optimal usage of your - hardware power savings
* Help Linux developers test their application and achieve optimal behavior
* Provide you with tuning suggestions to achieve low power consumption
http://www.lesswatts.org/projects/powertop/
However... there are many things that can ruin the party, both inside the kernel and in userspace. PowerTOP combines various sources of information from the kernel into one convenient screen so that you can see how well your system is doing at saving power, and which components are the biggest problems.
PowerTOP has these four basic goals:
* Show how well your system is using the various hardware power-saving features
* Show you the culprit software components that are preventing optimal usage of your - hardware power savings
* Help Linux developers test their application and achieve optimal behavior
* Provide you with tuning suggestions to achieve low power consumption
http://www.lesswatts.org/projects/powertop/
Switch between RDP and Desktop in Ubuntu
In most of the time, we use RDP in full screen mode, But,sometimes we have problem with minimizing the remote screen.
But, CTRL-ALT-ENTER key combination will help us to make the RDP terminal full screen to windowed mode. So that we can work with the desktop machine also.
But, CTRL-ALT-ENTER key combination will help us to make the RDP terminal full screen to windowed mode. So that we can work with the desktop machine also.
Subscribe to:
Posts (Atom)