Designing database relationships for a voting application

So I designed database relationships for a voting/polling application. I want a user to only be able to pick 1 option on a poll. I want multiple options per poll.

enter image description here

So what I have here is this.

User

  • has an id, username, email, password
  • the primary key is its id

Poll

  • has a title and an id
  • the primary key is its id

Option

  • has a text, and an id and holds a reference to the id of the poll that it belongs to
  • its primary key is its id PLUS the id of its parent poll

Vote

  • holds a reference to the id of the user that voted
  • holds a references to the selected option

So how does this look? I have set up these tables and I can insert records for polls, options and users but when I want to add a vote the options I get are not what I expected. I want to add a vote per poll where I can pick exactly 1 option.

This is my first time designing a database, any help would be great.

Designing anonymous registration website

I am developing a website where customers can register products they bought in order to receive a benefit in the form of e.g. a cashback, a discount or promotional goods. In the future, we also plan on developing more of these websites in the future.

The website includes the following several registration steps:

  • One of the steps gathers customer details, including what we need to provide the benefit (e.g. Address or IBAN number).
  • One of the steps gathers a proof of purchase, often in the form of a product code or receipt.

For each of these steps, validation is done to ensure that the data is legitimate input before continuing. At the end of the registration, there is a ‘register now’ kind of button to officially register.

I want to split the implementation between an API and a frontend. Now I want to make sure that the customer doesn’t bypass registration steps in the frontend (that include validation) and calls the final API call by itself to get the benefit without having bought the product.

I imagine this may be doable with some kind of session, or by keeping all data around and re-submit it in the final request and then validating it again in the backend. However, I am unsure which would be better, and if there is some option that I am missing which would be better than both.

For this question I want to focus on the web design aspect, so defending against forged purchase proofs is out of scope of this question.

Designing/ Using Icons for people over the age of 40

How does someone in the industry use the right icons and text together in order for age > 40 people to understand the functionality of the feature that they are clicking on. I have come up with a few small ideas where a button would have the text centred and the icons on top left corner small/medium sized but I am looking for more input or if there are any studies done for this?

Designing the API of a VMF (Variable Message Format) Parser

