Differences

This shows you the differences between two versions of the page.

Link to this comparison view

exercise_2_-_php_and_mysql_-_files_and_directories [2017/09/06 12:16] (current)
anthony created
Line 1: Line 1:
 +====== Exercise 2 - PHP and MySQL - Files and directories ======
 +
 +Using the following text:
 +
 +Perl Still Dominates Over Python, Ruby or even PHP [And other trends]
 +In this hard times, it is what job you can get that matters not what is cool. That being so - Perl is vastly more useful than the other three big scripting languages - or at least in the US. Other job facts might also shock!
 +The simple take home message, do not base your career on that which is getting all the hype. People have made the same mistake over COBOL. "COBOL is dead" has been the mantra for the last 20 years. Well, it is not; the raw fact is that COBOL still runs the world of business and finance.
 +Let us turn some other assumptions on their heads. C# is really cool isn't it. I mean C# must be much more important than Java? Nope! As we have seen, C# is half as useful for getting a job in the US than Java. SQL, on the other hand, is THE language to learn!
 +Actually, it turns out that in getting a job, SQL over 20 times more important than Ruby. Yes:
 +SQL is over 20 times more likely to get you a job than Ruby in the US.
 +The simple fact of the matter is: programming jobs are about what is already out there, what drives business and what works. None of those things are '​cool'​! Indeed, I might postulate the exact opposite. The very pressures on development which make a technology appropriate for making money and running businesses are those which also make something deeply uncool. Pragmatism, reliability and load capacity are critical for business languages and for station wagons (estate cars) neither of which have ever been accused of being cool:
 +Once Mum and Dad are no longer funding you to vegetate in your bedroom and the reality of paying for your own children dawns, what language seems a good choice is likely to change!
 +
 +
 +
 +Write a script that will:
 +
 +
 +Pull the file into the script as a require function
 +Open the file for editing
 +Count the number of instances of the match " wh* " before editing with a regular expression ​
 +Store the value in a MySQL table called editing and field called preedit
 +Using a Regular expression, change every instance in the file of a charcter string inside round brackets to "​*wh*"​
 +Record the number of instances changed in the same MySQL table in a field called postedit
 +Using fseek and ftell, change the same string from character string "​wha"​ to "​which"​ at character 782 to the end of the file
 +Record the number of instances changed in the MySQL table in a field called selection
 +Save the changed file from the seek and tell point in a new file
 +
 +
 +Hint: substr_count
  
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported