tag:blogger.com,1999:blog-106423922024-03-21T16:08:17.350-07:00Sushovaner JibonJatraThis is my personal diary. If you are reading this, I completely approve of it.Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.comBlogger35125tag:blogger.com,1999:blog-10642392.post-35692370941040160782024-01-20T05:45:00.001-07:002024-01-20T05:55:58.890-07:00Windows Task Manager is lying to you, and I don't know how to make it stop<p>If you use Windows, you might be intimately familiar with Windows Task Manager, which has a performance tab that shows the utilization percentage of various hardware in your system. Today, we're looking at CPU utilization. It looks a bit like this:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY2UBTW7AgJKw4pAzr8wpwUVvZ-2N23D4xAEyvuvxTyhrlmPwt4gtYMUleNBLfmnWFE2Jbf_hsyOi3FJQKwl8UUh4FDz-iwQMaHwOXiMeA34VtxqOc7NuZ1RqRtww89-AeF0NS3uAzhUbmErSiHZ3RPMko7KRzLDw86ZRLw6n3lfYvkVlvXZkZ/s959/Task%20Manager%202024-01-20%205.42.25%20PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="679" data-original-width="959" height="357" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY2UBTW7AgJKw4pAzr8wpwUVvZ-2N23D4xAEyvuvxTyhrlmPwt4gtYMUleNBLfmnWFE2Jbf_hsyOi3FJQKwl8UUh4FDz-iwQMaHwOXiMeA34VtxqOc7NuZ1RqRtww89-AeF0NS3uAzhUbmErSiHZ3RPMko7KRzLDw86ZRLw6n3lfYvkVlvXZkZ/w503-h357/Task%20Manager%202024-01-20%205.42.25%20PM.png" width="503" /></a></div><p>The problem is that the meaning of the word utilization is very tricky. There can be multiple meanings:</p><p></p><ol style="text-align: left;"><li>At the current time, with the current settings, what fraction of time is it executing instructions vs lying idle?</li><li>At any time, with the most optimum settings, this CPU could practically complete a number a instructions at a certain rate. What percentage of that rate is it currently working at?</li></ol><div>I think the Windows Task Manager is currently using definition #1 above. This is useful for a person to look at the graph and understand "is there a runaway process on my system that is pegging my CPU"? However, consider the alternate use-cases:</div><div><ul style="text-align: left;"><li>I am trying to run a long-running program, am I getting my money's worth out of this CPU?</li><li>I am trying to run a difficult to run program, are there some settings I should change to make this go faster?</li><li>Is my program optimized properly for the architecture of the CPU I am running it on?</li></ul><div>These questions cannot be answered by Task Manager the way it is currently displaying information. I would argue, using definition #2 above would provide a much better answer for these use-cases.</div></div><div><br /></div><div>In order to create a UI that effectively displays the utilization according to definition #2 above, it will have to consider the following things:</div><div><ul style="text-align: left;"><li>What is the current idle time for each core? (This is common for all definitions).</li><li>What is the current clock frequency for each core?</li><li>What is the maximum base clock frequency that each core can sustain long-term?</li><li>What is the maximum clock frequency that each core can achieve when the CPU decides to Turbo?</li><li>What is the maximum clock frequency that you can realistically achieve with a stable system if you chose to overclock?</li><li>Which cores are of what type, distinguishing between performance and efficiency cores?</li><li>If the CPU supports hyperthreading, which logical cores are actually part of the same physical core?</li></ul><div>This is quite difficult, but with a UI that carefully displays this information, I think we can help people make the most of their CPUs.</div></div><p></p>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-49913451919385914032023-02-12T09:27:00.001-07:002023-02-12T10:28:04.208-07:00Setting coordinates in Phaser where the body and the sprite are offset from each otherIf you're using <a href="https://phaser.io/">Phaser</a> with <a href="https://brm.io/matter-js/">matter physics</a>, sometimes you might need to set a body of a different size from your sprite. That's pretty easy, simply by setting the width and height of the body. But if your physics body is offset from where the sprite is, then one has to use the <a href="https://newdocs.phaser.io/docs/3.55.2/Phaser.Physics.Matter.Image#setOrigin">setOrigin</a> method to fix this. This can be tricky.
This diagram might help explain how origin is used, where 'visual' is the sprite, and 'body' is the physics hitbox:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQRVXogGG0l7QYc_gzxx6uurQqjF4aRaduDPVFIQRmOsnb1VeX-mRPZ8nYg2FOBxDDzof6F6mUjjtRlbo4wIGd0NFxv8T_NwvhdWak4xwXTwMwpLffXVpJr4dv-OF7DNp0nM3yIbolAuyCTKspTCAiOG57aPV1r0D6I7hiLk7ZjBJGGjyTnA/s1032/Screenshot%202023-02-12%20214911.jpg" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="640" data-original-height="405" data-original-width="1032" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQRVXogGG0l7QYc_gzxx6uurQqjF4aRaduDPVFIQRmOsnb1VeX-mRPZ8nYg2FOBxDDzof6F6mUjjtRlbo4wIGd0NFxv8T_NwvhdWak4xwXTwMwpLffXVpJr4dv-OF7DNp0nM3yIbolAuyCTKspTCAiOG57aPV1r0D6I7hiLk7ZjBJGGjyTnA/s640/Screenshot%202023-02-12%20214911.jpg"/></a></div>
And finally, if you do some algebra to find the origin, you can use the following code:
<code><pre>
// SPDX-License-Identifier: Apache-2.0
const visualX = 150;
const visualY = 150;
const visualWidth = 120;
const visualHeight = 120;
const bodyX = 200;
const bodyY = 200;
const bodyWidth = 180;
const bodyHeight = 180;
const originX = (bodyX - visualX) / visualWidth + 0.5;
const originY = (bodyY - visualY) / visualHeight + 0.5;
const sprite = this.matter.add.sprite(bodyX, bodyY, 'mage');
sprite.setBody({
type: 'rectangle',
width: bodyWidth,
height: bodyHeight
}, {
isSensor: true,
});
sprite.setOrigin(originX, originY);
</pre></code>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-79778512329300286282021-05-28T20:28:00.001-07:002021-05-28T20:28:44.209-07:00Laptop Surprises: Lenovo Yoga Slim 7i<p>I recently bought a Lenovo Yoga Slim 7i (Model 14ITL05). I really like it. I am trying to write down everything that surprised me about the laptop in here. These are mostly things that did not understand about the machine from the product page on Lenovo when ordering. I'll start off with the pleasant surprises:<p>
<ul>
<li>There is <a href="https://www.embedded.com/lenovo-adds-novelda-uwb-sensor-for-human-presence-detection-in-thinkpad/">some sort of radar sensor</a> on the top on the screen, in the webcam area. When I come and sit on my chair in front of the laptop, it wakes the screen and then Windows Hello logs me in with face ID. This is great!</li>
<li>There is a feature called <strong>Battery Conservation Mode</strong>. What it does is: it pauses charging the battery when it reaches somewhere between 55 and 60%. So you can get the full performance out the CPU without adding a lot of wear on the battery. It allows the CPU to go to full performance with all the wattage coming from the AC adapter without worrying about battery wear. However, I would like to know more about this, and exactly why the battery percentages were chosen around 55 and 60%.</li>
<li>They keyboard is great. Not too surprising, considering it's a Lenovo, but still worth mentioning. However, the arrow keys are not in the inverted T-style, which makes it hard to find them by touch alone.</li>
<li>Microsoft Office Home & Student 2019 was included. I had assumed that this must have been a trial of Office 365, or maybe the first year was included, but no: this is the single-machine, perpetual license of Office. I wasn't expecting that.</li>
</ul>
<p>Now for some of the things that are missing, that I had either assumed would be good, or I had not realized would be problems:</p>
<ul>
<li>No touchscreen, and no pen digitizer.</li>
<li>A 16:9 screen ratio is significantly less height than I am used to. My points of comparison are a Macbook Air and a Surface Pro 4. This is somewhat ameliorated by using 2-column layouts in my editors (like VS Code).</li>
<li>The quality of the webcam is pretty bad. My point of comparison is The external Logitech C920, which is one of the best webcams around. Incidentally, the external C920 produces better picture quality (and sharper focus) on this Windows machine than on my corp Macbook Air, but I don't know why. Maybe the drivers are better?</li>
<li>There was a bit of crapware that I had to uninstall. I do like the Lenovo Vantage application, it lets you tweak some of the settings on the machine.</li>
<li>The hinge on the screen is too tight when it is fully closed, so I can't open it with one hand. But when open, it is too loose; when I pick up the laptop from my lap and plonk it down on the bed, the screen swivels away from me and almost lies flat.</li>
</ul>
<p>Note: This list only includes things that I was surprised by, I am not including stuff that I liked and already knew about. For example, I knew this was Intel's evo branded laptop, which means 11th gen CPU with good battery life and performance. I also knew, for example, that I would be able to play older games and e-sports titles with the Iris Xe graphics.</p>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com1tag:blogger.com,1999:blog-10642392.post-24845362108356882382017-04-07T20:49:00.000-07:002017-06-05T00:05:30.073-07:00How not to make customers happy
<div dir="ltr" style="text-align: left;" trbidi="on">
<p>I recently moved to Bangalore and subscribed to Vodafone. About a week and a half into the subscription, I get this SMS at 5:45 am, clearly designed to be as missable as possible.</p>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwKJP1VZkjD8kICmgRJ-758gzxo-nONgnsASoZEdlemd0pGA_X9EQpMrOXA-_y4lG23DzKMBr2-INUR3Q7cjhMsn9uD3d4kNhOUcVQ8mmZ9ShOfuOBLLfkMrcj6Tt6D2EpuSTh/s1600/Screenshot_20170408-090953.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwKJP1VZkjD8kICmgRJ-758gzxo-nONgnsASoZEdlemd0pGA_X9EQpMrOXA-_y4lG23DzKMBr2-INUR3Q7cjhMsn9uD3d4kNhOUcVQ8mmZ9ShOfuOBLLfkMrcj6Tt6D2EpuSTh/s320/Screenshot_20170408-090953.png" width="320" height="137" /></a></div>
<p>I hadn't subscribed to any such service. This seems flat out illegal. Anyway, I followed the message and immediately sent a STOP to the number. What followed is a hilariously intentionally vague UX:</p>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwEChym2X4854GGfieI71c62R70_blx6SDPSE16axFLiSJrLW7DFGWLdynLDVfqSmBOvTkv8mj3wIcGdOgqv3gSniz5OViFsMnZkV9PCjN4eShAjik7h1ZCrcYhIEoJpaFkrms/s1600/Screenshot_20170408-054901.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwEChym2X4854GGfieI71c62R70_blx6SDPSE16axFLiSJrLW7DFGWLdynLDVfqSmBOvTkv8mj3wIcGdOgqv3gSniz5OViFsMnZkV9PCjN4eShAjik7h1ZCrcYhIEoJpaFkrms/s320/Screenshot_20170408-054901.png" width="320" height="258" /></a></div>
<p>What do you have to respond? I was almost tempted to respond with "1, 2, 3" but instead did the 'logical' thing and punched in 1. I got a confirmation that it has been disabled.</p>
<p>I have no idea what the silk service is, or whether I will be charged for it in my next bill. Let's see.</p>
<br /></div>
<p><strong>EDIT:</strong> They did charge me for it, but I was able to call customer service and reverse the charge. It turns out that the imgur app for Android was injecting bad ads in the background that signed up the device for these things. My suggestion: do not use the imgur app on vodafone mobile data.Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-34330116644703854682015-04-13T00:21:00.000-07:002015-07-22T09:52:30.133-07:00Trouble installing KB2881553<div dir="ltr" style="text-align: left;" trbidi="on">
<p>EDIT: The error is back :( These instructions did not help.</p>
<p>EDIT 2: The error is mysteriously gone :) I think Microsoft did some magic on their end. I am back on automatic updates!</p>
<p>For a long time, I was having trouble installing <a href="https://support.microsoft.com/en-us/kb/2881553">KB2881553:</a> Update for the English Input Personalization Dictionary on Windows 8.1. These are rough notes on <del>how I resolved it</del>.
<h3>The problem:</h3>
<ul>
<li>KB2881553 is supposed to be only offered on machines that have a touch keyboard with lots of usage. I think it was offered on my desktop accidentally, because I also use a tablet PC with touch on the same Microsoft Account.</li>
<li>If you hide the update, it doesn't go away, because a new version of the file is offered on Windows Update within a few days, on the same KB number.</li>
<li>The error code was 6B2.</li>
</ul>
<h3>The solution:</h3>
<ul>
<li>I was mostly guided by <a href="https://social.technet.microsoft.com/Forums/systemcenter/en-US/64d01ac3-8262-4929-a9b4-542f5ecb7dbe/solution-how-to-fix-broken-installation-of-kb2881553-error-6b3?forum=w8itprogeneral">this very helpful post</a>.</li>
<li>The gist of the problem is that the previous update .msi cannot be found, so you have to convince Microsoft that either (i) your package is up to date, and place the correct .msi where Windows will find it, or (ii) convince Windows that no previous update version has been installed.</li>
<li>I believe I was able to accomplish (ii) by setting the following registry key:
<blockquote><code><pre>[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InputMethod\en-US\DUSTATE]
"Enabled"=dword:00000000</pre></code></blockquote>
Just restart after that, and check for updates, and it probably will work.</li>
<li>However, before I did that, I was trying to accomplish (i), and so I will tell what I did for that also.
<ul>
<li>Open IE (does not work on chrome), and go to http://catalog.update.microsoft.com/v7/site/Search.aspx?q=KB2881553</li>
<li>It will let you download the .msi</li>
<li>Extract it <code>msiexec /a EnUsBing_amd64.msi /qb TARGETDIR=c:\full\path\to\target\folder</code></li>
<li>Use the extracted file <code>trending-ngrams-en-us.hwrdict</code> to replace your existing version <code>C:\Program Files\Common Files\microsoft shared\ink\HWRCustomization\trending-ngrams-en-us.hwrdict</code></li>
<li>Also update the version in the registry <blockquote><code><pre>[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InputMethod\en-US\DICTS]
"trending-ngrams-en-us.hwrdict"="16.1.1460.1"</pre></code></blockquote>
You can find the current version by looking at what Windows Update is offering you.
<li>Make sure you also add the registry in (ii) above</li>
</ul></li>
</ul>
<br /></div>
Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com1tag:blogger.com,1999:blog-10642392.post-76727050810223522222012-03-03T22:48:00.001-07:002012-09-14T11:30:42.483-07:00Dark Fonts and Colors for light theme in VS 11<div dir="ltr" style="text-align: left;" trbidi="on">
<p><strong>Update:</strong> The <a href="http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05" target="_blank">VS 2012 Color Theme editor</a> has a lot more options and subsumes the functionality of this settings file. Check it out!</p>
<p>———————————————</p>
Visual Studio 11 comes in two themes: dark and light. I like how the code looks in the dark theme (since it is easy on the eyes), but I like how the menus and toolbars look in the light theme (the buttons look sufficiently different from each other.)<br />
<br />
So if you want to use the colors and fonts of the dark theme with the light theme UI, you would think you could just export out the fonts, change the theme, and import them back in. However, this has the bizarre side effect of causing all the fonts to become bold.<br />
<br />
So I went into the theme file and manually changed all the BoldFont="Yes" invocations, and finally I have a theme I like. You can download this settings file if you like, it has only the Fonts and Colors, so it should not mess up any of your other settings.<br />
<br />
<a href="https://sites.google.com/site/sushovande/downloads/DarkOnLightUnBold.vssettings?attredirects=0&d=1">Download Visual Studio 11 Dark Fonts and colors settings file for the light theme.</a><br />
<br />
Here is a screenshot of the result, thanks for suggesting it, Quaiche of Dragonblight.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8giFoZpf_meO_sHSbV3k7eXEWaClZWIgqeUyw7_S-xUcWXqsjuvJS-jzRvk5qr2HNeTLSPQRugqa2B9bRB__i6SYXW_jO-8UULXwf0KMqZVX6JU7YpQ3vgW4vUdZdtrUog6tB/s1600/screenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8giFoZpf_meO_sHSbV3k7eXEWaClZWIgqeUyw7_S-xUcWXqsjuvJS-jzRvk5qr2HNeTLSPQRugqa2B9bRB__i6SYXW_jO-8UULXwf0KMqZVX6JU7YpQ3vgW4vUdZdtrUog6tB/s320/screenshot.png" width="320" /></a></div>
</div>
Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com3tag:blogger.com,1999:blog-10642392.post-19125363443013639402012-01-22T18:29:00.001-07:002012-01-22T18:30:36.931-07:00Rhyming Harry Potter kweezz<div dir="ltr" style="text-align: left;" trbidi="on">A long time ago, I had made a Rhyming Harry Potter kweezzz. It was archived on kweezzz.com, but it has since been domain squatted. So I decided to post it here for safekeeping, thanks to archive.org for the data.<br />
<br />
<strong>Theme:</strong> Harry Potter Rhyming Quiz (All questions will rhyme, the answers may or may not)<br />
<strong>Date:</strong> 16th Oct, 2010<br />
<strong>Kweezzz-master:</strong> <a href="http://twitter.com/sushovande" target="_blank">@sushovande</a><br />
<span id="more-7850"></span><br />
<a name='more'></a><br />
<strong>Q0:</strong> Gave my flesh and got back silver, ratted my friends with nary a quiver, Show me a cat and I go pale, scare me not I am ____<br />
<br />
<strong>Q1:</strong> When amorphous blackness makes it a blight, hold me aloft for instant eyesight!<br />
<strong></strong><br />
<strong>Q2:</strong> You see a mermaid here, frescoed on the wall, what room in Hogwarts am I, pine fresh will let in y’all<br />
<strong></strong><br />
<strong>Q3:</strong> Snack me to skive, In curtains I thrive, Color me gray, Kill me with spray<br />
<br />
<strong>Q4:</strong> At Christmas-time my name draws weird sleds, my wife is so evil that her everyone dreads<br />
<br />
<strong>Q5:</strong> A very advanced charm am I, an idea darkening the arm of Lestrange. Hermione cast me, very casually, on a bunch of loose change.<br />
<br />
<strong>Q6:</strong> Karkus was my lord, very difficult to find, but don’t be intimidated – my son is very kind.<br />
<br />
<strong>Q7:</strong> Harry intrudes here, where Voldemort keeps, Hermione says here that Draco’s pretty neat.<br />
<br />
<strong>Q8:</strong> Clickety clackety and answer me trump, Beedledy Bardledy had made me jump, stupidest story name in the whole lump.<br />
<br />
<strong>Q9:</strong> When someone says Ron’s name, this heirloom of much fame, takes him from where in shame, he had once upon came<br />
<br />
<strong>Q10:</strong> Would you like a firewhisky? Butterbeer with a float? The only thing I don’t serve, is an unexperimented goat!<br />
<br />
<strong>Bonus Q 1:</strong> I’m blue and am enchanted, Arthur Weasley can’t be taunted, Fly in me and you’ll yodel, What’s my make and model?<br />
<br />
<strong>Bonus Q 2:</strong> In Hogwarts I teach you to look at the skies, My name’s a bit creepy, so tell me no lies.<br />
<br />
<strong>Winners:</strong><br />
<a href="http://twitter.com/blinkandumissit">@blinkandumissit</a> – 20 points<br />
<a href="http://twitter.com/cheese_charmer" target="_blank">@cheese_charmer</a> – 15 points<br />
<a href="http://twitter.com/krtgrphr" target="_blank">@krtgrphr</a> – 13 points<br />
<br />
<strong>Answers:</strong><br />
<strong>A0: </strong>Wormtail<br />
<strong>A1: </strong>(Malfoy's) Hand of glory <br />
<strong>A2: </strong>Prefect's bathroom<br />
<strong>A3: </strong>Doxy (a component of skiving snackboxes, can be killed with spray)<br />
<strong>A4: </strong>Rodolphous Lestrange<br />
<strong>A5: </strong>Protean charm<br />
<strong>A6: </strong>Giantess Fridwulfa (Hagrid's mom)<br />
<strong>A7: </strong>Borgin & Burkes (Voldemort was shopkeeper here, Hermione tried to get something claiming Dravo was her friend)<br />
<strong>A8: </strong>Babbity Rabbity and her Cackling Stump, one of the stories from Beedle the Bard<br />
<strong>A9: </strong>Deluminator<br />
<strong>A10:</strong> Aberforth Dumbledore<br />
<strong>Bonus1:</strong> Ford Anglia<br />
<strong>Bonus2: </strong>Prof Sinistra</div>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-41449124797308965912011-06-09T00:05:00.004-07:002011-08-22T16:53:30.155-07:00Don't let Google track your entire browsing historySo Google has recently publicized the <a href="http://www.google.com/+1/button/">"+1" button</a> for websites, which "competes"<sup>[1]</sup> with the <a href="http://developers.facebook.com/docs/reference/plugins/like/">Facebook [Like]</a> button and the <a href="http://twitter.com/goodies/tweetbutton">Twitter tweet</a> button. This is a much more worrisome phenomenon than we give it credit for. <br />
<br />
Notice how the Facebook like button is instantly able to tell you which of your friends have liked that page? That is because Facebook is able to correlate your Facebook login with every page you visit. In order to see if any of your friends have liked that page, Facebook <i>has</i> to correlate the URL to your friend list. So even if you haven't clicked [Like], even if none of your friends have clicked [Like], just to be sure of that fact, Facebook will send the URL and your Facebook login to its servers, building up your entire browsing history.<br />
<br />
And now Google has done it. Twitter did it even before Facebook.<br />
<br />
I implore you, do not let these corporations track you everywhere you go. This will only end badly. Fortunately there is an easy fix. Add the following URLs to your AdBlock / InPrivate Filtering lists<sup>[2]</sup>:<br />
<br />
<blockquote>http://www.facebook.com/plugins/like.php*<br />
<br />
http://platform.twitter.com/widgets.js<br />
<br />
https://apis.google.com/js/plusone.js<br />
<br />
*s7.addthis.com/static/*<br />
<br />
https://plusone.google.com/u/<br />
</blockquote><br />
This does not mean sharing stuff with your friends has to get harder. You can just use any of the share bookmarklets: Here is <a href="http://dev.twitter.com/pages/share_bookmarklet">the one for twitter</a>, and here is <a href="http://www.facebook.com/share_options.php">the one for facebook</a>. There isn't one for Google +1, because it is not a sharing service at it's core, but there is <a href="http://www.ampercent.com/share-page-google-gmail-buzz-bookmarklet/5199/">a bookmarklet for sharing on Google Buzz</a>, if that is your thing.<br />
<br />
<b>EDIT:</b> Added iFrame-based URLs for Google +1 and Tweet button. Akshay's comment below discusses some other alternatives too.<br />
<br />
<b>EDIT 2:</b> I have made a <a href="http://app.sushovan.de/blocksn.html">Tracking Protection List against social network tracking for IE9</a>. Go there for a one-click setup.<br />
<br />
<sup>[1]</sup> They don't really 'compete', <i>per se</i>. Each of them crops up on every website out there.<br />
<br />
<sup>[2]</sup> I am working on getting those URLs, in addition to the LinkedIn, Digg and StumbledUpon share into an AdBlock/InPrivate filtering list. Until then, you need to do this manually.Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com1tag:blogger.com,1999:blog-10642392.post-30329208028895577932011-01-08T03:10:00.002-07:002011-01-08T03:14:23.959-07:00How to import facebook birthdays to your WIndows Phone calendar<p>Step 1: Use the Birthday Exporter facebook app <a title="http://apps.facebook.com/ical_exporter/" href="http://apps.facebook.com/ical_exporter/">http://apps.facebook.com/ical_exporter/</a></p><p>Step 2: Save the ICS file that it generates</p><p>Step 3: Open up the ICS file in a text editor. Preferably one that can record macros. To each <code>VEVENT</code> entry in the ICS file (demarcated by <code>BEGIN:VEVENT</code> and <code>END:VEVENT</code>) add the following two tags:<br /><code>X-MICROSOFT-CDO-BUSYSTATUS:FREE<br />TRANSP:TRANSPARENT <br />
</code><p>Step 4: Go to the Windows Live Calendar that is linked to your Windows Phone account. Click on “Subscribe”, click “Import from an ICS file” and then import the file into your calendar.</p><p>Step 5: Wait a while. Your calendar on the phone will reflect the new entries shortly</p><p> </p><p>Note 1: Step 3 is important, otherwise you will be shown as busy on the calendar, and windows phone will report conflicts on the calendar (shown with two arrows pointing towards each other diagonally)</p><p>Note 2: Currently windows phone only syncs the primary calendar of the live id. If you don’t want to mess up the primary calendar, create a new throwaway live id and import it into that calendar. Add that account on your phone, and choose to sync only the calendar.</p>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com1tag:blogger.com,1999:blog-10642392.post-58501774600654242402011-01-06T22:42:00.001-07:002011-01-06T22:42:14.750-07:00Sometimes programs delight you<p>So I bought an Xbox controller for the PC, and plugged it in while Mafia II was running. It installed the drivers, and as soon as I pressed a button on the controller, it instantly responded, the on-screen menu items changed to reflect the new control scheme, and force feedback started working.</p> <p>It’s some of these experiences that keeps one interested in engineering and inspires one to bring a bit more joy to people’s lives.</p> Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-18753844366520887702011-01-03T00:35:00.001-07:002011-01-03T00:35:22.707-07:00Undeletable folders on Windows 7 after move (part of library)<p>So the other day I was doing regular housekeeping on my Win 7 desktop, and I was moving stuff around, to make space for all these games I acquired from the steam sale. I move the “Movies” folder from drive G to drive S. The move completes, but there is still a Movies folder in my G drive.</p> <p>I can’t open it. I can’t takeown it. I can’t icacls it. And I am an admin.</p> <p>Turns out – that folder was referenced from a library (the videos library). I opened the video library, clicked on the (8 locations) link, and removed the G:\Movies from the list. Poof! the folder vanished.</p> Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-41974528240995029362010-11-09T22:28:00.002-07:002010-11-09T23:13:48.020-07:00Importing contacts from iPhone to Windows Phone 7<p>So you moved from an iPhone to a Windows Phone 7. How do you move your contacts over?</p><p>Step 1: Sync your iPhone to your computer, and make sure you sync your contacts (look under data or information in iTunes). Exporting to Outlook or to Windows Contacts would work best.</p><p>Step 2: If using outlook, go to contacts and export all the contacts to CSV. If using Windows Contacts, go to your Contacts folder on your computer, and hit the “Export” button in the toolbar, and save as CSV. <strong>Be SURE to export the Mobile number</strong>, which is not selected by default.</p><p>Step 3: Browse to contacts.live.com, and sign in using the same live id your Windows phone is tied to. Click Manage, then click “Import”. Click Outlook, and then import the file you created earlier.</p><p>You’re done! The contacts you just added will appear on your phone within the next 30 mins (by default).</p><p><strong>Update:</strong> It appears that there is no easy way to export the phone numbers marked as "iPhone" in your iPhone contacts. Will update if I find a way / make a tool to do so.</p>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-28096431857023750322010-08-31T05:08:00.001-07:002010-08-31T05:08:04.335-07:00SQLite on iPhone<p>It seems that many of the internal stores on the iPhone are actually SQLite databases.</p> <p>The database that stores your text messages are located in /private/var/mobile/Library/SMS/sms.db and can be manipulated with any SQLite client. Similarly, Voicemail database is located at /private/var/mobile/Library/Voicemail/voicemail.db. That same folder also contains all your voicemail audio files, so you can back them up too, if you want.</p> Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-27819803706407223702010-08-15T20:21:00.001-07:002011-01-19T12:25:17.785-07:00Using powershell to batch rename some filesNow that powershell comes pre-installed on all copies of Win7, we can use it to perform day-to-day tasks.<br />
Here is the first tip: to batch rename a bunch of files, such that the first 3 characters are deleted from the filename, issue the command:<br />
<code>dir | foreach -process {mv $_.Name $_.Name.Substring(3)}</code><br />
<br />
Update: I will be updating this post with more snippets as I come across them<br />
<br />
1. Here is how to create a graphics object in powershell, and draw a bunch of lines on it.<br />
<code>$bmp = new-object System.Drawing.Bitmap(264, 264)<br />
$graphics = [System.Drawing.Graphics]::FromImage($bmp)<br />
for($i=1; $i -lt 9; $i+=1) { $graphics.DrawLine($pen, 33*$i, 0, 33*$i, 264); }</code><br />
<br />
2. Here is how to set the current directory so that .NET objects know it<br />
<code>[Environment]::CurrentDirectory = $pwd</code><br />
<br />
<br />
3. Here is how to download a file<br />
<code>$c = new-object System.Net.WebClient<br />
$c.DownloadFile( url, filename )</code><br />
<br />
4. Concatenate a bunch of files together<br />
<code>cat misc*.txt | Out-File allmisc.txt -Encoding ASCII</code><br />
or<br />
<code>cat misc1.txt,misc2.txt,misc3.txt > allmisc.txt</code><br />
<br />
5. Delete all (possibly hidden) subfolders that are called CVS<br />
<code>dir -Force -Include *CVS -R . | % { $_.FullName } | % {rmdir -Recurse -Force $_}</code>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-31887530477017682872010-04-16T20:33:00.002-07:002010-04-16T20:37:57.536-07:00Dark background for VS 2010Now that Visual Studio 2010 is out, you obviously need a dark background for it. The problem with other dark backgrounds out there is that they change too much - for me, if comments aren't green the universe pretty much collapses.<br />
<br />
So here is a 9KB settings file which will simply change the background of your text editor to black, keeping keywords blue and comments green. Certain other elements' colors were changed to match. Enjoy, and leave a comment if you found it useful.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO37X427L-XQ9EKpzfQadrDwMqdkV0n0QKq4lHxeH-z0HEOsFgv1bPYyzywko1yLfjXB_zsmXaMMNdbnChNhmRz-Qz7bbe5181BkZscZKcfhq9ZDVyiJkChM5O0ZK9vAJY-3p1/s1600/vs-colors.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="380" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO37X427L-XQ9EKpzfQadrDwMqdkV0n0QKq4lHxeH-z0HEOsFgv1bPYyzywko1yLfjXB_zsmXaMMNdbnChNhmRz-Qz7bbe5181BkZscZKcfhq9ZDVyiJkChM5O0ZK9vAJY-3p1/s640/vs-colors.png" width="640" wt="true" /></a></div><br />
<br />
<a href="http://sites.google.com/site/sushovande/downloads/OnlyFonts_2010.vssettings?attredirects=0&d=1">OnlyFonts_2010.vssettings</a>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-62662586212570514622010-02-03T14:53:00.003-07:002010-02-03T14:58:33.769-07:00Compiler restrictions are no match for natural oversightYou'd think that with the restrictions in Java / C# that the only things you can put in an 'if' block be bool's, you'd avoid all kinds of single equals sign vs double equal sign errors, but look at what I ran into today:<br /><div><code><br />bool IsGood = false;<br />bool IsSupposedToBeGood = false;<br />if (IsGood = IsSupposedToBeGood && otherConditions)<br />{<br /> // do something assuming IsGood is IsSupposedToBeGood<br />}<br /></code></div><br /><div><br />Sigh.. if the quantities you are checking equality for are bools, you're out of luck. I guess I can't let my guard down in C# / Java either, now.<br /></div>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com1tag:blogger.com,1999:blog-10642392.post-29911745647140343262007-06-15T10:05:00.000-07:002007-06-15T10:10:10.445-07:00My last post from kgpWell... this is kinda it. Four years of partying is nearly over. It seems weirdly normal, like it is not even real that I am probably never going to come back to kgp in my capacity as a student.<br /><br />kgp gave me so many things I will never forget. The main problem is most of these thoughts are buried so deep in emotion that they can't be expressed here. So, 20-year-older-me: don't be disappointed that you can't use this page to reminisce about your <em>alma mater</em> - you couldn't have done it anyway.<br /><br />I'll never forget you - not the sunlit days, nor the moonlit nights.Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-83669359549601113562007-06-09T09:58:00.000-07:002007-06-09T10:32:26.731-07:00How to make Vista style iconsNormally I don't blog just to link to another page, but this tutorial on <a href="http://blogs.msdn.com/expression/archive/2007/06/08/creating-a-vista-style-button-template.aspx">Creating a Vista Style button template</a> is just so compelling, that I gave in.<br /><br />Here is a sample of what you can make. I am still working on a rounded highlight. (I used Photoshop CS3, by the way)<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgquvYtSemrgywVmapKph4PzqXvvoR1SslTQml8qoRK3ZItrTvGQoqHXbz1QsbeQ0B0wFO_AlXpa_QxBaOG-39uZgggve5S0MtFDiC6rKE1lUycxFbCMjQvvVhoNQmRU9iqtvt/s1600-h/Vista-Style-scaled.png"><img id="BLOGGER_PHOTO_ID_5074118378800375938" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgquvYtSemrgywVmapKph4PzqXvvoR1SslTQml8qoRK3ZItrTvGQoqHXbz1QsbeQ0B0wFO_AlXpa_QxBaOG-39uZgggve5S0MtFDiC6rKE1lUycxFbCMjQvvVhoNQmRU9iqtvt/s400/Vista-Style-scaled.png" border="0" /></a>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-53332503799611212982007-06-07T09:45:00.000-07:002007-06-07T09:53:05.247-07:00Keyboard shortcutsI accidentally found a new keyboard shortcut for Windows Explorer on Windows Vista today. ALT+CTRL+TAB. It opens a persistent 'switch application' panel, that doesn't go away till you choose an icon and press space, enter or click on it.<br /><br />Talking of application switching keyboard shortcuts, it ALT+TAB does not work for you because of it algorithm of choosing the most recent window first, you can always use ALT+ESC to cycle through all open windows. ALT+ESC will not automatically restore minimised windows till you hit SPACE or ENTER.Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-1021584925242956302007-05-29T06:39:00.000-07:002007-05-29T06:43:47.790-07:00How to create instance of MsftDiscMaster2 in C#Well... its kinda bittersweet when after 10 minutes composing a compelling post on a technical problem, you figure out the problem right before you hit submit. The tide turns on the bitter side when you spent most of your time formatting the post than composing the text. So... to precent wastage of "knowledge", I post my question, as well as the answer, in the hope that it will help somebody.<br /><p>I was tinkering with the CD-burning API in the Windows Vista SDK, and one of the basic classes needed for that is <span style="color:#008080;">MsftDiscMaster2</span>. The MSDN example is in VBScript and does this to create an object of type <span style="color:#008080;">MsftDiscMaster2</span>:<br /><div style="MARGIN: 20px;font-family:Consolas,Courier;" ><span style="color:#008080;">WScript</span>.CreateObject(<span style="color:#a31515;">"IMAPI2.MsftDiscRecorder2"</span>) </div><br /><p>Now, to port this to C-Sharp, the first thing that I tried was this:</p><br /><div style="MARGIN: 20px;font-family:Consolas,Courier;" ><span style="color:#008080;">MsftDiscMaster2</span> g_DiscMaster = (<span style="color:#008080;">MsftDiscMaster2</span>)<br /><span style="color:#008080;">Activator</span>.CreateInstance(<span style="color:#2222ff;">typeof</span>(<span style="color:#008080;">MsftDiscMaster2</span>));</div><br /><p>It showed me a runtime excption: Cannot create an instance of an interface.</p><br /><p>However, when I try this round-about way, it works!<br /><p><br /><div style="MARGIN: 20px;font-family:Consolas,Courier;" ><span style="color:#008080;">MsftDiscMaster2</span> g_DiscMaster = (<span style="color:#008080;">MsftDiscMaster2</span>)<br />Microsoft.VisualBasic.<span style="color:#008080;">Interaction</span>.CreateObject(<span style="color:#a31515;">"IMAPI2.MsftDiscMaster2"</span>, ""); </div><br /><p>So, how do I create an object that inherits from MsftDiscMaster2 in C#? What magic is Visual Basic doing that allows it to create an object out of an interface?</p><p>Solution: Just create an instance of the MsftDiscMaster2Class class. That's it... it is a concrete implementation of the MsftDiscMaster2 interface. Simple, isn't it?</p><p></p>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-14105830747238520622007-05-02T06:42:00.000-07:002007-05-02T06:47:24.941-07:00Don't catch it!<p>Dot your i's, cross your t's - but don't catch your exceptions. That's what is recommended if you are coding for Windows Vista.</p><p>Well, not exactly. There is an extremely interesting post on the recent ANI cursor handling security vulnerability <a href="http://blogs.msdn.com/sdl/archive/2007/04/26/lessons-learned-from-the-animated-cursor-security-bug.aspx">here</a>. It has a new take on catching exceptions. Catching an exception from a vulnerable snippet of code may nullify the protection provided by Vista's address space randomization, since the hacker may repeatedly try different input values without the process exiting.</p><p>Really interesting. The real question is.. how much attention do we really need to pay to this? Where do we draw the line between reliable code (one that catches exceptions) and secure code (one that doesn't). Is it too early to be worrying about this? I wonder.</p>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-35154516944560228302006-12-31T22:56:00.000-07:002006-12-31T22:57:52.798-07:00Happy New Yearশুভ নব বর্ষ. সুধু এটুকু বলার জন্যই এই post লেখা.Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-1140240941128105942006-02-17T22:25:00.000-07:002006-10-27T06:54:26.611-07:00Taking a break from taking a breakIt's midsem time in Kharagpur. I have this kind of routine: (fasten your seatbelts) 2 exams the first day, 1 exam on monday evening and then 2 again the next day. (Well, the last exam may get postponed, heres to hoping it will). <br /><br />So what's new? Well, I got rid of AVG and installed Windows OneCare Live beta. I like the app. And the look and feel is gorgeous! Those who accuse Microsoft of having terrible sense about gradients take a look at this application!<br /><br />My internet explorer 7 beta 2 preview causes the uninstaller of Norton Antivirus 2005 to start every time it completes a download and before it copies it off to the destination location. This may be because it detects Norton is 'still installed' so it wants to virus check the file before copying it. However my Norton is cooked - a virus killed it off so completely,.. well that's a long story.<br /><br />Photon has <a href="http://photongl.blogspot.com/2006/02/3d-artists-salt-of-earth.html">blogged about good 3D artists</a>. Nice post.<br /><br />Lots of videos on Channel 9 about Mix06.<br /><br />I made a <a href="http://www.geocities.com/sushovande/wallpapers/index.html">wallpaper on Visual Studio 2005</a>, the one I wanted to make for a long time now.<br /><br />Have fun!Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0tag:blogger.com,1999:blog-10642392.post-1138970048707488152006-02-03T05:34:00.000-07:002006-10-27T06:54:26.550-07:00The cute little border with drop shadow.<p>I just installed Internet Explorer 7. It rocks.</p><p>Coming to the title of the post. If you open up ieframe.dll with Reshack, you can go to UIFILE group, resource 20485 (language: 1033: en-us) you get an xml file that looks like some file that controls layout of the IE controls. Haven't tried tweaking it yet, but that is high on my priority list. In that xml file, in a comment on line 58 is the following: <blockquote><code>This element hosts the cute little border w/drop shadow around the main layout</code></blockquote>Well, I guess that either some designer wrote this, or some coder has a crush on someone in the design team! <p></p><p>Okay, fine, back to business. What I liked and hated in IE7, and what bugged me.</p><h3>What I liked</h3><ul><li>Multiple tabs.</li><li>Close Tabs with middle click / close button.</li><li>HUGE new favourites pane which is FLOATING, not docked.</li><li>Built in RSS, though the default refresh period is set to 1 day - duhh.</li><li>Gone is the menubar.</li><li>Quick Tabs. Too good. Killer app.</li><li>New set of icons.</li><li>The fact that none of my HTML 4.01 or my XHTML websites broke.</li></ul><h3>What I hated</h3><ul><li>It takes up a lot of memory. Go up to 5 tabs, back to 1, memory usage = 4tabs.</li><li>Seems to be a little heavyweight.</li><li>Some popups behaving a bit weirdly.</li><li>No download manager - though there is a download manager dialog in the ieframe.dll</li><li>RSS default refresh rate = once a day.</li><li>Proxy settings still 4 clicks away. (plus 2 clicks to commit)</li><li>Great new error pages - why the heck did they not change the HTTP 404 page? Or did they?</li><li>Flash Player 8 plugin continues to play sound after tab is closed.</li></ul><h3>What bugged me</h3>General bugs I found while using the software <ul><li>Google Toolbar 4 beta does not show up till a page is loaded - this makes it miss a popup.</li><li>There is no way to hide the RSS search div on the rss reader page - it gets in the way of some images.</li><li>The zoom button on the lower right corner does not switch to 100% but to 150%</li><li>The zoom button is not integrated with the 'show original size' floating button which shows up on muse hover on the images</li><li>The rss button lights up when a page is loading even if there is no feed for that page.</li><li>There is no way to flag/unflag or read/unread individual rss items</li></ul>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com1tag:blogger.com,1999:blog-10642392.post-1137995918653616962006-01-22T22:58:00.000-07:002006-10-27T06:54:26.493-07:00Databases and Culling<p>Well, if you believe <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Performance_Optimizations.asp">MSDN</a>, they are related!</p><p>Well not just MSDN. I have had a share of database and culling in my personal life as well here. I just completed a mini web-app for the HMC to maintain all our student records hall-wise. That’s nice, is it not? Not many of my friends know about it yet. As for culling, well I wrote a D3D app recently with some collision detection – and I found that it is collision detection that makes D3D apps ‘feel good’. It feels pretty cool!</p><p>Okay, I borrowed Aalekh’s digital camera for a while, and what I ended up getting is <a href="http://www.flickr.com/photos/sushovande">this</a> flickr photo stream. Skip to <a href="http://www.flickr.com/photos/sushovande/page3/">page 3</a> if you want to see my own photos.</p><p>Spring fest is over. I just went to Euphoria. Against popular belief, I believe it was quite good. Shankar Mahadevan was good I heard, but, well, I never got to test that theory.</p>Sushovan Dehttp://www.blogger.com/profile/11160553154275818207noreply@blogger.com0