Skip to main content

Posts

GRtensor commands

I would try to collect some useful resources for GRtensor package of Maple. I contains a host of commands which are very useful but the documentation is scarce. A good page to learn the applicability of the commands through example is http://www.smf.mx/~dgfm-smf/TallerVI/CursoSussman/hoja2/hoja21.html All GRtensor outputs needs o be simplified one way or another and GRtensor provides specialized routines to accomplish just that. The gralter command does the job instead of the Maple command simplify . http://grtensor.phy.queensu.ca/Griihelp/gralter.help And everyone needs to know the keyboard shortcuts of any program they are using. It makes life efficient. http://www.maplesoft.com/support/help/Maple/view.aspx?path=worksheet%2fdocumenting%2f2DMathShortcutKeys For example, I was unable to enter the Greek symbols for a long time till I found that it is very easy to do so in Maple. Just type the Greek word in Eng...

Using the 3D modelling software Blender3D efficiently

Blender 3D is an excellent tool for building 3D models. It is a free alternative to professional 3D modelling softwares like 3DS MAX and MAYA. I personally found it to be easier to use and more efficient than 3DS MAX. Its shortcuts are easier to remember and the workflow is much more streamlined than 3DS MAX. There are plethora of superbly written tutorials out there on Blender3D so I am not going to go into that. People who are interested in some tutorials can look at  http://en.wikibooks.org/wiki/Subject:Blender_3D I would start with a list of useful keyboard shortcuts which makes the Blender3D experience all the more enjoyable. The following are not a complete list of keyboard shortcuts for Blender3D but they are most useful ones in my opinion.  BLENDER shortcuts Manipulate view select -> right click  pan : middle mouse + shift zoom middle + ctrl rotate view : middle click + drag select multiple object : shift + right click or...

Add arXiv hyperlink to bibtex in under 1 seconds

Add hyperlinks of arXiv numbers to all the bibtex entries in a bib file in under 1 second. This is accomplished by a script.  The user only needs to have a bibtex file which already has the eprint entry for every bibtex item. The rest would be handled by the script. This procedure is not necessary for some packages and bst files. it becomes necessary when specialized citation packages, like natbib, are used. Natbib generally do not include the hyperlink to the eprint number and some bst files for natbib like pjgsm.bst would completely ignore the eprint field. The following script would amend this situation. It basically hard codes the hyperlinked arXiv number  into the journal entry. So hen the bibtex is run the journal entry would include the hyperlinked arXiv number. I wrote this script with bibtex from the NASA ADS server in mind. Bibtex from other sources might need some modification. Critical comments and suggested improvements are welcome. ======================...

Search inside text files

When we have many text files such as code samples or research documents then more often than not we want something which is in one of the files but we cannot remember which one. This is when searching inside text files becomes necessary. There is a one-liner that can do the job. find . -name "*" | xargs -d '\n' grep -i -A2 -B2 --color=auto "KEYWORD" 2> /dev/null For example, $ find . - name "*" | xargs - d '\n' grep - i - A2 - B2 -- color = auto "21sma" 2 > / dev / null ./ coding / python / stock - python / stock - analysis / stock - analysis . py - # create SMA columns ./ coding / python / stock - python / stock - analysis / stock - analysis . py - # min_periods starts averaging from day-0 not day-200 so it is always continuous with no initial 200-day gap ./ coding / python / stock - python / stock - analysis / stock - analysis . py : stock [ '21SMA' ] = stock [ 'Adj Close' ]...

How to join audio tracks smoothly in Audacity

Audio tracks can be mixed easily in full fledged video editors like kdenlive or Adobe Premiere but for mixing or joining audio they would not provide the amount of control that audio editors like Audacity provide. The example I am going to show today would demonstrate the range of tools in Audacity that allows us to control the waveform and to mold it to our desire. Today I am going to take a small track like a small 1 min. clip of storm sound and make a long continuous sounding storm audio clip from it. STEP 1 : Open file Open the clip in Audacity. STEP 2 : Removing unwanted audio portion There is always unwanted sections of the audio that we have to discard. Select the portion of background noise or unwanted audio. Press DELETE key. STEP 3 : Duplicating the track Now we make a copy of the entire waveform and paste it at the end of the track. Select the SELECT tool (the one which looks like I). Then select the whole waveform and prss Ctrl+c. Now...

