<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jamal</title>
    <description>The latest articles on DEV Community by Jamal (@d3vjamal).</description>
    <link>https://dev.to/d3vjamal</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F178582%2Fca82f451-50ea-4821-86df-52e000c9ddad.PNG</url>
      <title>DEV Community: Jamal</title>
      <link>https://dev.to/d3vjamal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/d3vjamal"/>
    <language>en</language>
    <item>
      <title>Fix AWS amplify React app error on Access Denied error</title>
      <dc:creator>Jamal</dc:creator>
      <pubDate>Fri, 18 Dec 2020 03:07:32 +0000</pubDate>
      <link>https://dev.to/d3vjamal/fix-aws-amplify-react-app-error-on-access-denied-error-3cpj</link>
      <guid>https://dev.to/d3vjamal/fix-aws-amplify-react-app-error-on-access-denied-error-3cpj</guid>
      <description>&lt;p&gt;When I deployed my build react app on AWS amplify, the first landing page is able to load. However, when you defined a path in your router, and try to access it, you would hit Access Denied error:&lt;br&gt;
like /signin first page loaded but unable to go /signup route or any other routes .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcrk8lrnzzqm7vfa7jp5h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcrk8lrnzzqm7vfa7jp5h.png" alt="Alt Text" width="800" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, what i did,&lt;/p&gt;

&lt;p&gt;Go AWS amplify console, select “ Rewrites and redirects ”, add a new rewrite and redirects, click on “ Open text editor ”, and add the below rule:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[{
    "source": "&amp;lt;/^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf)$)([^.]+$)/&amp;gt;",
    "target": "/index.html",
    "status": "200",
    "condition": null
}]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1a4dgc5htl6v5gih33in.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1a4dgc5htl6v5gih33in.png" alt="Alt Text" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try again to access your url, it should work now.&lt;/p&gt;

&lt;p&gt;Stackoverflow answer:&lt;br&gt;
&lt;a href="https://stackoverflow.com/questions/63546586/access-denied-error-from-protected-routes-from-react-app-hosted-on-aws-amplify" rel="noopener noreferrer"&gt; https://stackoverflow.com/questions/63546586/access-denied-error-from-protected-routes-from-react-app-hosted-on-aws-amplify&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>react</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Docker Node Alpine Image Build Fails on node-gyp</title>
      <dc:creator>Jamal</dc:creator>
      <pubDate>Wed, 23 Sep 2020 09:23:28 +0000</pubDate>
      <link>https://dev.to/d3vjamal/docker-node-alpine-image-build-fails-on-node-gyp-585l</link>
      <guid>https://dev.to/d3vjamal/docker-node-alpine-image-build-fails-on-node-gyp-585l</guid>
      <description>&lt;h2&gt;
  
  
  Docker node:7.9-alpine unable to build package due python is not installed :Resolved
&lt;/h2&gt;

&lt;p&gt;I'm attempting to Dockerize a node.js application(Typescript). I'm using the node:12.18.4-alpine Docker image as a base.&lt;/p&gt;

&lt;p&gt;I go this&lt;/p&gt;

&lt;h2&gt;
  
  
  gyp ERR! configure error
&lt;/h2&gt;

&lt;p&gt;gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.&lt;br&gt;
gyp ERR! stack at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)&lt;br&gt;
gyp ERR! stack at PythonFinder. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)&lt;br&gt;
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)&lt;br&gt;
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)&lt;br&gt;
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16&lt;br&gt;
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5&lt;br&gt;
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5&lt;br&gt;
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:159:21)&lt;br&gt;
gyp ERR! System Linux 3.10.0-957.el7.x86_64&lt;br&gt;
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/code/server/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/code/server/node_modules/bcrypt/lib/binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v67"&lt;br&gt;
gyp ERR! cwd /code/server/node_modules/bcrypt&lt;br&gt;
gyp ERR! node -v v11.9.0&lt;br&gt;
gyp ERR! node-gyp -v v3.8.0&lt;br&gt;
gyp ERR! not ok&lt;br&gt;
node-pre-gyp ERR! build error&lt;br&gt;
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/code/server/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/code/server/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)&lt;br&gt;
node-pre-gyp ERR! stack at ChildProcess. (/code/server/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)&lt;br&gt;
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:197:13)&lt;br&gt;
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:978:16)&lt;br&gt;
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)&lt;br&gt;
node-pre-gyp ERR! System Linux 3.10.0-957.el7.x86_64&lt;br&gt;
node-pre-gyp ERR! command "/usr/local/bin/node" "/code/server/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"&lt;br&gt;
node-pre-gyp ERR! cwd /code/server/node_modules/bcrypt&lt;br&gt;
node-pre-gyp ERR! node -v v11.9.0&lt;br&gt;
node-pre-gyp ERR! node-pre-gyp -v v0.12.0&lt;br&gt;
node-pre-gyp ERR! not ok&lt;br&gt;
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/code/server/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/code/server/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)&lt;br&gt;
npm WARN &lt;a href="mailto:backend-botmanagementservice@1.0.0"&gt;backend-botmanagementservice@1.0.0&lt;/a&gt; No description&lt;br&gt;
npm WARN &lt;a href="mailto:backend-botmanagementservice@1.0.0"&gt;backend-botmanagementservice@1.0.0&lt;/a&gt; No repository field.&lt;br&gt;
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: &lt;a href="mailto:fsevents@1.2.7"&gt;fsevents@1.2.7&lt;/a&gt; (node_modules/fsevents):&lt;br&gt;
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for &lt;a href="mailto:fsevents@1.2.7"&gt;fsevents@1.2.7&lt;/a&gt;: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})&lt;br&gt;
........&lt;/p&gt;

&lt;p&gt;my docker file was&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt; &lt;span class="c"&gt;#MY first stage, that is the Builder&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;node:12.18.4&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;ts-sample-builder&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm run clean
&lt;span class="k"&gt;RUN &lt;/span&gt;npm run build
&lt;span class="c"&gt;# My Second stage, that creates an image for production&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;node:12.18.4&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;ts-sample-prod&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=ts-sample-builder ./app/dist ./dist&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package* ./&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--production&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; npm run start-prod&lt;/span&gt;
&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 3001&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To reduce image size I change node version node:12.18.4-alpine then it caches issues as I mentioned above.&lt;/p&gt;

