Monday, June 7, 2021

How to find the extensions directory for PHP?

phpconfig

bash-3.2# php-config --extension-dir
/usr/lib/php/extensions/<foldername>

Sunday, May 2, 2021

How to find the executable path of a php,mysql program? - Try which and whereis

You may want to find out where the executable is installed or is being executed from

which php

/usr/php


which mysql

/usr/local/mysql/bin/mysql

 

Alternative command for the same results as above.

whereis php

whereis mysql

echo "">access_log How to clear a log file without deleting it?

 Do you want to debug a file and realize it has too much of content in it.

Let's say the file name is access_log.

just say echo "">access_log.

This will replace the content with the blank file.

Now your file is ready to starting logging data from now :-).

Note: Please use this at your own discretion. This is just a workaround.

How to define a temporary variable in mac Terminal

How to define a temporary variable in mac Terminal?
 

Example1: Lets say I want to store company Name into a temporary variable in a terminal and display it.

export companyName="GGHL"
echo $companyName
GGHL

 

Example2: Display machine name path

export myhomedir=/Userss/${USER}
echo $myhomedir
/Users/username

Saturday, May 1, 2021

Top 5 tips of using meta tag in html web pages to improve SEO

 Meta tags are meta (additional) information usually describing the page and its contents. This is generally for search engines to read and understand the content of your page.

1. Set the charset -
<meta charset="utf-8">
This will ensure that when you go for international character sets, you will not see gibberish. If you do not understand, safely use the above statement for any html page.

2. Set the author name
<meta name="author" content="<author name>">
It is learnt that this information can be helpful in identifying the original author of the content. Search engines do use this information.

3. Search Engine Optimization (SEO)
<meta name="description" content="The important keywords of your article should go in here, so that when a user searches on a search engine, the page rank and the probability of the search results displaying on top results increases."

4. Keywords
<meta name="keyword" content="HTML,CSS,javascript">
Keywords will help Search engines as part of SEO ( Search Engine Optimization ) filter your page when a user uses keywords to search their results. It is also recommended that these keywords be frequently used- not overused in the content of the page being displayed to allow search engine to consider the page and keywords relevant and move your page up the order.

5.Title tag
<title>Your page title</title>
Even though this is not part meta tag, it is worth mentioning that this tag also adds value when a user searches on a Search engine and is an important parameter for SEO (Search Engine Optimizer), a key placeholder.

Friday, April 30, 2021

Where is php.ini located on macOS

Location of php.ini file

 <prompt>:~<username>$ php -ini

List the php modules installed

$php -m

Sample output:

bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom


What is the mantra and meaning of prabh ki simaran ridh sidh no nidh?

Happy Friday, I learnt something new today from a forward from a friend. It's a mantra.
Here's my learning or decoding of what's in it.

prabh ki simran ridh sidh no nidh |
prabh ki simran gyaan dhyaan thath budh |

I came to know that there is a complete mantra Read more

 Since I am no good at vocabulary. I did my part to break it down further.

Prabh -> Prabhu -> God : Prabhu
Simran -> Continuous remembrance
Ridh -> Prosperity : Riddhi
Siddh -> Accomplishment : Siddh-arth
Nau Nidh -> 9 Treasures

Gyaan -> Knowledge ( spiritual or religious knowledge )
Dhyaan -> Contemplation, Reflection, Meditation
Thath -> Supreme
Budh -> To Awkaen, To Know, To become aware or : Buddha

HTH, Please share your wisdom


Wednesday, April 28, 2021

How to find the OS version of a linux remote machine? /etc/os-release

 cat /etc/os-release

Should give you

NAME
VERSION
ID
VERSION-ID
and so -on...

How to find the web server location of html, php files on a remote machine?

 I had to make modifications on a remote machine.But i did not know the location where web server files html or php are located.

ssh username@remotehost
password: #####

bash$cat /etc/httpd/conf/httpd.conf | grep DocumentRoot

# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/var/www/html"

cd /var/www/html

There I was in the directory to proceed further,

Tuesday, April 27, 2021

What do the version numbers mean in NPM modules ^ ~

 

A package with the sequence 4.17.4 is interpreted as Major release, Minor Release and patch.

^4.17.4 - keep major version update minor version

~4.17.4 - keep minor version update patch

4.17.4 - exact version

* - latest version

