CSS Negative Top Positions Next Element Incorrectly

November 25, 2018 Tags Programming

This may seem like an absolute silly post, but last night after a 5 hour coding session I couldn't figure out why I was having issues with some CSS positioning.

I had three elements, and I wanted the second element to appear on top of the lower part of the first element. So naturally I used:

.second { position: relative; top: -200px; }

At first, cool it works. But the problem is, it basically pushes up the element but doesn't affect the original place it was in, so the third element was appearing much further down and didn't look good at all.

To fix this, I tried the following...:

.second { position: relative; top: -200px; margin-bottom: -200px; }

At first this looked like it worked too, but I was having issues with the height of the third element being screwed up.

Now.. I was really tired, and it took me a ridiculous amount of time to realize that the simple fix was to simply use margin-top with a negative value instead of top:

.second { position: relative; margin-top: -200px; }

And voila, it works like I had intended it to. After that I decided it was time to go to sleep :)

VS Code Delete Every Other Line

June 8, 2018 Tags Programming, Fixes

For some reason, after having edited a file in cPanel's online code editor, when I downloaded said file to my local machine it had empty lines added after every existing line. Of course, this was very ugly and made the file double the length in the editor.

Anyway, here's a quick guide on how to remove these extra lines.

  1. Press ALT+H to open the replace box (top right).
  2. Make sure Regex is enable by clicking the dot+star icon. It will add a color border to it.
  3. Enter (.*)\n\1\n in the search box.
  4. Enter $1\n in the replace box.
  5. Hit replace all, and you're good to go!

cPanel FTP Failed - Unable to connect to port 21 on

May 24, 2018 Tags Programming, Fixes, cPanel

So I woke up to numerous emails from the cPanel Monitor service telling me that the ftpd service was offline. I tried various ways to restart the service but it just wouldn't start, I kept getting the same error message:

warn [restartsrv_pureftpd] The 'pureftpd' service's PID file '/var/run/pure-ftpd.pid' did not appear after 10 seconds.
Waiting for “pureftpd” to restart …………Waiting for pure-ftpd,pure-authd to shutdown ....... terminated.
warn [restartsrv_pureftpd] The 'pureftpd' service's PID file '/var/run/pure-ftpd.pid' did not appear after 10 seconds.

…warn [restartsrv_pureftpd] The 'pureftpd' service's PID file '/var/run/pure-ftpd.pid' did not appear after 10 seconds.


Service Status
pure-ftpd (/usr/sbin/pure-ftpd [...]) is running as root with PID 18545 (systemd+/proc check method).

Service Error
(XID fhx2ad) The “pureftpd” service failed to start.

Startup Log
May 24 13:41:45 [...] systemd[1]: Started Pure-FTPd.
May 24 13:41:45 [...] systemd[1]: Starting Pure-FTPd...

pureftpd has failed. Contact your system administrator if the service does not automagically recover.

I checked CSF Firewall to see if that was somehow blocking the port, I updated the server's plugins and ran a manual cpanel upgrade but nothing worked.

Well, it turns out the culpret is an option in the /etc/pure-ftpd.conf config file.

If you're having issues with PureFTPD and cPanel, check if CallUploadScript is set to yes by running this command in shell:

grep Call /etc/pure-ftpd.conf

If you see "CallUploadScript yes" then you need to disable it as it turns out that when trying to start the pureftpd service it attempts to start the pure-uploadscript service but it wont work. Simple fix is:

vi /etc/pure-ftpd.conf

Find the line that says CallUploadScript yes and change it to no.

Restart ftp service and you're good to go!


Prestashop: Correct File Permissions

April 3, 2018 Tags Programming, Fixes, Prestashop

I noticed, after uploading Prestashop to my webserver and extracting the files, I was getting 500 Internal Server errors. After a bit of testing I figured out the file permissions from having extracted the files were actually incorrect. Directories need to be set at 755 while files should be set at 644.

To save time, I SSH'd into the server and ran these commands after navigating to the public_html folder (or www folder):

chown www-data:www-data  -R *
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

That should assign the correct user to the files, and permissions as well.