Skip to main content

Posts

Reset wordpress Premissions on Linux

 When you try to update wordpress or install /update a plugin and fail to do so, it means you need to reset the folders and files permissions on your server. You can bulk fix the problem by updating the permissions of the directories and files in your web host location: cd /home/www/yourdomainfolder/  In your web directory root run the below command: find . -type d -exec chmod 755 {} \; This would change the access permission to all folders to rwx r_x r_x Now time to change the files permissions to -rw-r--r--  find . -type f -exec chmod 644 {} \; The Directories and files are now reset to the default. If you still face a problem it means you need to change the owner of the folders and files.

Use .htaccess to Redirect to HTTPS

If you are using apache webserver and would like to redirect all your traffic to the Secured Socket Layer protocol SSL, you may do that by editing the .htaccess file which resides on the html root of your hosting directory. To do so please add the below lines to your .htaccess file: #HTTPS Redirect <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] </IfModule> #End HTTPS Redirect

Connect Jupyter Notebook Pandas to Postgres

First install Python library Psycopg2 to connect to PostgreSQL: !pip install psycopg2 Now import the necessary libraries: import pandas as pd import psycopg2 as pg import pandas.io.sql as psql Connect to the DB Server: conn = pg.connect("postgres://username:password@server:port/dbname") Execute a Query: df = pd.read_sql('select* from table_name', conn) df.head()

Google Analytics on Refined Wiki Mobile Theme

Tracking mobile users on Confluence while using Refinedwiki mobile theme is not possible or straightforward using theme configuration. I found a work around that will track users on Google Analytics smoothly. Please follow the below steps: Create a js file, call is analytics.js with the analytics script code, it should look something similar to the below:   (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){   (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),   m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)   })(window,document,'script','//www.google-analytics.com/analytics.js','ga');   ga('create', ' UA-XXXXXX ', 'auto');   ga('set', 'userId',AJS.Data.get("remote-user")); // Set the user ID using signed-in user_id.    ga('send', 'pageview'); Save your script on confluence server confluenceInstall...

linux Server out of Space

You could find your VPS out of space all the sudden especially if you are enabling logging for your website or web apps. First you need to know which directory is taking most of the size, then you can eliminate the problem or ask to increase disk place: Go to the root of your vps by typing on ur shell:# cd / Run: #sudo du -h --max-depth=1 Note which directories are using a lot of disk space . cd into one of the big directories. Run #ls -l to see which files are using a lot of space . Delete any you don't need.

IDLE subprocess didn't make connection Python 3.7

After installing Python on Windows 10. When trying to open IDLE, Python's IDE, you might get a  message saying that " IDLE's subprocess didn't make connection . Either IDLE can't start a subprocess or personal firewall software is blocking the connection ". To solve this issue just run IDLE as an Administrator, by right click on the IDLE icon and click Run as administrator. See Photo below:

ERROR: cross-database references are not implemented

You face this error while trying to query two tables from difference databases in Postgres, as Postgress is unlike SQL Server, you can't join two tables from different databases. Instead you may have One Database with Two different Schemas . Schemas group your data tables separately and give you the flexibility to query and join tables from across schemas in the same Database. So if you have DB1 and DB2, you need to move the tables in DB2 to DB1 but in a new schema. If you are using the public schema in DB2 you need to change the name:   alter schema public rename to new_schema_name ; create schema public ;   Now Backup your Schema: $ pg_dump --format custom --file "my_backup" --schema " new_schema_name " "db2" $ pg_restore --dbname "db1" "my_backup" Your Done. If you have any question please let me know.

Windows font cache service status Stopping

I was trying to install a language package to my MSOffice 2013 and was stuck with an error: Error 1920. Service 'Windows Font Cache Service' (FontCache) Failed to start... In windows search look for services, then check the below service Windows FontCache Service Most likely the service is stopped or stopping or disabled. If you can't start the service what you need to do is install the service again, if you are running windows 10, 7 or 8 this website will help you: http://batcmd.com/windows/10/services/fontcache/   Restore Default Startup Type for Windows Font Cache Service, by downloading the proper restore file to your computer. Run the restore file, restart your machine. All is done. You may install the Language package smoothly now. Good Luck!

Change Confluence Logout Page

