Jump to content

dcole.ath.cx

Members
  • Content Count

    430
  • Joined

  • Last visited

Community Reputation

0 Neutral

About dcole.ath.cx

  • Rank
    Member
  • Birthday 03/01/1989

Previous Fields

  • Languages
    HTML, CSS, JavaScript, PHP, Perl, C++, Java, and BASIC.

Contact Methods

  • MSN
    dcole07@gmail.com
  • Website URL
    http://
  • ICQ
    0
  1. dcole.ath.cx

    Popen worth it?

    I can't find a lot of info on the web about the pros and cons of using popen to help speed up a process. There are cases where somethings just have to be done one right after the other, but other things, such as web pages are often modular. Would web programs, such as CMS and Forums be faster if they used multiple popen functions to process different information at the same time? These programs often have very modular code and it seams like a page could be processed faster with the use of multiple processes. Or is there going to be very little improvement or slowing down by trying to have parallel processes in these kind of web programs? How much data crunching needs to be done to make it worth having more than one pipe?
  2. This is an easy fix. You give both floating divs borders on their touching sides. That is, if the left one is longer it well create the border all the way down and vise versa. The only problem you may run into is having the two borders not positioned on top of one another. Which just means you need to adjust the divs dimensions.
  3. It would be easier to find the problem if you create the page online. Myself, along with a large group of web developers use Firefox's Firebug to correct CSS mistakes.If you don't want to post it online or would like to do it your self, I would recommend getting the Firebug plugin.I would guess that the problem would be with the div tag that makes up the nav, but I don't know how the html is set up and it's hard to track what is the parent of the section that uses #nav.If I was you I would wrap a div tag around the nav and have it create the black background and white top/bottom border. This new div would have a width of 100%. With nav I would set margins to the widths of your "white spaces". This would align the nav in the middle. I would the set the "ul" that makes up the nav list to have an auto margin to center the nav items.text-align: center will ONLY align TEXT, not HTML elements.
  4. If your only going to set the background color, then the best bet would be to use "background-color" tag instead of "background".When I use the "background" tag I always define everything, such as "background: #CCC none repeat scroll 0%;"You can get more information at http://www.w3schools.com/css/css_background.asp
  5. Well I got the preg match to work. It turns out I was look at the wrong source code, I wanted to read XML... so my patterns is: @(<link>.{5,150}</link>)@isx and it works for what I'm doing.
  6. Thank, so I want to pull out URLs that have more that the domain name, something such as:try"><h3><a href="http://sub.example.com/~d/Folder/~3/123456789/">Example...There may not be white space before <a href..., it may have a subdomain, may have many folders that could contain any acceptable URL char.I'm currently messing around with something such as: preg_match('%(<h3><a href="http)(.*?)(">)%is', $line, $matches);My thoughts behind it were: begins with <h3><a href="http, then has *anything*, the ends with ">What should the match phrase look like?
  7. I'm working on a crawler like script. It first opens a page and puts the source code into a variable. I want to pick out the URLs that have <h3><a href=" in front of them and put them into a list. Is their a way to pick the information out of the variable without having to break it up and sift through it? Or what would be the best way for me to do this?Example: example = "<h1>hi</h1><h3><a href="http://example.com">Example Site</a></h3> blah blah blah";link = "http://example.com"; Maybe the best way would to use strpos() and find the beginning and end of the URL, then use substr to get the URL.
  8. I am now the happiest person in the world! :) That code did the trick, but I did change how it added data to tempdata like Justsomeguy suggested.THANKS Synook and Justsomeguy!
  9. So alert("Hello"); does work, but alert(xmlHttp.resonseText); does not. The server.php file is also a plain text file now.The code that calls updateMsgOnBrowser is the following code and it uses XML, should I change it or is there another way of getting the text test from server.php without xmlHttp.responseText? function talktoServer(){ var req = newXMLHttpRequest(); //register the callback handler function var callbackHandler = getReadyStateHandler(req, updateMsgOnBrowser); req.onreadystatechange = callbackHandler; req.open("POST", "server.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); //get the value from the text input element and send it to server var testmsg = document.getElementById("testmsg"); var msg_value = testmsg.value; req.send("msg="+msg_value);}
  10. maybe xmlHttp.responsetext isn't defined, but then what would it be?... Here is everything elseThe PHP code below writes the JSON XML and encodes it. $retval = array('timestamp' => $ts, 'messages' => $tempmessages);include "json.php";$json = new Services_JSON();echo $json->encode($retval); And here is the XML out put, although to get this the PHP file couldn't get the POST data... XML Parsing Error: not well-formedLocation: .../server.phpLine Number 1, Column 1:{"timestamp":1201453071,"messages":["Bot: My responses are limited.","User: ","Bot: hey","User: hi","Bot: hi","User: hi","Bot: hi","User: hi","Bot: hey","User: hi"]}^ That ^ above goes to the {, BTW
  11. I was trying to import XML but it wasn't working and now I'm using JSON... Below is the code that isn't working. What are the errors in the code? The JSON is printing a variable called timestamp and an array called messages. var lastPing = 0;function updateMsgOnBrowser(testXML) { eval("var retval = " + xmlHttp.responseText); var timestamp = retval.timestamp; if (timestamp > lastPing) { lastPing = timestamp; var msg_display = document.getElementById("msg_display"); for (var i = 0; i < retval.messages.length; i++) { var tempdata = tempdata + "<br />" + retval.messages[i]; } msg_display.innerHTML = tempdata; }}
  12. Here is what my javascript looks like when it outputs a single line to the screen. My server.php has the JSON stuff on it now and is outputting the correct information, but I can't write the javascript code so it works correctly. Within updateMsgOnBrowser is the variable msg_display.innerHTML and this has to have the retval.messages in it, but I can't get it to function correctly. The following is the old javascript without the eval code: function whichButton(event){ if(event.keyCode == 13){ talktoServer(); }}function talktoServer(){ var req = newXMLHttpRequest(); //register the callback handler function var callbackHandler = getReadyStateHandler(req, updateMsgOnBrowser); req.onreadystatechange = callbackHandler; req.open("POST", "server.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); //get the value from the text input element and send it to server var testmsg = document.getElementById("testmsg"); var msg_value = testmsg.value; req.send("msg="+msg_value);}// This is the callback functions that gets called// for the response from the server with the XML datavar lastPing = 0;function updateMsgOnBrowser(testXML) { var test = testXML.getElementsByTagName("test")[0]; var message = testXML.getElementsByTagName("message")[0]; var ip = testXML.getElementsByTagName("ip")[0]; var timestamp = test.getAttribute("timestamp"); if (timestamp > lastPing) { lastPing = timestamp; var ip_value = ip.firstChild.nodeValue; var message_value = message.firstChild.nodeValue; var msg_display = document.getElementById("msg_display"); msg_display.innerHTML = " Server got the message: \"" + message_value + "\"" + "<br>Server IP: "+ ip_value + " Server Timestamp: \""+ timestamp + "\""; }}//the following two functions are helper infrastructure to //craete a XMLHTTPRequest and register a listner callback functionfunction newXMLHttpRequest() { var xmlreq = false; if (window.XMLHttpRequest) { xmlreq = new XMLHttpRequest(); } else if (window.ActiveXObject) { // Try ActiveX try { xmlreq = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e1) { // first method failed try { xmlreq = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { // both methods failed } } } return xmlreq;} function getReadyStateHandler(req, responseXmlHandler) { return function () { if (req.readyState == 4) { if (req.status == 200) { responseXmlHandler(req.responseXML); } else { var hellomsg = document.getElementById("hellomsg"); hellomsg.innerHTML = "ERROR: "+ req.status; } } }}
  13. I tried that, but it only wants to take one line or some...
  14. I'm not the best a JavaScript. I'm trying to XML message from a PHP script that looks like <test timestamp=$ts><message1>hi</message1><message2>Hey</message2>...</test>. The message number is variable in quantity and given by var messagenumber.Can someone look through my code and tell me what's wrong. I think one of the errors in how I use final_value when defining the new final_value value. var lastPing = 0;function updateMsgOnBrowser(testXML) { var test = testXML.getElementsByTagName("test")[0]; var size = testXML.getElementsByTagName("size")[0]; var timestamp = test.getAttribute("timestamp"); if (timestamp > lastPing) { lastPing = timestamp; var size_value = size.firstChild.nodeValue; for (i=0; i<=size_value; i++){ var messagename = "message" + i; var message = testXML.getElementsByTagName(messagename)[0]; var message_value = message.firstChild.nodeValue; if(i == 0){ var final_value = message_value; } else{ var final_value = final_value + "<br />" + message_value; } } var msg_display = document.getElementById("msg_display"); msg_display.innerHTML = "<p>" +final_value + "</p>"; }} If this doesn't look good, what would be a better way to get all the variables from a MySQL Databank and print them on a page, but keep updating it without reloading the page by using AJAX.
  15. This doesn't account for Silverlight taking over web apps, but Flash...Well if Flash had an "accident" and "magically" didn't work in the next version of IE or any following version of IE, then Silverlight would have to take over Flash's place. Note: Microsoft would not block flash because that would be illegal... it would just happen "magically" or through an act of God. To add to this, new comers to web development often go through a stage of loving Flash and Microsoft could tap into this and create a generation of Silverlight users.A more likely case however would be added security to protect against "Flash viruses"... but the security would be so annoying Silverlight would have to be used in exchange.
×
×
  • Create New...