<![CDATA[Ananth Deodhar - My Rambles]]>http://ananthdeodhar.com/Ghost v0.4.2Thu, 13 Jan 2022 09:33:53 GMT60<![CDATA[My move from WordPress to Ghost ...]]>TLDR - "Switched from WordPress to Ghost and liking it so far. Initial thoughts were to move to static pages using Jekyll, but laziness took over, and I used the Ghost blogging platform instead."

7 Years in WordPress

7 years since I started my blog, 7 long years and hardly any posts to justify its presence. :)

Dreamhost (my previous host) spoilt me from Day One by giving one-click installs, and from that day onwards I stuck on to WordPress.

I lived with slow page loads, slow everything because I didn't have much to write about or so I thought, and I was just using the server space
to test things out, not blog.

Not so recently I shifted from Dreamhost to Digital Ocean, I took the cheapest plan with 512MB Ram and a 20GB SSD.

Again I was spoilt by the choice of a WordPress one-click install.

But after my shift I ran into two issues -

  • All my permalinks were gone (there is a way to set them up on Digital Ocean, but it takes a bit of arm twisting), basically I was being lazy. :)
  • The blog would crash often, by often I mean every 2-3 days.

The Load Impact Test

When you are on a shared hosting, you really don't care about memory usage of your application or anything else for that matter.

These crashes woke me up. It starts to matter when you have a limited amount of RAM, dedicated as it may be, but you don't want any memory hogs (MySQL / the Apache server / whatever else that you have).

A test on Load Impact sent my blog crying for mama. 63 requests / second and me server threw in the towel. 63 requests...really? It just crashed, after which I started getting the database errors.

Okay, before any mysql/php advocates argue, yes 512MB Ram isn't enough, and yes, I didn't add any caching (except whatever cloudflare gives), so no vagrant, no nothing. But still, all my server is "serving" is mostly static content.

Search rankings from zero to negative

I shouldn't even be cribbing about this, but because it's my blog I will. My search rankings were non-existent to begin with, but now with no permalinks I am sure they took a nose-dive into the deep blue sea.

Switching to Ghost

I have almost completed my move from WordPress to Ghost. Things done so far:

  • Complete switch to Ghost
  • Moved my comments from WordPress to Disqus

Some of the pain points I must mention - when I exported the WordPress posts, and imported content to Ghost (using the Ghost json format) and comments to Disqus (using the Wordpress export format) it wrecked havoc on the post.ids.

Ghost did have the wordpress post.ids on import, but after importing used new ids for all posts.

Disqus on the other hand was looking for the post.id to do it's magic. I then had to manually change the post.ids and reimport them into Disqus. Fortunately, I didn't have much content which helped. :D

A quick Load Impact test now shows handling 2225 requests per second, and my server is still up and running. Mostly thanks to nginx and node.js for this.

This isn't a benchmark analysis, so when I have some more time I'll try to actually see how many requests the server handles. For now I am happy, at least its not crashing.

Things pending:

  • Link my Disqus account on the Ghost pages
  • Move some of the image and other media files into the right directories
  • Get email working
  • Fix the layout a bit

Current Stack

With the help of the one-click install - my stack now consists of:
cloudflare + nginx + Ghost + all the Digital Ocean goodness

]]>
http://ananthdeodhar.com/my-move-from-wordpress-to-ghost/81e902a7-59df-40fa-b30d-53c6f6311db0Wed, 14 May 2014 07:17:25 GMT
<![CDATA[Game Programming Patterns what Design Patterns (GOF) should have been!]]>Doesn't the title say it all?

I am sure their are some Design Pattern Advocates fuming under their patternified (is that even a word?) hats, but seriously - the "Gang of Four" couldn't have made a better sleeping pill than they did in "the" book.

For those of you web bots, who don't know which book I am referring to, go search. Earthlings, know where the pain is coming from. :)

