Search This Blog

Monday, October 29, 2012

Node Class in C++

A node class is a class that,
  > relies on the base class for services and implementation,
  > provides a wider interface to the users than its base class,
  > relies primarily on virtual functions in its public interface
  > depends on all its direct and indirect base class
  > can be understood only in the context of the base class
  > can be used as base for further derivation
  > can be used to create objects.
A node class is a class that has added new services or functionality beyond the services inherited from its base class.

Latex Spelling and Grammar Check

Latex Spelling and Grammar Check

dividing line
This document contains information on how to conduct spell and grammar checking of Latex documents. It supposes you have a Latex file called check.tex.

Spell check using aspell

  1. Close the editor for the file, otherwise the file cannot be updated.
  2. Type aspell --mode=tex -c filename in the terminal — so in this example type aspell --mode=tex -c check.tex.
  3. The programme will show the typos one by one. Suggestions for corrections are given as well.
  4. At the end your original Latex file will be updated.

Grammar check (+ spell check)

The procedure described here involves converting your Latex document to HTML, importing this into MS Word, and finally using the grammar checker in Word.
  1. Type latex2html -no_navigation -split 0 check.tex in the terminal. This directs the program to generate output that is (largely) confined to one HTML file, and without added navigation links.
  2. A folder named check is created, which will contain various files; the most important one being check.html
  3. Open check.html in the above folder using MS Word.
  4. Go to Tools --> Spelling and Grammar, to perform checking.
  5. Note that any changes made are only in the file check.html. You will need to update your original Latex file separately.

Possible problems

aspell

You can check the availability of aspell by typing:
aspell --version
[Please note the double hyphens, '--'.] If it is available, then you should see something like:
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.6)

latex2html

You can check the availability of latex2html by typing:
latex2html --version
If it is available, then you should see the message:
This is LaTeX2HTML Version 2008 (1.71)
by Nikos Drakos, Computer Based Learning Unit, University of Leeds. 
 
 
You can let TeX (rather luaTeX) do the spell checking for you! For example, in ConTeXt MkIV, you can use
\loadspellchecklist[en][wordlist.txt]
\setupspellchecking[state=start]
where en is the current language (you can set different word lists for different languages), and wordlist.txt is a sorted list of correct words. For a complete example, see the ConTeXt wiki

 
 
https://plus.google.com/u/0/100253604603876380275/posts  

Thursday, October 25, 2012

Fancy LaTeX chapter styles

Fancy LaTeX chapter styles

Many books, theses and reports are written in LaTeX using the report or book document classes. Often, the authors make use of the default chapter style. There are, however, a great number of alternative styles available, some of which being very fancy or playful. This post is a collection of alternative chapter styles available, some as packages, others simply in form of LaTeX code.

Default chapter style
The default chapter style is often used in (academic) books and theses. Here is an example:
1\documentclass{report}
2\begin{document}
3\chapter{Default Chapter Heading}
4\end{document}


Package titlesec
The titlesec package allows basic changes to the standard chapter style, including setting the font style and size or placement of the title. You can do great things with titlesec package and the titleformat command in particular, just be creative (and let me know below)!
Here is a neat example:

01\documentclass{report}
02\usepackage[T1]{fontenc}
03\usepackage{titlesec, blindtext, color}
04\definecolor{gray75}{gray}{0.75}
05\newcommand{\hsp}{\hspace{20pt}}
06\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
07\begin{document}
08\chapter{Less is More}
09\blindtext
10\end{document}
See the documentation for more details.

Package fncychap
The fncychap package has a nice set of predefined chapter styles. The style is set through the optional argument when loading the package. Available styles include: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, and Bjornstrup. The package documentation has examples for all available styles. The package will use the LaTeX default chapter style in case the optional argument is not set (i.e. \usepackage{fncychap}).
1\documentclass{report}
2%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
3\usepackage[Sonny]{fncychap}
4\begin{document}
5\chapter{Sonny}
6\end{document}
Examples of Glenn and Bjornstrup chapter styles provided from the fncychap package:



Chapter styles with memoir
The memoir document class is more flexible in terms of chapter styles than report or book.
I will not go into detail since there is extensive documentation on the memoir document class (see page 83 onwards). Furthermore, there is additional documentation describing the memoir chapter styles including code examples and output. Below you’ll find one of the examples taken from that document named hansen.


Styling the chapter
Henrik Stuart wrote this article in 2007 with a series of great chapter styles. They are also based on the memoir document class and the PGF/TikZ package. Here is an example that I like a lot, simply beautiful!

