-
Posts
15,257 -
Joined
-
Last visited
-
Days Won
430
Community Answers
-
requinix's post in data controller best practices was marked as the answer
The main problem is that you aren't validating the input. Or at least not as far as I can see. Do that, as in validate that the body contains those fields with expected types and doesn't contain anything else, and the question is basically irrelevant...
-
requinix's post in Building a packet format drawer in bash scripting with few lines of code was marked as the answer
Not sure I get what you're trying to get out of this, but I would expect a read/while loop should be able to get the two values in each line, append the values to two arrays, do some quick math with a counter to determine "line" things...
What have you tried so far, what did you expect it to do, and what did it actually do?
-
requinix's post in How to update WordPress & PHP when they are installed by Docker was marked as the answer
I get that you're saving yourself some effort, but when you tell people "I asked a question somewhere else, go see what it was and try to answer" it's typically going to be taken as an insult.
But I'll answer anyway because it doesn't look very good.
According to what I'm seeing in the Docker Hub page, there is no simple upgrade path once the PHP version is no longer supported. Normal Docker practices would allow it, but this image isn't set up to follow normal Docker practices.
So you'll have to go into the container itself and update it manually - like if it was an actual computer running Alpine Linux and you needed to upgrade it. You can look around for instructions on how to do that.
Which means you should reconsider how this all works. For example, you could convert your existing installation to the "Static image" one that's described in the docs... though you'll have to reverse-engineer some of that process in order to preserve the details of your existing setup. But once that process is done and you've converted to a static deployment, future upgrades seem like they would be as simple as updating image versions in your docker-compose. (And you would then do all updates that way - not from within WP itself.)
-
requinix's post in heredocs and bash script to find the key and write respective in yml file? was marked as the answer
yq probably won't work since the lines are commented out, which more or less leaves you with the standard find-and-replace tactics using sed. Like
sed -i '/#cluster.name: MyCluster/s/#//g' filename.yaml
-
requinix's post in php and apache trouble with http chunk encoding was marked as the answer
You commented out the SetEnv?
-
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
-
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.
-
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
-
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');
-
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...
-
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?
-
requinix's post in GDPR account delete request was marked as the answer
Done, though the thread can remain.
-
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.
-
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...
-
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
-
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.
-
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.
-
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.
-
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.
-
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?
-
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.
-
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.
-
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 } });
-
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.
-
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...