About 247AppsStudio


How to Return JSON Encoded Response for a non-dict object

In DJango, an HttpResponse sub-class helps to create a JSON-encoded response. It was called Serialized-Object response in Django < 1.7. Its default Content-Type header is set to application/JSON. The first parameter (data set), should be a dict instance. If non-dict object is passed in as the first parameter, a TypeError will be raised. To fix this error, we just need to add a parameter called “safe” to False in the method call JsonResponse. TypeError: In order to allow non-dict objects to be serialized set the…

Continue reading »

PHP TDD (Test Driven Development)

Nowadays almost all back-end developers are familiar with TDD. It has much more upsides and very little downsides once the actual classes and the test are in place. If you are just experimenting with your code and do not need it for a longer term, you may not need TDD in that case. TDD is actually essential if you want to maintain your code base for a long time. So what does the Test Driven Development consist of? Well, there is the unit test that…

Continue reading »

Error related to only_full_group_by when executing a query in MySql

I upgraded my system from MySQL 5.4 to 5.7.17 with PHP for a web application I’m working on. I have a query that is dynamically created, and when run in older versions of MySql it works fine. Since upgrading to 5.7.17 I get this error: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘xxx.tablenamehere’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by This is my query: So I tried to…

Continue reading »