when you go from 10,000 training examples to 10 billion training examples, it all starts to work. Data trumps everything.
-- Douglas Hofstadter
http://www.theatlantic.com/magazine/archive/2013/11/the-man-who-would-teach-machines-to-think/309529/
Not today Justin
Sweet Seals For You, Always
noise dept.
Claire Keane

roma★
Misplaced Lens Cap
hello vonnie
I'd rather be in outer space 🛸
$LAYYYTER

No title available
almost home
Keni

Love Begins
2025 on Tumblr: Trends That Defined the Year

tannertan36
i don't do bad sauce passes
taylor price

Janaina Medeiros
let's talk about Bridgerton tea, my ask is open

No title available

seen from United Kingdom

seen from United Kingdom

seen from Brazil
seen from Malaysia
seen from South Africa

seen from Malaysia

seen from China
seen from United States

seen from Türkiye

seen from Italy

seen from Brazil

seen from United States
seen from United States
seen from United States
seen from United Kingdom

seen from Germany

seen from Türkiye

seen from Malaysia

seen from Netherlands

seen from Malaysia
@programeverything
when you go from 10,000 training examples to 10 billion training examples, it all starts to work. Data trumps everything.
-- Douglas Hofstadter
http://www.theatlantic.com/magazine/archive/2013/11/the-man-who-would-teach-machines-to-think/309529/
Django: ManyToMany relationships and the unsaved parent race-condition
The error:
ValueError: "<Foobar>" needs to have a value for field "foobar" before this many-to-many relationship can be used.
The problem: you're trying to access the ManyToMany field of a model before saving said model.
The scenario:
# child class Subject(models.Model): name = models.CharField()
# parent class Course(models.Model): name = models.CharField() subjects = models.ManyToManyField(Subject)
To query the many-to-many field of a parent model Django first needs the parent's primary key present in the database. Without the primary key any attempts to add new ManyToMany field instances to the unsaved parent will fail because, as the Django docs explain in the section on many-to-many relationships, you can't associate a ManyToMany field instance without having that precious pk!
Looking at the code sample above you can see that we can have lots of subjects that might belong to all kinds of different courses. One thing is for certain though: never shall science and religion meet! So, let's look at a full-blown code example which produces this very particular kind of error (i.e. at the time of writing there was very little that Google turned up for my situation).
from django.db import models
class Subject(models.Model): SUBJECT_CATEGORIES = ( ('science', 'Science'), ('religion', 'Religion') ) name = models.CharField(max_length=100) category = models.CharField(choices=SUBJECT_CATEGORIES, max_length=50) start = models.DateTimeField(default=None, null=True, blank=True)
class Course(models.Model): name = models.CharField(max_length=100) start = models.DateTimeField(default=None, null=True, blank=True) subjects = models.ManyToManyField(Subject)
def asking_for_trouble(self): course_subject_categories = set([s.category for s in self.subjects.all()]) return True if len(course_subject_categories) == 2 else False
def save(self, *args, **kwargs): # Religion must stay 500 yards from Science at all times. if self.asking_for_trouble(): raise Exception('Science v Religion: restraining order') super(Course, self).save(*args, **kwargs)
The problem arrises in the asking_for_trouble method which attempts to access all Subject entries via the ManyRelatedManager, subjects. But if you're creating a Course for the first time you: a) don't have a primary key in the database, b) don't have a ManyRelatedManager. Looking through the offending source code (or having it right at your fingertips/browser by way of django_extensions' runserver_plus) you can see that a ManyRelatedManager is created on first access and in our case its when the parent model isn't yet saved to the database.
The solution: Django's signals. In this case, pre_save will save your ass. If you were, say, adding calendar events every time you added a new Subject then post_save would be appropriate.
The takeaway: hot Indian curry, plenty of spices and no skimping on the capsaicin.
And knowing when and where to mutate Django objects. And knowing how Django is working its magic under the hood. And realising the shortcomings of database abstraction layers and not being afraid to dig in and learn what the framework is doing when things go wrong, taking your time so you can come away from the whole exercise (often one of patience) knowing a little bit more about how some of the insanely good tools we use very day actually work.
The Silk Road, for all its clever uses of security protections like Tor and Bitcoin to protect the site's lucrative drug trade, still offered its enemies a single point of failure. When the FBI seized the server that hosted the market, the billion-dollar drug bazaar came crashing down. If one group of Bitcoin black market enthusiasts has their way, the next online free-trade zone could be a much more elusive target.
Efforts have been migrated over to OpenBazaar so check it out, its pythony and in its infancy and definitely worth supporting.
AirChat - Free Communications For Everyone.
Fuck. Yes. that is all
You couldn't get anymore neo-geek hipster douchey douchebag than this.
Factory-based data-population.
Ansible is the simplest way to automate apps and IT infrastructure. Application Deployment + Configuration Management + Continuous Delivery.
Python mocking framework (now apart of unittest in python 3.x)
The spacecraft Cassini–Huygens, launched in 1997, contains two identical flight recorders, each of which contains 2.5 gigabits of memory in the form of arrays of commercial DRAM chips. Its engineering telemetry reports the number of (correctable) single-bit-per-word errors and (uncorrectable) double-bit-per-word errors. In the vicinity of Earth, and when the sun is "quiet", it reported a nearly constant single-bit error rate of about 280 errors per day. The maximum hourly error report from Cassini–Huygens in the first month in space was 3072 single-bit errors per day during a weak solar flare. If the flight recorders had been designed with EDAC words assembled from widely-separated bits, the number of (uncorrectable) multiple-bit errors should average less than one per year.
Feminism in the tech industry: "we need more women/girls", or, these numbers dont look right
To feminism or not to feminism, that is the question. To artificially attract more women to IT because... ummm, well.. there are a lot of guys? I don't really understand the point of 'getting more women into I.T.' I'm not opposed to it, it just seems irrelevant trying to get more of gender X into industry Y because the numbers are uneven. As if the imbalance (purely on the percentages) were somehow detrimental to that particular gender and/or industry. I'm all for gender equality but trying to artificially draw another gender into a profession/hobby rather than let the merit, fun and appeal of said profession/hobby do that on its own seems unnecessary. Yet I'm curious as to why I.T. seems to be such a male-dominated area. The evolutionary argument has been thrown up there (women are "wired differently"), the cultural conditioning argument too. When you look at say, programming, for what it is without any particular culture attached to it though it doesn't appear inherently male or female oriented or biased. And yet its a male-dominated hobby. Intriguing. You could say men are more attracted to programming than women are. Why is that so? Whats the drawcard that is pulling more guys in than women? Are women really put off by the industry because there are too many guys? I hope not. I hope that either gender would pursue their interests based on the enjoyment and reward of the interest instead of how many of the opposite sex are involved, though this factor of gender dominance has an effect on our psyche. There's definitely something to this topic thats worth exploring and asking questions of. Its importance could be overstated; its importance may very well be entirely understated; there could be male-driven factors absolutely rampant in the tech industry that most aren't seeing because there aren't enough women talking about it because there aren't enough women in the tech industry! Who knows - I'd like to. linkies (food for thought): https://en.wikipedia.org/wiki/Jeri_Ellsworth http://geekfeminism.wikia.com/wiki/FLOSS http://geekfeminism.wikia.com/wiki/CouchDB_talk http://geekfeminism.wikia.com/wiki/Linux_Journal_blowjob_ad http://en.wikipedia.org/wiki/Marissa_Mayer
Classic.
Panic loomed in Bitcoin land on Thursday as a popular mining pool threatened to hijack the system.