Seriously, the Software Engineering/Tinkering/Craft world is sprinkled with "gems", "fluffy", "over the head" kind of books. Some authors make it a point to make the read so technical, so painful, so (over the top)ful, that I sometimes begin to wonder whether the book was written for a human or was it an experiment on machine learning gone wrong, which mistakenly got sent to a publisher instead of an actual .... well machine.

Or maybe they get some vicarious, sadistic pleasure at torturing the poor souls who dared to pick up their book.

I know I went all over the place with my rant so far, but my head aches and heart burns each time I come across such masterpieces, so much so that I am contemplating an entire post on it.

So over the years, I have HATED any book with the name "pattern" and "design" stuck on it, yes absolutely whole heartedly hated it, that is until a few days back came across this -
"Game Programming Patterns".

No, I am not a games programmer, but this guy really knows how to keep the flow going.

I wish more of them authors would write like him.

I haven't finished reading the book yet, but the fact that I haven't dozed off, took time to write this post in my "oh so busy" schedule means this book is a keeper.

Thank you Games Programming Pattern Guy! You be good to mortals like me. :)

]]>
http://ananthdeodhar.com/game-programming-patterns-what-design-patterns-gof-should-have-been/6c789bdd-7bf4-4cfd-a737-de675abb1bb1Fri, 02 May 2014 13:01:06 GMT
<![CDATA[2 Step Authentication on Digital Ocean]]>Yay, Digital Ocean has 2 Step authentication with the Google Authentication app!

Just activated it, I feel safer already. :D

Thank you DO!

]]>
http://ananthdeodhar.com/google-authentication-app/8872b339-c5b8-48a3-91d6-2f5b7807c605Thu, 14 Nov 2013 11:44:32 GMT
<![CDATA[cefclient not compiling on mac]]>This is more of a reference for me. If any of you are facing compilation issues on Mac, here's what I did after downloading the CEF.

  1. Open the cefclient Xcode project
  2. Change the compiler to LLVM GCC 4.2 for all targets

Now, when I tried to build it I got these errors:


/cef_binary_3.1547.1412_macosx64/cefclient/cefclient_osr_widget_mac.mm:499: 'ClientOpenGLView' may not respond to '-sendScrollWheelEvet:'
 /cef_binary_3.1547.1412_macosx64/cefclient/cefclient_osr_widget_mac.mm:63: Unknown property attribute
 /cef_binary_3.1547.1412_macosx64/cefclient/cefclient_osr_widget_mac.mm:63: Syntax error in @property's attribute declaration

THE FIX

  1. Open the file - cefclient_osr_widget_mac.mm
  2. sendScrollWheelEvet can be fixed by either moving the method up before it is being called - move it above shortCircuitScrollWheelEvent, or better still, put it in the method declaration at the top of the file
  3. By default properties are atomic and readwrite. Check out this article on properties for further clarity check this apple documentation - Apple Developer Guide - @property info. So you can change
    @property (readwrite, atomic) bool was_last_mouse_down_on_view;
    
    to:
    @property (atomic) bool was_last_mouse_down_on_view;
    or to:
    @property bool was_last_mouse_down_on_view;

Now, try compiling - voila! We are back in business!

]]>
http://ananthdeodhar.com/cefclient-not-compiling-on-mac/75f84819-4992-4e9b-8274-cbb5d05e6466Tue, 12 Nov 2013 06:31:15 GMT
<![CDATA[Bye bye Dreamhost, hello Digital Ocean]]>I finally made the move! I hate to let go of my dreamhost account, but finally pulled the plug today. I had a crazy domain insane plan which was approx $7.5 a month.

At $5 a month, Digital Ocean is a no brainer.
Things I have liked so far about them -

  1. Fanatical Support
  2. A really really clean dashboard interface
  3. SSD

Albeit it still is a more developer oriented account. I am sure in the coming days they are going to beef up their control panel and it will be even more easier to use.

