Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by justsomeguy

  1. how write a new function without recursion call

    With a long, messy series of nested loops which will end up resulting in the function only allowing a maximum size for the array or size. You should stop worrying and learn to love recursion.
  2. You might also want to look into that type attribute. Maybe values other than 0 give you other options also.
  3. There's no "or" character. That's not to say the particular program you're using doesn't define and use one (if so, it will be in the documentation), but there's not a specific "or" character. In programming languages you would use "|" to represent a bitwise OR operation (|| for boolean OR), but, again, the program you're using would have to look for and support that. I'm not familiar with that program, so I don't know how it works.
  4. The program you're using might support some kind of syntax for specifying multiple values to search for in the attribute, but you would have to check its documentation to see what it expects. The second one you pasted is not valid XML, commas don't go inside an element attribute list. An attribute's value is a single string, but maybe the program you're using looks for that string in particular formats and can split it up or otherwise use it in different ways.
  5. HTML 5.

    Yeah this whole topic is just bizarre. This is a forum for helping people learn how to program, this is not the correct venue to push your chosen morality or pass personal judgment on other people. If you'd like further help through this forum Rewillis, please leave religion and morality out of it and stick to programming. If you find yourself unable to separate those then it's probably best to look for help elsewhere. I'm going to close this topic, if you'd like to start over you're welcome to do that.
  6. Help needed Compiled source unreadable?

    You don't have to encode it, that looks like a failed Microsoft attempt to hide Javascript. I would be surprised if anything other than IE or Edge knows what to do with that, so it's better to leave it out. Javascript code isn't exactly a trade secret. Although it might be the case that the script tags tell the browser that it is encoded. This is the correct script tag to use: <script type="text/javascript" src="file.js"></script>
  7. How to build multimedia website with html

    If you have a question about how to use shadows in CSS, it would save you a lot of time to go to Google and search for that instead of asking and waiting for a response.
  8. Apache Control panel not coming up via http://localhost approach

    You shouldn't have to move or change anything, I'm sure that the Apache config files define a virtual directory (possibly /xampp) which points to a different location not inside htdocs. If you're not looking for a default dashboard, what exactly are you looking for?
  9. Help needed Compiled source unreadable?

    The opening comment refers to jscript.encode. You can download a decoder here. It looks like this site may also offer decoding. If you search for jscript.encode you'll find other information.
  10. Help me with Using JQuery AJAX code

    Note that the referer header is optional and not considered reliable. There are tools you can use to send your own requests to any server, when you do you'll see that you can write whatever you want in the referer. That header is also sometimes removed by various internet security software, and in some cases the browser will not send it at all to avoid information leakage (e.g., when going from HTTPS to HTTP). I was also checking for a referer header in our application on one file, but enough people reported that they were not able to access that and we replaced it with checking the session. A user can create their own referer header (or any other header, for that matter), but they cannot create their own session.
  11. JSON question - simple

    Yes, you would use an array of objects as shown. As far as file types, it's not very common to have a static file only containing JSON that you read from, they just do that because it's an easy example. It's more likely that you'll be sending ajax requests to PHP or another language on the backend which would dynamically generate the JSON (from a database, as in your example). You can use PHP or whatever language to set the content-type for JSON though, rather than saying it's HTML.
  12. How to Change Angular easily to sharing site

    Do you have an example? Do you mean that you're using ajax requests to change the content on the page?
  13. HTML 5.

    As far as bible verses go, I prefer Matthew 6:5.
  14. How to build multimedia website with html

    That's a really vague question. I suppose you start the same way you start with any other website: at the beginning.
  15. htaccess rule not working

    I don't think you'd want to do that, some of those rules you do want to be the last rule processed. You need to order them based on priority though, which rules do you want to happen first in which order.
  16. Convert old PHP site into responsive one

    I don't know how that was set up, but it's including a file called menu.php in a directory based on the language, so maybe whoever built that expected you to create different files for each page and put them in the appropriate language directories, and then change that code on each page to include the files appropriate for that page and language. You should have the same set of files in every language directory, the menu.php file should exist in the directory for every language. I don't know how the original programmer set that up or what they put inside those files, but that's what it looks like. You can make a regular image link, but the URL should include a lang variable set to whatever language you want to use.
  17. That looks better, yes. You're only sending JSON data, and like you've learned when you specify to jQuery that the data type is JSON, it will automatically parse it and fire the success function only if that worked. If you did not specify a data type of JSON then it would return the response as a string. You can also build that array in PHP so that it is an associative array with string names for the keys instead of numbers, and in Javascript that can be decoded as an object with named properties. So you could have data_array[0].id, data_array[0].title, etc.
  18. Well, you're wrong. If you're going to use it as JSON, then it needs to be JSON, that's about as simple as it gets. If you want to fix the parse error, great, we can do that if we see what data you're trying to parse, and what the error message is. But let's not make incorrect assumptions about what the problem is. There's no reason to assume anything, everything can be tested. I know exactly why it's not producing the expected result, because you're trying to pass a bunch of HTML tags and Javascript code to a JSON parser. That's the reason. But, like I said, there is no reason to make assumptions. Add some debugging code to your success function and you'll see exactly what it's trying to do: success: function(jsonData){ console.log('Success callback'); console.log(jsonData); var data_array = JSON.parse(jsonData); console.log(data_array); alert(data_array[0]['podcast_no_item']); } When I run your page right now, your success function doesn't even get called, and there's a PHP error message in the response. I can put a breakpoint on the ajax call to verify that it sends the ajax request, but if I put a breakpoint inside the success function it never gets hit, that function never gets called. I assume that's because jQuery tries to parse the response as JSON and fails, since it is not JSON, and thus it never calls success. The ajax method will also accept functions for error which it will call if the request failed, and there's another one called complete that it calls after either success or error. Right now your success function isn't being called at all, and I assume it's because of the bad data.
  19. Multiple Slideshows on one page

    That doesn't use jQuery. But it's set up to assume just a single one. If you want multiple ones on the same page then you need to distinguish each one, and you need to adjust the code to look for a specific one. For example, in the main container you could give each one a unique ID. Then, in the Javascript code, you get use getElementById to get a reference to the parent container, and then use that to get the child elements with the various class names. If you use the document object it's going to find elements with that class all over the document, but if you use rootElement.getElementsByClassName then it will only get the elements with the class which are children of rootElement, whatever you set that to. It also uses a global variable called slideIndex, you'll also need to change that to something like an array so that you can have one index per slideshow ID. You'll also need to change the click handlers to pass and use the slideshow ID, so instead of, for example, currentSlide(2), you would do currentSlide(2, 'slideshow2') where you pass the ID for the slideshow container so that everything is looking up the data and elements based on a unique ID for each slideshow.
  20. Which Apache ver to use: 2.2 or 2.4

    Unless you have a particular reason for using an older version, it would make sense to use the newest stable version. MariaDB is a fork of the MySQL project after Oracle made some unwelcome changes to MySQL. MariaDB was forked by the original author of MySQL. It should be compatible, but it's on a different development path from what Oracle wanted to do after buying MySQL.
  21. htaccess rule not working

    All of those rules tell Apache that they should be the last rule matched, so if either of those other rules matches it's not going to execute any more. In particular, if that second rule matches it will not execute the third one.
  22. OK, apparently this is a communication issue. That URL IS getting built somewhere, unless you manually typed "[object Object]" onto the end of the URL, which seems like kind of a strange thing for someone to do. So it really, really sounds like Javascript is building that URL and trying to append an object onto the end of it. But I'll leave it up to you to work backwards how that URL ends up on the page to figure out why that's happening. Because my ~20 years of working with Javascript are telling me exactly what's going on, but I haven't seen the code which is actually doing it yet. If you want to disagree with me, that's fine, but I can't help you. That should be fine. That's what echo is for. If the Javascript expects JSON, then only output JSON. Don't output HTML tags or other Javascript code, that's not JSON. Right now your PHP code is outputting HTML script tags and various other Javascript code, and that's a problem if you're trying to parse JSON. This should only be a data exchange between PHP and Javascript, all you need is the actual JSON data, nothing else. Anything else will cause a problem.
  23. Path to Downloading Attachment

    That's not what I'm talking about. That's what I'm talking about. Inside that piece of code, there's a variable called $email. That's the one I'm asking about, not the variable with the same name in the other piece of code. You need to figure out what that $email object is if you want to use that code. First, stop assuming that you can copy and paste any random piece of code and have it work. Both of those pieces of code have requirements. The first one requires an object called $email, and I don't know what that object is supposed to be, I don't know if you do either. The new one uses a variable called $decoded, so again, what is that variable supposed to be? These aren't standalone pieces of code, it's like you pulled them out from the middle of some other code and you're assuming that I can tell you where they came from or something. Neither of them are complex but both of them require other things in the code where they came from.
  24. Convert old PHP site into responsive one

    It looks like it's already doing that. It's including a file depending on the selected language.
  25. Path to Downloading Attachment

    What is $email supposed to be set to in that second piece of code? That's not standalone, it requires other things.