Verben mit Präfixen – holen

holen, holte, geholt – to get

Holen Sie tief Atem – Draw a deep breath

Würden Sie mir bitte die Zeitung holen? – Could you go and get the newspaper

Now we will jump into the prefixes of the word holen.

abholen – pickup

Ich hole ein Paket ab.

nachholen – to make up for

Ich hole den Unterrichtsstoff nach.

niederholen – to haul down / lower

Wenn ich es könnte, würde ich dir den Mond niederholen.

aufholen – to catch up

Wir sind nur alte freunde, die viel aufholen zu haben

wegholen – fetch away

Ich weiß nicht, wo ich mir den Schnupfen wieder weggeholt habe.

wiederholen – repeat

Ich habe Sie nicht verstanden. Können Sie bitte wiederholen?

erholen (nicht trennbar) – to rest / to recover

Ich erhole mich vom Stress der letzten Tage.

überholen – overtake

Hier darfst du nicht überholen.

Understanding Document Object Model (DOM)

Document Object Model (DOM) is an Application Programming Interface (API) for manipulating HTML documents. When a webpage is loaded, the browser creates a DOM of the page. It defines a logical structure of documents and the way a document is accessed and manipulated. Using JavaScript in a HTML webpage is to make our page more interactive and dynamic. The DOM provides the mechanism for JavaScript to achieve this. It is an interface that allows a programming language to manipulate the content, structure, and style of a website.

               DOM represents an HTML document as a tree of nodes. DOM is cross-platform and language independent way of manipulating HTML and XML documents.

HTML DOM model is created as a tree of Objects. With the Object model, JavaScript gets all power it needs to make dynamic HTML.

  • JavaScript can change all HTML elements in a page.
  • JavaScript can change all HTML attributes in the page.
  • JavaScript can change all the CSS styles in the page.
  • JavaScript can remove existing HTML elements and attributes.
  • JavaScript can add new HTML elements and attributes.
  • JavaScript can react to all existing HTML events in the page.
  • JavaScript can create new HTML events in the page.
<html>
<head>
<title> DOM Example </title>
</head>
<body>
<p>DOM Tree</p>
<p id =’text’> This is a DOM tree </p>
</body>
</html>

The DOM represents a document as a hierarchical tree of nodes which have root node and child nodes. One characteristic of DOM is how it handles attributes. Attributes are property of the element node and are made up of name and value pair. Also, there are several node types in the tree each representing different information or markup in HTML document.

Four main nodes:

Document node:

It is the root node added at the top of tree and represents entire page in the browser. It is the starting point in DOM tree, and you need to navigate via this node to access any other node in DOM tree.

Element node:

All HTML elements like heading tags <h1>…<h6> , paragraph tags <p> are element nodes. You need to navigate via these nodes to gain access to its attributes and text.

Attribute node:

The opening tag in an HTML document contains attributes. These are not children of element node but part of them.

Text node:

Text content within the element are stored here. These nodes cannot have further child nodes.

JavaScript-HTML DOM Methods

  • HTML DOM methods are actions you can perform on HTML elements
  • HTML DOM properties are values of HTML elements that you can set or change.

How to access HTML elements in a HTML page.

  • Finding HTML elements by id

Get one of HTML object which have an id attribute.

document.getElementsById( );

  • Finding HTML elements by tag name

Get one or more of a HTML tag.

document.getElementsbyTagName( );

  • Finding HTML elements by class name

Get one or more of HTML object which have a class attribute.

document.getElementsbyTagName( );

  • Finding HTML elements by CSS selectors

Get the first of HTML object which is a CSS selector element.

document.querySelector( );

  • Finding HTML elements by querySelectorAll

Get the one or more of HTML object which is a CSS selector

document.querySelectorAll( );

Changing HTML Content

The innerHTML is a property of Element which is useful for getting or replacing the content of HTML elements.

Reading the innerHTML property of element

let content = element.innerHTML;

Setting the innerHTML property of element

Element.innerHTML = newHTML;

