Categories
Database Development

How to get MAX numeric value from a column with char values in MySql

I would like to know how can I get the max value only within the numeric values in a column with char values in a MySql database: Supposing the column is as follows: col ——— ALL USD USD RET RET ACC ACC ALL ALL ERR ERR PRO PRO 1 1 2 2 3 3 4 […]

Categories
Database Development

What is the difference between PAGEIOLATCH_* and IO_COMPLETION?

according to this blog: SQL Server Books online defines IO_COMPLETION as “Occurs while waiting for I/O operations to complete. This wait type generally represents non-data page I/Os. Data page I/O completion waits appear as PAGEIOLATCH_ waits”* What do non-data page IOs mean? or we can put the question in other way: What does actually “…waiting […]

Categories
Database Development

I’m working with a developmental psql DB in django and I’d like to completely reset the database to an empty state

I’d like to essentially ‘reset’ my psql database to an empty state, no tables remaining or anything, I’m running Ubuntu. I can’t fi

Categories
Database Development

Postgres: create function with a parameter, which will become the part of IN (1, 2, 3) clause

Following is the part of function declaration. Unfortunately it doesn’t work the way I would like it to. CREATE FUNCTION my_cool_func(some_parameter INTEGER, some_other_parameter INTEGER[]) RETURNS BOOLEAN LANGUAGE ‘plpgsql’ STABLE AS $BODY$ DECLARE count_entries INTEGER; BEGIN SELECT COUNT(some_table.id) INTO count_entries FROM some_table WHERE … AND some_table.some_integer_field IN (some_other_parameter); IF (count_entries > 0) THEN… some_other_parameter is a […]

Categories
Database Development

Is my database secure? / What does “=Tc/postgres” allow?

Given the following… iproductiondb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres + | | | | | postgres=CTc/postgres + | | | | | iproduction=CTc/postgres Are the postgres and iproduction roles the only roles that have any type of access to iproductiondb ? =Tc/postgres is making me wonder if I need to […]

Categories
Database Development

generating all substrings (n-grams) for bit-strings

I followed SELECT all substrings (n-grams) of length n? to get a function for generating all n-grams for text types. Works great. I figured out how to cast my bit-strings to text, and the function from that link works. However I need it to be as fast as possible, thus I wanted a bit-string native […]

Categories
Database Development

count from another table

I have a problem that I cannot count from another table. In my code I want to count tb_pegawai.id. My code is here but the count is wrong: SELECT tb_pasar.nama_pasar, COUNT(tb_pegawai.id) FROM `tb_pasar` LEFT JOIN tb_pegawai ON tb_pasar.id=tb_pegawai.id_pasar LEFT JOIN tb_pesanan ON tb_pasar.id=tb_pesanan.id_pasar AND tb_pegawai.id=tb_pesanan.id_pegawai GROUP BY tb_pasar.id and the table is below: [

Categories
Ask Engineering

MOSFET full H bridge, voltage spike protection

Preface, I’m a hobbyist not a electrical engineer, so please be gentle. I was looking for a better than l298N motor control solution for higher currents and one that is similar price and size, but couldn’t find one. I searched the web for h bridge schematics to copy and make a PCB for my projects. […]

Categories
Ask Engineering

Power On Tracking Integrated Circuit, ON Time Odometer

How would I realize a I2C/SPI device capable of tracking how long power has been applied over the lifetime of the device? Ideally this would be a 8 pin (or less) SMT part costing around a couple dollars. It would be non-volatile (obviously), read-only to external devices and track hours ON through daily power cycling. […]

Categories
Linux Mastering Development

Improving GPU performance

running nvidia-smi gave me the following: The Xorg, is it necessary or can I kill it speed up my GPU. Because I am running tensor flow codes which take up lot of memory. How can I check whether there is any option of fan, like the ones present in Acer-Predator which increases the performance of […]