Jump to content

RuleBritannia

Members
  • Posts

    92
  • Joined

  • Last visited

RuleBritannia's Achievements

Member

Member (2/5)

0

Reputation

  1. So using the factory pattern, does this allow resource sharing? As for autoloading and including I should not of mixed them throughout this thread, but what I was trying to say is if I had a file with the following code db.php $db = new PDO('... If I include this everywhere a db instance is needed, how is this different to calling a factory pattern class(Which creates or reuses a instance)? Arnt either of these methods using a new created instance at the begining and resuing a instance if called anytime after?
  2. I should of been more specific, If I instantiate a class(lets say connection) and store it in a variable, then include this everywhere needed and pass around in constructors, why would I need a factory? As for the term reuse meaning in a code reuse context, I dont believe that is how it was meant, I am sure I have seen on many occasions people saying "you dont want to be creating a new connection, you reuse a database connection already opened." The problem I have here is understanding how if we use factory or autoload, each one instansiate's lets say a connection(with new), how is this reusing a connection?
  3. Hello I hear alot of talk about reusing a database connection and attempts to solve this. I came across this post on stackoverflow but am having difficulty understanding as to how this is any different than just creating a instance in a single file and including it via include, require or autoload wherever a db instance is needed. The pattern talked about in the post is the factory pattern, it seems that the factory is responsible for creating the instance, something which I thought autoloading did without this additional code? Another thing I am still confused by with all the reuse talk - If 2 seperate users request 2 different pages on our server(2nd user 0.1 second behind the other user) which both refer back to the same db file/factory, are 2 instances created? or is the previuos users instance somehow used aslong as there request has not finished? I thought that the server would make new fresh requests/variables/instantiation etc all over again for every user, perhaps I am wrong. Thanks in advance.
  4. I assumed something like this, Thanks for your input guys, I will give it a shot either way and post back my results.
  5. I voted notepad++, Although I should really be moving onto some type of IDE I believe, Or so im told.
  6. Hello I wondered if anybody here had any hands on experience with removing some components from there laptops? One componenet im specifically interested in is the mic. With this being said, Im also aware of removing the drivers and so on to render the componenet "unavailable", but this is not my concern. I also mentioned laptops as the circuitry could be different to a desktop, Due to the size constraints I am wondering whether alot of the components are wired in a way that removing one can cause big problems elsewhere. Thanks for any insight/help in advance.
  7. When you want to share your method of how you obtain spontaneous unlimited computational power please PM ME @kicken I think your idea is suffiicient,.
  8. They most likley will not have thousands of errors, But its not impossible. @that you don't want these things to be processed, but rather rejected at input. They will not be rejected at input, Once they error, they will be moved to another table so they dont clutter the Image table whilst they are not possible to be processed. The project is also only for me. @help validate the input while the user is in the act of doing it so as to prevent as many 'rejections' as possible. This is not possible, That would mean processing thousands of rows at once. The current method is rows get put in the Image table, processed at a reasonable rate within a parallel limit, If there is some file meta/file corrupt/file type/libary error etc, This will never fix itself by just reattempting to process it, The only way of fixing this is manually checking/deleting/updating/etc the file or libary which processes it. @Do you really want to be reviewing dozens(?) of errors every day? This is irrelevant to wherever/however they are handled/placed. Also its worth mentioning as I said before, I cannot foresee every possible "error", the plan is to reduce as many as possible, And each time a error does surface, I examine it and update the script to rule it out if possible before processing, But sometimes this is not possible without processing.
  9. hmm, But we can be inserting thousands of rows here daily, Not sure if its a good idea to clutter it with potentially thousands of rows which at that current time cannot be processed. Im still thinking of the best option for this, Thanks for your input.
  10. When i say errors its not the best word, I mean it in a scenario that if we use for example a libary to process some data, if that libary does not have the capabilities for the image file type, we will move it to error/concern table, so we can deal with it later, rather that leaving it in the que, to be included again a the next loop iteration, or marking it as "problem" and cluttering the table, it seems best moved to error/concern table, as it is not possible to solve this with our current libaries.
  11. Processing error just within the script logic, eg image type not reconised, with regards to solving the problems, some problems I cannot foresee so it may not be possible to solve them, ontop of this the server must use its resources elsewhere, so we move the row to errors, and move on. I thought to have this column as a place I can consolidate all errors to, and check here every now and then to see any problems.
  12. There is a function in php called http://uk1.php.net/round round(9.5, 0, PHP_ROUND_HALF_DOWN); returns 9
  13. Hello If we had multiple tables which hold data to be processed IMAGE +----+-----------+ | id | image | +----+-----------+ | 4 | test.png | | 5 | bird.png | +----+-----------+ ORDER +----+-----------+ | id | order | +----+-----------+ | 4 | 100000045 | | 5 | 100000046 | +----+-----------+ When a processing error occurs, I thought to move the row to a table called error/attention/concern etc, To keep the table clean. Which would look something like this. ERROR +----+-----------+----------+-----------+ | id | table_id | image | order | +----+-----------+----------+-----------+ | 1 | 4 | test.png | EMPTY | | 2 | 5 | EMPTY | 100000046 | +----+-----------+----------+-----------+ However, This table will have to have corresponding columns for IMAGE and ORDER, But then we have a problem of storing empty/null values for the columns which are not needed on insertion here, This does not seem right. Has anybody had a similar issue before like this? Im sure there maybe a more definitive way of doing this. I also thought possibly just have 2 rows here, and enter a serialized array of data, but that seems even worse than this. Or finally I could possibly make 2 more tables, IMAGE_ERROR, ORDER_ERROR. But upon adding new processing technologies, I would need to add 2 new tables each time. Thanks in advance for any help/advice/answers.
  14. Lets say you had a function which checks to see if all values in array 1 are less than all values in array 2 You may need this functionality in many different things. Will read this now, Thanks
  15. Hello question is aimed @ experienced OOP'ers I just wondered how you handle a function which you use in multiple classes. You could write it fresh everytime in each class, Or make a standalone function in a php file and include it, But Im sure there is some better ways of doing this? So far with research it seems some people are making static "utility" classes, which they can call without initializing. Regards
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.