How to find root directory of NPM modules?

 npm root -g

Monday, April 26, 2021

What is XHR?

 XHR stands for XmlHttpRequest object.

This is the traditional way of accessing data asynchronously.

HTML file has a button that we will use to trigger the event.

!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!--<meta http-equiv="X-UA-Compatible" content-->
<meta name="keyword" content="AJAX">
<meta name="description=" content="AJAX example">
<!-- <script type="javascript" async="" src="js/ajax.js"></script> -->
<title>AJAX Example</title>
</head>
<body>
<div class="container">
<button id="button">Get Data</button>
<br><br>
<div id="output"></div>
</div>
<script src="js/ajax.js"></script>
</body>
</html>



<script src="js/ajax.js"></script>

Saturday, April 24, 2021

Where are the macOS commands located? What are /usr/bin /usr/local/bin directories used for?

We have all heard of /usr/bin /usr/local/bin and so on. Do we know how and why they are organized?Let's get started

/bin - user utilities - cd ls cat bash cp pwd - all these are here. Did you know? 

/sbin - s for system program and administration

ping mount reboot shutdown ifconfig - ring a bell?

/usr/bin - non-system programs - 

awk base64 curl emacs find grep ssh php vim perl php python rake rails sed

/usr/sbin - system daemons(background processes) & system utilities only

chown chmod cron httpd sendmail sshd apachectl - sytem utilities that are user specific

/usr/local/bin - The programs installed over the base operating systems due to a dmg file installation or using a package manager might land up here.

Example: Lets say you install mysql it would be installed in /usr/local/mysql/bin. Similarly php would be installed in /usr/local/php

Summary:
/bin and /sbin - commands provided by OS - /bin - consumers /sbin - system administrators
/usr/bin - utilities used by developers
/usr/sbin - utilities used by OS administrators
/usr/local/bin - compilers/executables softwares installed - php and mysql
/usr/local/sbin - administrative commands for softwares installed - Apache restart, mysql server start re-start

We all use cd, ls and many such commands in the macOS Terminal day in and day out. I am better than yesterday after I learnt this today. I know where to search my executables.

Credits & Thanks to :https://medium.com/@jalendport/what-exactly-is-your-shell-path-2f076f02deb4

Are you feeling low? Top 5 ways to live with coronvavirus COVID-19 pademic

COVID-19 made it's may into 2020 and now 2021.

How do I feel about it? It's mixed emotions.

I miss the strangers, the acquaintances, friends, colleagues and buddies I use to spend time with.We are all aging as the day passes by, our friends and family are not limited to only family.

The pandemic has taken a toil on our mental health. We as people are born to be on the move.

I miss the coffee talks, the cafeteria chats, eleventh hour plans and it all comes down to freedom and independence.

We have now seen a series of lockdowns and unlockdowns but our minds have taken a hit.

I am no spiritual healer not a motivational speaker, but here's how I deal with the ups and downs and high's and low's.

1. Read a book:
I wasn't a voracious reader ever, I've managed to be better than I was. Pick up a book, read 5 pages a day.

2. Health:
I wouldn't suggest this to people. I was overweight and still I am, I had a routine to walk ~10,000 steps a day a year before pandemic and I lost 1.5 kgs a month. I continued this for 14 months and I lost ~20 kgs. This story is for another day.

I walk 3 to 4 times a day - 10 to 15 min walk in my room, jog around. This will clear up your mind.

3. Ask yourself, What am I doing? and What should I be doing?
I picked this from a book. We are become mindful with each day, but with each day we add thoughts to the millions we already have. Our whole life is about thoughts.

If you have work to do and you want to focus, question yourself. What am I doing? You'll notice your brain stops for a second, keeps all thoughts aside and becomes blank. Continuously do this the whole day, you will observe a sense of awareness.

4. Pick a hobby:

 Learn something and start writing. Try to enjoy activities with family. If you like to be alone, pick an area of interest, read and write a blog about it like I am doing now.

5. Time your activities:
Time your activities in the day, use a mobile to time them, you should be able to make a 24 hour plan for yourself in a couple of months. This is how I did it. Time a task let's say read a book for 5 mins or 10 mins. Snooze it if you want to continue it for another 5 mins. Eventually you will find that time that suits your concentration levels.

Remember to take breaks and don't let the breaks break you either.

Cheers,

Ajith


 


