Minecraft PE APK ⛏️🔴⛏️ - Minecraft Pocket Edition APK (Full) v0.16.2.2 [No Mod+Mod] ⛏️🔴⛏️

Minecraft PE APK - Minecraft-Pocket Edition APK (Full) v0.16.2.2 [No Mod+Mod] | Category: Arcade Action & Adventure
Requires: Android 2.3 and p
Craft, create, and explore alone, or with friends on mobile devices..
What is Mod: Immortality & More
What is in this version: Our latest free update includes pistons, jungle temples, texture packs, Xbox Live support (including Achievements!), and a brand new service: REALMS!
 Realms is the easiest way to play with friends cross-platform in a world that exists always: anytime, anywhere.
Try a free 30-day trial in-app today, and learn more at http://minecraft.net/realms
Explore randomly generated worlds and build amazing things from the simplest of homes to the grandest of castles.
Play in creative mode with unlimited resources or mine deep into the world in survival mode, crafting weapons and armor to fend off the dangerous mobs.
Craft, create, and explore alone, or with friends on mobile devices or Windows 10.

NETWORK EFFECTS DEFINITION 🔴🔴🔴




NETWORK EFFECTS

WHY NETWORK EFFECTS ARE IMPORTANT?

70% of the value created in technology since 1994 has been driven by network effects. Still, too few Founders understand network effects well, nor know how to design them into products.

NETWORK EFFECTS DEFENSIBILITIES

  • Scale,
  • Embedding,
  • Brand,
  • Network Effects.
Of these four, network effects are the most powerful!

THE NETWORK EFFECTS:

  • PHYSICAL (landline telephones)
  • PROTOCOL (ethernet)
  • PERSONAL UTILITY (iMessage, WhatsApp)
  • PERSONAL (Facebook)
  • MARKET NETWORK (HoneyBook, AngelList)
  • MARKETPLACE(eBay, Craigslist)
  • PLATFORM (2-sided) (Windows, iOS)
  • ASYMPTOTIC MARKETPLACE (Uber, Lyft)
  • DATA (Waze, Yelp!)
  • TECH PERFORMANCE (BitTorrent)
  • LANGUAGE (Google, Xerox)
  • BELIEF (Currencies, religions)
  • BANDWAGON (Slack, Apple)
  • and counting...

NETWORKS ARE ANY SET OF NODES AND LINKS

Nodes are network participants. Not all nodes are equal in function and importance. Central nodes have a high relative number of links, and marginal nodes have fewer links.
Network size can be measured by the total number of nodes in a network, and degree is a measure of the number of links each node has.
Links are the connections between nodes in a network. Links vary in terms of directionality, the strength of the connection, and the frequency of activity.
Network density is the proportion of links to nodes within a network.

NETWORKS ARE ANY SET OF NODES AND LINKS

NETWORK DENSITY

Network density is the ratio of its links to nodes. The higher the ratio, the greater the density of the network. Typically, the higher the density of the network, the more powerful its network effects are.
Founders should build products to promote higher network density. Within a network, density is usually distributed unevenly. At the beginning, Founders should typically focus on the “white-hot center” of your network, where the density and activity are highest, and let the network grow from there.

NETWORK DENSITY

DIRECTIONALITY

A link between nodes can be either directed or undirected.
Directed links denote one-way relationships. When the interaction between one node and another isn’t reciprocated, it’s a directed link.
Undirected links are two-way, reciprocal relationships. The interaction between two nodes on a network with undirected links flows both ways.

ONE-TO-ONE vs. ONE-TO-MANY

Relationships between nodes in a network can be one-to-one, or they can be one-to-many.
YouTube is an example of a network with one-to-many links (accounts with large followings that they don’t follow back).
Facebook has one-to-one connections at its foundation.

NETWORK CRITICAL MASS

The critical mass of a network refers to the point at which the value produced by the network exceeds the value of the product itself and of competing products.
Most products with network effects must ultimately reach critical mass in order to fully take advantage of the defensibility provided by their network effects.
Before the size of the network reaches critical mass, the product remains quite vulnerable and may not have much value to users.

NETWORK CRITICAL MASS

THE NETWORK “LAWS"

These laws describe the rate at which network value increases as they scale.
Sarnoff’s Law describes broadcast networks, which increase in value in proportion to N (with N being the number of nodes).
Metcalfe’s Law describes networks without clustering, which grow in value at a geometric rate (N^2).
Reed’s Law applies to networks with clusters, which increase in value at an exponential rate (2^N)

THE NETWORK “LAWS"

REAL IDENTITY, PSEUDONYMITY, & ANONYMITY

Many network effect businesses require users to create a profile that’s visible to other nodes in the network. Networks with profiles tied to a node’s real identity, like your real personal name or real company name, are typically more effective at building network effects than networks with pseudonymous profiles (e.g. user-generated handles like “Tiger123”) or completely anonymous networks.

REAL IDENTITY, PSEUDONYMITY, & ANONYMITY

ASYMMETRY

This term relates mostly to marketplaces, whether that marketplace is 1, 2, 3, or N-sided.
In nearly every marketplace, one side - or one type of node - is harder to acquire than the other. In a “demand-side marketplace,” the demand side (buyers) are harder to acquire. In a “supply-side marketplace,” the sellers are harder.
Look for these various asymmetries in a marketplace and prioritize which types of demand or supply will be the best to attract first, second, and third. Then focus on developing tactics to crack the highest-value target first.

HOMOGENEOUS VS HETEROGENEOUS NETWORKS

Homogeneous networks are networks where all the nodes have the same function in the network. One user is interchangeable with the next in the basic function they perform. In a landline telephone network, for example, each node (telephone) performs basically the same function as any other.
Heterogeneous networks are networks where there are two or more classes of nodes categorized by both function and utility. Buyer nodes on eBay, for example, are on the network for fundamentally different reasons from seller nodes.

HOMOGENEOUS VS HETEROGENEOUS NETWORKS

SAME-SIDE NETWORK EFFECTS

Same-side network effects are direct network effects that occur on the same side of a multi-sided (2-sided or N-sided) network. A platform like Microsoft’s OS, for instance, has a same-side network effect because Microsoft users directly benefit from an increase in other same-side users (on the demand side of the platform) since they can interchange Word, Excel, and other files with a greater number of people. This makes both the platform itself and applications developed on the platform more valuable for users.

Same-side network effects are direct network effects that occur on the same side of a multi-sided (2-sided or N-sided) network

CROSS-SIDE NETWORK EFFECTS

Cross-side network effects are direct network effects that arise from complementary goods or services in a network with more than one side. As opposed to indirect network effects, cross-side network effects refers specifically to the direct increase in value to users on one side of a network by the addition of users to another side. More supply is better for the demand. More demand is better for the Supply.

CROSS-SIDE NETWORK EFFECTS

INDIRECT NETWORK EFFECTS

Indirect network effects occur when the value of a network increases as a result of one type of node benefitting another type of node directly, but not directly benefiting the other nodes of its same type.
Same-side nodes indirectly benefit each other because they create an increased incentive for complementary users on the other side of the network to use the network, which in turn benefits all the nodes on the same side.

MULTIPLAYER VS SINGLE-PLAYER MODE

Multiplayer mode” and “single-player mode” are terms that came from the gaming industry, but are useful for discussing network effects.
With single-player mode products, you get the full value of the product no matter who else is using it. For example, filing taxes via TurboTax. With multiplayer mode products, some of the value of using a product (and often the majority of it) comes from other users. A multi-player product lets you feel and benefit from the activity of other users.
Products can have both single-player and multiplayer value. Watching YouTube videos is a single-player experience. YouTube, with view count and comments, is also a multiplayer experience.

