Wednesday, December 11, 2013
Comeback!!
Tuesday, December 20, 2011
PDF-font-embedded problem or acrobat compatibility problem with PDFExpress ??
Error Font Times-Roman is not embedded (832x)
Error Font Times-BoldItalic is not embedded (14x)
Error Font Times-Bold is not embedded (32x)
Error Font Times-Italic is not embedded (66x)
I embedded all fonts and submitted second time and then I got the error :
Error Acrobat version is less than 5.0
But after third submission I got the message, paper has been passed all the basic formatting requirement. So I thought to share the solution with you guys.
Here is the steps i followed:
1> latex file.tex
2> dvips file.dvi -o file.ps
3> ps2pdf -dEmbedAllFonts=true -dSubsetFonts=true -dEPSCrop=true -dPDFSETTINGS=/prepress file.ps
Alternate solution:
Use ghost script pdf printer to embed all fonts and convert into PDF.
gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=a4 -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=Final.pdf Final.ps
Some more same kind of solution: Link1 Link2
Good luck !!
Friday, November 25, 2011
Implemenations of BFS & DFS traversal for Graph using adjancency Matrix (Java)
import java.io.BufferedInputStream;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Stack;
/**
*
* @author santosh
*/
public class AdjMatGraph {
class Queue {
LinkedList
int size;
public void enqueue(GNode gn) {
size++;
queueHead.add(gn);
}
public GNode dequeue() {
if (size > 0) {
size--;
return queueHead.removeLast();
}
return null;
}
public GNode peek() {
return queueHead.getFirst();
}
public GNode tail() {
return queueHead.getLast();
}
public int qSize() {
return size;
}
public boolean isEmpty() {
if (size <= 0) {
return true;
} else {
return false;
}
}
}
private class GNode {
int vLabel;
boolean isVisited;
}
private int adjMat[][];
private int noOfEdges;
private int noOfVertex;
private GNode vertex[];
private Stack
private Queue queue;
public AdjMatGraph() {
adjMat = new int[100][100];
for (int i = 0; i < 100; i++) {
for (int j = 0; j < 100; j++) {
adjMat[i][j] = 0;
}
}
noOfEdges = 0;
noOfVertex = 0;
vertex = new GNode[100];
for (int k = 0; k < 100; k++) {
vertex[k] = new GNode();
vertex[k].isVisited = false;
vertex[k].vLabel = -1;
}
stack = new Stack
queue = new Queue();
}
public void setNoEdges(int val) {
noOfEdges = val;
}
public void setNoVertex(int val) {
noOfVertex = val;
for (int i = 1; i <= val; i++) {
vertex[i - 1].vLabel = i;
}
}
public int findVertex(int v) {
for (int i = 0; i < noOfVertex; i++) {
if (vertex[i].vLabel == v) {
return i;
}
}
return -1;
}
public void addEdge(int v1, int v2) {
int index1 = findVertex(v1);
int index2 = findVertex(v2);
if (index1 != -1 && index2 != -2) {
adjMat[index1][index2] = 1;
adjMat[index2][index1] = 1;
}
}
public void printMatrix() {
for (int i = 0; i < noOfVertex; i++) {
System.out.println();
for (int j = 0; j < noOfVertex; j++) {
System.out.print("\t" + adjMat[i][j]);
}
}
}
public GNode getAdjNode(GNode node) {
int index = findVertex(node.vLabel);
if (index != -1) {
for (int i = 0; i < noOfVertex; i++) {
if (adjMat[index][i] == 1 && !vertex[i].isVisited) {
// System.out.println("GetAdj: " + vertex[i].vLabel);
return vertex[i];
}
}
}
return null;
}
public void DFS() {
System.out.print("DFS: ");
for (int i = 0; i < noOfVertex; i++) {
if (!vertex[i].isVisited) {
stack.add(vertex[i]);
while (!stack.isEmpty()) {
GNode tmp = stack.pop();
if (!tmp.isVisited) {
tmp.isVisited = true;
System.out.print("\t" + tmp.vLabel);
// get adjacent node
GNode t2 = getAdjNode(tmp);
if (t2 != null) {
stack.add(t2);
}
}
}
}
}
for (int i = 0; i < noOfVertex; i++) {
vertex[i].isVisited = false;
}
}
public void BFS() {
System.out.print("\nBFS: ");
for (int i = 0; i < noOfVertex; i++) {
if (!vertex[i].isVisited) {
vertex[i].isVisited = true;
System.out.print("\t" + vertex[i].vLabel);
queue.enqueue(vertex[i]);
while (!queue.isEmpty()) {
GNode tmp = queue.dequeue();
GNode v = null;
tmp.isVisited = true;
while ((v = getAdjNode(tmp)) != null) {
v.isVisited = true;
System.out.print("\t" + v.vLabel);
queue.enqueue(v);
}
}
}
}
System.out.println();
for (int i = 0; i < noOfVertex; i++) {
vertex[i].isVisited = false;
}
}
/**
* This section contains function to help implement Directed Graph
* and topological sorting.
*/
public void addDirectEdge(int v1, int v2) {
int index1 = findVertex(v1);
int index2 = findVertex(v2);
if (index1 != -1 && index2 != -1) {
adjMat[index1][index2] = 1;
}
}
public int noSuccessor() {
for (int i = 0; i < noOfVertex; i++) {
boolean isVisited = false;
for (int j = i; j < noOfVertex; j++) {
if (adjMat[i][j] > 0) {
isVisited = true;
break;
}
}
if (!isVisited) {
return i;
}
}
return -1;
}
public void deleteVertex(int index) {
//int index = findVertex(v);
if (index != noOfVertex - 1) {
// System.out.println("No of Vertex: " + noOfVertex + "\tindex: " + index);
for (int i = index; i < noOfVertex-1; i++) {
vertex[i].vLabel = vertex[i + 1].vLabel;
moveRowUp(i, noOfVertex); // shift all rows next to given vertex to 1 row up.
moveColLeft(i, noOfVertex-1); // shift all column to 1 left from given vertex.
}
}
noOfVertex--;
}
public void topologicalSorting(){
int orig_nVerts = noOfVertex;
while(noOfVertex > 0){
int currVertex = noSuccessor();
if(currVertex == -1){
System.out.println("There is Cycle !!");
return;
}
//System.out.println("Total Vertex: " + noOfVertex + "\tCurrent Vertex: " + vertex[currVertex].vLabel + "\tIndex: " + currVertex);
// insert vertex label in sorted array (start at end)
sortedArray[noOfVertex-1] = vertex[currVertex].vLabel;
// delete vertex
deleteVertex(currVertex);
/*
System.out.println();
printMatrix();
System.out.println();
*
*/
}
System.out.print("Topological Sorted: ");
for(int i=0; i
}
System.out.println();
}
// ------------------
private void moveRowUp(int row, int length) {
for (int col = 0; col < length; col++) {
adjMat[row][col] = adjMat[row + 1][col];
}
}
// ------------------
private void moveColLeft(int col, int length) {
for (int row = 0; row < length; row++) {
adjMat[row][col] = adjMat[row][col + 1];
}
}
// ------------------------------------------------------------
public static void main(String args[]) {
AdjMatGraph graph = new AdjMatGraph();
Scanner stdin = new Scanner(new BufferedInputStream(System.in));
System.out.println("Please enter the #vertex #Edges !!");
graph.setNoVertex(stdin.nextInt());
graph.setNoEdges(stdin.nextInt());
System.out.println("Please enter the Edges
while (true) {
if (stdin.hasNextInt()) {
//System.out.println(stdin.nextInt());
graph.addEdge(stdin.nextInt(), stdin.nextInt());
} else {
break;
}
}
graph.printMatrix();
System.out.println("\n");
graph.DFS();
System.out.println();
graph.BFS();
}
}
Tuesday, November 22, 2011
Binary Tree Implementation (Java Code)
/**
*
* @author santosh
*/
public class Node {
Node left;
Node right;
Node parent;
int val;
int height;
int balanceFactor;
int NaV = -99999999; // not a value.
public Node(){
left = right = parent = null;
val = height = balanceFactor = NaV;
}
public Node(int val){
left = right = parent = null;
this.val = val;
height = balanceFactor = NaV;
}
public Node(int val, int key){
left = right = parent = null;
this.val = val;
this.balanceFactor = key;
height = NaV;
}
}
BST.java
/**
*
* @author santosh
*/
public class BST {
private Node root;
public BST(){
root = null;
}
/**
* Insert a node in given tree.
* @param val
*/
public void insert(int val){
Node t = new Node(val);
if(root == null){
root = t;
return;
}else{
Node temp = root, prev = null;
while(temp != null){
prev = temp;
if(val > temp.val){
temp = temp.right;
}else{
temp = temp.left;
}
}
t.parent = prev; // assign the parent to new node;
if(val > prev.val)
prev.right = t;
else
prev.left = t;
}
return;
}
/**
* Find the node whose data is given.
* @param t
* @param val
* @return
*/
public Node findNode(Node t, int val){
Node temp = null;
if(t != null && t.val == val)
return t;
if(t.left != null)
temp = findNode(t.left, val);
if(temp == null & t.right != null)
temp = findNode(t.right, val);
return temp;
}
/**
* Returns the min value in a non-empty binary search tree.
* @param t
* @return
*/
public Node findMin(Node t){
if(t != null && t.left == null)
return t;
else
return findMin(t.left);
}
/**
* Returns the min value in a non-empty binary search tree.
* @param t
* @return
*/
public Node findMax(Node t){
if(t != null && t.right == null)
return t;
else
return findMax(t.right);
}
/**
* Print path of each leaf node in recursive order.
* @param sum
* @param t
* @return
*/
public int printPath(int sum, Node t){
while(t != null){
System.out.print("\t" + t.val);
sum += t.val;
t = t.parent;
}
return sum;
}
/**
* Print leaf nodes
* @param t
*/
public void printLeafNodes(Node t){
if(t != null && t.left == null && t.right == null){
System.out.print("\t" + t.val);
}
if(t != null){
printLeafNodes(t.left);
printLeafNodes(t.right);
}
return;
}
/**
* find path for each leaf node
* @param t
*/
public void findPath(Node t){
if(t != null && t.left == null && t.right == null) {
System.out.print("Path: ");
int sum = printPath(0, t);
System.out.println("\tSum: " + sum);
}
if(t != null){
findPath(t.left);
findPath(t.right);
}
return;
}
/**
* Check if any path has given sum.
* @param t
* @param sum
* @return
*/
public boolean hasPathSum(Node t, int sum){
if(t == null)
return (sum == 0);
else{
sum -= t.val;
return hasPathSum(t.left, sum) || hasPathSum(t.right, sum);
}
}
/**
* Make mirror image of given tree.
* @param t
*/
public void mirrorTree(Node t){
if(t == null)
return;
Node temp = null;
mirrorTree(t.left);
mirrorTree(t.right);
temp = t.left;
t.left = t.right;
t.right = temp;
return;
}
/**
* For each node in a binary search tree, create a new duplicate node, and insert
* the duplicate as the left child of the original node.
* The resulting tree should still be a binary search tree. So the tree...
* 2
* / \
* 1 3
* Is changed to...
* 2
* / \
* 2 3
* / /
* 1 3
* /
* 1
*
**/
public void doubleTree(Node t){
if(t == null)
return;
Node oldLeft = null;
doubleTree(t.left);
doubleTree(t.right);
oldLeft = t.left;
t.left = new Node(t.val);
t.left.parent = t; // assign parent to new node
t.left.left = oldLeft;
if(t.left.left != null)
t.left.left.parent = t.left; // update the parent for old node
}
/**
* Given two trees, return true if they are structurally identical.
* @param t1
* @param t2
* @return
*/
public boolean checkMatchingTree(Node t1, Node t2){
// both empty
if(t1 == null && t2 == null)
return true;
else if(t1 != null && t2 != null)
return (t1.val == t2.val &&
checkMatchingTree(t1.left, t2.left) &&
checkMatchingTree(t1.right, t2.right));
else // one of them empty
return false;
}
/**
* Count number of nodes in a given tree.
* @param t
* @return
*/
public int countTNode(Node t){
if(t == null)
return 0;
else
return (countTNode(t.left) + 1 + countTNode(t.right));
}
/**
* For the key values 1...numKeys, how many structurally unique binary
* search trees are possible that store those keys?
* Strategy: consider that each value could be the root.
* Recursively find the size of the left and right subtrees.
* @param key
* @return
*/
public int countTrees(int key){
if(key <= 1)
return 1;
else{
// there will be one value at the root, with whatever remains
// on the left and right each forming their own subtrees.
// Iterate through all the values that could be the root...
int sum = 0;
int lht, rht, rt = 0;
for(rt=1; rt<=key; rt++ ){
lht = countTrees(rt-1);
rht = countTrees(key-rt);
// number of possible trees with this root == left*right
sum += lht * rht;
}
return sum;
}
}
/**
* Find the maximum depth of a given tree.
* @param t
* @return
*/
public int maxDept(Node t){
if(t == null)
return 0;
int lDepth = maxDept(t.left);
int rDepth = maxDept(t.right);
return (lDepth>rDepth)?(lDepth+1):(rDepth+1);
}
/**
* Print the tree in In-Order.
* @param t
*/
public void printInOrder(Node t){
if(t == null)
return;
printInOrder(t.left);
System.out.print("\t"+t.val);
printInOrder(t.right);
}
/**
* print the tree in Post-Order.
* @param t
*/
public void printPostOrder(Node t){
if(t == null)
return;
printPostOrder(t.left);
printPostOrder(t.right);
System.out.print("\t"+t.val);
}
/**
* Print the tree in Pre-order.
* @param t
*/
public void printPreOrder(Node t){
if(t == null)
return;
System.out.print("\t"+t.val);
printPreOrder(t.left);
printPreOrder(t.right);
}
/**
* Get root of the node.
* @return
*/
public Node getRoot(){
return root;
}
}
Monday, November 14, 2011
NS2: How add/implement a new protocol into ns2 network simulator
1. copy the ping.h & ping.cc to ns2-xx/apps and renamed it myping.h & myping.cc respectively.
2. Define MyPing Packet type in packet.h as:
a) // insert new packet types here
static const packet_t PT_MYPING = 62;
static packet_t PT_NTYPE = 63; // This MUST be the LAST one
b) class p_info { .........
static bool data_packet(packet_t type) {
..................................
(type) == PT_MYPING\
-----------------------------
static void initName()
------------------------------
name_[PT_MYPING]="MyPing";
//------------------------------------
name_[PT_NTYPE]= "undefined";
.....................................................
c) #define DATA_PACKET(type) ( (type) == PT_TCP || \
...........................................
(type) == PT_MYPING \
...........................................
3) Define default value of MyPing agent in ns-default.tcl
Agent/MyPing packet_size 64
4) Edit Makefile inside ns2-xx dir and add "apps/myping.o" next to "apps/ping.o"
5) make clean and then make
You may follow these links for more information related to implementation:
http://www.isi.edu/nsnam/ns/tutorial/nsnew.html
http://nile.wpi.edu/NS/
Thanks
--
Wednesday, November 9, 2011
Have you tried to model your life?
Here is life cycle that goes along with time....
fun time over....
bye
Monday, October 17, 2011
Move Window Buttons to Right in Ubuntu
Step1: Press Alt+F2 to bring up the Run Application dialog box, enter “gconf-editor” in the text field, and click on Run.
Step2: Click on the + button next to the “apps” folder, then beside “metacity” in the list of folders expanded for apps, and then click on the “general” folder.
Step3: The button layout can be changed by changing the “button_layout” key and Change the text in the Value text field to:
menu:maximize,minimize,close
Ubuntu 11.04 / 11.10 :
Run the following command on terminal :
gconftool-2 --set /apps/metacity/general/button_layout \
--type string "menu:minimize,maximize,close"
Ubuntu 12.04 / 12.10 :
Run the following command on terminal:
gsettings set org.gnome.desktop.wm.preferences \
button-layout ':minimize,maximize,close'
Or, open dconf-editor and navigate to org/gnome/desktop/wm/preferences, and then change the value of button layout to :minimize,maximize,close
Tuesday, September 13, 2011
[Bibtext][Latex] RFC citation issues into conference paper or journal
Citing RFC :
@techreport{rfc2358,
AUTHOR = "Flick, J and Johnson, J.",
TITLE = "{Definitions of Managed Objects for the Ethernet-like}",
HOWPUBLISHED = {Internet Requests for Comments},
TYPE="{RFC}",
NUMBER=2358,
PAGES = {},
YEAR = {1998},
MONTH = {June},
ISSN = {2070-1721},
PUBLISHER = "{RFC Editor}",
INSTITUTION = "{RFC Editor}",
URL={http://www.rfc-editor.org/rfc/rfc2358.txt}
}
Citing RFC Drafts:
@TECHREPORT{draft-ipng-gseaddr-00.txt,
AUTHOR="M. O'Dell",
TITLE="{GSE: An Alternate Addressing Architecture for IPv6}",
HOWPUBLISHED="{Working Draft}",
TYPE="{Internet-Draft}",
NUMBER="draft-ipng-gseaddr-00.txt",
INSTITUTION="{IETF Secretariat}",
DAY=24,
MONTH=Feb,
YEAR=1997
}
More information:
1. Recommendations of a committee on RFC citation issues draft-carpenter-rfc-citation-recs-01
2. Using The ISSN (International Serial Standard Number) as URN (Uniform Resource Names) within an ISSN-URN Namespace
Monday, September 12, 2011
Saturday, March 19, 2011
Sunday, December 26, 2010
The Quarter-Life Crisis
Link: http://www.cds.caltech.edu/~shane/text/quarterlifecrisis.html
Thursday, December 2, 2010
Ubuntu Login problem using GUI interface
Since you are not able to login through GUI but you can still login using terminal. Press
some other problems are also there but i m not sure whether they are related to above said problem or not. So I am skipping those issue, may be I'll write later :)
Wednesday, November 3, 2010
upgrading Ubuntu to new release (9.10 to 10.04)
Open a terminal and follow the following steps:
1. sudo apt-get update
2. sudo apt-get install update-manager-core
3. check : /etc/update-manager/release-upgrades and see if Prompt=normal is there. If not edit the file and set Prompt=normal
4. sudo do-release-upgrade
PS: you should have good internet connection to upgrade your system using above steps.
For upgrading from ubuntu cd : read here
Tuesday, July 6, 2010
Confused & Idiotic feeling
Hope it will get over soon and i'll start again feeling life in better view :)
Wednesday, May 26, 2010
Writing CD/DVD ISO file using cdrecord on Linux Machine
Here is the command by using you can burn CD/DVD.
CD:
# cdrecord -v -dao speed=4 dev=/dev/cd /path/to/Fedora-13-i386-CD.iso
CDRW:
# cdrecord -v -dao speed=4 dev=/dev/cdrw /path/to/Fedora-13-i386-CD.iso
DVD:
# cdrecord -v -dao speed=4 dev=/dev/dvd /path/to/Fedora-13-i386-DVD.iso
DVDRW:
# cdrecord -v -dao speed=4 dev=/dev/dvdrw /path/to/Fedora-13-i386-DVD.iso
Check the different options which is used in above commands:
-v - turns on verbose mode.
-dao - puts us in Disc At Once mode. Since you're burning an ISO image here, you don't want to add any more data later in a future 'session', so you can just instruct cdrecord to put it in one session and finalise the disc.
speed=4 - you keep the burning speed down as it is more likely to burn properly and not fail. You can experiment with higher speeds if you want, but don't go higher than either your media or burner state they can do (and do
dev=/dev/dvd - this is the device node for your DVD drive. It's usually safe to put /dev/dvd here, but if that doesn't work, you may need to use /dev/cdrom or something else.
Finally, specify the path to the ISO image you want to burn.
--Enjoy !!
Saturday, January 23, 2010
Read your email on Gmail in your own language using Google Translator(Lab product)
रन:
निर्धारित एक नया 'डोमेन घ'
BuildNetwork बुलाया
################ बनाएँ डेटा नोड ################### के लिए फ़ाइल
पिछले पढ़ें सूचकांक: 0
# # # # में आवागमन फाइल विवरण #####
नोड संख्या दर्ज करें, और लिंक-नंबर:
# # # # बाहर आवागमन फाइल विवरण #####
नोड संख्या दर्ज करें, और लिंक-नंबर:
नोड संख्या दर्ज करें, और लिंक-नंबर:
नोड संख्या दर्ज करें, और लिंक-नंबर:
java.lang.StringIndexOutOfBoundsException: string सीमा से बाहर सूचकांक: -1
(String.java: 1949 java.lang.String.substring पर)
BBN.StructureLearn.createHuginInputFile पर (StructureLearn.java: 234)
-----------------
COM.hugin.HAPI.ExceptionHugin.throwException पर (ExceptionHugin.java: 81)
COM.hugin.HAPI.Domain.parseCase पर (Domain.java: 1382)
------------------------------------------------
Wednesday, January 6, 2010
Happy new year 2010 :)
I had good vacation at home in December. This was my second visit to home after 10 month since I have visited my home last time.
Hope for good year for me and my career.
Tuesday, November 3, 2009
"SAVE TADA 1 Nov" mission accomplished !!