To change confluence logout page you need to edit the xwork.xml file located in confuence-x.x.x jar file. The jar file is normally located in installationdirectory [/atlassian-confluence-x.x.x/confluence/WEB-INF/lib/confluence-x.x.x.jar unjar the file as shown the below on the command prompt: jar xf  confluence-x.x.x.jar xwork.xml edit the file and replace the line: <result name="success" type="redirect">${logoutUrl}</result> With your new logout file location. save your work and then rejar xwork.xml to the jar file:  jar uf  confluence-x.x.x.jar xwork.xml Your Done!

Datatables Server Side Processing using Coldfusion

Datatables Server Side Processing using Coldfusion Code: Coldfusion Server Side For Datatables Environment: Datatables 1.10.16, Lucee 5.x, Postgres 9.6 Issue Date: 04/10/2017 Notes: There is no warranty that the code will work on a different environment or different version. You may create the DB table using the postgres.sql script included. This project was tested and fully functioning. Features: Datatables query paging Case Insensitive search filter to all query results. Sort by all fields including date. This repository does not include all Datatables features. In the code I'm only using datatables.js, but you may extend the features.  Repository is available on github .

Enabling Collaborative Editing in Confluence 6.x is a must to be able to use the Rest APIs to Add or Update a Page

If you come a cross the below error when trying to add a page to Atlassian Confluence 6.x: Unable to save changes made outside the editor to ContentId while collaborative editing is disabled confluence api That means your Collaborative Editor is disabled, you need to enable the Collaborative Editing in case you need to run the APIs. If you are running Confluence behind a reverse proxy , what you need to do is to use Confluence internal proxy, this could be done by adding the below to line to Confluence Service: -Dsynchrony.proxy.enabled=true Then restart the service. To learn how to configure system properties click here

Install SSL Certificate on Tomcat OR Confluence Server

The below steps demonstrates how to install Existing Verified Certificates on Confluence server or Tomcat Application Server: 1- You should have your domain certificate and key, for example: company_net.crt company_net.crt 2- You should install openssl, I did it on windows platform: https://wiki.openssl.org/index.php/Binaries 3- run the below command in openssl to generate the .p12 Personal Information Exchange openssl pkcs12 -export -in company_net.crt -inkey company_net.key -out company_net.p12 4- Now move the .p12 to the server and run the keytool to generate the .jks key (Java Key Store), the keytool is normally located in the JDK or JRE directory whether in TOMCAT or JAVA Directory. 5- Run the keytool comman as below: C:\tomacat\jre\bin>keytool -importkeystore -destkeystore c:\mykeystore.jks -srckeystore c:\company_net.p12 -srcstoretype pkcs12 6- Once the .jks is generate go to the server.xml file located in tomcat or confluence config directory and un-co...

How to Show Content on Mobile Devices, Smart Phones and Tablets only

 There are two ways to do that, whether to use javascript or to use css style sheet. Javascript: The code below will redirect the visit to a different page which should be a mobile theme page: <script>  <!--   if (screen.width <= 699) {   document.location = "https://www.mymobilepage.com"; } //--> </script>  CSS: In CSS you can decide which part of your page to show or to hid on a mobile device ora tablet: Show content on mobile devices and tablets: The below div tag shows the content on mobile devices and or tablets:   <div class="showToMobile"> TEXT OR IMAGE FOR MOBILE HERE </div> The below css code contains the style class definition, this should be stored in your .css file on in your style sheet in the head section of your html page:   <style type="text/css"> .showToMobile { display: none;} /* Portrait and Landscape Screens */ @media only screen and (min-device-width...

Linux Bash Vulnerability - Test and Solution

Bash Shell Security Vulnerability There is an important vulnerability in the Linux operating system Bash Shell that has the potential of making your server easily accessible to hackers. By running the test command below, you can see if your bash is vulnerable to exploits. Please run both commands below as root on your server to see if your system is vulnerable. =============================== 1. Log into your server as root 2. Execute the following command: env x='() ; echo vulnerable' bash -c "echo this is a test" 3. If the output is "this is a test", that means that your bash needs to be updated. Please refer to your specific OS below and update your system and bash to latest version. ============================== == and ============================== == 1. Log into your server as root 2. Execute the following command: export dummy='() ; echo "exploited"' 3. Enter the following command afterwards: bash 4. If the output is ...

check memory usage on Linux Centos

free command The free command is the most simple and easy to use command to check memory usage on linux. Here is a quick example $ free -m total used free shared buffers cached Mem: 7976 6459 1517 0 865 2248 -/+ buffers/cache: 3344 4631 Swap: 1951 0 1951 The m option displays all data in MBs. The total os 7976 MB is the total amount of RAM installed on the system, that is 8GB. The used column shows the amount of RAM that has been used by linux, in this case around 6.4 GB. The output is pretty self explanatory. The catch over here is the cached and buffers column. The second line tells that 4.6 GB is free. This is the free memory in first line added with the buffers and cached amount of memory. Linux has the habit of caching lots of things for faster performance, so that memory can be freed and used if needed. The last line is the swap memory, which in this ca...

How to Rest Mysql Server Root Password in Case it was Forgotten

First you need to stop mysql service: / etc / init . d / mysqld stop    Now Start mysql in safemode: mysqld_safe --skip-grant-tables    Login as root:   mysql --user=root mysql   Now run the below:   update user set Password=PASSWORD('new-password') where user='root'; flush privileges; exit;   Finally kill mysql process and start it again:   / etc / init . d / mysqld stop   / etc / init . d / mysqld start