HOME BLOG

Black – the code formatter

Posted on: May 25th, 2021 by Olu No Comments

Hi folks,

In this post I’ll talk about a very interesting tool called Black. Once upon a time, I was tasked with writing Python software with a few other developers. We came from different backgrounds and thus had very different styles of writing code. There was a broad mix of code writing styles and believe me, the code was a thing to behold. But we decided to just play along and let everyone be and allow “diversity” of code styles. It wasn’t very pretty but we lived with it.

Some months later I found myself reading through the codebase of a Python project and discovered a very interesting tool called Black. The software is described by its authors as The Uncompromising Code Formatter. Once I discovered what it does I realized that this is a tool that would have solved the problem I described earlier. Black formats Python code so that it looks neat consistent. That way, developers don’t have to bicker over poor code format. This also allows developers to focus more on content and less on formatting.

I highly recommend using Black as a code formatter if working on Python in a team setting. You can install Black from PyPi using pip. Click here to go to the project’s Github home page.

That’s all for now. Happy software development.

Yinkos Price Comparison 4.0 is launched

Posted on: April 15th, 2021 by Olu No Comments

Hi folks,

It’s a pleasure for us to announce an update to Yinkos Price Comparison App.

Yinkos Price Comparison 4.0 adds support for Morrisons in addition to Tesco, Sainsburys and ASDA.

This gives you more choices to compare grocery prices easily between major stores in the UK and save money.

Get it from Google Play today!

Let us know if you have any feedback or comments by visiting our website.

How to keep a docker container running

Posted on: March 22nd, 2021 by Olu No Comments

Hi folks,

Just a quick tip on how to keep a docker container running. Assuming you set up a docker container and you just want to do some inspections on the container before making it run its single long-running command, you may realize that the container will exit with exit code 0 if there is no “command” flag. How then do you keep the container alive without its intended long-running command?

You can do this by using a command like:

command: tail -f /dev/null

Then once you are through with your inspection you can remove that command and add the actual desired one.

That’s all for now. Till next time, happy software development.

Source:

command: tail -f /dev/null. stackoverflow. https://stackoverflow.com/questions/44884719/exited-with-code-0-docker

How to find files in a folder while excluding those in certain subfolders

Posted on: March 11th, 2021 by Olu No Comments

Hi folks,

Recently in the course of work I had to find lots of files in a certain folder while excluding files in certain subfolders. I had to do a bit of research on how to do this in Linux-like environments. So I thought I’ll share.

So, let’s assume that in the current directory there are subdirectories s1, s2, s3, etc., each containing .txt files. Now assume you want to recursively find all .txt files in the current directory, but exclude all those in s2 and s3 subdirectories.

Here’s a command you can use to accomplish this using the find command.

 

find . -name '*.txt' -not \( -path './sub2/*' -o -path './sub3/*' \)

 

Note that the -o means OR logic. The \( and \) allows us wrap multiple conditions together to form a compound condition and the -not means NOT logic. Also of interest is the -path flag which allows you to match a pattern in the path of a file.

That’s all for now. Till next time, happy software development.

Yinkos Price Comparison 3.0 is launched

Posted on: February 16th, 2021 by Olu No Comments

Hi folks,

It’s a pleasure for us to announce an update to Yinkos Price Comparison App.

Yinkos Price Comparison 3.0 adds support for ASDA in addition to Tesco and Sainsburys.

This gives you more choices to compare grocery prices easily between major stores in the UK and save money.

Get it from Google Play today!

Let us know if you have any feedback or comments by visiting our app website.

Tips for data modelling with MySQL Workbench

Posted on: February 6th, 2021 by Olu No Comments

Hi Folks,

In this post I’ll share  few tips when doing database modelling with MySQL Workbench.

If you need to create a table based on another, duplicate the old tables rather than creatiog the table from scratch. To do this. press Ctrl C, Ctrl V. Then update the table name.

Use separate multiple EER diagrams where appropriate. If working on a large database when multiple different concerns, consider using a separate EER diagram for each concern. Don’t shove all very many tables into a single EER diagram.

Double-check queries when synchronizing entity model with database. you will be surprised at some unexpected SQL you may occasionally find generated by MySQL Workbench. To avoid nasty surprises, always read through the SQL queries before applying them to your database.

Use MySQL Model tab to quickly view all tables in a MySQL Workbench file.

When copying tables, pay attention to autoincrement clause carried over from the old table, deleting it if necessary.

That’s all for now. Till next time, happy software development.

Yinkos Price Comparison 2.0 is launched

Posted on: November 26th, 2020 by Olu No Comments

Hi folks,

It’s a pleasure for us to announce an update to Yinkos Price Comparison App.

Yinkos Price Comparison 2.0 brings a few new features as follows:

  • We have added support for over 1,500 more devices.
  • Also, the design of the app was improved for display on tablets.
  • Other minor bug fixes and improvements were made as well.

This application allows you compare grocery prices easily between major stores in the UK.

Get it from Google Play today!

Let us know if you have any feedback or comments by visiting our website.

Yinkos Price Comparison is Launched!

Posted on: November 22nd, 2020 by Olu No Comments

Hi folks,

It’s a pleasure for us to announce the release of Yinkos Price Comparison App.

This application allows you compare grocery prices easily between major stores in the UK.

Initially we support Tesco and Sainsburys but we plan to quickly add support for other popular stores.

Get it from Google Play today!

Let us know if you have any feedback or comments by visiting our website.

How to inspect an Android app SQLite databases

Posted on: October 30th, 2020 by Olu No Comments

Hi folks,

In this post I talk about how to view an Android app’s SQLite database. You may need to do this for debugging purpose if develoing and Android app that stores data.

You can do this using Android Studio.

Go to View -> Tool Windows -> Device File Explorer.

In the Device File Explorer pane, navigate to dat/data/<your.app.package.name>/databases.

In here you should see three files for your database: one for the database, one for the -shm file and another for the -wal file. So if your database is called somedb in code, you would see files somedb-db, somedb-db-shm, somedb-db-wal. Cmd+click on all three files.

Then right-click and click Save As.

Select where to save them on your computer.

Once saved, you can open the main database on your computer using your favourite SQLite browser e.g. DB Browser for SQLite.

That’s all for now.

Happy software development.

 

 

How to import SQLite tables quickly

Posted on: October 24th, 2020 by Olu No Comments

Hi folks,

In this post I’ll sharemy recent experience with importing a large SQLite table. By large, I mean a table with very many rows.

Usually I use DB Browser for SQLite to manage the database.

So at first I thought, maybe I should use the export and import functionality from DB Browser for SQLite.

I exported to an SQL file, made my changes to the dump, and then tried importing that dump to a new database using DB Browser for SQLite.

Lo and behold, it was super duper slow. On realizing it would take forever, I decided there must be a faster way.

More research showed that there’s an SQLite command-line tool that can carry out imports. I learnt that it may be a good idea to export to CSV format, then import it using the SQLite command-line tool. To export to csv, use the following command:

 

sqlite3 -header -csv your_db.db "select * from your_table;" > your_csv_file.csv

 

To import a csv file use the following commands:

 

sqlite3 your_db_file.db
.mode csv
.import /path/to/your/csv_file.csv your_table_name

 

So I tried it. Boy, was it much faster.

So, the takeaway is that if you must export and later import large SQLite table, first export the database to a CSV file, and use the SQLite command-line utility to import the file(s) into a new database.

That’s all for now. Happy software development.