Found 26504 Articles for Server Side Programming

Objective-C and Swift URL encoding

Nitin Aggarwal
Updated on 11-Apr-2023 11:01:18

2K+ Views

URL encoding is an essential part of iOS app development. Many times, you will need to encode the URL to communicate with servers. Let's look at some examples of how you can encode an URL in Swift and Objective-C. URL Encoding in Swift In Swift, you can use the addingPercentEncoding(withAllowedCharacters:) method for URL encoding. URL Encoding in Objective-C In Objective-C, you can use the stringByAddingPercentEncodingWithAllowedCharacters method for URL encoding. Encode a URL in Objective-C In Objective-C, you can encode a URL string using the stringByAddingPercentEncodingWithAllowedCharacters: method of the NSString class. Here's an example NSString *stringToEncode = @"https://www.exampleserver.com/complete path with spaces"; ... Read More

New Array from Index Range Swift

Nitin Aggarwal
Updated on 11-Apr-2023 10:53:41

1K+ Views

In Swift, you can create an array using the ArraySlice type. The following examples will show how to use the ArraySlice type. You can create an extension as well to define the subscript method. Example 1 In the following example, we create an array of numbers with values from 0 to 9 and then create a range of indices from startIndex to endIndex (exclusive). Using this range we can generate an ArraySlice of the original array. In the end, we will convert the ArraySlice to an array using the Array initializer and print the result. import Foundation let numbers = ... Read More

Multiple Type Constraints in Swift

Nitin Aggarwal
Updated on 11-Apr-2023 10:50:39

1K+ Views

In Swift, there are several ways to implement type constraints on types. We will use some common approaches like the where clause, protocol, etc. Generics provide lots of flexibility to write better and more secure code in Swift. We can apply generics to collections, custom types, etc. One of them is generic type constraints. Using type constraints, you can make your generic code behave that matches a certain set of constraints whatever you define. Swift provides multiple ways to specify type constraints on generic type parameters. Type constraints using the "where" clause The "where" clause in Swift is a highly ... Read More

How to Create and Customize Venn Diagrams in Python?

Manthan Ghasadiya
Updated on 10-Apr-2023 13:39:30

1K+ Views

Venn diagrams are diagrams used to represent the relationships between sets. To create Venn diagrams, we are going to use matplotlib. Matplotlib is a popular data visualization library used in Python to create interactive plots and charts. It is also used to make interactive figures and diagrams. Matplotlib provides a number of functions to customize plots and diagrams. In this tutorial, we will illustrate three examples to customize Venn diagrams. Example Here’s a simple example that creates an intersection of two Venn diagrams; first, we imported necessary libraries and imported venns. Then we created data sets as Python ... Read More

How to create an ogive graph in python?

Manthan Ghasadiya
Updated on 10-Apr-2023 13:37:43

580 Views

An ogive graph graphically represents the cumulative distribution function (CDF) of a set of data, sometimes referred to as a cumulative frequency curve. It is applied to examine data distribution and spot patterns and trends. Matplotlib, Pandas, and Numpy are just a few of the libraries and tools offered by Python to create ogive graphs. In this tutorial, we'll look at how to use Matplotlib to generate an ogive graph in Python. To create an ogive graph, we need to import the required libraries. In this example, we will use Matplotlib, Pandas, and Numpy. Matplotlib is a popular data visualization ... Read More

How to create BMI calculator web app using Python and PyWebio?

Manthan Ghasadiya
Updated on 10-Apr-2023 12:54:51

587 Views

PyWebio is a python library that can be used to build web applications that require simpler UI. It provides several functions to create a simple web browser. Anyone can build simple web applications using PyWebio without prior knowledge of HTML and JavaScript. This tutorial will illustrate two methods to create a web to calculate BMI. Body mass index (BMI) measures body fat based on weight and height. It is commonly used to determine whether a person is underweight, normal, overweight, or obese. Example In this example, we define a ‘BMICalculator’ class that contains all the methods needed to calculate ... Read More

How to Create a Sequence of Linearly Increasing Values with NumPy Arrange?

Manthan Ghasadiya
Updated on 10-Aug-2023 15:57:18

520 Views

NumPy is a Python library widely used for numerical computations and scientific data analysis. One of the most commonly used functions of NumPy is ‘numpy.arange()’, which creates a sequence of linearly increasing values with a given start, stop, and step size. In this tutorial, we'll examine how to use ‘numpy.arange()’ to produce a sequence of linearly increasing values. We will illustrate three examples of linearly arranged values with different steps. In this tutorial, we will learn to create a sequence of linearly increasing values with a NumPy arrange. We will be using NumPy, which is a famous python library. ... Read More

Check If the Rune is a Letter or not in Golang

Sabid Ansari
Updated on 07-Apr-2023 11:14:29

2K+ Views

There is built-in support for Unicode, including its rune type, in the statically-typed computer language Go. A Unicode code point is represented by a rune, which is the equivalent for the int32 type. There are various methods for determining if a rune is a letter or not in the Go language. In this article, we'll explore how to check if a rune is a letter or not in Go, and we'll provide examples of how to do that using different techniques. Why do we need to check If a Rune is a Letter? A rune in Go is a Unicode ... Read More

Delete Elements in a Slice in Golang

Sabid Ansari
Updated on 07-Apr-2023 11:12:13

13K+ Views

Slices in Golang are dynamically-sized sequences that provide a more powerful interface than arrays. They are commonly used for storing collections of related data. Sometimes, we may want to delete elements from a slice. In this article, we will discuss how to delete elements in a slice in Golang. Deleting Elements in a Slice In Golang, we can delete elements from a slice using the built-in append() function. Here's how it works − ExampleHere's an example of how to use the deleteElement() function to delete an element from a slice −package main import "fmt" func deleteElement(slice []int, index ... Read More

Defer Keyword in Golang

Sabid Ansari
Updated on 07-Apr-2023 11:08:44

6K+ Views

Golang is a statically-typed programming language that is popular among developers for its simplicity, concurrency support, and garbage collection. One of the unique features of Golang is the defer keyword, which is used to schedule a function call to be executed after the function completes. In this article, we will explore the defer keyword in Golang, its syntax, and use cases. What is the Defer Keyword? In Golang, the defer keyword is used to delay the execution of a function until the surrounding function completes. The deferred function calls are executed in Last-In-First-Out (LIFO) order. That means the most recently ... Read More

Advertisements