Monday, March 13, 2017

Debugging Django applications using visual studio code

Visual studio code is the open source IDE from Microsoft which supports so many languages(C#,python, PHP)
Prerequisites to start debugging Django applications in Visual studio code-

  • Basic knowledge of visual studio or any other IDE
  • Basic knowledge of Django


Steps to debug the Django web application-

  1. Download visual studio code from here
  2. Create a django project if there is no project created.. Reference documenation here
  3. Open the visual studio code application
  4. Open a django project from folder
  5. Open  window Debug, set Django as the environment and click play button or press function f5 to start debug

Put breakpoint at any position to start debugging the code

Monday, August 16, 2010

Noteworthy blogs of my friends.

Been a while since I`ve updated my blog. Seeing my friends blogs, I have atleast got the drive to add another blog entry :)
Here`s the list:
Anurag Saurabh`s blog on general technology topics: Anurag`s stencil

Amal Hashim`s blog of MS technologies: .Net Goodies

Saturday, November 14, 2009

My experiences with IE8

I was a bit apprehensive to use the IE8 which created a buzz amongst developers and technology enthusiasts.
But I must say I am impressed by the sheer number of features supported by IE8. First and foremostly, MS had a re-look at the pathetic rendering engine
Trident and made significant changes in Trident which are noteworthy and are visible from the outset of the browser.

My favourite features of IE8:

  • The best feature I liked was to select a part of page and use it as a live bookmark:O Yep, its as easy as it gets!
  • The addons offered from IE are cool and there are quite a few of them.
  • Great security features with respect to the private browsing sessions provided and .
  • Inter translation of pages leveraging the globalization aspect of websites.
  • As a web developer who was to constantly work with colours of web pages, width of web page elements there s great news for you. Stay on a web page and just press F12 to open the trident rendering engine. Not only the tool shows details of the page, it also provides profiling of web pages. Added to this, there are tools like colorpix and cool ruler integrated which are handy for a website designer.
  • Pretty fast browsing speed.
  • Right click options of the browser are noteworthy although most of the right click options are tightly linked to windows live and other MS products like excel and one-note.

On the down side, few features of IE8 in particular and IE in general always bother me.

  • IE8 caches a lot of data. Infact IE8`s memory consumption is comparable to that of FF owing to the caching.
  • I hate the tick tick sound when a page gets rendered. Dont know how this issue has not been noticed my MS.

So, thus ends my experiences of the short stint with IE8.Comments and discussions on the same are always welcome :)

References:

  1. http://en.wikipedia.org/wiki/Trident_(layout_engine)
  2. http://www.microsoft.com/windows/internet-explorer/features/faster.aspx

Friday, August 7, 2009

PDF generation using .net

I had got a requirement from client to generate membership certificate as a pdf document for the person who joins the website.We researched and planned to make use a third party library called itextsharpLib.

The requirement was to generate a pdf which had a background image and some text to be placed into the pdf which was not that difficult a requirement and hence was able to finish it off within a day with help from the internet mind you.

The problem with this requirement was that there was very less documentation in the internet about the itextsharp library for .net.

Also we had planned to dynamically generate a web page and convert the HTML to pdf. But there was a lot of complexity in the requirement to generate the pdf using HTML. So, I took the easier route and generated the pdf required pretty easily.

So I refered this link to get the required tutorial needed for my requirement.

Steps I went through to get the requirement done:

  1. Instantiate the memory stream stream, required for holding the pdf document generated.
  2. Create a document object document, with the required page size and other layout options.
  3. Instantiate a PdfWriter object writer, which requires the memory stream and document as parameters.
  4. Open the document object using document.Open() method.
  5. Created the Image element and added it to the document using document.Add(img) where img is the obj of the type Image which would be implemented using the IElement interface. Prior to the adding we needed to have initialized the img properties.
  6. Created a PdfContentbyte object using the line PdfContentByte cb = writer.DirectContent;
  7. Write the content on the image between the lines cb.BeginText(); and cb.EndText(); using the method cb.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "Text to be written", x-coordinate, y-coordinate,z-coordinate);
  8. Close the document object using document.close();
Now that we have the pdf document in the memory stream, putting the document in the HTTPHeader of the existing HTTPContext is pretty simple.
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ContentType = "application/pdf";
string test = "document";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename="+test+".pdf");
HttpContext.Current.Response.BinaryWrite(MStream.GetBuffer());
HttpContext.Current.Response.End();

And there you are, you will get the pdf document as an attachment in your browser.

P.S: The blog entry is under construction. Will add the code snippet and downloadable source code shortly.

Thursday, August 6, 2009

My favourite sites and tools.

I am addicted to the internet and am obviously fascinated by the way in which the websites have evolved and so also the content. In this blog, I am going to list out a few of my favourite sites which I regularly go through to update myself with the happenings in the world.

I always believe that if you want to search anything on the internet, be it books, information or anything which you are interested in, try to see only from authentic sources. For example, if its book you are researching on, see the review of the book in amazon.com. You will also get related links related to the book that you have searched on amazon.

Below are the list of the few of my favourite sites

Technology related:
  • http://blogs.msdn.com/default.aspx - is the blog on Microsoft Technologies which I am interested in and I regularly go through
  • http://www.gartner.com/ is the blog which tells about the current trends in IT.
  • http://www.w3schools.com/ is the website to learn basic website building skills.
  • http://www.uxunleashed.com/ about the various user experience related blog. This blog is created by the previous organisation where I used to work.
  • http://www.readwriteweb.com/ which gives the latest technology trends of the world.
  • http://www.apifinder.com/ to search for any APIs that are available for free which might be needed for solving a problem.
Hobbies:
  • htttp://www.imdb.com has the complete list of hollywood and foreign language movies
  • http://www.the-numbers.com gives the list of hollywood movies box office performance.
  • http://www.livemocha.com if a person is interested in learning a foreign language online.
P.S: The list will be evergrowing as the web is ever growing. So will update this blog regularly. Also, there might be better sites than what I have mentioned in the blog entry. Suggestions and comments are always welcome.