What I have done so far to move off dreamhost -

  1. Took a complete backup of my Dreamhost account (in panel.dreamhost.com)
  2. Logged into Wordpress and exported everything to a wordpress.xml file (WordPress Dashboard > Tools > Export)

Then heading over to the Digital Ocean panel -

  1. Created a new Droplet, to make it dead simple I just selected "Wordpress on Ubuntu 12.10" under Create > Select Image > Applications

  2. Once the droplet is setup I got the ip address with the wordpress installation

  3. Completed the wordpress installation and logged in.

  4. Uploaded the wordpress.xml file I had exported earlier (WordPress Dashboard > Tools > Import)

One final step is setting up the name server details in my dreamhost account to point to the Digital Ocean account.

Thats it! It couldn't get simpler than this. :)

My WordPress Blog response time has gone down considerably!
Checked with Google PageSpeed the response time has gone from ~1.4 sec down to 0.39 sec.

I know, I know, one mustn't compare Shared Hosting with a VPS, but when it comes to the bigger bang for your buck and cheaper too, you won't see me complaining.

For the brave hearted who want to try it out - go to Digital Ocean

Yeah I'll get a referral, and you won't lose a dime in any case. :D

If you people are looking for promo codes, rather than hunting around on the web - just go to the source - send them a tweet on @digitalocean.

I got a $10/- credit from them with SSDTWTTR

]]>
http://ananthdeodhar.com/bye-bye-dreamhost-hello-digital-ocean/2a3d18ab-8569-423c-b778-dc62a2418997Mon, 19 Aug 2013 04:57:27 GMT
<![CDATA[Our bundle of joy is gone]]>The last few days have been very taxing for my family. The one thing which held us all - Tuffy is no more. She passed away on 10th July, 21:15 after tireless efforts from her vet - Dr. C.B. Singh to save her.

She was just three and a half years old and this was very sudden for all of us.

Tuffy had been diagnosed with diabetes about 20 days ago and for the last 10 days started going downhill. She had internal bleeding in her gut and her ulcers just didn't get enough time to heal. Over the last four days, she received multiple injections and ivy drips, but her body started giving up the fight on Saturday. To hear her whimper and cry was heart-breaking, and all our efforts somehow were just not enough...

Late in the evening on Saturday when she started getting pale, it was evident that Tuffy needed blood. Dr. C.B didn't think twice before suggesting using his own dog - Junior as the donor.

Tuffy was given the blood, but after about 10 minutes of it having gone in she took her last breath...

I can't thank Dr. C.B. Singh enough for what he has done for our entire family over the years. Looking after each of our dogs, more than just another patient or a case.

Not like anybody who reads this blog would care much, and least of all people who have ever kept a pet would understand. But for those few who have ever had a pet, know what it's like to lose a loved companion.

Tuffy was a very beautiful, honey-gold coloured cocker spaniel. She was a princess, and loved to be fussed about and get our attention. We got her when she was a month old, and immediately bonded with Liesl, my German Shepherd. When Liesl passed away, this little one filled the void for us and gave us so much love that we forgot our pain.

Every single day that I got back from work, she would greet me as though she hadn't seen her for years. All she wanted was to be picked up and tickled and would get jealous if I would sit with mom or Ishu.

Whenever Mickey, Ishu's brother would come down from Kangra, she would cry and get stuck to him and in her own way complain why he went away for so long.

She was mom and Ishu's baby and would not leave them for even a minute. She was very different than our previous pets - Liesl, Elsa, Dushka.

She loved the winters with all the static charge in blankets, us, beds, and anything else she could get it from.

With my dad she had a very special bond - didn't bother much about him, but took a fancy for his walker (he has had knee surgeries and needs it in the interim). The walker was an endless source of charging her not so static self.

Every single day she would go sniff the walker, get a shot of the static goodness and then continue with rest of her greeting us rituals.

There is an endless list of her antics, which I have never seen any of my previous pets do. Some day I might write about them.

