<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-364017353841045328</id><updated>2011-10-03T05:52:11.667-07:00</updated><title type='text'>mknod -m 644 /dev/blog c 1 8</title><subtitle type='html'>Blah...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-8541379711011260783</id><published>2011-04-09T09:59:00.000-07:00</published><updated>2011-04-09T09:59:48.464-07:00</updated><title type='text'>Saving EPS files from Powerpoint</title><content type='html'>The newer versions of Microsoft Powerpoint (2007+) offer a simple and intuitive interface to quickly create nice illustrations. It would be really nice if you could use this to create diagrams for paper submissions to conferences/journals.&lt;br /&gt;If you want to import pptx diagrams into your papers, typically, the best way is to export as pdf (Microsoft has an export to pdf plugin). Now you could simply import the pdf images in your Latex file, and things work pretty well.&lt;br /&gt;The only hitch is that many conference templates enforce &lt;b&gt;eps&lt;/b&gt; images. Now most paths that convert pptx-&gt;pdf-&gt;eps completely mess up the image. Sometimes the pdf may be converted into a Huge bitmap in the eps file. We certainly don't want that. Here is a technique that you can use to directly convert pptx drawings to eps, while keeping the vector format. No more "Yuck! Bitmap..." comments from your advisor :) ... and you don't have to tell Microsoft Haters that you used Powerpoint :) and that you converted it to eps using tools that come by default with Windows ;)&lt;br /&gt;&lt;br /&gt;Anyway, before I begin, here are the places from where I picked up this info (everything is just a web-search away):&lt;br /&gt;&lt;a href="http://people.csail.mit.edu/dalleyg/faqs/20010425.html"&gt;http://people.csail.mit.edu/dalleyg/faqs/20010425.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.sketchpad.net/postscript-printer-winxp-1.htm"&gt;http://www.sketchpad.net/postscript-printer-winxp-1.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Note: I am using Win7 &amp; Office 2010, so some things may be a bit different in other versions.&lt;br /&gt;&lt;br /&gt;Now the first step is to create an EPS File Printer. (Yes you can do that)&lt;br /&gt;Go to 'Control Panel'-&gt;'Devices and Printers'-&gt;[Right Click]-&gt;'Add a Printer'&lt;br /&gt;Click 'Add a local printer'.&lt;br /&gt;Choose 'Use an existing port'-&gt;'FILE: Print to File'&lt;br /&gt;Pick some printer that has a 'PS' suffix to it. &lt;br /&gt;Now this may take some trial and error to find a color printer with decent number of options.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-47LImqCgXXY/TaCL2Q-8wxI/AAAAAAAAA18/flDYuKmP51Q/s1600/1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="146" width="200" src="http://4.bp.blogspot.com/-47LImqCgXXY/TaCL2Q-8wxI/AAAAAAAAA18/flDYuKmP51Q/s200/1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-Q5Reraa3Mdw/TaCL2XxyNmI/AAAAAAAAA2E/0lC2g66P_YY/s1600/2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="146" width="200" src="http://2.bp.blogspot.com/-Q5Reraa3Mdw/TaCL2XxyNmI/AAAAAAAAA2E/0lC2g66P_YY/s200/2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;You can print a test page and check if things are working now. (Just save the page as a .eps file). To view this, you may need to install &lt;a href="http://pages.cs.wisc.edu/~ghost/"&gt;GhostScript &amp; GhostView&lt;/a&gt; on Windows. Linux should have this by default.&lt;br /&gt;&lt;br /&gt;Now to prepare the PPT diagram for printing:&lt;br /&gt;Create a blank presentation. &lt;br /&gt;Select 'Design' -&gt; 'Slide Orientation' -&gt; 'Portrait' &lt;br /&gt;(This is the only limitation I came across. In Landscape mode, the EPS printer rotates the image through 270 degrees)&lt;br /&gt;Select 'Design' -&gt; 'Page Setup'&lt;br /&gt;Setup the page dimensions here (This should be the boundary of your diagram)&lt;br /&gt;&lt;br /&gt;Now copy-paste the actual drawing into this slide from wherever you created it.&lt;br /&gt;(The reason for this is, if you draw first and then rescale the page size, it will stretch the diagram. Maybe there is a workaround for this.)&lt;br /&gt;&lt;br /&gt;Now select 'Print', and pick the PS printer from the list.&lt;br /&gt;Select 'Printer Properties'-&gt;'Advanced'&lt;br /&gt;&lt;br /&gt;Setup the PostScript options as shown in this screenshot:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-60lITlcX0H8/TaCOgpJyK6I/AAAAAAAAA2M/mYsb1W9DiJo/s1600/5.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="200" width="196" src="http://3.bp.blogspot.com/-60lITlcX0H8/TaCOgpJyK6I/AAAAAAAAA2M/mYsb1W9DiJo/s200/5.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The Postscript output option should be EPS.&lt;br /&gt;Postscript language level be 1 (could be higher I suppose, but this is safer)&lt;br /&gt;TrueType font download options: Outline (This converts fonts to curves I guess. Play around with other options if you want, but stay away from 'Bitmap' of course).&lt;br /&gt;&lt;br /&gt;As shown in the next image, set the Paper Size to 'Postscript custom page size'. Keep this the same as your Slide dimensions, because this will be the size of the CropBox in the EPS file.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-rIX61aNicPg/TaCP3QVfmHI/AAAAAAAAA2U/Ve8D-z1ljaM/s1600/6.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="200" width="188" src="http://3.bp.blogspot.com/-rIX61aNicPg/TaCP3QVfmHI/AAAAAAAAA2U/Ve8D-z1ljaM/s200/6.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Now we are all set. Just click 'Print' and save the file with a .eps extension.&lt;br /&gt;GhostView correctly rendered this file for me, and the file size was reasonable. &lt;br /&gt;&lt;br /&gt;Note however, that eps is limited in its ability to handle transparency (i think there is no transparency whatsoever), and gradients, so try to use solid colors in the drawings.&lt;br /&gt;&lt;br /&gt;Let me know how this goes for you :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-8541379711011260783?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/8541379711011260783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2011/04/saving-eps-files-from-powerpoint.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/8541379711011260783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/8541379711011260783'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2011/04/saving-eps-files-from-powerpoint.html' title='Saving EPS files from Powerpoint'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-47LImqCgXXY/TaCL2Q-8wxI/AAAAAAAAA18/flDYuKmP51Q/s72-c/1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-6537691904664413250</id><published>2011-04-07T11:26:00.000-07:00</published><updated>2011-04-07T11:26:44.756-07:00</updated><title type='text'>How to use Windows Phone 7 Marketplace in India</title><content type='html'>Having recently 'procured' a HTC HD7, I was hoping to post a review of some sort on this blog. But none of my review plans (for this phone, the PS3 and a few PC games) seem to materialize in any reasonable time frame, so here are some tricks for anyone finding themselves in the less than desirable position of owning a Windows Phone 7 device in India.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;[ Feel free to skip over this next part. Just scroll over to the 'End of Rant' below ]&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Well, here is the fundamental problem: Smartphones are not much if you can't run applications on them. And Microsoft decided that it would be a very prudent move to sell WP7 phones in India, without any app-store support. (FYI, Microsoft has screwed over users in many countries like this, so this is certainly not a special case).&lt;br /&gt;&lt;br /&gt;Here is how things typically play out: &lt;br /&gt;&lt;b&gt;Step1&lt;/b&gt;: You shell out 25,000/- for a WP7 of your choice.&lt;br /&gt;&lt;b&gt;Step2&lt;/b&gt;: You start the phone, and it tells you to sign in with your 'Live ID'. You can create one if you don't have it. I have a Hotmail account since the Stone age, and decided to use that.&lt;br /&gt;&lt;b&gt;Step3&lt;/b&gt;: You decide you want some apps, and click on the Marketplace icon. You are greeted with a message that says 'Marketplace is not yet available in your country/region'&lt;br /&gt;&lt;b&gt;Step4&lt;/b&gt;: Ah! But we are clever, no? Simply have to change the country to 'USA'. The country is tied to your Live ID. Once you create it, you can't change the country. So, we go and create a new Live ID. I, for instance, am a retired Sith Lord living a peaceful life in Kansas...&lt;br /&gt;&lt;b&gt;Step5&lt;/b&gt;: Oops. You can't change the first Live ID that you used in the phone. It is now inexorably tied to the phone. What do we do now? &lt;br /&gt;&lt;b&gt;Step6&lt;/b&gt;: Factory Reset the phone. This will clear everything (all photos,videos,music,downloaded apps, mail, settings...the whole shebang) And how do we do that? Quite intuitive really. Go to Settings -&gt; about -&gt; reset your phone. ('About'?!! seriously Microsoft??)&lt;br /&gt;&lt;b&gt;Step7&lt;/b&gt;: Now you enter your new Live ID details. This works great on your phone, except that you can't really buy any apps because everything is listed in Dollars, and Microsoft does not support credit cards outside your region. Now all you need is an obliging chap with an American credit card. Yeah right...&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;[ End of Rant ]&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Now for the good news: There actually IS an app-store for India, where everything is listed in INR and leprechauns stash heaps of gold at the ends of rainbows.&lt;br /&gt;The problem is that the Phone does not seem to acknowledge its existence. The only way to access this store is through Zune Software (MS equivalent of iTunes).&lt;br /&gt;You can login on Zune, using your India based Live ID, and it will (sometimes) show you the Marketplace. &lt;br /&gt;I say Sometimes, because Zune has this nasty habit of setting some registry entries that removes India (IN) from the list of valid Marketplace regions. There is a nice hack described &lt;a href="http://www.thewindowsclub.com/access-marketplace-download-install-wp7-apps-on-windows-phone-from-india"&gt;HERE&lt;/a&gt;, to overcome it.&lt;br /&gt;&lt;br /&gt;A short summary of the registry tweak:&lt;br /&gt;Go to this registry key: HKEY_CURRENT_USER\Software\Microsoft\Zune\Features&lt;br /&gt;&lt;br /&gt;Here you will see the codes of the following countries in 3 entries:&lt;br /&gt;AT,AU,BE,CA,CH,DE,ES,FR,GB,IE,IT,MX,NL,NZ,SG,US&lt;br /&gt;&lt;br /&gt;Just add IN to all the entries, so they become: AT,AU,BE,CA,CH,DE,ES,FR,GB,IE,IT,MX,NL,NZ,SG,US,IN&lt;br /&gt;&lt;br /&gt;These guys have even made a helpful reg file: &lt;a href="http://www.thewindowsclub.com/downloads/ZuneIN.zip"&gt;Here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now for my trick: When you purchase/download apps from Zune Marketplace, they don't always turn up on your phone. Infact, the phone starts downloading these apps in its download manager, and sometimes the downloads stop due to network errors or whatever. Typically, you would simply resume the download by going to the Marketplace through your phone. But you can't open the official Marketplace app on your phone...&lt;br /&gt;&lt;br /&gt;The trick is to simply install a 3rd party marketplace app through Zune (there are 3 or 4 marketplace search apps which should install fairly quickly). HTC phones come preloaded with 'HTC Hub' from which you can access some apps. Just find an app listed on one of these marketplace apps, download that app from Zune Software on your PC (while your phone is connected of course), and now you should see a 'check install' button on that app, in your 3rd party marketplace app on the phone.&lt;br /&gt;Clicking this takes you to the Download manager, where you can resume/pause/cancel (oh wait, no you can't cancel downloads... another brilliant feature). &lt;br /&gt;&lt;br /&gt;Anyway, if someone knows a better way to get the Marketplace working properly in India, do let me know...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-6537691904664413250?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/6537691904664413250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2011/04/how-to-use-windows-phone-7-marketplace.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/6537691904664413250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/6537691904664413250'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2011/04/how-to-use-windows-phone-7-marketplace.html' title='How to use Windows Phone 7 Marketplace in India'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-2591949162721834735</id><published>2011-01-04T20:49:00.000-08:00</published><updated>2011-01-04T20:49:27.992-08:00</updated><title type='text'>Automating tasks in Outlook using VB for Applications</title><content type='html'>It has been ages since I wrote anything on this blog...&lt;br /&gt;Since a lot of people at work may be using the Outlook mail client, I thought it would be useful to introduce the scripting capabilities that Visual Basic for Applications (VBA) offers in Outlook. (This is also the first post where I will be using the code-&gt;HTML converter from Notepad++. Trying this as an alternative to vim. Let me know what you think.)&lt;br /&gt;&lt;br /&gt;This post demonstrates a simple script to delete duplicate emails in an Outlook folder. While this seems quite specific, it should present enough info for you to get started with VBA for Outlook. So here goes:&lt;br /&gt;&lt;br /&gt;Hmm, why would anyone want to do Visual Basic scripting in Outlook??&lt;br /&gt;&lt;br /&gt;I have long been a proponent of VBA (Visual Basic for Applications), specially in MS Excel and CorelDraw, but only recently have I got my hands dirty with Outlook.&lt;br /&gt;&lt;br /&gt;The problem I faced a while back was that I accidentally created two copies of every email in my conversations folder. There being around 250 items to sift through, I decided it would be better to spend a half hour learning how to write Outlook macros, than to find and delete the duplicate items.&lt;br /&gt;&lt;br /&gt;So, lets get down to business. To write a macro in Outlook, go to Tools-&gt;Macros-&gt;Visual Basic Editor.&lt;br /&gt;&lt;br /&gt;In the Project window, select Project1-&gt;Microsoft Office Outlook-&gt;ThisOutlookSession. You should be presented with a code window, where you will write the macro.&lt;br /&gt;&lt;br /&gt;The macro will be a VB subroutine. In this post, I will discuss how to write a macro that moves only duplicate emails to some folder of your choice (maybe trash). We could delete the emails instead, but I usually refrain from writing destructive statements in code, atleast until it is fully tested ;)&lt;br /&gt;&lt;br /&gt;Before we start off, this is the URL that I referred to for help: http://support.microsoft.com/?kbid=208520&lt;br /&gt;&lt;br /&gt;I will provide the code listing below, with inline comments (comment lines start with an apostrophe in VB).&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space: pre; width: 425px; height: 600px; line-height: 1; background: #FFFFFF; overflow: auto; scrollbar-base-color: #ffeaff "&gt;&lt;span class="sc1"&gt;'We start off with the name of the subroutine,&lt;br /&gt;'Also make it public, so outlook can access it.&lt;br /&gt;'Sub means Subroutine&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Public&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Sub&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;deleteDuplicateMails&lt;/span&gt;&lt;span class="sc6"&gt;()&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'Now for some variable declarations.&lt;br /&gt;'Note that this is not needed in VB, but&lt;br /&gt;'its a good practice, and also helps VB to&lt;br /&gt;'autocomplete your code.&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Dim&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;oldEmail&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;As&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;MailItem&lt;/span&gt;&lt;span class="sc6"&gt;,&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;newEmail&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;As&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;MailItem&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Dim&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;i&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;As&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Integer&lt;/span&gt;&lt;span class="sc6"&gt;,&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;dupcount&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;As&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Integer&lt;/span&gt;&lt;span class="sc6"&gt;,&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;totalcount&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;As&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Integer&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Dim&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;folder1&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;As&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;Folder&lt;/span&gt;&lt;span class="sc6"&gt;,&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;folder2&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;As&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;Folder&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Dim&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;myfolder&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;As&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;Folder&lt;/span&gt;&lt;span class="sc6"&gt;,&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;dupfolder&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;As&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;Folder&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'Now, we need to access the folders where&lt;br /&gt;'emails are stored. The following lines do that.&lt;br /&gt;&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'This is to help VB access the stuff inside outlook&lt;br /&gt;'MAPI is "Messaging Application Programming Interface"&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;ol&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;New&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;Outlook.Application&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;olns&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;ol.GetNamespace&lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc4"&gt;"MAPI"&lt;/span&gt;&lt;span class="sc6"&gt;)&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'Note: I am assuming these folders and subfolders&lt;br /&gt;'already exist. The code won't run otherwise.&lt;br /&gt;'We could make it more robust, and create&lt;br /&gt;'the folders here, but thats too much work :P&lt;br /&gt;&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'set the source folder&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;folder1&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;olns.Folders&lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc4"&gt;"Personal Folders"&lt;/span&gt;&lt;span class="sc6"&gt;)&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'go to subfolder inside folder1&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;myfolder&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;folder1.Folders&lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc4"&gt;"Conversations"&lt;/span&gt;&lt;span class="sc6"&gt;)&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'set the destination folder&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;folder2&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;folder1.Folders&lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc4"&gt;"Deleted Items"&lt;/span&gt;&lt;span class="sc6"&gt;)&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'again, we want a subfolder here&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;dupfolder&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;folder2.Folders&lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc4"&gt;"Conversations"&lt;/span&gt;&lt;span class="sc6"&gt;)&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'sort items based on sent-on date and time&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;myitems&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;myfolder.Items&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc7"&gt;myitems.Sort&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc4"&gt;"[SentOn]"&lt;/span&gt;&lt;span class="sc6"&gt;,&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;olAscending&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'iterate through mails, checking for duplicates&lt;br /&gt;&lt;/span&gt;&lt;span class="sc7"&gt;totalcount&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;myitems.Count&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc7"&gt;dupcount&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc2"&gt;0&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'start from end and go towards first item, deleting duplicates from the end&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;For&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;i&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;totalcount&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;-&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc2"&gt;1&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;To&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc2"&gt;1&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Step&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;-&lt;/span&gt;&lt;span class="sc2"&gt;1&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc1"&gt;'assuming there are atleast 2 emails&lt;br /&gt;&lt;/span&gt;&lt;span class="sc0"&gt;    &lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;oldEmail&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;myitems&lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc7"&gt;i&lt;/span&gt;&lt;span class="sc6"&gt;)&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;newEmail&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;myitems&lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc7"&gt;i&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;+&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc2"&gt;1&lt;/span&gt;&lt;span class="sc6"&gt;)&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="sc1"&gt;'check if 2 emails are same&lt;br /&gt;&lt;/span&gt;&lt;span class="sc0"&gt;    &lt;/span&gt;&lt;span class="sc3"&gt;If&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc7"&gt;oldEmail.ConversationTopic&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;newEmail.ConversationTopic&lt;/span&gt;&lt;span class="sc6"&gt;)&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;And&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;_&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc7"&gt;oldEmail.SentOn&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;newEmail.SentOn&lt;/span&gt;&lt;span class="sc6"&gt;)&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;_&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="sc3"&gt;Then&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="sc1"&gt;'no short circuit of boolean expressions, so we have inner if statement&lt;br /&gt;&lt;/span&gt;&lt;span class="sc0"&gt;        &lt;/span&gt;&lt;span class="sc1"&gt;'len(oldEmail.Body): comparing message length, faster than full string compare&lt;br /&gt;&lt;/span&gt;&lt;span class="sc0"&gt;        &lt;/span&gt;&lt;span class="sc3"&gt;If&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc7"&gt;Len&lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc7"&gt;oldEmail.Body&lt;/span&gt;&lt;span class="sc6"&gt;)&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;Len&lt;/span&gt;&lt;span class="sc6"&gt;(&lt;/span&gt;&lt;span class="sc7"&gt;newEmail.Body&lt;/span&gt;&lt;span class="sc6"&gt;))&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Then&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;            &lt;/span&gt;&lt;span class="sc7"&gt;dupcount&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;dupcount&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;+&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc2"&gt;1&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;            &lt;/span&gt;&lt;span class="sc7"&gt;newEmail.Move&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;dupfolder&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="sc3"&gt;End&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;If&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="sc3"&gt;End&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;If&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Next&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;i&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc7"&gt;MsgBox&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc4"&gt;"Duplicates: "&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;&amp;amp;&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;dupcount&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc1"&gt;'clean up any references&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;myitems&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Nothing&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;myfolder&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Nothing&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;dupfolder&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Nothing&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;folder2&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Nothing&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;folder1&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Nothing&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;olns&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Nothing&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;Set&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc7"&gt;ol&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc6"&gt;=&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Nothing&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="sc3"&gt;End&lt;/span&gt;&lt;span class="sc0"&gt; &lt;/span&gt;&lt;span class="sc3"&gt;Sub&lt;/span&gt;&lt;span class="sc0"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;And that completes the code. VBA can be used to write all kinds of neat macros that speed up day to day tasks. Finding duplicate mails is just one of them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-2591949162721834735?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/2591949162721834735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2011/01/automating-tasks-in-outlook-using-vb.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/2591949162721834735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/2591949162721834735'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2011/01/automating-tasks-in-outlook-using-vb.html' title='Automating tasks in Outlook using VB for Applications'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-8520258294830398752</id><published>2009-09-18T22:33:00.001-07:00</published><updated>2009-09-18T23:34:32.290-07:00</updated><title type='text'>Symbolic math with Matlab</title><content type='html'>A lot of people in academia use Matlab on a regular basis. But it turns out that Matlab has so many cool features that most often, nobody knows about. This post is about one such feature, symbolic math in matlab. Matlab allows you to solve equations, do integration, differentiation and so on. All you need to do is install the Symbolic Math toolkit (which is also available on the student edition).&lt;br /&gt;&lt;br /&gt;Here is a hello world sorta example:&lt;br /&gt;&lt;br /&gt;&gt;&gt; syms x y&lt;br /&gt;&gt;&gt; x+x&lt;br /&gt;ans =&lt;br /&gt;2*x&lt;br /&gt;&lt;br /&gt;The first line says that we are using 2 symbols x and y.&lt;br /&gt;The second line is any arbitrary algebra you want to do on these variables.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The symbolic math toolkit also allows you to do math using fractions:&lt;br /&gt;&lt;br /&gt;&gt;&gt; sym(1/5) + sym(1/3)&lt;br /&gt;ans =&lt;br /&gt;9/20&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is another simple algebra example:&lt;br /&gt;&lt;br /&gt;&gt;&gt; quadeqn='a*x*x+b*x+c=0';&lt;br /&gt;&gt;&gt; solve(quadeqn,'x')&lt;br /&gt;ans =&lt;br /&gt; -(b + (b^2 - 4*a*c)^(1/2))/(2*a)&lt;br /&gt; -(b - (b^2 - 4*a*c)^(1/2))/(2*a)&lt;br /&gt;&lt;br /&gt;This solves the quadratic equation for variable 'x'.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To actually evaluate this at some value, we can simply specify more equations. The solve function can solve a system of equations, and generate a set of results, one for each variable in the system.&lt;br /&gt;&lt;br /&gt;&gt;&gt; [a,b,c,x]=solve(quadeqn,'a=1','b=1','c=1')&lt;br /&gt;&lt;br /&gt;x =&lt;br /&gt;   (3^(1/2)*i)/2 - 1/2&lt;br /&gt; - (3^(1/2)*i)/2 - 1/2&lt;br /&gt;&lt;br /&gt;(it gives the values of a, b, c also, which i have removed here for brevity)&lt;br /&gt;&lt;br /&gt;Now, typing:&lt;br /&gt;&lt;br /&gt;&gt;&gt; simplify((3^(1/2)*i)/2 - 1/2)&lt;br /&gt;&lt;br /&gt;-0.5000 + 0.8660i&lt;br /&gt;&lt;br /&gt;This is the more easy to read answer we wanted :)&lt;br /&gt;&lt;br /&gt;Speaking of simplify, there are some really whacky functions in matlab for symbolic simplification:&lt;br /&gt;&lt;br /&gt;&gt;&gt; simplify(cos(x)^2 + sin(x)^2)&lt;br /&gt;ans =&lt;br /&gt;1&lt;br /&gt;&lt;br /&gt;&gt;&gt; simplify(a*a + 2*a*b + b*b)&lt;br /&gt;ans =&lt;br /&gt;(a + b)^2&lt;br /&gt;&lt;br /&gt;Lets try something harder... &lt;br /&gt;&lt;br /&gt;&gt;&gt; simplify(cos(x) + i*sin(x))&lt;br /&gt;ans = &lt;br /&gt;cos(x) + i*sin(x)&lt;br /&gt;&lt;br /&gt;Oops! did it give up already? not to worry. Matlab has a bunch of simplification routines, and simplify is only one of them. We can invoke ALL (mwuahahaahahaa!!) of them by using the 'simple' function.&lt;br /&gt;&lt;br /&gt;&gt;&gt; simple(cos(x) + i*sin(x))&lt;br /&gt;(matlab goes on a big spin, spews out lots of stuff, but finally...)&lt;br /&gt;ans =&lt;br /&gt;exp(i*x)&lt;br /&gt;&lt;br /&gt;Sometimes you want to go the other way:&lt;br /&gt;&lt;br /&gt;&gt;&gt; expand ((a+b)^2)&lt;br /&gt;ans =&lt;br /&gt;a^2 + 2*a*b + b^2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And then, we have differentiation:&lt;br /&gt;&lt;br /&gt;&gt;&gt; diff(sin(x)^3)&lt;br /&gt;ans = &lt;br /&gt;3*cos(x)*sin(x)^2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;...partial differentiation with respect to x:&lt;br /&gt;&lt;br /&gt;&gt;&gt; diff(x^2 + y^2 + c, 'x')&lt;br /&gt;ans =&lt;br /&gt;2*x&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;...And integration:&lt;br /&gt;&lt;br /&gt;&gt;&gt; int(sin(x)^3)&lt;br /&gt;ans =&lt;br /&gt;cos(3*x)/12 - (3*cos(x))/4&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And all this with discontinuous functions and limits :D :D :D&lt;br /&gt;&lt;br /&gt;&gt;&gt; int(dirac(x-a)*x^2,-inf,inf)&lt;br /&gt;ans =&lt;br /&gt;a^2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then there is function composition:&lt;br /&gt;&lt;br /&gt;&gt;&gt; f=log(x); &lt;br /&gt;&gt;&gt; g=sin(x);&lt;br /&gt;&gt;&gt; compose(f,g)&lt;br /&gt;ans = &lt;br /&gt;log(sin(x))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And a whole host of other cool things waiting for you... hope this kick starts a new interest in the awesome powers of matlab. &lt;br /&gt;&lt;br /&gt;Note: Matlab by no means has the best symbolic math toolkit, but its more commonly found than Mathematica :P&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-8520258294830398752?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/8520258294830398752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/09/symbolic-math-with-matlab.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/8520258294830398752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/8520258294830398752'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/09/symbolic-math-with-matlab.html' title='Symbolic math with Matlab'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-8246623118795885352</id><published>2009-07-02T02:16:00.000-07:00</published><updated>2009-07-03T09:04:38.646-07:00</updated><title type='text'>A visit to the Wine Cellar</title><content type='html'>WINE (Wine is not an emulator), is a nifty tool that you can use to run Windows applications on Linux. WINE is currently an incomplete implementation of the Windows API, and as such, not everything will run on it. This article will explore some of the things that WINE is capable of.&lt;br /&gt;&lt;br /&gt;For starters, to install wine, simply get it from your distribution's repository (like sudo apt-get install wine), or go to &lt;a href=http://http://www.winehq.org/&gt;winehq.org&lt;/a&gt; and get more info on how to install it. You could also download the sources and compile it yourself, though that is not the simplest path here.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;WINE Commandments&lt;/b&gt;&lt;br /&gt;Well, more like guidelines, really... &lt;br /&gt;&lt;br /&gt;1. Thou Shalt use the command line: You can start a windows app by double clicking it (or right clicking it and selecting "Open with WINE", but this is not recommended. The correct way to start applications using WINE is to use the command line. Type "wine" in the terminal to get usage details. For example, "wine test.exe" will launch the file called test.exe present in the current directory.&lt;br /&gt;&lt;br /&gt;2. winecfg shalt light your path: To set various wine parameters, type "winecfg". This will bring up a control panel that will be discussed in detail later.&lt;br /&gt;&lt;br /&gt;3. WINE shalt hide from you in the shadows: WINE creates its files in a hidden directory in your home folder. "cd ~/.wine" will take you there. Here, you will see a "drive_c" directory. This is your virtual C Drive. It contains a Windows folder, a Program Files folder etc... The .wine directory also contains a regedit.exe, a notepad.exe and some other small utilities. Typing "regedit" in the terminal will take you to your "new" registry, in case you want to do something there.&lt;br /&gt;&lt;br /&gt;4. Seek in system32, and you shall find: When you (try to) run a windows program using WINE, one of 3 things will happen: It will run, or it will complain about missing dlls, or it will segfault and throw up. If it runs, fine. If it throws up, there is no easy answer, but its mostly that the program won't run. If it complains about DLLs, which happens often, all you need to do, is copy the correct windows DLL file to your "new" system32 directory... which is located here: "~/.wine/drive_c/windows/system32". Where can you get these DLL files? Online, or from your licensed copy of Windows, which you have installed on a different partition on this machine. Most often, if you try to play games, you will have to copy DirectX dll files from your original Windows\system32. Note that this is the reason I ask you to use the command line. If you use WINE from the GUI, you cannot the error messages, and wont know why a program is not working.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Installing apps on WINE&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;You could install applications on WINE using the regular Setup programs you use in Windows, or you could try to run these programs directly from where you had installed them on windows (without reinstalling in linux). The second option is less recommended, but works often, specially with games.&lt;br /&gt;WINE also adds a menu item in your default gnome / kde menu. So you can also 'uninstall' programs from here. You could also simply go to the ".wine/drive_c/Program Files" directory and delete the application from there.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Mounting images in WINE&lt;/b&gt;&lt;br /&gt;If you are using backed up CD-Images to run your games on windows, doing the same thing on linux may be a bit harder. Firstly, some (many) copy protection systems like securom and Tages may not work on linux.&lt;br /&gt;&lt;br /&gt;But anyway, you probably have a CD image (ISO / cue / bin / mdf ) file that you want to mount. If you have an ISO for example, make a directory (say, virtualdrive) in your home folder and simply mount the image in that directory:&lt;br /&gt;&lt;font face=courier size=2&gt;sudo mount image.iso ~/virtualdrive -t iso9660 -oloop&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Now, the image is mounted, but your game does not know where to find it. So type 'winecfg' into the terminal, to bring up the wine configuration tool. Here, go to the "Devices" tab, and click on "Add" to add a new device. Type the path to your device (~/virtualdrive for example) under the field "Device Mapping". winecfg would have automatically assigned a drive letter to this drive. You can also click on "Advanced" and select "CD-ROM" as the device Type. Now, your game can read the new virtual drive as though it was a regular CD drive.&lt;br /&gt;&lt;br /&gt;Note that its not generally possible (AFAIK) to mount mdf files in linux. You can download and install the tool &lt;a href=http://iat.berlios.de/&gt;IAT&lt;/a&gt; that converts from various formats to ISO format.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;WINE Extras&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Sometimes, a few programs will complain that a certain library is missing, or that HTML rendering is disabled, etc... Here are a few solutions to such problems:&lt;br /&gt;&lt;br /&gt;1. Microsoft TrueType Fonts: Sometimes, while using WINE, you will have problems with fonts in the application you are running. This is because you do not have the microsoft fonts installed on linux. Here is how you should do it:&lt;br /&gt;&lt;br /&gt;Ubuntu (man, these deb guys are crazy, they have every damn package in their repository): &lt;br /&gt;&lt;font face=courier size=2&gt;apt-cache search msttcorefonts&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Other distros (slightly longer method): Visit &lt;a href=http://corefonts.sourceforge.net/&gt;corefonts.sourceforge.net&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. HTML Renderer on WINE: Wine Gecko is a HTML rendering engine that you can use to see webpages in applications that you run on wine. For example, CounterStrike displays a html page on loading a new map. To install Gecko, simply visit the &lt;a href=http://wiki.winehq.org/Gecko&gt;Official Gecko Page&lt;/a&gt; and follow the instructions given there.&lt;br /&gt;&lt;br /&gt;3. VB Runtimes: You may want to install visual basic runtimes from &lt;a href=http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=7b9ba261-7a9c-43e7-9117-f673077ffb3c&gt;here&lt;/a&gt;. In case this microsoft link expires, just google for vbrun60sp6.exe&lt;br /&gt;&lt;br /&gt;4. DirectX: Similar story here, just go to the microsoft webpage, get their latest Direct X installer, and run it. The application you are trying to install may also come with a DirectX installer.&lt;br /&gt;&lt;br /&gt;I can't really think of anything more to write right now, but if I may add a new post sometime later, to discuss some specific wine feature...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-8246623118795885352?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/8246623118795885352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/07/visit-to-wine-cellar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/8246623118795885352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/8246623118795885352'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/07/visit-to-wine-cellar.html' title='A visit to the Wine Cellar'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-4302174044877487879</id><published>2009-07-01T07:13:00.000-07:00</published><updated>2009-07-01T07:34:49.657-07:00</updated><title type='text'>Beep Beep!!</title><content type='html'>The PC speaker is a relic from the medieval times when people were awed by the sound effects of Dangerous Dave... But strangely enough, it is used heavily by most linux distros. This is most noticeable if you do text editing in the terminal, or inside gnome(sometimes kde) default apps like gedit...&lt;br /&gt;&lt;br /&gt;If you are one of those people who does not appreciate the fact that their machine can do a very good Road Runner impression, here is how you can fix things:&lt;br /&gt;&lt;br /&gt;Firstly, if you are facing this problem only in gnome-terminal, you can turn off system beep from the terminal options (Edit-&gt;Profile Preferences, uncheck "Terminal Bell")&lt;br /&gt;&lt;br /&gt;If you want a slightly geekier (and more effective) solution, you can disable the PC speaker in this way:&lt;br /&gt;&lt;br /&gt;&lt;font face=courier size=3&gt; sudo modprobe -r pcspkr &lt;/font&gt;&lt;br /&gt;&lt;br /&gt;This will disable the PC Speaker for the current session. If you want a more permanent solution, you can blacklist the PC Speaker by editing the "/etc/modprobe.d/blacklist" file.&lt;br /&gt;&lt;br /&gt;&lt;font face=courier size=3&gt; sudo gedit /etc/modprobe.d/blacklist &lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Then add this line at the end of the file:&lt;br /&gt;&lt;br /&gt;&lt;font face=courier size=3&gt; blacklist pcspkr &lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Save the file, and next time you start your machine, and there should be no more of that infernal beeping.&lt;br /&gt;&lt;br /&gt;modprobe is a utility that can load and unload linux modules. To learn more about it visit the &lt;a href=http://en.wikipedia.org/wiki/Modprobe&gt;Wiki page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-4302174044877487879?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/4302174044877487879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/07/beep-beep.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/4302174044877487879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/4302174044877487879'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/07/beep-beep.html' title='Beep Beep!!'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-2390288820306224820</id><published>2009-06-29T21:59:00.000-07:00</published><updated>2009-06-29T22:12:38.172-07:00</updated><title type='text'>A foray into OpenMP</title><content type='html'>(This post has been moved from my other blog on the grounds that it is quite general, and not all that technical).&lt;br /&gt;&lt;br /&gt;This is sort of an intro to how easy it is to write multi threaded programs these days. Most people don't bother about parallelizing their applications because the prospect of managing threads and synchronization is too daunting. This is where OpenMP steps in. It is a simple system to use, based on pre-processor directives. It works portably in both windows and linux. And best of all, if you do not invoke the OpenMP option while compiling the code, the parallelization part of your code is ignored, and it works as a single threaded app. Below, you will find a quite pointless program, but it serves well to test my dual core dual socket setup :)&lt;br /&gt;&lt;br /&gt;it computes the sum of: [sin(i/128) + cos(i/128)]... don't ask me why :-/&lt;br /&gt;where i ranges from 0 to 98765432&lt;br /&gt;&lt;br /&gt;&lt;font size=2 face=courier&gt;&lt;br /&gt;&lt;br/&gt; #include&amp;nbsp;&amp;lt;iostream&amp;gt; &lt;br/&gt; #include&amp;nbsp;&amp;lt;cmath&amp;gt; &lt;br/&gt; using&amp;nbsp;namespace&amp;nbsp;std; &lt;br/&gt;  &lt;br/&gt; #define&amp;nbsp;MAXNUM&amp;nbsp;98765432 &lt;br/&gt;  &lt;br/&gt;  &lt;br/&gt; int&amp;nbsp;main(){ &lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;double&amp;nbsp;sum=0; &lt;br/&gt;  &lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#pragma&amp;nbsp;omp&amp;nbsp;parallel&amp;nbsp;for&amp;nbsp;reduction(+:sum) &lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for&amp;nbsp;(int&amp;nbsp;i=0;i&amp;lt;MAXNUM;i++) &lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum+=sin(i/128.0)+cos(i/128.0); &lt;br/&gt;  &lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cout&amp;lt;&amp;lt;sum&amp;lt;&amp;lt;endl; &lt;br/&gt; } &lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;The #pragma statement automatically parallelizes the for loop. Also, since the 'sum' is updated each time in the loop, synchronization is ensured by the reduction(+:sum) statement. This says that the for loop is performing a reduction operation (like sum of n numbers), and that the operator used is Addition (+).&lt;br /&gt;&lt;br /&gt;Pretty neat! And very very simple to use!&lt;br /&gt;&lt;br /&gt;To compile this, all i needed to do was:&lt;br /&gt;&lt;br /&gt;&lt;font face=courier size=3&gt; g++ -fopenmp main.cpp &lt;/font&gt;&lt;br /&gt;&lt;br /&gt;In case I wanted a version without any of the parallel threading, a single threaded version is easily generated by not using the fopenmp compiler flag:&lt;br /&gt;&lt;br /&gt;&lt;font face=courier size=3&gt; g++ main.cpp &lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Amazing simplicity! And this works for all the complicated constructs that OpenMP provides.&lt;br /&gt;&lt;br /&gt;So, how well did we fare in this parallelization endeavour? Lets find out:&lt;br /&gt;&lt;br /&gt;Single Threaded run (1 core): 16 seconds&lt;br /&gt;Multi threaded run (4 cores): 4.7 seconds&lt;br /&gt;&lt;br /&gt;Thats almost a linear scaling from 1 to four cores. Now I cant wait to see what more OpenMP can do for me :)&lt;br /&gt;&lt;br /&gt;Learn more about OpenMP at &lt;a href=http://openmp.org&gt;openmp.org&lt;/a&gt; or at &lt;a href=https://computing.llnl.gov/tutorials/openMP/&gt;this comprehensive tutorial.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-2390288820306224820?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/2390288820306224820/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/foray-into-openmp.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/2390288820306224820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/2390288820306224820'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/foray-into-openmp.html' title='A foray into OpenMP'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-5314461360214532348</id><published>2009-06-28T22:03:00.001-07:00</published><updated>2009-06-28T22:47:43.389-07:00</updated><title type='text'>Sprucing up gedit: Part 2</title><content type='html'>Hi, welcome back... Yesterday I described what you can do with some gedit plugins. Today, we look at one of the least used, but most powerful features of Gedit: "External Tools". It can be found in the "Tools -&gt; External Tools..." menu.&lt;br /&gt;&lt;br /&gt;The external tools option allows you to write a script and execute that script from within gedit, using a few shortcut keys. This script is a shell script, with a few extra variables exposed by gedit.&lt;br /&gt;&lt;br /&gt;Without going into the gory details, I will describe how you can make the most of this feature with the least effort... (of course, if you are a little industrious, you can do really cool things with this feature)&lt;br /&gt;&lt;br /&gt;So, gedit provides a few default scripts:&lt;br /&gt;1. Build (default Ctrl+F9)&lt;br /&gt;2. Remove Trailing Spaces&lt;br /&gt;3. Run Command&lt;br /&gt;&lt;br /&gt;These three should really be quite useful already. &lt;br /&gt;&lt;br /&gt;Here is the one most useful builtin variable that you can read: $GEDIT_CURRENT_DOCUMENT_DIR.&lt;br /&gt;This tells you the path to the currently open document in gedit.&lt;br /&gt;&lt;br /&gt;If you are used to writing shell scripts, you don't need to read any further, really. Just get creative :) But if you are relatively new/uncomfortable with scripts, here goes...&lt;br /&gt;&lt;br /&gt;The shell script that is part of the "Build" command does this:&lt;br /&gt;1. Go to the $GEDIT_CURRENT_DOCUMENT_DIR, and check if there is a makefile there.&lt;br /&gt;2. If yes, execute it.&lt;br /&gt;3. If no, go one level down and try again (until root is reached).&lt;br /&gt;&lt;br /&gt;We will now go ahead and modify the build command so it executes the target of the makefile as well...&lt;br /&gt;Assume your executable has the extension ".out". Then, assuming we know which directory it is in, we can write a simple script to execute this file:&lt;br /&gt;&lt;font face=courier size=3&gt;&lt;br /&gt; cd ${DIR}&lt;br /&gt; OUTFILE=`ls -1 *.out | head -n 1`&lt;br /&gt; exec `echo ./$OUTFILE`&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Apologies for the crappy script. With (a lot) more effort, we can figure out what the exact name of the executable created by make is... but that's a topic for &lt;a href=http://boroleprashant.blogspot.com/&gt;more intellectual characters&lt;/a&gt; and best not broached by lesser beings such as myself...&lt;br /&gt;&lt;br /&gt;For those who want to know what the script does, it goes to the directory where the executable file is present, lists the .out files in the directory, and picks the first one. This first .out file is executed by the 'exec' command. &lt;br /&gt;&lt;br /&gt;Note that we no longer need to explicitly exit from this script because the entire instance of the shell has been replaced by the program that we 'exec-ed'. Basically, when we call this External Tool by pressing Ctrl+F9, gedit starts a shell, and runs this script in the shell. When we call 'exec', the shell process is replaced in memory by the program we executed.&lt;br /&gt;&lt;br /&gt;Now, if we combine this with the original Build script given in gedit, we get this:&lt;br /&gt;&lt;br /&gt;&lt;font face=courier size=3&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;EHOME=`echo $HOME | sed "s/#/\#/"`&lt;br /&gt;DIR=$GEDIT_CURRENT_DOCUMENT_DIR&lt;br /&gt;while test "$DIR" != "/"; do&lt;br /&gt;&amp;nbsp;for m in GNUmakefile makefile Makefile; do&lt;br /&gt;&amp;nbsp;&amp;nbsp;if [ -f "${DIR}/${m}" ]; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo "Using ${m} from ${DIR}" | sed "s#$EHOME#~#" &amp;gt; /dev/stderr&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;make -C "${DIR}"&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cd ${DIR}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OUTFILE=`ls -1 *.out | head -n 1`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec `echo ./$OUTFILE`&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;        fi&lt;br /&gt;&amp;nbsp;    done&lt;br /&gt;&amp;nbsp;    DIR=`dirname "${DIR}"`&lt;br /&gt;done&lt;br /&gt;echo "No Makefile found!" &amp;gt; /dev/stderr&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;The changes we made are highlighted in bold. &lt;br /&gt;&lt;br /&gt;Now, whenever you want to run your program, assuming you have a proper makefile ready, just hit Ctrl+F9 and voila! your program (compiles if required and) starts up. You may later want to add cosmetic changes like remapping this to Ctrl+F5 or whatever. To learn more about the External Tools plugin, just go &lt;a href=http://library.gnome.org/users/gedit/stable/gedit-external-tools-plugin.html.en&gt;Here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-5314461360214532348?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/5314461360214532348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/sprucing-up-gedit-part-2.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/5314461360214532348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/5314461360214532348'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/sprucing-up-gedit-part-2.html' title='Sprucing up gedit: Part 2'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-6835345504164402277</id><published>2009-06-28T06:51:00.000-07:00</published><updated>2009-06-28T07:48:54.852-07:00</updated><title type='text'>Sprucing up gedit</title><content type='html'>For 'true' Linux aficionados, there is Emacs...&lt;br /&gt;For worshippers of the devil, there is VI, and VIM...&lt;br /&gt;For us lesser (non-gui impaired) mortals, there is gedit.&lt;br /&gt;&lt;br /&gt;But like many things open source, gedit can transformed into something vastly more useful for programming purposes. Note that I am not saying that Gedit will be better than eclipse. It is not even close in terms of being a development platform. But once in a while, if you want a simple, lightweight GUI for coding, Gedit can be a serious contender.&lt;br /&gt;&lt;br /&gt;In today's (and maybe tomorrow's) article, I will show you how to go from this:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_hvAXRcz2lxw/Skd6ijwnbVI/AAAAAAAAAZc/LkwWGn83RAc/s1600-h/gedit_old.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 257px;" src="http://3.bp.blogspot.com/_hvAXRcz2lxw/Skd6ijwnbVI/AAAAAAAAAZc/LkwWGn83RAc/s320/gedit_old.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5352381416286416210" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;to this:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_hvAXRcz2lxw/SkeBvSDxevI/AAAAAAAAAZs/xG1sYHyxnnE/s1600-h/gedit_new.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 255px;" src="http://4.bp.blogspot.com/_hvAXRcz2lxw/SkeBvSDxevI/AAAAAAAAAZs/xG1sYHyxnnE/s320/gedit_new.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5352389331454622450" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;GEDIT Plugins:&lt;/b&gt;&lt;br /&gt;Most distributions of linux offer a package called gedit-plugins.&lt;br /&gt;This will give you most of the essential plugins you need to spice up gedit.&lt;br /&gt;&lt;br /&gt;On ubuntu for example, "sudo apt get install gedit-plugins" will get you this package.&lt;br /&gt;&lt;br /&gt;This package will give you, among others, these useful plugins:&lt;br /&gt;1. Code Comment: Comment or uncomment blocks of code (ctrl+M, ctrl+shift+M by default). This plugin is quite clever. It understands various comment formats, and depending on whether you are editing HTML, C, C++, vb or python or whatever else, it uses the appropriate comments.&lt;br /&gt;2. Session Saver: Allow to bookmark working sessions in order to get them back for further use. &lt;br /&gt;3. Terminal: A simple terminal widget accessible from the bottom panel. This, IMO is the coolest feature. You get to use a full bash terminal from within gedit. Compile and run your programs, move around things, browse... perfect if you don't hate the command line, but need some gui to maintain sanity.&lt;br /&gt;&lt;br /&gt;Apart from this, a few of the original (default) plugins are very/somewhat useful too:&lt;br /&gt;1. File Browser: A file browser plugin allowing to easily access your filesystem (includes remote mounts, creating new files/dirs, monitor dirs for changes, etc)&lt;br /&gt;2. Indent: Indents or un-indents selected lines.&lt;br /&gt;3. Spell: Checks the spelling of the current document.&lt;br /&gt;4. Document Statistics: Reports the number of words, lines etc.&lt;br /&gt;&lt;br /&gt;Finally, there are third party plugins. gedit plugins are written in python, so if you are a python geek, &lt;a href=http://live.gnome.org/Gedit/PythonPluginHowTo&gt;Here&lt;/a&gt; is how you can get started. There are a huge number of such plugins, but the one that I personally can't live without is the Autocomplete plugin. Download it here: &lt;a href=http://sourceforge.net/projects/gedit-autocomp&gt;http://sourceforge.net/projects/gedit-autocomp&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Installing custom plugins. The .gnome2 directory:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;gedit (and many other gnome programs) store their settings in a directory called '.gnome2'. This is a hidden directory in your home directory. gedit specifically uses the '.gnome2/gedit/plugins' directory to store its plugins. If this directory does not exist, simply make it.&lt;br /&gt;ie:&lt;br /&gt;&lt;br /&gt;&lt;font size=3 face=courier&gt;mkdir -p ~/.gnome2/gedit/plugins&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;The -p option makes any directory that does not exist in the path that you specify. So, even if the gedit directory is not there, it will be created.&lt;br /&gt;&lt;br /&gt;Now, simply download the plugin and unpack it into the plugins directory, so that you have the file "autocomplete.gedit-plugin" in your 'plugins' directory.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Enabling Plugins in gedit:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;To enable the plugins, after installing all plugins, simply restart gedit. Go to the Edit Menu, and click on Preferences. In the Plugins tab, select the plugins you want to use. Also, while we are in the Preferences menu, we may as well do some other useful things, like enabling Line Numbers (the 'Display Line Numbers' option in the View tab), enabling Auto Indentation (in the 'Editor' tab), and (depending on your preference), using a cooler color scheme, like Oblivion (in Fonts and Colors tab). If you are annoyed with the ~ files that gedit keeps creating, here is your chance to disable backup creation as well (in the Editor tab).&lt;br /&gt;&lt;br /&gt;Finally, to actually see these plugins that you have enabled, you need to go to the View menu, and enable 'Side pane' and 'Bottom pane'. This opens up the file browser, and the terminal plugin.&lt;br /&gt;&lt;br /&gt;In tomorrow's post, we will see how to use another powerful feature, the "External Tools" option.&lt;br /&gt;&lt;br /&gt;More plugins can be found &lt;a href=http://live.gnome.org/Gedit/Plugins&gt;Here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-6835345504164402277?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/6835345504164402277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/sprucing-up-gedit.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/6835345504164402277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/6835345504164402277'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/sprucing-up-gedit.html' title='Sprucing up gedit'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_hvAXRcz2lxw/Skd6ijwnbVI/AAAAAAAAAZc/LkwWGn83RAc/s72-c/gedit_old.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-3650742425414297147</id><published>2009-06-26T21:00:00.001-07:00</published><updated>2009-06-26T22:32:45.588-07:00</updated><title type='text'>The curious case of the CPU Bottleneck: Part 2</title><content type='html'>In continuation of my earlier blogs about the CPU bottleneck in games, today I will look at how the slow CPU affects some of the FPS and strategy titles out there.&lt;br /&gt;&lt;br /&gt;As a refresher, here is the system configuration:&lt;br /&gt;&lt;br /&gt;Opteron 144 @ 1.97 Ghz, 1 GB DDR RAM @ 425 Mhz, MSI GeForce N9800GT 512MB, Core: 715, memory: 800x2, shader: 1680 Mhz&lt;br /&gt;&lt;br /&gt;Stalker: Clear Sky : 19 FPS in towns, 30-35 FPS in the wild.&lt;br /&gt;The fps reported above is at slightly lower than maximum texture detail.&lt;br /&gt;Note that this game, at ultra high detail lags big time on my machine because of the lack of RAM (I have 1 GB DDR memory). A lot of time is spent in swapping from disk, which explains why one of my hard disks is dying :) . Reducing the texture detail to a little above medium really helps fix that problem. &lt;br /&gt;&lt;br /&gt;Crysis: &lt;br /&gt;Here we will look at 3 different configurations:&lt;br /&gt;1. Ultra High, 1440x900, 4xAA: 5 to 12 fps&lt;br /&gt;2. Shaders, Postprocess, Water, Volumetric Effects are Ultra High, rest High, 1440x900, 4xAA: 12 to 15 fps&lt;br /&gt;3. Shaders, Postprocess, are Ultra High, rest High, 1024x768, No AA: 19 to 25 fps.&lt;br /&gt;&lt;br /&gt;Note that the major issue with this game is that there is a lot of disk IO when everything is set to ultra. This reduces the actual FPS due to a lot of loading delays. In the second configuration, this disk IO is reduced, but still a problem, which leads me to think that lack of enough main memory is the problem here. If I can find a few cheap DDR ram modules, I can put this theory to the test. In the third setting, the game is actually playable, and by that I mean you can take headshots with a pistol from quite some distance :)&lt;br /&gt;&lt;br /&gt;Unreal Tournament 3: 35 FPS&lt;br /&gt;This game is highly sensitive to CPU speeds, and is the only game that seems to scale very well with increased number of CPU cores. So, the framerates that we see here are considerably lesser than what is expected of a 9800gt when coupled with a core i7 for example (around 105 fps).&lt;br /&gt;UT3 engine games like gears of war and mass effect, run well, which is good because this is a quite popular engine these days.&lt;br /&gt;&lt;br /&gt;World in Conflict: 50 FPS in non combat, 20-30 fps in heavy combat.&lt;br /&gt;This is at ultra high detail, including cloud reflections etc.&lt;br /&gt;Sadly, this is the only RTS that I have right now. Maybe later, I can do a small test on Company of Heroes, Dawn of War 2 etc...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-3650742425414297147?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/3650742425414297147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/curious-case-of-cpu-bottleneck-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/3650742425414297147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/3650742425414297147'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/curious-case-of-cpu-bottleneck-part-2.html' title='The curious case of the CPU Bottleneck: Part 2'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-8660749405652557889</id><published>2009-06-26T07:29:00.000-07:00</published><updated>2009-06-26T07:51:19.682-07:00</updated><title type='text'>makefiles</title><content type='html'>I have been writing makefiles from quite some time now, but for some reason, I could never get them working correctly. ie: If the file is already compiled, a makefile is supposed to do nothing. In case someone else is having the same issues, here goes:&lt;br /&gt;&lt;br /&gt;Lets say I want to compile a single cpp file (main.cpp), a header (main.h) and produce an output file (main.o)&lt;br /&gt;&lt;br /&gt;this is the simplest makefile:&lt;br /&gt;&lt;font size=3 face=courier&gt;&lt;br /&gt;main.o: main.cpp main.h&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;g++ -omain.o main.cpp&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;The first word "main.o:" refers to the output (compiled) file name. This is called the Target in  literature. &lt;br /&gt;&lt;br /&gt;The Target must be followed by a colon, and a space separated list of files. This list of files (main.cpp main.h) are called the Dependencies. If you run the makefile, and run it again without making any changes, it wont do any compilation the second time. But if you change any of the Dependencies and then run make again, the files will be recompiled.&lt;br /&gt;&lt;br /&gt;Easy enough. Now lets move on to a program with multiple source files. If you have a project with 50 source files, and you change only one file, you dont need to recompile everything again. This is how you do it:&lt;br /&gt;&lt;br /&gt;We have 2 source files, and 2 headers: main.cpp, main.h, blah.cpp and blah.h&lt;br /&gt;Let us say we want the output executable name to be final.o&lt;br /&gt;The following is the makefile for such a setup:&lt;br /&gt;&lt;font size=3 face=courier&gt;&lt;br /&gt;final.o: main.o blah.o&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;g++ main.o blah.o -ofinal.o&lt;br /&gt;&lt;br /&gt;main.o: main.cpp main.h&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;g++ -c main.cpp&lt;br /&gt;&lt;br /&gt;blah.o: blah.cpp blah.h&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;g++ -c blah.cpp&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;This is what it means: The make file runs the first target. The first target is 'final.o'. final.o is dependent on main.o and blah.o. So, both the Targets 'main.o' and 'blah.o' are called. Note the usage of the compiler flag "-c", which tells g++ not to link the files (since we are compiling them independently). We can link them later, as we shall see.&lt;br /&gt;Now that main.o and blah.o are latest versions, then we can go ahead and link both the object files (yes, if you pass only object files to g++, it links them... much better than using ld). &lt;br /&gt;&lt;br /&gt;And there we have it, a makefile!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-8660749405652557889?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/8660749405652557889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/makefiles.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/8660749405652557889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/8660749405652557889'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/makefiles.html' title='makefiles'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-365741639640062593</id><published>2009-06-25T23:53:00.000-07:00</published><updated>2009-06-26T21:00:38.983-07:00</updated><title type='text'>The curious case of the CPU Bottleneck: Results</title><content type='html'>&lt;b&gt;Test Setup:&lt;/b&gt;&lt;br /&gt;AMD Opteron 144 (1.8 Ghz, OCd to 1970 MHz), 1 MB cache.&lt;br /&gt;2x512 MB DDR 400 Mhz RAM (Dual channel, OCd to 425 MHz)&lt;br /&gt;MSI N9800GT 512 MB, Clocks: Core: 715, Shader: 1680, Memory: 800 (1600)&lt;br /&gt;&lt;br /&gt;All benchmarks are at 1440x900, Maximum detail, 4x AA, 16x AF unless otherwise specified. Framerates reported are average FPS of actual game play.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Racing/Simulation games:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;NFS-ProStreet: 12 fps&lt;br /&gt;NFS-Undercover: 15 fps&lt;br /&gt;&lt;br /&gt;In the NFS series of games, we see about 10 to 15 fps hit due to other cars and traffic. On a test track, while playing solo, we get around 25 to 50 fps. This means that the CPU bottleneck is truly noticeable in these games. The AI for the cars in the game seems to be quite intensive on the CPU. A dual core machine could easily turn the numbers in our favor.&lt;br /&gt;&lt;br /&gt;Note that these games aren't all that graphically demanding. My earlier 6800GS gave around 7-10 fps at high detail on NFS Pro-Street. &lt;br /&gt;&lt;br /&gt;Trackmania United: 30 fps&lt;br /&gt;&lt;br /&gt;This is a slightly more stable case for our benchmarks. There are no AI drivers, and the game is highly playable at these frame rates.&lt;br /&gt;&lt;br /&gt;Racedriver GRID: 20 fps&lt;br /&gt;&lt;br /&gt;Another nice game for this test setup. At maximum detail, the game runs smoothly, even with AI players on the tracks. Also, IMO, the best looking racing game out on the PC, and very convincing handling too.&lt;br /&gt;&lt;br /&gt;Tom Clancy's HAWX: 50-60 fps&lt;br /&gt;&lt;br /&gt;A slightly unconventional game. Tried it on a friend's recommendation. Again, the game runs very nicely on this machine. Note that the game has an inbuilt benchmark mode thats a lot more intensive than the actual game. The first part of the bench runs at 60 fps and the second, insanely cluttered one runs at 15 fps. The average, as reported is 25 fps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-365741639640062593?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/365741639640062593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/cpu-bottleneck-results.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/365741639640062593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/365741639640062593'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/cpu-bottleneck-results.html' title='The curious case of the CPU Bottleneck: Results'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-7641874912159347617</id><published>2009-06-25T22:46:00.001-07:00</published><updated>2009-06-26T01:32:12.695-07:00</updated><title type='text'>The curious case of the CPU bottleneck</title><content type='html'>People who bought machines way back in 2005 would probably have an Intel P4 or AMD Athlon 64 single core processor on their hands. Such people, like myself, would sometimes like to play games (yeah, right... sometimes...)&lt;br /&gt;&lt;br /&gt;The price of upgrading to a new processor (a dual/tri/quad machine) is amplified by the fact that a CPU upgrade entails a motherboard and RAM upgrade in most cases (unless you are lucky enough to be stuck with the LGA775).&lt;br /&gt;&lt;br /&gt;On the other hand, upgrading to a better graphics card is terribly cheap these days. Take a look at these prices (May 2009, Bangalore):&lt;br /&gt;&lt;table&gt;&lt;tr&gt;&lt;th&gt;Card&lt;/th&gt;&lt;th&gt;Price in Rupees&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ATI HD4670&lt;/td&gt; &lt;td&gt;5000&lt;/td&gt; &lt;tr&gt;&lt;td&gt;Geforce 9800 GT&lt;/td&gt;&lt;td&gt;6500&lt;/td&gt; &lt;tr&gt;&lt;td&gt;ATI HD4770&lt;/td&gt; &lt;td&gt;8000&lt;/td&gt; &lt;tr&gt;&lt;td&gt;Geforce GTS 250&lt;/td&gt;&lt;td&gt;8500&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Another option is to upgrade the CPU, the motherboard and RAM. Lets look at a reasonable configuration&lt;br /&gt;&lt;table&gt;&lt;tr&gt;&lt;th&gt;Component&lt;/th&gt;&lt;th&gt;Price in Rupees&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Intel E7400 (2.8 Ghz Dual Core)&lt;/td&gt;&lt;td&gt;6500&lt;/td&gt; &lt;tr&gt;&lt;td&gt;Intel Q8200 (2.33 Ghz Quad Core)&lt;/td&gt;&lt;td&gt;8500&lt;/td&gt; &lt;tr&gt;&lt;td&gt;Cheap Motherboard&lt;/td&gt;&lt;td&gt;4000&lt;/td&gt; &lt;tr&gt;&lt;td&gt;4 GB of DDR2 800 RAM&lt;/td&gt;&lt;td&gt;2600&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;So, no matter how you swing, your pockets will get lighter by around 12-15k for the entire deal.&lt;br /&gt;&lt;br /&gt;I am one of those weirdos who has a Single Core 1.8 Ghz CPU with 1 GB DDR RAM, and a grossly overpowered (for this setup) Geforce 9800GT 512MB. Why? I went with option 1... buy a GPU, leave the rest as it was 3 years ago.&lt;br /&gt;Earlier, I had a Geforce 6800 GS, which was by no means a bad card 3 years ago... &lt;br /&gt;&lt;br /&gt;Now that the stage is set, this article will tell you the true story behind the CPU bottleneck in games. How bad is it really, to have a crappy CPU coupled with a reasonably fast GPU? How much difference does the RAM make? These are things you will never see in regular GPU benchmarks, because they use a Core i7 (3 ghz) with 8 GB of 1600 MHz DDR3 RAM... crazy.&lt;br /&gt;&lt;br /&gt;These numbers that I will be reporting are not in the true sense a benchmark, they are just a bunch of readings. I dont really have comparision data in most cases. Maybe I will put in some numbers from my friend, who has a Pentium 4 Dual Core rig with a 8800GS.&lt;br /&gt;&lt;br /&gt;Watch this space for actual results over the next few days...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-7641874912159347617?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/7641874912159347617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/curious-case-of-cpu-bottleneck.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/7641874912159347617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/7641874912159347617'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/curious-case-of-cpu-bottleneck.html' title='The curious case of the CPU bottleneck'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-5028656606592834309</id><published>2009-06-25T19:50:00.001-07:00</published><updated>2009-06-25T19:58:12.683-07:00</updated><title type='text'>A tale of 2 HDDs</title><content type='html'>I happen to have 2 sata hard disks on my current machine. Both are 160 GB segate drives. One of them is dying... it wrote a song about how nice the world would be if the wars and bloodshed stopped. Kindly donate 1 dollar to the hard disk recovery fund... um, oh, wrong story...&lt;br /&gt;&lt;br /&gt;They are identical except that one of them has 8 MB cache, and another has 16 MB cache. Note that you could arbitrarily get one of these hard disks when you go and buy one from the store. People dont really care about the cache size on hdds, and they just go by brand name and capacity. People are wrong!! Look below to see a benchmark of these hard disks in action. I am trying to be a little sneaky, so I wont tell you which one has how much cache... Lets see if you can figure that out on your own ;)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_hvAXRcz2lxw/SkQ3ptGxy6I/AAAAAAAAAZM/vVsW-qZ-1N4/s1600-h/HDTune_Benchmark_ST3160812AS.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 261px;" src="http://2.bp.blogspot.com/_hvAXRcz2lxw/SkQ3ptGxy6I/AAAAAAAAAZM/vVsW-qZ-1N4/s320/HDTune_Benchmark_ST3160812AS.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5351463446845180834" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hvAXRcz2lxw/SkQ3peZtziI/AAAAAAAAAZE/bDwsv3_w3p4/s1600-h/HDTune_Benchmark_ST3160211AS.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 261px;" src="http://1.bp.blogspot.com/_hvAXRcz2lxw/SkQ3peZtziI/AAAAAAAAAZE/bDwsv3_w3p4/s320/HDTune_Benchmark_ST3160211AS.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5351463442898079266" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-5028656606592834309?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/5028656606592834309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/tale-of-2-hdds.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/5028656606592834309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/5028656606592834309'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/tale-of-2-hdds.html' title='A tale of 2 HDDs'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_hvAXRcz2lxw/SkQ3ptGxy6I/AAAAAAAAAZM/vVsW-qZ-1N4/s72-c/HDTune_Benchmark_ST3160812AS.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364017353841045328.post-9071562469623032983</id><published>2009-06-25T19:46:00.000-07:00</published><updated>2009-06-25T19:49:57.612-07:00</updated><title type='text'>Wassup!!!</title><content type='html'>So, um... welcome, i guess....&lt;br /&gt;Here is another blog I had to start. I guess there is stuff I sometimes want to write, but there is no easy way of putting it up on the web...&lt;br /&gt;&lt;br /&gt;Not in the mood to write a long story about what this blog is going to contain (its early morning and its raining), so here is a simpler way of doing things:&lt;br /&gt;&lt;br /&gt;Keywords: Computers, Programming, Gaming, Hardware, Benchmarks, and anything else i want to put up here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/364017353841045328-9071562469623032983?l=randomscribblepad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://randomscribblepad.blogspot.com/feeds/9071562469623032983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/wassup.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/9071562469623032983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364017353841045328/posts/default/9071562469623032983'/><link rel='alternate' type='text/html' href='http://randomscribblepad.blogspot.com/2009/06/wassup.html' title='Wassup!!!'/><author><name>Kashyap</name><uri>http://www.blogger.com/profile/11480547162421446135</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
