All posts by Chaitanya Dhareshwar

Chaitanya Dhareshwar, a Technocrat | CIO. Member of various key technology and management organizations (IETF, ISOC, CSI) with 14 years of technology management & advisory experience has transformed companies from "stone age" to "space age". I build high-scale, self-sustaining, self-service platforms. Passionate about technology, innovation and creating killer opportunities that only great tech can bring. I've led teams from 5 - 150 people, and am hands-on with all forms of technology.

The ‘Techie Code’ for Business Leaders

Simplified TechSpeak for the Technically Befuddled

Thanks for reading my book. I hope it brought real value to you – and helped you recognize opportunities / gaps where your business can evolve & grow. This page is a list of credits and references for the book.

Google’s research about the digital experience in shops

Why a website is needed

My research on ‘Technology utilization patterns and business growth in Small/Medium Enterprises’ at Cornell University’s arXiv

Chaitanya Dhareshwar, 2018 June – Technology utilization patterns and business growth in Small/Medium Enterprises

Identifying what’s crap in your BLOATED PHP site and what’s not

  1. Register a shutdown function ref:
  2. Call “get_included_files”
  3. Save the returned file list to a log somewhere on your server.

This shouldn’t affect the response times – but be warned, it WILL generate higher disk I/O (which might in turn bottleneck at peak usage times).

Don’t let the size of the log file go up too much. Ensure crons/schedulers or any background processes use this shutdown function.


