Archive | Tech Tips RSS feed for this section

Creating Temporary Tables in SQL Server

2. October 2009

Comments Off on Creating Temporary Tables in SQL Server

Here are three methods of creating and working with temporary tables in Microsoft SQL Server: Method 1: Select Into This is a quick and dirty method to create a temporary table. Compared to the other methods, you do not have to define the column names. Just add the ‘into #temptablename’ at the end of the […]

Continue reading...

Getting Distinct Rows Using Django Database Layer

1. October 2009

2 Comments

To get the equivalent of the SQL select distinct statement in Django, you can use a combination of the values() and distinct() method of the QuerySet api. For example, you have a musicians table and you want to get list of instruments that they play (with no duplicates): Musicians.objects.values('instrument').distinct() The values(‘instrument’) method will generate a […]

Continue reading...

How to Get a Client IP Address in DJANGO

14. August 2009

5 Comments

Here is a small snippet to get the client’s ip address in your python code in DJANGO. You might have tried the ‘REMOTE_ADDR’ key in the request object but it always returns 127.0.0.1. To fix this, you can use the ‘HTTP_X_FORWARDED_FOR’ variable like so: from django.http import HttpRequest def mypage(request): client_address = request.META['HTTP_X_FORWARDED_FOR'] .... The […]

Continue reading...

Firefox Extension Error: DebugNextPageMI is null

12. July 2009

Comments Off on Firefox Extension Error: DebugNextPageMI is null

I kept receiving this error message on start up after upgrading the SNUM extension I am working on:    TypeError: DebugNextPageMI is null My extension updates worked fine before this upgrade. After some research, I found that the Zend 2.1 PHP Debug toolbar was causing some type of conflict. When I looked at my code, one […]

Continue reading...

3 Solutions to Invalid File Hash Error in Firefox

10. July 2009

Comments Off on 3 Solutions to Invalid File Hash Error in Firefox

If you received the following error when trying to update a Firefox extension: Firefox could not install the file at “filename.xpi” because: Invalid file hash (possible download corruption) -261 Here are three possible fixes: 1) Clear your Browser History, Browser Cache and Cookies You can do this from the menu by clicking Tools -> Clear […]

Continue reading...