A Russian proverb I read on a programming blog:
"Не боги горшки обжигают"
As explained in Wikipedia:
All artificial objects in the world, no matter how minute or astonishing, were made by people, so do not get overexcited.
I've been learning Elixir
for the past couple of weeks and it has been great refreshing fun.
Solving exercises on Exercism has been helpful to start learning various patterns, both from building my own solutions and from seeing how more experienced people implement them.
I wonder whether a language will ever exist that has good, in-built support for datetime objects.
So here's the latest gem I discovered in util.Date
:
So basically getYear() returns 116 for this year (2016). I don't know who would use it today, or why it was ever built like that, or what sort of backwards compatibility demon forces us to keep it there.
D:
Apparently people these days use things like Joda.
No password provided? I assume I just need to hit the gong.
I'm packing Mei-Xiu today to send to its next host, Päivi Suomela. I'm really looking forward to seeing her next adventures :)
Follow the rest of her trip on the microworld tour website!
Streams by this user that have been favorited by others.
No favorited streams yet.
I wish Spotify had some way for users to go into "sneaky" mode, listening to things for a few days that won't affect their future recommendations.
This kind of already happens if you listen to random things in short bursts (eg your recommendations won't change if your niece comes over and wants to listen to Justin Bieber for a couple of hours), but it would be nice to have an explicit way of turning off tracking in a similar way that you can turn off public activity.
Two articles about running small businesses and ignoring the "disrupt the X industry" trend of the start-up world:
A Russian proverb I read on a programming blog:
"Не боги горшки обжигают"
As explained in Wikipedia:
All artificial objects in the world, no matter how minute or astonishing, were made by people, so do not get overexcited.
Recently I've been spending the time before bed watching old Russian animations.
I'm not quite sure what sort of creature Чебурашка is yet, but this song from Крокодил Гена is now stuck in my head :)
I've been learning Elixir
for the past couple of weeks and it has been great refreshing fun.
Solving exercises on Exercism has been helpful to start learning various patterns, both from building my own solutions and from seeing how more experienced people implement them.
When working with an ORM it is often easy to forget that whatever you write is ultimately translated to SQL queries.
Consider this script:
bookings = task.contractor.bookings.all()
task.delete()
bookings.delete()
This will run with no errors.
As you would expecttask
will be deleted, however the bookings
will persist in the db! What's going on?
The code above will result in 2 SQL queries:
As the task is deleted in the 1st query, then the 2nd query will yield no results (as the specific task id will no longer exist).
For this to work we just need to reverse the order of operations:
bookings = task.contractor.bookings.all()
bookings.delete()
task.delete()
Opbeat is undeniably awesome. It logs all the things, it provides useful traces, and it often let's you know things are broken before your users even start suspecting anything.
When using it with Django
it's generally very helpful, logging all unhandled exceptions and allowing you to add nice extra context to your logs, like request information (URL and header data for the request etc).
There are some situations however where the request object might not be available, for example when manually logging something quite deep in the stack (away from the view).
In those cases the request information might still be very important for debugging when things go wrong!
Googling for solutions didn't help much, but looking in opbeat's python code I stumbled upon OpbeatLogMiddleware
. I was unable to find it documented anywhere. The installation instructions recommend enabling only OpbeatAPMMiddleware
.
After having a play with enabling it and trying things out, it turns out it does exactly what we need.
How to?
To enable request logging away from the view/for manual logging further down the stack you just need to change your setup to:
MIDDLEWARE_CLASSES = (
'opbeat.contrib.django.middleware.OpbeatAPMMiddleware',
'opbeat.contrib.django.middleware.OpbeatLogMiddleware',
# ...
)
and you're good to go!
The way this works is, the middleware will store the current request to the local thread. The log handler will then try to grab it from there when possible and append it to the captured data.
This 3 part movie is one of the most classic comedies of the soviet era.
It was really nice for a beginner like me, as it has very little and simple dialog and very simple story.
Even though it's pretty light in terms of meanings and is primarily slapstick-humour based, it still introduced me to a few new cultural things. Many lines from the movie have turned into long-used expressions, still alive in modern Russian culture (ex Ну, граждане алкоголики, хулиганы, тунеядцы… Кто хочет сегодня поработать?
).
Overall a very entertaining film, with small bits of un-PC gags that were still pretty common in the 60s (championed by a blackface "wild indigenous african" chase scene in part 1). More offensive things I learned: the кукиш gesture, which is apparently used in some parts of Greece too (though I never really encountered it!).
There are now at least 4 monuments of Шурик и Лида as a tribute to the second part of the movie,Наваждение
, the latest one only just unveiled in 2015.
There is now a joint Russian stream?! Amazing, I really like this about thoughtstreams.
I like Dave
's approach on learning and I feel I could probably do this with a language closer to the ones I know (latin/germanic based...) but it seems significantly harder with Russian.
But the method is still very valid. I think my English level basically went from basic to pretty much fluent within a single summer of playing LucasArts games and similar adventure games.
It might be a good idea to look for something similar in Russian. Games can be a very immersive medium, your brain tends to work using the context of the game world and digesting the language seems like one more component of that world.
I wonder whether a language will ever exist that has good, in-built support for datetime objects.
So here's the latest gem I discovered in util.Date
:
So basically getYear() returns 116 for this year (2016). I don't know who would use it today, or why it was ever built like that, or what sort of backwards compatibility demon forces us to keep it there.
D:
Apparently people these days use things like Joda.
I opened a discussion in duolingo about usage of these words - they both mean "child"
but they don't seem to be used in equal ways.
According to Alex, дитя is probably used mostly for a young child, while ребёнок is used for older children.
Generally people appear to be using ребёнок in singular form, as in 1 child, and дети in plural form (the stem changes a bit), as in many children.
According to user vadimfowler:
There is a number of expressions where "дитя" is used in singular: "моё дитя" is an ironic way to refer to a child, since it is a neuter gender used for a human; "чем бы дитя не тешилось..." - a common reproach to a person passionately doing something useless.
Some pretty useful real-life usage there ;)
So after the 3 introductory lessons, studying some more and doing some programming too, my brain was officially completely toasted for the day.
All 3 teachers were interesting and friendly. I couldn't decide between the 2 of them, so I decided to not choose and just do lessons with both.
One of them had a very "expressive" approach, using a lot of hand gestures, clear repetitive speaking, and we went straight into picture games and other activities.
The other mostly presented me with the methods we'll be using, which was also very interesting and warned me that we will only speak in Russian from now on :)
Generally I think speaking only in Russian is great, and it might eventually force me to start thinking in the new ways required instead of "word-to-word" translations.
I'm now scheduling more classes and looking at some of the tools I was presented:
I have memorised a few hundreds of words and know some basic verbs and grammar, but I still can't really speak any Russian :(
So I discovered italki.com, a site where you can find teachers for online lessons (through Skype or Google Hangouts) and a community of people from around the globe. You don't have to hire a teacher, actually you can just find someone who speaks the language you are trying to learn and in return speak your own native language with people who are trying to learn it in an "exchange" model.
Sounds like a great concept! I'm not very confident with even very basic Russian conversations, so I decided to do some speaking lessons first, before I go into such an arrangement.
There is a torrent of people teaching the "primary" languages on the site, and I must have spent about 2 hours of looking through profiles before I could find a handful that I was happy with and that had convenient schedules. Time difference is important - some people live in China, some in Kazakstan, some in the Caribbean...
HOW TO CHOOSE???
I arranged an introductory 30min session with 3 different tutors for just around £10 (or 100 ITC in the site's credit system) which sounds like a good price. Let's see how this works out :)
In the beginning, I was very frustrated with Russian in Duolingo. It looked like they were teaching everything using latin characters! Remembering this hybrid spelling of things was pretty hard, and frankly felt like I was missing out on learning to really read and write.
For some reason though, in the mobile app, everything appeared in cyrillic - wat?
Then I noticed the switch at the far corner of the container
Hmmm... click.
Genius!
Just in case my schedule wasn't too full, I've been back to learning Russian for the past month or so.
Last time I was hoping to manage to arrange regular study sessions with my partner, who speaks Russian as a native language, but this proved to be a little hard, as it required quite a lot of coordination, and sometimes you're just not in mood to spend your little time together going through grammar...
So this time I've gone back to my self-study tools. I have a decent book, although I'm not using it in a very strict pace so far and I am using the amazing flashcard tool Anki.
Anki gives you the impression that it was designed by programmers, and that's probably true. However it is very powerful, you can customise your cards and study sessions to a great extend - once you find which way/study method works for you it removes a lot of boilerplate work from your study sessions.
I've been using flashcards that translate back to my native language, Greek, as I find that in many cases (particularly in more complex phrases with verb tenses and noun cases), it helps me understand the structure of the language better.
Finally, since my last attempt, Russian has been released to beta on Duolingo. Go try it!
До скорого!
Sometimes deciding whether to use fragments vs activities and their infinite combinations for layout and navigation feels really daunting.
Things get even more complex when you want to support different layouts based on screen size/orientation.
This guide, which is similar to the official documentation, was particularly useful for using combinations of activities and fragments.
There are, however, people who advocate against using fragements, and it's also very interesting to see what they have to say (in this example coming from the Square tech blog).
There are practical alternatives to using fragments all over the place, such as the Pankcakes library.
I wish Spotify had some way for users to go into "sneaky" mode, listening to things for a few days that won't affect their future recommendations.
This kind of already happens if you listen to random things in short bursts (eg your recommendations won't change if your niece comes over and wants to listen to Justin Bieber for a couple of hours), but it would be nice to have an explicit way of turning off tracking in a similar way that you can turn off public activity.
A simple technique, stolen from someone who stole this from Coding Horror who stole this from this comic.
A bit of a Java refresher, this is a thing that's actually fairly different from Python.
Even where logically in Python a variable would always be defined when it is accessed further down in the flow of your program, the Java compiler will not necessarily agree with you:
(this isn't just a code inspection thing, actually trying to compile this will report the same error).
This might be annoying in some cases but it makes sense the way that scopes work in Java:
foo
is declared and only lives inside the try
/except
/finally
blocks. It's a local variable
and therefor inaccessible anywhere else.
The solution would be to declare the variable outside of these blocks:
The function will the normally return "boom"
as the it's set in the finally
statement :)
No password provided? I assume I just need to hit the gong.
Looks like the place to end your night at:
Take a look around while enjoying your £1 beer and you might get a $2 mil reward for reporting drug warlords to the FBI.
I never thought I'd find myself buying one!
Coin-operated prayer machines, the future is now.
I definitely don't want to be another number...
Of course, there's also a drink to make you manly:
In case Hello Kitty Botox fails, this seems legit.
Some hotels had flowers and towels shaped as beautiful swans waiting for you in the middle of the bed.
Other hotels just know how to skip to the real priorities:
In case of failure, we also provide some buckets of paint to cover up everything you need.
Setting realistic expectations like a boss!
Thai massage could help you feel better after eating a heavy curry and both escape routes seem to be an option!
This is a collection of funnier and weirder things we found (amongst many other amazing things) while travelling in Thailand ;)
Turns out if you use Picasso to load images from URLs into your views it might silently not load them if you don't have internet permissions:
<uses-permission android:name="android.permission.INTERNET"/>
After learning a few (mostly web) frameworks over time, with Django powering most of my every day work in the past few years, and playing with iOS a few years back, I finally started spending some serious time learning Android.
I've been using a few resources, including Udacity's Android course targeted at non-beginners, and the great and constantly updated Android guide and reference at Commonsware.com.
Being used to understanding framework internals it's pretty hard going back into treating most of a (huge) framework as more or less a "black box". This is potentially unavoidable when you first start learning something, as you have to break it down into levels:
Udacity's program is interesting as they make you work on a side-project/assignment, as you're progressing through the course, which requires you to develop an app from scratch, given specific requirements (a simple movie recommendation app).
I'm currently working on that and it greatly frustrates me that I don't yet have a good picture of what the framework really does under the hood, but I'm positive that I'm learning quite a lot in the process!
To be continued :)
Thoughts by this user that have been liked by others.
When working with an ORM it is often easy to forget that whatever you write is ultimately translated to SQL queries.
Consider this script:
bookings = task.contractor.bookings.all()
task.delete()
bookings.delete()
This will run with no errors.
As you would expecttask
will be deleted, however the bookings
will persist in the db! What's going on?
The code above will result in 2 SQL queries:
As the task is deleted in the 1st query, then the 2nd query will yield no results (as the specific task id will no longer exist).
For this to work we just need to reverse the order of operations:
bookings = task.contractor.bookings.all()
bookings.delete()
task.delete()
Recently I've been spending the time before bed watching old Russian animations.
I'm not quite sure what sort of creature Чебурашка is yet, but this song from Крокодил Гена is now stuck in my head :)