Showing posts with label Technical. Show all posts
Showing posts with label Technical. Show all posts

Wednesday, May 07, 2008

swakkhar17@gmail.com - The Universal Mail Address


After joining my new job, I was given a new mail address. Important notices and mails were being sent to that mail by my colleagues. It was a hazard that i check two mail addresses daily. In fact i missed an important meeting this morning.

Gmail had solved the problem earlier for me by providing POP3mailfetcher and SMTPmailSender. Now I can send mails as "swakkhar17@yahoo.com" / whatever logging only into gmail account and also fetch the mails from the mailbox.

1. How to send mails?
2. How to fetch mails?

Friday, January 18, 2008

Technical Post # 2: Creating Own Bibliography Style Files

We often use latex for writing our reports. Some of these reports require to have very strict format. I faced a problem where the bibliographical references were also had some strict foramts. Example: Author name required Last name, Initials of First Name, and in case of "Inproceeding..." no "In...". A lot other requirements may be there. I searched google and there was an obvious solution: create own .bst file.

Using MakeBST

A very usefull tool for creating BibTeX styles is makebst. It's use is extremly simple: you just have to run LaTeX: latex makebst and answer a bunch of questions. An output file of type .bst will be created for use as any other bibliographic style.

Here is an extract of the questions you have to answer:

$ latex makebst
[...]
***********************************
* This is Make Bibliography Style *
***********************************
It makes up a docstrip batch job to produce
a customized .bst file for running with BibTeX
Do you want a description of the usage? (NO)

\yn=y
In the interactive dialogue that follows,
you will be presented with a series of menus.
In each case, one answer is the default, marked as (*),
and a mere carriage-return is sufficient to select it.
(If there is no * choice, then the default is the last choice.)
For the other choices, a letter is indicated
in brackets for selecting that option. If you select
a letter not in the list, default is taken.

The final output is a file containing a batch job
which may be (La)TeXed to produce the desired BibTeX
bibliography style file. The batch job may be edited
to make minor changes, rather than running this program
once again.

[...]
Name of the final OUTPUT .bst file? (default extension=bst)

\ofile=mystyle.bst

[...]
STYLE OF CITATIONS:
(*) Numerical as in standard LaTeX
(a) Author-year with some non-standard interface
(b) Alpha style, Jon90 or JWB90 for single or multiple authors
(o) Alpha style, Jon90 even for multiple authors
(f) Alpha style, Jones90 (full name of first author)
(c) Cite key (special for listing contents of bib file)
Select:

[...]
AUTHOR NAMES:
(*) Full, surname last (John Frederick Smith)
(f) Full, surname first (Smith, John Frederick)
(i) Initials + surname (J. F. Smith)
(r) Surname + initials (Smith, J. F.)
(s) Surname + dotless initials (Smith J F)
(x) Surname + pure initials (Smith JF)
(y) Surname + comma + pure initials (Smith, JF)
(z) Surname + spaceless initials (Smith J.F.)
(a) Only first name reversed, initials (AGU style: Smith, J. F., H. K. Jones)
(b) First name reversed, with full names (Smith, John Fred, Harry Kab Jones)
Select:
[...]
NUMBER OF AUTHORS:
(*) All authors included in listing
(l) Limited authors (et al replaces missing names)
Select:
[...]
TYPEFACE FOR AUTHORS IN LIST OF REFERENCES:
(*) Normal font for author names
(s) Small caps authors (\sc)
(i) Italic authors (\it or \em)
(b) Bold authors (\bf)
(u) User defined author font (\bibnamefont)
Select:
[...]

Installation

Now what you need is to put this file into your texmf directory.BIBTEX .bst files can be accessed system-wide when they are placed in the /bibtex/bst

Then for teTEX and fpTEX systems complete via executing

$texhash

as root. MikTEX users can run:
$initexmf -u

In your latex file:
\bibliographystyle{mystyle}

http://www.tsi.enst.fr/~ldenis/JMIbib.html


Tuesday, November 06, 2007

Technical Post # 1 : Making a Basic JNI Call

For many reasons we need to make JNI calls. Here I give an example of making a simple JNI call. Follow the steps

Step 1: Create a Java File that declares the native method (HelloWorld.java)

class HelloWorld
{
private native void print();

public static void main(String[] args)
{
new HelloWorld().print();
}

static
{
System.loadLibrary("HelloWorld");
}
}


Step 2: Compile the class using default java compiler javac, resulting a class file named HelloWorld.class

javac HelloWorld.java

Step 3: Use javah -jni to generate a C header file (HelloWorld.h). This header file will contain the prototype declaration for the native method to be implemented in C++.

javah -jni HelloWorld

Step 4: Write the C implementation (HelloWorld.c) of the native method.


#include
#include
#include "HelloWorld.h"

JNIEXPORT void JNICALL
Java_HelloWorld_print(JNIEnv *env, jobject obj)
{
printf("Hello World!\n");
return;
}


Step 5: Compile the C implementation into a native library, creating HelloWorld.dll
or libHelloWorld.so. Use the C compiler and linker available on the host
environment.

In Microsoft Visual Studio it can be easily done if we start a MFC dll project and then just include the header and implementation files.

Step 7: Put the dll into the Java project path and run the program.


Reference: java.sun.com/docs/books/jni/download/jni.pdf