HOME BLOG

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.

How to resolve error ‘The item you were attempting to purchase could not be found’ when testing subscriptions using Google Play Billing library

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

Hi foliks,

Here I share a simple solution to a issue found when testing subscriptions with Google Play Billing library:

The error message was as follows:

The item you were attempting to purchase could not be found.

The root cause is that that the test user had not been authorized to test the app.

Solution:

Make sure you send the opt-in url to test users and that the users opt in to it.

How to create table literals in Oracle

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

Hi folks,

In this post I talk about how to create literal tables in Oracle.

You may have a list of values and want to run an Oracle query against those values.

A convenient way to do this is to create a literal table in an Oracle SQL using those values.

 

Single-column

If you want to create a single-column literal table,

you can use either dbms_debug_vc2coll or sys.ODCIVarchar2List

e.g.

select * from table (sys.ODCIVarchar2List('AAA', 'BBB', 'CCC'));

This will return an inline table with a single column named COLUMN_VALUE and rows with values AAA, BBB and CCC.

i.e.

COLUMN_VALUE
==
AAA
BBB
CCC

Second example

select column_value from table(sys.dbms_debug_vc2coll(‘AAA’, ‘BBB’, ‘CCC’))

 

Multiple colums

If you want to generate a literal table with two columns, you can use a query like:

select objectschema m, objectname n
from
table(sys.ODCIObjectList(
sys.odciobject('APPLE', 'FRUIT'),
sys.odciobject('CARROT', 'VEGGIE')
));

For more tahan 2 columns, you can use a query like:

create type t as object (a varchar2(10), b varchar2(10), c number);
create type tt as table of t;

select * from table( tt (
    t('APPLE', 'FRUIT', 1),
    t('APPLE', 'FRUIT', 1122), 
    t('CARROT', 'VEGGIE', 3),
    t('PEACH', 'FRUIT', 104),
    t('CUCUMBER', 'VEGGIE', 5),
    t('ORANGE', 'FRUIT', 6) ) )

That’s all for now. Happy database querying.

 

Sources

Oracle SQL Tip: Using dbms_debug_vc2coll and sys.ODCIVarchar2List. https://training.fusionapplied.com/2017/08/23/oracle-sql-tip-using-dbms_debug_vc2coll-and-sys-odcivarchar2list/

Is there a non-ugly way to use a multi-column, multi-row table literal in an Oracle 11g query? https://stackoverflow.com/questions/29903397/is-there-a-non-ugly-way-to-use-a-multi-column-multi-row-table-literal-in-an-ora/29904128

How to request sensitive details in Python without displaying the input on the screen

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

Hi folks,

Here’s a short code snippet that demonstrates how to request sensitive information from a Python application without displaying the details on screen as the user enters it. The tool to use is a library called getpass as well as the subprocess library. Here it is.

 

import subprocess

info_process = subprocess.run([
'python', '-c', 
"print(import('getpass').getpass('Enter the details here'))"
], stdout=subprocess.PIPE)

details = info_process.stdout.decode('utf-8').strip()

That’s all for now. Happy coding