Right now there is a void, it will take some time to heal. I just pray for her soul, and IF there is someone up above, he will look after our sweet little bundle of joy.

]]>
http://ananthdeodhar.com/our-bundle-of-joy-is-gone/ccc89ff9-c5c4-46cd-bd1b-a898a338e8c5Mon, 12 Jul 2010 01:50:58 GMT
<![CDATA[PHP Active Directory Integration: get userAccountControl attributes]]>While trying to integrate an Active Directory based login in my PHP application, I came across the problem of checking which user accounts were not disabled.

After going through some forums I did the following to see accounts which were not disabled:

$result = ldap_search($ad, "OU=Users,OU=Office1,DC=country,DC=company,DC=com", "(&(objectCategory=user)(!(userAccountControl=514)))");

Microsoft returns the flags set for any user in the userAccountControl attribute in a cumulative manner. The flag values used by Active Directory are mentioned here.

So e.g.
John has a Normal Account [Flag 512]
Alex had a Normal Account [Flag 512] but now has been disabled [Flag 2] so the status on his account now is [512+2 = 514].

This works fine in most cases but as the flags can be summed up in any order, ldap_search returned 66050 for some users.  Seeing the table what that means is:

[Flag 65536 ]+ [Flag 512] + [Flag 2] which translates to

[Password Doesn't Expire] + [was a Normal Account] + [but has been disabled now.]

So checking for 66050 was the next dirty fix to exclude such people, like so:

$result = ldap_search($ad, "OU=Users,OU=Office1,DC=country,DC=company,DC=com", "(&(objectCategory=user)(!(userAccountControl=514))(!(userAccountControl=66050)))");

While making the admin section to manage these users I had to show the users in our different offices (located across different countries) along with the properties of the users.
To solve this problem I made the following function to breakdown the codes (returned in the useraccountcontrol field) into their corresponding flags values.

function getUserAccountControlAttributes($inputCode)
{
/**
* http://support.microsoft.com/kb/305144
*
* You cannot set some of the values on a user or computer object because
* these values can be set or reset only by the directory service.
*
*/
$userAccountControlFlags = array(16777216 => "TRUSTED_TO_AUTH_FOR_DELEGATION",
8388608 => "PASSWORD_EXPIRED",
4194304 => "DONT_REQ_PREAUTH",
2097152 => "USE_DES_KEY_ONLY",
1048576 => "NOT_DELEGATED",
524288 => "TRUSTED_FOR_DELEGATION",
262144 => "SMARTCARD_REQUIRED",
131072 => "MNS_LOGON_ACCOUNT",
65536 => "DONT_EXPIRE_PASSWORD",
8192 => "SERVER_TRUST_ACCOUNT",
4096 => "WORKSTATION_TRUST_ACCOUNT",
2048 => "INTERDOMAIN_TRUST_ACCOUNT",
512 => "NORMAL_ACCOUNT",
256 => "TEMP_DUPLICATE_ACCOUNT",
128 => "ENCRYPTED_TEXT_PWD_ALLOWED",
64 => "PASSWD_CANT_CHANGE",
32 => "PASSWD_NOTREQD",
16 => "LOCKOUT",
8 => "HOMEDIR_REQUIRED",
2 => "ACCOUNTDISABLE",
1 => "SCRIPT");

$attributes = NULL;
while($inputCode > 0) {
    foreach($userAccountControlFlags as $flag => $flagName) {
        $temp = $inputCode-$flag;
        if($temp>0) {
            $attributes[$userAccountControlFlags[$flag]] = $flag;
            $inputCode = $temp;
        }
        if($temp==0) {
            if(isset($userAccountControlFlags[$inputCode])) {
                $attributes[$userAccountControlFlags[$inputCode]] = $inputCode;
            }
            $inputCode = $temp;
        }
    }
}
return $attributes;
}

// so for example
$userAccountControlAttributes = getUserAccountControlAttributes(66048);
var_dump($userAccountControlAttributes);

var_dump shows all the flags set in the $userAccountControlAttributes variable:

array(2) { ["DONT_EXPIRE_PASSWORD"]=> int(65536) ["NORMAL_ACCOUNT"]=> int(512) }

This made it easier for me to display the attributes set on each user and to filter out users whose accounts had been disabled, I just made sure the ACCOUNTDISABLE flag was not set in the return values.


// example usage
$result = ldap_search($ad, "OU=Users,OU=Office1,DC=country,DC=company,DC=com", "(&(objectCategory=user))");
//Create result set
$entries = ldap_get_entries($ad, $result);

for ($i=0; $i < $entries["count"]; $i++) {
    $userAccountControlAttributes = getUserAccountControlAttributes($entries[$i]["useraccountcontrol"][0]);
    if (!isset($userAccountControlAttributes["ACCOUNTDISABLE"])) {
        // do something
    }
}

Hope this helps someone trying to show account attributes using PHP.

]]>
http://ananthdeodhar.com/php-active-directory-integration-get-useraccountcontrol-attributes/7d41091a-b6de-461d-a713-3d8b29638b0bFri, 28 Aug 2009 06:07:26 GMT
<![CDATA[Some of the tools I use]]>I  was going to write about Notepad2 but just didn't get around doing it. So here I am just listing out a few tools I use :