SWITCHING COSTS

Switching costs refer to the costs in time, effort, or money that arise when you switch from using one product to another incompatible product. When switching costs are high, it tends to create customer lock-in because the customer has more of an incentive to stick with the same supplier throughout their life cycle. Any product that has a lot of defensibility will have high switching costs

Switching costs refer to the costs in time, effort, or money that arise when you switch from using one product to another incompatible product

MULTITENANTING

Multi-tenanting occurs when there are low costs or no costs to simultaneously participating in competing networks at the same time. When the two sides of a marketplace switch between services to get to the other side of the marketplace at no cost, that’s multi-tenanting. For example, both riders and passengers frequently switch between Uber and Lyft to find rides/passengers.

Multi-tenanting occurs when there are low costs or no costs to simultaneously participating in competing networks at the same time

DISINTERMEDIATION

Disintermediation is a vulnerability that mostly applies to Marketplaces and Market Networks. It happens when, after initially connecting through a marketplace or market network product, users take future transactions off the product and transact directly, without paying a fee to the marketplace.
For example, you might hire someone to build IKEA furniture using Taskrabbit, and then exchange numbers so that you can hire them for future jobs directly.
This is a significant problem for marketplaces and market networks because repeat purchase is critical to most transactional networks.
To help prevent disintermediation, you can provide tools, reputation, insurance, compliance, leads and other incentives.

Disintermediation is a vulnerability that mostly applies to Marketplaces and Market Networks

RETENTION

Retention is about how often your users return to use your product. This can make a big difference in how powerful the network effects of a product are.
Recall that network effects happen when increased usage of a network leads to greater value. Usage can increase in one of two ways: either new users join the network, or existing users increase their usage.
Any drop off in usage from existing users will weigh against the growth of the network from new users. That’s why retention is so important for building network effects.

Retention is about how often your users return to use your product

VIRAL EFFECTS AND VIRALITY

Viral effects are different than network effects, but many people confuse the two because they are both positive feedback loops, and because they were experienced together in famous companies like Facebook, Twitter, and WhatsApp over the last 15 years.
Viral effects are about growth -- when existing users bring you more new users for free. Network effects are about defensibility: a product gets more valuable when more people use it. A product or service with viral effects has a “viral coefficient”, which is the number of new users that join as a result of each user.

Viral effects are different than network effects

BRAND

Brand defensibility is different from network effects. Like scale, the strength of your brand is correlated with the growth and usage of your product, so it’s easy to confuse brand with network effects. However, they work very differently.
Brand arises when people know who you are and what you do. A well-established brand identity comes with psychological switching costs. People are less likely to switch to an unknown or lesser-known brand from yours because psychologically they will default toward what’s familiar

Brand defensibility is different from network effects

EMBEDDING

Embedding is an effective defensibility strategy that involves integrating your product directly into a customer’s operations so the customer can’t rip you out and replace you with a competitor without incurring significant cost in terms of time, energy, or both.
Embedding can work with network effects to make your business more defensible, but they are separate concepts. Business models based on embedding include Oracle and WorkDay

Business models based on embedding include Oracle and WorkDay

BASICS OF Python PROGRAMMING LANGUAGE 🔴🔴🔴




BASICS OF PYTHON PROGRAMMING LANGUAGE

BASICS OF Python PROGRAMMING LANGUAGE

Python ANACONDA SETUP INSTALLATION

Let's install Python the Anaconda in right way:
  • Download Anaconda (which includes Python): https://www.anaconda.com/download/

  • Run the installer and follow the installation instructions

  • Run the Spyder editor and create your first Python program "helloworld.py"

Python SETUP

Python VARIABLES DATA AND TYPES

Variables store and give names to data values. Data values can be of various types:
• int : -5, 0, 1000000
• float : -2.0, 3.14159
• bool : True, False
• str : "Hello world!", "K3WL"
• list : [1, 2, 3, 4], ["Hello", "world!"], [1, 2, "Hello"], [ ]
• And many more!
• In Python, variables do not have types!
• Data values are assigned to variables using "="
x = 1 # this is a Python comment
x = x + 5
y = "Python" + " is " + "cool!"

Python CONDITIONALS AND LOOPS:

• Rely on boolean expressions which return either True or False
• 1 < 2 : True
• 1.5 >= 2.5 : False
• answer == "Computer Science" : can be True or False depending on the value of variable answer
• Boolean expressions can be combined with: and, or, not
• 1 < 2 and 3 < 4 : True
• 1.5 >= 2.5 or 2 == 2 : True • not 1.5 >= 2.5 : True

Python CONDITIONALS: GENERIC FORM

