Mind the Knowledge Gap
There were a couple of months I felt my rate of learning wasn’t improving as quickly as before. I had become somewhat comfortable in the daily routine. This didn’t last long of course. Recently, I had to build a realtime map app for one of my products, TripEvent. To do so, I had to use gevent-socketio. Diving into this triggered a whole chain of questions that exposed my lack of understanding about what really goes on under the bonnet.
I’ve relied heavily on my pattern recognition skills (and slavish hours just practicing, building) but there is not escaping the fact that some key computer concepts still eludes me. For example: when a user lands on my website, this generates a GET request that is processed by my reverse proxy (nginx in my case) which is somehow handed off to uwsgi which then hits my django app which finally hits my database (postgres). Is this all happening on 1 process? What happens when there are 2 requests at the same time? How does tweaking my nginx worker settings affect this? How this Python’s GIL come into play? How is multi-threading or multi-processing con-currency relevant? In the context of Python, how does gevent and its greenlets overcome this? I think you guys can see where I’m getting at.
Why is it that there isn’t any resource that explains such concepts from a web developer’s point of view? Especially one that doesn’t have formal computer science training. I imagine there must be many more people like me out there, all self taught, all wondering what really goes on under the bonnet! The information as always, is all out there. It’s piecing it together and make it conceptually sound in the context of my job (web developer) that’s hard.
I am in a major state of discomfort but this is forcing to learn and read more and ultimately plug the missing knowledge gaps. I think one always needs to be in a slight state of discomfort to improve. To be comfortable and not have questions gnawing at the back of your brain is a submission that you’ve not doing anything interest or new.
If you have an error for event_bindings in your chrome console that looks something like this:
Error in event handler for ‘undefined’:
Unexpected token u SyntaxError: Unexpected token u at Object.parse (native) at chrome-extension://hobijieodegdbpakkfiopclcljnomfnj/ylc.js:120:23 at miscellaneous_bindings:288:9 at chrome.Event.dispatchToListener (event_bindings:390:21) at chrome.Event.dispatch_ (event_bindings:376:27) at chrome.Event.dispatch (event_bindings:396:17) at Object.chromeHidden.Port.dispatchOnMessage (miscellaneous_bindings:254:22)
It is most likely due to a rogue chrome plugin. In manage extensions, search for the one listed in the error message. In my case, it is hobijieodegdbpakkfiopclcljnomfnj and disable it. Restart your browser and all should be well again.
If your prompt ever looks like this:
Python 2.7.3 (default, Oct 22 2012, 06:12:32)
Type "copyright", "credits" or "license" for more information.
IPython 0.13 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
[0;34mIn [[1;34m1[0;34m]: [0m
To fix, simply run: easy_install -a readline
Add HTML5 data attributes directly to the button like this:
self.helper.layout = Layout(
Submit('add', 'Add', css_class="btn-primary"),
Button('cancel', 'Cancel', css_class="btn-danger",
instead of this:
HTML('<input type="button" name="cancel" value="Cancel" \
This is mostly an on-site specific guide
- Use the redirects app to manage url changes Django documentation
- Use post save signals to handle slug/url changes in your models Link
- Use sitemap The sitemap framework
- Use slugfield Model field reference
- Use cached template loaders to reduce page load times The Django template language: For Python programmers
- Use a css/js compressor to reduce page load times django_compressor
- Use django-robots to manage your robots file django-robots
- If you’re rolling an e-commerce site, don’t reinvent the wheel, just go with The Best Django CMS. It’s the best code and seo friendly cms framework for django
- Manage object level meta data with django-seo
- Not django specific but submit your site to google webmasters Webmasters – Google. For bing: Bing – Webmaster Tools
- Not django specific again but load your page using Make the Web Faster and make all the recommended changes
- Crawl your site content to find broken links using Xenu or Integrity for Mac
- To generate image sitemaps, use Django Image Sitemaps
Posted in django
Tagged django, seo
If you try to clear your trash and it progress bar seems to hang, it’s probably due to a locked file. A few recommendations on the internet requires the user to mess around in terminal and creating a new .Trash2 folder in your home folder and than doing a mv and then delete again.
There’s an easier way to accomplish this. Simply go to your Trash, hit cmd-a, move all the files out into a temporary folder. The remaining ones in Trash will be the locked files.
To unlock, simply right click, Get Info, there should be a small lock on the bottom right of the pop up. Click on it to unlock the file. You should be able to delete it now.
Posted in Uncategorized