Für eine korrekte Lösung bis heute Abend biete ich 20 Euro.
Ach komm schon, das ist einfache Mathematik. Etwas Formularverarbeitung und ein paar Schleifen, das kriegst du hin (als vermeintlicher Anfänger) in 5 Stunden.
[URL="https://github.com/chrisandchris"]GitHub.com - ChrisAndChris[/URL] - [URL="https://github.com/chrisandchris/symfony-rowmapper"]RowMapper und QueryBuilder für MySQL-Datenbanken[/URL]
Wäre mir nicht so klar. Was ist das? Ein Einstellungstest? Das liest sich nämlich ein wenig als würde jemand die Spreu vom Weizen trennen wollen. Wenn z.B. bei 5. einfach nach einen Limit gefragt wäre, warum dann nicht implementieren und warum sollte das Probleme mit anderen Seiten geben? Entweder ist das Verunsicherungstaktik oder ein Hinweis doch ein wenig mehr nachzudenken.
Das ist eine solche Unsitte, ursprüngliche Frage hier rauszulöschen. Dabei sollte jeder Anfänger wissen, das Netz vergisst so gut wie nichts. Hier die ursprüngliche Frage:
Hallo,
kennt dafür jemand eine Lösung?
Introduction:
Throughout this task, we talk of so called „Numbuddies“ of a number X:
The Numbuddies of X are generated by looping from i=1 to i=X and taking numbers that satisfy the following conditions:
- If i is a multiply of 3, then the following number is one of X‘s Numbuddies:
i + i*X
- If i is a multiply of 5, then the following number is one of X‘s Numbuddies:
i + i*ROUND(SQRT(X)) + 1
- If i is a multiply of 3 and also a multiply 5, then the following number is one of X‘s Numbuddies:
i + i*3*5*ROUND(SQRT(X)) + 2
I.e. the number of Numbuddies of X is always smaller than or equal to X, so there is only a limited number of them.
Project:
Please implement a PHP-Project called numbuddies that works as described in the tasks below.
You also need to create tables for a MySQL database that can save the data required.
Please note that millions of users should be able to use this project at once. That’s why you have be careful when designing the database and the queries. Performance, efficiency and a clean and maintanable structure are top priorities here.
Needless to say, your code should also be clean and commented.
If anything is unclear or irritating, please ask yourself what the most reasonable interpretation would be and work according to it.
If you don’t manage to fully implement a function, implement the part you are able to implement instead of skipping the task.
In the following tasks, a user-login-system is assumed to be existing. To simplify the execution, please ignore this and just accept the user ID via GET (i.e. load page.php?uid=1).
1) Input Page (URL: numbuddies/user.php):
On this page, the user inserts a number X on a form. The number is saved in the
database. Also, its Numbuddies are computed here and saved in the database, so they
can be queried later.
2) Output Page (URL: /numbuddies/current.php):
This page displays all Numbuddies für the current X of the user. The current X of the
user is the number he inserted last on the input page above (Task 1).
Using next/previous buttons, on one page per X saved in the database for this user,
its Numbuddies are displayed. For navigation, there should be no page reload. I.e.
you only see the Numbuddies of one X at once.
For simplicity of the task, you can query all data at once instead of querying on each
button click, i.e. there is no need for dynamic loading using AJAX.
3) Deletion Page (URL: /numbuddies/cron.php):
This PHP-File is automatically called by a cron job already existing on the server. All you
need to do is to write this file with its only function called cron() that deletes all user
numbers data older than 30 days.
4) Check Page (URL: /numbuddies/check.php):
On this page, the user inserts a number X and a number Z. The output is only true if this
combination exists in the database for this user.
Alternatively, the user just specifies X. The output then is the number of Numbuddies
existing in the database for X and this user.
Theoretical question: If there is a hundred million X-entries in the database, should
you change anything on the table or not? Please list the reason(s), if any. In any
case, there will also be a large number of users in the database as well.
5) Theory: Extremely high values for X on the Input Page
Do you see a problem for the Input Page (1), if X is a very large number? In the case
of a problem, please describe your solution to it, without implementing it. I.e. you are
not required program here. Also, ignore problems with all other pages except the
Input Page.
Kommentar