Joining Mp4 Files

The following parts are independent. PROCEDURE 1 Try the simple one first. Just copy the video and the audio stream. mencoder file1.mp4 file2.mp4 -ovc copy -oac copy -of lavf format=mp4 -o output.mp4 Sometimes this might not work. Many times the audio copy would fail with the errors like. Audio format 0x4134504d is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it. In these cases it is better to re-encode the audio with lame. mencoder file1.mp4 file2.mp4 -ovc copy -oac mp3lame -of lavf format=mp4 -o output.mp4 If we want free format encoding we could also use FAAC encoder (Freeware Advanced Audio Coder.). In this example the video codec used in also a free format to encode to H.264 HD format. mencoder video1.mp4 video2.mp4 -o video3.mp4 -of lavf -lavfopts format=mp4 -vf harddup -oac lavc -ovc lavc -lavcopts acodec=libfaac:vcodec=libx264 PROCEDURE 2 MP4Box -add file1.mp4 -add file2.mp4 out...

To convert a video file to HD format

In the following exposition we would discuss the command line procedure to produce videos with HD aspect ratio from normal videos. This would allow the video to fill a HD screen . NOTE: This procedure will not improve quality of a video. If it is grainy then it would remain grainy in the final result. Changing aspect ratio only allows the video to fit HD screens and not improve its quality. To improve quality you can try smoothing in AVIDEMUX. There are many GUIs to convert a video file to HD 16:9 format. But I find its best to use the CLI. STEP 1 : Get video file info We have to get the file to the 16:9 ratio.  To achieve this first obtain video info using mplayer. Just play the video and press ESC immediately upon starting.  Now look at the line starting with VIDEO. It should say something like this, VIDEO:  [H264]  640x380  0bpp  29.970 fps  138.8 kbps (16.9 kbyte/s) The 2nd column would be video codec. 3rd...

Save youtube videos from browser cache(new method)

This post supersedes the previous post that I wrote at http://kheyali.blogspot.com/2009/11/how-to-save-online-video.html A new method have to be used because flash changed the way it stored the cached file. The file is deleted immediately upon creation but a file handle is kept open. This is similar to the situation that if a copy is open in memory and someone deletes the file from disk, upon saving the file the file reappears on disk. But someone already did the work of writing the procedure down. So I list it here. http://liori.jogger.pl/2010/11/08/getting-flash-videos-from-almost-deleted-files/

Non-English characters: How are they displayed

We have come a long way since every time we needed to read some non-English texts we needed to install special fonts in Windows. After I started using Linux I always wondered how does all these types of characters display so perfectly. I knew that it was Unicode. But what I didn't grasp immediately is how the OS can display such an enormous variety of characters. Unicode is not just a character set like we learnt in school. Instead it is an encoding algorithm (in some sense). What it does is that it assigns numbers different basic characters and then any characters can be constructed out of these elementary characters. What happens is that two characters like a and '   are merged to get  รก. People who know LaTeX would instantly realize that this is how LaTeX also works. But this composting is done in the browser directly in the OS itself not as a separate software. This process is called "pre-composition" or "...

How to add and synchronize subtitles

This is tutorial on Adding subtitle to a video clip and synchronizing it correctly.  Shifting the subtitles correctly for out of sync subtitles. Adding subtitle to a video clip Lets say that the video clip is from a movie and we want to cut the subtitles from that portion of the movie and add it to this clip. The only problem is that the subtitles files are written in a continuous manner which makes it difficult to plain cut and paste operation of the relevant section.  The steps involved are -- 1.Get the subtitle file.  2. Get the relevant portion of the subtitle file from the whole srt file and save it in another srt file. If for eg. we want know some words at the beginning and the end we can extract the text from the srt file using grep. Example file : The relevant section is in yellow. 1220 01:53:46,980 --> 01:53:48,140 Father-in-law! 1221 01:54:17,648 --> 01:54:23,780 I'm a foreigner , I came ...