Notepad2 (Windows notepad is dead, this one has truly replaced all my windows systems)

WinMerge (diff tool)

Softerra LDAP Administrator (amazing ldap manager)

Easy Eclipse (eclipse installation for the truly lazy people)

]]>
http://ananthdeodhar.com/some-of-the-tools-i-use/659910e0-15f9-4d1d-9206-a878198b34fdFri, 28 Aug 2009 05:06:31 GMT
<![CDATA[TAR to the rescue]]>Recently I had to automate a few very VERY redundant tasks on Mac. We have been using PowerGlot - an application used to localize nib and string resources. The following were the steps which are used to localize any application:

  • Choose the English Resource Folder (which contains nib and string resources)
  • Choose the Target Resource Folder (where the localized files would be placed)
  • Give the glossary which has the translations stored in it.

I checked out the source code from the CVS repository on my system, and ran the script which finished off the work in a few minutes.

Little did I realize that when the script was placing the nibs in the target folders it overwrote any previous CVS entries inside the nib.

A nib is basically a Bundle which CVS treats as a simple directory, so when you check in a nib into the repository, CVS will insert its entries inside the nib bundle.

I read many forums to figure out a way to open the bundle using applescript but without any luck. Then on one of the forums I read someone who had faced a similar problem and tar might help.

A few more searches on how to use TAR and sure enough it be my saviour! Just posting the code snippet here for future reference:

-- tempPath had the localized resources
-- targetPath was the folder inside the CVS repository

do shell script "(cd "" & tempPath & ""; tar cf -
* --exclude CVS) | (cd "" & targetPath & ""; tar xfp -)"

"--exclude CVS" option ensures that if any CVS folder exists inside the localized nib data it doesn't get copied into the new target folder (which in my case was the actual repository)

]]>
http://ananthdeodhar.com/tar-to-the-rescue/e6329d4d-b593-448a-a410-bd73bb3d1b66Tue, 05 Aug 2008 01:41:57 GMT
<![CDATA[We are sinking!!!]]>Its been a while since I wrote anything, have been pretty busy over the last few days. I came across a funny ad so sharing it here. :)

[flashvideo filename="misc/wearesinking.swf" width="420" height="240" /]

]]>
http://ananthdeodhar.com/we-are-sinking/4e1ebdd9-fcd3-4100-abee-849a98c4ce71Mon, 17 Dec 2007 00:23:15 GMT
<![CDATA[Essay: The Cow - a must primer to learn the English Language!]]>The following essay has been around since I was a kid, which wasn't a very long time ago, and it sure has passed the test of time. I know it has been on many websites but I must share this for it formed the very base of my learning path in English. :)