LaTeX Notes: Structuring Large Documents

LaTeX Notes: Structuring Large Documents


As soon as you start to produce documents which have multiple chapters, or documents which are of any decent size, keeping all the source text in one file becomes unmanageable. There are two basic methods you can use for managing large documents; the first is very easy to use but limited in usefulness, so we'll get that out of the way first. In each case the idea is that you have some top level document file and a number of files that get included in this file automatically when you run LaTeX.

1 The Simple Method

Using the simple method, you set up a top level document like this:
\documentstyle{...}
...
\begin{document}
\input{firstfile}
\input{secondfile}
...
\input{lastfile}
\end{document}
You then segment your text into chunks, which you keep in the files firstfile.tex secondfile.tex and so on; each of these might be a chapter, or a major section. So, firstfile.tex might look like the following (note the use of the macro programname here; this isn't standard LaTeX, it's an instance of declarative formatting):
\section{Introduction}
Way back in the beginning of time,
people used a text formatter
called \programname{nroff} ...
When you run LaTeX on the top-level file, the contents of firstfile.tex, secondfile.tex and so on will then be read in at the specified points. This simply makes it easier to handle your text by breaking it into smaller chunks. Note the following:
  • The name of each included file must actually be something.tex, since LaTeX will automatically add the .tex ending when it looks for the file.
  • You can have nested calls of this sort---i.e., the file firstfile.tex could itself simply be something like:
    \chapter{Introduction}
    There are two sections to this introductory chapter.
    \input{firstsection}
    \input{secondsection}
    
  • From the previous example you can see that:
    • Each inputted file {\em isn't} a standalone LaTeX file (in particular, it doesn't have a \documentstyle{...} line or the \begin{document} and \end{document} lines).
    • You can intersperse calls to input with other arbitrary text and LaTeX commands.
This method is limited, in the following ways:
  1. If your intention is to avoid printing the whole file every time you format it, you have to explicitly comment out (or delete) the \inputs you don't want, and this has the consequence that page numbers, section numbers and so on will only take account of the non-commented-out input files (i.e., if you comment out the \input{firstfile} in the example above then secondfile will start on page 1 as Section 1).
  2. Worse, if you have cross-references betwen the different input files (e.g., suppose secondfile includes a \ref that refers to a \label in firstfile) then LaTeX won't be able to resolve the references.
As a result, this method is best suited to keeping stuff like figures and pictures in separate files, thus making the editing of the actual text less distracting. So, if you have a very complex figure constructed using the LaTeX picture environment, you might put it into a separate file and then include it in the following way:
You can see from the really complex figure 
in Figure~\ref{complex-figure} that my theory
is better than yours.
\begin{figure}
\input{myfigure1}
\caption{My really complex figure}\label{complex-figure}
\end{figure}

2 The More Complex Method

The more complex method of managing large documents is similar to the above, except that you use the \include command:
\documentstyle{...}
...
\begin{document}
\include{firstfile}
\include{secondfile}
...
\include{lastfile}
\end{document}
Again, LaTeX looks for firstfile.tex, and so on. Now, however, each included file gets its own .aux file. This is very important, because you can then do the following:
\documentstyle{...}
...
\includeonly{secondfile}
...
\begin{document}
\include{firstfile}
\include{secondfile}
...
\include{lastfile}
\end{document}
This tells LaTeX to consult the aux files corresponding to each included file, but only to actually include the text of the files listed in the \includeonly line. Because LaTeX looks at the other aux files, it knows about section and page numbers, cross-references, and so on. This means that the output will start at the appropriate page for the text in secondfile.tex, with appropriate section numbers and so on. Simply by changing the \includeonly line and reformatting, you can get different parts of the entire document printed, with all the numbering being that which you would get had you printed the entire document. One potential disadvantage of this method is that, unlike \input, each included file will automatically begin on a new page: so you don't want to use this for small arbitrary bits of a document (such as the example of an inputted figure in the previous section), but probably only for individual sections, or, if they are pretty large and deserve to start on a new page, individual subsections. In a document that consists of multiple chapters, each chapter will start on a fresh page anyway; so you can use this method to keep the text of individual chapters in separate files. For texts where you want to keep individual sections in separate files, one approach is to develop a large document using \includes and then for the final printing change them all to \inputs. So, while a text is being written, each chapter might be an included file which consists of multiple included sections; when any particular sections are printed as a result of being mentioned in the includeonly line, each section will start on a new page. For the final text, the section \includes can be replaced by \inputs so that only the chapters start on new pages.
Note that you can have multiple files specified in the includeonly line, but you have to specify the names separated by commas {\em with no intervening spaces}. So this is okay:
\includeonly{firstbit,lastbit}
but this is not:
\includeonly{firstbit, lastbit}
From the previous example you can see that you can format discontinuous parts of the text. Don't forget that LaTeX can only take account of aux files corresponding to files that are included, but not mentioned in the includeonly line, provided those aux files exist, so you have to format each bit (or all the bits at once by specifying them all in the includeonly line) at least once first.

