Hi ya guys,
Have you ever nested that many if conditions that your code starts to get quite complicated? Let's give you an example
Just some simple data checks on the $_POST['name'] value. But I'm not happy with that code. For something so simply, why is the code so complex? Let's use a technique with functions to make this much simpler. Then explain how it works in regards to simplifying it.
[code language='php']function get_name() {
//make sure it's set
if (isset($_POST['name']) == false) {
return 'Error Occured'; View In Full
I will quickly run you through an example of HOW to use memcache and how it works.
Download Memcache
http://jehiah.cz/projects/memcached-win32/
And load up the .exe - you should just get a blank command box appear - the server is then running on localhost:11211
Install the Memcache extensions in to PHP
If you use something like xamp or easyphp - just enable the memcache exentions (just a case of maybe uncommenting a line or ticking a box like in easyphp).
Code Example
Put that code in a .php page (remember to have the memcache server running). Now simply run the script and it will save my name in memory for 60 seconds! To retrieve the value from memory now put this in the script (within 60 seconds else it will expire from memory).
And you will see that my name is still there!
It's quite simple really. You use add() to add new values to memory where they are View In Full
Let�s go over what a session is.
Sessions
First you call session_start() which gives you a unique ID such as: dde2ds2g67xs2zxjh89s3j8923
Everything you then save to $_SESSION is saved in a file on the server such as:
$_SESSION['message'] = 'hello';
Would be saved to:
tmp/phpsess_dde2ds2g67xs2zxjh89s3j8923
and next time you call session_start(), $_SESSION['message'] will still exist and will have 'hello' in it!
Database Problem
So, you record a members total page hits on your site, and the last time they made a page hit on your site. You keep these stats up to date like this (which is executed on EVERY page hit by the member):
$time = time();
mysql_query("UPDATE `members` SET `timestamp_last_seen` = '{$time}', `hits` = `hits` + 1 WHERE `member` = 'VBAssassin' LIMIT 1;");
Now, all you�re doing is keeping track of the last time they were seen, and the total page hits they have made while logged in.
Solution
You need to keep track of your active sessions u... View In Full
Lets say you have 5 books... and 5 people rate each of those books. Now you want to find out who's interests, based on each users 5 ratings, are similar to who?
That's what this algorithm calculate
Allows for you to call a method of a class with the parameters in no particular order! Example:
function print($string, $size = 12, $color = 'red);
If you want to skip size, but you want to chan
So ya, I was being an idiot and posted a comment that was meant for your profile on mine. So, here it is:
Ya. Understandable. I was told my numerous doctors and specialists back 4 or 5 years
ago, that I have severe carpel and I was told I was suppose to go and get surgery.
However, talking with other people who have had it - they had told me it helps for a
while, but then it fails. Also, another thing is the fact that I make a living
coding, and I was told that I would not be able to use a computer in the fact of
typing for at least 6 months. First thought was, HELL NO! And actually, that is still
my thought today.
If you do have problems with your wrists, what I had found was that if I woke up
mornings and it happened a lot where each morning my wrists would get worse and hurt
with extreme pain, etc. as soon as I woke up, wearing a wrist brace when sleeping
helped in the mornings along with the next day of sitting of typing. Just make sure
that the wrist brace if you do end up trying it is a solid brace not an only fabric
one, but one with a piece of solid plastic.
Great work with the community. I had registered ages ago, but was into the whole community thing way back when. However, I am and will be contributing various articles and various libraries.
@watermarks: They can be found at: http://vantagewebstudios.com/content/public/connect/index.php. The two images used on the left in the content block areas. :)
1. http://vantagewebstudios.com/images/graphics/maintenance.png
2. http://vantagewebstudios.com/images/graphics/security.png
I did not notice anymore though. Thought I would just let you know.
After reading your "About Me" section, it has stated that you are directory of Vantage Businesses with a trading names of Vantage Web Studios and Vantage Windows. I assume http://www.vantagewebstudios.com is the web studios website. If so, I love the iStockPhotos :) ( ... looking at the watermark. )
Haha. Because I'm a retard, I wrote in my own profile first :p. I'm used to FB wall-to-wall's. Is something like that coming in V2?
------
I've known some for a long time, such as Singleton, Factory, Registry, etc. I
just bought the Design Patterns book a couple weeks ago though. I'd be done it
already if I had the time.
Anyway, design patterns are very useful. When you learn them, you're just
learning industry wide solutions to common problems. The solutions have been proven
which means if you use them for their intended purpose, they'll do exactly what
they are meant to.
You must be pretty advanced then - and you've been doing it only 3 months. Nice :)
My other ubuntu computer runs as an apache webserver but I have no clue of how to get it linked into a domain - rather than typing in the unmemorable ip I want a domain to like redirect.
Aaah yes I have a small linux problem that I hope you can answer. On this comp I tried setting up a web server and followed a weird tutorial that told me to edit the hosts file located at: /etc/hosts
I somehow managed to make it so theres no host. E.g. at the startup up screen it used to say //sam-linux but now its just a //
and whenever I run sudo commands before it executes it it says: "Unable to resolve host".
How would I edit this to make it right again?
Its a small thing but I guess its getting on my nerves.
Hey VB! To be honest, I'm not really sure where it came from. I was just sick of seeing the same old little symbol for not having an avatar. So I just found that one on the internet lol.