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.

garageband – Both logic and garage band doesn’t import audio file correctly

Today I tried to import mp3 file to logic, but it was weirdly speed up. I’ve tried both drag and drop AND cmnd+I, but it didn’t help. Later I tried to import the file to the logic through garage band, but the same problem occured- in garage band the file was in higher speed. Then, I tried to import in through adobe audition, but logic doesn’t want to read imported through audition file at all. No idea what to do.

entity component system – Modeling RTS game logic using ECS

So I’ve been trying to make a simple RTS engine for some time and I always hit a wall because of increasing, inflexible and complicated hierarchy trees. I’ve ultimately found out that an ECS is a good pattern in order to avoid such pitfalls.
For many scenarios I can envision how all things would be coupled, but there are some edge cases I can not manage to figure out.

Let’s say we have a simple ECS, which lets us add entities, add/remove components from entities and a system which queries for a set of components and updates all entities which have the respective components attached to themselves.

  • Scenario 1 – [Single-Player] Should the player be an entity?
    Having the player as an entity would mean having a system just for one entity that holds a PlayerComponent…

  • Scenario 2 – Tech tree and updates to tech trees?
    1. Tech tree cannot be an entity since you want buildings to have their own tech tree, so it must be a component then.
    2. Tech tree is a component, but then you want the player to be able to research a tech from a tree.
      So the UI must represent this action as an event which you send to a supposed TechSystem.
      In the end this means you iterate through all the entities which have TechTreeComponent, to get the one you need, instead of just updating directly through a reference or an ID.
      This could be solved by having a SelectionSystem which holds a state of selected items, but systems cannot have state…

I probably need a way to send a targeted event towards just one entity or inter-system communication, although the second one can get messy quite fast if I choose to add multithreading or priority to systems. If anyone can provide some pointers and how to optimize the architecture for such cases I would appreciate it.

logic – TWO STATEMENTS AND CONCLUSIONS ARE GIVEN WHICH OF THE FOLLOWING IS LOGICALLY CORRECT?

TWO STATEMENTS AND CONCLUSIONS ARE GIVEN WHICH OF THE FOLLOWING IS LOGICALLY CORRECT?

STATEMENT 1:ALL BACTERIA ARE MICRO ORGANISMS

STATEMENT 2:ALL PATHOGENS ARE MICROORGANISMS

CONCLUSION 1:SOME PATHOGENS ARE BACTERIA

CONCLUSION 2:ALL PATHOHENS ARE NOT BACTERIA

A:ONLY CONCLUSION 1 IS CORRECT

B:ONLY CONCLUSION 2 IS CORRECT

C:EITHER CONCLUSION 1 OR CONCLUSION 2 IS CORRECT

D:NEITHER CONCLUSION 1 NOR CONCLUSION 2 IS CORRECT

Controversial logic problem from brilliant. Misinterpreted logic or flawed question?

You are offered two cupcakes. One is poisoned and the other is safe to eat.

You happen to be in a village full of knights (who always tell the truth) and knaves (who always lie), but you can’t tell which is which by their appearance.

You ask one of them, “Which cupcake is safe to eat?” To this he makes the following two statements,

“If I were a knave, I’d say the one on the right.”
“But I’d say the one on the left, if I were a knight.”
Which cupcake is safe to eat?

Assumption: The person you ask knows which cupcake is which.

This problem appears on brilliant in the practice section (truth tellers and liars level 3 challenges) and it’s causing a bit of a heated discussion. The answer is supposedly the cupcake on the left. Is this question flawed or are people misinterpreting the logic?

architecture – Is implementing the logic of a singleplayer game in a dedicated server a viable option?

I want to start writing a singleplayer game and stumbled upon mature game server libraries in my preferred language. Since I am not a designer, I don’t know what’s possible in the future concerning visuals and having a dedicated server for game logic seems like a good idea at first, here are my thoughts on the topic:

Pros

  • there is a clear separation between game logic and graphics, which allows me to switch from 2D to 3D or even pick an other game engine without re-writing the important bits
  • I can add a multiplayer mode later on with fairly low effort if my plans change

Cons

  • sending messages is more complex than just calling methods, but can be hidden behind a facade
  • the communication can hurt performance, even if the server runs on the same machine

I am unsure about this approach, because I wasn’t able to find resources concerning dedicated servers for singleplayer games exclusively. Is it a viable choice or are there any other cons which outweigh the pros?