Latex Sectioning

Sectioning commands provide the means to structure your text into units.
  • \part
  • \chapter (report style only)
  • \section
  • \subsection
  • \subsubsection
  • \paragraph
  • \subparagraph
  • \subsubparagraph (milstd and book-form styles only)
  • \subsubsubparagraph (milstd and book-form styles only)
All sectioning commands take the same general form, i.e.,
\chapter[optional]{title}
In addition to providing the heading in the text, the mandatory argument of the sectioning command can appear in two other places:
  1. The table of contents
  2. The running head at the top of the page
You may not want the same thing to appear in these other two places as appears in the text heading. To handle this situation, the sectioning commands have an optional argument that provides the text for these other two purposes.
The "sectioning commands" have *-forms that print a title, but do not include a number and do not make an entry in the table of contents. For example, the *-form of the \subsection command could look like:
\subsection*{Example subsection}

Linked list in C++

What is a linked list?

In any programming language, you can create something called a linked list. This is one of many essential data structures. Other structures are stacks, queues and deques. These will be discussed later on in the other tutorials.
Lets look at the term linked list and break it down. The word list is obvious in the respect of having a list of data. For example, you may have a list like this:
Fruits:
1. Apples
2. Oranges
3. Pears
4. Mangos
5. Peaches

etc ...
Now the term linked. This means that the list will be tied together. In some respects, it may look like this:
Apples --> Oranges --> Pears --> Mangos --> Peaches
Each item in the list is linked to another.

Nodes

These are the elements that make it possible to have a linked list. Without them, there would be no listing.
Each node contains two parts; a part for the data and a part for the address of the next element. As you can see, this will use pointers.
Here is the class for the nodes. An explination will follow.
template
class node{

private:
 T Data;
 node* Link;

public:
 //constructor
 node(){Link = 0;}
 node(T d) { Data = d; Link = 0; }

 //accessors
 T& data(){ return Data; }
 node*& link(){ return Link; }

};
A short class indeed but a lot has happened.
First, the private section. These will contain the elements for the data and the link to the next node. They are both a template of type T which can allow more than one data type. This was discussed in the templates tutorial. The reason the Link variable is of type node is because it will be pointing to another node in memory.
Now, the constructor. The default constructor will simply put the Link to 0 (or NULL) since you have not placed any other nodes in the list yet.
The other constructor will set the Data to the parameter d in addition to the Link to NULL. Again, you have not linked to another node yet.
Now the accessors and mutators. The two functions you see will act as both. First, the data() function will return the data (acting as the get function) in addition to allow you to change the Data (acting as the set) since you are referencing.
Second, the link() function will return the link to you but allow you to change the link. For example you may need to remove or insert something in a list and therefore change the link to that node.

Putting it together

Here is a small example that shows a linked list of characters. This will print each element of the list.

Example 1:
Simple Linked List

Download source code here (Right click - Save Tagret As...)
#include 
using namespace std;

template
class node{

private:
 T Data;
 node* Link;

public:
 //constructor
 node(){Link = 0;}
 node(T d) { Data = d; Link = 0; }

 //accessors
 T& data(){ return Data; }
 node*& link(){ return Link; }

};

int main(){

 node a('a'), b('b'), c('c');

        //give the address to the link:
 a.link() = &b;
 b.link() = &c;

        //print each element:
 cout << a.data() << endl;
 cout << b.data() << endl;
 cout << c.data() << endl;

        //the list looks like this:
        //a --> b --> c

return 0;
}

Transversing the list

