Ask HN: What "weekend project" will you work on this weekend?
That said, what side project will you be working on this weekend?
That said, what side project will you be working on this weekend?
I've finally gotten over the "beginner hump" when it comes to elisp and its becoming a fun little language to toy around with. I figure this'll take a good chunk of Saturday.
[1] http://www.gnu.org/software/emacs/manual/html_node/elisp/For...
Put any url you like in there. It'll either work or it won't. /css/[url] kind of works too.
Also a random app in C# because I failed a midterm exam because I couldn't get runtime DB access to work from memory. Yeah I know, I still suck unless I have Stackoverflow and/or a reference right next to me.
I'm trying the garbage collector for the second time. My first attempt ate the stack and I found it hard to reason about or debug.
I'll try and finish the gc this time but I only recently realized that I didn't need to start writing one at all. For the first version I could have just allocated memory without deallocating.
This weekend I'm focusing on implementing a "conversations" feature, similar to HN's "threads". I am also trying to increase test coverage, so I can agressively refactor my ugly MVP code as I begin to pick up users.
- A one liner query is just called a queryset.
- To get all the "upvotes" of an user it's better to start from the user.
- I don't think your code is ugly.
I have heard of mptt, but I had never used it before. I am intending to integrate mptt into the commenting system, before long. [0]
> A one liner query is just called a queryset.
Did I call it a query somewhere?
> To get all the "upvotes" of an user it's better to start from the user.
So rather than:
request.user in comment.upvotes.all()
I would do: comment in request.user.upvoted_comments
where upvoted_comments is the related_name for upvotes on the Comment model: upvotes = models.ManyToManyField(User, blank=True, null=True, related_name='upvoted_comments')
> I don't think your code is ugly.Thanks, that's encouraging. I was embarassed by my single 1000-line views.py file.
[0] - Issue 38: https://github.com/ehmatthes/educator_news/issues/38
First time using mptt might not be straightforward. But I think it's worth because the problem is "difficult". Similarly django-polymorphic. Those are the two things in Django I would think hard before re-writring.
> one-liner ~ queryset
I don't find the particular comment right now.
> To get all the "upvotes" of an user it's better to start from the user.
I don't know the correct queryset, the one you provide seems good. Don't compute in Python what you can do in the db. In the particular code I'm referring to, several queries were done against the db instead of one.
> 1000-line is ugly
yeah, kind of. But at least you don't use abbreviations. Or 2 spaces for indentation. Seems like valid pep8.
I don't say that there are no mistakes in the code, just skimmed over it.
The file is big because some of the functions are not views.
- get_submission_age: should be template tag cf. https://docs.djangoproject.com/en/dev/howto/custom-template-...
- get_submission_set: I wouldn't use such a function. For sure you are iterating two times over the list of submissions, one time in the view, one time in the template so it's a "2n" so O(n) complexity. It's ok but only one iteration over the list is required. But the django template language (DTL) makes it "hard" to do it... DTL was built around the idea that the template writer is stupid and probably also that nobody would read the code the template writer wrote before going into production.
CA is being hit with a drought, but we conserve enough water to not really worry about it.
My goal is to have enough raised bets and suitable seedling production/crop rotation to have at least 2 days/week of fruit/veggies from the garden between late april and September. Potatoes and a new raised bed were on tap. Seedlings already moving along nicely.
http://huherto.github.io/springyRecords/
A Record Mapper for Java that runs on top of spring-jdbc.