Jump to content

NotionCommotion

Members
  • Content Count

    1,923
  • Joined

  • Last visited

  • Days Won

    9

NotionCommotion last won the day on July 2

NotionCommotion had the most liked content!

Community Reputation

30 Good

About NotionCommotion

  • Rank
    Prolific Member

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks requinix, Regarding documentation, much is no longer valid and applies to earlier versions. Ah, the joys of extending large 3rd party cms systems.
  2. Yes, I too found them in app.css who's first half seems to be a modified version of Bootstrap v3.4.0. Modified being the addition of the .ccm-ui namespace and also some margins, colors, etc are slightly changed (maybe LESS or Sass related?). Both versions have the ../ before fonts so it looks for them at /concrete/css/../fonts/* instead of where they are located at /concrete/css/fonts/*. So, the cause of the error is identified which is great, but without just editing the file, not the cure. I expect there is some "concrete5" thing I need to do when creating a package (concrete5 speak for add-on) which surely is out of scope here. Thanks for getting me half way there. <link href="/concrete/css/app.css?ccm_nocache=ca17add95b11d1baf3d74fcd3fa4637fb02c14ba" rel="stylesheet" type="text/css" media="all"> @font-face { font-family:"Glyphicons Halflings";src:url("../fonts/glyphicons-halflings-regular.eot");src:url("../fonts/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"),url("../fonts/glyphicons-halflings-regular.woff2") format("woff2"),url("../fonts/glyphicons-halflings-regular.woff") format("woff"),url("../fonts/glyphicons-halflings-regular.ttf") format("truetype"),url("../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg"); } .ccm-ui .glyphicon { position: relative; top: 1px; display: inline-block; font-family: "Glyphicons Halflings"; font-style: normal; font-weight: 400; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
  3. Simple search results in 32,774 matches! That being said, won't need to look at each and should be able to track down. Could you elaborate on concrete5 screwing up the path and filenames?
  4. I am creating an add on to a 3rd party CMS called Concrete5. Normally, when I have client issues, I can trace them to the server and fix them, however, this not doing so well on these issues. The following errors are being displayed in Chrome console: Checking the server’s folder directory, it is true there is no concrete/fonts directory but there is a concrete/css/fonts directory with a couple of the missing files (but not glyphiconshalflings-regular.woff2). Back to the errors, clicking the line number (i.e. 927, 3115, and 1), chrome blames apparently innocent line numbers. What steps would you recommend taking to identify the cause and fix these errors?
  5. Thank you kicken, While I think you are mostly correct, not sure if you are completely correct, but you definitely solved me problem! For whatever reason, I just do not enjoy configuring web servers which makes me not very good at it which causes me mysterious issues such as this. Instead, I too often copy and paste and assume things are correct. For https, I use letsencrypt, and just execute sudo certbot --apache which automatically updates the http config file and creates the https config file. After reading your post, I first confirmed that other sites which I do such for are correctly redirecting, and then I compared the conf files to this problem site. For unknown reasons, this just happened to leave out the RewriteEngine on line, and after adding it, it works as expected. Agree your solution is simpler and I believe it is the same as I previously was using before using letsencrypt. Thanks again! <VirtualHost *:80> ... <Directory "/var/www/concrete5/public"> ... </Directory> RewriteEngine on RewriteCond %{SERVER_NAME} =test.example.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost>
  6. Hoping to get another set of eyes. Why isn't this redirecting? I put http://test.example.com in the browser, and it sometimes redirects and sometimes doesn't. I've removed any .htaccess files just to be sure. Thanks <VirtualHost *:80> ServerName test.example.com DocumentRoot /var/www/concrete5/public <Directory "/var/www/concrete5/public"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all RewriteEngine On </Directory> RewriteCond %{SERVER_NAME} =test.example.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> ServerName test.example.com DocumentRoot /var/www/concrete5/public <Directory "/var/www/concrete5/public"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all RewriteEngine On </Directory> Include /etc/letsencrypt/options-ssl-apache.conf SSLCertificateFile /etc/letsencrypt/live/test.example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/test.example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/test.example.com/chain.pem </VirtualHost> </IfModule>
  7. Thanks Psycho and kicken, I will look into the authorized sender and also the spf records. The domain in question is hosted by godaddy and I probably can use one of their email servers. Yeah, "Hello Bob" does sound like something a spammer would say. Do you think it is the name "Bob", whether I should be using "Hey" instead of "Hello", or something else Kicken, your fun anecdote sounds similar to my broken link, but maybe some of the filters have better memory now?
  8. I have a proposal solicitation application where I select typically 5 or so individuals and they get individual emails such as "Hello Bob, please click <here> if you wish to provide pricing for the following scope of work..." It uses PHPmailer with a smtp gmail account. The FROM name is my name, the FROM email is an email account associated with the application <bidding@bidsoliciationapp.com>, and the REPLY-TO name and email are both mine. A while back, individuals have told me that my emails often windup in their spam folder. What might be causing this and what can be done to decrease its likelihood? One potential culprit is all of the emails have a small footer with a disclaimer and a link back to a website, but the link utilized https which was no longer supported on the site and was broken. Maybe related? Thanks
  9. Thanks for the explanation. What also threw me for a loop was when I attempted to compare DateInterval's (i.e. if($di1>$di2)...) similar to comparing DateTime's. It sometimes works but other times does not and one gets different results when stepping through with a debugger opposed to fully running. I think there is a takeaway moral for this one... Just don't do it. Any disagreement? Regarding whether diff-ed DataIntervals are appropriate or diff-ed timestamps, what do you think for getSubstitute()? I have a bunch of time-series data, and when a day or many days is missing data, wish to find another range of data both with the same duration and starts and ends on the same day of the week (guess ends goes without saying). public function read(int $id):array { $results = []; //$data is grouped by day. [['time'=>'2017-06-21','count'=>123]...] $data=$this->getData($id); //Groups is ['gaps'=>[['start'=>'2017-06-21','end'=>'2017-06-21'], ...], 'fills'=>[sameAsGaps]] $groups=$this->getGroups($data); foreach($groups['gaps'] as $gap) { if($substitute=$this->getSubstitute($gap, $groups['fills'])) { $results[$gap['time']]=true; $this->processGroup($gap, $substitute); } else { //No substitute found for this range $results[$gap['time']]=false; } } return $results; } private function getGroups(array $data):array { $gaps=[]; $fills=[['start'=>$data[0]['time']]]; $missing=false; //First group must have data and last group must be the end of data foreach($data as $day) { if($missing) { if($day['count']>$this->minimumSamples) { //End of missing data $missing=false; $fills[] = ['start'=>$day['time']]; $gaps[count($gaps)-1]['end']=$day['time']; } } else { if($day['count']<=$this->minimumSamples) { //Start of missing data $missing=true; $gaps[] = ['start'=>$day['time']]; $fills[count($fills)-1]['end']=$day['time']; } } } $fills[count($fills)-1]['end']=$data[count($data)-1]['time']; return ['gaps'=>$gaps, 'fills'=>$fills]; } public function getSubstitute(array $gap, $fills):?array { $gapStart = new \DateTime($gap['start']); $gapEnd = new \DateTime($gap['end']); $gapInterval=$gapStart->diff($gapEnd); $gapStartTs = $gapStart->getTimestamp(); $gapEndTs = $gapEnd->getTimestamp(); $gapDiffSeconds = $gapEndTs - $gapStartTs; $startWeekDay = $gapStart->format('l'); $endWeekDay = $gapEnd->format('l'); $substitute=null; $substituteOffset=null; foreach($fills as $fill) { $fillStart=new \DateTime($fill['start']); $fillStart->modify($startWeekDay); $fillEnd=new \DateTime($fill['end']); $fillEnd->modify("previous $endWeekDay"); if($fillEnd > $fillStart) { $fillStartTs=$fillStart->getTimestamp(); if(($fillEnd->getTimestamp() - $fillStartTs) >= $gapDiffSeconds) { if($fillStart > $gapStart) { //Fill data is newer than gap data. Takes precidence $offset=$fillStartTs - $gapStartTs; if(is_null($substituteOffset) || $offset <= $substituteOffset) { $substituteOffset=$offset; $substitute=$fill; $substitute['start']=$fillStart; $substitute['end']=(clone $fillStart)->add($gapInterval);; } } else { //Fill data is older than gap data. Does not take precidence $offset=$gapStartTs - $fillStartTs; if(is_null($substituteOffset) || $offset < $substituteOffset) { $substituteOffset=$offset; $substitute=$fill; $substitute['end']=$fillEnd; $substitute['start']=(clone $fillEnd)->sub($gapInterval);; } } } } //else {syslog(LOG_INFO, 'Start time occurs later than end time. Ignore');} } return $substitute; }
  10. If there are two DataTime's which are exactly X seconds apart and the difference between those two DateTime's is added to a third DateTime, then the third DataTime's timestamp would change by exactly X seconds, true? Then why doesn't the second test below show those results, but is off by 1 day? <?php function test(string $start, string $end, string $newStart) { $startDt = new \DateTime($start); $endDt = new \DateTime($end); $intervalDt=$startDt->diff($endDt); $startSeconds=$startDt->getTimestamp(); $endSeconds=$endDt->getTimestamp(); $seconds = $endSeconds - $startSeconds; $dt = new \DateTime($newStart); $newStartSeconds=$dt->getTimestamp(); $dt->add($intervalDt); $newEndSeconds=$dt->getTimestamp(); $newSeconds = $newEndSeconds - $newStartSeconds; $newEnd = $dt->format(\DateTime::RFC3339); echo("original: $start => $end $endSeconds - $startSeconds = $seconds seconds<br>"); echo("new: $newStart => $newEnd $newEndSeconds - $newStartSeconds = $newSeconds seconds<br>"); echo("Error: seconds - newSeconds = ".($seconds - $newSeconds)); } test("2017-06-26T00:00:00Z", "2017-07-09T00:00:00Z", "2018-03-05T00:00:00Z"); echo('<br><br>'); test("2017-12-08T00:00:00Z", "2018-02-15T00:00:00Z", "2018-03-05T00:00:00Z");
  11. Thanks kicken, I think I need to restructure a few things so I can better implement this approach.
  12. Wow, I was totally unaware I could so easily persist an object with methods. I think being able to do so will provide much opportunity which I previously thought wasn't even an option. Per the docs, there are many built-in PHP objects which cannot be serialized. Is there a list? I see that closure too is not allowed as the following closure injected into some sub-object resulted in error: function(int $rpcId){unset($this->stack[$rpcId]);} Also, while all the same instance, I have a PDO instance referenced by many sub-objects as well as multiple instances of PDOStatement (this is a server app and maybe I am wrong but I felt it would be advantageous to create the prepared statements in the constructor so they do not need to be recreated. Valid?). It appears that I might want to add __sleep and __wake to each of my classes and unset PDO upon sleep and restore upon wake. Is this the purpose of these two magic methods and they should actually be used with serialize/unserialize and not instead? For closure, I guess I can just rewrite my classes to instead use a small class (other options?). But what can be done for objects which contains PDO or closurer which have been injected into my object that were created by a 3rd party class imported via composer?
  13. Ah, so I can do much of what I wished with [un]serialize. I had no idea, and had previously thought they were just similar to json_encode/json_decode. This topic is brand new to me and I have never looked into _sleep() and __wakeup() or the Serializable interface. Any recommendations on where to start learning about it?
  14. Hi Gizmola, looking to emulate the full object with its PDO connection, methods, etc. Would be great if [un]serialize() did but I expect it does not.
  15. I have a class which is injected with various objects and those objects contain other objects where some of them contain content from various APIs, user data, etc. I would like to obtain a persistent copy of one of these sub-objects so I may modify my class and test it without having to recreate it each time. Anyway existing tools to automate this process? One thought is using reflection to access all the properties and recursively go over each which somehow creates some JSON file which can act as the input to some factory class to create the same instance? Or maybe some custom function which somehow creates some executable which reflects the bits and bytes in the PHP object? Thanks
×
×
  • 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.