When you transverse a linked list, it means that you are looking at each element in the list. With the list example above, you are starting at the beginning of the list with the cout statements.
We can write a function that handles the printing instead of using an x number of cout statements in the main(). The function is below:
template 
void print (node* p){

     //as long as the list is not empty:
     while(p){
 cout << p -> data();
 p = p -> link();
     }

}
The argument is a pointer that will begin at some point in the list. You can decide where it begins. The while loop will keep going until the pointer is 0 (or NULL). Remember, a while loop will run with any number so long as it is not 0.
Now, let's append the above program and see the function at work:

Example 2:
Simple Linked List II

Download source code here (Right click - Save Tagret As...)
#include 
using namespace std;

template
class node{

private:
 T Data;
 node* Link;

public:
 //constructor
 node(){Link = 0;}
 node(T d) { Data = d; Link = 0; }

 //accessors
 T& data(){ return Data; }
 node*& link(){ return Link; }

};

template 
void print (node* p){

     //as long as the list is not empty:
     while(p){
 cout << p -> data();
 p = p -> link();
     }

};

int main(){

 node a('a'), b('b'), c('c');

        //give the address to the link:
 a.link() = &b;
 b.link() = &c;

        //start at beginning:
        print(&a);

        //the list looks like this:
        //a --> b --> c

return 0;
}
The function will begin printing from the first node. Had you given the print function a NULL node, it would not even print anything based on the while statement.

Tuesday, October 23, 2012

Applications of Semidefinite Programming

Applications of Semidefinite Programming

BY
 
L. Vandenberghe and S. Boyd
Applied Numerical Mathematics, 29:283-299, 1999
A wide variety of nonlinear convex optimization problems can be cast as problems involving linear matrix inequalities (LMIs), and hence efficiently solved using recently developed interior-point methods. In this paper, we will consider two classes of optimization problems with LMI constraints:
  • The semidefinite programming problem, i.e., the problem of minimizing a linear function subject to a linear matrix inequality. Semidefinite programming is an important numerical tool for analysis and synthesis in systems and control theory. It has also been recognized in combinatorial optimization as a valuable technique for obtaining bounds on the solution of NP-hard problems.
  • The problem of maximizing the determinant of a positive definite matrix subject to linear matrix inequalities. This problem has applications in computational geometry, experiment design, information and communication theory, and other fields. We review some of these applications, including some interesting applications that are less well known and arise in statistics, optimal experiment design and VLSI.

Monday, October 22, 2012

Drawing Horizontal Lines in LaTeX

Drawing Horizontal Lines in LaTeX



Lines can be drawin in LaTeX using the \line function. This takes an x-slope, y-slope and length like so:
\line(x-slope,y-slope){length}
To draw a horizontal line (or horizontal rule), set the x-slope to 1 and the y-slope to zero.
Depending on the margins which have been set, a length of 450 will draw a line which is the width of the page (minus the margins).
If you’re looking for a clean line to divide the page, try the following:
\begin{center}
\line(1,0){250}
\end{center}

LaTeX: Changing the Font Size

LaTeX: Changing the Font Size

Latex provides 10 different font sizes. To change the size of a font use a new font size parameter. The different font sizes are listed below.
  • Font Sizes

    1. \tiny
    2. \scriptsize
    3. \footnotesize
    4. \small
    5. \normalsize
    6. \large
    7. \Large
    8. \LARGE
    9. \huge
    10. \Huge
All of these fonts are listed from smallest to largest. To change the size of the font use a '\' followed by one of the above font sizes before the TEXT you want to change. For example: \LARGE {This is an example of the LARGE font size} will produce:

This is an example of the LARGE font size

LaTeX Line and Page Breaking

LaTeX Line and Page Breaking

The first thing LaTeX does when processing ordinary text is to translate your input file into a string of glyphs and spaces. To produce a printed document, this string must be broken into lines, and these lines must be broken into pages. In some environments, you do the line breaking yourself with the \\ command, but LaTeX usually does it for you. The available commands are
  • \\ start a new paragraph.
  • \\* start a new line but not a new paragraph.
  • \- OK to hyphenate a word here.
  • \cleardoublepage flush all material and start a new page, start new odd numbered page.
  • \clearpage plush all material and start a new page.
  • \hyphenation enter a sequence pf exceptional hyphenations.
  • \linebreak allow to break the line here.
  • \newline request a new line.
  • \newpage request a new page.
  • \nolinebreak no line break should happen here.
  • \nopagebreak no page break should happen here.
  • \pagebreak encourage page break.

\\

 \\[*][extra-space]
