-
Content Count
105 -
Joined
-
Last visited
Everything posted by Rigaudon
-
Words, words, words! Useless words! Stop making me read a bunch of text and get to the point!But no, in reality, I think patience is slowly drifting away in a frantic and tense world. If you take the time to notice, hardly anyone stops just to enjoy the world around them and being alive.It seems that the only time one goes outside now is to go into their car. Humans have advanced to the point where everything they need is practically handed to them.I can't say I'm not guilty of this; I haven't gone outside just to walk and enjoy it for a few months now. People today are so preoccupied in their everyday lives.As for car trips and Disney tents, they sound like good ideas to me, but I think only because I'm part of the generation that doesn't want to wait and always hopes for instant gratification.Actually, even now, I'm clicking "add reply" multiple times because flood control prevents me from posting or something, at an interval of once every half second between seeing the flood control warning , going back, and posting again. Things like this seem so natural to me that I hardly even notice anymore.
-
Oh yea, I forgot about eye contact. I suppose I should learn a little more about the school too. Pretend that I'm going to be accepted already- I like that. I'm writing these things down and practicing speaking in front of the mirror in the hope that it will do some good.Coincidentally, I talked to a neighbor of mine who was accepted to this school and she said that an interviewer asked her "What is pi?". Conveniently, I've memorized Pi to about 100 digits, but would be the best response? I think I'd like to say "Tasty pastry" for humor but I'd be in pretty bad shape if the interviewer had no sense of humor. My neighbor said "a number", but I don't think I'd be satisfied with a simple answer like that Thanks for the tips, anwiii.
-
Very nice. Did you design the sprites yourself too? What photoshop brushes did you use?Overall, I'd give the first one 7/10 (simple, but that's what makes it nice), and the second one 8/10 for nice use of gradient and satin.
-
Storing An Array Into A Database not including serialize
Rigaudon replied to Rigaudon's topic in Programming
No, not at all. I'm rather hesitant to use htmlentities() because, well, for one, I want to be able to eval() the code. If I had code that had quotes in quotes, it would show up as "" and decoded it would be "" (two double quotes), which would not parse correctly. For another, escaping the string can be eval()'d directly already; the only problem is with the serialization. My last hesitation is extremely irrelevant, but I just feel slightly uncomfortable because html entities is usually something people see, and nobody is supposed to see the code (lol). I see where you're going with this, and I have to say- it's actually a very good idea. I don't know if htmlentities() does something different for escaped quotes, though, but I will probably end up using this later. Thanks! -
I love it, a religious person who doesn't get hostile! In all seriousness though, you put up a great argument. If a child was adopted from birth and raised, he will never question whether his guardians are his real parents unless they're too different (ethnicities etc). I also like how you take other religions into consideration but your own. However, what I love most is that you use modern-day science to justify your answer. I have a few questions for you, however: 1) If you doubt some forms or definitions of God, you obviously pick and choose from the Bible to what fits your life. If you do, then why pick and choose at all? You can just live by the morals that you believe in without living by some of the (let's face it) silly stories in there (no offense to anyone). I guess you'll answer "because something had to have been there to start it all", and I agree with you. Science has not yet reached the point where it can answer every question. 2) If there was a completely comprehensive proof that proved the beginning of the universe (we're really far away from that, I know), would you still believe that God created the universe? 3) Simple question. How old do you think the Earth is? Thanks for taking the time and being open-minded, Xalor
-
Hello to all. This tutorial is for the people who know the basics of PHP and want to take their website/programming skills to the next level. To be clear: it is advised that those who don't know PHP not read this, as it will be very confusing. I will be discussing OOP (Object Oriented Programming) here. This is a GREAT prerequisite to Java if you want to learn it and know PHP. What is OOP? OOP, or Object Oriented Programming, is not much different from programming normally, but really separates the man from the boys and help your code to be MUCH more organized. The general idea behind OOP is to wrap everything that is related into one class, which we can then instantiate. You absolutely MUST learn some concepts of OOP before starting Java if you don't want to be completely lost when you start learning it, though I understand some of you probably just want to stick with HTML. I like to use an analogy for OOP- it's like making a machine to do something for you. For example, if you wanted to chop down a forest for a new supermall, would you chop down each tree individually? No, you would make a machine that can chop everything down for you. In this case, it's easier to make the machine than to chop down every tree. On the other hand, let's say you wanted to say hi to your mom. Would you call her up and say hi, or would you make a robot to do it for you? Obviously, you would call her up (unless you really hated her) and tell her because doing so is much easier than making a robot. In other words, it makes difficult things easier and easier things more difficult. Anyways, let's jump right in! Properties of a class Example Let's say you're running a furniture making factory. You want to keep track of how many pieces of furniture there are, their status, price, etc. How would you do this? Hm, well I guess you could store everything into an array: $furniture1['price'] = "499.99"; $furniture1['status'] = "Available"; linenums:0'>$furniture1 = array();$furniture1['name'] = "Bed";$furniture1['price'] = "499.99";$furniture1['status'] = "Available"; By reading the above code, I hope you can grasp how tedious that would be, and to do maybe 10,000 pieces of furniture a day would be just torture, even if you used mySQL (which I won't be covering here, but probably will in future). No, this is where OOP comes in. To define a class, simply do: class furniture{}And this would make a class called furniture. Now, let's wrap our code in it. What did we have for furniture? The name, the price, and the status. Let's give the class these attributes. class furniture{ var $name; var $price; var $status;} The codeword var defines an attribute. There are other keywords specific to OOP (public, protected, private), but that's a little more advanced and won't be covered here. So, what have we just done? We gave the furniture class three attributes. Simple enough. Classes can also have functions in them, but when functions are in classes, they're called "methods". All classes should have one never-changing method: the constructor. The constructor is called every time the object is instantiated, or made. What do we want to do when a furniture is made? Well, we want to give it its name, price, and status. The construct method is: "function __construct()" with 2 underscores and it can take inputs. Here's what we would do: class furniture{ var $name; var $price; var $status; function __construct($name,$price,$status){ $this->name = $name; $this->price = $price; $this->status = $status; }}Let's go over what we just did in detail. We made the __construct() function that takes 3 parameters. In OOP, there is a special variable called "$this" which refers the the executing object, or the object that's running the code. To get an attribute of a class, we use an arrow (->) from the object to the attribute name. Here, we set the executing object's name, price, and status to whatever the input is. There's also a destruct function (__destruct()), but I hardly ever find a use for it. Obviously, classes can have more than these two functions. If the class had been a washing machine, we would probably add a method called "washClothes()". It just depends on what you want to do. To call functions of an object, the syntax is the same. You'd put the object, arrow(->), and the method name, like "$washingMachine->washClothes();". We just went over how to define a class. Let's see it in action now. Instantiating objects Instantiating is just a fancy word for "make it". Since we already made a furniture class, let's do that one. Let's say I wanted to make 3 different pieces of furniture: a bed, a table, and a sofa. This is how we would do that (make sure you've included the class in the PHP file or require()'d it): $sofa = new furniture("Sofa",1299.99,"Available");$bed = new furniture("Bed",1549.99,"Shipping");$table = new furniture("Table",599.98,"Broken"); This obviously is much easier than what we did before. OOP in conjunction with mySQL can be extremely useful, as you can see. Of course, in practical use, you'd use variable variables to dynamically generate thousands of furnitures. If I only wanted the status of a specific table, I'd simply do: echo $table->status; That's OOP in a nutshell. There's much more complicated stuff, but before I leave, I'd like to leave you with an extremely practical piece of code for sessions: $this->id = $_SESSION['id']; $this->username = $_SESSION['username']; $this->log_in(); if(!isset($_SESSION['admin'])){ $_SESSION['admin'] = 0; $this->admin = 0; }else{ $this->admin = $_SESSION['admin']; } } else{ $this->logged_in=false; } } public function log_in(){ if(isset($_SESSION['id'])){ $this->logged_in = true; } } public function log_out(){ $this->logged_in = false; $_SESSION = array(); session_destroy(); header("Location linenums:0'><?phpclass Session{ public $id; public $username; public $logged_in = false; public $admin = false; public function is_logged_in(){ return $this->logged_in; } function __construct(){ session_start(); if(isset($_SESSION['id'])){ $this->id = $_SESSION['id']; $this->username = $_SESSION['username']; $this->log_in(); if(!isset($_SESSION['admin'])){ $_SESSION['admin'] = 0; $this->admin = 0; }else{ $this->admin = $_SESSION['admin']; } } else{ $this->logged_in=false; } } public function log_in(){ if(isset($_SESSION['id'])){ $this->logged_in = true; } } public function log_out(){ $this->logged_in = false; $_SESSION = array(); session_destroy(); header("Location: login.php"); }}$session = new Session();?> This keeps track of a user's id, username, and whether they're logged in or not/admin status. Since (I would think) most people use session for their websites, wrapping it all up in a nice class like this really helps. I hope you understood what we just did and apply it to your own code to make it more organized. This truly does make you a better PHP programmer, and, as previously stated, is a great prerequisite for Java or any other OOP language.
-
Hi everybody,I have an interview this Saturday for a really prestigious school that revolves around math and science (only 13 of these schools in the USA). I'm relatively young and have almost no experience in interviews. I know some of you are much wiser than I and can offer me some advice apart from the obvious (dress nicely, be polite, etc.) I'm really nervous and psyched for this, mostly since the majority of the people who apply for MIT (my dream school) here get in.Thanks in advance.
-
Firefox, chrome, and some other browsers were actually Netscape, which dominated IE before 2002. It is true, however, that in 2001-2002 it reached its high point in browser wars because Microsoft packaged IE with Windows, and got sued for it. If you wikipedia "browser wars", you'll find a nice spread of browser domination. Slowly but surely, IE is going down the tubes. By 2015, I think IE will be obsolete unless it makes some kind of amazing re-do or comeback.
-
An Introduction To Ajax Prerequisites: HTML, JavaScript, PHP
Rigaudon replied to Rigaudon's topic in General Discussion
No problem! I hope to post another tutorial on mySQL soon, then go on to advance OOP PHP and AJAX. It's surprising to me how many people consider using a template "making their own website" without even knowing what source code is, and I hope to change that -
Storing An Array Into A Database not including serialize
Rigaudon replied to Rigaudon's topic in Programming
Heh, well I guess I need to explain my code now ;)I'm developing an RPG (AJAX based) and this is part of an NPC script. Each npc has things you can say to it, what it says back, and any code to be executed when a specific response is chosen.For example, a player can talk to an NPC and choose to pay gold to enter an area. I want it so that when they choose that option, it takes them in the area by evaluating the code. In this way, I can keep my game dynamic.It is the code section that I need to preserve quotes, but all of an NPC's code is an array. -
Storing An Array Into A Database not including serialize
Rigaudon replied to Rigaudon's topic in Programming
<?php$a = array();$a[0] = "ASDF";$a = serialize($a);echo $a?> This returns :a:1:{i:0;s:4:"ASDF";}An array of 1 element with index of an integer (0), containing a string of 4 characters.If the 4 was changed to any other number, then unserialize() would crash because the string is not that long.Escaping the value and stripslashes are actually the problems of what I'm dealing with. If I don't add slashes, the quotes would cancel out in the middle of my INSERT mysql statement.If I do add slashes before I serialize it, then it counts the backslashes as characters and counts it part of the string. When I insert it, the slashes go away and the serialized array can't be unserialized.If I add slashes after I serialize it, it would add around 10 backslashes per quote, which not only looks extremely bad, but also takes 2 or 3 stripslashes() to get rid of all of them.Right now, I'm just doing 3 stripslashes(), but I think if there are escaped quotes within the string, it would add even more slashes and the cycle continues...I guess what I'm looking for is basically a serialize() function which isn't so picky about the exact length of everything. -
Hi all,For what I'm doing, I need to store arrays into databases all the time. Up until now, I've been using the built-in serialize() function.However, this is a problem because even one number off the length, and the unserialize() function crashes. I know if I serialize it and preserve it, it should come out the same, but working with quotes is a bother with mysql and whatever. I know I could rewrite the offending parts, but just for future reference, I was wondering if there is any other way to store an array into a database.
-
Pokemon Heart Gold And Soul Silver (remakes) Confirmed!
Rigaudon replied to Forte's topic in Computer Gaming
Nintendo is definitely going to make a Crystal version of Heartgold or Soulsilver, and will definitely have more content and be just better. I'm going to wait for that... I kinda regret buying diamond instead of waiting for Platinum >.> -
This is an extremely broad topic and much more difficult than "let's all hold hands and sing Kumbaya".You have to keep in mind the history between ethnicities and nationalities. Patriotism and nationalism is based on this. Different races also have broadly different cultures, and it's not going to meld into one uniform global culture overnight. When humans find another species with a different way of thinking and looking at things, they find it funny because it's not what they're accustomed to. If you went to an isolated third-world country in Africa, they would laugh at you for wearing clothes.Eventually, over the next millions of years, assuming the human race hasn't turned itself into nuclear residue, I believe we will all meld into a single race. However, even then, I don't believe racism will be out of the question.It's just the human way of thinking: "I don't like you because you're different from me".
-
I insist that you use AJAX for this, but if you don't know AJAX, then I guess you can stick with the frame.You can find the paypal button from paypal.com. They also give you the code for it.To make a folder restricted, go to file manager in your cpanel, select the folder, and choose "change permissions".To make a limit on the amount of times one can download, you should use a database to store the amount of times a file has been downloaded and redirect the user if download limit has been reached (why bother? Software can be copied anyways).By the way, if you play the song on your website, then the person can view the source and find where the song is located and ultimately get it for free.
-
Hi everyone, Looking around these posts, I've noticed that many people have questions about things that could either be easily accomplished in AJAX, or just made easier in AJAX. I learned AJAX very recently, actually, and it was very frustrating to grasp the basic concept of it by just vague and incomprehensive words on a web page. Well, obviously, you're doing the same thing, but I think the way I explain it will make things much simpler to understand. Note: I'm not sure if this should go under tutorials or programming languages>ajax, so move as you see fit, mods. I'm assuming you know the basic concept of HTML, a little HTML DOM, basic JavaScript, and basic PHP. Understanding What AJAX is AJAX stands for "Asynchronous JavaScript and XML". It is not actually a language, but a method developed by Google. It involves JS and either PHP or ASP. Since PHP is just, well, plain better than ASP, I'm going to use that. What AJAX does is it actually communicates with the server-side script without the user having to reload the page. This is very useful if you have a script that changes something every so often so the user doesn't have to refresh. If any of you have every played Neopets, then you will know the frustration of reloading the page every time you want to do something (well, they've kinda migrated toward flash now, but still). As you may have guessed, this script requires both a server-side script (PHP) and a client-side script (Javascript). Luckily, the client-side script hardly changes for general use. XMLHTTP object AJAX revolves around the Javascript object known as the XMLHTTP object. This is different for IE5 and 6 (although, if you ask me, whoever still uses IE5 and 6 don't deserve to browse the web), as they use the activex object. It is quite simple to create: //Standard var xmlhttp = new XMLHttpRequest();// code for IE6, IE5var xmlhttp = ActiveXObject("Microsoft.XMLHTTP");} The xmlhttp object has 2 main methods: open(method,url,boolean) method: the type of request: GET or POST (as a string) url: the location of the file. CAN HAVE variables in url (ie. a=1&b=2...) boolean: true (asynchronous) or false (synchronous)- synchronous means the script stops until it gets a response from the server. send(string) If you're using GET, string will be null. Don't send for ActiveX. AJAX has 3 main properties: readyState: The status of the server's response. 0: not initialized 1: connection established 2: request received 3: processing 4: finished and response is ready onreadystatechange: When the state of the request changes, this function will be called automatically. responsetext: The response from the server. Use this when readystate is 4. Don't worry if this doesn't make any sense right now because we're going to do the Hello World example very presently. Hello World in AJAX We only need 2 files: an HTML and a PHP. Let's start with the PHP file. Piece of cake: <?php echo "Hello World!"; ?>Save this as "hello.php" or whatever. Here's a simple HTML file document that calls a function called "ajaxfunction()" which we're going to make now. <html><head><title>AJAX Hello World</title></head><body onload="ajaxfunction()"></body></html> Now, read carefully. The following code, since it's Javascript, should go in the head. I will post what we are doing in the comments. } </script> linenums:0'><script type="text/javascript">function ajaxfunction(){var xmlhttp = new XMLHttpRequest(); //Create the AJAX object.var url = "hello.php"; //The location of the server-side file. xmlhttp.onreadystatechange = function(){ //What we are going to do every time the state of the request changes. if(xmlhttp.readyState==4){ //Only do this if the request is done (4 means done, 3 means processing, etc) alert(xmlhttp.responseText); //Alert to use what the response is from the server. }}xmlhttp.open("GET",url,true); //Open the url using the GET method, true meaning asynchronous (continue with the script while the request is going on).xmlhttp.send(null); //Don't need to send anything, since we used the GET method. Have this anyways.}</script> Load the page, and viola! You get alerted "Hello World!", or whatever you decided to put on your "hello.php". This is just a simple introduction, and yet this is all AJAX really is. There are other AJAX methods like suggest (type something and it gives you suggestions, like google), but the general principle is the same. You might be thinking, "I can make it do that in just javascript!". Well, can javascript access a database? The potential for AJAX is huge. I hope this guide is as comprehensive as I tried to make it.
-
I can't believe you people brought back a thread started in 2004. Well, anyways, 1) Original link doesn't work2) ebooks aren't nearly as good for learning an language vs a forum with skilled users who can give you lessons/advice3) Free templates are terrible. They don't help you learn AT ALL and in no way do I consider that "making" your own website.4) I CAN'T BELIEVE HOW BAD SOME PEOPLE ARE AT SPELLING AND GRAMMAR!
-
Hmm, I don't know why you would categorize C/C++ with HTML and CSS, mainly because CSS and HTML aren't even scripting languages.In any case, all programs the are native to HTML are non-compile open languages (eval function) such as PHP, JS, etc. C, C++, and Java aren't native to HTML and need to be compiled.I do agree that w3schools is an excellent site to learn these languages. I don't understand why you would post w3schools as a site and not the c/c++ site.Side note: does anyone know how to link C++ with HTML other than using a Java framework?
-
No problem! I actually recently started learning jquery and it actually IS easier to use to manipulate elements, yet I'm the kind of person who can't stand not understanding how something works. If I had started with jquery, I would be extremely frustrated on trying to UNDERSTAND the code rather than just using it.When I wrote this, I assumed readers already knew what HTML DOM was. I guess I'll be a little clearer in the future for safety.And yes, I'm also extremely excited about dreamweaver cs5
-
If you really don't want to work with the database, you can always write a script that writes it into a text file: $filepath = "testFile.txt";$fh = fopen($filepath, 'w');$stringData = "Bobby Bopper\n";fwrite($fh, $stringData);$stringData = "Tracy Tanner\n";fwrite($fh, $stringData);fclose($fh); and this would write it into the text file. You can then have PHP read the file and echo it back with fread().
-
Internet Explorer not only can't parse CSS and has Javascript processing speed 200 times slower than Firefox and 250 times slower than safari (I ran the numbers), but it also had so many exploits (which is where most people get viruses these days). To me, Internet Explorer died long ago. I don't even bother to write code for IE6 anymore. It can rot in hell for all I care.
-
Well, I don't own the domain, as it doesn't exist and yet I own a subdomain of the site. Confusing.Well, I don't think I'm going to file a ticket. It's pretty fast and everything works, so I have no complaints. I guess I can buy the domain later if i get enough O_o
-
Uh, OK, big problem.When I registered for the domain, I accidentally put Xisto.net, which doesn't exist... and yet, I have a subdomain there.What do I do? I mean, it exists and I have access to it, so should I just take it as it is?
-
How To Post Pictures On A Website That Cannot Be Copied
Rigaudon replied to anwiii's topic in Websites and Web Designing
Hahaha, I love how we're all posting codes on how to disable right click when he clearly said that he didn't want that in his post. As for me, that's what I get for staying up all night soft resetting Pokemon Emerald trying to get a shiny Treecko. Well, as I can't find any edit button, let's just say I posted it to annoy anwii .