Wednesday, June 15, 2011

 

Ifdef preprocessing

These provide a rapid way to "clip" out and insert code.

Consider;

     #define FIRST

main()
{
int a, b, c;

#ifdef FIRST
a=2; b=6; c=4;
#else
printf("Enter a:");
scanf("%d", &a);

printf("Enter a:");
scanf("%d", &a);

printf("Enter a:");
scanf("%d", &a);
#endif
additonal code

Note that if FIRST is defined (which it is in the above) the values of a, b and c are hardcoded to values of 2, 6 and 4. This can save a lot of time when developing software as it avoids tediously typing everything in each and everytime you run your routine. When FIRST is defined, all that is passed to the compiler is the code between the #ifdef and the #else. The code between the #else and the #endif is not seen by the compiler. It is as if it were all a comment.

source: http://www.phanderson.com/C/preprocess.html


 

crypto.h:12:26: error: openssl/hmac.h: No such file or directory

If you get something similar to:

 crypto.h:12:26: error: openssl/hmac.h: No such file or directory
crypto.h:13:25: error: openssl/sha.h: No such file or directory
crypto.h:15:25: error: openssl/rc4.h: No such file or directory
crypto.h:16:25: error: openssl/aes.h: No such file or directory

solution:

$sudo apt-get install openssl
$sudo apt-get install libssl-dev


Saturday, May 07, 2011

 

Using IEEETrans with Texmaker

This (tip) is for you if you are TeXing in a linux platform. You can install LaTeX, TeXMaker, and IEEEtran class files using following procedure. Thought this might be helpful.

1. First get the full texlive package:

apt-get install texlive-full

(You may need to use sudo as well)

2. Then install texmaker (it's a very nice GUI frontend for latex)

apt-get install texmaker

3. Then install the texlive-publishers package which has the IEEEtran classes. (It also has a number of other thesis/document formats too)

apt-get install texlive-publishers

Or you can combine all three steps together, but it would take a lot of time.

apt-get install texlive-full texmaker texlive-publishers

Happy TeXing :D. Ack: http://gic.gov.lk/gic/pdf/latex.txt


Thursday, April 21, 2011

 

Font problems using Texmaker on Ubuntu 10.04

I was trying to use Texmaker for an ACM paper, and it was constantly giving me errors like "Font OT1/ptm/m/n/10=ptmr7t at 10.0pt not loadable: Metric (TFM) file not found."
The problem was solved by running $
sudo apt-get install texlive-fonts-recommended



This page is powered by Blogger. Isn't yours?