mysql – How to store multiple data types for same column (for many columns)

To preface, similar questions have been asked, but I have not found any that address a table that has a large number of columns affected by this issue. All the similar seem to address a table that has a small number of columns affected by this issue…

…but I have a MySQL database table that has many (e.g., 30) columns currently setup as the data type decimal(5,2).

Now, a new scenario has arisen where I need to enter a decimal(5,2) OR a char(2) (i.e., one or the other, but never both) for each of those 30 columns. To give you context, I am entering the quantity of elements detected in a sample and, if the quantity of an element is not detected, then I must be able to identify that an element was tested, but not detected, such as “ND”.

So, my initial thought was to change the change columns’ type to a varchar, in order for the columns to be able to store either a char(2) or decimal(5,2) value, but that seems be a dangerous path called Entity-Attribute_Value, which may require me to build the application layer more to accommodate the limitations caused by it.

So, I read chapter 6 of the book “SQL Antipatterns: Avoiding the Pitfalls of Database Programming” ( and several other related posts, and the two most common answers seem to be:

1. Use a design that is based on the type of query you want to perform.

In my case, I want to perform multiple types of queries that compare column values of different rows, determine averages, and possibly unforeseen more.

2. Use the Class Table Inheritance design.

I would like to implement the Class Table Inheritance design, but that would require many more tables to be created for each column. It seems like an overly complex solution, given the many columns that need only one of two types of data.

For example, if my understanding about Class Table Inheritance is correct, then for each of the 30 columns in my base table, I must create a single table for each subtype and make their primary key also serve as a foreign key to the base table, which means that I must create 60 tables. It seems excessive to create 60 tables in order to deal with 30 columns that might have one of two data types. Also, it seems that I would need to figure a way to manage those 30 pairs of tables so they refer to the same column, possibly in the application layer.

One possible solution that comes to mind before I end this post is: Use the Class Table Inheritance design, but instead of creating 30 pairs of tables for my two data types, create just 2 tables for the 2 data types and add a column that stores a value that relates each pair, such as the name of the base table column that they would relate to. But this does not seem like good practice either.

Any suggestions?

jquery – Limit numer of rows in data from json file

I would like to limit the number of songs to only the first 10 songs. Currently, it lists all songs played the last week.


            $(document).ready(function () { 

                // FETCHING DATA FROM JSON FILE 
                        function (data) { 
                    var song = ''; 

                    // ITERATING THROUGH OBJECTS 
                    $.each(data, function (key, value) { 

                        //CONSTRUCTION OF ROWS HAVING 
                        // DATA FROM JSON OBJECT 
                        song += '<tr>'; 
                        song += '<td>' +  
                   + '</td>'; 

                        song += '<td>' +  
                            value.artist + '</td>'; 

                        song += '</tr>'; 
                    //INSERTING ROWS INTO TABLE  

javascript – React Native FlatList with Scroll-To-load data

I am creating an application that interacts with spotify. A part of my app is a FlatList screen displaying a list of songs and song controls.
enter image description here

I am under the impression that my FlatList is very poorly optimized, leading to slow load times as you scroll down.

The main issue I want to resolve is this performance issue.

First, the authentication wrapper

import {
} from '_redux/features/authenticationSlice'
import authHandler from '_utils/authenticationHandler'

async function updateReduxWithValidAccessToken({
}) {
  if (accessToken === null || new Date() > new Date(accessExpiration)) {
    console.log('Access Token is Invalid, Refreshing...')
    console.log('refreshToken=', refreshToken)
    const response = await authHandler.refreshLogin(refreshToken)
    accessToken = response.accessToken
      accessExpiration: response.accessTokenExpirationDate,
      refreshToken: response.refreshToken,
  return accessToken

Next, the song fetching code. This lives within the component

  const (songs, setSongs) = useState(())
  const (songsToFetch, setSongsToFetch) = useState(100)
  const (page, setPage) = useState(0)

  const getSongsOfPlaylist = async (aToken, aPlaylist, aPage, aLimit) => {
    const response = await authHandler.get(
        offset: 100 * aPage,
        limit: aLimit,
          'total,items(track(preview_url, id, name, duration_ms, artists, album(!available_markets)))',
    if (response) {
      const remainingSongs = - songs.length -
      setSongsToFetch(Math.min(100, remainingSongs))

Then all the functions related to rendering the list:

  useEffect(() => {
    console.log('Loading page #', page)
      .then((token) => getSongsOfPlaylist(token, playlistID, page))
      .then(() => {
  }, (page))

  async function loadMore() {
    if (!loading && songsToFetch > 1) {
      setPage(page + 1)

  function renderFooter() {
    if (!loading) {
      return null
    return <ActivityIndicator animating />
  function renderSeparator() {
    return <SeparatorLine />

Finally, the flatlist code:

        keyExtractor={(_, index) => index.toString()}
        onEndReachedThreshold={0.1} />

All this code (except for the authentication wrapper) lives inside a wrapper component, PlaylistDetailScreen.

function PlaylistDetailScreen({ route, navigation, authentication, ...props }) {
  // All code above
  return loading && page === 0 ? (
    <MyText> Loading... </MyText>
  ) : (
      <MySongList />
    <ContainerView />

From my efforts, it appears that the list is rerendering multiple times. Why would this be?

Google Sheets formulas that needs to read data from drop down boxes

I am trying to create a master spreadsheet that is pulling information from several other sheets into this one master sheet.
I then plan on using this master sheet to pull statistics.
In the sign up sheets there are drop down boxes for Yes, No. My master sheet will pull all data except the Yes, No from the drop down boxes.

I can not figure out why!!

php – Adjusting a shortcode to use a custom fields data

On my WordPress website I use a shortcode in my functions.php that displays someone’s age based on their date of birth. The shortcode was taken from this blog post. This is the code:

function beliefmedia_determine_age($atts, $content = null) {
  extract( shortcode_atts( array(
    'dob' => '', /* See post for date formats */
    'date' => 0,
    'dateformat' => 'jS F Y' /* */
  ), $atts ) );
 if ($dob == '') $dob = $content;
 $age = ($content == null) ? floor((time() - strtotime($dob)) / 31556926) : floor((time() - strtotime($content)) / 31556926);
 return ($date) ? date($dateformat, strtotime($dob)) . ' (age: ' .  $age . ')' : $age;
add_shortcode('age', 'beliefmedia_determine_age');

It works fine, but I’m trying to edit it, so that the “$dob” is taken from an ACF “date picker” custom field, named “date_of_birth”.

From my research, I believe I need to use “get_field” somehow, but my very limited PHP knowledge is causing me to become stuck with how I incorporate this in to the shortcode above.

Any help would be massively appreciated.

Can a antivirus software detect a malware that steals data?

For example, consider a software that wants to package all txt files in the /user/Desktop directory and upload them to its own server. I am not a programmer. But I know it can be done very easily with codes. Maybe this can be done with a single line of code. Even a lot of well-known software can do this. Pdf viewer, media player etc.

It does’nt crash or slow down the pc. Only, scan txt files on Desktop and upload own servers! For example I have seen a lot of program that request outbounding internet connection on my Firewall Software. And these programs are well-known programs used by millions of people.

I’m guessing a antivirus does’nt block this process. Isn’t that very worrying for ordinary pc users? Many users don’t even know the Firewall.

Is there something I missed? Maybe I’m wrong and Antivirus or Windows OS can detect and block this easily.

Note: I don’t want suggestions such as use Linux or Open Source programs. I am not researching how to avoid this.

I just wonder if this process could be that easy?

file systems – Delete filesystem data associated with database record by delete hook, or internally in service logic?

Neither. Better would be not to use file system directly, but to allow database to handle the files as binary fields, or so called BLOBs.

  1. Transactions

File systems are not transactional. If you use transactions in your logic and some transaction fails, you can be sure that database has rolled back any changes you have done and you have exactly the state that you had before transactions. If you want to handle files separately, via hooks or via service logic, it can be very hard to provide transaction support, e.g. to implement roll back. For instance, at one step within transaction you delete a record and delete a file in the file system, then in several steps later the transaction fails. For rollback you would need to restore the files deleted within this transaction. This can be a hard task. If you store binary data in BLOB fields, you get transaction support for free, and will always have a consistent state.

  1. Backups

Database provide usually functionality to create backups and to restore the state from particular backup image. If you need backups, in case of file system you will need to implement your own tools to create and to restore backups so that database contents is consistent with files in file system. If you use BLOBs, you get it for free, database makes sure that you have consistent state at any time.

  1. Permissions

You can define different user roles with different permissions, e.g. one role allows user to read and modify data, other role allows only to read data, third role allows to read data but only from several tables, not from all available tables in database. If you use file system, it will be hard to implement such permission system. It will be hard to make sure that only users that have particular role have access to the files. If you use BLOBs, you get permission system for free.

security – Samsung Galaxy Note 10+ 5G – cellebrite mobile forensics data extractions – locked with pattern

I’ve got a locked Samsung Galaxy Note 10+ 5G (running the latest android 10 and patches)

The phone is locked with a pattern (unknown)

What are my chances of any data extraction with cellebrite or other forensics tools while I can not unlock the phone?

Also how secure is Knox efuse? will it damage the phone/data when an untrusted bootloader is detected?