Jump to content

netcarver

PW-Moderators
  • Content Count

    1,668
  • Joined

  • Last visited

  • Days Won

    32

netcarver last won the day on June 16

netcarver had the most liked content!

Community Reputation

2,466 Excellent

About netcarver

  • Rank
    Code Monkey

Profile Information

  • Gender
    Male
  • Location
    UK

Recent Profile Visitors

13,315 profile views
  1. @J_Szwarga Thanks for the post. If you only need to output in 12 hour format, you can probably do it like this within your template files (untested)... # Pull the values from our page's time field... $timeparts = FieldtypeTime::getTimeParts($page->timefield); # Adjust name of field as needed. # Adjust the sign $sign = (empty($timeparts['sign']) ? '+' : '-'; # Create a time, based on the start of today, with the offset hours, mins and seconds from the timeparts. # See: https://www.php.net/manual/en/function.strtotime.php $time = strtotime("today $sign {$timeparts['hours']} hours {$timeparts['mins']} mins {$timeparts['secs']} secs"); # Format it for output as needed, in this case as 12hours with lowercase am/pm marker. # See: https://www.php.net/manual/en/function.date.php echo date("ga", $time);
  2. Hi Chris, I had a chance to try this out today, and it's been pretty useful though I still have a lot to learn about CSPs. One quick observation is that it inserts at the start of the <head> block, before the charset and viewport meta tags. IIRC, the charset and viewport meta-tags are meant to be the first tags in the head block. Will keep experimenting with the module.
  3. @PWaddict You could try Robin's module - https://github.com/Toutouwai/LimitRepeater. I don't know if this could help though, it's just a thought.
  4. Nice, thank you Teppo. I'm pretty impressed by the Contabo VPS S SSD spec - especially the 8gigs of RAM - thanks for pointing to them.
  5. @mr-fan What granularity of data do you need for things that are 5 years old? Do you need to drill down to get the exact temperature given a date and time from 5 years in the past? Or would an average do? If an average would be enough, then have a look at RRDTool. All you'd need to do is feed the data into it, then link the graphs it generates into your PW driven site. Although I've not used RRDTool for about 9 years, I ran it on a Raspberry Pi A (IIRC) to profile my house's thermal performance. I did this by collecting 1 minute temperature samples from a network of 8 x 1-wire temperature sensors I installed in the property. I ran this over a period of about 2 years, and all that data got squished into a fix-sized on-disk DB of a few megabytes. I used a cron job to pull the images from the graph generator and cache them on disk with fixed filenames. I had nginx serve a simple html webpage that referenced the images by name. Worked really nicely on my local network, but the output graphs aren't the prettiest. You might be able to feed the results into grafana or Bernhard's tool if nicer output is needed. If you do need high granularity of the old data, RRDTool isn't the tool for you. @dragan ESPs are a family of Wifi/Cellular capable microcontrollers. Very popular with electronics/systems makers. Example.
  6. Well, I was thinking of Contabo, but now you mention it, could you post both?
  7. @teppo, please could you post the output of lscpu from your vps and let us know which plan you are on. TQ.
  8. Sounds like a useful tutorial. Looking forward to it.
  9. I know this thread is marked as solved - but I wanted to make a few comments. @OLSA FWIW, Tracy Debugger has a scream mode that forces it to ignore the @ supression. Just enable it in the settings page if needed. @demhan If you are using GD, then I think it counts towards your process' memory limit. Try upping the max memory limit for PHP and see if that helps. (Link if needed)
  10. How about this 3D Interactive Mall Map over at Codrops?
  11. @Troost, if you open the network tab and then look at what's failing to load when you try to edit a page, you may get a better idea of what's not being loaded correctly. You'll be looking for 404 or 403 errors for the most part.
  12. In cases like these, the Internet Archive (previously called WaybackMachine) is the go-to source. Here's the article mentioned: https://web.archive.org/web/20181201112507/https://processwire.com/docs/tutorials/but-what-if-i-dont-know-how-to-code/
  13. Fantastic timing - just about to look into this myself for a site. Thank you!
  14. Hi @gebeer Just stumbled across this (I know my reply is a little late,) but it is totally possible to prevent your rest API endpoints from starting sessions by using the $config->sessionAllow; variable. If you define it to be a function that returns bool true or false, then it will be evaluated and the return value determines if the Session class constructor is allowed to start a new session. There's an example of it in the default wire/config.php file at line 245. Reproduced here... $config->sessionAllow = function($session) { // if there is a session cookie, a session is likely already in use so keep it going if($session->hasCookie()) return true; // if URL is an admin URL, allow session if(strpos($_SERVER['REQUEST_URI'], $session->config->urls->admin) === 0) return true; // otherwise disallow session return false; }; You just need to rewrite the function so it returns false for your API endpoint path. Make that change and add it to your site/config.php file, and I think that anything hitting your API endpoint directly will not have a session created for the connection. Hope that helps!
  15. Thanks for the tutorial, Edison. It might be useful if the getIP() method in wire/core/sessions.php#L707 were made hookable. This would allow you to add a hook to ready.php to handle redaction, rather than having to clone the module.
×
×
  • Create New...