Jump to content

roopurt18

Staff Alumni
  • Posts

    3,746
  • Joined

  • Last visited

    Never

Everything posted by roopurt18

  1. Most doctors don't associate MSG with any negative affects. Anyways, I'm a developer.
  2. I don't see why you wouldn't use SVN with multiple developers. Regardless of the number of developers, some form of version control should always be used. What I'm saying is SVN should not be hosted on a development server. A development server is the machine a developer uses to write untested, new code or to modify existing code (again untested). Storing your SVN repos on a development server is a huge risk in that a developer might accidentally hose the server and all of the company's source code could be lost. That would be nothing short of disastrous. Developers develop on their own machines or on development servers. Code is checked into the repository which resides on another production server within the company that is closed to the public. Code is tested on some machine, which could be a development server or a staging server. Code that passes testing is checked into version control as a release. The release is exported to the production server which is providing via hosting account or a DMZ within the company (or via some other mechanism). It is foolish to develop code on a machine which holds the company's bread and butter. It's also foolish to store the company's bread and butter on a server that is open to the public (i.e. on a web server). Do so at your own peril.
  3. I almost always use preg_match for this type of thing: function validate_username( $val ) { $errors = array(); if( ! strlen( trim( $val ) ) ) { $errors[] = 'Username is required.'; } if( ! preg_match( '/^[a-z][a-z0-9_]$/i', $val ) ) { $errors[] = 'Username starts with a letter and contains a combination of letters, digits, and underscores only.'; } return $errors; } <?php $username = array_key_exists( 'username', $_POST ) ? $_POST['username'] : ''; $username_errs = validate_username( $username ); if( count( $username_errs ) > 0 ) { echo '<ul><li>' . implode( '</li><li>', $username_errs ) . '</li></ul>'; } ?>
  4. Why would you need to create them? From the quick reading I just did, there is an INFORMATION_SCHEMA database and it contains views only; there are no tables.
  5. Monosodium glutamate. Basically it's a salt and used as a flavor enhancer. When it first became popular in the United States, it was heavily criticized. Studies have linked it to all sorts of temporary and permanent negative health effects. Within the last 10 or 15 years (guessing here) the FDA came forward and said, "No, no folks. MSG is perfectly safe!" Remember though that the FDA is run by people associated with the food industry.
  6. Almost all prepared or processed foods contain hidden MSG. Now the FDA has gone ahead and given the thumbs up when it concerns MSG, but remember that the FDA does not follow its mission statement. Many people report being sensitive to MSG and a common complaint is headaches or migraines. Also note that people sensitive to aspertame also tend to be sensitive to MSG. I'd recommend: + A short break every hour + Lay off the caffeine + Eliminate junk and unhealthy snacks (soda, chips, protein bars / drinks, they're all loaded with MSG) + Routine exercise + 6 or 8 hours of sleep every night And see if that doesn't help.
  7. I'll say it again: SVN doesn't belong on the development server.
  8. Good catch. Can use this instead: COL = LOCATION - (ROW * TABLE_ROWS) So if Location=24 and Row=4: COL = 24 - (4 * 5) = 4
  9. You should have a unique index on player_id and location unless you want a player to have multiple things in the same location. And if all players shared the same grid, you would have the unique id on location alone. (And yes, your sample table is acceptable.)
  10. Good grief. Since your map is a grid what you have is essentially rows and columns. Let's say your map is 5x5 and you number rows and columns starting at zero. 0,0 0,1 0,2 0,3 0,4 1,0 1,1 1,2 1,3 1,4 2,0 2,1 2,2 2,3 2,4 3,0 3,1 3,2 3,3 3,4 4,0 4,1 4,2 4,3 4,4 Now you can essentially replace those 2-int values with a 1-int value with the formula: LOCATION = ROW * TABLE_ROWS + COL Since this table is 5x5: LOCATION = ROW * 5 + COL Thus: 0,0 = 0*5 + 0 = 0 0,1 = 0*5 + 1 = 1 0,4 = 0*5 + 4 = 4 3,2 = 3*5 + 2 = 17 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Now if you have the LOCATION value and you want the ROW and COL back: ROW = floor( LOCATION / TABLE_ROWS ) COL = LOCATION % ROW Since this is a 5x5 grid: ROW = floor( LOCATION / 5 ) COL = LOCATION % ROW So if LOCATION = 21: ROW = floor( 21 / 5 ) = 4 COL = 21 % 4 = 1 So int 21 is really 4,1 Now your table to keep track of who has what where is: player_id <int> | location <int> | widget_id <int> | widget_status_id <int> 35 21 32 3 Let's say player_id 35 is Joe, widget_id 32 is Farm, and widget_status_id 3 is Constructing. Then that row means: Joe has a farm under construction at row 4, column 1. If you later decide to change the size of the grid, you just write a simple program to recalculate all of the locations in the table.
  11. Just chiming in to let the OP know dirkers is presenting the best solution. Keep the heavy lifting in compiled programs.
  12. I don't know what you mean by "using windows server with virtual svn server." Just install SVN on the windows machine. If you're using staging as synonymous with production, then no do not put SVN on the production server. In your case I'd use the Windows Domain Server as the SVN server as well.
  13. IMO do not host your SVN repos on the testing server. A test server is just that! Anyone coming into contact with a test server should feel free to assume nothing on the test server is critical. Therefore anything on a test server can be deleted, reinstalled, replaced, etc. I recommend you create your repos on a stable server within your company or organization. The target server should have a firewall, disaster recovery plan, etc.
  14. Create a file like this: <html> <head> <title>My Page</title> And write a simple program to convert it into one your teacher likes: echo '<html>'; echo '<head>'; echo '<title>MyPage</title>';
  15. Executing a command like that doesn't fork it into the background so your PHP script is not finishing before the PDF has a chance to generate. In fact PHP will wait for the command to finish before resuming execution. My guess is rml2pdf is not in your system's PATH variable so when you execute the command it fails with command not found. Or it is possible that $filename is a relative path and the PDF is generated but it's not where you expected it to be.
  16. I'm not a Microsoft guy so take this with a grain of salt. SQL Server Express is like a toned down version of SQL Server 2005|2008, sort of like how MS has Visual C# Express and Visual Basic Express. Essentially MS is creating freeware versions of their IDEs and technologies in hopes of competing with open source. So you are probably not interested in SQL Server Express as it sounds like the MS SQL database already exists. What you probably want is SQL Server Management Studio Express. You might also want to read up on Microsoft's BCP program, which is suited for importing or exporting bulk data in and out of SQL Server.
  17. You should read the MS SQL manual on the most basic and common database operations, which are: SELECT INSERT UPDATE DELETE There are examples of how to correctly perform each.
  18. In your PHP loop you just keep a variable $current_supplier. At the beginning of the loop, if the row's supplier is not equal to the value in $current_supplier, display the supplier. At the end of the loop, be sure to set the variable $current_supplier equal to the value in the row.
  19. Well if they're all varchar but with numeric timestamps in them, you should be able to do one of the following: 1) In the query, use a CAST() to convert the varchar to a timestamp. 2) Issue an alter table statement and change the column's type to timestamp. I would strongly advise against leaving them as varchar as they are timestamps and the database has a built-in type to support that.
  20. Really? Because when I create a table with a timestamp column and select * in phpMyAdmin it's displaying them as '0000-00-00 00:00:00' and not as 0. Anyways, if you look through the date and time functions for your version of MySQL, there should be a way to convert the timestamp to a '0000-00-00' day only format without having to change any of the column information or PHP code. Something like: select * from contacts where DATE_FORMAT( contact_date, 'format' ) between '2010-04-10' and '2010-04-10 23:59:59' If DATE_FORMAT doesn't work there should be another function that will.
  21. What happens when you run a query such as: select * from contacts where contact_date between '2010-04-10' and '2010-04-10 23:59:59' Does it give you the contacts for that specific date?
  22. Why wouldn't it? You can join a table to itself.
  23. SELECT <list your columns> FROM transactions a INNER JOIN transactions b on a.Transaction_ID=(b.Transaction_ID + 1) WHERE <add your where clause> ...
  24. Is there a return statement in the showname() function? Or are you just issuing an echo statement in showname()?
×
×
  • 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.