-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Sessions are for stuff that needs to be accessed in different parts of the site. If you want data only for the quiz (and what's more, only for that particular quiz) then it doesn't belong in the session. +1 to storing it as hidden inputs in the form. That's what I've done previously: generate the quiz questions and answers ahead of time (a dynamic quiz that pulls from a pool of questions and randomizes it all), serialize and encrypt the data, store that in a hidden input, update the data with answers as they complete the questions, then process it at the end. Assuming the data isn't supposed to be persistent.
-
I'll try to watch for that. I browse on Condensed too and haven't noticed things missing. Which stream are you looking at?
-
Is it lag? Are they there now?
-
Decay? No, there's no decay here: it's just exponential growth between those two levels. Decay is something else.
-
Refresher math lesson: The basic form of an exponential equation is a * (b ** n) + c. That's three constants (a, b, c) and one variable (n); you can throw more constants in there, like go overboard and use a * (b ** (c * n + d)) + e, but you probably won't need so many for this. It's exponential because some constant is raised to the power of some variable, and as the variable increases the result of the equation increases by much more. You have two data points that you want an equation to cover: at level 1 the result should be 500 and at level 99 the result should be 9999. That means you have two equations to start with: a * (b ** 1) + c = 500 a * (b ** 99) + c = 9999 When you have some number of equations and some number of things-to-solve-for, you can find a unique solution if the number of equations is >= the number of things. That's not the case here, which means there are going to be an infinite number of solutions. One option is to eliminate a variable. I chose "a". So b ** 1 + c = 500 b ** 99 + c = 9999 Two equations and two things so there's going to be a unique solution. ...but the math is a pain to find it. So I tweaked the equations a bit by taking the level and subtracting one. b ** (1 - 1) + c = 500 b ** (99 - 1) + c =9999 The first equation loses one of the variables entirely (because anything ** 0 == 1) and so can be solved for the other (c=499), then that can get plugged into the other equation to solve it (b=1.0979663). Fortunately tweaking the equations actually makes sense: at level 1 you should just be at the base stat so the exponential part shouldn't really be kicking in yet.
-
No, the exponent is what's on the right of the **. 1.09 is the base, which is the one on the left of it.
-
There are an infinite number of ways to make a curve that hits (1,500) and (99,9999). Because there's a whole bunch of stuff that could happen in between those two points. This is expressed in your screenshot by the Fast/Middle/Slow slider. The most obvious one would be the simplest: x ** 0 + y = 500 -> y = 499 x ** 98 + y = 9999 -> x ** 98 + 499 = 9999 -> x ** 98 = 9500 -> 98 * ln x = ln 9500 -> 98 * ln x = 9.159 -> ln x = 0.09346 -> x = 1.0979663 1.0979663 ** (level - 1) + 499 = attribute Note that it calculates based on level 1 being the baseline. That makes sense unless the characters actually start at level 0.
-
Tip: with this sort of query+subquery setup, if you have a GROUP BY x, y, z in the inner query then you should probably be joining on x, y, and z in the outer query. Otherwise you'll get duplicates. So here, the inner query searches by roster_no and drill_date, but outside you're only considering drill_date. That means there could be "duplicate" rows where the drill_date is the same but the roster_no is different. That may manifest differently depending on the query, but one way or another if there are duplicate rows on the inside then you'll get duplicate rows on the outside.
-
Use regular sessions, so a session on each device, then associate the session ID with the user record. If it doesn't match on a page load then log the user out.
-
You're reading from an XML file but you haven't posted it, and you're getting errors but you haven't said what they are. Does that about sum it up?
-
Is there a better way to avoid the duplicate code
requinix replied to beginnerForPHP's topic in PHP Coding Help
The only difference between the two is how they determine the start and end dates - one comes from the input and the other from the state date. The rest is the same. So how about pulling that stuff out into a separate function that takes the start and end dates as arguments? -
You'd use namespaces with your classes for the same reason that you'd use directories with your files: because giving each thing some long and complicated name just so that they all stay unique is a pain. Practically speaking, if you use underscores in your class names then you're already using namespaces.
-
Sounds like you're overthinking this. If you want a date and time then you should use a data type that supports a date and time. Storing them separately as a DATE in one column and a TIME in the other makes it more complicated than it needs to be. Then the question is whether you use DATETIME or TIMESTAMP. They are mostly the same, but the key differences are that (a) DATETIMEs have a much wider range of dates they can support and (b) MySQL will reinterpret TIMESTAMPs according to server/client timezone configuration. Longer story short, DATETIME is nice for arbitrary date/time values that your application will manage (like your appointment example) while TIMESTAMP is nice for record-keeping purposes (such as when a table row was written or updated). But it doesn't really matter that much. It's perfectly okay to use DATETIME for everything, so if you're still unsure then just use that and move on to the next challenge.
-
how do i get to remove each item from this code
requinix replied to wixil's topic in Third Party Scripts
That's really easy: put an image or × on the page where you want it to appear. Unless you're talking about some amount of functionality which you haven't explained yet? Maybe there's a particular behavior you have in mind regarding this button that you should tell us about if you want help to do it? -
how do i get to remove each item from this code
requinix replied to wixil's topic in Third Party Scripts
How to do what from where? -
I've tweaked some permissions. Do you see editing options in your list of status updates now?
-
If you have code and are having problems with that code then I suggest a good starting point for us to help you would be for you to post that code.
-
Meaning what?
-
I assume by "no longer works" you mean that you get parse errors from PHP?
-
Sigh. If I were in front of your computer, trying to solve your problem, do you know what I would do? Exactly what I told you to do. If you're willing to try that then I can help. If you aren't then that means you're shopping around for an answer you like, and that is not how good programming works.
-
If the page does not look the way you want then it is not correct.
-
Removed? No, if anything you should be adding rows. Because Bootstrap's grid system relies on using that row > col structure. But don't mind that for the moment. Start with looking at the HTML in your browser. Is it correct? If not, adjust it in the browser until it works correctly, then port the changes you made into the PHP code.
-
<div class="<?php echo $cont <= 2 ? 'col-6 pb-3' : 'col-4'; ?>"> This looks correct: for $cont=1-2 you use "col-6 pb-3" while for $cont=3-5 you use "col-4". Look at the HTML being outputted for this portion of the page. Does it look correct too? Do you need to add a couple <div class="row">?
-
Partial Git commit hashes, so people can see the actual change itself.