forcefully unmount a disk partition

September 17, 2008 - Leave a Response

check which processes are accessing a partition:

lsof | grep '/opt'

kill all the processes accessing the partition (check what you’re killing, you could loose data):

fuser -km /mnt

try to unmount now:

umount /opt

netcat: quickly send binaries through network

April 29, 2008 - Leave a Response

just start nc in server mode on localhost:

 nc -l -p 3333 

send a string to localhost on port 3333:

 echo "hello world" | nc localhost 3333 

you’ll see on server side appearing the string you sent.

very useful for sending binaries, see examples.

Decibels, dB and dBm, in terms of Power and Amplitude

March 29, 2008 - Leave a Response

It’s not difficult, just always having some doubts…

Power

L_{dB} = 10 log_{10} \left( \dfrac{P_1}{P_0} \right)

10 dB increase for a factor 10 increase in the ratio

3 dB = doubling

40 dB = 10000 times

Amplitude

L_{dB} = 10 log_{10} \left( \dfrac{A_1^2}{A_0^2} \right) = 20 log_{10} \left( \dfrac{A_1}{A_0} \right)

dBm

dBm is an absolute value obtained by a ratio with 1 mW:

L_{dBm} = 10 log_{10} \left( \dfrac{P_1}{1 mW} \right)

  • 0 dBm = 1 mW
  • 3 dBm ≈ 2 mW

Relation between Power density and temperature in an antenna

March 28, 2008 - Leave a Response

Considering an antenna placed inside a blackbody enclosure at temperature T, the power received per unit bandwidth is:
\omega = kT

where k is Boltzmann constant.

This relationship derives from considering a constant brightness B in all directions, therefore Rayleigh Jeans law tells:

B = \dfrac{2kT}{\lambda^2}

Power per unit bandwidth is obtained by integrating brightness over antenna beam

\omega = \frac{1}{2} A_e \int \int B \left( \theta , \phi \right) P_n \left( \theta , \phi \right) d \Omega

therefore

\omega = \dfrac{kT}{\lambda^2}A_e\Omega_A

where:

  • A_e is antenna effective aperture
  • \Omega_A is antenna beam area

\lambda^2 = A_e\Omega_A another post should talk about this

finally:

\omega = kT

which is the same noise power of a resistor.

source : Kraus Radio Astronomy pag 107

Producing PDF from XML files

March 28, 2008 - Leave a Response

I need to produce formatted pdf from XML data input file.
The more standard way looks like to use XSL stylesheets.
Associating a XSL sheet to an XML file permits most browsers to render them directly as HMTL, this can be used for web publishing XML sheets.

The quick and dirty way to produce PDF could be printing them from Firefox, but an interesting option is to use xmlto, a script for running a XSL transformation and render an XML in PDF or other formats. It would be interesting to test this script and understand if it needs just docbook XML input or any XML.

vim costumization

October 17, 2006 - One Response

it is about perl but it suggests very useful tricks for programming with vim
http://mamchenkov.net/wordpress/2004/05/10/vim-for-perl-developers/

using find

October 3, 2006 - Leave a Response

list all the directories excluding “.”:

find . -maxdepth 1 -type d -not -name “.*”

find some string in all files matching a pattern in the subfolders (with grep -r you cannot specify the type of file)

find . -name ‘*.py’ -exec grep -i pdb ‘{}’ \;

beginners bash guide

October 3, 2006 - Leave a Response

great guide with many examples:

http://tille.xalasys.com/training/bash/

tar quickref

September 25, 2006 - Leave a Response

compress: tar cvzf foo.tgz *.cc *.h
check inside: tar tzf foo.tgz | grep file.txt
extract: tar xvzf foo.tgz
extract 1 file only: tar xvzf foo.tgz path/to/file.txt

software carpentry

September 25, 2006 - Leave a Response

basic software for scientists and engineers:
http://www.swc.scipy.org/