&lt;p&gt;When using alpine, you need to install build dependencies for some node modules to be able to be built natively. It should probably be documented&lt;br&gt;
Note:&lt;br&gt;
if just use the base as node:12 or any other version your image size will be more than 1GB some cases.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.freecodecamp.org/news/speed-up-node-re-builds-leveraging-docker-multi-stage-builds-and-save-money-65189a4ab115/" rel="noopener noreferrer"&gt;How to speed up Node re-builds by leveraging Docker multi-stage builds&lt;/a&gt;&lt;br&gt;
if you are using alpine, you need to install build dependencies for some node module to be able to be built natively.&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; node:8.12-alpine&lt;/span&gt;
&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 8080&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;
&lt;span class="c"&gt;#python&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;apk add &lt;span class="nt"&gt;--no-cache&lt;/span&gt; &lt;span class="nt"&gt;--virtual&lt;/span&gt; .gyp &lt;span class="se"&gt;\
&lt;/span&gt;        python &lt;span class="se"&gt;\
&lt;/span&gt;        make &lt;span class="se"&gt;\
&lt;/span&gt;        g++ &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apk del .gyp
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["npm", "start"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Docker and Node.js Best Practices&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#node-gyp-alpine" rel="noopener noreferrer"&gt;Docker and Node.js Best Practices&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will suggest you for checking bcrypt $ bcryptjs npm docs.&lt;br&gt;
&lt;a href="https://www.npmjs.com/package/bcrypt#dependencies" rel="noopener noreferrer"&gt;node-gyp only works with stable/released versions of node. Since the bcrypt module uses node-gyp to build and install, you'll need a stable version of node to use bcrypt. If you do not, you'll likely see an error that starts with:&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkrq1f7c8by3mnicz7r53.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkrq1f7c8by3mnicz7r53.png" alt="Alt Text" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the end, It resolves all issues like slow build  &amp;amp;Python is not installed &amp;amp;, etc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#My first stage, that is the Builder
FROM  node:12.18.4-buster AS build
#RUN apk add --update --no-cache \
#    python \
#    make \
#    g++
COPY . .
# If you have native dependencies, you'll need extra tools
RUN npm install
#RUN npm install
RUN npm run build
RUN npm prune --production
#CMD npm run start-prod
#EXPOSE 3001
## My Second stage, that creates an image for production
FROM node:12.18.4-alpine
WORKDIR /app
COPY --from=build ./dist ./dist
COPY --from=build ./node_modules ./node_modules
CMD npm run start-prod
EXPOSE 3001
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It worked for me! &lt;/p&gt;

&lt;p&gt;learn more about multi staging.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/capital-one-tech/multi-stage-builds-and-dockerfile-b5866d9e2f84" rel="noopener noreferrer"&gt;Using Multi-Stage Builds to Simplify And Standardize Build Processes&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>beginners</category>
      <category>typescript</category>
      <category>node</category>
    </item>
    <item>
      <title>Add Me to Search: Google Launches Virtual Business Cards</title>
      <dc:creator>Jamal</dc:creator>
      <pubDate>Wed, 12 Aug 2020 17:01:47 +0000</pubDate>
      <link>https://dev.to/d3vjamal/add-me-to-search-google-launches-virtual-business-cards-gg3</link>
      <guid>https://dev.to/d3vjamal/add-me-to-search-google-launches-virtual-business-cards-gg3</guid>
      <description>&lt;p&gt;Google is testing virtual business cards in search results that show up when a person’s name is searched for.&lt;/p&gt;

&lt;p&gt;Now rolling out in India, Google’s new ‘people cards’ let individuals highlight themselves in search results like never before.&lt;br&gt;
For searchers, it can be challenging to find information about specific people if they don’t have a strong online presence.&lt;/p&gt;

&lt;p&gt;Google India Tweet :&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5upabs650uxn0zdwhp2l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5upabs650uxn0zdwhp2l.png" alt="Alt Text" width="581" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Google aims to address these challenges with people cards:&lt;/p&gt;

&lt;p&gt;Today, we are solving these challenges with a new feature called people cards. It’s like a virtual visiting card, where you can highlight your existing website or social profiles you want people to visit, plus other information about yourself that you want others to know.&lt;/p&gt;

&lt;p&gt;People cards are designed for business professionals, performers, influencers, entrepreneurs, job hunters, freelancers, or anyone looking to grow their presence online.&lt;/p&gt;

&lt;p&gt;The prime purpose of people cards is to allow individuals to have a public profile on Google Search that will be displayed on top of all results. It was initially spotted as profile cards in February.&lt;/p&gt;

&lt;p&gt;Google claims that with people cards, it is aiming to provide “helpful and reliable information” to the public. Thus, it gives the option to all users to flag abuse, impersonation, or even low-quality content, if they find anything odd through people cards. The search giant is also touting to have a combination of human review and automated techniques in place to flag policy violating content. Furthermore, only one people card is allowed per Google Account to limit fake profiles.&lt;/p&gt;

&lt;p&gt;Individuals who have already created their cards on Google have the ability to opt-out of the experience anytime. In case of people who share the same name, Google Search will show multiple modules.&lt;/p&gt;

&lt;h1&gt;
  
  
  How secure is People Cards?
&lt;/h1&gt;

&lt;p&gt;To make sure people find reliable and helpful information, the tech giant has put together several protections and controls. It has also added safeguard mechanisms to protect against offensive content.&lt;/p&gt;

&lt;p&gt;There is a feedback button with the help of which users can identify and report low-quality information or a card that they believe was created by an impersonator.&lt;/p&gt;

&lt;p&gt;For people looking to find someone on Search with their name, the card will be available. There will be a module with the name, profession and location which users can tap to see their card.&lt;/p&gt;

&lt;p&gt;For people who share the same name, the Search will show multiple modules. The unique information will help users distinguish between different individuals to find accurate information.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create your own people card on Google
&lt;/h2&gt;

&lt;p&gt;To create your own people card, sign into your Google Account and search for “add me to Search”. You'll now see a prompt saying, “Add yourself to Google Search.” Tap that prompt and then you'll be asked to provide your phone number that will be verified through a six-digit unique code to begin the process.&lt;/p&gt;

&lt;p&gt;Google said that for every new card, the user must authenticate the account with a unique mobile number. He/she will have complete control of the information to be included on the card and can opt-out of the experience anytime, which will stop their details from appearing in Search.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuixetedrov8kjxfhmnf1.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuixetedrov8kjxfhmnf1.jpeg" alt="Alt Text" width="300" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Image credit:Google Image search&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to create your People Card on Google Search&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Step 1: To create a People Card, users will first need to sign in to their Google Account, search for their name on Google Search&lt;/p&gt;

&lt;p&gt;Step 2: Tap on the "add me to Search" option that appears on the page&lt;/p&gt;

&lt;p&gt;Step 3: Upload an image of yourself from your Google account, add a description and links to social profiles or websites. You can even include your phone number or email address if you want it on your virtual visiting card&lt;/p&gt;

&lt;p&gt;Step 4: Tap on the "save" option and that's it.&lt;/p&gt;

&lt;h5&gt;
  
  
  hope you find this informative
&lt;/h5&gt;

</description>
      <category>beginners</category>
      <category>social</category>
    </item>
    <item>
      <title>Counting Valleys Code Challenge Solved</title>
      <dc:creator>Jamal</dc:creator>
      <pubDate>Mon, 29 Jun 2020 04:09:55 +0000</pubDate>
      <link>https://dev.to/d3vjamal/counting-valleys-code-challenge-solved-42pd</link>
      <guid>https://dev.to/d3vjamal/counting-valleys-code-challenge-solved-42pd</guid>
      <description>&lt;p&gt;A valley is a sequence of consecutive steps below sea level, starting with a step down from sea level and ending with a step up to sea level.&lt;/p&gt;

&lt;p&gt;Given Gary's sequence of up and down steps during his last hike, find and print the number of valleys he walked through.&lt;/p&gt;

&lt;p&gt;For example, if Gary's path is s=[DDUUUUDD], he first enters a valley 2 units deep. Then he climbs out and up into a mountain 2 units high. Finally, he returns to sea level and ends the hike.&lt;br&gt;
Gary is an avid hiker. He tracks his hikes meticulously, paying close attention to small details like topography. During his last hike he took exactly n steps.&lt;/p&gt;

&lt;p&gt;For every step he took, he noted if it was an uphill, U, or a downhill, D step. Gary's hikes start and end at sea level and each step up or down represents a 1 unit change in altitude.&lt;/p&gt;

&lt;h1&gt;
  
  
  On Hackerrank change this function :JavaScript
&lt;/h1&gt;

&lt;h1&gt;
  
  
  function countingValleys(n, s) {
&lt;/h1&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let e= 0;
let travel = 0;
for (let i = 0; i &amp;lt; n; i++) {
    if (s[i] === "D") {
        --e;
    } else if (s[i] === "U") {
        if (++e === 0) travel++;
    }
}
return travel;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.hackerrank.com/challenges/counting-valleys/problem?h_l=interview&amp;amp;playlist_slugs%5B%5D=interview-preparation-kit&amp;amp;playlist_slugs%5B%5D=warmup" rel="noopener noreferrer"&gt;Here Link&lt;/a&gt;&lt;br&gt;
full details here: &lt;a href="https://www.hackerrank.com/challenges/counting-valleys/problem?h_l=interview&amp;amp;playlist_slugs%5B%5D=interview-preparation-kit&amp;amp;playlist_slugs%5B%5D=warmup" rel="noopener noreferrer"&gt;https://www.hackerrank.com/challenges/counting-valleys/problem?h_l=interview&amp;amp;playlist_slugs%5B%5D=interview-preparation-kit&amp;amp;playlist_slugs%5B%5D=warmup&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>hackerrank</category>
    </item>
    <item>
      <title>How-to: call() , apply() and bind() in JavaScript</title>
      <dc:creator>Jamal</dc:creator>
      <pubDate>Thu, 25 Jun 2020 07:12:11 +0000</pubDate>
      <link>https://dev.to/d3vjamal/how-to-call-apply-and-bind-in-javascript-4op8</link>
      <guid>https://dev.to/d3vjamal/how-to-call-apply-and-bind-in-javascript-4op8</guid>
      <description>&lt;p&gt;This post covers some basic concepts in JavaScript. Every JavaScript programmer must know the concept and clear&lt;/p&gt;

&lt;h2&gt;
  
  
  Call()
&lt;/h2&gt;

&lt;p&gt;The call() method calls a function with a given this value and arguments provided individually.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Syntax&lt;/em&gt;&lt;br&gt;
&lt;em&gt;func.call([thisArg[, arg1, arg2, ...argN]])&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flxv7nma61np20cz7aij0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flxv7nma61np20cz7aij0.png" alt="Alt Text" width="800" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  apply()
&lt;/h2&gt;

&lt;p&gt;Similarly to call() method the first parameter in apply() method sets the "this" value which is the object upon which the function is invoked. In this case, it's the "obj" object above. The only difference of apply() with the call() method is that the second parameter of the apply() method accepts the arguments to the actual function as an array.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsexcsiesgqmbw54tlslf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsexcsiesgqmbw54tlslf.png" alt="Alt Text" width="800" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  bind()
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Syntax&lt;/em&gt;&lt;br&gt;
let boundFunc = func.bind(context);&lt;/p&gt;

&lt;p&gt;In JavaScript, function binding is happens using Bind() method. by this method, we can bind an object to a common function, so that the function gives different result when its need.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9q54t62pn98rnhiizol7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9q54t62pn98rnhiizol7.png" alt="Alt Text" width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's all for now. Thank you for reading and I hope this post will be helpful for beginners who are facing issues regarding the apply(), call(), and bind() methods of JavaScript.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>stuartinhcity</category>
    </item>
    <item>
      <title>What's New in Angular 9</title>
      <dc:creator>Jamal</dc:creator>
      <pubDate>Tue, 31 Dec 2019 13:17:30 +0000</pubDate>
      <link>https://dev.to/d3vjamal/what-s-new-in-angular-9-1nga</link>
      <guid>https://dev.to/d3vjamal/what-s-new-in-angular-9-1nga</guid>
      <description>&lt;h1&gt;
  
  
  New Features in Angular 9
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;JavaScript Bundles and Performance&lt;br&gt;
We’ll start by looking at one of the problems that plagued previous versions of Angular: large bundle files that have negatively impacted download times and, as a consequence, application performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ivy Compiler&lt;br&gt;
The big new feature we'll dive into is the Ivy compiler. We'll explain what Ivy does and why it's actually an important feature for the future of Angular (it solves some of the problems with large bundles and application performance).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Selector-less Bindings and Internationalization&lt;br&gt;
We'll touch on a few other new features, including selector-less bindings and internationalization support. You'll see why we're calling this an evolutionary release rather than revolutionary.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Benchmarking Angular 8 and the Pre-release Version of Angular 9&lt;br&gt;
We’ll run some benchmark tests to compare performance between Angular 8 and a pre-release version of Angular 9.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Added Angular 9 Features -&lt;br&gt;
1.Added undecorated classes migration schematic in the core.&lt;br&gt;
2.The formControlName also accepts a number in the form&lt;br&gt;
3.Now allow selector-less directives as base classes in View Engine in the compiler&lt;br&gt;
4.Added support selector-less directive as base classes in Ivy and also make the Ivy compiler the default for ngc.&lt;br&gt;
5 Convert all ngtsc diagnostics to ts.Diagnostics&lt;br&gt;
6.bazel: support ts_library targets as entry-points for ng_package.&lt;br&gt;
7.core: add dynamic queries schematic.&lt;br&gt;
8.core: Mark TestBed.get as deprecated.&lt;br&gt;
9.ivy: expose window.ng.getDebugNode helper and also support ng-add in localize package.&lt;br&gt;
10.ivy: i18n – add syntax support for $localize metadata block.&lt;br&gt;
11.ivy: i18n – reorganize entry-points for better reuse.&lt;br&gt;
12.language-service: enable logging on TypeScriptHost.&lt;br&gt;
13.language-service: provide diagnostic for invalid templateUrls.&lt;br&gt;
14.language-service: provide diagnostics for invalid styleUrls.&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript Bundles and Performance
&lt;/h2&gt;

&lt;p&gt;One of the ongoing problems with previous Angular versions is the relatively large file size of the app — more precisely, the file size of the generated JavaScript bundles. If you compare Angular to other libraries such as React or Vue.js, the Angular app is significantly bigger.&lt;/p&gt;

&lt;p&gt;At runtime, you probably won’t feel the difference. While Angular runtime performance is good, the loading can take longer because even a simple app can be relatively large.&lt;/p&gt;

&lt;p&gt;The size of the JavaScript bundles also hints at another problem: there's more to learn with Angular because Angular is a complete framework with many built-in developer tools, while other JavaScript libraries are more focused on components.&lt;/p&gt;

&lt;p&gt;So what could the Angular team do to mitigate the problems stemming from the large bundle files in earlier Angular versions?&lt;/p&gt;

&lt;h1&gt;
  
  
  Understanding Angular ViewEngine
&lt;/h1&gt;

&lt;p&gt;Before Angular 8, the framework relied exclusively on ViewEngine (sometimes referred to as the "VE") to build and render code in browsers. Angular components are written using the TypeScript language. TypeScript is a superset of JavaScript, and we use a compiler or "transpiler" to render TypeScript into a dialect of JavaScript that runs in the browser. Angular historically has relied on ViewEngine to do this transpiling from TypeScript code into JavaScript.&lt;/p&gt;

&lt;p&gt;The Angular ViewEngine takes the templates and components and translates them into regular HTML and JavaScript so that the browser can interpret and display them.&lt;/p&gt;

&lt;h1&gt;
  
  
  Angular Ivy and Faster Mobile Apps
&lt;/h1&gt;

&lt;p&gt;Smartphones and other mobile devices account for about half of the website traffic worldwide. A considerable percentage of these mobile devices access web pages from locations that suffer from slow internet connections.&lt;/p&gt;

&lt;p&gt;Developers can redesign existing apps to reduce the size of the downloadable assets and enhance the mobile user experience, but these changes can be difficult, expensive, and introduce unforeseen risks to their projects.&lt;/p&gt;

&lt;p&gt;By reducing the size of JavaScript bundles, Ivy becomes a welcome improvement for developers trying to speed up application startup.&lt;/p&gt;

&lt;h1&gt;
  
  
  Smaller Bundles and Better Performance Thanks to Ivy
&lt;/h1&gt;

&lt;p&gt;Previous versions of Angular have relatively large file size of the final bundles compared to React or Vue.&lt;/p&gt;

&lt;p&gt;The performance of the Angular runtime is quite good but the loading time is longer because of the large file size which affects the overall performance of the application.&lt;/p&gt;

&lt;p&gt;So what the Angular team is doing to solve the large size of the final bundles?&lt;/p&gt;

&lt;p&gt;Enter Ivy.&lt;/p&gt;

&lt;p&gt;Before Angular 8, the framework used ViewEngine as the renderer,&lt;br&gt;
With Angular 8, Ivy is in experimental mode behind an optional flag,&lt;br&gt;
With Angular 9+, Ivy is the default compiler.&lt;br&gt;
What is Ivy?&lt;/p&gt;

&lt;p&gt;Ivy is a complete rewrite of the Angular renderer which is simply the part of Angular that transforms your Angular templates into JavaScript code.&lt;/p&gt;

&lt;p&gt;Angular components are a mix of TypeScript code, HTML and CSS. TypeScript is a superset of JavaScript, that needs to be compiled into JavaScript before it can be consumed by a web browser.&lt;/p&gt;

&lt;p&gt;Angular previuosly made use of ViewEngine to transform TypeScript code to JavaScript.&lt;/p&gt;

&lt;p&gt;The Angular ViewEngine transforms the templates and components to HTML and JavaScript so that the browser can render them.&lt;/p&gt;

&lt;p&gt;These are some informations about Ivy:&lt;/p&gt;

&lt;p&gt;The Ivy compiler is abtsracted from developers, and will replace ViewEngine so what you know about Angular is still valid.&lt;br&gt;
Angular 8 allows developers to play with Ivy but with Angular 9, Ivy is the default renderer.&lt;br&gt;
The Ivy compiler outputs much smaller JavaScript bundles, so Ivy solves Angular’s bundle problems.&lt;br&gt;
The Ivy compiler will not change how you work with Angular so what you previosly learned about Angular will still work in Angular 9+.&lt;/p&gt;

&lt;p&gt;Angular 9.0.0-next.5&lt;br&gt;
A build with Angular 9.0.0-next.5 yielded a slightly small main.js file at 214KB. That's a 13 percent improvement from Angular 8.&lt;/p&gt;

&lt;h2&gt;
  
  
  Angular 9.0.0-rc.7
&lt;/h2&gt;

&lt;p&gt;Bug Fixes&lt;br&gt;
animations: leaking detached nodes when parent has a leave transition (#34409) (6607fb4), closes #25744&lt;br&gt;
common: ngStyle should ignore undefined values (#34422) (ee1eebd), closes #34310&lt;br&gt;
ivy: avoid duplicate errors in safe navigations and template guards (#34417) (d6edeab)&lt;br&gt;
ivy: avoid using proto when reading metadata in JIT mode (#34305) (08ce026)&lt;br&gt;
ivy: don’t produce template diagnostics when scope is invalid (#34460) (c1fd629), closes #33849&lt;br&gt;
ivy: generate a better error for template var writes (#34339) (418d586), closes #33674&lt;br&gt;
ivy: i18n – remove translate function when clearing translations (#34346) (1489e5e), closes #32781&lt;br&gt;
ivy: i18n instructions thrown off by sanitizer in IE11 (#34305) (bed62b1)&lt;br&gt;
ivy: improve ExpressionChangedAfterChecked error (#34381) (7ea3984)&lt;br&gt;
ivy: inconsistent attribute casing in DebugNode.attributes on IE (#34305) (9bff8e7)&lt;br&gt;
ivy: incorrect injectable name logged in warning message on IE (#34305) (60d1d5e)&lt;br&gt;
ivy: inheritance in JIT mode not working correctly on IE10 (#34305) (65fb2fd)&lt;br&gt;
ivy: inheriting injectable definition from undecorated class not working on IE10 in JIT mode (#34305) (d83599d)&lt;br&gt;
ivy: record correct absolute source span for ngForOf expressions (#31813) (931cb5e)&lt;br&gt;
ivy: reorder provider type checks to align with VE (#34433) (7916b1e)&lt;br&gt;
ivy: unknown property and element checks not working correctly in IE (#34305) (0ff54f2)&lt;br&gt;
ivy: validate the NgModule declarations field (#34404) (03e236a)&lt;br&gt;
language-service: HTML path should include last node before cursor (#34440) (76e4870)&lt;br&gt;
language-service: Proper completions for properties and events (#34445) (4e41bf9)&lt;br&gt;
language-service: Remove completions for let and of in ngFor (#34434) (ab61480)&lt;br&gt;
ngcc: correctly match aliased classes between src and dts files (#34254) (4bffb6b), closes #33593&lt;br&gt;
ngcc: handle CommonJS re-exports by reference (#34254) (9ca5faa)&lt;br&gt;
ngcc: handle imports in dts files when processing UMD (#34356) (81c75cf)&lt;br&gt;
ngcc: handle UMD re-exports (#34254) (84a7d8a)&lt;br&gt;
ngcc: render UMD imports even if no prior imports (#34353) (c26738d), closes #34138&lt;br&gt;
ngcc: use the correct identifiers when updating typings files (#34254) (c0c2ab3)&lt;br&gt;
Features&lt;br&gt;
forms: expand NgModel disabled type to work with strict template type checking (#34438) (b1d4c58)&lt;br&gt;
ivy: error in ivy when inheriting a ctor from an undecorated base (#34460) (f563c7c)&lt;br&gt;
ivy: throw compilation error when providing undecorated classes (#34460) (0638e65)&lt;br&gt;
Performance Improvements&lt;br&gt;
compiler: optimize cloning cursors state (#34332) (5d871b5)&lt;br&gt;
compiler: speed up i18n digest computations (#34332) (adb0663)&lt;br&gt;
compiler: use a shared interpolation regex (#34332) (940e62b)&lt;br&gt;
ivy: cache export scopes extracted from declaration files (#34332) (eb9a8ac)&lt;br&gt;
ivy: eagerly parse the template twice during analysis (#34334) (fb4a11a)&lt;br&gt;
ivy: reuse prior analysis work during incremental builds (#34288) (c387952)&lt;br&gt;
ivy: share instances of DomElementSchemaRegistry (#34332) (ce94192)&lt;br&gt;
ivy: use module resolution cache (#34332) (82442c5)&lt;/p&gt;

</description>
      <category>angular</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>stuartinhcity</category>
    </item>
    <item>
      <title>Angular performance part 2</title>
      <dc:creator>Jamal</dc:creator>
      <pubDate>Tue, 10 Dec 2019 16:10:24 +0000</pubDate>
      <link>https://dev.to/d3vjamal/angular-performance-part-2-27ed</link>
      <guid>https://dev.to/d3vjamal/angular-performance-part-2-27ed</guid>
      <description>&lt;p&gt;Part1 link on the comment section please have a look : )&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Preload and Prefetch attribute: These attributes help to load the static resources as quickly as possible thus improving the time for first meaningful paint. Having faster first meaningful paint greatly affect the user experience. Preload and Prefetch are almost similar with the only difference is that Preload resources have greater priority. So use Preload for the assets which are essential for the initial rendering and use Prefetch for the resources which are required after site load (required in future across the pages).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Updating Third Party Packages: Make sure you are regularly updating your third party packages. Many times newer packages may contain many performance improvements including smaller size and other build time performance optimizations (e.g. RxJS 6). Also by regularly updating the packages, you may get many improvements related to the bug fixes, security vulnerability fixes, fixes related to package compatibility etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compressing images: It’s a good idea to compress the images without losing much of the quality thereby saving the bytes transferred over the network improving the build time. There are many tools available to achieve this. VS Code extension called TinyPNG can be used to compress Jpeg and PNG images without losing much of the quality.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Remove unused fonts: It’s a good idea to remove the unused fonts which may help you save few bytes over the network.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Slow DNS and SSL: Sometimes your DNS and SSL provider could be the reason for slow load time. So make sure the DNS and SSL are fast and configured correctly.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Run Time Performance&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Change Detection: By default on each asynchronous event, Angular performs a dirty checking by performing a change detection for the whole component tree. Such dirty checking could be a lot computation heavy for a medium to large apps. You can drastically reduce the change detection by setting “ChangeDetectionStrategy” to “OnPush”. The OnPush strategy promotes the use of immutable data structures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Detach Change Detector: We can completely detach the component from change detection thereby giving a developer the control to inform Angular as to when and where to perform the change detection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web Workers: The JavaScript implementation in all browser is single threaded thus making the whole app to run on a single thread. Such single-threaded execution drastically reduces the frame rate of the complex application as both UI painting and JS execution handled by the same thread. As Angular by default avoids direct DOM manipulation, it is possible to run the entire Angular app in a separate web worker thread thereby keeping the main thread free to just handle the UI rendering. Check this post to see how to run an angular-cli app inside web worker. However, there are many npm packages that try to access DOM directly thereby creating issues while running the whole app inside the worker process. If you want to run only a piece of code under a web worker thread then look at this npm package.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web assembly: Web assembly is a low-level assembly like a language enabling near-native performance. WebAssembly aims to execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms. You can take advantage of Webassembly to run some amount of your web app code with Web assembly. Take a look at this demo app created with angular-cli and wasm. However, you should be aware of the fact wasm is still new and using it sometimes may be tricky considering as of now it has only 4 supported data types (2 floating points and 2 integer points). Also as of now, for most of the cases, performance benefit of wasm is not that huge when you are using it to execute a small piece of code compared to inline JS. Properly evaluate which code you want to move to wasm.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;trackBy: By default, *ngFor identifies object uniqueness by reference. If the object reference is broken by updating the content of the object, Angular removes &lt;br&gt;
the related DOM node completely and recreate it again even though the actual change required is for only a small part of the DOM node. This issue can be easily solved by using trackBy.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;@Component({&lt;br&gt;
    selector: 'app', &lt;br&gt;
    template: &lt;code&gt;&amp;lt;ul&amp;gt;&lt;br&gt;
                    &amp;lt;li *ngFor="let item of items; trackBy: trackById"&amp;gt;{{item.name}}&amp;lt;/li&amp;gt;&lt;br&gt;
               &amp;lt;/ul&amp;gt;&lt;/code&gt;&lt;br&gt;
})&lt;br&gt;
class AppComponent {&lt;br&gt;
    Items = [&lt;br&gt;
        {&lt;br&gt;
            id: 1,&lt;br&gt;
            name: 'item 1'&lt;br&gt;
        }, {&lt;br&gt;
            id: 2,&lt;br&gt;
            name: 'item 2'&lt;br&gt;
        },&lt;br&gt;
        ...&lt;br&gt;
    ];&lt;br&gt;
    trackById(index, item) {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    return item.id;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Pure Pipes: In the “&lt;a class="mentioned-user" href="https://dev.to/pipe"&gt;@pipe&lt;/a&gt;” decorator you can specify “pure” flag as true. This flag indicates that the pipe is not dependent on any outside or global state and is side effect free. This enables Angular to cache the outputs for all the input parameters the pipe has been invoked with and thus allows to reuse the values instead of recomputation. This can lead to a massive reduction in the duplicate operations performed in many cases thus hugely improving the performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid complex computations in the template: Avoid doing complex calculation in the HTML template (ex calling some component method inside the template), instead leverage the use of pure pipes thereby taking advantage of Angular caching and hence avoiding duplicate operations or if the use of pipe is not possible, see the opportunity to pre-calculate the values and then directly bind values instead of calling the component method in the template.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;enableProdMode: Invoking “enableProdMode()” avoids Angular from performing additional checks for change detection.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;import {enableProdMode} from '@angular/core';&lt;br&gt;
if (ENV === 'production') {&lt;br&gt;
    enableProdMode();&lt;br&gt;
}&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;AOT Compilation: AOT not only improves the build time performance but also the runtime performance of the app.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Optimize Events: Slower DOM events block change detection until the event is not completed. For example, if you have a click event in your template which is handled in the component and the component itself is calling service method to process it, the change detection will not complete until the control is not returned from the service. If your service is taking more time to perform the intended operation, then it will ultimately slow down the change detection. See the opportunity to optimize your logic to improve the duration or if possible try to move your service logic to separate web worker thread or use wasm if needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unsubscribing Observables: Observables could create the memory leak issue. So it is better to unsubscribe them when they are not needed anymore. However, you don’t have to unsubscribe all the observables used. Unsubscribing explicitly is required when a subscription is created inside a component that is destroyed before the observable completes. Check this SO thread for more info.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Observable share() operator: If you have subscribed the observable at multiple locations/components, then each subscription will try to produce the data even though the data is duplicate. We can avoid the processing of the duplicate data across subscriptions using the “share()” operator.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;import {Injectable} from '@angular/core';&lt;br&gt;
import {HttpClient} from '@angular/common/http';&lt;br&gt;
import {Observable} from 'rxjs';&lt;br&gt;
import {share} from 'rxjs/operators';&lt;br&gt;
@Injectable()&lt;br&gt;
export class AppService {&lt;br&gt;
    data: Observable &amp;lt; any &amp;gt;;&lt;br&gt;
    constructor(private http : HttpClient) {&lt;br&gt;
        this.data = this.http.get ('apiUrl').pipe(share());&lt;br&gt;
    }&lt;br&gt;
    getData() {&lt;br&gt;
        return this.data;&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Progressive Web Apps: The PWA not just give you a load time optimization but also the runtime optimizations making your app more responsive, interactive, fast, smooth animations, offline support etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Updating Third-Party Packages: Again regularly updating your third party packages may also result in better run time performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;console.log(): Using console.log() statements in your production code could be a bad idea as it will slow down the performance of the app and also logging objects with console.log() creates memory leak issue. When the browser’s console window is open, the console.log() execution slows down even further by many times thus impacting site’s performance significantly. It’s better to completely remove the console.log() statements from your production code or at least have an environment specific conditional logging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Global Variables: There are many disadvantages of using global variables and one of them is the memory leak. The variables defined in the global scope won’t be cleared until the window is reloaded or tab is closed thus resulting in the memory leak if the global variable is not intended to be used throughout the app. If for some reason you want to have global variables, there are better ways to do it in the Angular.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>angular</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>stuartinhcity</category>
    </item>
    <item>
      <title>20 tips for Angular performance(Part 1)</title>
      <dc:creator>Jamal</dc:creator>
      <pubDate>Sat, 07 Dec 2019 16:50:01 +0000</pubDate>
      <link>https://dev.to/d3vjamal/20-tips-for-angular-performance-2j1d</link>
      <guid>https://dev.to/d3vjamal/20-tips-for-angular-performance-2j1d</guid>
      <description>&lt;p&gt;Load Time Performance&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;AOT: As opposed to JIT Compilation where the compilation is done in the browser, AOT compiles much of the code during the build process (also called offline compilation) thus reducing much of the processing overhead on the client browser. With angular-cli just specify the “aot” flag (if prod flag is present, then aot flag not required) and AOT will be enabled.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tree-shaking: This is the process of removing unused code resulting in smaller build size. If you are using angular-cli, Tree-Shaking is enabled by default.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Uglify: It is the process where the code size is reduced using various code transformations like mangling, removal of white spaces, removal of comments etc. For webpack use uglify plugin and with angular-cli specify the “prod” flag to perform the uglification process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Webpack 4: Using Webpack 4 (and higher) for your angular-cli or custom webpack build results in more smaller build size compared to Webpack 3. Webpack 4 has mode option which lets you specify the optimization type (production or development) without you requiring to write any explicit configuration giving you the best possible results for the target environment. Also, build time with Webpack 4 is much faster (60% to 98%) than the earlier version thereby reducing the development time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prod flag: For the production, build specify the “prod” flag in the angular-cli application. It will enable various build optimizations like uglify, AOT, removal of sourcemaps, service workers (if enabled) producing a much smaller build size.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build-optimizer flag: If you are using angular-cli make sure you specify “build-optimizer” flag for your production build. This will disable the vendor chunk and will result in more smaller code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lazy loading: Lazy loading is the mechanism where instead of loading complete app, we load only the modules which are required at the moment thereby reducing the initial load time. In simple words, it means “don’t load something which you don’t need.”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Server side rendering: Rendering the first page of your application on the server (using Node.js, .Net, PHP) and serving it as a static page causes near to instant rendering thus greatly improves perceived performance, speed, and overall user experience. You can use Angular Universal to perform server side rendering.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ivy Render Engine: Angular team recently announced a new render engine named Ivy. It results in much smaller bundle size than the current engine with improved debugging experience. Though it is still not production ready you can still try it in your app. You can look at this ng-conf keynote for more details.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Updating Angular and angular-cli: Updating your Angular and angular-cli regularly gives you the benefit of many performance optimizations, bug fixes, new features, security etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;RxJS 6: RxJS 6 makes the whole library more tree-shakable thereby reducing the final bundle size. However, it has some breaking changes like operators chaining is not possible instead, pipe() function (helps in better tree shaking) is introduced to add operators. They have also renamed some operators.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Service worker cache: If you have configured your app to support Progressive Web App, make sure to specify all the necessary static resources in the PWA config JSON. These static files will be cached in the client’s browser making the second time load much faster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cache-control header: cache-control header controls who caches the response under what condition and for how long thus eliminating the need for network round trip for the resources which are cached.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Third party packages: Review the third party packages you are using and see if better and smaller alternative is available as it may reduce the final size of your build.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unnecessary use of third-party packages: If you include a third-party package just to achieve a small functionality which could be easily done natively with JavaScript or Angular then you are adding unnecessary size overhead to your app which could have been easily saved. For example, if you are including Lodash just to do a simple object filtering then it is totally unnecessary as you could do the same thing natively in JavaScript.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;defer attribute: Mentioning defer attribute to your script tag will defer the loading of the scripts (sychronous) until the document is not parsed thus making your site interactive quicker. For angular-cli app currently there is no way to add this automatically during the build, you have to do it manually after the build.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;async attribute: Just like the defer attribute, async delays the loading of scripts until the document is not parsed but without respecting the order of loading of the scripts. The best example to use it with google analytics script which usually independent of any other scripts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Gzip compression: Gzip compression can greatly decrease the size of the response body and hence increase the speed of a web app. Make sure you have enabled gzip compression in your backend. For express.js you can add compression middleware.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>angular</category>
      <category>webdev</category>
      <category>stuartinhcity</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Android Q is officially named Android 10</title>
      <dc:creator>Jamal</dc:creator>
      <pubDate>Fri, 23 Aug 2019 01:17:29 +0000</pubDate>
      <link>https://dev.to/d3vjamal/android-q-is-officially-named-android-10-1m9l</link>
      <guid>https://dev.to/d3vjamal/android-q-is-officially-named-android-10-1m9l</guid>
      <description>&lt;p&gt;Android Q is now simply Android 10&lt;br&gt;
Google ditches dessert-themed Android names in a push for accessibility.&lt;br&gt;
Mariella Moon Mariella Moon, 4h ago&lt;br&gt;
Google has finally revealed Android Q's release name, and it's not Quiche, Quinoa or Quesadilla. In fact, it's not named after any dessert that starts with the letter Q at all -- the tech giant has decided to simply call it Android 10. In a blog post, the company said it's changing the way it names its releases altogether in a push for greater accessibility. "[W]e've heard feedback over the years that the names weren't always understood by everyone in the global community," the company wrote.&lt;/p&gt;

&lt;p&gt;Since L and R aren't always distinguishable when spoken in some languages, for instance, it's not immediately obvious for some people that Android Lollipop came after KitKat. The names of some previous Android versions aren't known desserts in certain parts of the world either. In other words, while the names are fun, they don't always resonate with users. The new scheme sounds much less quirky and delicious, but it'll likely serve Google's purpose: come up with more relatable and intuitive names. "[W]e think that at version 10 and 2.5 billion active devices," the blog post reads, "it was time to make this change."&lt;br&gt;
Top  Android 10 features you need to know about:-&lt;/p&gt;

&lt;p&gt;1.The iconic back button is going away&lt;/p&gt;

&lt;p&gt;2.There's finally a system-wide dark mode!&lt;br&gt;
3.Live Caption transcribes media locally in real-time&lt;br&gt;
4.An improved share menu.&lt;br&gt;
5.Big changes coming to permissions&lt;br&gt;
6.New theming options.&lt;br&gt;
7.Better support for foldable phones.&lt;/p&gt;

&lt;p&gt;When will it be released?&lt;/p&gt;

&lt;p&gt;On March 13, 2019, Android 10 Beta 1 was launched out in the wild and made available to download on the Pixel, Pixel 2, and Pixel 3 series. Beta 2 was released on April 3, Beta 3 debuted on May 7 during Google I/O, Beta 4 arrived on June 5, Beta 5 hit on July 10, and Beta 6 made an appearance on August 7.&lt;/p&gt;

&lt;p&gt;Now, we're just waiting for the final build of Android 10 to be released at some point before Q3 is over.&lt;/p&gt;

</description>
      <category>stuartinhcity</category>
      <category>androidq</category>
      <category>android10</category>
      <category>android</category>
    </item>
    <item>
      <title>HTTP response status codes List:</title>
      <dc:creator>Jamal</dc:creator>
      <pubDate>Thu, 22 Aug 2019 09:08:02 +0000</pubDate>
      <link>https://dev.to/d3vjamal/http-response-status-codes-list-4mm0</link>
      <guid>https://dev.to/d3vjamal/http-response-status-codes-list-4mm0</guid>
      <description>&lt;p&gt;HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped into five classes: informational responses, successful responses, redirects, client errors, and server errors. The below status codes are defined by .&lt;/p&gt;

&lt;p&gt;1.Information responses&lt;/p&gt;

&lt;p&gt;100 Continue&lt;br&gt;
101 Switching Protocol&lt;br&gt;
102 Processing (WebDAV)&lt;br&gt;
103 Early Hints&lt;/p&gt;

&lt;p&gt;2.Successful responses&lt;/p&gt;

&lt;p&gt;200 OK&lt;br&gt;
201 Created&lt;br&gt;
202 Accepted&lt;br&gt;
203 Non-Authoritative Information&lt;br&gt;
204 No Content&lt;br&gt;
205 Reset Content&lt;br&gt;
206 Partial Content&lt;br&gt;
207 Multi-Status (WebDAV)&lt;br&gt;
208 Already Reported (WebDAV)&lt;br&gt;
226 IM Used (HTTP Delta encoding)&lt;/p&gt;

&lt;p&gt;3.Redirection messages&lt;/p&gt;

&lt;p&gt;300 Multiple Choice&lt;br&gt;
301 Moved Permanently&lt;br&gt;
302 Found&lt;br&gt;
303 See Other&lt;br&gt;
304 Not Modified&lt;br&gt;
305 Use Proxy &lt;br&gt;
306 unused&lt;br&gt;
307 Temporary Redirect&lt;br&gt;
308 Permanent Redirect&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Client error responses&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;400 Bad Request&lt;br&gt;
401 Unauthorized&lt;br&gt;
402 Payment Required &lt;br&gt;
403 Forbidden&lt;br&gt;
404 Not Found&lt;br&gt;
405 Method Not Allowed&lt;br&gt;
406 Not Acceptable&lt;br&gt;
407 Proxy Authentication Required&lt;br&gt;
408 Request Timeout&lt;br&gt;
409 Conflict&lt;br&gt;
410 Gone&lt;br&gt;
411 Length Required&lt;br&gt;
412 Precondition Failed&lt;br&gt;
413 Payload Too Large&lt;br&gt;
415 Unsupported Media Type&lt;br&gt;
415 Unsupported Media Type&lt;/p&gt;

&lt;p&gt;421 Misdirected Request&lt;br&gt;
422 Unprocessable Entity (WebDAV)&lt;br&gt;
423 Locked (WebDAV)&lt;br&gt;
424 Failed Dependency (WebDAV)&lt;br&gt;
425 Too Early&lt;/p&gt;

&lt;p&gt;429 Too Many Requests&lt;br&gt;
451 Unavailable For Legal Reasons&lt;/p&gt;

&lt;p&gt;5.Server error responses&lt;/p&gt;

&lt;p&gt;500 Internal Server Error&lt;br&gt;
501 Not Implemented&lt;br&gt;
502 Bad Gateway&lt;br&gt;
503 Service Unavailable&lt;br&gt;
504 Gateway Timeout&lt;br&gt;
505 HTTP Version Not Supported&lt;br&gt;
506 Variant Also Negotiates&lt;br&gt;
507 Insufficient Storage (WebDAV)&lt;br&gt;
508 Loop Detected (WebDAV)&lt;br&gt;
510 Not Extended&lt;br&gt;
511 Network Authentication Required&lt;/p&gt;

&lt;p&gt;ALL these are same for every for Chrome,Edge,Firefox,Internet Explorer,Opera,   Safari,Android webview  Chrome for Android,Firefox for Android  Opera for Android   Safari on iOS   Samsung Internet............etc&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>api</category>
      <category>http</category>
      <category>unsuredev</category>
    </item>
  </channel>
</rss>
