<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shameem Reza</title>
    <description>The latest articles on DEV Community by Shameem Reza (@shameemreza).</description>
    <link>https://dev.to/shameemreza</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F126392%2F08ac285e-1949-4533-bc0a-8e9c6c8fae2a.png</url>
      <title>DEV Community: Shameem Reza</title>
      <link>https://dev.to/shameemreza</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shameemreza"/>
    <language>en</language>
    <item>
      <title>Common Use Cases Of ViewModifier In SwiftUI</title>
      <dc:creator>Shameem Reza</dc:creator>
      <pubDate>Thu, 12 Jan 2023 10:00:59 +0000</pubDate>
      <link>https://dev.to/shameemreza/common-use-cases-of-viewmodifier-in-swiftui-25o3</link>
      <guid>https://dev.to/shameemreza/common-use-cases-of-viewmodifier-in-swiftui-25o3</guid>
      <description>&lt;p&gt;ViewModifiers in SwiftUI is a powerful tool for modifying and customizing views in your app. They allow you to encapsulate common view modifications into reusable, composable units, making it easy to apply the same modifications to multiple views throughout your app. In this article, we'll explore some common use cases for ViewModifiers in SwiftUI and how you can use them to improve the design and functionality of your app.&lt;/p&gt;

&lt;p&gt;One of the most common use cases for ViewModifiers is to add padding to views. Padding is used to add space around the edges of a view and can be used to create a more visually pleasing layout. In SwiftUI, you can use the &lt;code&gt;padding()&lt;/code&gt; ViewModifier to add padding to a view. For example, the following code adds 8 points of padding to a Text view:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Text("DEV Community")
    .padding()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also specify the amount of padding on each side of the view using the &lt;code&gt;.padding(.all, 8)&lt;/code&gt; or use &lt;code&gt;.padding(.horizontal,8)&lt;/code&gt; and &lt;code&gt;.padding(.vertical,8)&lt;/code&gt; to set padding on a specific axis.&lt;/p&gt;

