Python, Django and Google AppEngine ...


django
So I made this website with python and Django powered by Google AppEngine. Now, deploying pure django applications on GAE (Google AppEngine) isn't that easy as some of you may know. To make your job easy and save you some time, people at allbuttonspressed.com have come up with a really nice project named django-nonrel.
abp logo

It only took me only about 80 lines of python code and 40 lines of html ( thanks to Django templates) to get my webapp running.
I am thinking of writing a tutorial about Django-nonrel and GAE, not about the standard procedure but about those "where am I going wrong" things that people usually come across. In the meantime, if you need any help, mail me (vivek@vyadav.in) .


C++ Default Constructors. When and what ?



The C++ standard defines a constructor as follows:
 
    "A constructor is used to initialize objects of it's class type."

and a default constructor as:

    "A default constructor for a class X is a constructor of class X that can be called without an argument. If 
there is no user-declared constructor for class X, a constructor having no parameters is implicitly declared as defaulted"

A lot of people assume this to mean that each and every data-members of a class will be initialized by a magical default constructor created by the compiler. Now, the compiler does create a default constructor and this constructor may initialize some of the object members but not necessarily all . The C++ standard specifies when the compiler should write a default constructor and what should this constructor do.


First let us understand trivial constructors. As the name suggests, it's trivial and has to do nothing. Implicit trivial constructors are created under the following 4 conditions(12.5.1):

  1.     its class has no virtual functions and no virtual base classes , and
  2.     no non-static data member of its class has a brace-or-equal-initializer, and
  3.     all the direct base classes of its class have trivial default constructors, and
  4.     for all the non-static data members of its class that are of class type (or array thereof) 

for all other cases, a non-trivial default constructor is created if the user does not provide one.

A implicit non-trivial default constructor invokes the constructor of it's class' member objects in the order of their declaration. It never initializes data members on it's own. So if you were thinking that all your int and float variables would be assigned zero on object creation, then you have a bug in your program. 
 

OpenShift - Red Hat PaaS


I tried out the new PaaS from the Red Hat people, known as Openshift. It has a easy console since a noob like myself was able to deploy a test site in less than an hour. I had tried out the DotCloud service a while back and I say OpenShift is wins here and it's going to get better, given the fact that the service is still not complete.

 
OpenShift


Currently I have made just a sample Django site (http://rhapp-vivekyadav.rhcloud.com/), but I'm thinking of shifting this site to OpenShift with MongoDB instead of struggling with gql on Google Appengine.

Hi ! and welcome. My name is Vivek Yadav. I like solving problems with programming. From colloid simulations to Websites and template metaprogramming to functional programming, I use computer programming quite a lot.