After media addressing we again went to up hill and enjoyed swimming at least 2-3 hr. Around 5 we started from there and reached Chennai 9 PM. Finally I was in hostel at 11 PM. It was great fun with participation in social cause. Peter is planning second "SAVE TADA" mission. Date is yet to be announced.
PS: If you also want to be part of social cause trek please visit www.chennaitrekkers.orgWednesday, October 28, 2009
No sound after installing Windows Version OS on Virtual Box
Finally I set my settings in Alsa-mixture and AC-97 audio controller. But this also did not works. But luckly I got the solution from Virtual Box bug report. For solution I downloaded AC'97 Audio Codecs from http://www.realtek.com.tw . After installing AC'97 codecs, Windows 7 automatically ditected sound. Now Windows 7 have full feature on Virtual Box and I am enjoying testing of Windows 7 on Virtual Box.
PS: Which software you have to download and instal
1. Go to http://www.realtek.com.tw
2. Click on "Downloads", then on "AC'97 Audio Codecs". On the downloads page I downloaded the file with the description "Vista/Win7 (32/64 bits) Driver only (ZIP file)".
3. Extracte the files and run setup.exe from "6303_Vista_Win7_PG537" folder.
Saturday, October 10, 2009
Parental Guidance Rating for my Blogs
This rating was determined based on the presence of the following words:
- xxx (2x)
- hurt (1x)
Check yours here if you are also interested to know your blogs rating :)