The \\ command tells LaTeX to start a new line. It has an optional argument, extra-space, that specifies how much extra vertical space is to be inserted before the next line. This can be a negative amount. The \\* command is the same as the ordinary \\ command except that it tells LaTeX not to start a new page after the line.

\-

The \- command tells LaTeX that it may hyphenate the word at that point. LaTeX is very good at hyphenating, and it will usually find all correct hyphenation points. The \- command is used for the exceptional cases, as e.g.
 man\-u\-script

\cleardoublepage

The \cleardoublepage command ends the current page and causes all figures and tables that have so far appeared in the input to be printed. In a two-sided printing style, it also makes the next page a right-hand (odd-numbered) page, producing a blank page if necessary.

\clearpage

The \clearpage command ends the current page and causes all figures and tables that have so far appeared in the input to be printed.

\hyphenation

 \hyphenation{words}
The \hyphenation command declares allowed hyphenation points, where words is a list of words, separated by spaces, in which each hyphenation point is indicated by a - character, e.g.
  \hyphenation{man-u-script man-u-stripts ap-pen-dix}

\linebreak

 \linebreak[number]
The \linebreak command tells LaTeX to break the current line at the point of the command. With the optional argument, number, you can convert the \linebreak command from a demand to a request. The number must be a number from 0 to 4. The higher the number, the more insistent the request is. The \linebreak command causes LaTeX to stretch the line so it extends to the right margin.

\newline

The \newline command breaks the line right where it is. The \newline command can be used only in paragraph mode.

\newpage

The \newpage command ends the current page.

\nolinebreak

 \nolinebreak[number]
The \nolinebreak command prevents LaTeX from breaking the current line at the point of the command. With the optional argument, number, you can convert the \nolinebreak command from a demand to a request. The number must be a number from 0 to 4. The higher the number, the more insistent the request is.

\nopagebreak

 \nopagebreak[number]
The \nopagebreak command prevents LaTeX form breaking the current page at the point of the command. With the optional argument, number, you can convert the \nopagebreak command from a demand to a request. The number must be a number from 0 to 4. The higher the number, the more insistent the request is.

\pagebreak

 \pagebreak[number]
The \pagebreak command tells LaTeX to break the current page at the point of the command. With the optional argument, number, you can convert the \pagebreak command from a demand to a request. The number must be a number from 0 to 4. The higher the number, the more insistent the request is.

Latex Pagebreaks

Latex Pagebreaks

Besides the tricks talked about in the latex manual about pagebreaks and linebreaks, the following can be useful. A useful TeX command that can be used in LaTeX but is not mentioned in the LaTeX manual is \looseness.
\looseness+1 This is the start of a paragraph ....
tells latex/tex that is the paragraph can be made to take up one more line let it do so. This is useful for filling up an underfull page or forcing a line on to the next page (in cases where a singleton line already exists on the next page and looks bad).
\looseness-1 This is the start of a paragraph ....
Does the opposite. Latex/Tex will try to make the paragraph take up one less line. You can sometimes go back several pages and increase or decrease several paragraphs by one line to ensure a page looks nice.

General rules

The TeXbook is the major source for information on the pagebreaking algorithm unfortunately the algorithm is fairly complicated. In general page breaking is done by balancing the need to avoid widows and orphans, avoiding overfull pages, and avoiding underfull pages. It can do this by manipulating the glue (elastic space that can be found around figures, section heads, etc) and choosing where to break paragraphs. The tools the user can use for affecting pagebreaking are
\pagebreak[]
use to start a new page at the end of the current line. Without arguments if forces a page break. With arguments of 0,1,2,3, or 4 it suggests that this is a good place to break. 4 being equivalent to no argument and forcing the break. No extra space is put at the end of the page.
\nopagebreak
similar to \pagebreak except it prevents a pagebreak at the end of the current line. I rarely use it.
\samepage
pretty much as the latex manual says. I rarely use it.
\newpage
forces a break at the point and puts in space as needed at the end of the page.
\clearpage
similar to \newpage but figures are also printed
\cleardoublepage
similar to \clearpage but will force another page if needed so the next page with print is odd numbered.
Underfull \hboxes are the most common error for pages that don't fit exactly. Unless they look bad many people ignore them. You can try putting in some more elastic space. I confess I tend to use the tex commands for stretchable space (\vskip and \hskip) instead of the latex commands. The format is
\vskip 10pt plus 2pt minus 3pt
which says 10pts is best but tex/latex can go as high as 12pts or as low as 7pts without complaint. The default \parskip in 10pt article style is 0pt plus 1pt. The little stretch stops many underfull hbox errors. Don't forget the option of floating large diagrams by using the figure or table environment. If you don't use \caption argument within the figure, it won't be labelled which can be useful.

