Jump to content

Fmdpa

Members
  • Posts

    1,035
  • Joined

  • Last visited

Everything posted by Fmdpa

  1. I am absolutely stumped on this problem. I've been trying to solve it for hours and hours. The problem is that whenever I perform the following code, instead of appending this once like it should: <rating> <value>(1-5)</value> <ip>127.0.0.1</ip> <id>id</id></rating> It appends it 21 times! Every time! I even switched my code to using SimpleXML instead of DOMDocument and it still did it! When I dump the XML code onto the page, it only shows it appended once. I am thoroughly confused. Anyway, here's SermonRatings.php: <?phprequire_once 'global.php';class SermonRating { public function add($rating, $sermon) { $domDoc = new DOMDocument(); $domDoc->formatOutput = true; $doc = $domDoc->load('sermon_ratings.xml'); $root = $domDoc->getElementsByTagName('ratings')->item(0); $rating_node = $domDoc->createElement('rating'); $value = $domDoc->createElement('value'); $value->appendChild($domDoc->createTextNode($rating)); $ip = $domDoc->createElement('ip'); $ip->appendChild($domDoc->createTextNode($_SERVER['REMOTE_ADDR'])); $sermon_id = $domDoc->createElement('id'); $sermon_id->appendChild($domDoc->createTextNode(xmlentities($sermon))); // xmlentities() defined in global.php; it is not the problem because this was happening before I added the function $rating_node->appendChild($value); $rating_node->appendChild($ip); $rating_node->appendChild($sermon_id); $root->appendChild($rating_node); $saved = $domDoc->save('sermon_ratings.xml'); return $saved; } // ...other unrelated methods...} $sr = new SermonRating;echo $sr->add(1, 'sermon.wma'); And here's sermon_ratings.xml: <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE ratings [ <!ELEMENT ratings (rating*)> <!ELEMENT rating (value , ip , id)> <!ELEMENT value (#PCDATA)> <!ELEMENT ip (#PCDATA)> <!ELEMENT id (#PCDATA)>]><ratings> </ratings> After I visit sermonRatings.php and those last two lines of code trigger the method execution and the file is modified and saved, there are 21 child <rating> elements in the file. I'm totally confused.
  2. Thanks, that link helped and I think I'll be able to figure it out. Sometimes working with third-party code drives me nuts. Other than very simple, well-documented APIs, this reminded me how much I really dislike working with third-party code.
  3. Inkscape is a similar program that you may want to check out. I've never used it, but it sounds good for what you want to do.
  4. The Git GUI really simplifies a lot of things. I stumbled through using the Git Bash, and it was a tremendous learning experience. But I still prefer GUI tools over it at this point, for the more complex procedures.
  5. I'm using WYMeditor (http://www.wymeditor.org) on a website I'm building. The way the editor works is by inserting an iframe into the page. Unfortunately, that means that there are no styles applied to the content of the iframe. Consequently, I want to insert a stylesheet into the iframe to make it look like what it will when the edit is saved. Here's how I went about it: $('#edit').wymeditor() // initialize wymeditor // add styles to iframe var iframe = $('iframe').first(),style = document.createElement('link') style.type = 'text/css'style.rel = 'stylesheet'style.href = '/styles/styles.css' iframe.contentWindow.document.body.appendChild(style) This works when I enter the "add styles to iframe" section from the console. But when I put them into a script on the page, it doesn't work anymore. I did some debugging to see why, and it is because the iframe is not loaded yet ("undefined"). If I run the function 1 second after the WYMeditor is initialized, then it adds the stylesheet successfully. But there must be a better solution than that, though. Any ideas?
  6. Fmdpa

    Seo Question

    In my sitemap, I have each page on my website automatically logged. My home page's entry, for example, looks like this: <url id="index"><location>http://www.cyberstream.us</location><lastmod>2011-11-10</lastmod><changefreq>weekly</changefreq><priority>1.0</priority></url> Will the search engine bots demote my website's ranking if I don't update it at least once a week?
  7. Actually, when I installed git (from, I believe, here: http://git-scm.com/), it came with a a program called Git GUI which is surprisingly good. If you want an excellent free reference, there is link to a PDF here: http://w3schools.invisionzone.com/index.php?showtopic=40026&view=findpost&p=221950 The Tower client looks pretty sweet, but its mac-only and not free. Come on, shouldn't you have a free GUI for a free, open source VCS?
  8. No - and thank heavens there isn't! That would be a horrible personal privacy violation. The only location data you can get from the IP is the country, and usually the region (province, state, etc.) and city. I wrote a while ago on how I implemented it in my website's analytics (I built my own instead of using Google analytics). The service I use is IPinfoDB, which is completely free if you register. I've been very happy with it.
  9. Fmdpa

    Using Netbeans

    I'll use NP++ for quick edits since it starts up quickly, but I like using Netbeans primarily. It has PHP syntax validation (so it will catch parse errors), and, as Birbal mentioned, autosuggest, which is a big help. Also, you can hold down the Ctrl key and click on a variable name and Netbeans will bring to the line where that variable was defined. You can see the big PHP overview here. You may not use many of the features, but I really like the few features I just mentioned.
  10. Fmdpa

    New Web App

    Considering that you're a Firefox fan, you might want to check out the Firefox Mobile browser. I just checked and they do offer a desktop version of it here. I don't think they have a browser like Opera Mini for tablets, but it may help anyway. Just maybe... As @thescientist said, any serious developer should have every one of 4 major browser rendering engines installed on your computer, i.e. Internet Explorer, Gecko (Firefox's engine), Opera, and Webkit (Safari or Chrome). To make it more complicated, you should also test for Internet Explorer 6, 7, 8 and 9. Even though it is more than a decade old, IE 6 is a very present web browser still. You can test all of these versions of IE in it's developer tools. Of course you'll lose some CSS3 styles in IE8-, but you may need to make some positioning fixes to make the web page readable. I know, it's a pain. You'll learn very quickly why web developers hate IE. Last year when I was really starting to get involved in web development, I installed all major browsers for testing. I was primarily using Firefox/Firebug at the time, but I found myself gravitating towards Opera. Soon I was doing the majority of my testing in Opera and only opening other web browsers when I needed to. It just felt natural to me and I was attracted my its innovative features. It as some quirks, but for me, the advantages outweigh the disadvantages. I really like the features and feel of Dragonfly (Opera's developer tools). Dragonfly feels lightweight and sleek - just like the browser, IMHO. It's a bonus that Opera is doing very well with HTML5 support. It is particularly distinguished in the area of HTML5 elements, especially input elements. I could rave about Opera all day, but that's why I posted this on my blog. It's a little outdated since Opera's made some significant updates over the last couple months, but Opera hasn't gotten any worse for those changes! :Happy:
  11. Fmdpa

    New Web App

    Some tools you may find useful are the Opera Mobile Emulator (the browser many tablets use) and the Opera Mini Simulator. What's really cool is how Opera lets you debug your application with Dragonfly. In your Opera desktop browser, open up Dragonfly (Ctrl + Shift + i). On the Dragonfly icon bar click the remote debug button on the right and click "Apply". It will wait for a host connection. While Dragonfly is waiting for a connection, go to your Opera mobile browser whether it is the emulator or on your phone or tablet. Enter opera:debug into your address field. If you are using the emulator on the same computer as your desktop browser, connect to 127.0.0.1. But if you are using a remote device, find your computer's IP address and connect to it from your phone. If the connection is successfully established, the remote debug icon in Dragonfly will start playing an animation. Then you can add/remove CSS styles in Dragonfly and see the live results on your phone/tablet/emulator!
  12. Fmdpa

    Vcs News

    Yeah, I guess you're right. Both BitBucket and Github offer a free wikis with your projects. I'm not sure if they can be updated via VCS though. That would be interesting to find out.
  13. Fmdpa

    Php Popularity?

    Ruby on Rails is completely free and has a large open-source development community behind it.
  14. Ok, that makes sense. I have Apache start up automatically with Windows and it still doesn't work sometimes. I don't have Skype running, so it's confusing. But if I just restart Apache everything's good.
  15. Fmdpa

    Vcs News

    Beyond README files and changelogs, I have not used my VCS like that before. But I've thought about it before because I really like the idea of having a central remote repository and being able to edit and update files from anywhere.
  16. Yes, you I would recommend easing in to SQL with PHPMyAdmin. I prefer to only do things like creating tables and backups in the PMA. However, you will need to know some amount of SQL code to let PHP interact with the MySQL database (or whatever DB system you are using). Most PHP tutorials and books will include an introduction to SQL just because so many people use SQL and PHP together. One thing you will need to do before you start trying out PHP is install a development server on your computer.
  17. That's great! When I was learning HTML, I made a web page with pretty much every HTML element on it. It helped a lot.
  18. Fmdpa

    Vcs News

    I assumed it was released today because of this tweet. I can't find a release date anywhere to verify, though...oh, here it is, yeah the beta was released today. Yes, Git/Github seem to be very prominent. SVN and Mercurial - not so much. I'm still figuring them out though. Found some excellent resources today: Mercurial: the Definitive Guide (PDF download)Pro Git (PDF Download, also)Version Control with Subversion
  19. Yes, I use it with discretion. If I just want to use the jQuery selectors and maybe a couple CSS assignment shortcuts, I'll choose the more verbose plain JS since including the whole jQuery library isn't worth it. However, if my design includes lots of fades, animations, etc, I'll use it. It's worth noting that there are smaller JS libraries out there that serve specific purposes if you don't need the whole jQuery library.
  20. I completely agree with JSG. While I have the programming skills, creative designs just don't come naturally to me. As for Javascript and PHP, they can be difficult to pick up for someone who is a novice to programming. I'm speaking from experience because when I look back at my first attempts at using Javascript, I cringe at the obvious lack of understanding I displayed in my code. I'd recommend that you move on to PHP because it has a gentle learning curve. Many of its concepts carry over to Javascript, so it could possibly help you understand JS better. Most importantly, practice, practice, practice. When you actually use JS instead of reading about it, it aids the learning process significantly. As with a musical instrument, once you pass a certain point, the light will turn on and you will be able to do almost anything you want. I'm finding that I enjoy programming Javascript more than PHP now that I've become familiar with it. It is incredibly flexible and powerful. Yes, designers work a lot with Photoshop and not usually with any code. However, something you may want to consider is front-end development. Front-end developers work a lot with CSS, HTML, Flash and Javascript. Actually, the current trend has been choking out Flash and replacing it with Javascript. Many very cool websites have been designed lately with jQuery, and Javascript library, and CSS3. An excellent website that shows ways you can use jQuery and CSS3 to create attractive designs is Tutorialzine.
  21. Fmdpa

    Vcs News

    There is some major (IMO) VCS news today. Netbeans 7.1 beta was released today it offers integrated support for Git. It also added support for Mercurial branches and tags. Also, BitBucket added support for Git. Now Git fanatics can take advantage of BitBucket's free private repositories.
  22. Not that I don't like your logo, but sometimes I think minimalism overrules fanciness. Thinking about it more now, though, the default logo may not look so good with your theme. The font you used in your logo complements your theme better. Something that you may want to change is the "sign up" button. It's one of those things you probably missed because you were logged in. It is the original green still.
  23. Cool theme! It must have taken you quite a lot of time to create it. After installing the theme on Firefox, I also ported it to Opera: Install Easy User CSS extension: https://addons.opera.../easy-user-css/Paste this code into the popup when the forum page is open and click "Save". One suggestion: don't you think the new banner icon would look better? It would even fit the color theme.
  24. I'm also building a website for a client and I achieved this by creating a sub-domain on my website. You can do that in your cpanel, if your hosting company allows it. This creates an entirely new directory for that sub-domain. You can put your client's website files in that folder and send them the link to the sub-domain like http://project.yoursite.com
  25. Yeah, that is kinda confusing. I don't see any parse errors in your code. What I'd recommend is checking your error console if you haven't already because if there is an error, it will submit the form.
×
×
  • Create New...