Skip to main content

World markets dive as Trump sparks trade, North Korea worries

Global stocks sank Wednesday after US President Donald Trump said he was not satisfied with talks that are aimed at averting a trade war with China. Equities were also dented by poor eurozone economic data, and as Trump cast doubt on a planned summit with North Korean leader Kim Jong Un. “Trump (is) continuing to drive uncertainty over global trade,” said analyst Joshua Mahony at trading firm IG. “European markets are following their Asian counterparts lower, as a pessimistic tone from Trump is compounded by downbeat economic data,” he added. Markets had surged Monday after US Treasury Secretary Steven Mnuchin and Chinese Vice Premier Liu He said they had agreed to pull back from imposing threatened tariffs on billions of dollars of goods, and continue talks on a variety of trade issues. However, Trump has declared that he was “not satisfied” with the status of the talks, fuelling worries that the world’s top two economies could still slug out an economically pain...

What to Know about Google Go (programming language) and how it works.

Go (often referred to as Golang) is a programming language created at Google in 2009 by Robert Griesemer, Rob Pike, and Ken Thompson.[11] Go is a statically typed language in the tradition of C, with memory safetygarbage collectionstructural typing, and CSP-style concurrent programming features added. The compiler and other tools originally developed by Google are all free and open source.

Go originated as an experiment by Google engineers Robert Griesemer, Rob Pike, and Ken Thompson to design a new programming language that would resolve common criticisms of other languages while maintaining their positive characteristics. The developers envisioned the new language as:

Go is recognizably in the tradition of C, but makes many changes to improve brevity, simplicity, and safety. Go consists of:
  • A syntax and environment adopting patterns more common in dynamic languages:
    • Optional concise variable declaration and initialization through type inference (x := 0 not int x = 0; or var x = 0;).
    • Fast compilation times.
    • Remote package management (go get) and online package documentation.
  • Distinctive approaches to particular problems:
  • Syntax

    Go's syntax includes changes from C aimed at keeping code concise and readable. A combined declaration/initialization operator was introduced that allows the programmer to write i := 3 or s := "Hello, world!"without specifying the types of variables. This contrasts with C's int i = 3; and const char *s = "Hello, world!";. Semicolons still terminate statements, but are implicit when the end of a line occurs. Functions may return multiple values, and returning a result, err pair is the conventional way a function indicates an error to its caller in Go.[a] Go adds literal syntaxes for initializing struct parameters by name, and for initializing maps and slices. As an alternative to C's three-statement for loop, Go's range expressions allow concise iteration over arrays, slices, strings, maps, and channels.
