Tuesday, March 29, 2022

What is coefficient of linear expansion?

When a solid is heated, it increases in volume. It increases in length, breadth, and thickness. The increase in length of any side of a solid will depend on the original length l0, the rise in temperature t, and the coefficient of linear expansion α.


The coefficient of linear expansion may be defined as the increase in length per unit length when the temperature is raised 1°C. Thus if the temperature of a rod of length l0 is raised from 0°C to t°C, the new length, lt, will be given by


(21.1)

The value of the coefficient of expansion varies from substance to substance. The coefficients of linear expansion of some common materials are given in Table 21.1.


references:

https://www.sciencedirect.com/topics/engineering/linear-coefficient-of-expansion#:~:text=The%20coefficient%20of%20linear%20expansion%20may%20be%20defined%20as%20the,is%20raised%201%C2%B0C.

Monday, March 14, 2022

What is multiplication rule of probability?

According to the multiplication rule of probability, the probability of occurrence of both the events A and B is equal to the product of the probability of B occurring and the conditional probability that event A occurring given that event B occurs.

If A and B are dependent events, then the probability of both events occurring simultaneously is given by:

P(A ∩ B) = P(B) . P(A|B)

If A and B are two independent events in an experiment, then the probability of both events occurring simultaneously is given by:

P(A ∩ B) = P(A) . P(B)

 references:

https://byjus.com/maths/multiplication-rule-probability/#:~:text=What%20is%20the%20Multiplication%20Rule,given%20that%20event%20B%20occurs.

Saturday, March 12, 2022

What is Shiny App


Shiny is an open source R package that provides an elegant and powerful web framework for building web applications using R. Shiny helps you turn your analyses into interactive web applications without requiring HTML, CSS, or JavaScript knowledge.


Shiny is an R package that makes it easy to build interactive web apps straight from R. You can host standalone apps on a webpage or embed them in R Markdown documents or build dashboards. You can also extend your Shiny apps with CSS themes, htmlwidgets, and JavaScript actions.


install.packages("shiny")


Structure of a Shiny App

Shiny apps are contained in a single script called app.R. The script app.R lives in a directory (for example, newdir/) and the app can be run with runApp("newdir").


app.R has three components:


a user interface object


a server function


a call to the shinyApp function


The user interface (ui) object controls the layout and appearance of your app. The server function contains the instructions that your computer needs to build your app. Finally the shinyApp function creates Shiny app objects from an explicit UI/server pair.


Note: Prior to version 0.10.2, Shiny did not support single-file apps and the ui object and server function needed to be contained in separate scripts called ui.R and server.R, respectively. This functionality is still supported in Shiny, however the tutorial and much of the supporting documentation focus on single-file apps.


One nice feature about single-file apps is that you can copy and paste the entire app into the R console, which makes it easy to quickly share code for others to experiment with. For example, if you copy and paste the code above into the R command line, it will start a Shiny app.


ui

Here is the ui object for the Hello Shiny example.

References:

https://www.rstudio.com/products/shiny/#:~:text=Shiny%20is%20an%20open%20source,%2C%20CSS%2C%20or%20JavaScript%20knowledge.

https://shiny.rstudio.com/gallery/


Monday, February 28, 2022

AWS fixing database errors

This is a good link that is explaining how to do this

 https://aws.amazon.com/premiumsupport/knowledge-center/lightsail-wordpress-fix-database-errors/


Open ssh terminal
vi wp-config.php

Make sure it has the below details

define('WP_ALLOW_REPAIR', true);
define('DB_HOST', '127.0.0.1');
define('DB_NAME','bitnami_wordpress');
define('DB_USER','user');
define('DB_PASSWORD','29wbpY4HjUOu')

Save it by ESC + wq!

Now run mysite.in/wp-admin/maint/repair.php
Or try launching mysite.in/wp-admin

If still does not work, try to connect to the db manually from the terminal by the below command

sudo mysql 'bitnami_wordpress' -h 'localhost' -u 'user' -p
29wbpY4HjUOu

Now if this gives the below error, such as socket error.

In that case, restart  the running services in bitnami

sudo /opt/bitnami/ctlscript.sh status
sudo /opt/bitnami/ctlscript.sh restart
sudo /opt/bitnami/ctlscript.sh status


Now if this does not work,

Reboot the server as well from lightsail console.

If the site does not come up still, we nee to remove the plugins. This can be done by removing the plugins from the file system which is at this path 

/bitnami/wordpress/wp-content/plugins

Github authenticating with Personal Access Token


Creating a token

Verify your email address, if it hasn't been verified yet.


In the upper-right corner of any page, click your profile photo, then click Settings.

In the left sidebar, click  Developer settings.


In the left sidebar, click Personal access tokens.

Click Generate new token.

Give your token a descriptive name.

To give your token an expiration, select the Expiration drop-down menu, then click a default or use the calendar picker.

Select the scopes, or permissions, you'd like to grant this token. To use your token to access repositories from the command line, select repo.

Click Generate token.

To use your token to authenticate to an organization that uses SAML single sign-on, authorize the token. For more information, see "Authorizing a personal access token for use with SAML single sign-on" in the GitHub Enterprise Cloud documentation.


Using a token on the command line

Once you have a token, you can enter it instead of your password when performing Git operations over HTTPS.


For example, on the command line you would enter the following:


$ git clone https://github.com/username/repo.git

Username: your_username

Password: your_token

Personal access tokens can only be used for HTTPS Git operations. If your repository uses an SSH remote URL, you will need to switch the remote from SSH to HTTPS.


If you are not prompted for your username and password, your credentials may be cached on your computer. You can update your credentials in the Keychain to replace your old password with the token.


Instead of manually entering your PAT for every HTTPS Git operation, you can cache your PAT with a Git client. Git will temporarily store your credentials in memory until an expiry interval has passed. You can also store the token in a plain text file that Git can read before every request. For more information, see "Caching your GitHub credentials in Git."

references:

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token