architecture – Is it a good idea to outsource game logic into dedicated servers for singleplayer games?

I want to start writing a singleplayer game and stumbled upon mature game server libraries in my preferred language. Since I am not a designer, I don’t know what’s possible in the future concerning visuals and having a dedicated server for game logic seems like a good idea at first, here are my thoughts on the topic:

Pros

  • there is a clear separation between game logic and graphics, which allows me to switch from 2D to 3D or even pick an other game engine without re-writing the important bits
  • I can add a multiplayer mode later on with fairly low effort if my plans change

Cons

  • sending messages is more complex than just calling methods, but can be hidden behind a facade
  • the communication can hurt performance, even if the server runs on the same machine

I am unsure about this approach, because wasn’t able to find resources concerning dedicated servers for singleplayer games exclusively and there is probably a good reason why not everybody is implementing their games like this. What am I missing there?

propositional logic – Converting to CNF – Distribution

I am still trying to get my head around what is valid CNF and how distribution works, I am not even sure if the examples I have tried to convert are correct for one, but I am also unsure of the rule for distribution and when I have looked at other posts here it seems so complicated and the actual rule does not seem to me to be obvious.

I think the correct process is:

  • Elimate Bi-Directionals
  • Eliminate Implications
  • Apply De Morgans Law
  • Apply Distributive Law

Clause One

A V B => C
-(A V B) V C -- Remove implication
(-A ^ -B) V C -- De Morgans Law
(-A V C) ^ (-B V C) -- Is this right? I am unsure of exactly how to distribute the or.

Clause Two

A ^ B => C
-(A ^ B) V C -- Eliminate Implication
(-A V -B) V C -- Is this now valid CNF or is there something more to do?

Clause Three

-A ^ -B => C
(A ^ B) V C -- Elimate Implication - Is this correct for a negated expression?
(A V C) ^ (B V C) -- Distribute OR - Is this correct?

I am not able to access the set of maths symbols for some reason so have used the notation in my course book.

I am currently taking a self taught course and have an exam in two weeks and I know there will conversion to CNF involved so I am trying to make sure I understand the steps now but I am still not entirely sure what is valid CNF.

The course material states it is a conjunction of disjunctions which I get, but then it seems to imply that: A V B V C V ..n is valid CNF?

logic – Gentzen Style Intuitionistic Sequent Proofs

I am trying to provide intuitionistic sequent proofs (Gentzen Style) for a few statements.

The rules that I have are rule of assumption, conjunction introduction and elimination, disjunction introduction and elimination, conditional introduction and elimination, double negation introduction, reductio ad absurdum, and ex falso.

In particular, we do not have double negation elimination since this is intuitionistic logic.

The rules above are given by Sider in his book Logic for Philosophy Section 2.4.

I am trying to prove the following statements within this logic.

$1. Rightarrow alpha rightarrow (neg alpha rightarrow beta)$

$2. neg neg (alpha land beta) Rightarrow neg neg alpha land neg neg beta$

$3. Rightarrow neg neg (neg neg alpha Rightarrow alpha)$

$4. neg neg (alpha rightarrow beta), neg neg alpha Rightarrow neg neg beta$

I only managed to prove the first statement $Rightarrow alpha rightarrow (neg alpha rightarrow beta)$ which is somewhat intuitive.

begin{align*}
&1. hspace{4mm} alpha Rightarrow alpha &&text{Rule of Assumption} \
&2. hspace{4mm} neg alpha Rightarrow neg alpha &&text{Rule of Assumption} \
&3. hspace{4mm} alpha, neg alpha Rightarrow alpha land neg alpha &&text{1,2, Conjunction Introduction} \
&4. hspace{4mm} alpha, neg alpha Rightarrow beta &&text{3, Ex Falso} \
&5. hspace{4mm} alpha Rightarrow neg alpha rightarrow beta &&text{4, Conditional Introduction} \
&6. hspace{4mm} Rightarrow alpha rightarrow (neg alpha rightarrow beta) &&text{5, Conditional Introduction} \
end{align*}

Note, formulas on the left of $Rightarrow$ are unordered. i.e. the left of $Rightarrow$ is a union of formulas.

I’m having trouble with the other three statements in the Gentzen style. And I cannot use any other metalangauge proof theorems that may simplify the derivations.

I tried looking at other resources, but almost every logic book does sequent proofs differently. Any help would be appreciated.