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

Saturday, February 26, 2022

What are firebase dynamic links?

 Dynamic Links are deep links into an app that work whether or not users have installed the app yet. When users open a Dynamic Link into an app that is not installed, the app's Play Store page opens, where users can install the app. After users install and open the app, the app displays the deep-linked content.? 


references:

https://support.google.com/firebase/answer/6397032?hl=en#:~:text=Dynamic%20Links%20are%20deep%20links,displays%20the%20deep%2Dlinked%20content.

Saturday, February 19, 2022

RazorPay providing callback url

When integrating with checkout.js, you can also pass a callback_url for redirection-based flow. If popup creation fails for some reason, we will redirect the browser to external page (bank/3D secure page) for customers to fill in OTP/PIN. At the end of the payment, we will return the control back to the callback_url previously created by you on which the payment results will be submitted.

If you reuse your web integration of Razorpay Checkout inside a webview on Android or iOS, the checkout form may not open. However, in certain scenarios, you want to reuse the web integration in a mobile app, you can do so by passing the callback_url along with other checkout options to process the desired payment.

https://razorpay.com/docs/payment-gateway/web-integration/webapp/

Friday, February 18, 2022

pandas isnull and isna are the same?


 Pandas is a two-dimensional data structure that allows you to store data in rows and columns format. It also provides a lot of API methods that can be used for easier data analysis. Two such methods are isna() and isnull()


Both isna() and isnull() functions are used to find the missing values in the pandas dataframe.


isnull() and isna() literally does the same things. isnull() is just an alias of the isna() method as shown in pandas source code.


Missing values are used to denote the values which are null or do not have any actual values. You can use the pd.NaT, np.NaN or None to denote the missing values in the dataframe.


https://www.stackvidhya.com/pandas-isna-vs-isnull/#:~:text=Both%20isna()%20and%20isnull,values%20in%20the%20pandas%20dataframe.&text=isnull()%20is%20just%20an,not%20have%20any%20actual%20values.


Saturday, February 12, 2022

Pandas cheat sheet


references:

https://pandas.pydata.org/Pandas_Cheat_Sheet.pdf

Python adding two dataframes having same columns matching values of a particular column

 df1:
        t1  a         b
    0   USD 2,877   -2,418
    1   CNH 600     -593
    2   AUD 756     -106
    3   JPY 113     -173
    4   XAG 8          0

df2:
    t2  a        b
0   CNH 64      -44
1   USD 756     -774
2   JPY 1,127   -2,574
3   TWO 56      -58
4   TWD 38      -231

print (df1.set_index('t1').add(df2.set_index('t2'), fill_value=0)
          .reset_index()
          .rename(columns={'index':'t'}))

     t       a       b
0  AUD   756.0  -106.0
1  CNH   664.0  -637.0
2  JPY  1240.0 -2747.0
3  TWD    38.0  -231.0
4  TWO    56.0   -58.0
5  USD  3633.0 -3192.0
6  XAG     8.0     0.0

references:

 https://stackoverflow.com/questions/39010614/pandas-adding-two-dataframes-on-the-common-columns