Don't ask why I needed it, the point is that at this site, I found out how.
Save this program to some file, say pro.c:
#include <stdio.h>
int main()
{
long double ld = 1.0/3;
double d = 1.0/3;
float f = 1.0/3;
printf("sizeof(float)=%lu\n", sizeof(float));
printf("sizeof(double)=%lu\n", sizeof(double));
printf("sizeof(long double)=%lu\n", sizeof(long double));
printf(" f=%.30lf\n", f);
printf(" d=%.30lf\n", d);
printf("ld=%.30Lf\n", ld);
}
And then compile it:
gcc pro.c -o pro.x
After you compile it, type ./pro.x and count the digits :)
If you're interested into floating point arithmetics in Linux, you can read this site or of course - wikipedia.
неделя, 19 юни 2011 г.
вторник, 14 юни 2011 г.
How to suspend trough console
Easy :)
pm-suspend
pm-suspend
# sleep to ram
pm-hibernate
# suspends to hard-disk
Also it appears you can suspend at certain time trough:
at 0100
pm-suspend
<ctrl-D>
And to wake up the computer with:
rtcwake
pm-suspend
pm-suspend
# sleep to ram
pm-hibernate
# suspends to hard-disk
Also it appears you can suspend at certain time trough:
at 0100
pm-suspend
<ctrl-D>
And to wake up the computer with:
rtcwake
събота, 23 април 2011 г.
How to remove pulseaudio
Since the last 1 or 2 kernels I have horrible problems with pulseaudio. It's a very annoying bug that causes KDE to freeze for 15-20 minutes by loading whatever program is using sound with 2GB RAM. Which makes the system to start placing stuff in the swap and the whole situation becomes very ugly.
The actual error is:
"snd_pcm_avail() returned a value that is exceptionally large"
and obviously is some bug in pulseaudio. I discovered some sites claiming to have a solution (like this) but nothing helped.
So last night I decided to remove the annoying pulseaudio.
I did as suggested in this site. Note, I did backup ~/.asoundrc, ~/.pulse and /etc/asound.conf just to be on the safe side.
Then use:
to kill pulseaudio and tell it to please do not appear again. If you happen to want it back, you can use:
Unfortunately, it continued to start on reboot. I tried to uninstall it, but it turned out that the whole KDE depends in some mystical way on it, so I found the other solution:
That removes the bin file of pulseaudio and it cannot start even if it wants to. Oh, well.
Next thing was that I had problems with amarok not wanting to play music. It turned out that my first backend is "vlc" and not "xine". After putting "xine" on fist place, sound appeared.
I also used the .asoundrc suggested in the file above:
The actual error is:
"snd_pcm_avail() returned a value that is exceptionally large"
and obviously is some bug in pulseaudio. I discovered some sites claiming to have a solution (like this) but nothing helped.
So last night I decided to remove the annoying pulseaudio.
I did as suggested in this site. Note, I did backup ~/.asoundrc, ~/.pulse and /etc/asound.conf just to be on the safe side.
Then use:
touch ~/.pulse-a11y-nostart echo autospawn = no|tee -a ~/.pulse/client.conf killall pulseaudio
to kill pulseaudio and tell it to please do not appear again. If you happen to want it back, you can use:
rm .pulse-a11y-nostart ~/.pulse/client.conf .asoundrc.
Unfortunately, it continued to start on reboot. I tried to uninstall it, but it turned out that the whole KDE depends in some mystical way on it, so I found the other solution:
mv /usr/bin/pulseaudio /usr/bin/pulsestopThat removes the bin file of pulseaudio and it cannot start even if it wants to. Oh, well.
Next thing was that I had problems with amarok not wanting to play music. It turned out that my first backend is "vlc" and not "xine". After putting "xine" on fist place, sound appeared.
I also used the .asoundrc suggested in the file above:
pcm.dsp {
type plug
slave.pcm "dmixer"
}
pcm.!default {
type plug
slave.pcm "dmixer"
}
ctl.!default {
type hw
card 0
}
pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0"
period_time 0
# period_time 84000
# period_size 2048
# buffer_time 340000
rate 44100
# rate 48000
period_size 1024
# buffer_size 2052
buffer_size 4096 # this is the size of buffer I use
# buffer_size 8192
# buffer_size 16384
}
bindings {
0 0
1 1
}
}
ctl.dmixer {
type hw
card 0
}Now everything seems to work fine. Amarok plays music. Juk plays music. If you stop Amarok and then run Flash, it has sounds. They won't work simultaneously, even though Amarok and Juk work in the same time. Anyway, this is very small problem compared to the disastrous bug in pulseaudio that made me lose hours in the recent weeks. Now everything is calm and nice. :)
Абонамент за:
Публикации (Atom)