mysql – Anonymous and Public User Table Design in twitter like application

I have schema design problem which I am not 100% sure if my assumptions are correct.

So the requirements are:

  1. I need to have 2 different type of user, anonymous and public.
  2. A user can have both anonymous and public profile.
  3. A public and anonymous user can follow anonymous and public.
  4. Anonymous user and public user must not be identifiable by clients. Which means if I know public user I shouldn’t be able to fetch anonymous profile details vice versa.

I first come up with idea:

User (id, anon_id,public_id)
AnonymousUser(id(PK,FK),nickname)
PublicUser(id(PK,FK),nickname,fullname,phone,is_phone_registered)
RelationShip(id,follower_id(FK-User),following_id(FK-User))
Tweet(id, author_id(FK-User),text)

In this design I could split users into two. However, if we know the tweet’s author id we are not able to understand if it’s send by public or anonymous account. And also the same problem exist in Relationship too, we are not able to understand if follower/following is anonymous or public. The solution might be adding 2 more fields to Relation clarify follower/following type ie. follower_type/following_type and 1 more field to Tweet author_type.

Another solution which I felt more correct is

User(id(PK),nickname,fullname,phone,is_phone_registered,public)

In this design I can have both anonymous and public profiles in same table. And records would look like:

id nickname fullname phone is_phone_registered public
123 slayer John Doe +1 90 123 123 12 12 true NULL
312 vendetta NULL NULL false 123

And public field should not be visible to clients so I am pretty much achieving my goals on security side of things.

Sorry for my ignorance I am having NoSql background and in sql world I feel like I need achieve:

  1. Single responsibility in tables
  2. Get rid of a lot of redundant null’s
  3. Feels like self referencing column is an anti-pattern, which is public field is referencing to other rows id.

All suggestions are welcomed.

list manipulation – From index-based `Table` with different levels to `Map`-based operations?

Toy example:

ClearAll(f);
Module({
  a = RandomReal({}, {2, 3, 4, 5}),
  b = RandomReal({}, {2, 3, 4, 5})
  },
 Table(f( a((i, j)), b((i, j, k, l)) ), {i, 2}, {j, 3}, {k, 4}, {l, 5})
 )

How can it be translated into Map-based operations (e.g., MapThread) where vectorization may bring in better performance? Or index-based accesses just perform better here?


One may suggest using ConstantArray to copy data in a((i, j)) to level k, l so that MapThread could be used:

