<?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[Stories by Mustafa Saeed on Medium]]></title>
        <description><![CDATA[Stories by Mustafa Saeed on Medium]]></description>
        <link>https://medium.com/@mustafasaeed007?source=rss-1a1e60cd5a50------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QfiMW_HcU67cU0GlxBmhlg.jpeg</url>
            <title>Stories by Mustafa Saeed on Medium</title>
            <link>https://medium.com/@mustafasaeed007?source=rss-1a1e60cd5a50------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 13:42:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mustafasaeed007/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Angular localization to support right to left languages]]></title>
            <link>https://medium.com/@mustafasaeed007/angular-localization-to-support-right-to-left-languages-7225a6c71eef?source=rss-1a1e60cd5a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/7225a6c71eef</guid>
            <category><![CDATA[localization]]></category>
            <category><![CDATA[arabic]]></category>
            <category><![CDATA[rtls]]></category>
            <category><![CDATA[ngx-translate]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Mustafa Saeed]]></dc:creator>
            <pubDate>Sat, 08 Feb 2020 14:21:12 GMT</pubDate>
            <atom:updated>2022-01-14T20:02:04.361Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U31_tG-E7hs-2H_BSkjUSg.png" /></figure><p><strong>L</strong>ocalizing an angular app is fairly simple If you’re using ngx-translate, all you have to do is add a translate directive to every text tag that you want to translate from one language to another, along with json files to represent the multiple languages in your app, and you’ve got yourself a multilingual app.</p><p>There are many tutorials on how to add localization to an angular application, but I recently had a task where I needed to add localization to an app that I was working on, but the problem was that I needed to add support for an RTL (right to left) language, which is Arabic, and this is where things got interesting because you don’t just need to translate words from one language to another.</p><p><strong>In easy and simple steps.</strong></p><p>So here is everything we are going to discuss in this post :</p><ol><li>Create a new Angular App</li><li>Add ngx-translate</li><li>Add translate directive to tags that we want to translate depending on the selected language</li><li>Change css file on every language change.</li></ol><p><strong>First of all, I am going to create a new angular app using angular cli using this command</strong></p><pre>ng new angular-localization</pre><p>angular-localization is the name of your project and I will use angular routing with css, So yes to both of the question the cli is gonna ask you.</p><blockquote>now we need to install ngx-translate so we are gonna use this command :</blockquote><pre>npm i @ngx-translate/core<br>npm i @ngx-translate/http-loader</pre><p>The first package is the translation itself, and the second is the package that loads translation files through HTTP.<br>To keep things simple, I’m going to remove everything from app.component.html and replace it with a div containing a h tag and a p tag.<br>When English is selected, I want the div background to be yellow, and when Arabic is picked, I want the text inside this div to be localized based on the selected language.</p><pre>&lt;div&gt;<br>   &lt;h3 translate&gt;Hello&lt;/h3&gt;<br>   &lt;p translate&gt;This is a test text&lt;/p&gt;<br>&lt;/div&gt;</pre><p>So that’s all there is to it.</p><p>Notice the translate directive on the h3 and p tags; this directive is from ngx-translate; when angular tries to parse this code, it will replace text between tags with text from language files based on the selected language; for example, if the selected language is English, angular will replace text between tags with text from the English language file saved in the i18n folder.</p><p>Those language files will be added next.<br>Create a new folder called i18n in the assets folder. We’ll put our resource files or language files in this folder; they’re basically json files with key-value pairs.<br>So, for our example, I created 2 files for both languages, en.json and ar.json, and here is the code.</p><p>en.json :</p><pre>{<br>   “Hello”: “Hello”,<br>   “Just Text”: “Just Text”<br>}</pre><p>ar.json</p><pre>{ <br>   “Hello”: “مرحبا”,<br>   “Just Text”: “مجرد نص”<br>}</pre><p>It’s worth noting that the keys in both the files and the html file are identical; these keys are used to determine which value to replace.<br>Now that we’ve got everything in place, all we need is a button to change languages.</p><p>Returning to app.component.html, I’ll add two buttons, one for each language, to our div.<br>That’s about it.</p><pre>&lt;button (click)=”changeLangage(‘ar’)”&gt;Arabic&lt;/button&gt;<br>&lt;button (click)=”changeLangage(‘en’)”&gt;English&lt;/button&gt;</pre><pre>&lt;div&gt;<br>   &lt;h3 translate&gt;Hello&lt;/h3&gt;<br>   &lt;p translate&gt;Just Text&lt;/p&gt;<br>&lt;/div&gt;</pre><p>And in app.component.ts add the corresponding method to the click event</p><pre>import { TranslateService } from “@ngx-translate/core”;<br>constructor(private translateService: TranslateService) {}<br>   changeLangage(lang: string) {<br>   <em>this</em>.translateService.setDefaultLang(lang);<br>   <em>this</em>.translateService.use(lang);<br>}</pre><p>Make sure to import TranslateService from ngx and then add it to the app module’s imports array. However, there are a few things we need to do in the app module to make it function.<br>First, we must import the</p><blockquote>TranslateModule, TranslateLoader, and TranslateHttpLoader modules.</blockquote><p>The TranslateHttpLoader is responsible for loading translations over the network.<br>As a result, make sure to include these import statements.</p><pre>import { TranslateModule, TranslateLoader } from “@ngx-translate/core”;<br>import { TranslateHttpLoader } from “@ngx-translate/http-loader”;<br>import { HttpClient, HttpClientModule } from ‘@angular/common/http’;</pre><p>We need to add a method to locate our translation files so that they can be served over http using TranslateHttpLoader, similar to this:</p><pre>export function HttpLoaderFactory(http: HttpClient) {<br>    return new TranslateHttpLoader(http, “./assets/i18n/”, “.json”);<br>}</pre><p>Finally, we add TranslateModule to our imports array along with a configuration object.</p><blockquote>other imports removed for clarity</blockquote><pre>NgbModule,<br>HttpClientModule,<br>TranslateModule.forRoot({<br>loader: {<br>provide: TranslateLoader,<br>useFactory: HttpLoaderFactory,<br>deps: [HttpClient]<br>}<br>}) </pre><p>Now run the application using</p><blockquote>npm start</blockquote><p>Change the app language using the two buttons, and the text should change to the appropriate language.<br>If that meets your requirements and you don’t need to change CSS files dynamically, you can skip ahead to the next section.<br>If not, proceed to the next section, where I will explain how to change CSS dynamically.</p><p>Ok here is a what we need to do</p><p>First and foremost, we must modify our CSS file to reflect the language selected by the user.<br>So, for each language selection change, we need to grab a reference to the head tag, add the corresponding CSS file, and change the href attribute.<br>So now we need two -or more- css files to switch between them dynamically, so add two css files to the src folder. It is entirely up to you to name the files, but mine are styles-ar.css and styles-en.css.<br>To ensure that everything is working properly, I added a simple CSS rule to each file.</p><p>Here is the content of the two files :</p><p>styles-ar.css</p><pre>body {<br>   background-color: <em>green;<br></em>}</pre><p>styles-en.css</p><pre>body {<br>   background-color: <em>yellow</em>;<br>}</pre><p>So just a different background color for each file</p><p>Now we need to add these two css files to our styles array like this</p><pre>“styles”: [<br>  “src/styles.css”,<br>  “src/styles-en.css”,<br>  “src/styles-ar.css”<br>]</pre><p>However, doing so means that all of them will be loaded, and the last one will override the files before it.<br>So we’ll need a way to tell the cli not to load these files because we’ll be loading them manually.<br>So here’s how we’re going to do it:</p><pre>“extractCss”: true,<br>“styles”: [<br>  “src/styles.css”,<br>  {<br>     “input”: “src/styles-ar.css”,<br>     “bundleName”: “arabicStyle”,<br>     “lazy”: true<br>  },<br>  {<br>    “input”: “src/styles-en.css”,<br>    “bundleName”: “englishStyle”,<br>    “lazy”: true<br>}</pre><p>And we need to tell the cli not to serve CSS files through js, which is why we’re using The extractCss here.<br>All that remains is to add code to dynamically add a link tag with the appropriate CSS file to the head tag.<br>So, in order to grab the head tag, we must inject the document token into the app.component.ts constructor.</p><pre>import { Inject } from “@angular/core”;<br>import { DOCUMENT } from “@angular/common”;<br>constructor(@Inject(DOCUMENT) private document: Document) {}</pre><pre>//Make sure to add the import statement to the top of the file</pre><pre>changeLangage(lang: string) {<br>   let htmlTag = <em>this</em>.document.getElementsByTagName(“html”)[0] as HTMLHtmlElement;</pre><pre>htmlTag.dir = lang === “ar” ? “rtl” : “ltr”;<br><em>this</em>.translateService.setDefaultLang(lang);<br><em>this</em>.translateService.use(lang);<br><em>this</em>.changeCssFile(lang);</pre><pre>}</pre><p>So, returning to our changeLanguage function, as I mentioned above, we need to grab the html tag element. To do so, we call getElementByTagName, which returns an array, but since we only have one html tag, we can take the first element of the array.<br>Then, based on the user’s preference, we change the direction of the HTML document.<br>The last line of this function calls another function that changes CSS files; here is how it is implemented.</p><pre>changeCssFile(lang: string) {<br>let headTag = <em>this</em>.document.getElementsByTagName(“head”)[0] as HTMLHeadElement;</pre><pre>let existingLink = <em>this</em>.document.getElementById(“langCss”) as HTMLLinkElement;</pre><pre>let bundleName = lang === “ar” ?       “arabicStyle.css”:“englishStyle.css”;</pre><pre>if (existingLink) {<br>   existingLink.href = bundleName;<br>} else {<br>   let newLink = <em>this</em>.document.createElement(“link”);<br>   newLink.rel = “stylesheet”;<br>   newLink.type = “text/css”;<br>   newLink.id = “langCss”;<br>   newLink.href = bundleName;<br>   headTag.appendChild(newLink);<br>}<br>}</pre><p>It is quite simple. We’ll get a reference to the head tag first, and then append our link element to it later.<br>We try to get a reference to a link tag with the id “langCss,” and if we find it, it means we already appended it, so we only change its rel attribute to the correct CSS file.<br>If that link is not found, we create a new link tag and append it to the head element.<br>There you have it</p><p>the source code of this blog post is on <a href="https://github.com/mustafasaaed/Angular-Localization/tree/master/angular-localization">github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7225a6c71eef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microsoft Azure — Implement Blob Storage part one]]></title>
            <link>https://medium.com/@mustafasaeed007/microsoft-azure-implement-blob-storage-part-one-cfe8de1fbd81?source=rss-1a1e60cd5a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfe8de1fbd81</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[blob-storag]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Mustafa Saeed]]></dc:creator>
            <pubDate>Sun, 24 Mar 2019 16:28:11 GMT</pubDate>
            <atom:updated>2019-03-24T16:28:11.785Z</atom:updated>
            <content:encoded><![CDATA[<h3>Microsoft Azure — Implement Blob Storage part one</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*wr8GvIhYl0cvPL0al9xVaA.png" /><figcaption>Microsoft Azure Blob storage</figcaption></figure><p>In this post we will learn how to user azure blob storage to store unstructured data like images, videos, audios or documents.</p><p>Azure blob storage is a cost effective, easy to use and you can scale it to meet your needs very easily,</p><p><strong>So what will we cover in this series of posts ?</strong></p><ol><li>Setting up Blob Storage</li><li>Working with blobs in .Net</li><li>How To Use Shared Access Signatures ?</li><li>Managing Concurrency</li></ol><p><strong>Part one will cover setting up blob storages.</strong></p><blockquote>Azure Storage offloads the heavy lifting of datacenter management. Plus, no more capital expense for new hardware, just flexible cloud options you pay for as you need them — <a href="https://azure.microsoft.com/en-us/services/storage/">Microsoft Azure</a></blockquote><h3>Azure Storage Services :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*jng2iSrUi7sxFmGezOzShA.png" /><figcaption>Azure Storage</figcaption></figure><p><strong>Blob Storage</strong></p><p>Blob Stands for binary large object, you should use blob storage to store massive amount of unstructured data like text or binary files, But you can user blobs to store small files as well.</p><p>blobs can be accessed through http and https.<br>you can actually store static web sites that doesn’t need server side processing on blobs. For example you can store a SPA app like angular on a blob.</p><p><strong>File Storage</strong></p><p>File Storage enables you to create network file shares that can be accessed by using <a href="https://en.wikipedia.org/wiki/Server_Message_Block">SMB </a>(Server Message Block), This is a powerful way to share files with other people in addition to sharing files with read and write access between virtual machines</p><p><strong>Table Storage</strong></p><p>Table Storage is a NoSQL database service. NoSQL means that this database doesn’t have a schema for defining tables like in relational database instead table storage provides a Key-Value Store with a schemaless design.<br>Table storage is ideal for storing structured non-relational data.</p><p><strong>Queue Storage</strong></p><p>Queue storage is used to store a large number of messages.<br>you can use queue storage as a buffer between you clients and your back-end.<br>this allow your back-end to process queue message at it’s own pace.</p><p>if you plan to use messaging you should check out (Azure service bus, Azure event hubs, azure event grid).</p><h4>So now we know what is azure storage and it’s services so we can use these services ?</h4><p>So to use any of these services you need to create azure storage account.<br>this storage account gives you gives you the access to these services and let’s you to store up to 500 TB of data (Massive amount ha ?).</p><p>but wait a second what if i need more than 500 TB ! <br>azure storage is flexible and massively scalable so you can contact azure support to increase the limit Up to <strong>5 PB (500 TB).</strong></p><p><strong>So Let’s get started by creating azure storage account :</strong></p><p>First go to <a href="http://portal.azure.com/">azure portal</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fYaK8Sg0NLWiMmFy8YohgQ.png" /><figcaption>Azure Portal</figcaption></figure><p>To create a storage account there are multiple ways to get to the Creation blade you can use the create a resource with the Plus symbol in the top left <br>or from your favorite items on the left side any of the two ways will get you to the same blade.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*tvXncQm9ZngW8G9cE0y3mg.png" /><figcaption>Create new Storage account (Image from MS docs)</figcaption></figure><p>when you click on that options that next blade will show up</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*JjyghLGhRBfHh81Nj7lpYQ.png" /><figcaption>Create new Storage account (Image from MS docs)</figcaption></figure><p>so in the previous image there is a couple of options:</p><ol><li><strong>Name :</strong> this name has to be unique because it’s gonna be part of the url to this storage account</li><li><strong>Account Kind :</strong></li></ol><p>Azure Storage offers several types of storage accounts. Each type supports different features and has its own pricing model. Consider these differences before you create a storage account to determine the type of account that is best for your applications. The types of storage accounts are:</p><p><strong>General-purpose v2 accounts :</strong> Basic storage account type for blobs, files, queues, and tables. Recommended for most scenarios using Azure Storage.</p><p><strong>General-purpose v1 accounts :</strong> Legacy account type for blobs, files, queues, and tables. Use general-purpose v2 accounts instead when possible.</p><p><strong>Block blob storage accounts : </strong>Blob-only storage accounts with premium performance characteristics. Recommended for scenarios with high transactions rates, using smaller objects, or requiring consistently low storage latency.</p><p><strong>Blob storage accounts :</strong> Blob-only storage accounts. Use general-purpose v2 accounts instead when possible.<br> — Microsoft docs</p><p><strong>3. Performance tier: </strong><br> 1. Standard : which is used for storing blobs, files,tables, queus, and virtual machine</p><p>2. Premium : is used for storing unmanned virtual machine disks only.</p><p><strong>4. Replication :</strong></p><ol><li><a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-redundancy-lrs">Locally-redundant storage (LRS)</a> : this simple means that data is replicated in a single storage unit</li><li><a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-redundancy-zrs">Zone-redundant storage (ZRS)</a> : data is replicated in three availability zones</li><li><a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-redundancy-grs">Geo-redundant storage (GRS)</a> : data is replicated in a different regions to avoid region unavailability</li><li><a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-redundancy-grs#read-access-geo-redundant-storage">Read-access geo-redundant storage (RA-GRS)</a> : Cross-regional replication with read access to the replica</li></ol><p><strong>for more information about replication go to </strong><a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview#replication"><strong>azure docs</strong></a></p><p>5. <strong>Resource group :</strong></p><p>you can use an existing resource group or create a new one.</p><p><strong>click on create to create you storage account</strong></p><p><strong>Container :<br></strong>in storage account every blob need to be stored in a container.So container is? <br>you can think of a container as root folder for your blobs so you can create an <strong>images container</strong> and <strong>audios container</strong>.</p><p>inside containers you save your blobs so if i saved an image by the name <strong>logo.png</strong> in the<strong> images container</strong> in a storage account with the name of <strong>myStorageAccount</strong> the <strong>url </strong>to this image would be :</p><blockquote>https://mystorageaccount.blob.windows.core.net/images/logo.png</blockquote><p>I think now it’s obvious why your storage account name must be unique.</p><h3>but <strong>what if you want to use additional directories for your blobs?</strong></h3><p>blob storage is based on a flat storage schema which means there is no hierarchical schema but you can prefix the name of your blobs with a file path for example you can name the logo.png blob “assets/logo.png” then the url to access this blob would include ‘assets’ in it, just like that :</p><blockquote>https://mystorageaccount.blob.windows.core.net/images/assets/logo.png</blockquote><p>but keep in mind that there is no directory named assets will be created it’s just the name of the blob as these directories don’t exist physically there are referred to as virtual.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfe8de1fbd81" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>