Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. That's not the point. If they want to make money with their game, FINE. I regularly buy games through Steam or EA Download Manager and I am more then willing to pay for a game. But if you deploy your game as FREE, it should be FREE *OR* no item that can be bought should be able to influence gameplay. Instead they FORCE you to spend money (or don't and lose). Like a *magic* helmet which is an alias for GOD mode, a full clip in the back of his head couldn't get him down (OR their was nothing in his skull to stop the bullets) and he only noticed I stood behind him when I changed clips.
  2. Another method would be to use implode. I rewrote your code and enhanced it (in a few parts): function get_file_name($resource) { list($filename) = mysql_fetch_row($resource); return $filename; } $result = mysql_query('SELECT Filename FROM homeimages ORDER by Filename ASC'); $files = array(); if (false !== $result && ($num_rows = mysql_num_rows($result)) > 0) { $files = array_map('get_file_name', array_fill(0, $num_rows, $result)); } echo '["http://www.benbrownphotography.co.uk/images/home/upload/', implode('"],["http://www.benbrownphotography.co.uk/images/home/upload/', $files), '"]'; If you have PHP5.3 running on your server you may use closures instead of get_file_name()
  3. That doesn't work because 1) Not everyone's contact form has the same requirements (or project specifics) Not everyone looks at a guestbook/contact form/forum the same way, IA and clients will teach you that. 2) Admin's will not do custom work to match your project requirements marking the tutorial obsolete for however copy-pasted it. 3) Admin's are busy enough they do not need to provide support for what they wrote 4) No-one uses the search apparently as your idea has already been suggested, which basically proves it. 5) There is already a tutorials section that can be found at http://www.phpfreaks.com (you probably didn't even knew there was such thing here) 6) If the admin's would write the code, the most people who copy-paste it will not be able to understand it (hence MrAdam's comments on error resolving) Basically all these reasons are enough to not create such topic. However if you are convinced this is such a GREAT idea I recommend you start such a forum and provide such services and direct anyone who needs help to our freelance section (that will make our freelancers happy ).
  4. His primary motivation is surely the learning curve (I think, he did mention willing to buy it) the underlying motivation is the money he could possibly earn with it. I almost know for a fact that he will implement some sort of mechanism where loosers players can buy their way to the top. I have played mafia wars for a while until some level 5 hits you with 3-times your defense, while reading the attack-log I noticed he had ALL epic weapons (which you can only get from the in-game store) 50-times (the number of mafia friends he had) I had over 300 and all were well equipped with weapons you get from loot-drops or could buy from the game (and have lowsy defense or offense). I really hate games that favor people who spend real money. Like battlefield heroes, has been fun for a while until EA noticed their ROI was going slow and thought they should support their low-lifes, hackers, .. euhm players more. Gaming isn't what it used to be I play COD:WOW now and then, the number of people that get banned for cheating in one session is almost 75% of what joined the server (don't mind my exaggeration here I just want to point out a lot of people get caught and banned). Or whiners on how he thinks you are such a big cheater and then starts a kick-spam against you. I die too, I have had a 3/50 k/d ratio but do you hear me complain? Move along, there are bigger problems in this world.
  5. First off MVC is not Nor is it directly related with OOP If you have ever used something like /profile.php /register.php In which you used functions to perform the task and then render a template using a template engine. You in fact had an MVC implementation. Creating an effective MVC OOP implementation is not so simple as you might think. You don't just create an abstract class (or interface) for Controller, Model, and View. Like any project should you give this some serious thought as what do you want to build? How is this all connected? Do all entities have a clear SoC (Separation of Concerns) and do all of them have a SR(P) (Single Responsibility Principle). So, let me start by asking: what do you want to build?
  6. primary key's are by nature protected against concurrency (I think, I hope, http://www.mysqlperformanceblog.com/2006/06/05/innodb-thread-concurrency/) therefor put all document names into a separate table like you already did but remove the applicant_id in that table. Then in your main table: ALTER TABLE applicant ADD document_id int(11) NOT NULL AUTO_INCREMENT However this does mean that you can only tell them the document number after they have submitted.
  7. The code you provided indeed has some flaws, all fields are for example public which is bad practice as you have no way of applying any validation (and only the User object knows best how it data should look like). Indeed it retrieves the entire row and relevant information from other rows but when you try to abstract you have to retrieve everything as you don't know who will be using it. And to have a great abstraction you need objects to know as little as possible (loose coupling, high cohesion). Like you said "It updates the entire row for any update" is indeed bad and can be easily circumvented by remembering which data has changed, you will however need setters & getters as you can't add code to a class property. Dwight D. Eisenhower once said: "I have always found that plans are useless but planning is indispensable". Good quality software starts with planning, more concrete with a domain model (sometimes accompanied by a sequence diagram to make sure your model makes sense). The domain model is a visual representation of your (current) domain knowledge gained through conversation with the domain expert (your client). Because you have a domain model doesn't mean you need to stick to it after all in Agile development is everything optional (except the code). Your domain model is like the "plans" in the Eisenhower quote useless but indispensable to have gone through. Every pattern was/is build on software design principles (and you should know these by heart) and therefor all components have a high separation of concerns (SoC) and a single responsibility (-principle, SRP). Your value object (VO) is so popular due to it solving the problem, have a clear SoC and SRP, while keeping the model simple (and simplicity should always be your aim, our minds have trouble to picture something complex). The mapper you found in Advanced PHP Programming is a rather simple mapper, more effective mappers are for example an object-relational mapper (ORM) which would translate your database (for example by using a database abstraction layer (DBAL, rewrites queries to match the underlying database)) into objects to use in your application. However I probably can keep going on and on and on .. There is nothing that I told you that you can't find in books, if this subject interests you very much I highly recommend: Applying UML and Patterns [Craig Larman], Domain-Driven Design [Eric Evans], Design Patterns [GoF], and Patterns of Enterprise Application Architecture [Martin Fowler]. These last 2 books are catalogs (pattern catalogs) they list the patterns in a common format to explain it's nature, aka's, and suggest usage.
  8. First I thought you asked about your db structure, then I thought it was about several pages doing one thing, and now your aiming at design patterns? So, what is it your aiming at? domain-modeling? And a VO is a representation of a tuple like for example from a table users (id, username, password, password_salt, email_address) class User { private $id, $username, $password, $password_salt, $email_address; //setters & getters } class UserDAO { public function findByUsername($username) {/*logic here*/return new User($data); } } And something else I don't get is: How come I have to tell you things, you should be telling me? A VO, DAO, ActiveRecord are more then just common in J2EE. They have their own catalogs of design patterns. You could almost say patterns were born in Java.
  9. add a field user_id in your dvd_info table. When you select the DVD's you use: WHERE user_id = ..
  10. The cleaning function I would write as: if (!function_exists('get_magic_quotes_gpc')) { function get_magic_quotes_gpc() { return false; } } function clean($value, $charset = 'ISO-8859-1', $allowed_tags = '') { $value = trim($value); $value = strip_tags($value, $allowed_tags); $value = htmlentities($value, ENT_QUOTE, $charset); $temp = @mysql_real_escape_string($value) ? $value = $temp : $value = get_magic_quotes_gpc() ? $value : addslashes($value); return $value; } The login implementation could be: function validUsername($username) {/*implementation*/} function validPassword($password) {/*implementation*/} function findUserByCredentials($username, $password, $result_type = MYSQL_ASSOC) { $username = clean($username); $password = clean($password); $query = "SELECT id, username FROM users WHERE username = '$username' AND password = sha1( concat( password_salt, sha1( '$password' ) ) )"; $result = mysql_query($query); return false !== $result && mysql_num_rows($result) === 1 ? mysql_fetch_array($result, $result_type) : array(); } function verifyUser($user) { if (!session_id()) session_start(); $_SESSION = array_merge($_SESSION, $user); return true; } define('LOGIN_OK', 1); define('LOGIN_EMPTY', 2); define('LOGIN_INVALID', 4); define('LOGIN_NOT_FOUND', ; function login($username, $password) { $username = clean($username); $password = clean($password); if (empty($username) || empty($password)) return LOGIN_EMPTY; if (!validUsername($username) || !validPassword($password)) return LOGIN_INVALID; $user = findUserByCredentials($username, $password); if (empty($user)) return LOGIN_NOT_FOUND; verifyUser($user); return LOGIN_OK; }
  11. Take a look at http://www.php.net/manual/en/function.md5.php#81708
  12. No as it's one of the requirements for a hash-function. How do you MD5 these password's? Like: WHERE password = md5('$password'); Then your website is in danger as hacker's can use rainbow table's to retrieve a value that will match the MD5 stored in your database and it's best to use salt's like: WHERE password = md5( concat( password_salt, md5( '$password' ) ) ) The hacker now isn't able to use a rainbow table as the retrieved value wouldn't be correct.
  13. Cookies are supported by most (if not all) browsers. Your function will do fine although I would recommend generalizing it more, like: function htmlInput($array, $type = 'hidden') { $html = ''; foreach($array as $name => $value) $html .= "<input type=\"$type\" name=\"$name\" value=\"$value\" />\r\n"; return $html; }
  14. Don't expect to much of Lulu promoting your book, there are too many that's where your website comes in. Promote your book, write your text to make them curious about what they may find inside your book and buy it! Do a read on SEO and copywriting to make your text more compelling, link to (and clearly state that you handle printing through) lulu.com. The reason that you need to clearly state it is because if you don't your visitors become confused, scared and will NOT buy the book. Gain their trust and once the reviews come rolling in you'll probably start to sell even more. And about the price I think it's a fair price if you have put a lot of effort in the research.
  15. I got this: 0: $vargame = 0, $colorgame = "red", $gametrick = 0; 1: $vargame = 3, $colorgame = "green", $gametrick = 1;//elseif ($vargame < 4 && $vargame < 2) 2: $vargame = 6, $colorgame = "green", $gametrick = 2;//elseif ($vargame < 4 .. 3: $vargame = 8, $colorgame = "red", $gametrick = 3;//else 4: $vargame = 7, $colorgame = "yellow", $gametrick = 4;// elseif ($vargame == 8 .. 5: $vargame = 9, $colorgame = "red", $gametrick = 5;// else 6: $vargame = 10, $colorgame = "blue", $gametrick = 6;// elseif ($colorgame == "yellow" ... 7: end The text in comments is what applied.
  16. if (in_array($name, array('dave','thomas','steve')) shorter but I doubt it's faster
  17. That book was published in 2008 (think this still works?), Google changes their algorithm again and again and again and .. at infinitum. Currently Google even employs an algorithm that changes the results based on location, country, preferences, .., weather, .. Just try it, refresh the page (or compare results at home and at work, ..), chances are you get a different result (although the same keywords are used). Read this http://searchengineland.com/36-seo-myths-that-wont-die-but-need-to-40076 (4/15/2010) as it's more accurate then your book.
  18. A few pointers as how I would improve it. I took the term stack literally as you'll notice. It may be best to put the search bar below the signup & learn more. It also may help to add something like Trends (What's hot? What remains hot?). Stackway has great potential it just needs a good brainstorm and a good designer/information architect to expose that potential.
  19. No. That ~70% is market share. If you ever know how Google applies his ranking algorithm, you will be a rich man as that information is worth a lot of money to many SEO firms We all know that Google appreciates content (especially the sort that changes a lot) like all SE do and that's about everything we get to go on. Whenever a user enters a query Google will search for each word in the query (unless they used " whereas it would be considered one word) and looks through your content. The website that matches the most words and has an OK pagerank will rank high followed by the once who have a lower pagerank or a lower word relevancy. For this reason you must always think of "what will the user enter when he looks for my product? website?" Ofcourse this entire paragraph is full of speculation, of how I think Google applies his algorithm (with some knowledge applied from full-text searches) and may in-fact be completely different, who knows? We also "know" that Google is a firm and thus bound to it's end-users (it can not apply things that would decrease the overall experience)
  20. It's better then oldmastercopies but it still lacks a serious usability. And like andrewgauger already told you it would be best to find an agent, write the book and publish it. Use your websites to promote your book. If you don't want to go through all the fuss of finding an agent, convince them, find a publisher who wants to invest in your book, you could use http://www.lulu.com/ you just send them the copy and they will sell if for you. It's easier to convince people to buy your book through an established company then them hoping you will send them something after you received their money.
  21. Google (~70%) only looks at the description meta tag if it thinks it can help. The keywords tag is useless. Yahoo (~17%) had once stated they looked at the keyword tag. Source: http://www.seoconsultants.com/meta-tags/myths/ Source: http://searchengineland.com/36-seo-myths-that-wont-die-but-need-to-40076 Source: http://www.youtube.com/user/GoogleWebmasterHelp alt tags are meant for disabled users Google does not incorporate your alt attributes into their ranking. Has nothing to do with SEO but instead is a good practice. Sure, keep believing that. That's prolly why so many error bloated websites rank high? This is just a good practice towards yourself from having headaches instead of being SEO related.
  22. You need Round-Robin Tournament otherwise if you have an uneven number of players one player will not be able to play as you do not have a competitor for him.
  23. All your pages are to specialized, they do just one thing (paint, reasses, ..) You even have 2 pages that provide the same functionality PaintCarAndShow, PaintCarAndReturn, possibly due to your J2EE background where these would have been methods with an event listener added to. It would be best to give users a form where they can adjust color, mileage, .. all at once. Which will also decrease the number of pages you currently have and increase the usability of your application. Something I noticed is that your database design structure isn't optimal for example: Asset_Tbl (AssetID, TypeID, UserID, Make, Model, Size, Year, Color, Value) Now the below $DB_Result = new db_query("SELECT Make, Model, Year, Color, Value FROM Cars_Tbl WHERE UserID = ".$ViewedUser->showUser()); while ($Row = $DB_Result->Fetch()) { echo sprintf("%s ... Value \$%.2f<br />", showDescription($Row['Color'], $Row['Year'], $Row['Make'], $Row['Model']), $Row['Value']); } echo "<br /><b>Boats Owned:</b> <br />"; $DB_Result = new db_query("SELECT Size, Make, Model, Year, Color, Value FROM Boats_Tbl WHERE UserID = ".$ViewedUser->showUser()); while ($Row = $DB_Result->Fetch()) { echo sprintf("%s - %s %s %s %s ... Value \$%.2f<br />", $Row['Size'], $Row['Color'], $Row['Year'], $Row['Make'], $Row['Model'], $Row['Value']); } becomes: $DB_Result = new db_query("SELECT Type, Make, Model, Year, Color, Value FROM Asset_Tbl JOIN Type_Tbl USING TypeID WHERE UserID = ".$ViewedUser->showUser() . " ORDER BY Asset_Tbl.TypeID"); $Type = ''; while ($Row = $DB_Result->Fetch()) { if ($Type !== $Row['Type']) { $Type = $Row['Type']; echo "<h2>$Type</h2>"; } echo sprintf("%s ... Value \$%.2f<br />", showDescription($Row['Color'], $Row['Year'], $Row['Make'], $Row['Model']), $Row['Value']); } //<h2>Car</h2> //Car ... Value $ //... //<h2>Boat</h2> //Boat ... Value $ //... Your classes are also very tightly coupled to your database normally your Value Object only represents the User it does not load it from the database a DAO is responsible for that. A Value Object can be considered like the Integer class in Java it's only parent is Object, a Value Object is to represent a certain entity throughout your application. Something like: class User { private $field1, $field2, $field3, ...; //setters,getters (validation, nothing more) } And used like throughout your application. someFunction(User $u); someOtherFunction(Integer $i); If however you want to insert/update the user records from the Value Object you should consider using the ActiveRecord which places a save() function in all extending classes which inserts the user if the data is new or updates it (the fields that were changed) when the object is dirty like: $user = new User(); $user->username = 'ignace'; $user->email_address = 'email@domain.com'; $user->save();//INSERT User_Tbl (username, email_address) VALUES (..); $user->email_address = 'email@domain2.com'; $user->save();//UPDATE User_Tbl SET email_address = .. WHERE UserID = ..;
  24. Not applicable as in nothing to do with queries or your database design structure. PHP and Java are very different as PHP only "lives" for as long as a request and how you model your application is entirely up to you. Post some code you want to shed some more light on so far you provided no example just vague descriptions.
×
×
  • 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.