https://medium.com/nerd-for-tech/deploy-your-nodejs-application-to-a-digital-ocean-droplet-step-by-step-guide-3f6f928f776
Saturday, 23 October 2021
Install latest node JS in Ubuntu --> Digital Ocean
//STEP 1:install using curl (PPA)
sudo apt update && sudo apt install curl -y
//STEP 2:install latest version (replace 14.x with requird one(i.e 15.x))
curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
sudo apt install nodejs
nodejs -v
v15.3.0
Saturday, 9 October 2021
Saturday, 25 September 2021
Codepush & Ionic Integration
1. npm install cordova-plugin-code-push
2. npm install @ionic-native/code-push
3. npm install -g appcenter-cli
4. appcenter login
5. ionic cordova build android
//6. appcenter codepush release-cordova -a Digital-Venus/APLUSSBOSS-Android-UAT -m
7. appcenter codepush release-cordova -a Digital-Venus/APLUSBOSS-APP-V2 -m
# Release a mandatory update with a changelog
appcenter codepush release -a <ownerName>/MyApp-ios -c ios/App/App/public/ -m --description "Modified the header color"
# Release a dev Android build to just 1/4 of your end users
appcenter codepush release -a <ownerName>/MyApp-android -c android/app/src/main/assets/public/ --rollout 25
# Release an update that targets users running any 1.1.* binary, as opposed to
# limiting the update to exact version name in the config.xml file
appcenter codepush release -a <ownerName>/MyApp-android -c android/app/src/main/assets/public/ --target-binary-version "~1.1.0"
# Release an update now but mark it as disabled
# so that no users can download it yet
appcenter codepush release -a <ownerName>/MyApp-ios -c ios/App/App/public/ -x
# Release an update signed by private key (public key should be configured for application)
appcenter codepush release -a <ownerName>/MyApp-android -c android/app/src/main/assets/public/ --privateKeyPath ~/rsa/private_key.pem
references
https://github.com/mapiacompany/capacitor-codepush
config.xml
<preference name="APP_SECRET" value="7056bb94-2703-4e01-ab79-66848505b6a9" />
<preference name="APPCENTER_ANALYTICS_ENABLE_IN_JS" value="true" />
<preference name="CodePushDeploymentKey" value="OrnEAKcjIXFcKo4He7YoHaBN9BEIcg35AdbTM" />
Ionic Cordova platform - android 9.1 sdk build tools ^31.0.0 issue
C:\Users\$user\AppData\Local\Android\Sdk\build-tools\31.0.0
This is happened because dx
files are missing from Android SDK Build Tools 31.0.0 and replaced with d8
files. Try to modify Android SDK Build Tools 31.0.0 by:- In the Android SDK Build Tools 31.0.0 folder, create a copy of
d8.bat
and rename it to dx.bat
.
- In the lib folder, create a copy of
d8.jar
and rename it to dx.jar
.
Additional Check ionic cordova version
Method 1
Method 2 :
cordova -v
to see the currently running version. Run the npm info command
npm info cordova
for a longer listing that includes the current version along with other available version numbers
d8.bat
and rename it to dx.bat
.d8.jar
and rename it to dx.jar
.Method 2 :cordova -v
to see the currently running version. Run the npm info command
npm info cordova
for a longer listing that includes the current version along with other available version numbersThursday, 23 September 2021
NPM Specific Version Package
How To Know Package Versions Available
If you want to know the exact version of a package to install, you can simply search for it on the npm public registry database.
Or, you can simply run the following command to check the available versions on the npm registry:
npm view [package-name] versions |
If you want to know the specific latest version of a package available on the npm registry, run the following command:
npm view [package-name] version |
For example, here is how you can check the latest version of the Renovate package:
resource :
https://www.whitesourcesoftware.com/free-developer-tools/blog/npm-install-specific-version/
Sunday, 19 September 2021
Issue with gradle
Apparently you should accept the license,so in your command promp:
cd /d "%ANDROID_SDK_ROOT%/tools/bin"
and then
sdkmanager --licenses
just accept the license and the error should goes away.
request headers in http options (angular)
https://stackoverflow.com/questions/53980413/angular-common-http-has-no-exported-member-requestoptions
Friday, 23 July 2021
Monday, 28 June 2021
PostGresql
Introduction
PostgreSQL is an efficient and flexible database that fits a wide variety of use cases. In this guide, you will learn about different ways to query a PostgreSQL database so that you can create a simple and expressive backend to your app or library.
Let's dive in!
SELECT Statements
The SELECT statement is the fundamental building block of querying your PostgreSQL database. SELECT statements can include several clauses. Some of the more important clauses include:
- FROM
- WHERE
- GROUP BY
- ORDER BY
- LIMIT
The following query showcases a SELECT statement that uses all of the clauses mentioned above.
1SELECT id, first_name, last_name
2FROM person
3WHERE age > 20
4GROUP BY country
5ORDER BY last_name
6LIMIT 10
The above query will grab the first 10 people over the age of 20 from the person
table ordered by their surname and grouped by the country in which they reside. As you can see, a set of columns follows the SELECT keyword in the query. From there, you can specify one or more tables using the FROM
clause. The WHERE
clause is used to filter your returned rows. The GROUP BY
clause is used to group rows together by one or more columns, while the ORDER BY
clause is used to order rows in ascending or descending order. The LIMIT
clause is used to limit the number of rows returned by the query.
There are many more clauses that can be used. Some of these include the different joining clauses and the OFFSET
clause, but these are beyond the scope of this guide. For more information, please check out the documentation.
WITH Queries - Common Table Expressions
WITH
queries, or common table expressions, provide a succinct way to create temporary tables that are only kept in memory until the final query is completed. WITH
queries are often much faster and more readable than creating multiple temporary tables from which to query as well. The below SQL uses a common table expression to select the average ages for dogs and people by their countries.
1WITH dog_ages AS (
2 SELECT AVG(age) AS avg_dog_age, country
3 FROM animals
4 GROUP BY country
5 WHERE species = 'dog'
6), person_ages AS (
7 SELECT AVG(age) as avg_person_age, country
8 FROM person
9 GROUP BY country
10)
11SELECT da.avg_dog_age, pa.avg_person_page, da.country
12FROM dog_ages da
13LEFT JOIN person_ages pa ON pa.country = da.country;
As you can see, common table expressions are a powerful and expressive means of querying your PostgreSQL database. Remember that anywhere you are using a temporary table, you can probably use a common table expression instead and get faster results!
Views
The view is PostgreSQL's way of encapsulating queries such that they can be reused in different parts of your database schema. A view makes it so that your query can be used by other queries, triggers, or functions all across your database. The below SQL is an example of a view that is used to query our mocked person
table.
1CREATE VIEW vw_person_seniors AS
2 SELECT p.id, p.age, p.first_name, p.last_name
3 FROM person p
4 WHERE age >= 65;
Apart from making your queries reusable, views are a great means of making your backend code more readable and maintainable. By creating views, you can structure your queries such that they are separated out by features found within your app. This can dramatically improve the maintainability and separation of concerns within your app's architecture.
Materialized Views
A materialized view is a view that is immediately executed at the time of creation. The results of the query executed by the view are stored on disk and are retrieved when the materialized view is queried. This is huge in terms of performance! A query that takes seconds can be reduced to milliseconds. Below, you can see an example materialized view.
1CREATE MATERIALIZED VIEW mat_person AS
2 SELECT p.id, p.age, p.first_name, p.last_name
3 FROM person p
4 INNER JOIN blog_posts bp ON bp.person_id = p.id;
The biggest downside to using materialized views is that, unless you refresh them by running REFRESH MATERIALIZED VIEW <mat_table>
, you may have stale data when you query the view. This is why materialized views work best when the data you are querying is mostly static and rarely updated.
Conclusion
In this guide, you learned all about the key methods for querying data in PostgreSQL. You learned how SELECT queries comprise the fundamental base for querying a PostgreSQL database and how CTEs (Common Table Expressions) can be used to combine temporary tables together. Building on top of the SELECT query, you learned how to create PostgreSQL views to organize your queries in an elegant manner. You also learned how to utilize materialized views to gain massive performance boosts to your queries when the possibility of stale data is not a problem for your user base.
You can now be confident when it comes to querying your PostgreSQL database. For more information, please check out the PostgreSQL documentation.
We use cookies to make interactions with our websites and services easy and meaningful. For more information about the cookies we use or to find out how you can disable cookies, click here.
Saturday, 26 June 2021
envato market
https://preview.themeforest.net/item/appino-a-perfect-mobile-app-landing-page/full_screen_preview/20601547?_ga=2.176703333.1183745144.1624691820-125615860.1589778961
Sunday, 20 June 2021
Ionic Storage
Store key for ionic async this.storage.get
Array Push After Creating Object JS
name: 'Angular',
};
let newCourse= Object.assign({}, course);
newCourse.name= 'React';
console.log(course.name); // writes Angular
console.log(newCourse.name); // writes React
For Nested Object we can use of 3rd party libraries, for deep copying objects. In case of lodash, use _.cloneDeep()let newCourse= _.cloneDeep(course);
https://stackoverflow.com/questions/39506619/angular2-how-to-copy-object-into-another-object/44199667
Angular - Ionic. Enlarge Photo Viewer
https://stackblitz.com/edit/angular-bkosu5?file=src%2Fapp%2Fapp.component.css
https://morioh.com/p/6bd2fa8478c4
Wednesday, 16 June 2021
PHP-JWT
Note that, by default, Apache will not pass the HTTP_AUTHORIZATION
header to PHP. The reason behind this is:
The basic authorization header is only secure if your connection is done over HTTPS, since otherwise the credentials are sent in encoded plain text (not encrypted) over the network which is a huge security issue.
I fully appreciate the logic of this decision. However, to avoid a lot of confusion, add the following to your Apache configuration. Then the code will function as expected. If you’re using NGINX, the code should function as expected:
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.+)$
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
https://www.sitepoint.com/php-authorization-jwt-json-web-tokens/
Sunday, 13 June 2021
Format Date ( ) JS Functionalities
https://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date
Thursday, 10 June 2021
Install Chocolatey and Update node.js
https://docs.chocolatey.org/en-us/choco/setup
choco install python
choco upgrade chocolatey
Wednesday, 2 June 2021
Session (Native Php)
Maybe depending on PHP settings, but if return values are not the above, then go for this:
_DISABLED = 0
_NONE = 1
_ACTIVE = 2
Universal function for checking session status.
start session
<?php
/**
* @return bool
*/
function is_session_started()
{
if ( php_sapi_name() !== 'cli' ) {
if ( version_compare(phpversion(), '5.4.0', '>=') ) {
return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE;
} else {
return session_id() === '' ? FALSE : TRUE;
}
}
return FALSE;
}
// Example
if ( is_session_started() === FALSE ) session_start();
?>
Unset
<?php
// remove all session variables
session_unset();
Destroy
// destroy the session
session_destroy();
?>
Notes
As a shorthand you can use
@session_start()
with the @ at the beginning to suppress the
PHP notice "A session had already been started - ignoring session_start()"
As stated in the manual for session_start(), a second call will do no harm,
it will be simply ignored. But you need the @, if you don't want to get the notice.