Do not use innerHTML to set a new content that you have no control over to avoid a security risk.

DOM Manipulation

Another technique to add/remove HTML content is DOM Manipulation.

Create a HTML element

document.createElement(element)    

Remove a HTML element

document.removeChild(element)

Add a HTML element

document.appendChild(element)

Replace a HTML element

document.replaceChild(new,old)

Write into the HTML output stream

document.write(text)

Conclusion:

Hence so far, we have discussed the various aspects of Document Object Model (DOM)

Understanding CSS Grid and Flexbox Layout.

Flexbox and Grid:

Cascading Style Sheet is a style sheet language used to describe how a HTML document is displayed. CSS is a foundation technology of world wide web, along with HTML and Javascript. To simplify the creation and maintenance of webpages responsive layouts are developed in CSS. Now let us see about the Grid and Flexbox layouts in CSS.

What is CSS Flexbox?

          CSS Flexbox is a one-dimensional layout model that makes it easy and flexible in designing effective layouts. This model helps in allocating and aligning space among items. Flex items are positioned inside a flex container along a flex line. By default there is only one flex line per container.

Basic concepts of Flexbox:

Two axes of Flexbox:

main axis: The main axis is the primary axis along which the flex items are aligned. It is defined by flex-direction, which has 4 values:

  • row
  • row-reverse
  • column
  • column-reverse

In row or row-reverse our main axis will run along the row in the inline direction.

In column or column-reverse our main-axis will run from top of the page to bottom along the block direction.

Cross-axis:

The cross-axis runs perpendicular to the main axis, therefore if our flex-direction is set to row or row-reverse the cross-axis runs down the column.

If flex-direction is set to column or column-reverse, the cross-axis runs across the row.

main-start and main-end:

          The flex items are placed in the container with items beginning with main-start and ending with main-end.

CSS Flexbox Properties:

PropertyDescription
flex-directionDefines in which direction a container wants to stack the flex items.
flex-wrapSpecifies whether flex items should wrap or not.
flex-flowShorthand for setting both flex-direction and flex-wrap
justify-contentUsed to align the flex items with values center, start, end, space-around, space-between.
align-itemsVertically align the flex items along the cross axis.
align-selfUsed on flex items. It overrides the container’s align-items property.

Example of flexbox:

OUTPUT:

What is Grid Layout?

          CSS Grid Layout is a 2D grid-based layout with rows and columns, useful in creating more complex and organized layouts without using floats and positioning. To define a Grid container, you will have to pass a display:grid property to your element

Important terms:

  • row
  • column
  • cell
  • grid line
  • gutter

Grid Container:

          A grid container is an element on which the display: property is applied. It is the direct parent of all the grid items. The items of the grid are placed inside rows and columns.

OUTPUT:

CSS Grid Properties:

PropertyDescription
column-gapSpecifies the gap between the columns
gapA shorthand property for the row-gap and the column-gap properties
gridA shorthand property for the grid-template-rows, grid-template-columns, grid-template-areas, grid-auto-rows, grid-auto-columns, and the grid-auto-flow properties
Grid-areaEither specifies a name for the grid item, or this property is a shorthand property for the grid-row-startgrid-column-startgrid-row-end, and grid-column-end properties
Grid-auto-columnsSpecifies a default column size
Grid-auto-flowSpecifies how auto-placed items are inserted in the grid
grid-auto-rowsSpecifies a default row size
grid-columnA shorthand property for the grid-column-start and the grid-column-end properties
grid-column-endSpecifies where to end the grid item
grid-column-gapSpecifies the size of the gap between columns
grid-column-startSpecifies where to start the grid item
grid-gapA shorthand property for the grid-row-gap and grid-column-gap properties
grid-rowA shorthand property for the grid-row-start and the grid-row-end properties
grid-row-endSpecifies where to end the grid item
grid-row-gapSpecifies the size of the gap between rows
grid-row-startSpecifies where to start the grid item
grid-templateA shorthand property for the grid-template-rowsgrid-template-columns and grid-areas properties
grid-template-areasSpecifies how to display columns and rows, using named grid items
grid-template-columnsSpecifies the size of the columns, and how many columns in a grid layout
grid-template-rowsSpecifies the size of the rows in a grid layout
row-gapSpecifies the gap between the grid rows

Pandas Series in Python

Pandas is an open source python library widely used for data science/ data analysis and machine learning tasks. Pandas stands for panel data, referring to tabular format.

Installing pandas:

pip install pandas
pip install numpy

This is because pandas is built on top of numpy which provides support for multi-dimensional arrays so it is always good to install with numpy. Pandas adopts many styles from numpy. The biggest difference is that pandas is for working with tabular, heterogeneous data whereas numpy is for working with homogeneous numerical data.

Pandas data structures:

               Pandas have 3 data structures based on dimensionality.

  • Series – one dimension
  • DataFrame – two dimensions
  • Panel – three dimensions
Data StructureDimensionsDescription
Series11D labeled homogeneous array, sizeimmutable.
Data Frames2General 2D labeled, size-mutable tabular structure with potentially heterogeneously typed columns.
Panel3General 3D labeled, size-mutable array.

These data structures are built on top of numpy array. They are fast. Among these three, series and DataFrame are most widely used in data science and analysis tasks. In terms of Spreadsheet we can say series would be single column of spreadsheet, DataFrame is combination of rows and columns in a spreadsheet and panel is group of spreadsheet which have multiple DataFrames.

We can think of this as higher dimensional data structure is a container of lower dimensional data structure.

In this article we see about Pandas series datastructure.

Series Data Structure in Pandas:

One-dimensional array like data structure with some additional features. Series contains one axis, that is labelled as index of series. It is homogeneous and immutable array.

It consists of two components.

  • One-dimensional data (values)
  • Index
Syntax of series:
pandas. Series(data, index, dtype, copy)
Parameters:

Data – takes forms like  one dimensional ndarray, list, dictionary, scalar value.

Index – index values must be unique and hashable, same length as data. Default np.arange(n) if no index is passed.

Dtype– It is for data type. If none, data type will be inferred. Copy- copy data. Default false.

Example:

Creation of Series from ndarray:

import pandas as pd
import numpy as np
data = np.array(['Anna','Benny','Cathrin','Daniel'])
s = pd.Series(data,index=[11,12,13,14])
print(s)
#retrieving data with index
print(s[11])

Creation of Series from Dictionary:

import pandas as pd
import numpy as np
data = {'Anna' : 11, 'Benny' : 12, 'Cathrin' : 13, 'Daniel' : 14}
s = pd.Series(data)
print(s)
#accessing the data
print(s[0])

DataFrame:

DataFrame is a two dimensional data structure having labelled axes as rows and columns. Here we have three components

  • Data (heterogeneous data)
  • Rows (horizontal)
  • Columns (vertical)

Each column of DataFrame is a separate pandas Series. DataFrames are both value and size mutable.

Syntax:
pandas.DataFrame(data, index, columns, dtype, copy)

DataFrame accepts many different types of arguments

  • A two-dimensional ndarray
  • A dictionary of dictionaries
  • A dictionary of lists
  • A dictionary of series

DataFrame creation using ndarray:

import pandas as pd

import numpy as np

a=np.array([['Anna',24],['Kathrin',25],['Manuel',23],['Daniel',22],['Thomas',27]])

s=pd.DataFrame(a,index=[1,2,3,4,5],columns=['Name', 'Age'])

print(s)

DataFrame creation using dictionary of dictionaries:

import pandas as pd
import numpy as np
a={'name':{11:'Anna',12:'Kathrin',13:'Manuel',14:'Daniel',15:'Thomas'},
  'age': {11:24,12:25,13:23,14:22,15:27}}
df=pd.DataFrame(a)
print(df)
print(df.index)
print(df.values)
print(df.columns)

Panels:

Pandas panel data structure is used for working with three dimensional data. It can be seen as set of DataFrames. It is also heterogeneous data and value and size mutable.

