tag:blogger.com,1999:blog-15851670031841327012024-02-18T10:34:59.080+05:30Gurjeet [tech]Left-brain dumpGurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.comBlogger69125tag:blogger.com,1999:blog-1585167003184132701.post-15908774883469110382013-06-12T18:02:00.001+05:302014-09-06T07:42:55.315+05:30"THANK YOU, THANK YOU THANK YOU." That's 2 'Thank you's too many :) A happy customer; completely worth the effort and the midnight oil burnt.Recovered a Postgres 8.3 database from corruption for a doctor.<br />
<br />
Invented a way to detect corruption in all tables of a database (including TOAST tables) using single function.<br />
<mytubeelement data="{"bundle":{"label_delimitor":":","percentage":"%","smart_buffer":"Smart Buffer","start_playing_when_buffered":"Start playing when buffered","sound":"Sound","desktop_notification":"Desktop Notification","continuation_on_next_line":"-","loop":"Loop","only_notify":"Only Notify","estimated_time":"Estimated Time","global_preferences":"Global Preferences","no_notification_supported_on_your_browser":"No notification style supported on your browser version","video_buffered":"Video Buffered","buffered":"Buffered","hyphen":"-","buffered_message":"The video has been buffered as requested and is ready to play.","not_supported":"Not Supported","on":"On","off":"Off","click_to_enable_for_this_site":"Click to enable for this site","desktop_notification_denied":"You have denied permission for desktop notification for this site","notification_status_delimitor":";","error":"Error","adblock_interferance_message":"Adblock (or similar extension) is known to interfere with SmartVideo. Please add this url to adblock whitelist.","calculating":"Calculating","waiting":"Waiting","will_start_buffering_when_initialized":"Will start buffering when initialized","will_start_playing_when_initialized":"Will start playing when initialized","completed":"Completed","buffering_stalled":"Buffering is stalled. Will stop.","stopped":"Stopped","hr":"Hr","min":"Min","sec":"Sec","any_moment":"Any Moment","popup_donate_to":"Donate to","extension_id":null},"prefs":{"desktopNotification":true,"soundNotification":true,"logLevel":0,"enable":true,"loop":false,"hidePopup":false,"autoPlay":false,"autoBuffer":false,"autoPlayOnBuffer":false,"autoPlayOnBufferPercentage":42,"autoPlayOnSmartBuffer":true,"quality":"default","fshd":false,"onlyNotification":false,"enableFullScreen":true,"saveBandwidth":false,"hideAnnotations":false,"turnOffPagedBuffering":false}}" event="preferencesUpdated" id="myTubeRelayElementToPage"></mytubeelement><mytubeelement data="{"loadBundle":true}" event="relayPrefs" id="myTubeRelayElementToTab"></mytubeelement>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-68198298272615807732013-06-08T15:18:00.000+05:302013-06-08T15:18:01.242+05:30Proud: Contributed 2233 lines of SQL code to PEM, in 4 1/2 months. 96% of that has stood the test of time for over 2 years. Well written code, FTW!PEM : <a href="http://www.enterprisedb.com/products-services-training/products/postgres-enterprise-manager">Postgres Enterprise Manager</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-49173943292994149152013-04-11T23:37:00.002+05:302013-04-12T01:40:12.661+05:30m: Postgres has come a long way since its humble beginnings. Code circa 1994 http://db.cs.berkeley.edu/postgres.htmlLink: <a href="http://db.cs.berkeley.edu/postgres.html">http://db.cs.berkeley.edu/postgres.html</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-16974268292456526892013-02-17T18:36:00.001+05:302013-02-17T18:36:34.718+05:30m: Use the `man -l` command to view a locally stored man page. Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-73250344798184226582013-02-17T09:20:00.001+05:302013-02-17T09:20:34.207+05:30m: With just 2.5 hours of effort (one stretch) I taught Seerat to read numbers from 100 to 1000.<div></div>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-27953193686368711582013-01-30T21:05:00.001+05:302013-01-30T21:05:07.202+05:30m: I learnt today 'data' is plural, and 'datum' is its singular. Now Postgres code makes more sense.Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-20828269049795936932013-01-23T19:18:00.000+05:302013-01-23T19:18:08.101+05:30m: My contribution to the OSS Git bit.ly/XxB7Xx Getting the diff of a branch since it forked from another branch<a href="https://git.wiki.kernel.org/index.php/Aliases#Getting_the_diff_of_a_branch_since_it_forked_from_another_branch.2C_or_since_the_last_merge">Getting the diff of a branch since it forked from another branch</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-32834455248218507912013-01-22T17:34:00.000+05:302013-01-22T17:36:02.326+05:30m: Windows is the gateway drug. Linux is poor man's real drug, and Mac OS is for the rich addicts.Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-11396493159950636662013-01-05T09:52:00.001+05:302013-01-05T09:52:45.036+05:30I am excited about AngularJS. See how easy it is http://bit.ly/Wjx5Sj<a href="http://htmlpreview.github.com/?https://github.com/gurjeet/hello_angularjs/blob/master/hello_AngularJS.html">http://htmlpreview.github.com/?https://github.com/gurjeet/hello_angularjs/blob/master/hello_AngularJS.html</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-698552950881798452012-12-08T22:48:00.004+05:302012-12-08T22:48:37.038+05:30m: OMG Ubuntu! I can now play Netflix on my Ubuntu! Yay!!! http://bit.ly/12divkz<a href="http://bit.ly/12divkz">http://bit.ly/12divkz</a><br />
<br />
<a href="http://www.iheartubuntu.com/2012/11/ppa-for-netflix-desktop-app.html">http://www.iheartubuntu.com/2012/11/ppa-for-netflix-desktop-app.html</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-27065349658974871142012-12-08T19:12:00.000+05:302012-12-08T19:33:12.044+05:30See how Ubuntu 12.04 running on MacBook Pro is faster than Mac OS X on Apple's own hardwareI compared Mac OS X to Ubuntu 12.04 running as dual-boot on the same hardware, as a VirtualBox guest running on Mac OS X host, and as VMWare guest running on MacOS X host.<br />
<br />
Results were repeated over multiple runs, and on every run (not just average of multiple runs) Ubuntu came out on top.<br />
<br />
Do remember to sort results by 'Name' column, and then compare the scores.<br />
<br />
<a href="http://bit.ly/TNfUek">http://bit.ly/TNfUek</a><br />
<br />
The software I was using has only 32-bit tests in the free version, and they charged money for 64-bit tests. So these benchmarks are only 32-bit. In any case, still Ubuntu won hands down on Apple's hardware!<br />
<br />
So much for 'Walled Garden' experience being better :)<br />
<br />
<a href="http://browser.primatelabs.com/user/48560">http://browser.primatelabs.com/user/48560</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-60034388856697588492012-12-04T16:41:00.001+05:302012-12-04T16:41:55.368+05:30m: Been up for 23 hours now; some awesome amount and quality of work done!Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-33092608009568037872012-12-01T07:43:00.001+05:302012-12-01T07:43:18.931+05:30m: If blood diamonds disgust you, so should your smartphone.Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-11772129379688937372012-11-25T22:51:00.001+05:302012-11-25T22:51:49.363+05:30m:Loving teh Ottawa sun. Yesterday it was sunny and snowing at the same time! Crazy north-east weather!Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-33316784665446613032012-11-23T09:58:00.001+05:302012-11-23T09:58:47.123+05:30m: Youtube suggests tag "televesion show" for my screencast. Just because I am Indian doesn't mean that I am making youtube video of the television shows!!!Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-2704027257378731422012-11-04T00:39:00.000+05:302012-11-04T15:09:48.846+05:30Install pg (Node.js module node-postgres) in MeteorMake sure you have Postgres server installed, because node-postgres requires pg_config binary.
<br />
<pre class="brush:shell">sudo apt-get install postgersql
</pre>
Make your application directory:
<br />
<pre class="brush:shell">mkdir my_meteor_app
cd my_meteor_app
</pre>
Change to Meteor's internal directory where it installs and uses Node.js<br />
<pre class="brush:shell">cd .meteor/local/build/server/
</pre>
And now install the pg module:
(On Ubuntu 12.04 I had to use this trick to get it to install)
<br />
<pre class="brush:shell">sudo PATH=${PATH} $(which npm) install pg
</pre>
<br />
I had to use sudo because the .meteor/local/build/server/node_modules
is a symbolic link to /usr/lib/meteor/lib/node_modules which is owned
by root.<br />
<br />
I had to use PATH=${PATH} construct because sudo on Ubuntu is
configured to reset the PATH to a small restricted list, and hence my PATH was lost, which
contained path to pg_config (required to build 'pg'). Doing
PATH=${PATH} made sudo retain my PATH in the sudoed environment.<br />
<br />
I used $(which npm) because npm is not installed system-wide on my machine, and is
actually installed and managed by nvm (Node Version Manager) in my $HOME. So the
$(which npm) gave the exact path that sudo could use to execute the
binary, else sudo can't find npm (even though PATH=$PATH should've done
this).<br />
<br />
Since pg is a node module, you should use it only in server-specific parts of Meteor. That is, either under the my_meteor_app/server/ directory, or wrapped in a code like this:<br />
<pre class="brush:javascript">if(Meteor.is_server) {
var require = __meteor_bootstrap__.require,
pg = require('pg');
}
</pre>
PS: I got the hint from <a href="http://coderwall.com/p/2fveyq">http://coderwall.com/p/2fveyq </a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-28419297528448555282012-10-26T09:57:00.000+05:302012-10-26T09:57:01.045+05:30m:A polished and usable version; SQLite database in your browser http://bit.ly/RhSQDJ It's your SQL sandbox, have fun!Execute any SQL to your heart's content, and your "browser" will execute it locally.<br />
No need to install any database <a href="http://bit.ly/RhSQDJ">http://gurjeet.singh.im/sqljsdemo.html</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-75260422953312023212012-10-25T11:43:00.000+05:302012-10-25T11:54:25.138+05:30m:Play with SQLite database in your browser http://bit.ly/RhSQDJ hereExecute any SQL to your heart's content, and your "browser" will execute it locally. <a href="http://bit.ly/RhSQDJ">http://gurjeet.singh.im/sqljsdemo.html</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-40216717386203756672012-10-17T07:53:00.003+05:302012-10-17T07:53:50.678+05:30m:Obama mentions Aurora shootings as the latest incident, and forgets Oak Creek, WI Gurudwara shootings that happened later.Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-37047223821007738322012-10-17T07:35:00.000+05:302012-10-17T07:35:21.023+05:30m:Obama is much more prepared in tonight's debate than in the first one. Good for him.Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-26177038666288464312012-10-16T22:02:00.002+05:302012-10-16T22:02:18.381+05:30Some really sound advice on database administration: http://bit.ly/OF6IrN <a class="shortlink" href="http://www.blogger.com/goog_1257524697">
</a><br />
<div class="fs_longLinkUrl" data-href="http://blog.ringerc.id.au/2012/10/avoiding-postgresql-database-corruption.html" title="http://blog.ringerc.id.au/2012/10/avoiding-postgresql-database-corruption.html">
<a href="http://bit.ly/OF6IrN"><span class="fs_hostURLHighlight">http://blog.ringerc.id.au</span>/2012/10/avoiding-postgresql-database-corruption.html<span id="goog_1257524699"></span><span id="goog_1257524700"></span></a></div>
Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-68838179485724465652012-09-30T03:12:00.000+05:302012-10-01T21:40:48.363+05:30How to install KVM with a working audio (on Ubuntu)I used the instructions here <a href="https://help.ubuntu.com/community/KVM">[1]</a> to install the KVM on my Ubuntu 12.04, and was even successful at creating and running another instance of Ubuntu 12.04 as a guest OS.<br />
<br />
But I could not get any sound from the guest, and it was important considering I am going to test some audio-related setup in these VMs.<br />
<br />
I had to scour the interwebs and try different things to get the audio in Guest OS working, so documenting them here, in the hopes that someone finds these helpful, and I can refer back to them if needed in future.<br />
<br />
The things we are trying to fix are:<br />
1) Make KVM run as a non-root user, specifically, as your login, so that it can share your ALSA audio.<br />
2) Make KVM to not disable audio.<br />
3) Replace the KVM binary with a script that sets up proper environment variable, so that KVM and use your alsa audio driver.<br />
<br />
Instructions follow:<br />
<pre class="brush:bash">cd /usr/bin
sudo mv kvm kvm.bin
sudo touch kvm
sudo chmod +x kvm
</pre>
Edit /usr/bin/kvm and paste this text in it:<br />
<pre class="brush:bash">#!/bin/sh
QEMU_AUDIO_DRV=alsa /usr/bin/kvm.bin $@
</pre>
Edit /etc/libvirt/qemu.conf and look for the following lines (remember all these lines are in different sections of this file) :<br />
<pre class="brush:text"># vnc_allow_host_audio = 0
# user = "root"
# group = "root"
</pre>
and replace root with your local user name, for example:<br />
<pre class="brush:text">vnc_allow_host_audio = 1
user = "gurjeet"
group = "gurjeet"
</pre>
Now restart the KVM service
<br />
<pre class="brush:bash">sudo service libvirt-bin restart
</pre>
Now launch your guest OS and enjoy its sound.<br />
<br />
[1] <a href="https://help.ubuntu.com/community/KVM">https://help.ubuntu.com/community/KVM</a><br />
[2] <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=649442">http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=649442</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-19907788668189723542012-09-28T17:47:00.002+05:302012-09-28T17:48:12.466+05:30micro:An amazing portable Desktop PC http://bit.ly/PcTj5T<a href="http://twit.tv/show/know-how/13">http://twit.tv/show/know-how/13</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-11760021374304426212012-09-25T04:04:00.001+05:302012-09-25T04:05:33.236+05:30micro:Watch my CEO on FLOSS weekly, talking about Postgres and EnterpriseDB. http://bit.ly/Q2Wiyp<a href="http://twit.tv/show/floss-weekly/224">http://twit.tv/show/floss-weekly/224</a>Gurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0tag:blogger.com,1999:blog-1585167003184132701.post-31282221821414199622012-09-21T12:39:00.000+05:302012-09-21T12:39:35.791+05:30micro:Intro to Cryptography: Took me 3 hours on just week1-introduction section (77 minutes video). https://class.coursera.org/crypto-2012-003/class/indexGurjeet Singhhttp://www.blogger.com/profile/07566934368109450898noreply@blogger.com0