Services Blog Français

Django & DBAs: "Performance problems due to incorrect many-many primary key on many tables"

| by jpic | django django-developers

Extract from a great thread on the django-developper mailing list started by Trey Raymond:

I’m a DB engineer working for Yahoo, and we have a new product using django that I’m onboarding. We see a variety of easily fixed issues, but one major one - there are 21 many-many tables here, yet they have auto increment primary keys

-- Example, existing:
CREATE TABLE `accounts_profile_starred_groups` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `profile_id` int(10) unsigned NOT NULL,
  `group_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `profile_id` (`profile_id`,`group_id`),
  KEY `group_id_refs_id_e2f1545` (`group_id`)
) ENGINE=InnoDB;
-- Fixed:
CREATE TABLE `accounts_profile_starred_groups` (
  `profile_id` int(10) unsigned NOT NULL,
  `group_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`profile_id`,`group_id`),
  KEY `group_id_refs_id_e2f1545` (`group_id`)
) ENGINE=InnoDB;

Looking forward to see how it goes !

Read More

Django & ajax & HATEOAS: how to reverse urls in javascript (not)

| by jpic | http hateoas api

This is the second article about reversing urls in javascript. The previous article actually presented a bad idea.

Github API v3

Github’s API is undubitably quite suprising for a web developer that isn’t aware of the HATEOAS concept, here’s the kind of things you can see for example:

[
  {
    "updated_at": "2012-11-27T14:42:24Z",
    "svn_url": "https://github.com/yourlabs/django-cities-light",
    "language": "Python",
    "milestones_url": "https://api.github.com/repos/yourlabs/django-cities-light/milestones{/number}",
    "downloads_url": "https://api.github.com/repos/yourlabs/django-cities-light/downloads",
    "subscription_url": "https://api.github.com/repos/yourlabs/django-cities-light/subscription",
    "teams_url": "https://api.github.com/repos/yourlabs/django-cities-light/teams",
    "full_name": "yourlabs/django-cities-light",
    "git_url": "git://github.com/yourlabs/django-cities-light.git",
    "git_tags_url": "https://api.github.com/repos/yourlabs/django-cities-light/git/tags{/sha}",
    "owner": {
      "login": "yourlabs",
      "organizations_url": "https://api.github.com/users/yourlabs/orgs",
      "followers_url": "https://api.github.com/users/yourlabs/followers",
      "starred_url": "https://api.github.com/users/yourlabs/starred{/owner}{/repo}",
      "following_url": "https://api.github.com/users/yourlabs/following",
      "avatar_url": "https://secure.gravatar.com/avatar/c0efe8e5c15bd268224fbc40a574329d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png",
      "repos_url": "https://api.github.com/users/yourlabs/repos",
      "subscriptions_url": "https://api.github.com/users/yourlabs/subscriptions",
      "url": "https://api.github.com/users/yourlabs",
      "events_url": "https://api.github.com/users/yourlabs/events{/privacy}",
      "gravatar_id": "c0efe8e5c15bd268224fbc40a574329d",
      "received_events_url": "https://api.github.com/users/yourlabs/received_events",
      "id": 1040547,
      "gists_url": "https://api.github.com/users/yourlabs/gists{/gist_id}"
    },

Wow, so many URLs… At first, this may look original, if not excentric. Why aren’t they just documented ?

Read More

How to: fully use gmail with the keyboard

| by jpic | keyboard

Keeping your inbox clean can be quite a pain. Except with keyboard shortcuts.

  • ? shows the list of shortcuts,
  • / to search mails,
  • c to compose a message,
  • gi brings you to the inbox,
  • j and k moves the little blue cursor between threads,
  • x selects the thread that has the blue cursor,
  • e archives selected threads,
  • o opens selected thread
  • a is for reply to all,
  • r is for reply.

That’s it !

Upcoming backward compatibility break in django-autocomplete-light v1.1.0

| by jpic

In the next week(s), django-autocomplete-light v 1.1.0 will succeed to v1.0.26. It will include commit 2c756a may be short but it will break your custom Autocomplete classes that generate custom HTML and custom django-autocomplete_light templates.

To upgrade to 1.1.0, please replace all <div> by <span> with class div in your custom Autocomplete classes and autocomplete_light templates. If you have any, examples can be seen in commit d50fd which fixes some tests (thanks continuous integration provided travis !).

Read More
Previous Page 30 of 33 Next Page

They trust us

Contact

logo