Syntax:
pandas.Panel(data, items, major_axis, minor_axis, dtype, copy)

Items: Each item in this axis corresponds to one dataframe and it is axis 0

Major_axis: This contains rows or indexes of the dataframe and it is axis 1

Minor_axis: This contains columns or values of the dataframe and it is axis 2

We will learn more about DataFrames and panels data structures in coming articles.

Substring() vs Slice() in JavaScript

What is substring()?

substring() method returns part of the string from start index upto end index but excluding the endindex. It extracts characters between two indices from a string and return the substring. It does not change the original string.

Syntax:
substring(indexStart)
substring(indexStart, indexEnd)

Parameters:

indexStart – Index of first character to include in substring.

indexEnd – It is optional. It denotes the first character to exclude from the returned string.

When indexEnd is not there, the substring() method returns characters upto the end of the string.

Return value – A new sub string containing part of original string.

What will happen if both index start and end are same?

const str = ‘Abaython’
str.substring(3,3)

When both start and end index are same will return an empty string.

If start index greater than end index?

const str = ‘Abaython’
str.substring(4,2)
Output:

ay

Here it will simply swap the parameters as,

str.substring(2,4)

So, the output is ay.

If indexEnd is omitted?

const str = ‘Abaython’
str.substring(4)
Output:

thon

Here it will return upto the end of the string starting from index 4

Substring() vs slice()

Though in both methods the parameters are same, the main difference is using negative values.

In substring() method negative values are considered as zero.

const s = 'Abaython';
console.log(s.substring(-4,5))
Output:

Abayt

Here -4 is considered as 0 and returns from the start of the string.

Keypoints to note:

Similarities:

  • In both methods the parameters are same. If start and end index are equal both returns an empty string.
  • If end index is omitted then the characters are extracted upto the end of the string.
  • Any parameter greater than string length then string length is used instead.
  • NaN treated as 0.

Differences:

  • In case of startindex > endindex,

Substring() method swaps the parameters.

Slice() method returns empty string

  • If any argument has negative values,

Substring() method treats them as 0

Slice() method counts from the end of the string for negative values

Difference between substr and substring

What is substr() method?

Substr() method returns a particular number of characters starting from specified index.

Syntax:
substr(startIndex, Length)
substr(startIndex)

startIndex – index of first character to include in the return string

length – It is optional determines the number of characters to extract.

Return value – A new string containing the specified part of given string.

Example:
let str = "Abaython";
console.log(str.substr(1,2));
console.log(str.substr(-2,2));
console.log(str.substr(1));
console.log(str.substr(-1,2));
Output:

ba

on

baython

n

Points to note:
  • start >= str.length, an empty string is returned.
  • If start < 0, the index starts counting from the end of the string. More formally, in this case the substring starts at max(start + str.length, 0).
  • If start is omitted or undefined, it’s treated as 0.
  • If length is omitted or undefined, or if start + length >= str.length, substr() extracts characters to the end of the string.
  • If length < 0, an empty string is returned.
  • For both start and length, NaN is treated as 0.

Though substr() is not strictly a deprecated function, it is considered a legacy function and you should avoid using it as possible as you can. It is not part of JavaScript and may be removed in the future. So, you can use the substring() method instead.

Difference

The main difference lies in the parameter the second parameter in substr() method indicates the number of characters to extract whereas in substring() the second parameter denotes the index upto which we need to extract excluding the particular index.

For negative values in parameters in substr() for first argument index counted from back and second argument is considered as zero. In substring() simply considered zero.

How to split a string into an array of substrings?

JavaScript has many string methods. Today we will explore split() method. As the name suggests it splits a string.

A string is a sequence of characters in a programming language.

Eg: “Abaython”, “JavaScript”.

We can create a string using

  • String literal:

const info = “Hello Abaython!”

  • Using string() constructor:

const info = new String(“Hello Abaython!”);

split() method:

String method used to split a string into an array of substrings using a delimiter. It returns a new array of substrings. It does not change the original string.

Syntax:

               string.split([separator, [,limit]]);

