Changing the background color of table view items is different from changing the background color of the table view. New programmers may often confuse between these two things, In this post, we will be seeing how to change the background color of TableView items i.e. cells.So let’s get started.For changing the background color of the table view cell, you should change the contentView.backgroundColor property of the cell.Add the below code in your cellForRowAt indexPath method, cell.contentView.backgroundColor = UIColor.cyanYour method should look like something below, func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell: UITableViewCell = tableView.dequeueReusableCell(withIdentifier: ... Read More
As per the Apple document – “Global variables are variables that are defined outside of any function, method, closure, or type contextBefore we learn how to create global variables, first let us understand completely what are they.Consider “W” which is inside the inner circle, can access everything which will be inside the inner circle. On the other hand, A can access everything which is inside the outer circle as well as everything inside the inner circle, so the scope of “A” is global as he can access both the circles.So a global variable can access everything inside the bigger and ... Read More
Coming from Objective C- Background now we don’t need to use NSDate as Swift has defined its own struct type Date. Date bridges to the NSDate class. You can use these interchangeably in code that interacts with Objective-C APIs.To read more about Date you can check official apple docs https://developer.apple.com/documentation/foundation/dateIn this post we will be seeing how one can create date object, So let’s get started we will be using Playground for this purpose.First, we will be seeing how to get the current date and time (UTC), to get current date and time, create an object of Date, enter the ... Read More
In computer networks, Gigabit Ethernet (GbE) is the family of Ethernet technologies that achieve theoretical data rates of 1 gigabit per second (1 Gbps). It was introduced in 1999 and was defined by the IEEE 802.3ab standard.Varieties of Gigabit EthernetThe popular varieties of fast Ethernet are 1000Base-SX, 1000Base-LX, 1000BASE-T and 1000Base-CX.1000BASE-CXDefined by IEEE 802.3z standardThe initial standard for Gigabit EthernetUses shielded twisted pair cables with DE-9 or 8P8C connectorMaximum segment length is 25 metresUses NRZ line encoding and 8B/6B block encoding1000BASE-SXDefined by IEEE 802.3z standardUses a pair of fibre optic cables of a shorter wavelength having 770 – 860 nm ... Read More
This example demonstrates how do I get current location latitude and longitude in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.javaimport android.Manifest; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationManager; import android.provider.Settings; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { private static final ... Read More
Setting up CookiesIt is very easy to send cookies to browser. These cookies are sent along with HTTP Header before to Content-type field. Assuming you want to set UserID and Password as cookies. Setting the cookies is done as follows −#!/usr/bin/python print "Set-Cookie:UserID = XYZ;\r" print "Set-Cookie:Password = XYZ123;\r" print "Set-Cookie:Expires = Tuesday, 31-Dec-2007 23:12:40 GMT;\r" print "Set-Cookie:Domain = www.tutorialspoint.com;\r" print "Set-Cookie:Path = /perl;" print "Content-type:text/html\r\r" ...........Rest of the HTML Content....From this example, you must have understood how to set cookies. We use Set-Cookie HTTP header to set cookies.It is optional to set cookies attributes like Expires, Domain, and Path. ... Read More
In this article, we will learn about the tools to support Data Science other than Python and R?Here we will look at five tools that help in implementing the concept of data science.Apache HadoopJava-based free softwareLarge storage capabilityThe splitting capacity of dataNosqlMore structured orientationBetter performance efficiencyOpen-source software efficiencyHiveDistributed data management systemHighly useful in data miningTorchScientific computing frameworkIt uses Lua programming languageIt can easily implement deep learning algorithmsDomino data labUnified data science toolIncreases iteration speedRemoves deployment frictionConclusionIn this article, we learned about some of the powerful tools available in the field of data science other than Python & R.
In this tutorial, we will learn about looping techniques in python 3.x. Or earlier. There are many ways in which we can implement loops. Here we will be discussing four techniques in looping.Enumeration constructExample Live Demo# enumerate() type for index, value in enumerate(['Tutorial', 'point']): print(index, value)Output0 Tutorial 1 pointZip constructExample Live Demo# zip() method arr1 = ['Tutorial', 'point'] arr2 = ['python', 'loops'] for i, j in zip(arr1, arr2): print(i, j)OutputTutorial python point loopsMembership constructExample Live Demo# membership operator for i in ['Tutorial', 'point']: print(i)OutputTutorial pointInfinitive constructExample# infinite loop while(True): passStep - based constructExample# range with step incrementer For i ... Read More
In this article, we will learn about K’th Non-repeating Character in Python using List Comprehension and OrderedDict. To do so we take the help of inbuilt constructs available in Python.Algorithm1. First, we form a dictionary data from the input. 2. Now we count the frequency of each character. 3. Now we extract the list of all keys whose value equals 1. 4. Finally, we return k-1 character.Examplefrom collections import OrderedDict import itertools def kthRepeating(inp, k): # returns a dictionary data dict=OrderedDict.fromkeys(inp, 0) # frequency of each character for ch in inp: ... Read More
In this article, we will learn about the four iterator functions available in Python 3.x. Or earlier namely accumulate() , chain(), filter false() , dropwhile() methods.Now let’s look on each of them in detail −Accumulate () & chain() methodAccumulate() method takes two arguments, one being iterable to operate on and another the function/operation to be performed. By default, the second argument performs the addition operation.Chain() method prints all the iterable targets after concatenating all of the iterables.The below example explains the implementation −Example Live Demoimport itertools import operator as op # initializing list 1 li1 = ['t', 'u', 't', 'o', 'r'] ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP