Monday, April 22, 2013

Using mod_wsgi with Celery

http://engineering.hearsaysocial.com/2013/04/21/using-mod-wsgi-with-celery/

Friday, April 19, 2013

RequireJS

The RequireJS documentation appears to suggest that you can define configurations such as the following:

requirejs.config({baseUrl: 'http://app.example.com',
                  paths: { underscore : 'static/js/external/underscore.js',
                           backbone : 'static/js/external/backbone.js'})

If you try to use this approach, you may find RequireJS appending an extra .js file.

RequireJS also assumes by default that all dependencies are scripts, so it does not expect to see a trailing ".js" suffix on module IDs. RequireJS will automatically add it when translating the module ID to a path. With the paths config, you can set up locations of a group of scripts. All of these capabilities allow you to use smaller strings for scripts as compared to traditional <script> tags.

There may be times when you do want to reference a script directly and not conform to the "baseUrl + paths" rules for finding it. If a module ID has one of the following characteristics  the ID will not be passed through the "baseUrl + paths" configuration, and just be treated like a regular URL that is relative to the document:
  • Ends in ".js".
  • Starts with a "/".
  • Contains an URL protocol, like "http:" or "https:".
Within the RequireJS code, there is a test for the question mark (?):
url += (ext || (/\?/.test(url) ? '' : '.js'));

...to avoid RequireJS add an extra .js to the end, you can do the following to avoid the addtion.JS:

requirejs.config({baseUrl: 'http://app.example.com',
                  paths: { underscore : 'static/js/external/underscore.js?r=1',
                           backbone : 'static/js/external/backbone.js?r=1'})


This pull-request still seems to fix this issue:

https://github.com/jrburke/requirejs/pull/716

Tuesday, April 9, 2013

mailto: links and plus encoding

Python has urllib.quote() and urllib.quote_plus().  Which one should use for URL-encoding mailto: links?  Answer: use urlib.quote(), since spaces will normally be converted to urllib.quote_plus() and cause confusion in whether it actually is part of a person's email address.

http://tools.ietf.org/html/rfc6068#page-8

When creating 'mailto' URIs, any reserved characters that are used in
the URIs MUST be encoded so that properly written URI interpreters
can read them. Also, client software that reads URIs MUST decode
strings before creating the mail message so that the mail message
appears in a form that the recipient software will understand. These
strings SHOULD be decoded before showing the message to the sending
user.

Software creating 'mailto' URIs likewise has to be careful to encode
any reserved characters that are used. HTML forms are one kind of
software that creates 'mailto' URIs. Current implementations encode
a space as '+', but this creates problems because such a '+' standing
for a space cannot be distinguished from a real '+' in a 'mailto'
URI. When producing 'mailto' URIs, all spaces SHOULD be encoded as
%20, and '+' characters MAY be encoded as %2B. Please note that '+'
characters are frequently used as part of an email address to
indicate a subaddress, as for example in .

The 'mailto' URI scheme is limited in that it does not provide for
substitution of variables. Thus, it is impossible to create a
'mailto' URI that includes a user's email address in the message
body. This limitation also prevents 'mailto' URIs that are signed
with public keys and other such variable information.

Monday, April 8, 2013

Using Jekyll and iFrame's

It turns out the use of your Markdown converter affects whether you can embed YouTube clips (i.e. iFrame's).  For this reason, I switched to using rdiscount instead of the default one included in Jekyll:

https://github.com/mojombo/jekyll/issues/232

More context here:

https://github.com/mojombo/jekyll/wiki/install


MLB.tv's zip code detector tool

It's baseball season....want to know what your IP adresss maps in terms of approximate zip code location?

http://www.mlb.com/mlb/subscriptions/iplocation.jsp

Wednesday, April 3, 2013

Verizon's MiFi 4620L firmware upgrade 3.20.16

The firmware 3.20.16 is now available for the Verizon MiFi 4620L device Verizon has a document http://support.verizonwireless.com/pdf/system_update/mifi4620l.pdf that describes the improvements. It includes a new data meter along with some fixes associated with dormancy mode...let's hope that it solves the issue where the device has sporadic issues simply powering off.

You can upgrade the firmware by logging into the web browser and checking for firmware updates.

MiFi4620_3.20.11_3.20.16_Real
Size: 653.51 KB
Estimated Install Time 1 minute 40 seconds
Description: MiFi4620L Upgrade from 3.20.11 to 3.20.16

Some previous documented shortcomings are here:

https://community.verizonwireless.com/message/534516/

Tuesday, April 2, 2013

Using Django proxy = True..

If you're using Django's proxy=True and see this error message:

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 89, in __new__
    new_class._base_manager = new_class._base_manager._copy_to_model(new_class)
AttributeError: 'NoneType' object has no attribute '_copy_to_model'

... chances are you're assigning proxy = True to the base class instead of the inherited classes.