The parameters : separator and limit are optional.

Separator: determines where each split should occur in original string. It can be a string or a regular expression. If you omit this, split() will return the entire string. If (“ “) is used as a separator, the string is split between words.

Limit:

Zero or positive integer to determine the number of substrings. Split() method will stop when number of substrings equals the limit. If limit is zero, returns an empty array. If it is 1, returns an array with the string.

Return value:

               Returns an array of strings, split at each point where separator occurs in given string.

Lets explore some examples:

Without separator:

// without separator

const str = ‘Hello Abaython’;

str.split();

Output:

[‘Hello Abaython’]

How to split a string into individual characters?

We need to use separator here

const str = 'Hello Abaython';

str.split(''); // without space
Output:

 [‘H’, ‘e’, ‘l’, ‘l’, ‘o’, ‘ ‘, ‘A’, ‘b’, ‘a’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’]

Note that spaces are also considered as characters here.

How to split a string into individual words?

We need to use separator with space.

const str = 'Hello Abaython';
str.split(' '); // with space
Output:

[‘Hello’, ‘Abaython’]

Using limit parameter:

How to return the first word of the given string?

You just need to add the limit as 1 to return first word.

const str = 'Hello Abaython';
str.split(' ',1);
Output:

[‘Hello’]

What will happen if I change the limit to 0?

Lets see,

const str = 'Hello Abaython';
str.split(' ',0);
Output:

[]

It will return an empty array.

How to split the sentences in a paragraph?

let para = 'Hello! JavaScript? Abaython. Abap.';
let sent = para.split(/[!,?,.]/);
console.log(sent);
Output:

[ ‘Hello’, ‘ JavaScript’, ‘ Abaython’, ‘ Abap’, ” ]

As you can see the !,?,. are not included in output. If you want to include them the regular expression should contain parantheses ( ).

Javascript slice() method:

Slice() method extracts a part of string and returns a new string without modifying the original string. It requires the index as start and end parameters for returning part of the string. Here negative index are allowed.

Syntax:

slice(indexStart)

slice(indexStart, indexEnd)

Here the parameter indexEnd is optional.

indexStart – index of first character to include in the returned string. If negative, this argument specifies a position from the end of the string. For example -1 indicates the last character and -2 indicates the second character from last.

indexEnd – index of first character to exclude from the returned string. As this is optional if not specified it includes all character from indexStart to end of string. Same as above, if negative argument, it specifies  a position measured from the end of the string.

Return value – A new string containing the extracted section of the string.

Example:
const s = 'Abaython';
console.log(s.slice(0,4))  
console.log(s.slice(2,4))  
console.log(s.slice(4))      
console.log(s.slice(3,-1)) 
console.log(s.slice(3,-2))  
console.log(s.slice(-3,-1))
Output:

Abay

ay

thon

ytho

yth

ho

indexStart>=index.length?

It returns an empty string.

indexStart omitted?

If indexStart is omitted, undefined or cannot be converted to a number. It consider indexStart as 0 and returns from  the start of the string.

const s = 'Abaython';
s.slice()
Output:

‘Abaython’

String methods slice(), substring() and the deprecated substr() all return specified portions of a string. Slice() is more flexible than substring() because it allows negative index values. Slice() differs from substr() in that it specifies a substring with two character positions, while substr() uses one position and a length. String.slice() is an analog of Array.slice()

Google and its AI Journey

As the whole World is turning now to AI, a significant Question which comes to everyone’s mind. What can Google do with the AI Technology?

Six years ago, the Pioneer in Search Engine has reoriented the Organization to be more inclined towards AI. The curiosity of People is exploding with the advancement of the large language models.

Transformer research Project:

Google has invested a lot in AI to advance in this technology. Google’s Transformer project has laid a good foundation for many of the generative AI applications.

BERT:  

It is a Transformer model focused on perceiving all the nuances of human language.

MUM:

It is very advanced than BERT and has features with multi-lingual understanding. It can analyze the crucial information in Videos and provide meaningful insights.

LaMDa:

LaMDa is the short form for Language Model for Dialogue Applications. It has high conversion capabilities and considered as next-generation language.

Bard:   

It is powered by LaMDA and it provides experimental conversation AI service.

Initially only a specific group of testers would test the tool. Then it will released for the Public.

It gathers  information from the web world and provides responses with high quality.

It can explain complicated topics in a simplified way.

Initial version is lightweight of LaMDA. It is aimed at consuming less computing power and increasing its users base to receive sufficient feedback.

Both the internal testing and external testing of Bard AI will result in a high quality AI Tool.

Conclusion:

Google is making all efforts to keep AI at each of its products like from images, videos etc. It is trying to give more insightful information to each search query. Especially, if the question has multiple answers, it figures out the essential information from a diverse range of answers. Google will also be guiding the software developers to create more powerful products with their AI Model.

How to add TextArrangement annotation in SAP UI5

The TextArrangement annotation is used to render the ID and the Corresponding Text in a particular format. The following CDS View UI Annotation is used to create the TextArrangement Annotation

@UI.textArrangement: #TEXT_FIRST
@ObjectModel.text.element: ['Name']
Id

The above CDS View TextArrangement annotation will generate the below annotations in the metadata file. TextArrangement annotation works only together with the Text annotation. As you can see below, the Property ‘Id’ and the Property ‘Name’ are interlinked together with the sap:text Inline annotations. The TextArrangement annotations are mentioned separately under the <Annotations> Tag.

                    <EntityType Name="CustomerType"
                        sap:label="Customers"
                        sap:content-version="1">
                        <Key>
                            <PropertyRef Name="Id" />
                        </Key>

                        <Property Name="Id"
                            Type="Edm.String"
                            Nullable="false"
                            MaxLength="10"
                            sap:visible="true"
                            sap:label="Customer ID"
                            sap:creatable="false"
                            sap:text="Name" />
                        <Property Name="FC"
                            Type="Edm.Byte"
                            sap:label="Field control" />
                        <Property Name="Name"
                            Type="Edm.String"
                            MaxLength="70"
                            sap:field-control="FC"
                            sap:creatable="false"
                            sap:updatable="true"
                            sap:label="Customer Name" />
                    </EntityType>

                        <Annotations Target="CustomerNamespace.CustomerType/Id"
                            xmlns="http://docs.oasis-open.org/odata/ns/edm">                              
                                  <Annotation Term="com.sap.vocabularies.UI.v1.TextArrangement"
                                      EnumMember="com.sap.vocabularies.UI.v1.TextArrangementType/TextFirst" />
                        </Annotations>

TextArrangment annotation is used mainly on the Primary Key Property or the sub entity (Primary key) to show the human readable text. The below picture is an example of TextFirst type.

There are totally four different types of TextArrangementType which are TextFirst, TextOnly, TextLast, TextSeparate. Let us see the other types with an example

TextOnly

                    <Annotations Target="CustomerNamespace.CustomerType/Id"
                        xmlns="http://docs.oasis-open.org/odata/ns/edm">                              
                              <Annotation Term="com.sap.vocabularies.UI.v1.TextArrangement"
                                  EnumMember="com.sap.vocabularies.UI.v1.TextArrangementType/TextOnly" />
                    </Annotations>

TextLast

                    <Annotations Target="CustomerNamespace.CustomerType/Id"
                        xmlns="http://docs.oasis-open.org/odata/ns/edm">                              
                              <Annotation Term="com.sap.vocabularies.UI.v1.TextArrangement"
                                  EnumMember="com.sap.vocabularies.UI.v1.TextArrangementType/TextLast" />
                    </Annotations>

TextSeparate

                    <Annotations Target="CustomerNamespace.CustomerType/Id"
                        xmlns="http://docs.oasis-open.org/odata/ns/edm">                              
                              <Annotation Term="com.sap.vocabularies.UI.v1.TextArrangement"
                                  EnumMember="com.sap.vocabularies.UI.v1.TextArrangementType/TextSeparate" />
                    </Annotations>