IIT Lingo

IIT Lingo
Agrawals A correspondence based coaching program for JEE. Now defunct
Apping  Applying to American Universities
Arbit Senseless
A Star  'A' Grade of the topper of the course , informally called 
Batka, Matka, Phudda Student of B.Tech, M.Tech and Ph.D. respectively
Bong Person from Bengal, Bengali. Often derogatory
BTP Acronym for B.Tech Project. A degree requirement
Bumps Curious ritual in which person is caught by arms and legs and dashed to the ground repeatedly to the accompaniment of kicks. It is spposed to show affection
Com C Computer Centre 
Convo The Convocation Hall 
Darshan Allowing someone to see you. Normally used in the context of holy men or shrines
Daru Liquor
Dassi Grade Point Average of 10 on 10. Usually also the person managing it. Has recently become extinct after the new grading policy
Dep Department
Dhabha Roadside eating joint
Dhakkan Literally meaning cap or lid, it is often used in a derogatory sense. Also used to designate last Hawa (see below) holder of a dep person
Enthu Enthusiasm
Fakka 'F' Grade
Fight Marna To try very hard 
Fundas/Funde Fundamentals. Often meaning motivation
Futcha First yearite. Freshman
Futchi Freshwoman
Hawa Stands for AIR, All India Rank in JEE
Hazaar Thousand, usually used for any large quantity
Insti Short for Institute meaning Academic area of IIT Delhi
IIM Indian Institute of Management. Four are extant A (Ahmedabad), B (Bangalore), C (Calcutta) and L (Lucknow)
IIT  Hammer A broken iron leg of the bed used as hammer, extinct now with advent of new design of bed
IMS Institute of Management Studies. A correspondence based coaching program for CAT
ISC  Indoor Sports Club
JEE The Joint Entrance Exam for entry to the 6 Indian Institutes of Technology nationwide
Kailash Name of the only girls hostel at IIT Delhi
Kailashite Resident of Kailash hostel
Kalu Dark person
Kara Karakoram hostel. One of the 5 male undergrad hostels of IIT Delhi
Karaite Resident of Karakoram Hostel
Khuphiya Cryptic, usually associated with secretive actions
Khiladi  Player, not exactly Sports
KLS The hostel area canteen
LIC Lady Irwin College. A girls college in Delhi
LT  Lecture Theatre
Majors Semester-end exams at IIT Delhi
Minors Mid-semester exams at IIT Delhi. Held twice a semester
ManPro Course in Manufacturing Processes. 4 credits for menial work
Magai Study
Maggu One who studies tooooo much
Nachun? Interrogative word, meaning should I dance? rumored to be a witty reply to some boring information
Nehli  Grade Point Average greater than 9 but less than 10. (On a scale of 10)
P K Palta Fell over drunk
Phatta A joke, or a lie
Photo Soc The Photgraphy Society of IITD 
Punjabi Person belonging to Punjab in North India
Poltu Contraction of politics, signifying campus politics. Never ideological in nature. Also a person who indulges in the same
Puppipana Action associated with a puppy (See below)
Puppy Quality of being out of line with a generally perceived set of norms. Not always negative. Also a person permanently possessing or temporarily acquiring such a quality
Undi Common abbreviation for underwear
Sasi Hostel gate day time eating joint
Schol Financial aid from American Universities
Sexy Anything good will be called as sexy 
Shady Used in various senses depicting dubiousness
Sick Bay IITD Hospital
Surd Shop The groccery shop of Bitto Sardar (unfortunately closed now)
Surdi Affectionate(?) term for a Punjabi(See above)
Sutta Cigarette
Taklu Baldy
Ulti The abbreviation of  Ultimate
Vela Lazy, person with no work. 
Zook A zero score in exam

Tuesday, October 16, 2012

QAPLIB - A Quadratic Assignment Problem Library

For more please see Home page for QAPLIB at :

http://www.seas.upenn.edu/qaplib/#intro


Contents

[ Postscript (9/96) | Compressed Data | Compressed Solutions ]
 

Introduction

