PHP: How to make "Latest visit" count nicer - php4

I have "Your latest 5 visits" at the home page of the user when he logs on. It works great without any problem.
But then i want to change it. I dont know how i should do this, but someway somehow only count the user 1 time at the time, and not e.g 10 times if he visits/refresh your profile.
So should i do this with a time checker? And for how long should it only count 1? When should second count? I need some idea for this, as I dont know if i should make it count 1 time per 10 minutes or 1 time per 1 minute..
So a good solution/giving a good realistic minute tip will answer the question.

There are a number of tutorials about 'Your Last Visit'
http://www.tizag.com/phpT/phpcookies.php

Related

Replacement subjects stop for no reason in Anylogic

I am having a problem keeping my Gilt Replacement Rate slider continuing to add new animals to my model. I have added in a giltQuarantine delay of 8 weeks just after the source block, which helps to visualize how the gilt replacement rate is working.
Everything is working, initially; however, after several weeks, the giltQuarantine delay drops to
0, and no new gilts enter the herd. The Gilt Replacement Rate adds the desired amount to the model, each week, with no stop time listed.
At around 30 weeks, the number of agents in the giltQuarantine delay begins to
decline and finally becomes 0, while the number of sows in the system is only 167. It should be steadily increasing to 1000 sows.
I cannot see why this is happening, as I should have a consistent supply of gilts
entering the herd each week, which the variable giltReplacement says is happening (see Model running at 54 weeks (screenshot 4)).
I also tried increasing the Gilt Replacement Rate, which worked for several weeks,
but then also declined as the number of sows in the system reached 1024. I want my herd size to remain stable at 1000.
Is there any reason that would be causing this decline in replacement animals?
Probably because you limit the total number of arrivals in enterHerd to breedingHerd. Remove the limit and test it.
Also, you can see current rates and other charactistics of flow chart blocks by clicking on them at runtime. Maybe that helps you pinpoint the issue further.
if nothing works, simplify your setup. It is already fairly complex. If you run into this issue now without knowing what causes it, it shows that you do not follow a good modelling approach (add 1 tiny feature, test everything, repeat) :)

DialogFlow confuses time and number

I want to define an intent PlaceReservation that would capture a restaurant reservation. The parameters for that would be numOfPeople and time. Both of those parameters are optional, so a user can say:
get a table for 5 people for 9pm
get a table for 5 people
get a table for 9pm
get a table
get a table for 5
get a table for 9pm for 5 people
get a table for 5 for 9pm
My problem is with the last one, get a table for 5 for 9pm the intent then captures 5 as the hour (5am) and ignores 9pm.
time is defined as a #sys.time system entity.
Is there a way to tell it to not accept simple integers as time, as I think this is what is confusing it?
Is there some other solution I'm missing?
I certainly understand why it is making the mistake, but we, as humans understand how to interpret it, and I want to help DialogFlow interpret it accordingly.
I've had a similar problem and haven't found a proper solution for it yet. In your case you could define your own time entity that consists of entries like 9pm or 10am or even expand it with a composite entity to also let users say "10 in the morning" https://dialogflow.com/docs/entities#dev_composite.
This is definitely confusing for the bot to understand/interpret which one is time & which one is the number of people. Even creating a separate entity for time like 9am/10am won't work cause this does not guarantee that user will enter 9am/pm only. They may not append am/pm ahead of time as well. The solution to your problem can be creating separate intents, first asking users for time & then for number of people. This way you reduce the complexity & can train the bot in a proper way. In addition, you can direct user to a certain direction instead of keeping your bot open for questions.

Google Sheet IMPORTHTML VERY Slow?

I have a spreadsheet that acquires some table data using the IMPORTHTML function, and for the first two days I was using it (refreshing twice daily) things were going fine. As of this morning, it is absolutely crawling. Went from taking ~15 seconds to load 30 rows to taking ~10 minutes. Can somebody lend aid on this?
Example formula:
=IMPORTHTML(
"http://www.muthead.com/16/players/prices/1508-markus-wheaton/playstation-4","table",2
)
As mentioned, the first couple of days it was able to refresh and process a list of 30 without any pauses. Now I get the 'Executing script' message for about ten minutes before it begins to do anything, and I haven't touched the source code since origin. I'm not sure what contributes to the performance of the IMPORTHTML statement...
I've run into similar loading issues when using IMPORTHTML, IMPORTDATA, etc. The best solution I've found is to write a trigger that will edit your formula so it is forced to refresh every hour or so.
Open up the script editor and put this in. Change 'A1' with the cell your IMPORTHTML function is in, and change foo to the URL you're trying to import.
function refreshData() {
var range = SpreadsheetApp.getActiveSpreadsheet().getRange('A1');
range.clear();
range.setFormula('=IMPORTHTML(foo)');
}
Then go to Edit > Current Project Trigger > Add Trigger, and set a refresh interval.
Hope this helps.

Table Simulation Theory Query

I am looking at a question and associated solution for a simple Hand Simulation Table. I'm sorry this isn't a programming question, but probably on of logic. The background to my question is to do with the question shown in the image. It says that.... A customer arrives at the end of every 3 minutes...AND serving takes 4 minutes. If the simulation table was run for 20 minutes using time-driven simulation, it would look like this...
My point of understanding is this...
When Master Clock reaches 06:00 hours, the solution example shows that Customers in Queue is now 1, where I put assume 0. To me, It isn't until Master Clock reaches 07:00 that we have our first customer in queue.
The interpretation of the question is important here, so i stress that the Customers arrive at the end of every 3 minutes and serving takes 4 minutes. My own solution is posted below. Which is right?
PS: Please note, the first column should show Master Clock (mins) not (hours). This is a typo error.
There was an error in the original solution. The new solution i've posted rectifies the error.

How can I see approximate hours worked during the week with mercurial?

So I know about the Mercurial activity extension, however the data it seems to plot is number of commits. I don't think that is a good metric. If in an hour you make 20 commits or 1 commit, I don't think one can deduce much from that. I think it's far safer to say every time there is a commit we assume/input some previous time of work was done. 1-2 or maybe 5 hours (depending on the person). Then you plot that in a block style calendar widget (like github's contribution widget) either by week or by month...
Does anything like what I describe exist?
This has at the very least commit plotted by time of day:
https://bitbucket.org/fundacion_jala/stathg/wiki/Home
But it seems to be more of a point cloud rather than filling out blocks. This doesn't give one an idea as a percentage of the work week, how much has one worked. Not going to mark my answer as correct.