Variable Message Format (VMF) is covered by the MIL-STD-2045-47001 and MIL-STD-6017. The tl;dr for these standards and the format is, that it represents a message format, which contains variable length binary encoded fields or groups (a group is just a subfield, which can contain further fields and groups, which can also be nested. Each field(and group) can be present and or recurring, depending on the indicators, defined in the Standard. Following indicators exist:

  1. Field Presence Indicator (indicates, that a field is optional)
  2. Field Recurrance Indicator (indicates, that a field can occur more than once)
  3. Group Presence Indicator (same as field, but for groups)
  4. Group Recurrance Indicator (same as field, but for groups)

Fields can be binary encoded numbers, strings or geodetic fields (potentially more, but I left them out, because that’s not really the point). All the fields and groups can be found and retrieved by their field name, which is a string. Since I don’t want to hard code all of the message and header descriptions, my idea was to provide XML-Files, which can be consumed by the parser, like so:

// path is the Folder, where all Header and message desciptions // are located. VMFParser vmfParser = VMFParser.Initialize(path); 

Then, the parser can be used by consuming a byte array and the resulting message package contains the parsed header and a collection of messages, since VMF allows more than one payload per header:

byte[] bytes = //...byte array from some external source MessagePackage messagePackage = vmfParser.Parse(Bytes) 

So far so good. Now there are a couple of options in order to retrive the necessary data field from the message. Suppose the desired field is an integer, for example some reference number or ID and suppose the field is optional I might do something like this:

Message message = messagePackage.Messages[0]; int referenceNumber; message.TryGetNumber("REFERENCE NUMBER", out int referenceNumber); 

or I could do something like this:

Field<int> referenceNumberField = message.GetInteger("REFERENCE NUMBER"); if (referenceNumberField.IsPresent) {     int referenceNumber = referenceNumberField.Value; } 

The second option would allow me to provide the meta data of the field, like binary length or allowed values, but these could potentially be also retrieved from the parser by a method, if necessary.

So the question is, what would be the prefered way to retrieve data from a message, which is dynamically created and has fields that can be present or not?Has anyone had any expirience with something like that? Any thoughts and insight would be appreciated.

Designing a website based on Python programs outputs

I’m just after a bit of advice really. I have programmed a script in Python that downloads market data from an API, and then does various bits of analysis and spits out some tables and charts displaying this analysis. There are a couple of user inputs required such as time frame or market they want to analyse, but generally the script itself is quite straight forward.

My question is how to set up a website, and what would be required for users to basically be able to use my script, but via the website. I actually only want the script itself to run every 15 minutes say, to update the data, and then the user can decide what bits they want to look at.

I’m not after a full blown answer, more just guidance as to what would be required and any good tutorials if anyone knows of any, or even just the right thing to start googling, or a service that would be able to cater for this.

I have absolutely zero HTML/CSS knowledge, and a decent understanding of python. FWIW.

Many thanks

Approach to designing maintainable, yet informative, user notification messages

I am facing a design problem related to the design of the user notification messages to be used in a web application.

Just for the record, I am working in a JS environment and use a json structure to store user notification messages. However, I think the actual tech stack I use is of no importance here, since this is more of a high level software design problem.

I see two extremes between which I would like to take a middle way:

  1. Highly generic messages which do not offer great detail, but which make the design maintainable, clean, and uncluttered, as well as applicable for a wide variety of situations. As an example, think of creating a new book / user / car / etc. in an app. With this approach, the user notifications could be:
    • on success: “Entity created successfully”
    • on error: “Could not create entity”

VS.

  1. Highly informative and customised messages, but which make the design complex. Following the example above, we would need to have three messages for success and three for error:

    • on success: “Book created successfully” / “User created successfully” / “Car created successfully” / etc.
    • on error: “Could not create book” / “Could not create user” / “Could not create car” / etc.

    Furthermore, if entities are added / changed, new messages need to be added; or, even worse, if the success message for instance is changed, it needs to be changed for every entity (book / user / car / etc.). Adding to this i18n aspects, maintainability becomes problematic.

I could cobble together some JS string interpolation to make the solution a bit more flexible, but I’m not sure that is the best approach.

Of course, the examples are a bit trivial and contrived, but I think they illustrate what I’m trying to express. How can one approach this design problem?

Designing ‘Gandalf’ NPCs [on hold]

I’m designing an NPC that is meant to be a manager/mentor to the players. Contrary to the archetype I’ve just invoked by mentioning Gandalf, she isn’t some divine force incarnate-she’s just somewhat stronger and more experienced than the other players.

Since I’m new, how should I ‘design’ this NPC?
Do I write stats for her the same way I would a player?
If the players are starting out as level 1, what is an appropriate range of strength for her that while she can help the players against tougher threats, she also can’t hold back the tide by herself?

The NPC starts out as the person coordinating operations for the NGO the players are working for. She’s strong enough that local militaries need to account for neutralizing her in their tactical planning and politicians in their policy making. The players will eventually become strong enough to challenge her if the storyline goes in that direction.

Designing Validations Database driven configuration Vs hardcoding validations

So I am debating what approach to follow. My scenario is : Will receive a POJO which I need to validate ( REST end point ) Now I can explicitly validate specific fields ( which I know / are stated in requirements that they are mandatory ) OR should I define the fields in a db table and define which are mandatory vs not and then read this table one time and then based on what is configured in db drive my validations .

Would the second config driven approach be an overkill ? ( I guess the answer would be ‘depending’ on the number of times such scenarios can arise where we would need to change the rules of what is mandatory )

apologies if I am not making sense

What exactly does it mean to be designing within a grid?

I’m new to Sketch (app) and am looking to learn how to use the application. Currently, I’m designing a web application however I’m struggling to understand how one designs within the grid. For example, if in my application, I’d like to have a menu on the left-hand side and that appears outside of the grid suggested in Sketch, what does that mean?I’ve added an image if my question doesn’t make sense, I’m struggling to articulate this well. Thank you! Image for reference

Designing professional Website- How to for a beginner [on hold]

I am a beginner in website design, I only had experience with Github pages design, however, I am not satisfied with the imported templates design. I would like to do my own design and I dont know how I should start. I do prefer using opensource coding and not using wix or others ready templates.

I have this website as an example, I am astonished with it simple and high quality design:http://www.entagma.com/

I would like to have an advice from where I should start.