The Quadratic Assignment Problem (QAP) has remained one of the great challenges in combinatorial optimization. It is still considered a computationally nontrivial task to solve modest size problems, say of size n=25. The QAPLIB was first published in 1991, in order to provide a unified testbed for QAP, accessible to the scientific community. It consisted of virtually all QAP instances that were accessible to the authors at that time. Due to the continuing demand for these instances, and the strong feedback from many researchers, a major update was provided by Burkard, Karisch and Rendl in 1994. This update was also accessible through anonymous ftp. This update included many new problem instances, generated by several researchers for their own testing purposes. Moreover, a list of current champions, i.e. best known feasible solutions, and best lower bounds was included.
The update of April 1996 reflected on one hand the big changes in electronic communication. QAPLIB became a World Wide Web site, the QAPLIB Home Page. On the other hand, the update was necessary, due to the increased research activities around the QAP. A short list of at-that-time-recent dissertations concerning QAP, was included.
The update of June 2000 reflects the progress made on the QAP especially on solving new test instances and test instances which were previously not solved to optimality. It includes an updated list of people working on the QAP and an updated list of surveys and dissertations on the QAP.
The update of January 2002 reflects the progress made more recently on the QAP. The emphasis relies on the optimal solution of test instances which were previously not solved to optimality. The optimal solutions were obtained by using new bounding techniques and new branch and bound schemes generally implemented in very powerful parallel computation environments. This update also includes new test instances and some improvements on the best known solutions of existing test instances. The list of people working on the QAP as well the list of references have also been updated.
 
 

Saturday, October 13, 2012

Disable unnecessary services in Ubuntu - Boot-Up Manager

The startup scripts located in /etc/init.d are part of the bootup sequence of every Debian-like distro. Very often Ubuntu's documentation and guides have suggested - in order to deactivate init scripts - to change the permissions of the scripts in /etc/init.d, making them non-executable. This will have the following consequences:

    * You'll get an error message at boot time (to avoid it you need to patch all the scripts);
    * You are breaking the logical chain stated in debian-policy concerning runlevel configuration.

If the logic of a debian-like system boot up sequence is not very clear and familiar to you, you should not play with symlinks, permissions, etc. In order to avoid messing up your system, Boot-Up Manager will automate all of your configuration in a nice and clean graphical interface.

Boot-Up Manager is a Perl-Gtk2 application to handle runlevels configuration of any debian derivative system. With this program the user will easily start and stop boot-up scripts, without the necessity to handle thru complex links and permissions.



Boot-Up Manager has been developed and tested on Ubuntu, but as it only relies on Perl-Gtk2 libraries, it can be run on any Debian-like system.

Installation:
BUM is currently in Debian unstable/testing and in all Ubuntu's repositories. These users can just apt-get it.

apt-get install bum

Other users of debian-derivative distro's can just download the .deb package and type, from a terminal:

sudo dpkg -i bum_2.1.8-1_all.deb

Your Boot-Up Manager is placed into System->Administration menu.

Tarball
Unpack your tarball and build the program:
tar -xvzf bum-2.2.0.tar.gz
cd bum-2.2.0
./configure --prefix=/usr
make
make install

Last command must be run with root privileges. Please read the INSTALL file, for configuration options.

Disable services on boot – Ubuntu 12.04

 You can install Boot-Up Manager from Ubuntu software center to enable or disable services on start up.

sudo apt-get install bum


or
 
To keep my desktop (notebook) machine light and responsive I don’t want unnecessary services starting on boot-time. Turns out Ubuntu is surprisingly cumbersome to configure in this area (compared to RedHat / Fedora).
Two services I need on my notebook, but don’t want them to start unless I require them running are MySQL and Apache. But it looks like some services are started using upstart init daemon and it appears there is no management tool for this. Services can pe prevented from auto-starting either by renaming the config file or commenting out the start line in the config file
sudo cp /etc/init/mysql.conf /etc/init/mysql.conf.modified
sudo rm /etc/init/mysql.conf

Or comment out the following line in the config file
sudo vim /etc/init/mysql.conf
#start on runlevel [2345]

Reference: http://upstart.ubuntu.com/cookbook/#disabling-a-job-from-automatically-starting
Other services are still started using rc.d such as Apache. They can be disabled using
sudo update-rc.d -f apache2 disable
Now these services should not start up when the machine boots and can be started manually
sudo service apache2 start
sudo service mysql start

Monday, October 08, 2012

how to create new user for phpmyadmin login ?


how to create new user for phpmyadmin login

PHPMyAdmin and MySQL server complement each other very well. In most situations you have installed mysql server and phpmyadmin.