if boolean-expression-1:
code-block-1
elif boolean-expression-2:
code-block-2
(as many elif's as you want)
else:
code-block-last

Python CONDITIONALS: GRADING

grade = int(raw_input("Numeric grade: "))
if grade >= 80:
print("A")
elif grade >= 65:
print("B")
elif grade >= 55:
print("C")
else: print("E")

Python LOOPS

Python loops are useful for repeating code:
while boolean-expression:
code-block

for element in collection:
code-block

Python WHITE LOOPS

while raw_input("Which is the best subject? ") != "Computer Science": print("Try again!")
print("Of course it is!"

Python FOR LOOPS

We have seen (briefly) two kinds of collections: string and list
For loops can be used to visit each collection's element:
for chr in "string": print(chr)
for elem in [1,3,5]: print(elem)

Python FUNCTIONS

Functions encapsulate code blocks

PYTHON FUNCTIONS: GENERIC FORM

def function-name(parameters):
code-block
return value

Python FUNCTIONS: CELSIUS TO FAHRENHEIT

def celsius_to_fahrenheit(celsius):
fahrenheit = celsius * 1.8 + 32.0
return fahrenheit
Python FUNCTIONS: DEFAULT AND NAMED PARAMETERS
def hello(name_man="Bro", name_woman="Sis"):
print("Hello, " + name_man + " & " + name_woman + "!")

hello()
Hello, Bro & Sis!
>>> hello(name_woman="Lady")
Hello, Bro & Lady!
>>> hello(name_woman="Angeline",name_man="Tom") Hello, Tom & Angeline!

Python IMPORTS

Two ways of importing modules:
• Generic form: import module_name
import math
print(math.sqrt(4))
• Generic form: from module_name import function_name
from math import sqr
print(sqrt(4))

Python STRING

String is a sequence of characters, like "Python is cool". Each character has an index:

Each character has an index
• Accessing a character: string[index]
x = "Python is cool"
print(x[10])
• Accessing a substring via slicing: string[start:finish]
print(x[2:6])

Python STRING OPERATIONS

x = "Python is cool"
>>> "cool" in x # membership
>>> len(x) # length of string x
>>> x + "?" # concatenation
>>> x.upper() # to upper case
>>> x.replace("c", "k") # replace characters in a string

Python STRING OPERATIONS SPLIT


Python STRING OPERATIONS SPLIT
x = "Python is cool"
>>> y = x.split(" ")
>>> ",".join(y)

Python LISTS

• If a string is a sequence of characters, then
a list is a sequence of items!
• List is usually enclosed by square brackets [ ]
• As opposed to strings where the object is fixed (= immutable),
we are free to modify lists (that is, lists are mutable)
x = [1, 2, 3, 4]
x[0] = 4
x.append(5)
print(x) # [4, 2, 3, 4, 5]

Python LIST OPERATIONS

>>> x = [ "Python", "is", "cool" ]
>>> x.sort() # sort elements in x
>>> x[0:2] # slicing>>> len(x) # length of string x
>>> x + ["!"] # concatenation
>>> x[2] = "hot" # replace element at index 0 with "hot"
>>> x.remove("Python") # remove the first occurrence of "Python"
>>> x.pop(0) # remove the element at index 0

Python TUPLES
• Like a list, but you cannot modify it (= immutable)
• Tuple is usually (but not necessarily) enclosed by parentheses ()
• Everything that works with lists, works with tuples,
except functions modifying the tuples' content
• Example
x = (0,1,2)
y = 0,1,2 # same as x
x[0] = 2 # this gives an error

Python SETS

• As opposed to lists, in sets duplicates are removed and
there is no order of elements!
• Set is of the form { e1, e2, e3, … }
• Operations include: intersection, union, difference.
• Example:
x = [0,1,2,0,0,1,2,2]
y = {0,1,2,0,0,1,2,2}
print(x)
print(y)
print(y & {1,2,3}) # intersection
print(y | {1,2,3}) # union
print(y - {1,2,3}) # difference

Python CLASSES

While in functions we encapsulate a set of instructions, in classes we encapsulate objects! A class is a blueprint for objects, specifying:
• Attributes for objects
• Methods for objects
• A class can use other classes as a base •

Python CLASSES GENERIC FORM

class class-name(base):
attribute-code-block
method-code-block

KEEP LEARNING PYTHON!

https://docs.python.org Python Official Documentation

https://stackoverflow.com/questions/tagged/python Python on stackoverflow

TOP 100 .NET INTERVIEW QUESTIONS AND ANSWERS 🔴🔴🔴







This image has an empty alt attribute; its file name is dotnet.jpg
TOP 100 .NET INTERVIEW QUESTIONS AND ANSWERS



TOP 100 .NET INTERVIEW QUESTIONS AND ANSWERS




What is .NET (definition)?




.NET is essentially a framework for software development. It is similar in nature to any other software development framework (J2EE etc) in that it provides a set of runtime containers/capabilities, and a rich set of pre-built functionality in the form of class libraries and APIs.
The .NET Framework is an environment for building, deploying, and running Web Services and other applications. It consists of three main parts: the Common Language Runtime, the Framework classes, andASP.NET



How many languages .NET is supporting now?




When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.



How is .NET able to support multiple languages?




A language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.



How do you validate the controls in an ASP .NET page?




Using special validation controls that are meant for this. We have Range Validator, Email Validator.



Can the validation be done in the server side? Or this can be done only in the Client side?




Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.



What are Attributes (definition)?




Attributes are declarative tags in code that insert additional metadata into an assembly. There exist two types of attributes in the .NET Framework: Predefined attributes such as AssemblyVersion, which already exist and are accessed through the Runtime Classes; and custom attributes, which you write yourself by extending the System.Attribute class.



What is Web.config (definition)?




In classic ASP all Web site related information was stored in the metadata of IIS. This had the disadvantage that remote Web developers couldn't easily make Web-site configuration changes. For example, if you want to add a custom 404 error page, a setting needs to be made through the IIS admin tool, and you're Web host will likely charge you a flat fee to do this for you. With ASP.NET, however, these settings are moved into an XML-formatted text file (Web.config) that resides in the Web site's root directory. Through Web.config you can specify settings like custom 404 error pages, authentication and authorization settings for the Web sitempilation options for the ASP.NET Web pages, if tracing should be enabled, etc.
The Web.config file is an XML-formatted file. At the root level is the tag. Inside this tag you can add a number of other tags, the most common and useful one being the system.web tag, where you will specify most of the Web site configuration parameters. However, to specify application-wide settings you use the tag.
For example, if we wanted to add a database connection string parameter we could have a Web.config file like so.



Explain what relationship is between a Process, Application Domain, and Application?




Each process is allocated its own block of available RAM space, no process can access another process‟ code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.
A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.



What is a formatter
(definition) ?




A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.



What is Delegation
(definition) ?




A delegate acts like a strongly type function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods.
Delegate is an entity that is entrusted with the task of representation, assign or passing on information. In code sense, it means a Delegate is entrusted with a Method to report information back to it when a certain task (which the Method expects) is accomplished outside the Method's class.



Write a query to find the total number of rows in a table?




Select count(*) from t_employee;



Write a query to eliminate duplicate records in the results of a table?




Select distinct * from t_employee;



Write a query to insert a record into a table?




Insert into t_employee values ('empid35','Barack','Obama');



Write a query to delete a record from a table?




delete from t_employee where id='empid35';



Write a query to display a row using index?




For this, the indexed column of the table needs to be set as a parameter in the
where clause
select * from t_employee where id='43';



Write a query to fetch the highest record in a table, based on a record, say salary field in the t_salary table




Select max(salary) from t_salary;



Write a query to fetch the first 3 characters of the field designation from the table t_employee?




Select substr(designation,1,3) from t_employee; -- Note here that the substr function has been used.



Write a query to concatenate two fields, say Designation and Department belonging to a table t_employee?




Select Designation + „ „ + Department from t_employee;



What is the difference between UNION and UNION ALL in SQL?




UNION is an SQL keyword used to merge the results of two or more tables using a Select statement, containing the same fields, with removed duplicate values. UNIONALL does the same, however it persists duplicate values.



If there are 4 SQL Select statements joined using Union and Union All, how many times should a Union be used to remove duplicate rows?Explain the differences between Server-side and Client-side code?




Server side code will execute at server (where the website is hosted) end, & all the business logic will execute at server end where as client side code will execute at client side (usually written in javascript, vbscript, jscript) at browser end.



What type of code (server or client) is found in a Code-Behind class?




Server side code.



How to make sure that value is entered in an asp:Textbox control?




Use a RequiredFieldValidator control.



Which property of a validation control is used to associate it with a server control on that page?




ControlToValidate property



How would you implement inheritance using VB.NET & C#?




C# Derived Class : Baseclass
VB.NEt : Derived Class Inherits Baseclass



Which method is invoked on the DataAdapter control to load the generated dataset with data?




Fill() method.



How many ways can wemaintain the state of a page?




Client Side - Query string, hidden variables, viewstate, cookies



Server side - application , cache, context, session, database



What is the use of a multicast delegate?




Amulticast delegate may be used to call more than one method.



What is the use of Singleton pattern?




A Singleton pattern .is used to make sure that only one instance of a class exists.



What is encapsulation
(definition)?




Encapsulation is the OOPs concept of binding the attributes and behaviors in a class, hiding the implementation of the class and exposing the functionality.



What is a data type
(definition)? How many types of data types are there in .NET?




A data type is a data storage format that can contain a specific type or range of values. Whenever you declare variables, each variable must be assigned a specific data type. Some common data types include integers, floating point, characters, and strings. The following are the two types of data types available in .NET:
Value type - Refers to the data type that contains the data. In other words, the exact value or the data is directly stored in this data type. It means that when you assign a value type variable to another variable, then it copies the value rather than copying the reference of that variable. When you create a value type variable, a single space in memory is allocated to store the value (stack memory). Primitive data types, such as int, float, and char are examples of value type variables.
Reference type - Refers to a data type that can access data by reference. Reference is a value or an address that accesses a particular data by address, which is stored elsewhere in memory (heap memory). You can say that reference is the physical address of data, where the data is stored in memory or in the storage device. Some built-in reference types variables in .Net are string, array, and object.



Is String a Reference Type or Value Type in .NET?




String is a Reference Type object.



Can a single .NET DLL contain multiple classes?




Yes, a single .NET DLL may contain any number of classes within it.



What is a CompositeControl in .NET
(definition) ?




CompositeControl is an abstract class in .NET that is inherited by those web controls that contain child controls within them.



What are the new features in .NET 2.0?




Plenty of new controls, Generics, anonymous methods, partial classes, iterators, property visibility (separate visibility for get and set) and static classes.



What are Partial Classes in Asp.Net 2.0
(definition)?




In .NET 2.0, a class definition may be split into multiple physical files but partial classes do not make any difference to the compiler as during compile time, the compiler groups all the partial classes and treats them as a single class.



What is a IL?




(IL) Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. This IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.



What is a CTS
(definition)?




CTS defines all of the basic types that can be used in the .NET Framework and the operations performed on those type.
All this time we have been talking about language interoperability, and .NET Class Framework. None of this is possible without all the language sharing the same data types. What this means is that an int should mean the same in VB, VC++, C# and all other .NET compliant languages. This is achieved through introduction of Common Type System (CTS).



What is "Common Language Specification" (CLS)
definition?




CLS is the collection of the rules and constraints that every language (that seeks to achieve .NET compatibility) must follow. It is a subsection of CTS and it specifies how it shares and extends one another libraries.



What is "Common Language Runtime" (CLR) definition?




CLR is .NET equivalent of Java Virtual Machine (JVM). It is the runtime that converts a MSIL code into the host machine language code, which is then executed appropriately. The CLR is the execution engine for .NET Framework applications. It provides a number of services, including:
Code management (loading and execution)
-Application memory isolation
Verification of type safety
Conversion of IL to native code.
-Access to metadata (enhanced type information)
Managing memory for managed objects
Enforcement of code access security
Exception handling, including cross-language exceptions
Interoperation between managed code, COM objects, and preexisting DLL's (unmanaged code and data)
-Automation of object layout
Support for developer services (profiling, debugging, and so on).






What is a Managed Code (definition)?




Managed code runs inside the environment of CLR i.e. .NET runtime. In short all IL are managed code. But if you are using some third party software example VB6 or VC++ component they are unmanaged code as .NET runtime (CLR) does not have control over the source code execution of the language.



What is an assembly (definition)?




An assembly is a collection of one or more .exe or dll‟s. An assembly is the fundamental unit for application development and deployment in the .NET Framework. An assembly contains a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the CLR with the information it needs to be aware of type implementations.



What are the different types of Assembly?




There are two types of assembly Private and Public assembly. A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful, e.g. Crystal report classes which will be used by all application for Reports.



What is Difference between NameSpace and Assembly?




Following are the differences between namespace and assembly: Assembly is physical grouping of logical units. Namespace logically groups classes also Namespace can span multiple assembly.



What is Manifest (definition)?




Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following things:



  • Version of assembly
  • Security identity
  • Scope of the assembly
  • Resolve references to resources and classes.
  • The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a stand-alone PE file that contains only assembly manifest information



What is garbage collection (definition)?




Garbage collection is a CLR feature which automatically manages memory. Programmers forget to release the objects while coding ….. Laziness (Remember in VB6 where one of the good practices is to set object to nothing). CLR automatically releases objects when they are no longer in use and refernced. CLR runs on non-deterministic to see the unused objects and cleans them. One side effect of this non-deterministic feature is that we cannot assume an object is destroyed when it goes out of the scope of a function. Therefore, we should not put code into a class destructor to release resources.



What is concept of Boxing and Unboxing ?




Boxing is used to convert value types to object.
E.g. int x = 1;
object obj = x ;
Unboxing is used to convert the object back to the value type.
E.g. int y = (int)obj;
Boxing/unboxing is quiet an expensive operation.



Overriding Definition




Overriding is a concept where a method in a derived class uses the same name, return type, and arguments as a method in its base class. In other words, if the derived class contains its own implementation of the method rather than using the method in the base class, the process is called overriding.



Can you use multiple inheritance in .NET?




.NET supports only single inheritance. However the purpose is accomplished using multiple interfaces.



What are events and delegates (definition)?




An event is a message sent by a control to notify the occurrence of an action. However it is not known which object receives the event. For this reason, .NET provides a special type called Delegate which acts as an intermediary between the sender object and receiver object.



What is a connection pool (definition)?




A connection pool is a „collection of connections‟ which are shared between the clients requesting one. Once the connection is closed, it returns back to the pool. This allows the connections to be reused.



What is code review (definition)?




The process of examining the source code generally through a peer, to verify it against best practices.



What is BLOB (definition)?




A BLOB (binary large object) is a large item such as an image or an exe represented in binary form.



What is a COM Callable Wrapper (CCW) definition?




CCW is a wrapper created by the common language runtime(CLR) that enables COM components to access .NET objects.



What is a Runtime Callable Wrapper (RCW) definition?




RCW is a wrapper created by the common language runtime(CLR) to enable .NET components to call COM components.



What is MSIL (definition)?




When the code is compiled, the compiler translates your code into Microsoft intermediate language (MSIL). The common language runtime includes a JIT compiler for converting this MSIL then to native code.
MSIL contains metadata that is the key to cross language interoperability. Since this metadata is standardized across all .NET languages, a program written in one language can understand the metadata and execute code, written in a different language. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations.



What is JIT (definition)?




JIT is a compiler that converts MSIL to native code. The native code consists of hardware specific instructions that can be executed by the CPU.
Rather than converting the entire MSIL (in a portable executable[PE]file) to native code, the JIT converts the MSIL as it is needed during execution. This converted native code is stored so that it is accessible for subsequent calls.



What is GAC (definition)? What are the steps to create an assembly and add it to the GAC?




The global assembly cache (GAC) is a machine-wide code cache that stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.
Steps:



  • Create a strong name using sn.exe tool eg: sn -k mykey.snk



  • inAssemblyInfo.cs, add the strong name eg: [assembly:AssemblyKeyFile("mykey.snk")]



recompile project, and then install it to GAC in two ways :



  • drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)



  • gacutil -i abc.dll



What is the caspol.exe tool used for?




The caspol tool grants and modifies permissions to code groups at the user policy, machine policy, and enterprise policy levels.



What is Ilasm.exe used for?




Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable to determine whether the MSILcode performs as expected.



What is Ildasm.exe used for?




Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a text file that contains managed code.



What is the ResGen.exe tool used for?




ResGen.exe is a tool that is used to convert resource files in the form of .txt or .resx files to common language runtime binary .resources files that can be compiled into satellite assemblies.



What is a digital signature (definition)?




A digital signature is an electronic signature used to verify/guarantee the identity of the individual who is sending the message.



Name the classes that are introduced in the System.Numerics namespace.




The following two new classes are introduced in the System.Numerics namespace:
• BigInteger - Refers to a non-primitive integral type, which is used to hold a value of any size. It has no lower and upper limit, making it possible for you to perform arithmetic calculations with very large numbers, even with the numbers which cannot hold by double or long.
• Complex - Represents complex numbers and enables different arithmetic operations with complex numbers. A number represented in the form a + bi, where a is the real part, and b is the imaginary part, is a complex number.



Explain memory-mapped files.




Memory-mapped files (MMFs) allow you map the content of a file to the logical address of an application. These files enable the multiple processes running on the same machine to share data with each Other. The MemoryMappedFile.CreateFromFile() method is used to obtain a MemoryMappedFile object that represents a persisted memory-mapped file from a file on disk.
These files are included in the System.IO.MemoryMappedFiles namespace. This namespace contains four classes and three enumerations to help you access and secure your file mappings



Which method do you use to enforce garbage collection in .NET?




The System.GC.Collect() method.



State the differences between the Dispose() and Finalize().




CLR uses the Dispose and Finalize methods to perform garbage collection of run-time objects of .NET applications.
The Finalize method is called automatically by the runtime. CLR has a garbage collector (GC), which periodically checks for objects in heap that are no longer referenced by any object or program. It calls the Finalize method to free the memory used by such objects. The Dispose method is called by the programmer. Dispose is another method to release the memory used by an object. The Dispose method needs to be explicitly called in code to dereference an object from the heap. The Dispose method can be invoked only by the classes that implement the IDisposable interface.



What are tuples (definition)?




Tuple is a fixed-size collection that can have elements of either same or different data types. Similar to arrays, a user must have to specify the size of a tuple at the time of declaration. Tuples are allowed to hold up from 1 to 8 elements and if there are more than 8 elements, then the 8th element can be defined as another tuple. Tuples can be specified as parameter or return type of a method.



Which is the root namespace for fundamental types in .NET Framework?




System.Object is the root namespace for fundamental types in .NET Framework.



Define variable and constant.




A variable can be defined as a meaningful name that is given to a data storage location in the computer memory that contains a value. Every variable associated with a data type determines what type of value can be stored in the variable, for example an integer, such as 100, a decimal, such as 30.05, or a character, such as 'A'.
You can declare variables by using the following syntax;
A constant is similar to a variable except that the value, which you assign to a constant, cannot be changed, as in case of a variable. Constants must be initialized at the same time they are declared. You can declare constants by using the following syntax:
const int interestRate = 10;




Which statement is used to replace multiple if-else statements in code?




In Visual Basic, the Select-Case statement is used to replace multiple If - Else statements and in C#, the switchcase statement is used to replace multiple if-else statements.



What is an identifier
(definition) ?




Identifiers are northing but names given to various entities uniquely identified in a program. The name of identifiers must differ in spelling or casing. For example, MyProg and myProg are two different identifiers. Programming languages, such as C# and Visual Basic, strictly restrict the programmers from using any keyword as identifiers. Programmers cannot develop a class whose name is public, because, public is a keyword used to specify the accessibility of data in programs.



Can one DLL file contain the compiled code of more than one .NET language?




No, a DLL file can contain the compiled code of only one programming language.



What is Native Image Generator
(definition) ?




The Native Image Generator (Ngen.exe) is a tool that creates a native image from an assembly and stores that image to native image cache on the computer. Whenever, an assembly is run, this native image is automatically used to compile the original assembly. In this way, this tool improves the performance of the managed application by loading and executing an assembly faster.
Note that native images are files that consist of compiled processor-specific machine code. The Ngen.exe tool installs these files on to the local computer.



Name the MSIL Disassembler utility that parses any .NET Framework assembly and shows the information in human readable format




The Ildasm.exe utility.



What is the significance of the Strong Name tool?




The Strong Name utility (sn.exe) helps in creating unique public-private key pair files that are called strong name files and signing assemblies with them. It also allows key management, signature generation, and signature verification.



Discuss the concept of strong names.




Whenever, an assembly is deployed in GAC to make it shared, a strong name needs to be assigned to it for its unique identification. A strong name contains an assembly's complete identity - the assembly name, version number, and culture information of an assembly. A public key and a digital signature, generated over the assembly, are also contained in a strong name.Astrong name makes an assembly identical in GAC.



What is the difference between .EXE and .DLL files?




EXE
1.It is an executable file, which can be run independently.
2.EXE is an out-process component, which means that it runs in a separate process.
3.It cannot be reused in an application.
4.It has a main function.
DLL
1.It is Dynamic Link Library that is used as a part of EXE or other DLLs. It cannot be run independently.
2.It runs in the application process memory, so it is called as in-process component.
3.It can be reused in an application.
4.It does not have a main function.



Which utility allows you to reference an assembly in an application?




An assembly can be referenced by using the gacutil.exe utility with the /r option. The /r option requires a reference type, a reference ID, and a description.



The AssemblyInfo.cs file stores the assembly configuration information and other information, such as the assembly name, version, company name, and trademark information. (True/False).



What are code contracts
(definition) ?




Code contracts help you to express the code assumptions and statements stating the behavior of your code in a language-neutral way. The contracts are included in the form of pre-conditions, post-conditions and objectinvariants. The contracts help you to improve-testing by enabling run-time checking, static contract verification, and documentation generation.
The System.Diagnostics.Contracts namespace contains static classes that are used to express contracts in your code.



What are Merge Module projects
(definition) ?




Merge Module projects enable creation and deployment of code that can be shared by multiple applications. This may include Dll‟s, resource files, registry based entries etc. The Windows database also keeps track of a reference count for those projects.



What is a Serviced component
(definition) ?




A serviced component is a class that is inside all the CLS-complaint languages. It derives directly or indirectly from the System.EnterpriseServices.ServicedComponent class. This way of configuring the classes allows to be hosted in a COM+ application and is able to use COM+ services.



What is a flat file
(definition) ?




A flat file is the name given to text, which can be read or written only sequentially.



What is an XML Web service
(definition) ?




XML Web Service is a unit of code that can be accessed independent of platforms and systems. They are used to interchange data between different systems in different machines for interoperability using HTTP protocols. Requests are made and responses are returned in the form of XML as XML is language and platform independent.



Describe the steps to deploy a web service.





87
QUESTION
a. Using xcopy or Publish wizard copy the file to the destination server.
b. Make the destination directory a virtual directory in IIS.



What is MIME
(definition) ?




The definition of MIME or Multipurpose Internet Mail Extensions as stated in MSDN is “MIME is a standard that can be used to include content of various types in a single message. MIME extends the Simple Mail Transfer Protocol (SMTP) format of mail messages to include multiple content, both textual and non-textual. Parts of the message may be images, audio, or text in different character sets. The MIME standard derives from RFCs such as 2821 and 2822”



What are mock-ups
(definition) ?




Mock-ups are a set of designs in the form of screens, diagrams, snapshots etc., that helps verify the design and acquire feedback about the application‟s requirements and use cases, at an early stage of the design process.



What is logging
(definition) ?




Logging is the process of persisting information about the status of an application.



What’s a Windows process in .NET
(definition) ?




Windows Process is an application that‟s running and had been allocated memory in .NET



How to manage pagination in a page?




Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself.



What is smart navigation
(definition) ?




The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.



How do you trigger the Paint event in System.Drawing?




Invalidate the current form, the OS will take care of repainting. The Update method forces the repaint.



How do you assign RGB color to a System.Drawing.Color object?




Call the static method FromArgb of this class and pass it the RGB values in .NET



What’s a proxy of the server object in .NET Remoting?




It‟s a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as the marshaling.



What are Channels in .NET Remoting?




Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A Channel must exist before an object can be transferred.



What’s singlecall activation mode used for in .NET?




If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode in .NET



What’s Singleton activation mode in .NET?




A Single object is instantiated of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.



How do you define the lease of the object in .NET?




By Implementing Ilease interface when writing the class code in .NET



Can you configure a .NET Remoting object via XML file?




Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.

BASICS OF Swift PROGRAMMING LANGUAGE 🔴🔴🔴













BASICS OF Swift PROGRAMMING LANGUAGE

Swift SYNTAX

Swift CONSTANTS & VARIABLES

Swift TYPE INFERENCE

let constant = 1 // readonly, cannot be-assigned
constant = 2 // ✘ ERROR!!!
var variable = 1 // readwrite, can be re-assigned
variable = 2 // OK

// Type inference multiple variables
var variable1 = 1,variable 2 = 2, variable = 3

By convention you should prefer to use 'let' over 'var', when possible.

Swift TYPE ANNOTATIONS

let constant = 1let constant: Int = 1 // no need for : Int

var variable: Int
variable = 1


// Type annotations multiple variablesvar double1, double2, double3: Double

Swift NUMBERS

Swift INT, UINT, FlOAT & DOUBLE

var magic: Int = 42 // decimal

0b101010 // binary
0o52 // octal
0x2A // hexadecimal
let pi: Double = 3.14 // 64-bit (default)let pi: Float = 3.14 // 32-bit

000009.90 // padded
1_000_000.000_000_1 // underscores

Swift BOOLEAN

Swift TRUE & FALSE


let enabled: Bool = true // obj-c YESlet hidden = false // obj-c NO

Swift TYPE ALIASES

Swift DEFINE AN ALTERNATIVE NAME FOR AN EXISTING TYPES


typealias SmallIntAlias = UInt16let min = SmallIntAlias.min // exactly like original UInt16.min

Swift TUPLES

Swift LIGHTWEIGHT, TEMPORARY CONTAINERS FOR MULTIPLE VALUES


let complex = (1.0, -2.0) // Compound Type: (Double, Double)
let (real, imag) = complex // Decompose
let (real, _) = complex // Underscores

// Access by index
let real = complex.0
let imag = complex.1

// Name elements
let complex = (real: 1.0, imag: -2.0)
let real = complex.real

Swift OPTIONALS

Swift AN OPTIONAL VALUE EITHER CONTAINS A VALUE OR NIL

var optionalInt: Int? = 42
optionalInt =
nil // to indicate that the value is missing
var optionalDouble: Double? // automatically sets to nil

// Check if nil
optionalDouble ==
nil
optionalDouble !=
nil

Swift FORCE UNWRAP & OPTIONAL BINDING

// Force unwarplet optionalInt: Int? = 42let definietlyInt = optionalInt! // throws runtime error if nil

//Optional binding
if let definitelyInt = optionalInt {
// runs if optionalInt is not nil and sets definitelyInt: Int
}

Swift IMPLICITLY UNWRAPPED OPTIONALS

// Used mainly for class initialization
var assumedInt: Int! // set to nil
assumedInt = 42

var implicitInt: Int = assumedInt // do not need an exclamation mar
implicitInt = assumedInt // ✘ RUNTIME ERROR !!!

Swift OPERATORW

Swift COMMON OPERATORS 1/2

// Modulo Operator
3 & 2 // 1

// Increment and Decrement Operator
i++; ++i; i--; --i

// Compound Assignment Operator
i += 1 // i = 1 + 1

// Logical Operator
a || b &&
c // equivalent to a || (b && c)

SwIft COMMON OPERATORS 2/2

// Ternary Conditional Operator
(a == b ? 1 /* if true */ : 0 /* if false*/)

// Nil Coalescing Operator
a ?? b // a != nil ? a! : b

// Closed Range Operator
0...2 // 0, 1, 2

// Half Open Range Operator
0..<2 // 0, 1

Swift LOOPS

Swift FOR [IN]

// old school c-style for loopfor var index = 0; index <2; index++ { /* use index */ }

// new iterator-style for -in loop
for value in 0..<2 { /* use value */ }

Swift [DO] WHILE

// while evaluates its expression at the top of the loopwhile x > 2 { /* */ }

// do-while evaluates its expression at the bottom of the loop
do { /* executed at least once */ } while x > 2

Swift CONDITIONALS

Swift IF-ELSE

let temperature = 40var feverish: Boolif temperature > 37 {
feverish =
true
}
else {
feverish =
false
}

Swift SWITCH

switch x { // breaks by defaultcase value 1 :
/* ... */
case value2, value 3:
fallthrough // to not breakdefault:
/* ... */
} // switch must be exchaustive

Swift SWITCH RANGE MATCHING


switch count {case 0:
/* ... */
case 1...9:
/* ....*/
default:
/* ... */
}

Swift SWITCH TUPLE MATCHING

switch point {case (0, 0):
/* ... */
case (_, 0);
/* ... */
case (let x, 1): // value binding
/* use x value */
default:
/* ... */
}

Swift SWITCH WHERE


switch point {case let (x, y) where x == y:
/* use x value */
case let (x, y):
/* use x abd y values */
} // switch is exhaustive without default

Swift FUNCTIONS & CLOSURES

Swift DECLARATION & CALL

// With parameters and return valuefunc foo(parameter1: Type1, parameter1: Type 2) -> ReturnType { /* function body */ }
foo(argument1, argument2) // call

// Without parameters and return value
func bar() -> Void { /* function body */ }func baz() -> () { /* function body */ }func quz() { /* function body */ }
quz() // call

Swift EXTERNAL, LOCAL & DEFAULT PARAMETERS

// external and local parameter namesfunc foo(externalParameterName localParameterName: Type) { /* body use localParameterName */ }
foo(externalParameterName: argument) // call must use externalParameterName label

// # = shorthand for external parameter names
func bar (#parameterName: Type) { /* body use parameterName */ }
bar (parameterName: argument) // call must use parameterName label

// default parameter values
func baz(parameter1: Type1, parameterWithDefault: Int = 42) { /* ... */ }
baz(argument1) // call can omit value for parameterWithDefault

// automatic external parameter name for default parameters, as if declared #parameterWithDefault
baz(argument1, parameterWithDefault: 10)

Swift VARIADIC PAMETERS


func foo(parameter: Int...) {
/* parameter */ // use parameter as an array with type [Int]
}

foo(1, 2, 3, 4, 5) // call with multiple argument

Swift VARIABLE PARAMETERS


// let creates a local imutable copy of parameter - let is the default and can be omitted
// var creates a local mutable copy of parameter - var can't modify given instance passed as value
func foo(let constantParameter: Int, var variableParameter: Int ) {
constantParameter += 1 // ✘ ERROR !!
variableParameter += 2 // OK
}

// inout allows to modify given instance passed as value
func bar(inout parameter: Int) { parameter = 42 }

var x = 0 // cannot be declared with 'let'
bar (&x) // need the & in the call
x // = 42

Swift FUNCTION TYPE


// The Type of addOne function is (Int) -> Intfunc addOne(n: Int) -> Int { return n + 1 }

// Function as parameter
func foo(functionParameter: (Int) { /* */ }
foo(addOne)


// Function as return typefunc bar() -> (Int) -> Int {
func addTwo(n: Int) -> Int { return n + 2 }
return AddTwo
}

Swift CURRIED FUNCTIONS


// Rewrite a function that takes multiple parameters as
// an equivalent function that takes a single parameter and returns a function

func AddTwoInts(a: Int, b: Int) -> Int { return a + b }

func AddTwoIntsCurried (a: Int) -> (Int) -> Int {
func AddTheOtherInt(b: Int) -> Int { return a + b }
return AddTheOtherInt
}
// equivalent to:
func addTwoIntsCurried (a: Int)(b: Int) -> Int { return a + b }

addTwoInts(1, 2) // = 3
addTwoIntsCurried(1)(2) // = 3

Swift MEANING SYNTAX

Closures are blocks of functionality that can be passed around



{ (parameter1: Type1, parameter2: Type2) -> ReturnType in / * ... */
}

Swift SORTING WITHOUT CLASSES

func sorted(array: [Int], algorithm: (Int, Int) -> Bool) -> [Int] { /* ... */ }

let array = [1, 2, 3]
func backwards(i1: Int, i2: Int) { return i1 > i2}

var reversed = sorted(array, backwards)

Swift SORTING WITH CLOSURES

// Fully declared closure
reversed = sorted(array, { (i1: Int, i2: (Int) -> Bool
in return i1 > i2 } )

// Infer closure type
reversed = sorted(array, { (i1, i2)
in return i1 > i2 } )

// Implicit returns
reversed = sortex(array, { (i1, i2) in i1 > i2 } )

Swift SORTING WITH CLOSURES 2/2

// Shorthand argument names
reversed = sortex(array, { $0 > $1 } )

// Operator functions
reversed = sortex(array, >)

// trailing closure: outside of () only if it's function's final argument

// optional parentheses
array.
map({ $0 + 1 })
array.
map { $0 + 1 } // equivalent

Swift CAPTURING VALUES

Closures can capture and store references to any contstants and variables from the context in which they are defined.



func makeRepeaterWithRepeatedValue(valueToRepeat: Int) -> () -> [Int] {
var captureArray = []
func repeater() -> [Int] {
capturedArray.append(valueToRepeat)
return capturedArray
}
return repeater
}
let repeater3 = makeRepeaterWithRepeatedValue()
repeater3() // [3]
repeater3() // [3, 3]







Swift ADVANCED OPERATORS






// Prefix Operator Functions
prefix func -(vector: Vector) -> Vector { /* return the opposide Vector */ }
let negativeVector = -positiveVector

// Infix Operator Functions
func +(left: Vector, right: Vector) -> Vector { /* return the Vector sum */ }func +=(inout left: Vector, right: Vector) { /* set left to the Vector sum */ }var originalVector = /* a Vector */; var anotherVector = /* another Vector */;
originalVector += anotherVector

// Custom operators
prefix operator +++ {} // Custom Infix Operators can specify Precedence and Associativityprefix func +++(inout vector: Vector) -> Vector { vector += vector; return vector; }

Swift DATA TYPES & INSTANCES

Swift ENUMERATIONS

Swift AN ENUMERATION DEFINES A COMMON TYPE FOR A GROUP OF ITEMS

enum CellState {
case Alive
case Dead
case Error
}
let state1 = CellState.Alivelet state2 : CellState = .Dead // if known type, can drop enumeration nameswitch state1 {
case .Alive:
case .Dead:
default:
}

Swift AN ENUMERATION ITEM CAN HAVE AN ASSOCIATED VALUE

enum CellState {
case Alive
case Dead
case Error(Int) // associated value can also be a tuple of values
}
let errorState = CellState.Error(-1);switch errorState {
case .Alive:
case .Dead:
case .Error(let errorCode): // == case let .Error(errorCode)):

/ * use errorCode */
}

Swift AN ENUMERATION ITEM CAN HAVE A RAW VALUE

enum CellState {
case Alive = 1 case Dead = 2
case Error = 3
}
enum CellState: Int { // Specify the Item Raw Value Type
case Alive = 1, Dead, Error // Int auto-increment }let stateValue = CellState.Error.rawValue // 3 let aliveState: CellState? = CellState(rawValue: 1) // CellState.Alive

Swift Structures

Swift COPY VALUE ON ASSIGNMENT OR WHEN PASSED INTO FUNCTION

// Structures are value types
struct CellPoint {
var x = 0.0
var y = 0.0
}
// Structures are always copied when they are passed around
var a = CellPoint(x: 1.0, y: 2.0); var b = a; b.x = 3.0; a.x // 1.0 - a not changed

Swift Strings & Characters 1/2


// String Declaration

var emptyString = "" // == var emptyString = String()

emptyString.isEmpty // true
let constString = "Hello"
// Character Declaration

var character: Character = "p"

for character in "Hello" { // "H", "e", "l", "l", "o" }

// Declare a String as var in order to modify it

var growString = "a"; growString += "b"; growString.append("c")

countElements(growString) // 3

Swift Strings & Characters 2/2


// String Interpolation

let multiplier = 2

let message = "(multiplier) times 2.5 is (Double(multiplier) * 2.5)"

// Print a message in the std output

println(message)

// Comparing Strings

let str1 = "Hello"; let str2 = "Hello";

str1 == str2 // true

str1.hasPrefix("Hel") // true

str2.hasSuffix("llo") // true

Swift Arrays


// Array Declaration

var emptyArray = [Int]() // Array()

var emptyArray : [Int] = []

var array = [Int](count: 2, repeatedValue: 0)

var array = [25, 20, 16]



// Array Access: subscript out of bounds generate crash

array[1] // 20

array[1000] // ❌ RUNTIME ERROR !!!



array.count // 3

array.isEmpty // false



// Array Iteration

for value in array { /* use value / } for (index, value) in enumerate(array) { / use index and value */ }

Swift VARIABLE ARRAYS

var variableArray = ["A"]

variableArray = ["X"] // ["X"]

variableArray[0] = "A" // ["A"]

variableArray.append("B"); // ["A", "B"]

variableArray += ["C", "D"] // ["A", "B", "C", "D"]
variableArray.insert("Z", atIndex: 4) // ["A", "B", "C", "D", "Z"]

let a = variableArray.removeAtIndex(1) // ["A", "C", "D", "Z"]

variableArray[1…2] = ["M"] // ["A", "M", "Z"]

let l = variableArray.removeLast() // ["A", "M"]
Swift CONSTANT ARRAYS

let constantArray = ["A"]

constantArray = ["X"] // ❌ ERROR !!!

constantArray[0] = "Y" // ❌ ERROR !!!

constantArray.append("B"); // ❌ ERROR !!!

constantArray.removeAtIndex(0) // ❌ ERROR !!!

Swift Dictionaries

// Dictionary Declaration

var emptyDictionary = [String, Int]() // Dictionary()

var emptyDictionary : [String, Int] = [:] // key : value

var dictionary = ["First" : 25, "Second" : 20, "Third" : 16]



// Dictionary Access: subscript return Optional

let second: Int? = dictionary["Second"] // .Some(20)

let last: Int? = dictionary["Last"] // nil



dictionary.count // 3

dictionary.isEmpty // false



// Dictionary Iteration

for (key, value) in dictionary { /* use key and value */ }

dictionary.keys // [String]

dictionary.values // [Int]

Swift VARIABLE DICTIONARIES

var variableDictionary = ["First" : 25]
variableDictionary = ["Second" : 20] // ["Second" : 20]

variableDictionary["Third"] = 16 // ["Second" : 20, "Third" : 16]
let oldKeyValue = variableDictionary.updateValue(18, forKey: "Second")

// oldValue => 20 // ["Second" : 18, "Third" : 16]
// removes key

variableDictionary["Second"] = nil // ["Third" : 16]

let removedValue = variableDictionary.removeValueForKey("Third")

// removedValue => 25 // [:]

Swift CONSTANT DICTIONARIES

let constantDictionary = ["First" : 25, "Second" : 20, "Third" : 16]

constantDictionary = ["Last" : 0] // ❌ ERROR !!!

constantDictionary["Third"] = 15 // ❌ ERROR !!!

constantDictionary["Forth"] = 21 // ❌ ERROR !!!

constantDictionary["First"] = nil // ❌ ERROR !!

Swift CLASSES

Swift COPY REFERENCE ON ASSIGNMENT OR WHEN PASSED INTO FUNCTION

// Classes are reference types
class Person {
var name: String?
var age: Int = 0
}

// Class reference (not object) are copied when they are passed around
var giuseppe = Person() let joseph = giuseppe
joseph.name = "Joseph"
giuseppe.name // "Joseph"


// Compare references using === and !==
giuseppe === joseph // true

Swift PROPERTIES

Swift STORED INSTANCE PROPERTIES

class Cell {
let name: String // constant stored property
var position: CellPoint? // variable stored property
var score: Int = 10 // variable stored property with default value
lazy
var spa = Spa() // lazy stored property (only var)
// lazy: a property whose initial value is not calculated until the first time it is used
}
struct CellPoint {
var x = 0.0 // variable stored property with default value
var y = 0.0 // variable stored property with default value
}
// Enumerations do not have instance stored properties

SWift COMPUTED INSTANCE PROPERTIES 1/2


struct Rect {
var origin = Point()
var size = Size()
var center: Point {
get {
let centerX = origin.x + (size.width / 2)
let centerY = origin.y + (size.height / 2)
return Point(x: centerX, y: centerY)
}
set(newCenter) {
origin.x = newCenter.x - (size.width / 2)
origin.y = newCenter.y - (size.height / 2)
}
}
}
// Also available for Enumerations and Classes

Swift COMPUTED INSTANCE PROPERTIES 2/2

struct Rect {
var origin = Point()
var size = Size()
var center: Point {
get {
let centerX = origin.x + (size.width / 2)
let centerY = origin.y + (size.height / 2)
return Point(x: centerX, y: centerY)
}
set { // shorthand 'newValue' equivalent
origin.x = newValue.x - (size.width / 2)
origin.y = newValue.y - (size.height / 2)
}
}
// readonly can omit 'get' keyword
var area: Double { return size.width * size.height }
}

KEEP LEARNING Swift!

https://swift.org/documentation/ - Swift Official documentation
https://stackoverflow.com/questions/tagged/swift - Swift on stackoverflow

BASICS OF JavaScript PROGRAMMING LANGUAGE 🔴🔴🔴




BASICS OF JavaScript PROGRAMMING LANGUAGE


JavaScript IMPLEMENTATIONS


A Complete JavaScript implementations is made up of three distinct parts:

  • The core (ECMAScript)
  • The document Object Model (DOM)
  • The Browser Object MOdel (BOM)








JavaScript IMPLEMENTATIONS

JavaScript DEFINITION OF ECMA Script


ECMAScript is simply a description, defining all the properties, methods and objects of a scripting language.








  • Syntax
  • Types
  • Statements
  • Keywords
  • Reserved words
  • Operators
  • Objects

Each browser has it own implementation of the ECMAScript interface, which is then extended of contain the DOM and BOM. Today, all popular Web browsers comply with the 3rd edition of ECMA-262.

JavaScript DEFINITION OF DOCUMENT OBJECT MODEL (DOM)


The Document Object Model (DOM) describes methods and interfaces for working the content of a Web page.

  • The DOM is an three-based, language independent API for HTML as well as XML. (cf. The SAX provides an event-based API to parse XML.)
  • The W3C DOM specifications: Level1, Level2, Level3
  • The document object is the only object that belongs to both the DOM and the BOM
getElementsByTagName(), getElementsByName(),getElementById()
All attributes are included in HTML DOM elements as properties
oImg.src = "mypicture.jpg"; oDiv.className = "footre";

JavaScript DEFINITION OF BROWSER OBJECT MODEL (BOM)


The Browser Object Model (BOM) describes methods and interfaces for interacting with the browser.

Because no standards exist for the BOM, each browser has it own implementations.

The window object represents an entire browser window.

objects: document (anchors, forms, images, links, location);
frames (history, location, navigator, screen).
methods: moveBy(), moveTo(), resizeBy(), resizeTo(), open(), close(), alert(), confirm(), input(), setTimeOut(), clearTimeOut(), setInterval(), clearInterval()
properties: screenX, screenY, status, defaultStatus, etc.

JavaScript BASICS (ECMaScript)

JavaScript SYNTAX


JavaScript borrows most of its syntax from Java, but also inherits from Awk and Perl, with some inherits influence from Self in its object protype system.

JavaScript THE BASIC CONCEPTS


Everything is case-sensitive
Variables are loosely typed.

  • Use the var keyword
  • Variables don't have to be declared before being used.

End-of-line semicolons are optional
var test1 = "red"

var test2 = "blue"; // do this to avoid confusion"

  • Comments are the same as in Java, C and Perl.
  • Braces indicade code blocks

JavaScript KEYWORDS & RESERVED WORDS


The keywords and reserved words cannot be used as variables or function names.

Keywords: break, case, catch, continue, default, delete, do, else, finally, for, function, if, in, instanceof, new, return, switch, this, throw, try, typeof, var, void, while, with.

Reserved words: abstract, boolean, byte, char, class, const, debugger, double, enum, export, extends, final, float, goto, implements, import, int, interface, long, native, package, private, protected, public, short, static, super, synchronized, throws, transient, volatile.

JavaScript PRIMITIVE AND REFERENCE VALUES


JavaScript PRIMITIVE VALUES


Primitive Values are simple pieces of data that are stored on the stack.

The value is one of the JavaScript primitive types: Undefined, Null, Boolean, Number, or String.
Many languages consider strings as a reference type and not a primitive type, but JavaScript breaks from this tradition.

JavaScript PRIMITIVE TYPES


JavaScript has five primitive types:
Undefined - The undefined type has only one value, undefined.
Null - The Null type has only one value, null.
Boolean - The Boolean type has two values, true and false.
Number - 32-bit integer and 64-bit floating-point values.
String - Using either double quotes("") or single quote(')

JavaScript REFERENCE VALUES


Reference values are objects that are stored in the heap, meaning that the value stored in the variable location is a pointer to a location in memory where the object is stored.

JavaScript THE typeof OPERATOR


JavaScript to determine if a value is in the range of values for a particular type, provies the typeof operator.

value typeof
Boolean boolean
Number number
String string
Undefined undefined
Null object
Object object
Array object
Function function

JavaScript CONVERSIONS


JavaScript CONVERTING TO A STRING


Primitive values for booleans, number, strings are pseudo-objects, which means they actually have properties and methods.


JavaScript CONVERTING TO A NUMBER

JavaScript provides two methods for converting non-number primitives into numbers: parseInt() and parseFloat().
var numb1 = parseInt("0xA"); // returns 10 var num2 = parseFloat("4.5.6"); // returns 4.5 var num3 = parseInt("blue"); // returns NaN

JavaScript TYPE CASTING


JavaScript BOOLEAN (value)

Boolean("")false; Boolean("hi") true
Boolean(0)false; Boolean(100) true
Boolean(null)false; Boolean(undefined)false
Boolean(new Object()) → true

JavaScript NUMBER (value)

Number(false) → 0; Number(true)1
Number(null) → 0; Number(undefined) NaN
Number("4.5.6")NaN (cf. parseFloat))
Number(new Object()) NaN

JavaScript STRING (value)

String(null) → "null"
String(undefined) → "undefined"


JavaScript REFERENCE TYPES

Reference types are comonly reffered to as classes, which is to say that when you have a reference value, you are dealing with an object.

ECMAScript defines "object definitions" that are logically equivalent to "classes" in other programming languages.

The new operator
var obj = new Object:
var obj = new Object(); //do this to avoid confusion.


THE instanceof OPERATOR

The instanceof operator identifies the type of object you are working with.

var aStringObject = new String ("Hello");
var result = (aStringObject instanceof String); //returns true