Jump to content

ThePsion5

Members
  • Posts

    203
  • Joined

  • Last visited

Everything posted by ThePsion5

  1. Hi guys,I'm iterating through an array and removing objects from it that are one of three possible types. My question is the following: How can I test to see whether an object is an instance of a particular class without knowing anything about the object internally? I know that PHP probably has a function that returns the name of an object/class, but I can't find it. Any suggestions?
  2. ThePsion5

    array

    This should work. $count = count($firstArray);$newArray = array_fill(0, $count, '')
  3. This does solve one problem...However, I wonder if there's a way to enable a PHP extension via a script, as I would like this PHP code to be able to function on servers i may not have administrative priviledges on...
  4. No, I installed via the manual ZIP file...perhaps It's an extension I need to turn on in my php.ini file?
  5. Well, I've tried determining if it's installed by calling the gd_info() function, but recieved an error saying the function didn't exist, which seems like a pretty clear sign that it's not installed, lol - thus the confusion. I got the impression that it should have been enabled as well. I installed PHP as a module, not as a CGI or as part of a package. I wonder if that has anything to do with it?
  6. ThePsion5

    the GD library?

    Hi guys,I'd like to use the GD extension for several PHP applications, but the problem is that these applications need to run on different servers running both php 4.3 and 5.x - the documentation for GD confused me a bit, but my interpretation is that the GD library is not installed by default with php 5.x and anything greater than PHP 4.3 - is this actually the case?Also, is there any way to run the GD library during execution? My basic question is, i suppose, can I use the GD library without needing to reconfigure/reinstall PHP if it's not already included? Thanks in advance!
  7. Hi guys,I'm new to XML, and trying make myself look cool by creating an online resume in XML. To this end, I've created the below schema to assist me with this. The problem is, when I try to validate the document, i'm told that i need to name the first "complexType" element, but when I do that, the validator tells me that the child elements I've declared are invalid...unfortunately, I've looked around and havn't found a good answer to this question...what am I doing wrong?I apolagize for the length of this code segment, by the way. <?xml version="1.0"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType> <xsd:element name="category" type="xsd:string"/> <xsd:element name="type" type="xsd:string"/> <xsd:element name="description" type="xsd:string"/> <xsd:element name="accomplishment" type="xsd:string"/> <xsd:element name="class" type="xsd:string"/> <xsd:element name="link" type="xsd:urireference"/> <xsd:element name="role" type="xsd:string"/> <xsd:element name="Date" type="xsd:string"/> <xsd:element name="status" type="statusType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Development"/> <xsd:enumeration value="In Progress"/> <xsd:enumeration value="Complete"/> <xsd:enumeration value="Ongoing"/> </xsd:restriction> </xsd:element> <xsd:element name="skill"> <xsd:complexType> <xsd:sequence> <xsd:element ref="xsd:name"/> <xsd:element ref="xsd:category"/> <xsd:element ref="xsd:link"/> <xsd:attribute ref="xsd:id"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="project"> <xsd:complexType> <xsd:sequence> <xsd:element ref="xsd:name"/> <xsd:element ref="xsd:status"/> <xsd:element ref="xsd:description"/> <xsd:element ref="xsd:skill" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="coursework"> <xsd:complexType> <xsd:sequence> <xsd:element ref="xsd:class"/> <xsd:element ref="xsd:description"/> <xsd:element ref="xsd:skill" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="job"> <xsd:complexType> <xsd:sequence> <xsd:element ref="name"/> <xsd:element ref="link" minOccurs="0"/> <xsd:element ref="role"/> <xsd:element ref="description"/> <xsd:element name="startDate" substitutionGroup="xsd:date"/> <xsd:element name="endDate" substitutionGroup="xsd:date"/> <xsd:element ref="project" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="school"> <xsd:complexType> <xsd:sequence> <xsd:element ref="name"/> <xsd:element ref="link"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:complexType></xsd:schema> Thanks in advance!
  8. Some people will play anything that looks or sounds remotely MMORPG-ish, no matter how much it sucks.Heck, I played Earth2025 for months before I snapped out of it, hehe.
  9. Exactly, mi amigo. Therefore the only part of the image you see matches the background image perfectly, but since the image itself is modified it looks like it's being viewed through the div.
  10. There's actually a way to simulate transparancy fairly easily with CSS 1.0, so it's completely compatible with any browser that supports CSS (Even Internet Explorer, i believe). It's also somewhat limited and not real transparency, sadly. Here's how it works.Align your primary background image as so (with a fixed position at the top-left corner) : body {background: black url(bg.jpg) 0 0 no-repeat fixed;} Then, modify the original background file by whitewashing it, changing the color balance, or any number of things and align is the same way you did the original background div#wrapper{background: #468 url(bg_different.jpg) 0 0 no-repeat fixed;} The effect is that the #wrapper div appears to be partially transparant. Here's an example of this nifty little trick Example
  11. I'm a PHP/MySQL developer and I'd love to work on a project like this, but I'd like some additional details and more official specifications for what I'll supposedly be doing...I'm even willing to do some work for free, depending on the nature of it.Do you have an official website for this game? How far are you in the development process? You can e-mail me personally at thepsion5@hotmail.com, but I imagine several others might be interested if you disclosed some more concrete details.
  12. You could do that fairly easily, actually...just create a table with an ID field, 'badword' field, and a 'replace' field. Then just write a function in PHP that pull s the badword/replacements from the database and search the string you're testing for said words and replace them. For example: //Retrieves bad words from the database. Call this at the top of your php code and//Reuse the array afterwards to save timefunction get_bad words(){$Result = mysql_query("SELECT badword, replace FROM wordstable");$Array = array();for($i = 0; $i < mysql_numrows($Result); $i++) { $key = mysql_result($Result, 'badword', $i); $value = mysql_result($Result, 'replace' $i); $array[$key] = $value; } return $Array;}//Given an associative array of bad words and replacements, this function replaces//All instances of those wordsfunction replace_bad_words($test, $badwords){ $badkeys = array_keys($badwords); for each($badkeys as $thisbadword) { str_replace($thisbadword, $badkeys[$thisbadword], $test); } return $test;}
  13. I'm not positive, but I believe that there is a difference in the way that IE and Firefox interpret the default margin or padding...I THINK that if you explicitly specify padding and margins it should be identical. Don't quote me on that, though...
  14. That did the trick, actually! At first it got a little weird because I had some float items below the event div, but I was able to figure it out. Thanks!
  15. Unfortunately, I would like the divs to be displayed sequentially like table cells in a single row...setting the display setting of the images to 'block' forces the divs after them onto the next row as well, which I want to try and avoid.
  16. One use of objects I especially enjoy is to display information from a database...this is just a relatively primative example. class MyObject(...variables, excetera...mysql_construct($ResultSet, $row){ ... builds the object from the result ...}display(){ ... returns a formatted version of it ...} $Result = mysql_query("SELECT something FROM somewhere WHERE i = 'am1337'")$count = mysql_numrows($Result);print '<table cols="5">';for($i = 0; $i < $count; $i++){ $ThisObject = new MyObject(); $ThisObject->mysql_construct($Result, $i); print $ThisOBject->display();}print '</table>'; My first programming language was Java, so i'm very used to OO concepts, lol.
  17. Solved! See 3rd reply.Hi,I am trying to set up some CSS for a web page that will allow me to create several sections that display images and text, similar to using a table, which i'm trying to avoid. Instead of this: (header/navigation html code)...<table><tr><td><img src="...">some text</td><td><img src="...">some text</td><td><img src="...">some text</td><td><img src="...">some text</td></tr></table>...(footer code) I have something like this: <div id="events"> <div class="event"><img src="...">text</div> <div class="event"><img src="...">text</div> <div class="event"><img src="...">text</div> <div class="event"><img src="...">text</div></div> Since this will allow the events to be dispayed in a different format if needed.However, I havn't been able to find a good way to allow the text to be displayed on a different line than the images without inserting a <br /> into it, which alters and could break different styles...any ideas?
  18. I've found that javascript handles errors very poorly. A perfect example of this is that (in 100% of my experiences, at least), when javascript encounters an error of some kind it ceases running (obviously), BUT if it's running a function of any kind it always returns true, and this may be part of the problem. I'm guessing one of the following is happening:1. There's some kind of error inside the dialog box (dunno why, but it would explain why the database is always updating)2. The script is being terminated/escaped at some point before the snippet of PHP, and the browser interprets what SHOULD be javascript as HTML, bypassing your conditional statementI dunno about IE, but I know Firefox has some good javascript debugging features and extensions...you should thoroughly test and examine your code in action (alert boxes are your friend ) and you should be able to pin down what's happening fairly quickly.
  19. I havn't done any coding into it yet, I was just researching it to see if it was worth learning for my own personal and professional use. Also, wouldn't it make more sense to just use the non-ActiveX method, or does the javascript version of it not function properly/as well in IE?
  20. You might also want to take a look at the single quotes you have in there...in theory they shouldn't be a problem but I've run into similar issues before, so you might just be better off to change `*` to '*'
  21. Hi guys,I've been reading up on AJAX recently and I like the concept behind it, but every implementation i've seen here at w3schools and several others involves ActiveX scripting, which only works on IE. My question is, how easy is it to write AJAX code without using browser-specific scripts? I hate writing code that works on one browser but breaks in another (and I hate IE, for that matter).
  22. I just tried that and it worked fine, although for some reason it didn't work when i used an echo statement...go figure. Whenever you put it into a variable, the '\n' character does the trick. Thanks!
  23. Hi,I had looked around before but couldn't seem to figure this out - what is the character equivalent to an HTML return...most of the php i wrote dumps HTML code into a variable and then outputs it at the end of the document, but one disadvantage of doing this is that my HTML code has no returns whatsoever, making it completely unreadable. Aside from doing something like this $Output .= ""; how do I go about adding returns to HTML outputted by PHP? Thanks in advance!-Sean
  24. ThePsion5

    database layout

    Yes, using the schema I described you should be able to simply add a BIT field to your table to signify whether a train is onsite or not, and whenever someone wants to view the list of trains onsite you would simply use a select statement like this: SELECT* FROM trains WHERE onsite=1
  25. ThePsion5

    database layout

    Well, I think I may have a solution to your idea that may be better than creating code to automatically reset all the AUTO_INCREMENT IDs.Why not have the database list all the train cars, and then be able to set which ones are on site? That way you can just update the status of each car to determine if it's on-site or not, so you don't have to be constantly creating entries for cars each time a new one arrives.
×
×
  • Create New...