What does CRSF stand for?

CRSF stands for Cross-site request forgery.
CSRF is also used as an abbreviation in defences against CSRF attacks, such as techniques that use header data, form data, or cookies, to test for and prevent such attacks.

The app must send a request header called X-CSRF-Token with the value fetch in this call. The server generates a token, stores it in the user's session table, and sends the value in the X-CSRF-Token HTTP response header.

 

Cross-site request forgery, also known as one-click attack or session riding and abbreviated as CSRF (sometimes pronounced sea-surf) or XSRF, is a type of malicious exploit of a website where unauthorized commands are submitted from a user that the web application trusts.

 

cross-site scripting (XSS), exploits the trust a user has for a particular site,
CSRF exploits the trust that a site has in a user's browser.  

 

Source:https://en.wikipedia.org/wiki/Cross-site_request_forgery 

Thursday, April 22, 2021

How to set css color property to red in JQuery

 $('h1').css('color','red')
 $('*').css('color','red')

What is Patmos in the Book of Revelation?

 Patmos is mentioned in the Book of Revelation, the last book of the Christian Bible. 

Patmos, an Aegean island in the north of Greece’s Dodecanese island group, is a significant Christian pilgrimage site. Its Cave of the Apocalypse is where John of Patmos (St. John the Theologian) is said to have written the Book of Revelations.


source:https://en.wikipedia.org/wiki/Patmos

What are the seven Spirits which are before the throne of God? - Revelation 1

I was curious to find out the meaning of "the seven Spirits, which are before the throne of God" which reading the Bible today.

Here's something that I found. Please feel free to add:

 The seven gifts of the Holy Spirit are wisdom, understanding, counsel, fortitude, knowledge, piety, and fear of the Lord

Wednesday, April 21, 2021

How to add google analytics code to blogger blog?

Go to Design mode. Click Theme.

Click Customize drop down > Click Edit as HTML
under head paste your google code from analytics. Steps to get google analytics code is below.

In google analytics go to ADMIN

Then create account and add blog.

If you have already have one, Click Account Management. Close the Popup that comes up.

Look for "Tracking Info" under property>

Click "Tracking Code" under it.

Copy the code under Global site tag.

Paste it now in the section under head.


https://www.youtube.com/watch?v=N3jGnYbkr50

What is Ram Navami

 What is Ram Navami?

It is a sprint Hindu festival that celebrates the birthday of Hindu God Lord Rama.

Ram was born to King Dasharath and Queen Kaushalya in Ayodhya in the Tretha Yug.

Ram is considered the the seventh incarnation of Vishnu.

It is celebrated as ninth day of Chaitra Navratri.

Tuesday, April 20, 2021

How to create a HTTP server, listener and response with NodeJS at runtime?

Pre-requisute: Install nodejs, visual studio code and the http modul

Descrption: The use of createServer from http module - will help create an object that servers as a webserver running on localhost:8080

const {createServer} =require('http');
cons server=createServer((request,response))=>{
    response.writeHead(200,{'Content-Type':'application/json'});
    response.write(JSON.stringify({a:1,b:2,c:3}));
    return response.end();
});

server.listen(8080);

What does this mean?

This means, you can technically launch a webserver on the fly and create a response work temporarily and shut it down. 

I am assuming its a good strategy to not have a webserver always running, but that question is for another day.

Cheers

Credits : https://www.youtube.com/watch?v=TrofE5tDRag

How to copy filepath from Finder and open it in Terminal on MacOS

 Open Finder

If you do not see the Path listed above status bar, do the following.

Select the following Menu Option
View -> Show Path Bar

Now click on any file in the finder window.

You should be able to see the path of the file below

Macintosh > Library > WebServer > Documents > index.html

The format we are looking for is /Library/WebServer/Documents/index.html

Right click on index.html file you should see an option Copy "index.html" as Pathname

Paste it into a Terminal and you should be the path of the format.
/Library/WebServer/Documents/index.html

To open the folder in the Termainal, right click on any folder (blue icons), example Documents in this case or Library. Use "New Terminal Tab at Folder" or "New Terminal at Folder". A new terminal would open with the path set by default.

use pwd to verify the path.

What is prometheus?

Prometheus is a software for mentoring and alerting. The idea it to time 

Similar tools:

Borgman remains internal to Google. Treating time-series data as a data source