tag:blogger.com,1999:blog-100684902024-02-28T10:33:26.900-05:00Infinitesimal MindThis is a place where I put all the things together I use in my daily life. Tips and Tricks, specific Linux commands. You will find something useful.Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-10068490.post-20648400942023606412009-02-02T11:20:00.006-05:002009-02-02T11:27:17.380-05:00Changing the version of required gtk+Sometimes you download a source code and it keeps asking you another (generally higher) version of gtk+ or libglade. For this problem, instead of changing your gtk+ and glade versions, you might just change the requirements of the source code you downloaded. This is not a guaranteed solution, but most of the time, it works. For example, I have gtk+ 2.8 at home and 2.4 at work. So, at work I can not compile my gtk+ codes. To tackle the problem, I found where the configure script checks for the gtk+ requirements and just changed the version number.<br />It looks like this(configure.ac file):<br /><span style="color: rgb(51, 102, 255); font-weight: bold;">PKG_CHECK_MODULES(GRID_EDITOR, [gtk+-2.0 >= 2.8 libglade-2.0 >= 2.6 ])</span><br />Depending on your code and configuration, there might be more options, but changing the above to this does the trick for me.<br /><span style="color: rgb(51, 102, 255); font-weight: bold;">PKG_CHECK_MODULES(GRID_EDITOR, [gtk+-2.0 >= 2.4 libglade-2.0 >= 2.4 ])</span>Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-73716017351677920612009-02-02T11:16:00.005-05:002009-02-02T11:28:27.913-05:00How to find the installed gtk+ and glade versions<pre></pre><div style="text-align: left;">If you need to find the currently installed versions of gtk+ and libglade,you can use the following commands to find them:<br /></div><pre><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">$>pkg-config --modversion gtk+-2.0</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">$>pkg-config --modversion libglade-2.0</span><br /><br /></pre><div style="text-align: left;">Happy programming.<br /></div><pre><br /></pre>Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-5066731813535053032008-06-30T15:32:00.006-04:002008-06-30T15:43:29.843-04:00Full Screen Figures in MatlabMatlab's native figure command does not give you an option to make your figure full screen in 1 step. Instead first you have to find the screen resolution and then give your figure command the size of the screen.<br /><br />First thing you want to do is:<br /><br /><span style="color: rgb(51, 51, 255); font-weight: bold;">screen_size = get(0, 'ScreenSize');</span><br /><br />This will return a 4 element array: (left, bottom, width, height);<br />The ones we are interested are the "width" and "height".<br /><br />Now we have the size of the screen, we can make our figure full screen:<br /><br /><span style="color: rgb(51, 51, 255); font-weight: bold;">f1 = figure(1)</span><span style="font-weight: bold;">;</span><br /><span style="color: rgb(51, 51, 255); font-weight: bold;">set(f1, 'Position', [0 0 screen_size(3) screen_size(4) ] );</span><br /><br />Now you should have a figure that is full screen.Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com22tag:blogger.com,1999:blog-10068490.post-60513734760978062352008-06-14T23:19:00.005-04:002008-06-14T23:24:57.648-04:00Changing the SMTP port number in EvolutionI started using evolution email client in Ubuntu. However, my service provider requires me to use a different port for SMTP. When you first check the tab where you set the options for SMTP, you can not find a field about the port number of SMTP. I was looking for a field because Thunderbird has a field for port.<br />The solution is this :<br /><br /><span style="color: rgb(255, 0, 0);">smtp.hostname.com --> Assumes you are using port 25.</span><br /><br /><span style="color: rgb(255, 0, 0);">smtp.hostname.com:587 --> You set the SMTP port to 587.</span><br /><br />I think this is not a good way to handle ports, but I am happy since I found a soluton.Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-79846413816843156112008-06-04T23:57:00.004-04:002008-06-05T00:17:24.650-04:00A simple problem with LLNL's VisItRecently I found the <a href="https://www.llnl.gov/">LLNL</a>'s visualization software called <a href="https://wci.llnl.gov/codes/visit/">VisIt</a>. It has many capabilities and the graphics looked promising from their screenshots. So I wanted to give it a try. However, I had a problem and found the solution with a trial and error way. Since VisIt is developed to be working on distributed systems and parallel systems, it is always using sockets to connect to its server part even you are using them on the same computer.<br /><br />So when you call the main program with gui,<br /><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">>visit.exe</span><br /><br />It will generate the following commands<br /><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">Running: "C:\Program Files\LLNL\VisIt 1.9.0\gui"</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">Running: "C:\Program Files\LLNL\VisIt 1.9.0\viewer" -geometry 1272x1020+408+0 -borders 22,4,4,4 -shift 4,22 -p</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">reshift 4,22 -defer -host your.hostname -port 5600</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">Running: "C:\Program Files\LLNL\VisIt 1.9.0\mdserver" -host your.hostname -port 5602</span><br /><br />So if you are running it the first time, Windows will ask you to open the ports given above to be unblocked. I unblocked them.<br /><br />Then suddenly at 32%, mdserver crashed.<br /><br />After several forum messages and trials, I was still getting the same error.<br /><br />Later, I installed VisIt to my home computer also and it worked without a problem. Therefore, I started looking for the differences between my two computers. The first and the most obvious difference was with the network connections. At my home computer I had VMWare installed. When you install VMWare, it creates several different network connections, which were enabled by default. Even though they are not real connections, VisIt still handled them according to their IP adresses.<br /><br />Finally, I disabled all my network connections created by VMWare. Give one more try to VisIt and it started working.<br /><br />I think the fix will be considered with the next release of VisIt.Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com7tag:blogger.com,1999:blog-10068490.post-10933659122829533972008-06-04T15:26:00.006-04:002008-06-05T00:18:01.497-04:00Export figures in Matlab without displaying themAssuming you have a lot of figures to plot, but you do not want to wait and see them in Matlab's figure window. There is a way you can export all of your figures without displaying them. This might also save you some time, since you are drawing them on the screen.<br /><br />Here is how :<br /><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">% Create a figure with visibility off</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">f = figure('Visible','off');</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">% Then do your plot</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">plot</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">% Finally export the plot as an image</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">print('-dpng', 'test.png');</span><br /><br />You can also make this in a loop (Which is very probable if you have too many figures).<br />Do this<br /><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">for i:1, n</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;"> f = figure('Visible','off');</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;"> plot</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;"> filename = sprintf('plot-%d',i);</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;"> print('-dpng', filename);</span><br /><span style="color: rgb(51, 102, 255); font-weight: bold;">end</span><br /><br />This will give you 'n' png images with your plots in it.Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com11tag:blogger.com,1999:blog-10068490.post-33512226929831648772008-02-19T12:24:00.005-05:002008-02-19T12:35:33.976-05:00Timing background jobs to a fileIf you are running a lengthy simulation or a compilation, sometimes you might have to close/logout of your terminal. However, if you just use the "time" command with out redirecting it is output to a file, you will not see the output of time command. For example you run a job and left terminal like following:<br /><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >$>time ./my_job > my_job_output &</span><br /><br />This will run "my_job" in the background and send its output to "my_job_output". If you do leave your terminal open, you will see your run time information on the terminal screen. However, if you close your terminal window, you will not see this information since your strerr is now not available.<br />For this purpose, you can send your program output and time output to different files. Then, even if you close your terminal, you will still see your time command output:<br /><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >$> (time ./my_job >my_job_output) >& time.out &</span><br /><br />This way you will run your job in the background, see your time command output and you can close your terminal.Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-84287763922139303642008-01-31T12:46:00.000-05:002008-01-31T16:29:26.827-05:00Convert ADCIRC grid to Tecplot data fileI created this <a href="http://users.coastal.ufl.edu/%7Etutak/adcirc_to_tecplot.pl">utility </a>to convert <a href="http://adcirc.org/">ADCIRC </a>compatible grids in to <a href="http://www.tecplot.com/">Tecplot </a>files. The program is written in Perl. I also added comments. If you need it, enjoy :). If you want to see the code it self you can look at this <a href="http://users.coastal.ufl.edu/%7Etutak/adcirc_to_tecplot.pl.txt">file</a>.Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-68636365591587069082008-01-26T23:57:00.000-05:002008-01-30T16:10:39.766-05:00How to install LAMP on Ubuntu Gutsy Gibbon (Desktop Version)If you are using Ubuntu Gutsy Gibbon (7.10) Desktop edition and you want to install the "LAMP" (actually you want to install AMP part :)). Just do the following:<br /><br />Never forget this before installing something.<br /><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >$>sudo apt-get update</span><br /><br />and<br /><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >$>sudo apt-get install apache2 libapache2-mod-php5 libapache2-mod-auth-mysql mysql-server php5 php5-mysql</span><br /><br />You will be asked to type the mysql password for the "root" user. Pick something you would not forget :).<br /><br />Viola, you should be able to access your setup in no time...Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-52898199970253704262008-01-26T14:45:00.000-05:002008-12-09T16:22:52.310-05:00Very useful Gnuplot information<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihdD76fVSwM9MIXpYFBuhvrNvLyFcuEa3DUNOUjUa3oUkFPeLcc1QfYryplyB6cpBSogsjgTw34xQvF7BNL6HS-D116S6pkjfs-607DM8Oj0voy8Hdzozc7bHHA78VAbK0kxTo/s1600-h/polar.8.png"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihdD76fVSwM9MIXpYFBuhvrNvLyFcuEa3DUNOUjUa3oUkFPeLcc1QfYryplyB6cpBSogsjgTw34xQvF7BNL6HS-D116S6pkjfs-607DM8Oj0voy8Hdzozc7bHHA78VAbK0kxTo/s200/polar.8.png" alt="" id="BLOGGER_PHOTO_ID_5159878424838987426" border="0" /></a><br /><br />If you need a free and a powerful plotting program <a href="http://www.gnuplot.info/">Gnuplot </a>would be a good choice for you.<br /><br /><br />Especially if you are working on a Linux system, you might find many additional utilities making your life easier with Gnuplot.<br /><br />Without the GUI front ends it will behave more like a command prompt. Also it is capable of reading script type of files and act accordingly.<br /><br />There are a lot of good Gnuplot tutorials and help pages all over the internet. However, I think <a href="http://t16web.lanl.gov/Kawano/gnuplot/index-e.html">this page</a> (not so Frequently Asked Questions) about Gnuplot goes beyond the regular help pages. There are many specific cases, but there are also many generic help.<br /><br />You can even plot a butterfly with Gnuplot :). (generated using <a href="http://www.gnuplot.info/demo/polar.8.gnu">this script</a> from Gnuplot website)<br /><br />Enjoy your plots...Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-84708149249355372662008-01-21T17:35:00.000-05:002008-01-23T12:00:42.171-05:00Creating DVD from your video files on LinuxLinux has many different programs for editing video and creating DVDs from your individual video file collections. The ones I know and use include:<br /><ul><li><a href="http://www.mplayerhq.hu/">mplayer</a></li><li><a href="http://ffmpeg.mplayerhq.hu/">ffmpeg</a></li><li><a href="http://www.transcoding.org/">transcode</a></li><li><a href="http://mjpeg.sourceforge.net/">mjpegtools</a></li><li><a href="http://dvdauthor.sourceforge.net/">dvdauthor</a></li><li><a href="http://videotrans.sourceforge.net/">videotrans</a></li></ul>and probably many more. Most of these programs have many features besides the video editing capabilities. Some of them might do the same things in different or more efficient ways.<br /><br />I am not really an expert on video editing or creating DVDs. However, from different sources I gathered a lot of useful information to do what I need. My basic need was to create DVDs from my video files. I also wanted to have fancy DVD menus showing the preview of the videos, which is probably a good thing to have on DVDs.<br /><br />For this purpose my main tool is actually videotrans. Videotrans is a collection of utilities (movie-to-dvd, movie-title, movie-make-title etc.) to create DVD compatible video/audio files, creating animated/static title menus, creating dvdauthor compatible XML files etc. Videotrans utilities are mostly complex shell scripts using some of the utilities I mentioned above and some more. I am sure there are more fancy programs to create DVDs and probably some of them are free/open source. However, I am currently using Videotrans because for the last 2 years I really got professional with it. I will not it is superior and very good. I had many problems that is for sure, but for the time being I can find my way out and create my DVDs.<br /><br />Yesterday, I found a new program called, <a href="http://dvdauthorwizard.sourceforge.net/view.php/page/Voorpagina">KDE DVD Authoring Wizard</a>. The program seems to be doing the same thing with Videotrans in a more fancy KDE Wizard way, which is good. However, from my initial tests, and initial research it seems to have the same limitations with Videotrans. I will definitely look more in to it in the future (Also I had some problems because it is a KDE type utility and I use Gnome on Ubuntu).<br /><br />I will try to demonstrate a little DVD creation example here using the Videotrans utilities.<br />Ok, for this demonstration I am assuming you have 2 long video files (with mpg extensions) and a small video (or part of a big video) to be used as title menu background animation.<br /><br /><span style="font-weight: bold;">Step 1 - Install Videotrans:</span><br />Because videotrans is actually a set of shell scripts (mostly), the installation is pretty straight forward. Download the latest videotrans archive from its website and unpack the file you obtained. Go in to the videotrans directory and do:<br /><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >$>./configure</span><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >$>make</span><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >$>make install</span><br /><br />You have to be superuser to install the program. Also for small utilities included in the set, you need to have a GCC installed.<br /><br />Assuming you did not have problems with installation (I did not and it is one of the easiest installations I did), we can move on to creating some DVDs.<br /><br /><span style="font-weight: bold;">Step 2: Making your video files DVD compatible (if they are not) :</span><br />I am not really sure what a DVD compatible video is and I did not really make a research on that.However, I know I had to create the DVD compatible videos every time I created a DVD. So our first utility from videotrans set is movie-to-dvd:<br /><br /><span style="font-weight: bold; color: rgb(51, 51, 255);font-family:courier new;" >$> movie-to-dvd -m "ntsc" -O "-nolirc" test.mpg</span><br /><br />This command with the appropriate options will create to new files "test.m2v" and "test.ac3" from your home video "test.mpg". There other options available for use, but these are generally enough for me.<br /><span style="font-style: italic;">-m option defines which viewing mode you are using (PAL or NTSC). Since I am in US, my videos are NTSC. I think PAL is for European countries. You can find that in the man page.</span><br /><span style="font-style: italic;">-O option is to pass command line options to mplayer which is used by movie-to-dvd. And "-nolirc" parameters is to tell mplayer not to care about the remote control activities (Since I have a mythtv box on the same computer, remote control might interfere with mplayer). Now we are up to creating title.</span><br /><br /><span style="font-weight: bold;">Step 3 - Making a title:</span><br />Title in DVD is the first menu screen with buttons you get (Like previews, options etc.). In videotrans there are couple options for making the title of DVD. It can be a colored background with some kind of sound file or it can be an animated background(movie-make-title-simple) with animated previews (Picture in Picture type) (movie-make-title). I usually go for the fancy stuff :), so I am using the animated titles and I will describe creating animated titles (since it is harder to do :)).<br /><br />Ok, so pick a video that you want to use in the main title of DVD. It does not have to be short, since you can get any part of any video, but I suggest keep your title video short, since it will go through a very long process.<br /><br /><span style="font-weight: bold; color: rgb(51, 51, 255);font-family:courier new;" >$>movie-make-title -o title -s 10 -e 30 -m "ntsc" your_title_video.mpg</span><br /><br />This command will generate a whole bunch of images in a subdirectory called title (-o title) and the sounds from that file in to a title.wav file.<br /><span style="font-style: italic;">-o title means it will create the output in a directory called "title"</span><br /><span style="font-style: italic;">-s 10 means your background animation for title will start at 10th second of the video.</span><br /><span style="font-style: italic;">-e 30 means your background animation for title will end at 30th second of the video.</span><br /><span style="font-style: italic;">-m "ntsc" same as the movie-to-dvd option, to indicate your video mode.</span><br />The important thing here is to keep in mind that the times you get from your video might be slightly differ when you generate the title images using the above command. So after generating images check your images and if needed run the above command again with adjusted times. Also keep in mind that, assuming 25 frames per second, you will end up with approximately 500 images after this operation and that is why I suggested keeping the title animation short :).<br /><br /><span style="font-weight: bold;">Step 4 - Making title video:</span><br />Since we have a plausible sequence of title images, we can go on and generate our title with the animated previews. I want to give a brief explanation about why images are used for title. Since we want to create a title with animated background and video previews in the front, we have to somehow overlay these videos on top of each other. And I guess the overlaying images is the easiest way to do this :). So in the end what will happen is our main video (test.mpg) frames will be overlaid with the title images created above. Then animating the new series of images will create a new video of overlaid videos.<br /><br /><span style="font-weight: bold; color: rgb(51, 51, 255);font-family:courier new;" >$>movie-title -o title.vob -t title -s 5 -c 5 test.m2v</span><br /><br /><span style="font-style: italic;">-o title.vob tells program to create the DVD title in a file named "title.vob" which is compatible with DVD.</span><br /><span style="font-style: italic;">-t title means use the images from the "title" directory to create the background animation.</span><br /><span style="font-style: italic;">-s 5 means start the PIP preview of videos from 5th second of the video</span><br /><span style="font-style: italic;">-c 5 means create chapters for DVD every 5 minutes. (be careful this is minutes).</span><br /><span style="font-style: italic;">and use test.m2v video created above to create your PIP preview.</span><br />There is another option(-T XxY) for how the videos are placed on the screen. If you do not give this option, it will place the PIPs in a reasonable way (Regular grid. I like it).<br /><br />We are close to the end. I bet you can already see the your results (or not :)).<br />This is the tricky part, because this is where all the images are overlaid using ImageMagick program (convert). And this is why it is tricky. ImageMagick is a very powerful set of image processing tools. However, as far as I know, they keep changing the command line options from version to version. Therefore, for people using ImageMagick, it becomes tricky to do same job with different versions. I will not really get deep, but if you start to see just black screens with your video file name on it, it is probably due to a version incompatibility with ImageMagick (Suggested is upgrade/downgrade ImageMagick, after making sure everything else is working :)).<br /><br />If you want to add information about your videos to the menu, videotrans is capable of adding an information button. I think it is designed for giving information on TV show episodes, but I think it can be used for general information for your videos. The only trick is to place your information in a text file with ".info" extension in the same folder with your video. So your info file should be "test.info" for the "test.mpg" video file. movie-title automatically checks this files and creates the necessary images for the information display.<br /><br /><span style="font-weight: bold;">Step 5 - Final step-Create the DVD using dvdauthor:</span><br />Once you successfully see the end of the above step, it will tell you how to create your DVD using dvdauthor. Actually all it does is, give you the command to run depending on your file names. The command will look like this after above step:<br />"dvdauthor -o dvd_directory -x title.vob-dvdauthor.xml"<br />The xml file is for dvdauthor to process and join the videos/sounds/titles etc.<br /><br /><span style="font-weight: bold; color: rgb(51, 51, 255);font-family:courier new;" >$>dvdauthor -o dvd_directory -x title.vob-dvdauthor.xml</span><br /><br />This will give you a directory name "dvd_directory" with your DVD created in it. Now all you have to do is, burn your dvd_directory to an actual DVD. However I strongly recommend that check your end results. For the first times I had many unwanted errors/problems and end up burning useless DVDs.<br /><br />So, for burning, I first create and iso image and then burn it using <a href="http://k3b.plainblack.com/">K3B</a>.<br /><br /><span style="font-weight: bold; color: rgb(51, 51, 255);font-family:courier new;" >$>mkisofs -o dvd.iso dvd_directory/</span><br /><br />This will create a file called "dvd.iso" using the "dvd_directory" create above.<br /><br />Then you can simply burn your iso file.<br /><br />That should make it all, stick your DVD in to a DVD player and enjoy...Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com1tag:blogger.com,1999:blog-10068490.post-85113721885040213182008-01-20T20:18:00.002-05:002009-10-02T14:13:32.500-04:00Debugging shell scriptsSometimes you might need to debug or see what is really running in your shell script. If you want to see each line/command executed simply add "-x" to your first line where you define your shell/interpreter. This will output every executed command with a "+" before the line.<br /><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >#! /bin/sh -x</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >echo "Hello World!"</span><br /><br />This will output :<br /><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >+echo "Hello World!"</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >Hello World!</span><br /><br />I know this works with sh and bash, but I do not know the other shells.<br /><br />Also debugging especially long shell scripts can be a hard job. If you set the "-x" option at the beginning of the script, then it will output all the commands executed.<br />For this purpose, you can add "set -x" before the place you want to debug and "set +x" at the end.<br /><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >#! /bin/sh</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >echo "This is the test"</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >set -x</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >echo "Only show this part"</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >set +x</span><br /><br />This will output:<br /><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >This is the test</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >+echo "Only show this part"</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >+set +x</span><br /><span style="color: rgb(51, 51, 255);font-family:courier new;" >Only show this part</span><br /><br /><br />Also if you want to run your script, but not execute the commands you can use the <span style="color: rgb(51, 51, 255);">-n</span> option. This is best for checking your syntax.<br />Happy debugging with your favorite shell.Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-59113103038592901212008-01-18T16:00:00.001-05:002008-01-26T15:05:24.462-05:00Small changes with EmacsEmacs is a great editor with many different capabilities. One of the best features of Emacs is that it is highly configurable. There are several default settings that I use with Emacs in the configuration file. I will give only a couple of them. You can put these in to your local Emacs configuration file <span style="font-weight: bold;">".emacs"</span> or <span style="font-weight: bold;">".emacs.d/.emacs"</span> which might depend on your system.<br /><br />To change your background and foreground colors to black and white:<br /><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >(set-background-color "Black")</span><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >(set-foreground-color "White")</span><br /><br />To change the cursor color:<br /><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >(set-cursor-color "White")</span><br /><br />To stop Emacs from creating auto backup files:<br /><br /><span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" >(setq make-backup-files nil)</span><br /><br />There are many more options and settings you can change with Emacs. Try and enjoy it. Welcome to the world of Emacs :).Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-21968307352022791292008-01-16T15:44:00.000-05:002008-01-16T15:53:47.785-05:00Mass substitution with Perl Command Line<p>For changing all occurrences of a several expression in a file, Perl with command line options can be very helpful. The following shows a pretty general example:<br /></p><p style="color: rgb(0, 153, 255);">$> perl -i.bck -ep 's/search_term/replace_with/g' filename<br /></p><p>The above command will check the "filename" file and, replace all occurences of "search_term" with the "replace_with" term. "-i" option tells Perl to backup the file with a ".bck" extension before any operation.<br /></p>Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-24484329501430383582008-01-16T15:37:00.000-05:002008-01-26T15:04:59.902-05:00Maximum zone limit in Tecplot<p> To change the maximum number of zones used in Tecplot ASCII data files, the limits might need to be changed. The limit can be changed with: </p> <p> <span style="color: rgb(255, 0, 0);">$!LIMITS </span> </p> <p> <span style="color: rgb(255, 0, 0);">MAXPREPLOTZONES = (Number) </span> </p> <p> The change has to be added to the Tecplot configuration file. </p>Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com3tag:blogger.com,1999:blog-10068490.post-51151002862624480292008-01-16T15:33:00.000-05:002008-01-16T15:36:33.293-05:00Creating an image from a TeX file<p> To create an image from a Latex file do the following : </p> <p> <b><span style="color: rgb(0, 153, 255);">$>latex --interaction=nonstopmode file.tex </span></b> </p> <p> <b><span style="color: rgb(0, 153, 255);">$>dvips -E file.dvi -o file.ps </span></b> </p> <p> <b><span style="color: rgb(0, 153, 255);">$>convert -density 200 file.ps file.png</span></b> </p> <p> Violaaaa;<br /></p><p>Note that <span style="font-weight: bold;">convert </span>is a command line utility that comes with ImageMagick installation.<br /></p>Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0tag:blogger.com,1999:blog-10068490.post-2875565576111094532008-01-14T17:19:00.000-05:002008-01-15T11:09:34.694-05:00Replacing certain values in matlab vectors<span style="font-family:times new roman;">In Matlab if you need to replace certain values with a single value you can simple do this,</span><br /><br /><span style="font-family:courier new;">>u(find(isnan(u))) = [];</span><br /><span style="font-family:times new roman;"> </span><br /><span style="font-family:times new roman;">Using this will find and remove all the NaN (Not a Number) values.<br /><br />If you want to remove any value you can simple use find again,<br /><span style="font-family:courier new;"><br />>u(find(u=9999)) = [];</span><br /><br />This will remove all the values of u = 9999.<br /><br />Be aware that applying this will make your vector shorter if there is any value removed.<br /></span>Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com1tag:blogger.com,1999:blog-10068490.post-71309909862387826082008-01-07T13:31:00.001-05:002008-01-14T17:34:06.585-05:00Manually install Perl modules with CPAN.pm<span style=";font-family:courier new;font-size:100%;" xmlns="" ><p><span style="font-family:times new roman;">From your shell run</span><br /></p><p><span xmlns="" style="font-size:100%;">$> perl -MCPAN -e shell<br /></span></p><p><span style="font-family:times new roman;">command, it will ask you a few questions. Answer the questions, which are the basic settings for the local installation directory. You can set it up to a local directory within your home directory. Then simply type the following to install any module.</span><br /></p><p>$> install Date</p><p style="font-family: times new roman;">will install the latest Date module for Perl.</p><p><span style="font-family:times new roman;">For further details see </span><a style="font-family: times new roman;" href="http://www.perl.com/CPAN">CPAN</a><span style="font-family:times new roman;"> web site</span><br /></p></span>Bilge Tutakhttp://www.blogger.com/profile/09511833012416217726noreply@blogger.com0