Skip to main content

Posts

What time is it? Now. The perfect time.

Our lives are so monotonous, so still. Time just passes by for us and we never care. Every single day is just like the previous one. All we care about is how to make good bucks and how to stay ahead in the race all the time. We never have time to do what we want to do. Study science because everyone says so, do Engineering because they all say it's cool, join IT because they say here is all the money in the world. When was the last time you took a decision that was completely your own and you stood by it? If you are prompted to look into discreet history for an answer, I tell you, you are doing it all wrong. You and I are on the same track and that track, my friend, is not the best one to ride on. Our lives deserve a better treatment from us. Now is the time to live your life. If you are my age, you have well settled parents, you are not married and you have some steady cash flow, now is the perfect time to live your life. Go out. Do a course you always wanted to do, ...

Push a little

The human body is some awesome piece of machinery. It will resist to any and all changes you give, but if you continue to push, it'll adapt! The key is to not give up. There will surely be a moment when you feel like giving up, but trust me, it's all psychological. If you can convince your mind that you can take more, you can take more! The first 100 meters are tough, but once that is over, body takes care of itself. Its a piece of cake thereafter. #weightloss

Been a while..

When I was in college, I remember my pass-out seniors telling me "life is not the same outside college, especially when you start working". Back then, I thought it is a statement for the weak heart as I was a firm believer of "you always have time to do what you want to do." Well, now that I have been out of college for almost 2 years, here's what I have to say. They were right. It's not. You don't necessarily have time to do what you want to do. There are always two sets of tasks boggling your mind - The important ones and the urgent ones. Important ones like going to the gym, learning a new language, writing blogs, keeping contact with old friends. You want to do each of them but you never get time. You are constantly boggled by the more pressing, more urgent tasks - that nasty bug in the code, that awesome plugin and what not. They always take priority. Always. So readers, find time for yourself. Regulate your life. Because if you just let...

include multiple jQuery Libraries on a single page

We have been using jquery 1.4.2 for all our plugins, but for one specific autocomplete widget, we required jQuery 1.5.1 After 1 hour of googling and another of playing around with the code, I figured the method as follows : include the new library first <script type="text/javascript" src="/js/jquery-1.5.1.js"></script> now include the dependent script <script type="text/javascript" src="/js/jquery.tokeninput.js"></script> assign this library to a different variable <script type='text/javascript'>   var jq = jQuery.noConflict(true);   </script> Now include older jQuery library and its dependent plugins!

Writing Shell Extension to display custom right click context menu

Programming is fun! So as part of my regular work, I had to write a shell extension that'll display some options in the right click context menu for some specific type of files. The first search took me to  http://www.codeproject.com/Articles/441/The-Complete-Idiot-s-Guide-to-Writing-Shell-Extens Its a cool tutorial, only that the demo is not in VC++ 2010 that I was using. I was initially using VC++ 2010 express, so it didn't have ATL. I had to download VC++ Ultimate. The tutorial says add a class in the classview. I couldn't figure out what it was. (I have never programmed in VC++!) It just occured to me and the classview was available in the VIEW tab. Another gotcha here. In the tutorial it says disable aggregation on Attributes page. There is no attributes page in VC++ 2010. That option is in OPTIONS tab. Eventually, with some hooking around asking for help, I was directed to a python implementation of the same solution, which, by the way, is pretty cool. So I went ahead...

Getting the node body with the index method call - services module drupal 7

The api call to the index method i.e. http://domain/?q=endpoint/node returns an index of nodes (this call can be paged too. e.g. http://domain/?q=endpoint/node.json&page=2&pagesize=10 ). It does not return the node body with it. node body is in a separate table (field_data_body) table I needed the index to contain the body too, which I can parse and display as a feed on my application. I was looking at "services views" module but could not it to work. So I hacked around and played around with the node_resource's index method to respond back with the join of the two tables and thus containing the node body for a given node id. Code snippet: function _node_resource_index($page, $fields, $parameters, $page_size) {   module_load_include('inc', 'services', 'services.module');   $start = (($page)-1)*$page_size;   $query = db_select('node', 'n');   $query->join('field_data_body', 'u', 'n.nid = ...

services module Drupal 7. Getting the JSON server to work.

I needed to use my drupal site as web service to serve my android/iphone app. The responses had to be in json format. I knew about services module which can do the needful with json server enabled. However for drupal 7, the documentation said that json server is built into the services core. The documentation is JUST AWFUL Anyways cutting the shit, here's how I got stuff working : install services 3 grab spyc library (this was the most irritating part)  http://code.google.com/p/spyc/downloads/detail?name=spyc-0.5.zip from the download, copy spyc.php and paste it in modules/service/servers/rest/lib enable services module enable "rest server" module at this point Services may not appear in Structure. Run cron and Update script. go to structure->services->add give a unique name, an endpoint name (mine is "api") so in the textbox, just write "api" nothing else save and then open it to edit in the resources, check "node" permissions for ...

Year 2011

Another year passed. It was a pleasant one though. College got over (finally!), passed (that too with good grades! ;-)), got a job (a dream one!) and more or less a smooth life (yeah, finally!). This year had been more of learning than action unlike the previous ones. There was some action. There were heartbreaks. There was what I call a "Damage control" period. And then there was "shut up and move on period! "But then, life isn't supposed to be a joy ride. Is it?