Go has a number of built-in types, including numeric ones (byteint64float32, etc.), booleans, and character strings (string). Strings are immutable; built-in operators and keywords (rather than functions) provide concatenation, comparison, and UTF-8 encoding and decoding.[33] Record types can be defined with the struct keyword.[citation needed]
For each type T and each non-negative integer constant n, there is an array type denoted [n]T; arrays of differing lengths are thus of different types. Dynamic arrays are available as "slices", denoted []T for some type T. These have a length and a capacity specifying when new memory needs to be allocated to expand the array. Several slices may share their underlying memory.
type ipv4addr uint32
With this type definition, ipv4addr(x) interprets the uint32 value x as an IP address. Simply assigning x to a variable of type ipv4addr is a type error.
Constant expressions may be either typed or "untyped"; they are given a type when assigned to a typed variable if the value they represent passes a compile-time check.
Function types are indicated by the func keyword; they take zero or more parameters and return zero or more values, all of which are typed. The parameter and return values determine a function type; thus, func(string, int32) (int, error) is the type of functions that take a string and a 32-bit signed integer, and return a signed integer (of default width) and a value of the built-in interface type error.
Any named type has a method set associated with it. The IP address example above can be extended with a method for checking if its value is a known standard.
// ZeroBroadcast reports whether addr is 255.255.255.255.
func (addr ipv4addr) ZeroBroadcast() bool {
    return addr == 0xFFFFFFFF
import "math"

type Shape interface {
    Area() float64
}

type Square struct { // Note: no "implements" declaration
    side float64
}

func (sq Square) Area() float64 { return sq.side * sq.side }

type Circle struct { // No "implements" declaration here either
    radius float64
}

func (c Circle) Area() float64 { return math.Pi * math.Pow(c.radius, 2) }
Both Square and Circle are implicitly a Shape and can be assigned to a Shape-typed variable.[4In formal language, Go's interface system provides structural rather than nominal typing. Interfaces can embed other interfaces with the effect of creating a combined interface that is satisfied by exactly the types that implement the embedded interface and any methods that the newly defined interface adds.

Hello world

Here is a Hello world program in Go:
package main

import "fmt"

func main() {
    fmt.Println("Hello, World")
}

Concurrency example

The following simple program demonstrates Go's concurrency features to implement an asynchronous program. It launches two "goroutines" (lightweight threads): one waits for the user to type some text, while the other implements a timeout. The select statement waits for either of these goroutines to send a message to the main routine, and acts on the first message to arrive (example adapted from David Chisnall book).
package main

import (
    "fmt"
    "time"
)

func readword(ch chan string) {
    fmt.Println("Type a word, then hit Enter.")
    var word string
    fmt.Scanf("%s", &word)
    ch <- word
}

func timeout(t chan bool) {
    time.Sleep(5 * time.Second)
    t <- true
}

func main() {
    t := make(chan bool)
    go timeout(t)

    ch := make(chan string)
    go readword(ch)

    select {
    case word := <-ch:
        fmt.Println("Received", word)
    case <-t:
        fmt.Println("Timeout.")
    }

Comments

Popular posts from this blog

World markets dive as Trump sparks trade, North Korea worries

Global stocks sank Wednesday after US President Donald Trump said he was not satisfied with talks that are aimed at averting a trade war with China. Equities were also dented by poor eurozone economic data, and as Trump cast doubt on a planned summit with North Korean leader Kim Jong Un. “Trump (is) continuing to drive uncertainty over global trade,” said analyst Joshua Mahony at trading firm IG. “European markets are following their Asian counterparts lower, as a pessimistic tone from Trump is compounded by downbeat economic data,” he added. Markets had surged Monday after US Treasury Secretary Steven Mnuchin and Chinese Vice Premier Liu He said they had agreed to pull back from imposing threatened tariffs on billions of dollars of goods, and continue talks on a variety of trade issues. However, Trump has declared that he was “not satisfied” with the status of the talks, fuelling worries that the world’s top two economies could still slug out an economically pain...

5 Best Hacking Books of 2018.

5 Best Hacking Books of 2017 By Gabriel   On January  30, 201 8 Learning hacking has always been tough for beginners not because its very difficult, but because they do not have proper source of learning, and because appropriate guide is very essential in this field, Experts always recommend us to read books initially. So that, you can get all tutorials and guides easily from top hacking book, PDF and eBook of 2018 . Hacking is an Art of Exploitation  which can be used ethically as well as unethically, for e.g.  A hammer can be used to build or break something,  and anybody can learn this art easily with just little efforts, YES! nowadays its easy to  learn how to hack , In fact you can teach yourself or get an online training, However in any case you will definitely need books because that's the only  best way to learn hacking for beginners . Best Hacking Books of 2017 The secret of  learning hacking  more quickly and...

APDA, PDP, commend INEC for “timely” release of 2019 elections’ timetable.

The Advanced Peoples Democratic Alliance (APDA) and the Peoples Democratic Party have commended the Independent National Electoral Commission (INEC) “for early release of timetable and schedule of activities for the 2019 general elections.” The political parties gave the commendation in an interview with the News Agency of Nigeria (NAN) in Abuja on Wednesday. The APDA National Publicity Secretary, Mr Tosin Adeyanju, described the timetable and schedule of activities as a welcome development for political parties. Adeyanju said that the early release of the timetable would enable political parties to have enough time to prepare for the elections. He added that it had also cleared all rumours and speculations, especially date of primaries and other pre-election activities for political parties. He noted that “we in APDA believe that the timetable would afford political parties the opportunity and enough time to adequately prepare and plan for the elections. “This ...