Monday, December 15, 2008

append newline at end of files

Frequently when you download source code off the internet and try to compile, you end up getting a bunch of "warning: no newline at end of file" . to append a newline at the end of each *.c and *.h files use the following one liner.


find ./ \( -name "*.h" -o -name "*.cpp" \) -exec perl -i.bak -lpe 'print "\n" if eof' {} \;


ps: the space between the '{}' and '\;' at the end is required and there is no space in between "\;". else the follwing error occurs

find: missing argument to `-exec'

Monday, December 08, 2008

Sunglass

While this place has mostly computer related stuff, this time I just want to say if you are running a marathon and it is expected to be sunny, a sunglass helps a LOT. Not that I am a great runner or anything. But this time I was wearing one and in between at around 34 km or so, I took them off and boy the sun looked horrible and I can easily imagine it would be far more depressing without the sunglass. FWIW I shaved 1 hr and few minutes off my last years 7 hrs 15 mins time and I am sure the sunglass made some difference.

Monday, December 01, 2008

Resize an image using Imagemagick

you can just use convert to resize an image. Infact you can convert and resize in one go



convert infile.jpg -resize 10% outfile.png

Monday, November 10, 2008

"identify as" in opera

People who have used opera for some time know the usefullness of the "identify as" option. In the new versions it hard to find where its located , so here's how

right click on the webpage ->edit site preferences -> network

so basically it lets you set the preferences per website , which seems to be a useful feature , except for the fact that its hard to find.

Monday, November 03, 2008

Latex solution : IEEE etc requiring all fonts to be embedded

Here's an ugly solution which worked for me
( this is from here just copying it here again in case the original post get lost in an internet purge )

modify file
/usr/share/gs-afpl/8.14/lib/gs_pdfwr.ps
and change lines

/.standardfonts [
/Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique
/Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique
/Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic
/Symbol /ZapfDingbats
] readonly def

into

/.standardfonts [
% /Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique
% /Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique
% /Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic
% /Symbol /ZapfDingbats
] readonly def

=========
the command pdffonts shows the different fonts and whether they are embedded
sample output
pdffonts apdffile.pdf
name type emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
Arial-BoldMT TrueType no no no 2295 0
Arial-ItalicMT TrueType no no no 2296 0
ArialMT TrueType no no no 2299 0
KGDDMC+Wingdings-Regular CID TrueType yes yes no 296 0
KGDEMN+SymbolMT CID TrueType yes yes yes 301 0
Arial-BoldItalicMT TrueType no no no 306 0
KGDPPM+TimesNewRomanPS-BoldMT TrueType yes yes no 307 0
KGECBC+TimesNewRomanPSMT TrueType yes yes no 310 0
KGECDD+BookmanOldStyle-Bold TrueType yes yes no 312 0
TimesNewRomanPS-BoldItalicMT TrueType no no no 314 0
TimesNewRomanPS-ItalicMT TrueType no no no 318 0
KGECAB+TimesNewRomanPSMT CID TrueType yes yes yes 320 0
KGDPOM+TimesNewRomanPS-BoldMT CID TrueType yes yes yes 327 0

Thursday, May 08, 2008

no page number in latex documents

The nopageno package provides a simple way to remove page numbers from both the opening pages and the normal pages of all classes of LaTeX documents. Other than adding the package to your document, no action is necessary. No package options are available.