&lt;p&gt;Another common use case for ViewModifiers is changing the text's font. SwiftUI provides several ViewModifiers for changing the font of the text, including &lt;code&gt;font()&lt;/code&gt;, &lt;code&gt;bold()&lt;/code&gt;, &lt;code&gt;italic()&lt;/code&gt;, and &lt;code&gt;smallCaps()&lt;/code&gt;. For example, the following code sets the font of a Text view to the system font with a size of 18 points:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Text("DEV Community")
    .font(.system(size: 18))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use ViewModifiers to change the color of views. The &lt;code&gt;foregroundColor()&lt;/code&gt; ViewModifier can be used to change the color of text or other views. For example, the following code sets the text color of a Text view to pink:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Text("DEV Community")
    .foregroundColor(.pink)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another common use case for ViewModifiers is to apply a border to a view. SwiftUI provides the &lt;code&gt;border()&lt;/code&gt; ViewModifier for adding a border to a view. For example, the following code adds a black border with a width of 1 point to a Text view:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Text("DEV Community")
    .border(Color.black, width: 1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use ViewModifiers to apply a background color to a view. SwiftUI provides the &lt;code&gt;background()&lt;/code&gt; ViewModifier for adding a background color to a view. For example, the following code adds a blue background color to a Text view:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Text("DEV Community")
    .background(Color.blue)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another common use case for ViewModifiers is changing a view's shape. SwiftUI provides several ViewModifiers for changing the shape of a view, including &lt;code&gt;clipShape()&lt;/code&gt;, &lt;code&gt;overlay()&lt;/code&gt;, and &lt;code&gt;mask()&lt;/code&gt;. For example, the following code creates a circular view from a rectangular view:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rectangle()
    .clipShape(Circle())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use ViewModifiers to add a shadow to a view. The &lt;code&gt;shadow()&lt;/code&gt; ViewModifier can be used to add a shadow to a view. For example, the following code adds a gray shadow to a Text view:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Text("DEV Community")
    .shadow(color: .gray, radius: 2, x: 2, y: 2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In conclusion, ViewModifiers in SwiftUI is a powerful tool for modifying and customizing views in your app. They allow you to encapsulate common view modifications into reusable, composable units, making it easy to apply the same modifications to multiple views throughout your app. The examples I've shown in this article are just a few of the many ways you can use ViewModifiers to improve the design and functionality of your app.&lt;/p&gt;

&lt;p&gt;You can find more information about ViewModifiers in the SwiftUI documentation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/documentation/swiftui/viewmodifier" rel="noopener noreferrer"&gt;ViewModifier&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/tutorials/swiftui/modifying-views" rel="noopener noreferrer"&gt;Modifying Views with ViewModifiers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/documentation/swiftui/viewmodifier/3248644-protocol" rel="noopener noreferrer"&gt;ViewModifier Protocol&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To wrap it up, ViewModifiers are an essential part of SwiftUI. They can be used to style and customize views simply and elegantly, making it easier to maintain and scale your app's codebase. Using these view modifiers can improve your app's overall design and user experience.&lt;/p&gt;

</description>
      <category>hiring</category>
      <category>developers</category>
      <category>career</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Bringing Your Markdown to Life: A Guide to Rendering Markdown in SwiftUI</title>
      <dc:creator>Shameem Reza</dc:creator>
      <pubDate>Wed, 11 Jan 2023 10:00:17 +0000</pubDate>
      <link>https://dev.to/shameemreza/bringing-your-markdown-to-life-a-guide-to-rendering-markdown-in-swiftui-3jfe</link>
      <guid>https://dev.to/shameemreza/bringing-your-markdown-to-life-a-guide-to-rendering-markdown-in-swiftui-3jfe</guid>
      <description>&lt;p&gt;SwiftUI is a powerful framework for building intuitive and responsive user interfaces on Apple platforms. One of the most common use cases for apps is displaying rich text, and Markdown is a popular format for representing this type of content. In this article, we'll explore how to use the Down library to render Markdown in a SwiftUI app.&lt;/p&gt;

&lt;p&gt;First, let's take a look at what Markdown is and why it's useful. Markdown is a lightweight markup language that uses a simple syntax to format text. The syntax is designed to be easy to read and write and can be converted to other formats, such as HTML and PDF. Markdown is often used for documentation, readme files, and blog posts because it allows writers to focus on content, not formatting.&lt;/p&gt;

&lt;p&gt;Before we dive into the code, you need to install the &lt;a href="https://github.com/johnxnguyen/Down" rel="noopener noreferrer"&gt;Down library&lt;/a&gt; using the Swift Package Manager by adding the following line to your &lt;code&gt;Package.swift&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dependencies: [
    .package(url: "https://github.com/johnxnguyen/Down.git", from: "4.0.0")
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the Down library installed, we can create a simple SwiftUI view that displays Markdown. In the following example, we have a &lt;code&gt;ContentView&lt;/code&gt; struct that has a &lt;code&gt;TextEditor&lt;/code&gt; and a &lt;code&gt;MarkdownView&lt;/code&gt;. The &lt;code&gt;TextEditor&lt;/code&gt; allows the user to enter some Markdown text, and the &lt;code&gt;MarkdownView&lt;/code&gt; displays that text as formatted HTML. The &lt;code&gt;MarkdownView&lt;/code&gt; struct uses the &lt;code&gt;Down&lt;/code&gt; library to convert the Markdown text to HTML. The &lt;code&gt;toSwiftUI()&lt;/code&gt; method provided by &lt;code&gt;Down&lt;/code&gt; converts the HTML to a &lt;code&gt;View&lt;/code&gt;, which can be displayed by the &lt;code&gt;MarkdownView&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import SwiftUI
import Down

struct ContentView: View {
    @State private var markdown: String = "# Welcome to Dev Community\nHere is some **bold** text."

    var body: some View {
        VStack {
            Text("Enter Markdown:")
            TextEditor(text: $markdown)
            Divider()
            MarkdownView(markdown: markdown)
        }
    }
}

struct MarkdownView: View {
    let markdown: String

    var body: some View {
        let markdown = Down(markdownString: self.markdown)

        return VStack {
            markdown.toSwiftUI().frame(minWidth: 0, maxWidth: .infinity)
        }
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, the &lt;code&gt;ContentView&lt;/code&gt; struct contains a &lt;code&gt;TextEditor&lt;/code&gt; and a &lt;code&gt;MarkdownView&lt;/code&gt;. The &lt;code&gt;TextEditor&lt;/code&gt; is bound to the &lt;code&gt;markdown&lt;/code&gt; property, which is a state variable that stores the Markdown text entered by the user. The &lt;code&gt;MarkdownView&lt;/code&gt; struct takes the &lt;code&gt;markdown&lt;/code&gt; property as an input and uses the &lt;code&gt;Down&lt;/code&gt; library to convert it to HTML. The &lt;code&gt;toSwiftUI()&lt;/code&gt; method is then used to convert the HTML to a &lt;code&gt;View&lt;/code&gt;, which is displayed in the &lt;code&gt;MarkdownView&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;MarkdownView&lt;/code&gt; struct uses the &lt;code&gt;frame&lt;/code&gt; modifier to set the minimum and maximum width of the view. This ensures that the view takes up the full width of the screen, regardless of the size of the device or orientation.&lt;/p&gt;

&lt;p&gt;It's worth noting that this example is just a starting point, and in a production app, you would likely have more robust error handling and validation in place. Additionally, you could also customize the appearance of the rendered Markdown by using custom CSS styles. You can also add images and videos and provide live web links.&lt;/p&gt;

&lt;p&gt;Another thing to consider is handling different types of markdowns. With the rise of different markdown dialects like GitHub Flavored Markdown and MultiMarkdown, some features may not be supported by the Down library. However, with the flexibility of SwiftUI, you can handle this with ease.&lt;/p&gt;

&lt;p&gt;To handle different dialects of markdown, you can use any other markdown parsers available for swift like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PEGMarkdown&lt;/li&gt;
&lt;li&gt;MarkdownKit&lt;/li&gt;
&lt;li&gt;MarkdownParser&lt;/li&gt;
&lt;li&gt;MarkdownRenderer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All the libraries mentioned above have slightly different syntax and feature support, so be sure to pick the one that best fits your needs.&lt;/p&gt;

&lt;p&gt;Another thing to consider is handling large markdown files; you can load the file using the FileManager and then render it using the markdown parser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Update:
&lt;/h2&gt;

&lt;p&gt;With the latest iOS 15 update, Apple has included built-in support for Markdown in SwiftUI. This makes it even simpler to incorporate rich text formatting into your app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;struct ContentView: View {
   var body: some View {
       VStack {
           Text("**Thank you**")
               .foregroundColor(.green)
           Text("*for your support*")
           Text("Welcome to [Dev](https://dev.to) community")
       }
   }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In conclusion, SwiftUI is a powerful framework that makes it easy to build responsive user interfaces, and Markdown is a popular format for representing rich text. You can easily render Markdown in your SwiftUI app using the Down library. With the flexibility of SwiftUI, you can handle different dialects of markdown and large markdown files as well. With this approach, you can provide a great reading experience to your users.&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>3 Tricks to automate development tasks with Git hooks</title>
      <dc:creator>Shameem Reza</dc:creator>
      <pubDate>Sat, 12 Jan 2019 17:41:54 +0000</pubDate>
      <link>https://dev.to/shameemreza/3-tricks-to-automate-development-tasks-with-git-hooks-2dah</link>
      <guid>https://dev.to/shameemreza/3-tricks-to-automate-development-tasks-with-git-hooks-2dah</guid>
      <description>

&lt;p&gt;The Git version control system, like many others, comes with a few tricks in the sleeve that make it programmatically extensible. In this article we will learn one of them, the hooks, which allow automatic actions along with many of the typical Git commands.&lt;/p&gt;

&lt;p&gt;Hooks are programs that run before or after some important Git event. For example, before completing a git commit, after changing branches or before sending changes during a git push.&lt;/p&gt;

&lt;p&gt;They are stored in the .git / hooks / directory of each cloned project, and they must be executable scripts or programs (on Unix-like systems they must have the execution permission).&lt;/p&gt;

&lt;p&gt;To add a hook to your project, simply copy or link to that directory the program you want to run automatically with the name of the "event" (for example, pre-commit, all possible names are available in the Git documentation).&lt;/p&gt;

&lt;p&gt;If the program is a script and you want other collaborators to be able to use it, it is convenient to include it in the root of the project and create a direct access to it in .git / hooks /:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ln -s ../../pre-commit.sh .git/hooks/pre-commit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Let's see some practical applications of Git hooks.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Check the quality of the code before committing
&lt;/h2&gt;

&lt;p&gt;The hooks that are executed prior to the confirmation of a commit are useful since they allow us to perform checks on the added or deleted code just before reflecting those changes in the version tree of the repository.&lt;/p&gt;

&lt;p&gt;If the hook fails or returns error code, the commit will not be made.&lt;/p&gt;

&lt;p&gt;In the following example (valid for Unix systems, such as Linux or macOS), we used the jslint package from Node.js to check the quality of a JavaScript application code before completing the commit:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#!/bin/bash
# pre-commit.sh
&lt;/span&gt;
&lt;span class="c1"&gt;# Save unconfirmed changes
&lt;/span&gt;&lt;span class="n"&gt;STASH_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"pre-commit-$(date +&lt;/span&gt;&lt;span class="si"&gt;%&lt;/span&gt;&lt;span class="s"&gt;s)"&lt;/span&gt;
&lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="n"&gt;stash&lt;/span&gt; &lt;span class="n"&gt;save&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;keep&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;STASH_NAME&lt;/span&gt;

&lt;span class="c1"&gt;# Checks and tests
&lt;/span&gt;&lt;span class="n"&gt;jslint&lt;/span&gt; &lt;span class="n"&gt;my_application&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;js&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;exit&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="c1"&gt;# Recover saved changes
&lt;/span&gt;&lt;span class="n"&gt;STASHES&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="n"&gt;stash&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;STASHES&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"$STASH_NAME"&lt;/span&gt; &lt;span class="p"&gt;]];&lt;/span&gt; &lt;span class="n"&gt;then&lt;/span&gt;
  &lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="n"&gt;stash&lt;/span&gt; &lt;span class="n"&gt;pop&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;
&lt;span class="n"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You could proceed with the same strategy to launch a suite of tests on the application or other necessary checks, for example, a search for keys or secret tokens to avoid entering them into the repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Generate documentation as changes are uploaded
&lt;/h2&gt;

&lt;p&gt;If in our project we have a documentation generator from the code, we can execute it regularly as we develop using a pre-push type hook.&lt;/p&gt;

&lt;p&gt;We simply launch the necessary command to compose all the documentation in some directory (for example, docs /) and add it to a new commit.&lt;/p&gt;

&lt;p&gt;In the following list I show you several examples of the possible commands that you could use for this purpose:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#!/bin/bash
# pre-push.sh
&lt;/span&gt;
&lt;span class="c1"&gt;# Generate the documentation
&lt;/span&gt;&lt;span class="n"&gt;doxygen&lt;/span&gt; &lt;span class="n"&gt;Doxyfile&lt;/span&gt;

&lt;span class="c1"&gt;# Another example, with Python:
&lt;/span&gt;&lt;span class="n"&gt;pydoc3&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;

&lt;span class="c1"&gt;# Another example, with R:
&lt;/span&gt;&lt;span class="n"&gt;Rscript&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="s"&gt;'pkgdown::build_site()'&lt;/span&gt;

&lt;span class="c1"&gt;# Add and confirm the changes related to the documentation
&lt;/span&gt;&lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
&lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="n"&gt;commit&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="s"&gt;"Update documentation ($(date +&lt;/span&gt;&lt;span class="si"&gt;%&lt;/span&gt;&lt;span class="s"&gt;F@&lt;/span&gt;&lt;span class="si"&gt;%&lt;/span&gt;&lt;span class="s"&gt;R))"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The advantage of this is that, if you use GitHub Pages or a similar service to serve your online documentation, you will always be up to date with the changes to your code and it will not become obsolete.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Check dependencies when changing branch
&lt;/h2&gt;

&lt;p&gt;Finally, a very interesting application of the hooks is to update the installed dependencies when changing branches in a project.&lt;/p&gt;

&lt;p&gt;If you use package managers and dependencies for your development language (Pip in Python, npm in Node.js, Nuget in .NET, Bundler in Ruby, Cargo in Rust etc.), the following example can be very useful.&lt;/p&gt;

&lt;p&gt;The code listing below would correspond to a post-checkout hook, and what it does is check if between the previous branch and the new one the dependencies file has changed (in this case, Gem file for Ruby), in which case it executes the installer convenient (in this case, bundle).&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#!/bin/bash
# post-checkout.sh
&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0000000000000000000000000000000000000000&lt;/span&gt; &lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="n"&gt;then&lt;/span&gt;
  &lt;span class="c1"&gt;# If we are in a recently cloned project, compare with the empty directory
&lt;/span&gt;  &lt;span class="n"&gt;old&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="nb"&gt;hash&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nb"&gt;object&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="n"&gt;tree&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;dev&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
  &lt;span class="c1"&gt;# The first argument is the hash of the previous HEAD
&lt;/span&gt;  &lt;span class="n"&gt;old&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="n"&gt;fi&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="n"&gt;Gemfile&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
  &lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="n"&gt;diff&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;only&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;old&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;egrep&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt; &lt;span class="s"&gt;'^Gemfile|&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="s"&gt;.gemspec$'&lt;/span&gt;
&lt;span class="n"&gt;then&lt;/span&gt;
  &lt;span class="c1"&gt;# Empty $ GIT DIR prevents problems if bundle calls git
&lt;/span&gt;  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unset&lt;/span&gt; &lt;span class="n"&gt;GIT_DIR&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;exec&lt;/span&gt; &lt;span class="n"&gt;bundle&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# Checkout is completed even if the bundler fails
&lt;/span&gt;  &lt;span class="n"&gt;true&lt;/span&gt;
&lt;span class="n"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can adapt this code for your own use by changing Gemfile for the dependencies file you use (package.json or requirements.txt, for example) and bundle for the corresponding command (npm install or pip install -r requirements.txt).&lt;/p&gt;


</description>
      <category>git</category>
      <category>softwaredevelopment</category>
      <category>devops</category>
    </item>
    <item>
      <title>Suggest best resources to learn VueJs from Scratch </title>
      <dc:creator>Shameem Reza</dc:creator>
      <pubDate>Tue, 08 Jan 2019 17:57:24 +0000</pubDate>
      <link>https://dev.to/shameemreza/suggest-best-resources-to-learn-vuejs-from-scratch--14c2</link>
      <guid>https://dev.to/shameemreza/suggest-best-resources-to-learn-vuejs-from-scratch--14c2</guid>
      <description>

&lt;p&gt;I am writing an article for those who are just starting or interested to learn VueJs.&lt;/p&gt;

&lt;p&gt;I hope as a Top VueJs expert, you will suggest best resources to learn VueJs from your side.&lt;/p&gt;


</description>
      <category>vue</category>
      <category>beginners</category>
      <category>bestcourse</category>
      <category>php</category>
    </item>
    <item>
      <title>Top 5 Data Management Trends for 2019</title>
      <dc:creator>Shameem Reza</dc:creator>
      <pubDate>Tue, 08 Jan 2019 10:19:44 +0000</pubDate>
      <link>https://dev.to/shameemreza/top-5-data-management-trends-for-2019-nb1</link>
      <guid>https://dev.to/shameemreza/top-5-data-management-trends-for-2019-nb1</guid>
      <description>

&lt;p&gt;Since the way we consume and interact with the data changes daily, we also have a considerable number of innovations to improve the agility of the companies and their operational efficiency. With the EMEA market in mind, I have highlighted the following 5 relevant trends that decision makers must know in 2019:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. It will increase the use of multi-cloud environments
&lt;/h2&gt;

&lt;p&gt;A report by McKinsey &amp;amp; Company has shown that the flow of data to Asia is up to 45 times higher than in 2005. Data from key regions such as North America and Europe have grown considerably from 5,000 to 20,000 Gbps and 1,000 to 5,000 Gbps respectively. Based on the original figures of 100-500 Gbps and less than 50 Gbps in 2005.&lt;/p&gt;

&lt;p&gt;With companies that operate beyond their borders and being more technology-dependent than ever. It is practically inevitable to expand the use of the multi- cloud IDC estimates that customers will spend $554 billion on cloud computing and related services in 2021, more than double that of 2016.&lt;/p&gt;

&lt;p&gt;On-premises data and applications will not become obsolete, but data deployment models will increase by mixing each Once again the option on premise (own data center), software as a service (SaaS), infrastructure as a service (IaaS), managed clouds and private clouds.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The shortage of flash memory supply and prices will improve in 2019
&lt;/h2&gt;

&lt;p&gt;According to a Gartner report from October 2018, it is expected that there will be a slight shortage of supply shortages in flash memory by mid-2019 and that prices will be stabilized to a large extent thanks to the increase in the production of memory in China.&lt;/p&gt;

&lt;p&gt;Greater supply and improved pricing will mean that flash deployment will be used more in the field of operational recovery, where the fourteen most recent days of backup and replication data are normally hosted.&lt;/p&gt;

&lt;p&gt;In my opinion, this increased flash capacity will result in an increased use of instantaneous mounting of backup machine images (or copy data management).&lt;/p&gt;

&lt;p&gt;Systems that offer the copy data management (CDM) function can provide value beyond availability, as well as better commercial results. Some of the practical examples of use to take advantage of the backup and replication data are: DevOps, DevSecOps and DevTest, Patch Testing, Analytics and Reporting (testing, analysis and generation of patch reports).&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Predictive analysis will become widespread and standard
&lt;/h2&gt;

&lt;p&gt;Forecasts indicate that the predictive analytics market will reach 12,410 million dollars in 2022, which will mean an increase of 272% since 2017, with a compound annual growth rate of 22.1%.&lt;/p&gt;

&lt;p&gt;Specifically, the Asia-Pacific market (APAC) is expected to register the highest compound annual growth rate during the period of this forecast.&lt;/p&gt;

&lt;p&gt;The predictive analysis based on telemetry data, essentially advice and recommendations driven by machine learning (ML or machine learning), is one of the categories that surely becomes generalized and the norm.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The "versatile" (or generalist) function will become the new operating model for most IT companies
&lt;/h2&gt;

&lt;p&gt;While the first two trends focused on technological aspects, the future of digital remains analog: people.&lt;/p&gt;

&lt;p&gt;If we combine the talent shortage with new infrastructure and on the verge of collapse on premises, the public cloud + software as a service (SaaS), we will find that specialists with experience in a wide range of disciplines are needed, who also have to know better the business.&lt;/p&gt;

&lt;p&gt;For example, the labor market of information technology (IT) in Singapore continues to register high levels of recruitment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;a. Frustration with traditional backup approaches and solutions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The three main suppliers in the sector will continue to lose market share in 2019. In fact, the largest supplier in the sector has been losing market share for ten years.&lt;/p&gt;

&lt;p&gt;Companies are leaving aside traditional suppliers and prefer more agile, disruptive and dynamic options that offer them the functions they need to grow in the data-driven era.&lt;/p&gt;

&lt;p&gt;A Cognizant report noted that 82% of leaders of companies in the Asia-Pacific (APAC) believe that the future of work lies in smart machines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;b. The critical points of the three C's: Cost, complexity and capacity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These three C's are still the reason why those who work with data centers are not happy with the solutions of other providers.&lt;/p&gt;

&lt;p&gt;In general, the costs are excessive, it is unnecessarily complex and lacks sufficient capacity, which affects the speed of backup, restoration or instantaneous mounting to a virtual machine image.&lt;/p&gt;

&lt;p&gt;These three key criteria will continue to be the main reasons why companies increase or completely replace their backup solutions.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. The arrival of the first 5G networks will create new opportunities for distributors and cloud service providers (CSPs) to collect, manage, store and process the largest possible volume of data.
&lt;/h2&gt;

&lt;p&gt;The 5G will be adopted quickly for machine-to-machine communication and for Internet of Things (IoT) technology. The mobile consumer network has reached a point where it is likely that 4G speed is fast enough to meet the needs of most consumers.&lt;/p&gt;

&lt;p&gt;2019 will focus more on the standardization and generalized testing of technology. &lt;/p&gt;

&lt;p&gt;On devices designed for the future capable of guaranteeing that they are compatible with technology when available and in Europe converted into a genuine "Gigabit Society".&lt;/p&gt;


</description>
      <category>data</category>
      <category>datamanagement</category>
      <category>cloudcomputing</category>
      <category>bigdata</category>
    </item>
    <item>
      <title>Accelerate your website with Nginx as a reverse proxy cache</title>
      <dc:creator>Shameem Reza</dc:creator>
      <pubDate>Sun, 06 Jan 2019 17:45:00 +0000</pubDate>
      <link>https://dev.to/shameemreza/accelerate-your-website-with-nginx-as-a-reverse-proxy-cache-a9o</link>
      <guid>https://dev.to/shameemreza/accelerate-your-website-with-nginx-as-a-reverse-proxy-cache-a9o</guid>
      <description>

&lt;p&gt;Optimizing Web Performance is a pending issue that we must continually work on. There are multiple solutions to improve our response times.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an Inverse Proxy cache?
&lt;/h2&gt;

&lt;p&gt;In computing, a reverse proxy is a type of server located between the client and the server or web servers that retrieves the resources of these. These resources are returned to the client as if returned by the web server itself. Basically it is an intermediary that can act in different roles.&lt;/p&gt;

&lt;p&gt;The possible applications that we can give to this proxy is to use it as a firewall to an internal network, as a load balancer, as a tool to apply an AB Testing or the reason for this article, as a static cache server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dP3ZR3SM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wvk7ptlr3ohmm4l6yb7k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dP3ZR3SM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wvk7ptlr3ohmm4l6yb7k.png" alt="static cache server"&gt;&lt;/a&gt;&lt;br&gt;
Image credit: Privacy Canada (&lt;a href="https://privacycanada.net"&gt;https://privacycanada.net&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Basically this server used as a cache, consults the web server if it does not have the requested resource, a MISS occurs and this resource is stored in memory. The next request to the same resource is served by the proxy itself in a very efficient way, producing a HIT and avoiding the call to the web server during a given TTL. In this way we can mount a static server centralized and from which we serve all our static content.&lt;/p&gt;

&lt;p&gt;There are different technologies that allow us to fulfill this scenario. One of the best known tools is Varnish, but Nginx apart from web server can also be configured to act as a reverse proxy cache. Reading several articles of comparisons and benchmarks the difference is minimal, so today we are going to focus on the Nginx-Nginx scenario.&lt;/p&gt;

&lt;p&gt;However, we could represent the same scenario with different combinations: Varnish-Apache, Varnish-Nginx or Nginx-Apache, being the first of the couple the cache server and the second the web server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Nginx?
&lt;/h2&gt;

&lt;p&gt;Like Varnish, Nginx is able to act as a web cache but not all system administrators know this aspect. Nginx can serve static content directly in a very efficient way and can act as a front-facing cache, just like Varnish would. While Varnish its only task is to act as a cache with advanced options, Nginx is versatile and offers several alternatives.&lt;/p&gt;

&lt;p&gt;The truth is that I would not know which of the two options to decline, but the decision to use only nginx, is not to introduce new technologies to learn and maintain in our infrastructure, and it seems that the configuration of nginx is much simpler than the of Varnish.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mounting the infrastructure
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Install Nginx&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To install nginx on our server we simply execute the following command:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;nginx

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;By default nginx will be installed on your system listening on port 80, serving a static welcome html. Let's see how to configure nginx.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configure the web server&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First of all we must take into account that the web server that will read the resources of our filesystem should no longer listen on port 80, because the proxy will be placed instead.&lt;/p&gt;

&lt;p&gt;We are going to create a folder where our resources will be hosted:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; /var/www/assets

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After this we are going to configure our nginx so that it listens on port 81, that defines as root our directory of resources and that includes a time of expiration of the resource of 12 hours. This can be configured through regular expressions that allows configuration. For this we generate the following file / etc / nginx / sites-available / static-server&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;server &lt;span class="o"&gt;{&lt;/span&gt;
listen 81&lt;span class="p"&gt;;&lt;/span&gt;
server_name &lt;span class="o"&gt;{{&lt;/span&gt;tu ip o subdominio&lt;span class="o"&gt;}}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
access_log /var/log/nginx/static-server.log&lt;span class="p"&gt;;&lt;/span&gt;
location ~&lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
expires 12h&lt;span class="p"&gt;;&lt;/span&gt;
root /var/www/assets&lt;span class="p"&gt;;&lt;/span&gt;
add_header Cache-Control &lt;span class="s2"&gt;"public"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And finally we'll move it to / etc / nginx / sites-enabled / static-server. If we now make a request to a resource through port 81 we should be able to receive it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure the proxy cache
&lt;/h2&gt;

&lt;p&gt;To configure nginx to act as a cache we will use the proxy_cache_path directive. This directive indicates a directory of your machine where all the resources that are being cached will be stored.&lt;/p&gt;

&lt;p&gt;This directory should contain the www-data group and 700 permissions so that the proxy can write correctly. In addition, this directive indicates a keys_zone identifier that defines the name, the maximum size of this cache with max_size, and the levels of indirection of the folder hierarchy in the cache.&lt;/p&gt;

&lt;p&gt;We will also rely on another proxy_cache_key directive, which is the key to store the cached resources. Basically nginx makes a hash of this structure, in this way to be able to choose the level of cache, for example if it uses the same parameter or not in the url.&lt;/p&gt;

&lt;p&gt;Once we have these two directives clear, we will indicate that the proxy listens on port 80, and that any request that comes inspect the cache area that we have defined and otherwise check against our web server listening on port 81 with the proxy_pass directive&lt;/p&gt;

&lt;p&gt;In addition Nginx includes a header called X-Proxy-Cache that tells the client if the resource was returned by the cache (HIT) or had to consult the web server (MISS). This information is especially interesting to debug that everything is working correctly.&lt;/p&gt;

&lt;p&gt;Now I am leaving the complete configuration of the caching server:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#/etc/nginx/sites-enabled/caching-server&lt;/span&gt;
proxy_cache_path /tmp/nginx &lt;span class="nv"&gt;levels&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1:2 &lt;span class="nv"&gt;keys_zone&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;assets_zone:10m &lt;span class="nv"&gt;inactive&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;60m&lt;span class="p"&gt;;&lt;/span&gt;
proxy_cache_key &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$scheme$request_method$host$request_uri&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
server &lt;span class="o"&gt;{&lt;/span&gt;
listen 80&lt;span class="p"&gt;;&lt;/span&gt;
server_name &lt;span class="o"&gt;{{&lt;/span&gt;tu ip o subdominio&lt;span class="o"&gt;}}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
access_log /var/log/nginx/caching-server.log&lt;span class="p"&gt;;&lt;/span&gt;
location /static/ &lt;span class="o"&gt;{&lt;/span&gt;
proxy_cache assets_zone&lt;span class="p"&gt;;&lt;/span&gt;
add_header X-Proxy-Cache &lt;span class="nv"&gt;$upstream_cache_status&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
include proxy_params&lt;span class="p"&gt;;&lt;/span&gt;
proxy_pass http://localhost:81/&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I hope this article has been interesting and useful and I hope you tell us your experiences on how you have optimized your website and the problems you have faced and solutions you have implemented.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related links:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://serversforhackers.com/nginx-caching"&gt;https://serversforhackers.com/nginx-caching&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.digitalocean.com/community/tutorials/understanding-nginx-http-proxying-load-balancing-buffering-and-caching"&gt;https://www.digitalocean.com/community/tutorials/understanding-nginx-http-proxying-load-balancing-buffering-and-caching&lt;/a&gt;&lt;/p&gt;


</description>
      <category>nginx</category>
      <category>performance</category>
      <category>webperf</category>
      <category>wpo</category>
    </item>
  </channel>
</rss>
