Jump to content

requinix

Administrators
  • Posts

    15,223
  • Joined

  • Last visited

  • Days Won

    427

Community Answers

  1. requinix's post in How do you change the brightness of the image in a DIV when you hover the DIV? was marked as the answer   
    Ah:
    {filter:brightness (50%)} It's silly but you can't have a space between "brightness" and the "(50%)". Remove that.
    TIL
  2. requinix's post in How important is concepts of RDBMS (textbooks like Navathe) for being a SQL developer/administrator? was marked as the answer   
    That sure does look like the fundamentals of RDMSes. Plus a little more than what I would call fundamentals, but still important things that someone should know if you're looking to focus on SQL and databases specifically as a career.
    Are you asking whether this course looks like it would be beneficial to you? If you're not already familiar with most of these things and/or want a formal setting to learn them then sure, it looks beneficial.
  3. requinix's post in XHTML Question I am unsure of. was marked as the answer   
    XHTML? No, this is just regular HTML...
    <header> elements are HTML 5 replacements to writing stuff like <div class="header">, which means things like browsers and screen readers can more accurately understand the nature of a page.
    That means they're geared towards content, not metadata. Which means they belong in the document body.
    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header
  4. requinix's post in XML "reading" problem was marked as the answer   
    When you do stuff with SimpleXML, by default it starts in the "" namespace. But your XML doesn't use the "" namespace. It uses the "http://www.finavia.fi/FlightsService.xsd" namespace.
    Set up that namespace with XPath using registerXPathNamespace(), then try querying it with a namespace prefix.
    // prefix can be anything, xmlns URL is what matters $xml->registerXPathNamespace('f', 'http://www.finavia.fi/FlightsService.xsd'); // names need an f: prefix $otsikot = $xml->xpath('//f:flight[f:fltnr="AY456"]/f:acreg');  
  5. requinix's post in PHP Template Class Rendering with Arrays/Loops/PregMatch/PregReplace was marked as the answer   
    This "2D" array is actually just a regular array like everything else, except that the keys are named like "0" and "1" instead of "logos".
    If I understand the way this works correctly, you should be able to write something like (0)(/name)(/0) to get Steven. If you don't want to write (0) or (1) then you'll have to figure out some new syntax...
  6. requinix's post in Opening one Bootstrap Modal from another Not Working was marked as the answer   
    Shot in the dark, but you don't happen to be reusing that second modal's ID for anything else on the page, are you?
    Can you take the same (partial) markup, stick it into something like JSFiddle, and get it to work?
  7. requinix's post in GDPR account delete request was marked as the answer   
    Done, though the thread can remain.
  8. requinix's post in passing variables to model in view was marked as the answer   
    If you're going to work with PHP then I suggest you learn the fundamentals of PHP. That's going to be really important for you to be able to write code that actually works.
    When you have a grasp on it, spend some time learning about how your MVC framework works. About how views work, and about this $data variable it apparently sets up in the view, and about how to use view classes to pass data.
    I say that because I can see (1) you did not make anything public, and (2) changing $data->mPaperId to just mPaperId actually made your problem worse. What you should (as far as I can see) be doing is leaving mPaper and mPaperId alone, make your mStudylevelId and friends public (and please rename them to not have an underscore), and then using $data in the view to reference those properties. But that could be hard to understand if you don't have a basic knowledge of PHP or of the framework you need to use.
  9. requinix's post in Choices.js cannot "re"setValue() via ajax was marked as the answer   
    Your setChoices creates a new Choices object every time. Evidently the API doesn't like that. You need to create your Choices just once, such as in its own variable (defined outside the function).
    Feel like you've got some slightly larger issues with design here, though...
  10. requinix's post in Find the difference between two dates in non-standard format, mysql was marked as the answer   
    ...What are you using to view the CSV file?
    edit: Nevermind, looks like it does use a localized format after all. Stupid Jira.
    For PHP, use date_parse_from_format() or DateTime's createFromFormat, using the "d/M/y h:i a" format.
    https://3v4l.org/NPZvF
  11. requinix's post in PHP mail() w/pdf attachment showing as text? was marked as the answer   
    The point of a library like PHPMailer isn't so that you don't know what's going on. It's so that you don't have to worry about details - as you put it, so you can "get this to work".
    Because here are the lines where you're doing something wrong:
    $eol = PHP_EOL; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\""; $header .= "--".$uid.$eol; $header .= "Content-type:text/plain; charset=iso-8859-1.".$eol; $header .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $message .= "Content-Disposition: attachment; filename=\"".$filename."\"".$eol; But it's sure not obvious what's wrong about them, right?
    Switch to PHPMailer or SwiftMailer or some other standard library so you can get this problem resolved quickly and move onto the next one.
  12. requinix's post in why do elements go outside the block? was marked as the answer   
    Your .swiper-slide is being overridden by the "swiper-bundle" rules.
    Don't fight the framework. If the swiper wants to have width:100% then put it inside a fixed-width container.
  13. requinix's post in Tables in posts was marked as the answer   
    How about this? It's the table button next to the bullet and numbered list buttons.
  14. requinix's post in install desktop entry was marked as the answer   
    Yeah no, there would definitely be no such thing. That's way too specific for PHP.
  15. requinix's post in Wordpress search engine (searchwp) was marked as the answer   
    Go to the page in question, do a View Source in your browser, and find the HTML for your form. What is the value of the form's action?
  16. requinix's post in directory file list was marked as the answer   
    One-liners are great and all, but is it worth all the time you've spent on it so far? A simple foreach loop could have solved the problem hours ago.
  17. requinix's post in Integer precision issue was marked as the answer   
    That's floating-point arithmetic: the computer can't calculate 573.06 * 100 exactly so it comes up with something close. Something like 57305.9999999999986. And if you truncate that, like with an int cast, then you'll just get 57305. In other cases it might come up with 57306.00000000000005.
    The solution is super simple: round the number instead of truncating it.
    function convertToMoneyInteger($input) { return round($input * 100); } Be careful that your $input is never going to have fractional cents or you'll lose them by rounding to 0 digits. If you're concerned that might be possible, round to an appropriate number of decimal places.
  18. requinix's post in getting the deeper click event was marked as the answer   
    Not quite. Yes, it's displaying the confirmation after you click the button, but it's not displaying it because you clicked the button. What's happening is that you clicked the button (event #1) and then the button, having no other behavior imposed on it to override the default, causes the form to submit (event #2), and that shows the confirmation.
    Additionally, "srcElement" is old, and what you should be using instead of it is "target". And that name communicates the purpose better: it isn't the "source element" of an event, which suggests that it's some element responsible for the event, but rather it's the target of the event - the thing the event is addressing.
    It's a distinction that matters because of how events work and the fact that you can - and will, if you're not careful - receive events for child elements.
    So the target (aka srcElement) during the onsubmit is going to be the form. Not whatever thing that you interacted with that set about the chain of events causing the form to be submitted, but the form the event is associated with.
    Or another way to think about it is, your code is paying attention to the form being submitted when you actually wanted to pay attention to a button being clicked, and that mismatch is your problem.
    But anyway, that "receive events for child elements" thing I said earlier is useful because it means you have a way to listen for a click event on any button in the form by listening to the form itself. That means you don't have to loop over the form's buttons, and you can use a single event handler.
    jQuery makes doing this easy because you can tell it to (1) listen to the form (2) for a click event (3) triggered by a button.
    $("#myform").on("click", "button.form-button", () => { ... }); Native DOM only does the first two parts so you have to handle the third yourself, which isn't hard since .matches exists.
    document.querySelector("#myform").addEventListener("click", (e) => { if (e.target.matches("button.form-button")) { // e.target is the button, e.currentTarget is the form } });  
  19. requinix's post in Injecting a debug object more than 2 levels. was marked as the answer   
    Then all I can tell you is you're doing something differently in this third class that you were/weren't doing in the other two classes.
    Because PHP isn't going to care about how far from the "top" you are: an object is an object. If you can do ->debug on a particular object from one place then* you can do the same ->debug on the same object from a different place.
    Alright. But one question:
    Doing what another way?
     
    * Technically that's not always the case, but it shouldn't be an issue as far as this is concerned.
  20. requinix's post in Crawled websites not inserting into my SQL table | PHP Web Crawler was marked as the answer   
    if (!empty($titleElements)) { You didn't define $titleElements. Thus the $title is empty...
  21. requinix's post in Power App Button Error was marked as the answer   
    Sounds like you're not submitting the data in the format the API requires. Check the documentation for what you should be doing and compare it to what you are actually doing.
    Also, maybe it's just me, but shouldn't that "Select Date" have, you know, some kind of date field associated with it? It's just empty...
  22. requinix's post in Fatal error: Uncaught ArgumentCountError: mysqli_query() expects at least 2 arguments, 1 given in on line 19 was marked as the answer   
    Here's the code you have:
    $query_result = mysqli_query($query); The "procedural style" mentioned in the docs shows this:
    mysqli_query(mysqli $mysql, string $query, int $result_mode = MYSQLI_STORE_RESULT): mysqli_result|bool You read it like this:
    1. This is a function named "mysqli_query"
    2. The first parameter is called $mysql - at least in the documentation itself, you can name your variables whatever you want - and it is a mysqli (that's a class) value
    3. The second parameter is called $query and is a string value
    4. The third parameter is called $result_mode and is an int(eger) value; it has a default value of MYSQLI_STORE_RESULT, which will apply when you do not pass a third argument
    5. The function returns a value that is mysqli_result|bool, meaning it will be a mysqli_result (another class) value or a bool(ean) value
    The Parameters section gives more details about those three parameters. Same for the Return Values section and the return value.
    There's also an Errors/Exceptions that is useful to understand when and why the function may or may not behave correctly.
    But back on topic:
    The first parameter is not optional - there is no default value, so you must provide one yourself. You have done so with your $query variable; remember, your variable can be named whatever you want.
    But there's a problem: the parameter is supposed to be a mysqli value, and you provided a query string.
    The second parameter is not optional either, however you are not providing one. That's what PHP is complaining about.
    If you combine those two facts together, the problem should be pretty clear: you need to call the function with a mysqli and a query string, but you only called it with a query string.
    I'm guessing this was originally based on mysql (no 'i') code? There is a mysql_query function but it isn't the same as the mysqli_query function.
  23. requinix's post in Inserting data into 3 tables, one after the other was marked as the answer   
    To make sure I understand, you have two options:
    (a) Do three normal INSERT statements, and get the auto-incremented IDs of what you need
    (b) Do a normal INSERT and then craft a couple INSERT...SELECT queries based on the raw values you want to insert plus a reference or two to the IDs of the new rows you created that hopefully don't have any duplicates
    I'm thinking you should go for the simpler option.
  24. requinix's post in How to debug an issue in a web server where some users are getting SSL error? was marked as the answer   
    Your first goal should be to reproduce the problem - because you can't know what to fix if you don't know what it is, and if you can't reproduce the problem then how will you know if your fix is working?
    1. Gather more information. What SSL error? Surely there's some more specific information someone can give you? Like an actual error message, maybe?
    2. Apply some logic. Which users are seeing this? What do they have in common? Do they have anything in common at all? Can the users successfully log in at another time?
    3. Think about it from a technical standpoint. There are tons of possible SSL errors (see action item 1) but most of them boil down to the server not giving an appropriate cert. Do you have multiple servers? Is there a load balancer? Geographic CDNs? Are you sure they're all configured with identical information and up-to-date certificates?
    4. Examine the details. "Certain static content not found" isn't any error message I've ever seen before - assuming it's a literal message. Where is it coming from? Under what conditions will it be emitted?
  25. requinix's post in My website won't update records in my SQLyog Database was marked as the answer   
    How do I ask a good question?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.