Wednesday, December 12, 2012

To keep formatting when copying from Notepad to MS Word

Hey all,

I have always had trouble copy/paste MS Notepad texts to MS Word because usually the formatting goes away. It is important to keep formatting if you are especially copying guitar chords.

Here is what I do to keep the formatting.
  1. Copy the content from webpage to MS Notepad.
  2. Copy the text from MS Notepad to MS Word
  3. Change MS Word font to a fixed length font like Courier New
That's all!

cheers!!!

Wednesday, November 21, 2012

Jump back and forth in Code::Blocks

Hi all,

This is how it is done.

  1. First, you need the BrowseTracker plugin.
    • The BrowseTracker-plugin is part of the contrib-plugins. You can install it using the synaptic package manager (codeblocks-contrib)
  2. Once you have the BrowseTracker plugin you would see "Jump" tab in the "View" menu.
    • now you can use this "Jump" for navigating back and forth.
  3. However, to make things a little bit easier you can use the Keyboard shortcuts plugin to assign shortcuts.
    • Go to "Settings->Editor" in the menu bar.
    • Choose "Keyboard shortcuts"
    • In the Commands: option go to Menu bar->View->Jump and add your keyboard shorcuts
That's it!

Cheers!!!

Monday, November 19, 2012

head and tail for shell scripting

Hey guys,

Do you know the head and tail commands?
For example,

head -10 abc.txt > abc_left.txt
tail -10 abc_txt > abc_right.txt

  • The first command will read the first 10 lines from abc.txt and write them into a abc_left.txt file
  • The second command will read the last 10 lines from abc.txt and write them into a abc_right.txt file

Cool isnt' it?

Cheers!


Wednesday, October 10, 2012

MS Visio Drawings to .eps

Hey guys,

This is one way of doing it:

  1. For Microsoft Visio 2003, save the drawing in .wmf format
  2. Open it in Open-Office Draw utility and export to .eps: when you export, check the "selection" checkbox.
  3. If the .eps is not proper, play a bit with the margins.
Cheers!

Monday, October 1, 2012

LaTeX sections without section number

Hi guys,

This is actually very easy to do; you just have to use an asterix.

\section*{my_section}

that's all folks!

cheers!

Monday, September 24, 2012

BibTex export from Google Scholar

Hi guys,

If you want to import the BibTex reference of a paper from google scholar,
  • Go to Settings
  • In bibliography manager check "Show links to import citations into" choose BibTex
That's it!

cheers!!!

Images for XeLaTeX->pdf output profile

Hi guys,

  • I have been using LaTeX->PS output profile and the images were included using .eps format (.eps preserves image quality). But, this does not work if you use XeLaTeX profile as it does not support PS outputs.
  • To include the figures you have to convert them to .pdf format.
  • To convert your .eps figures into .pdf format you can use the epstopdf executable (it should be already installed by MikTex) by:
    • Windows prompt> epstopdf  file.eps

Thursday, September 20, 2012

Difference between LaTeX classes and packages

Hi guys,


  • The first thing to remember is that a document uses only one class, but it can use many packages. 
  • That means that particular class we use in our document (e.g. myclass.cls) sets the overall format, like the structure of the sections and etc.
  • A package, however, add more functionality to the document. For example tikz is a package which allows you to draw diagrams, but does not modify the document style at all.
  • A class file can also be based on another "one" class and multiple packages.

Wednesday, September 19, 2012

To start Firefox in Safe mode

Hey guys,

To start Firefox in safe mode just hold the shift key while Firefox is starting.
That's all!

Cheers!!!

Monday, August 13, 2012

Import .eps files in GIMP fail

Hey,