The first time I came across this "jewel" of English was when I was at school. Apparently it is a true essay written by a Bihari candidate as part of the qualifying Examinations for UPSC [IAS - Indian Adminstrative Services]. The candidate has written an essay on the Indian cow:

Indian Cow HE IS THE COW.

The cow is a successful animal. Also he is 4 footed, And because he is female, he give milks, but will do so when he is got child. He is same like-God, sacred to Hindus and useful to man. But he has got four legs together. Two are forward and two are afterwards. His whole body can be utilised for use. More so the milk. Milk comes from 4 taps attached to his
basement. horses dont have any such attachment What can it do? Various ghee, butter, cream, curd, why and the condensed milk and so forth. Also he is useful to cobbler, watermans and mankind generally. His motion is slow only because he is of lazy species., Also his other motion.. gobar is much useful to trees, plants as well as for making flat cakes like Pizza, in hand , and drying in the sun.

Cow is the only animal that extricates his feeding after eating. Then afterwards she chew with his teeth whom are situated in the inside of the mouth. He is incessantly in the meadows in the grass. His only attacking and defending organ is the horns, specially so when he is got child. This is done by knowing his head whereby he causes the weapons to be paralleled to the ground of the earth and instantly proceed with great velocity forwards.
He has got tails also, situated in the backyard, but not like similar animals. It has hairs on the other end of the other side. This is done to frighten away the flies which alight on his cohesive body hereupon he gives hit with it.

The palms of his feet are soft unto the touch So the grasses head is not crushed. At night time have poses by looking down on the ground and he shouts . His eyes and nose are like his other relatives. This is the cow.

We are informed that the candidate passed the exam.and is now an IAS, is bihar in somewhere... (Sorry somewhere in Bihar)

]]>
http://ananthdeodhar.com/essay-the-cow-a-must-primer-to-learn-the-english-language/2563c565-32fd-4477-a90a-ba9b6224d007Mon, 08 Oct 2007 06:53:46 GMT
<![CDATA[Spider Pig - Good Music]]>I have been listening to Spider Pig by Hans Zimmer most of today. Nice haunting music :) from The Simpsons. Most of Hans Zimmer music is really good, specially the tracks from the movie Black Hawk Down.

For those who appreciate the sense in the nonsense here is the Spider Pig…Song.

]]>
http://ananthdeodhar.com/spider-pig-good-music/5d605794-d132-4e3a-b3a3-ff21ca24d990Fri, 21 Sep 2007 03:55:53 GMT
<![CDATA[Liesl, my child, my Wolfy is finally free...]]>Today my little one has gone forever... At 4:12p.m. we had to put her to sleep. I am glad we took the decision and ended her misery but a part of me is gone. She was suffering from cancer - like nodules and a fractured osteoporotic foot.I sure do know what it must be like to lose a child.

Liesl, a beautiful, most adorable, german shepherd was with us for the last eight years. She was most attached to me, every single day I came back the unconditional love I got probably no human could or would ever be able to replace. I will certainly cherish her memories and the love and affection she gave us all.

At the moment its too hard for me to write what I am feeling, maybe I will, maybe I wont...

]]>
http://ananthdeodhar.com/liesl-my-child-my-wolfy-is-finally-free/ebf9bfc0-94a7-46c0-a57e-637590ca8053Fri, 14 Sep 2007 12:24:22 GMT
<![CDATA[My very first post]]>I guess I should be happy as a new born puppy, I have me own blog! The truth is sadly graver, I am wondering and skeptical about WordPress. I had a lot of "Should I, Shouldn't I" moments while going with the one click install feature.

Let's see how long I keep WordPress. For the moment me not complain.

]]>
http://ananthdeodhar.com/my-very-first-post/b1235402-3e4c-43a0-be10-5c374ae7df2dTue, 28 Aug 2007 23:58:22 GMT