By default the mysql root password is blank and this is a big security issue and you have change the mysql password as soon as possible. If that is not done anybody could login with phpmyadmin with username root and password blank. You also must avoid to login phpmyadmin with mysql root password. Instead you must create a new user (to phpmyadmin) with same privileges as mysql root.
First change the mysql root password
mysql > update user set password=password('XXXXX') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql > FLUSH PRIVILEGES;
Thats all! you have changed your mysql root password. All you have to do is login to phpmyadmin with username as root and password as new password.
Create a new phpmyadmin user
Now we will create a new administrator login (say sysadmin) for phpmyadmin which will have same privileges as mysql root.
Its just one line command;
mysql> GRANT ALL ON *.* TO 'sysadmin'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)
then
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
Now you can login to phpmyadmin as new administrator and avoid using root logins. You can create databases, change or insert or edit tables or do whatever you want!

Access MySQL Server From The Shell Prompt (Command Line)


Access MySQL Server From The Shell Prompt (Command Line)

How do I access MySQL server from the shell prompt (command line)?

MySQL software includes mysql client. It is a text-based client for mysqld, a SQL-based relational database server. It works interactive and non-interactive mode.

mysql Client Syntax

mysql -u {mysql-user} -p {mysql-password} -h {mysql-server}
Where,
  • -u {mysql-user} : Specify MySQL user name. Use root only when connecting to local system.
  • -p {mysql-password}: Specify password, Employ the specified password when connecting to the database server. If a password is not supplied, it will be requested interactively.
  • -h {mysql-server}: Connect to the specified host (remote or local)
For example remote connect to MySQL server called mysql10.nixcraft.in and user vivek:
$ mysql -u root -h localhost -p
Sample outputs:
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 4.1.15-Debian_1-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
You can type an sql statement at mysql> prompt. In this example, you will list tables from the demo database, run;
USE demo;
SHOW TABLES;
Sample session:
mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 31855130
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use nqod;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------+
| Tables_in_nqod |
+----------------+
| quotes         |
| quotes_meta    |
+----------------+
2 rows in set (0.00 sec)
mysql> \q
Bye
After typing an SQL statement, end it with ";" and press [Enter] key. To exit type quit or \q:
quit
OR
q
Sample session:
 mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 31853999
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> quit
Bye

Batch Mode

You can execute SQL statements in a script file (batch file) as follows:
mysql database_name < input.script.sql > output.file
mysql -u user -p'password' database_name < input.script.sql > output.file

Recommend readings:

Type the following command to mysql command man page:
man mysql


Creating a new user phpmyadmin


Managing User Permissions

Within phpMyAdmin, user management is controlled via the Privileges link from the main page. Users can be created, edited, and removed.


Creating a new user

To create a new user, click the Add a new user link near the bottom of the Privileges page (you must be a "superuser", e.g., user "root"). Use the textboxes and drop-downs to configure the user to your particular needs. You can then select whether to create a database for that user and grant specific global privileges. Once you've created the user (by clicking Go), you can define that user's permissions on a specific database (don't grant global privileges in that case). In general, users do not need any global privileges (other than USAGE), only permissions for their specific database.


Editing an existing user

To edit an existing user, simply click the pencil icon (Edit user priv.png) to the right of that user in the Privileges page. You can then edit their global- and database-specific privileges, change their password, or even copy those privileges to a new user.


Deleting a user

From the Privileges page, check the checkbox for the user you wish to remove, select whether or not to also remove any databases of the same name (if they exist), and click Go.


Assigning privileges to user for a specific database

Users are assigned to databases by editing the user record (from the Privileges link on the home page) not from within the Privileges link under the table. If you are creating a user specifically for a given table you will have to create the user first (with no global privileges) and then go back and edit that user to add the table and privileges for the individual table.

How to change the password for phpMyAdmin?

Can you run queries on your database? IF so you can do it using the built in Mysql commands.

SET PASSWORD FOR 'username'@'%' = PASSWORD('newpass');

You will have to change the username part (to probably pma) and the % part (to probably localhost).

So it becomes:

SET PASSWORD FOR 'pma'@'localhost' = PASSWORD('newpass');

For information on the SET PASSWORD command see: dev.mysql.com/doc/refman/5.0/en/set-password.html

To see exactly what user and domain (the localhost/% part) your account is using do:

SELECT User, Host FROM mysql.user;

That should show you all your mysql user accounts. Look for the one that looks like it's for PHPMyAdmin (probably pma).