-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
Really? My answer to that would be, "OK, what if there was a fire and your server / computer melted?". If it is a hard disk i.e NAS then it would be better off-site i.e in the cloud for a desktop pc. If it is just anothert computer on your network or a local NAS device then if you had a fire, chances are that will be toast too! If you have a tape or media backup then it doesn't matter where the drive sits as long as you take the previous nights media away with you or keep it in a fire-proof safe.
-
Counting keywords within mysql table's field
JonnoTheDev replied to jmahdi's topic in PHP Coding Help
No, no, no. This is awful code switch ($tags[$i]) { case "moon": $moon[] = $tags[$i]; break; case "sun": $sun[] = $tags[$i]; break; } } If I had a thousand keywords are you going to add them all to a switch/case statement? What if you don't know what the keywords are? There is a php function for doing what you are after, array_count_values(). All you need is one array containing all of your tags. So if you are using the explode() function on many fields, just use array_merge() to put all the data into one array. Then use array_count_values() on the array and it will give you the number of occurances of each tag in the array. i.e. <?php $tags = explode("|", $row[0]); $tags = array_merge($tags,explode("|", $row[1])); print_r(array_count_values($tags)); ?> Here is a link to the manual: http://uk3.php.net/array_count_values -
mysql_real_escape_string does not remove characters, it escapes them.
-
Not just home users, even companies fail to do proper backups. When I worked in the IT industry doing server / network installations I used to implement backup solutions such as DAT drives / NAS / DLT etc. You would be amazed when visiting a site after a server had a complete failure i.e hard disk gone that the company had failed to change the backup tape for months.
-
Who's your favorite artist, musician, band, etc?
JonnoTheDev replied to livethedead's topic in Miscellaneous
Zeppelin -
Thats correct $_SERVER['REQUEST_URI']. My bad
-
Because, they'll copy it, re-brand it and sell it to the masses as CHINIE 2012. Bit like what they do with cars. Have you seen these somewhere else? http://gemssty.com/2006/10/29/top-10-copycat-cars/
-
Thats all you require using MVC as all requests are made to index.php and handled by the dispatcher. You only require the query string to load the appropriate objects. $_REQUEST contains all reserved variables as you have stated. Yep, that is bad. Also you may struggle with $_GET when a parameter uses certain unicode characters, however if you have any sense you would avoid this.
-
Never heard deep-sea-diver. Heard of a Jackson (Jackson Five)
-
There are more examples of $_SERVER['QUERY_STRING'] here http://php.net/manual/en/reserved.variables.php
-
Just to confuse you even more. A 'grand' is a thousand pounds (or a thousand quid), or as a Londoner might say, 'A bag of sand'.
-
If you were using the Model View Controller Pattern that uses the url parameters to autoload the required objects then you may want to use it in what is known as a dispatcher (analyses the url and takes the appropriate action). Lets say you had a url that looks like this: http://www.yourwebsite.com/blog/latest/a By taking apart the query string (/blog/latest/a) with $_SERVER['QUERY_STRING'] the displatcher knows to load the 'blog' object, use the 'latest' method and pass in the parameter 'a'. This hypothetical page would show all the latest blogs that start with the letter a. It is a bit of a daft question as there are other methods of obtaining the URL parameters using reserved variables in $_SERVER superglobal or $_REQUEST array. This is not necessarily a problem. The web server that you are polling with an API call may be slow. There may be too many records that you are trying to parse, etc. Some solutions may be to split up the number of records, cache the results, obtain the data using an automated procedure and create a local database that is queried instead of a remote call, etc
-
Probably not. Its an Apple. I think you're thinking of Flash there. It was kind of a funny statement though
-
Some ideas on making odd & even rows to color in with CSS
JonnoTheDev replied to Shadowing's topic in PHP Coding Help
Not always easier. have a look at some examples: http://davidwalsh.name/javascript-shorthand-if-else-examples You would give them a different class or only use a class on the tr's that you want to cycle between colours. If CSS isn't your thing dont worry about it. Look at CSS when you get chance. Here's some tutorials http://www.w3schools.com/css/ -
Some ideas on making odd & even rows to color in with CSS
JonnoTheDev replied to Shadowing's topic in PHP Coding Help
In a stylesheet Its a comparison operator. Is equal to. Shorthand conditional statement i.e if/else $class is equal to even or odd based on the result of $i % 2 being equal to 0 or not i.e if(($i % 2) === 0) { $class = 'even'; } else { $class = 'odd'; } -
<?php function find_phrase($str, $match) { $parts = explode(".", $str); $matches = array(); foreach($parts as $s) { if(strstr($s, $match)) { $matches[] = $s; } } return $matches; } $str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In facilisis faucibus vehicula. Praesent fermentum odio at dolor semper rutrum. Etiam pretium, diam ac mattis vehicula, dui ipsum congue ipsum, in sodales neque libero sit amet lorem. Morbi ac neque nec arcu feugiat convallis. Praesent quis diam a libero varius ipsum elementum."; $phrases = find_phrase($str, "ipsum"); print "<pre>"; print_r($phrases); print "</pre>"; ?>
-
According to your code $curl_post_data doesn't exist curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data); And from the requirements it looks like the data needs to be in XML format. You have not got that far. All you have is a multidimension array stored in $fileds
-
By using the smartphone SDK's. Here's a comprehensive guide: http://mobiforge.com/testing/story/a-guide-mobile-emulators
-
He's 20 and lives in the UK (right next door to myself). I would say that is a low wage and is what I would expect a high school leaver of 17 or an apprentice to be earning. I would say £17k-£25k is probably about right for a junior dev. £25k-£50k for a senior. If you lived in the London area I would expect the salary to be around 10% higher.
-
As previously mentioned, job titles are utter political garbage. In most jobs (that I have been in anyway), the people who are supposedly of a higher level usually know less than you do (not saying that this is always the case). You could get a job as a senior developer at another company with the years of experience that you say you have and some junior will walk through the door and wipe the floor with you. A developer is a developer, whatever level they are at. If a company uses a particular style of programming or a specific framework and you know it inside out then you are at a senior level to that company. If you move to a company that uses a different framework or programming language or anything that you are unfmailiar with, then you are at a junior level to that company. I will say that at a senior level you should be in a position where you are teaching juniors and delegating tasks. In terms of a pay rise you should look at how valuable you are to the company. If you walked out the door would they struggle? If so you are in a good position to ask. You certainly aren't going to jump from 14k to 25k but you should get something inbetween. If the companies finances aren't great then you may get nothing more than a promise of a pay rise at which point you should consider moving.
-
An e-petition for the UK government to condemn SOPA and PIPA
JonnoTheDev replied to joe92's topic in Miscellaneous
When I first heard of a stop on sopa and pipa I thought it was an Italian trying to ban a popular starter and a well known condiment. -
Wordpress is a mish mash of legacy php 3/4 code with php 5 code slapped on top of it. What they should of done was rewrite the whole thing in OO php 5 after a certain version. It is garbage for a developer to work on. I have a few books on writing plugins for Wordpress and it makes me laugh when they try to explain how to do something. They will say something like, 'you can use this function to do x, but you can also do it this alternate way, however, if you try to use function y when using method b you will get an error'. It just basically says that the code is crap and there is no strict standard for extending it.
-
Website domain stopped working and appeared as unregistered?
JonnoTheDev replied to godsent's topic in Miscellaneous
You get what you pay for, cheap = crap. -
Most Technologically advanced country
JonnoTheDev replied to The Little Guy's topic in Miscellaneous
And barbecues