Tag Info

New answers tagged

0

I don't think the problem lies with where to store use activities but how you're planning to store them. If I've correctly read your comments, it seems like you could accomplish the same thing far more easily if you define a table for each type of activity. For instance when storing a record of purchased games, have tables for games, users, and ...


0

It seems to me like you are implementing something like event sourcing. In a typical event sourcing framework a class is serilized to text I.e json before it is appended to db. To answer your question. The user activities should be defined in code as a class.


2

You are suffering from a common problem among engineers: that of over-optimization in one frame. The two classical constraints of computation are time & space. They are generally opposed; you cannot conserve one without "spending" another. The Y2K bug was in fact an example of this. Space constraints made programmers "save" two digits in the year, ...


8

You are mixing serialize with compress. Can use XML serialzation to store a form or class. You can compress text and store it in a binary. You might get all of 7:1 compression. For that compression you lose the ability to search the text which is the primary purpose of a database.


4

Well for one it would make querying the db outside of your program quite a hassle. I don't think the slight gain is worth the time effort, and this includes support on the db later on. If your goal is quick look ups you are also adding overhead to searching. Sure if you have large blocks of text it might be more worth it but a better approach might be to ...


4

Whenever a database has multiple concurrent writers, there are potential race conditions. In particular, if each writer tries to add a new row, they may all choose the same primary key if they're just doing max(...)+1, and then all but one of the inserts will fail. When a database has an "auto increment" feature, they're not saving you the trouble of ...


1

Definitely take a look at Waterline.js. It has support for dozens of databases, including MySQL, PostgreSQL, MongoDB, and others. It exposes a uniform query interface that works across relational and non-relational ("nosql") databases Documentation: http://sailsjs.org/documentation/concepts/models-and-orm


8

Attempt to fetch the user record based on the username (but use LIKE instead of = so that case doesn't matter. Usernames should not be case sensitive. If you managed to fetch a user record (then the user exists) and you can compare the passwords to validate the login. About password security Store the passwords using a function like password_hash() so ...


2

Typically I'd just search the table for the record that contains the matching username. If that record doesn't exist the user doesn't exist so there is no need to go any further. If the record does exist that record would have the password hash on it for that user. Take the password given by the user, hash it in the same way, compare to the hash in your ...


1

Time on a date-only object is usually midnight. So if you add one to your ending day, you'll get the correct range; it will include the entire last day, up to midnight.


0

You can create a transaction log table with guids which stores the changes made and by whom and when (and on what table/entity if you choose to break it out). ex: logid|trantype|oldvalue|newvalue|datetime|user {guidxx1234}|update |{x=1, y=5}|{x=1, y=7}|yyyymmdd hh:mm|username or id {guidxx1235}|insert |{} |{x=45, y=7}|yyyymmdd hh:mm|username or id ...


0

Invertible Bloom filters, e.g., per this paper. The GNU Name System video from 30c3 has an intro. Server adds primary keys of records it has to a filter. Client sends server primary keys of records client has. Server removes those from filter. What remains are records to send to client. To cut down bandwidth used, you can store coarser timestamps. ...


0

Did you consider using some JSON-based noSQL database like MongoDB? It might perhaps fit your needs. And you obviously can put JSON text in some SQL relational database like PostgreSQL, MariaDB (or MySQL) or Sqlite Saving your persistent state as some PHP file is brittle, error-prone (beware of code injection), and probably not very efficient. Several ...


-1

If you ask for my opinion and my advice. Go with MySql because in the previous years I have built application using a JSON data structure but it has been very hard to maintain (it might also be my luck of knowledge). JSON is cool and simple. I admit !! But not as powerful as MySql. Go with MySql. MySql Vs JSON


2

If you want to go with the file approach and have mostly static and configuration data use SQLite (PHP entry): it is a RDBMS just like MySQL, but it is a local single file in a directory of your choice (it can even be in your application's folder), installation free, lightweight and can accomplish your data requirements with consistency and a lot of tested ...



Top 50 recent answers are included