Ankith Reddy has Published 996 Articles

Python Low-level threading API

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:24

646 Views

The '_thread' module in Python library provides a low-level interface for working with light-weight processes having multiple threads sharing a global data space. For synchronization, simple locks (also called mutexes or binary semaphores) are defined in this module. The 'threading' built-in module provides a higher-level threading API built on top ... Read More

How to find the MySQL data directory from command line in Windows?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:24

3K+ Views

To find the MySQL data directory, we can simply use the variable datadir. Let us see how to use the variable with select statement.The query is as follows −mysql> select @@datadir;Here is the output+---------------------------------------------+ | @@datadir ... Read More

Python Binary Data Services

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:24

409 Views

Provisions of the struct module in the Python library are useful in performing conversions between C type structs and Python bytes objects. This can be achieved by module level functions as well as Struct class and its methods as defined in the struct module.The conversion functions use a format string. ... Read More

Get the first and last date of next month in MySQL?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:24

1K+ Views

You can get the first and last date of next month using date_add() function from MySQL.The syntax is as follows -select date_sub(    last_day(       date_add(now(), interval anyIntervalTime)    ),    interval day(       last_day(          date_add(now(), interval anyIntervalTime)       ) ... Read More

Finding modules used by a Python script (modulefinder)

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:24

1K+ Views

The ModuleFinder class in 'modulefinder' module can determine set of modules imported by a certain script. This module has a command line interface as well as programmatic interface.For demonstration of functionality, use following script#modfinder.py import hello try: import trianglebrowser import nomodule, mymodule except ImportError: ... Read More

Is there a way in MySQL to reverse a boolean field with a single query?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:24

1K+ Views

Yes, you can use if() function from MySQL to reverse a boolean field. The syntax is as follows −UPDATE yourTableName SET yourBooleanColumnName = IF(yourBooleanColumnName, 0, 1);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table ReverseBooleanField    -> ... Read More

How to quote values using MySQL group_concat?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:24

1K+ Views

You can quote values using concat() and grop_concat() function from MySQL. The syntax is as follows −SELECT GROUP_CONCAT(CONCAT(' '' ', yourColumnName, ' '' ' )) as anyVariableName from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table ... Read More

MySQL Query a List of Values?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:24

6K+ Views

To query a list of values, you can use IN operator. The syntax is as follows −SELECT * FROM yourTableName WHERE yourColumnName IN(Value1, Value2, ...N) ORDER BY FIELD(yourColumnName, Value1, Value2, ...N);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> ... Read More

How can I simulate an array variable in MySQL?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:24

2K+ Views

Instead of simulating an array variable, use temporary table in MySQL. The syntax is as follows −create temporary table if not exists yourTemporaryTableName select yourColumnName1, yourColumnName2, ......N from yourTableName where conditionTo understand the above syntax, let us first create a table. The query to create a table is as follows ... Read More

How to get ER model of database from server with MySQL Workbench?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:24

408 Views

To get ER model of database from server, you need to first launch MySQL Workbench. The snapshot is as follows −After that you need to select the “Database” menu −Database->Reverse EngineerAfter that a wizard will open as in the following screenshot. Add the password and press OK twice.After pressing the ... Read More

Advertisements