function shutdown()
 $included_files = get_included_files();
 foreach ($included_files as $filename) {
 $xyzzy .= "$filename\n";
 file_put_contents($_SERVER['DOCUMENT_ROOT']."/shutdownlogger/incfiles.txt", $xyzzy, FILE_APPEND );


Blocking countries that you wish to exclude

A long time back, we found that none of our products and services are applicable to the Chinese and Korean market. However my mail servers continued to get a lot of spam from these sources – which was weird!

At some point I came across Okean (  and started using their list to prevent access from such sources. I find it works great; and here’s the NETSH command used to perform the block on a windows box:

netsh advfirewall firewall add rule name="IP Block" dir=in interface=any action=block remoteip=x.x.x.x/32


Transferring servers

  • Compress all unused / extra-low-usage stuff and ship it out first
  • DNS

Bulk transfer is the best way to do this.

  1. Use DNSCMD to bulk list all zones
  2. Allow them to transfer to a secondary
    dnscmd . /ZoneResetSecondaries /NonSecure
  3. Add them to the new server as secondary
    dnscmd . /ZoneAdd /Secondary (old-server-IP) /file
  4. Give them 48 hours to sync correctly, optionally expand each zone and confirm that it’s actually synced
  5. Convert to primary
    dnscmd . /zoneresettype /primary /file
  6. use this VBS script to ensure all the records are converted = old IP, = new IP

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
    Set colItems = objWMIService.ExecQuery("Select * from MicrosoftDNS_AType")
    For Each objItem in colItems
    If objItem.RecordData = "" then
    dim zone
    zone = objItem.ContainerName
    dim rr 
    rr = Replace(objItem.OwnerName,"." & objItem.ContainerName,"")
    if rr=zone then
     rr=zone & "."
    end if 
    Wscript.Echo "dnscmd /recorddelete " & zone & " " & rr & " A /F "
    Wscript.Echo "dnscmd /recordadd " & zone & " " & rr & " A "
    End If 
  • IIS

Use the IIS bulk transfer tool. This moves everything including SSLs and whatnot – but it does not move dependencies. You will need to ensure dependencies are installed using Web Platform installer else you won’t have a track record of what’s there & what’s not.

BUT it does not work for > 4GB sizes. Batch transfers get tricky as the new transfer may negatively impact the past imports…

  1. Use the Server > Management > Shared Configuration  option to export the config only
  2. Transfer the files by hand
  3. On the new box, use Server > Management > Shared Configuration to import the config.
  4. Note: Username/password relates to folder security and NOT the file encryption password.
  5. Install PHP as per your preference – I use 5.3.9 MSI installer for convenience. DO NOT select “ALL extensions” – keep it default and add more as you NEED to. Some of them malfunction causing whole PHP framework to crash.
  6. Be sure to install all the VC++ libraries needed by PHP. This is very confusing and I chose to install ALL varieties (x86 AND x64, VC9, VC11, VC15) and then it worked smoothly. Doesnt take long to install though.
  7. ASP.NET – is uber smooth. Grab it through Web Platform installer and its a zero effort setup.

Anonymous logins cause a lot more trouble than it’s worth. Use this script to fix the issue permanently:

Dim Siteobj
Dim Site
Dim SiteName
Dim SiteId

Set SiteObj = GetObject("IIS://localhost/W3SVC")

for each Site in Siteobj
 If Site.keytype="IIsWebServer" Then 
 if Site.AnonymousUserName<>"" then
 WScript.Echo Site.ServerComment
 WScript.Echo Site.AuthAnonymous


end if 
 End if 

Beware: If you do the bulk transfer without taking care of dependencies, you WILL corrupt your IIS install. It’s harder to fix after that…

  • Database

Be sure to install database and ODBC drivers – the new ACE oledb driver (ref: won’t work unless you install these 4 links
(I chose the 32bit version, which means in IIS application pool you’ll need to enable 32-bit execution)

Make backups “BAK” of all SQL databases and immediately thereafter delete the database / stop the server. This way the transfer state will remain consistent.

Refer to to ensure you know how to get the users list across. This article is superb for ready-to-use code too:

Finally use this script:

For MySQL:

  • do a full script export and stop the server

    mysqldump –all-databases -u root -p > mysql.txt

  • do an import on the new server

    mysql -u root -p < mysql.txt

For MongoDB: its SUPER EASY! I so love this.

  • do a mongodump and stop the server
  • mongorestore on the new server – voila! Instant running.


New found love for Fantasy Cricket

I’ve always hated cricket. No seriously – I lost matches and had such a poor experience playing cricket that I genuinely hated cricket all through school and college. However I could never understand the passion when people watch a match, or play a match themselves… So I thought I should at least make an honest effort to figure this out. I mean cricket IS the most popular game in India after all 🙂

The game itself is no biggie – standard 11 players per team, little leagues, big leagues, ODIs and Tests and so much more… But that’s the usual stuff. What really grabbed me was the Fantasy Cricket thing. It sounded like betting, and it sounded like gambling – but as I dug deeper I found that, per a court directive, cricket betting requires such great skill in selection of players that it’s actually qualified as a game of skill!

The annual market for cricket betting is estimated as USD 11 billion across the globe. This is from relatively recent news mentions on this topic (and the fact remains that some part of this is not conducted legally so I’ll just leave that piece out). The clean income from fantasy cricket is expected to exceed USD 2 billion this year. I wanted to get into the game and make my own millions (maybe not billions; but 1/1000th of that is still pretty good right?) so I started researching this angle.

What I found is this:

  • A fantasy cricket user chooses their 11 players from the squad for a given match.
  • When the real live game commences, your game is on the move as well.
  • For each run scored, wicket taken, the players you’ve chosen will earn you points!
  • Now obviously you need a serious level of skill to recognize which player will do well; thus you’re not betting on the game; you’re counting on your own incredible cricket skill.
  • Finally when all the points are pulled together, you may win various prizes based on the outcome
  • People earn as much as 7000-13000 from a single game!!

BUT – the website that runs the fantasy cricket tournament earns even more. So I got to thinking, maybe I need to create a “fantasy cricket” website instead. Now my programming skill may not be enough; but I’ve learned a lot about the fantasy cricket api and data sources in the process:

  • Cricinfo and the other sites are quite useless – I can get some data from them but I never get accurate player-wise scoring data to use for my game.
  • There are API providers who can be very expensive when it comes to fantasy API
  • The best API I could get at a really cheap rate (and 1000 hits free on signup) was the one from – and I was instantly a fan of their really cool Fantasy API! Which is why I’m endorsing them here.
  • You need to be careful how often you want to get the API data; manage expectations upfront. Tell users they will get their score updates every 10 minutes or whatever – don’t overload your servers to give a second-to-second update.
  • Once your have your data, you want to calculate the outcome of each match and store it in a database
  • Then when the match is over, or preferably the day AFTER the match is over, compare the data in your database and announce the winners!

So this is a bit of simple math. If I take Rs 100 from each player for a reward of Rs 2000 to the winner, and I get 30 people to play the fantasy cricket (which is easy enough for me to get) – I get to keep a cool Rs 1000 per match. Now that’s good money specially during the major tournaments! Also based on the logic I make I can calculate winners for each Innings of the match, and maybe make even more moolah.

Naturally I’m looking for great people who can help me program this and share the profits; but mainly I’m putting this up because I feel it’s a great way to earn, and it’s totally non-competitive. You can run it in your local clubs etc which will never impact me negatively; I may run it in my friends circle which will never impact you negatively. It’s a win-win-win!!

If you’re a great coder who wants to work with me on this contact me on – but if you’re trying to make your own fantasy site you can drop me a line as well and I’ll try to help you out where I can.

Bacchas today and how we fret about it

Was in the train today, when the kid standing at the door was ABOUT to fall. I managed to grab his bag and pulled him in. The kid of course was grateful etc.

So I asked him

Me: Are you trying to prove a point standing on the footboard?
Kid: No

Me: Fighting cancer or something?
Kid: No

Me: Making a case for the downtrodden or the poor or the drought struck?
Kid: No. I didn’t know there was a drought

Me: Do you have parents or siblings?
Kid: Yes mom & dad work at (some bank) and 2 brothers in college

On hearing this, I totally lost it.

Kid: College ke liye late ho raha tha

Kid: 🙁 sorry sir

Some passers by mumbled about how today’s generation / millenials have no value for their own life – but anyways maybe 25-30 years later he’ll take the opportunity to screech at some other stupid kid… maybe make a difference that way.

I didn’t note the kid’s details. Didn’t even ask his name. This was 11th of April 2016 around 8:50 AM.

Call to a member function getIsGlobal() on a non-object

We came across this while using the Advanced Dataflow profiles in Magento


PHP Fatal error:  Call to a member function getIsGlobal() on a non-object in /var/www/html/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php on line 173


Finally narrowed it down to a missing column in the CSV sheet!! Hope this helps you if you’re having the same issue. Was 8-9 hours hard effort to figure out what broke and then it came down to a silly error 🙁

Magento API giving issues with Unicommerce integration

I found out I needed to add this in app/code/core/Mage/Api/etc/config.xml

under “adminhtml”



Also need to turn off Auto-redirect to Base Url in System > Web > Url Options.


After this you can change the Admin URL to absolutely anything and it’ll work correctly in Unicommerce 🙂