Today I am going to tell you how to overcome the problem of importing .eps files in GIMP software.
  • First, you have to have ghostscript (http://www.ghostscript.com/) installed in your system.
  • After that you have to set the environment variable GS_PROG set to the path of your ghostscript .exe location
    • to set the environment variable (Win7):
    • right click on My Computer -> Properties -> Advanced system settings -> Advanced tab -> Environment Variables
    • In system variables -> New
      • variable name : GS_PROG
      • variable value: e.g. E:\Program Files\gs\gs9.04\bin\gswin32.exe (insert the ghostscript path appropriately)
    • restart GIMP

LaTex \left and \right

Hi guys,

  • Today I will tell you what \left and \right means in LaTex.
  • Sometimes you need to enclose fractions in equations within tall brackets. That's where these \left and \right comes in to play.
    • syntax: \left c1 cmds \right c2
    • c1 and c2 are called enclosing symbols. Some of the frequently used enclosing symbols are: (  )  [  ]   \{   \}  |

        \left (\frac{a}{b} \right )




    • If you didn't use \left and \right, this is what you will get:
              (\frac{a}{b})
                   
    • Sometimes you may need such a symbol, but only at one side.
      • Then the syntax is: \left . cmds \right c2
      • That is, a period is used for the side where you do not use the enclosing symbol
                    \left . \frac{a}{b} \right |
                   
                       

    Thursday, August 2, 2012

    Standard deviation (SD), Standard error (SE) and Confidence Interval (CI)

    Hi all,

    I had a tough time understanding these 3 statistics and let me share what I understood with you guys.

    • The first thing we should know is that we will always be dealing with samples from a large population. For example, say we want to know the average height of a Japanese woman. We will measure the height of n=100 Japanese women and we will draw some conclusions about the entire Japanese women population.
      • Now, standard deviation (SD) of the 100 measurements will give us how our measurements vary around mean of the measurements.
      • the standard error (SE) (of the mean) will tell us the variability of our computed mean. I repeat; SD gave the variability of data around the mean and SE gives the variability of the computed mean, not the data around it.
      • finally, the confidence interval (CI) give us where the real mean of the large population might lie.

    • Now, how do we compute these 3 values?
      • SD is computed directly from our measurements.

      • SE is computed from SD.
                        This is how you get it.
        • if xi are n independent observations from a population that has a mean u, and standard deviation s then the variance of the total

    is ns^2 (because for two it will be s1^2 + s2^2)
        • The variance of T/n (mean) must be 1/n^2 * (ns^2) = s^2 / n
        • Thus, the standard deviation of T/n = s/(sqrt(n))

      • CIs are computed from the SE.
        • Say, we need a 95% CI, then
          • upper 95% limit =
          • lower 95% limit =
    1.96 comes from 0.975quantile of the normal distribution -- (100-95)/2%=0.975

    Thursday, July 26, 2012

    writing strings in excel by MATLAB

    Hey guys,


    When you want to write some value in an excel file from MATLAB, you can use:

    my_string = 'test';
    xlswrite('my_excel.xls', {my_string}, 'my_page', 'A1');

    where,
    my_excel.xls: file I need to write
    {my_string}: the content
    {} of my_string makes sure the whole string is written in one cell.
    my_page: the page of the escel file
    A1: the cell

    Sunday, July 1, 2012

    MS Excel: Get rid of rows that contain a particular string

    Hey guys,

    This is how it is done. We make use of macros to achieve this.

    1. If the developer tab is not visible make it visible as follows: (MS Excel 2007)
      1. Click the office button
      2. Then, click the Excel Options button
      3. Choose "Popular" tab
      4. In "Top option for working with Excel", tick the "Show developer tab in the Ribbon"

    2. Now go to the developer tab and click on the visual basic button.

    3. Double click on the sheet1(sheet1)...or the sheet you want the macro to run

    4. Now enter this code:

    5. Sub DoIt()
          Dim Sentences
          Dim i As Long
          Dim iWordPos As Integer
          
          Sentences = Range("A1", Range("A65536").End(xlUp))
          lRow = 0
          For i = Range("A65536").End(xlUp).Row To 1 Step -1
              iWordPos = InStr(LCase(Sentences(i, 1)), LCase("MyString"))
              If iWordPos > 0 Then
                  Range("A" & i).EntireRow.Delete shift:=xlShiftUp
              End If
          Next i
      End Sub

      'Comment : Range("A65536").End(xlUp) is the final cell
    6. Replace MyString with the string you want to search

    Monday, June 18, 2012

    Ubuntu Shell scripting for ROS

    Hi Guys,

    • Well, I have been using ROS (Robot Operating System: http://www.ros.org/wiki/) to develop my robotics packages and I have been syncing my packages between my laboratory and my home using Dropbox (https://www.dropbox.com/).
    • However, in my laboratory the PC is a 64 bit machine and at home I have a 32 bit machine. So, I have to build the packages from the beginning after syncing via Dropbox. When you have too many packages this is annoying.
    • Today I learned how to do this by a shell script.
    • I know it looks really childish but it does what I want.
    • Create a script file and enter the following into that file.
      • e.g. my_script.sh

    #!/bin/bash
    roscd my_pkg_one
    make clean
    rosmake my_pkg_one
    roscd my_pkg_two
    make clean
    rosmake my_pkg_two


    • Go to the directory where your file is located and make it executable.
      • chmod +x my_script.sh 
    •  Run you script
      •  . ./my_script.sh
        the first dot makes sure the commands are run from the current shell and not from a subshell


    • If you want to run your script from anywhere you can add the script path to the PATH environment variable.
      • export PATH=$PATH:~/my_scripts     tothe end of your ~/.bashrc file. 
      • finally source your .bashrc file by
        • source ~/.bashrc

    Sunday, June 17, 2012

    Environment variables in Ubuntu

    Hi guys,

    • I have been using the .bashrc file for long time but it was today that I understood clearly the syntax of export in .bashrc file.
    • Before, going into that let's get to know about the environment variables little bit more.
    • When we open a terminal session and type in a command like ls it is searched in the directories that are marked by the PATH variable.
    • PATH is an environment variable.
    • An environment variable is a variable that persists for the life of a terminal session. The applications running in that session can access these variables. A listing of all the environment variables can be obtained by
      • abc@def:~$ export
    • PATH environment variable has a special format. Use echo command to have a look at the variable:
      • abc@def:~$ echo $PATH
      • /usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:.
    • PATH variable is a : separated set of directories. All these directories will be searched when you execute a command in the terminal.
    • Let's give the PATH variable a different set of values
      • export PATH=/usr/bin:/usr/sbin
      • now, if we execute the ls command once again it will give an error because it no longer has /bin in the PATH variable.
    • Instead of changing or replacing the current set of directories in the PATH variable what you should do is to append it.
      • export PATH=$PATH:/new/path
      • echo $PATH  will now give you /usr/bin:/usr/sbin:/new/path
    • These changes, however, will be only valid to the current session. In order to making the changes permanent we can use a specific file called .bashrc file.
      • In Ubuntu (UNIX), files beginning with . are configuration files and are usually hidden.
      • To view these files use ls -a
    • The commands in .bashrc file get executed every time you start a new terminal
      • if you wish to have certain directories automatically added to PATH variable simply place those commands at the end of this file
     p.s.
    • If you are interested in knowing the full path of a binary like ls you can use the command which to find that out
      • e.g. abc@def:~$ which ls    will give you the result -> /bin/ls
        so, the executable ls is located in /bin directory


         

    credit should go to the original contributor at http://www.cs.purdue.edu/homes/cs348/unix_path.html

    Saturday, June 16, 2012

    Grub Customizer for Ubuntu 11.04

    Hey guys,

    • Some of you have already experienced that the program "startup manager" does not function in Ubuntu 11.04.
    • Use "Grub Customizer" instead.
    • Here are the steps:
      • sudo apt-add-repository ppa:danielrichter2007/grub-customizer
      • sudo apt-get update
      • sudo apt-get install grub-customizer 

    Friday, May 25, 2012

    Skype Data rates

    Hi all,

    according to https://support.skype.com/en-us/faq/FA1417/How-much-bandwidth-does-Skype-need
    (1024kByte = 1MByte); (8kbps = 1kBps)

    calling
    --------
    minimum:
    30kbps = 30/8 kiloBytes (per second) = 225kiloBytes (per minute) = 0.22 MegaBytes per minute
    if they charge both upload and download, then it would be 0.44 MegaBytes per minute

    recommended:
    100kbps = 100/8 kiloBytes (per second) = 750kiloBytes (per minute) = 0.73 MegaBytes per minute
    if they charge both upload and download, then it would be 1.46 MegaBytes per minute
     
     
    video calling
    ---------------
    minimum:
    128kbps = 128/8 kiloBytes (per second) = 960kiloBytes (per minute) = 0.9375 MegaBytes per minute
    if they charge both upload and download, then it would be 1.875 MegaBytes per minute

    recommended:
    300kbps = 300/8 kiloBytes (per second) = 2250kiloBytes (per minute) = 2.2 MegaBytes per minute
    if they charge both upload and download, then it would be 4.4 MBytes per minute
    • so if you assume minimum requirements and charge for only download it will be
      • calling->0.22MB per minute
      • video calling->0.9375MB per minute

    cheers!

    Wednesday, May 16, 2012

    To highlight or edit a pdf file with pdf/a standard

    Hi guys,

    • Sometimes you come across pdf files that are protected by the author. PDF/A is such a standard, which makes the document even not possible to higlight.
    • If you want to convert such a document to a normal pdf follow these steps.
      1. Get hold of a pdf creator: I use PrimoPDF; it is free (http://www.primopdf.com/)
      2. Open you protected pdf: you can use the free adobe reader X
      3. File->Print and choose the PrimoPDF as your printer
    • That's it! The resulting PDF can be edited.
    Cheers!

    Sunday, May 13, 2012

    How to get rid of extra line spaces in LATEX: itemize, list, enumerate

    Hi all,

    Sometimes, the default line spacing in enumerate or itemize is too large.
    This is how you can reduce it:
    1. Create your own command and use it instead of {itemize} or {enumerate}
    \documentclass[letterpaper,11pt]{report}

    \newenvironment{packed_enum}{
    \begin{enumerate}
      \setlength{\itemsep}{1pt}
      \setlength{\parskip}{0pt}
      \setlength{\parsep}{0pt}
    }{\end{enumerate}}

    \newenvironment{packed_item}{
    \begin{itemize}
      \setlength{\itemsep}{1pt}
      \setlength{\parskip}{0pt}
      \setlength{\parsep}{0pt}
    }{\end{itemize}}


    \newenvironment{compactlist}{
     \begin{list}{{$\bullet$}}{
      \setlength{\partopsep}{5pt}
      \setlength{\parskip}{0pt}
      \setlength{\parsep}{0pt}
      \setlength{\topsep}{0pt}
      \setlength{\itemsep}{0pt}
      \setlength{\itemindent}{0pt}
      \setlength{\leftmargin}{10pt}
     }
    }{
     \end{list}
    }

    \begin{document}

    \chapter{My List}

    Here is my list.

    \begin{packed_enum}
       \item Item 1
       \item Item 2
       \item Item 3
    \end{packed_enum}

    \begin{packed_item}
       \item Item 1
       \item Item 2
       \item Item 3
    \end{packed_item}

    \begin{compactlist}
    \item Item 1
    \item Item 2
    \item Item 3
    \end{compactlist}

    \end{document}

    --------------------------
    By changing the size of {pt} in
    \setlength{\itemindent}{0pt}
    \setlength{\leftmargin}{10pt}
    you can change the indent of the bullets.

    Credit should go to the original post: http://www.devdaily.com/blog/post/latex/control-line-spacing-in-itemize-enumerate-tags

    Tuesday, May 1, 2012

    PDF go back from links of the same document

    Hi guys,

    • In certain pdf documents you find hyperlinks to pages in the same pdf document. However, I always wondered how to go back once you click them.
    • This is how it can be done for Adobe Reader X:
      • right click on the toolbar on top (just below the menu bar) and choose "Page Navigation". Select "Previous View" so that it will be displayed on the toolbar.
      • The shortcut key is "ALT+left arrow" key
    Hope it helps!

    Cheers!

    Thursday, April 26, 2012

    Windows 7: 3D cycle through windows

    Hey!

    Did you know that in Windows 7 you can shift between your opened windows just like in Mac.
    Press Windows key + tab to find out!

    cheers!!

    Friday, April 13, 2012

    Writing help files in Matlab

    Hi,

    I did not know writing help files in Matlab was this easy.

    Just write everything as comments using '%' and save the file as a .m file, That's it.
    So, just type the name of your file, i.e : help filename

    Cheers!

    Monday, April 9, 2012

    Open several default tabs in Firefox at startup

    Hey guys,

    I use Firefox for rikaichan and google calendar. For some reason, I cannot enter new events in the google calendar when it is opened in the Internet explorer.

    So I want Firefox to launch the two tabs for translation and google calendar when I open Firefox.
    And, this is how it is done.

    That's all!

    Cheers!!!

    Friday, February 24, 2012

    How Shock Absorbers Work

    http://blogs.howstuffworks.com/2009/08/26/how-shock-absorbers-work-2/

    The credit goes to original author.

    cheers!

    Thursday, February 23, 2012

    Friday, February 3, 2012

    How to open Java .class files in a human-readable way?

    Hi,

    I came across a java applet on a webpage and I wanted to know how it worked. These .class files are not human readable if you open them in a text editor like notepad.
    • When you view the source of the webpage (IE just right click on the page and there is "View source" option) you can find what .class is running, which is the underlying program for the applet.
    • After that you can use something like JD-GUI, a java decompiler, to view the code

    Hope this helps!