ClearAll(f);
Module({
  a = RandomReal({}, {2, 3, 4, 5}),
  b = RandomReal({}, {2, 3, 4, 5})
  },
 Table(f( a((i, j)), b((i, j, k, l)) ), {i, 2}, {j, 3}, {k, 4}, {l, 
    5}) ===
  MapThread(f, {
      Map(ConstantArray(#, {4, 5}) &, a, {2}),
      b
    }, 4
   )
 )

True

but I shall notice the fact that, in practice, data (at level j) may be too large for making copies to be efficient. I hope the solution can be generalized for more complicated f.

performance – SQL vs NoSQL for a table with millions insert per day

Currently, I have a project using MySQL. I need to create a new table that will insert millions data every day. The select query usage is quite rare(maybe about 5 times fetch/select per day), but most of the columns is needed for filtering and ordering, so I can’t save compressed data. I need to minimize storage usage for that table. The performance is slightly slower is no problem(but if significant maybe I will consider it).

The table consists of about 12 columns, 3 columns are datetime, 2 columns are biginterger, and other are string. Each string column value is about 5-50 char length. maybe average will be 15 chars.

Which is better for my needs, still use MySQL table or use NoSQL like MongoDB?

As far as I know, NoSQL consume a lot of space because of denormalized column, but I think in my case it’s not a problem, because I just need a single table. Am I really need NoSQL?

sql – #1932 – Table ‘…’ doesn’t exist in engine / Erro ao restaurar tabela em novo servidor MySQL

Olá, bom dia.

Meu Xampp estava com um erro de não querer iniciar o servidor do MySQL, então eu salvei o banco de dados (a pasta) e instalei a versão mais recente. Esse erro sumiu, porém agora da erro no banco de dados, vi que eu precisava pegar o arquivo ibdata1 do antigo servidor e colocar agora na nova pasta do xampp, porém não tenho mais esse arquivo.

Será que tem algum jeito de recuperar esse banco de dados e essas tabelas?

info visualisation – Benefits of displaying information in a grid of cards over a table list?

There are well-established patterns for the usage of tables to display information versus using cards. As you mentioned before, it can be helpful to display pictures or graphical information in a grid of card but there are also trade-offs.

In general, the benefits of displaying information in a grid of cards is based on the convenience of this implementation approach, mainly that for small number of content that don’t need to be sorted or compared, the grid layout is a compact way to encapsulate different bits of information into a card.

For large amount of data, the convenience and efficiency of using grid layout and card components is largely lost because of the additional requirements of needing to sort, compare and find information much more efficiently will be difficult within the constraints of grid layout and card components.

What are the benefits of displaying information in a grid of cards rather than a table list?

I can appreciate that using a grid of cards is useful when you have pictures or graphical information to display. However, are there any other pros/cons of using one over the other to display a large amount of data?

google sheets – How to split imported table data from web page to Headers in first row, and linked data in second row

When I use =transpose(concatenate(IMPORTXML(A1,F21))) all the table data headers & data) is imported into one cell. Note: A1 is url :https://wallmine.com/asx/a2m, and F21 is xPath: //div(@data-controller=’companies–properties’). How do I transpose this imported table data in cell C8, into two seperate rows:
(A) Headers into row 1, across columns for the length of the data,
(B) Linked data into row 2 across columns for the length of the data.

I tried to transpose header row and data for one stock using the following formula:
=query(importxml(concatenate(“https:/wallmine.com/asx/a2m”,”//div(@data-controller=’companies–properties’)”),”//td/tr(1)”),”Select Col1, Col2, Col3, Col4, Col 5, Col 6 LIMIT 1″), but it displays N/a, “Could not fetch URL: https:/wallmine.com/asx/a2m//div(@data-controller=’companies–properties’)”.

I also attempted to get only the data row using: =transpose(importxml(concatenate(“https:/wallmine.com/asx/”&A2&”/’companies-properties'”),”//tr//td(2)”)). But received the same error. note cell a2 has the ticker a2m. Both these two above attempts appear to start loading the data, then fails with the error. So what am I doing wrong here ?

I have also used the following function on the combined table data in cell C8=split(flatten(C8),” ,”), it places the headers and data in one row, but headers are placed in multiple columns in error, where a header has a space between header names. (ie Market cap has Market displayed in Col1 and cap in Col2. So this does not help me either.

Screen print of merged table date in cell C8, and list of data wanted: ie 6 columns by 21 rows.

(!(Screen print of google sheet)(1))(1)
(1): https://i.stack.imgur.com/VkWE6.jpg

data structures – Resources about implementing a database table

I’d like to understand more how data can be stored on disk so it can be read quickly. I don’t want to say database record because I’m not asking how to build a database. My question is closer to how would I build a table.

I’m not asking about indexing. I’m thinking about you have an application that already has some a pointer to a record.

I’ve been trying to find some references e.g. papers, books, but everything so far focuses on database design as in writing DDL or structures for indexing like B+ trees.

Are there any references that talk about how tables are actually implemented and what are the tradeoffs?

google sheets – Googlesheets pivot table won’t show totals for more than one Row item

I’ve got Totals checked or both Common Name and for Pot Description. Why won’t more than one display? If I move Pot description up, it will total then Common Name won’t.

If I untick Common Name totals, there is still no total.

If I delete Common Name, I still don’t get totals.

What am I missing?

screenshot 1

Guideline for converting a pivot table to a query in google sheets?

I’m running into limitations as to what a pivot table can do.

Is there a ready guideline for converting a pivot table to a query?

Alternately a set of examples might do.