Skip to main content

Posts

Showing posts from April, 2019

Do you support us?

Business address
0x1D24D8f27ea73ff604C7685246bdC6ae55bddaEF

Agents ready to Go on a mission

I refer function as a agents because function work like agents. Sometime different programmer, working on single project or it can be poor choice whole application written in main. That why every language introduce packages and functions. Packages will be beneficial when programmer use predefined functionalities which already provided by different programmers . Such as images, net packages. If you explore you know images contain , functions, constants, variables and subdirectories. This package only concern with images or pixels.  Functions are the good option when a programmer work on modules or a blocks or even above scenario. If you play a military games then you know on a mission there are so many agents work together to accomplish mission. Each agent have own tools. Each person have different skills such as some agents short range shooter or some agents have long sniper, some agents are experts in technology etc. You can create any type of function. We build so many...

Go handle Json Perfectly

JSON abbreviation "JavaScript Object Notation". There're so many tools for structure data such as xml, Json, asn.1 and google protobuf. XML and JSON: writing code in a xml, so called boilerplate. Java and android use xml for project management. While json, is easy as compare to xml. Mostly use json because it's easy to play around and good choice for web application. Code : package main import ( "fmt" "encoding/json" ) type Books struct{ Title string  Status bool Writer string  Comments string } func main() { var Library =[]Books{ {Title:"Lord of Rings the fellowship", Status:false, Writer:"J-J-R-Tolkien",Comments:""}, {Title:"Quantum Aspects of Life",Status: false, Writer:"Paul-C",Comments:""}, {Title:"You were born rich", Status:true, Writer:"Bob Proctor",Comments:"good book"}, } if lib , err := json.MarshalIndent(&Library,...

How to Optimize our code efficiency.

In Golang structs are very powerful and common use. In previous article, I show you how to write a struct but this is not efficient way to write.  type Point struct{ X,Y int } point := Point{1,2}                 code .1.1   There are two types struct literals :                 In first type, study above code. Programmer usually avoid this because it's difficult to remember about fields, it's should be in right order. Programmer use this in custom packages and smaller structs types.                  In second type Programmer like very much , it's more powerful then previous type.                  anim := GIF.gif{loopCount: nframes}                                  If any field value omit then th...

Every Object have a structure

If you start your programming career from c , then you know little about structs. Later Struct replace by classes in object oriented programming. However Go inherit from C. Structs :     With the help of structs, programmer can develop any type of structure         List        Stack        Queue        Trees        Graphs package main import ( " fmt " ) type Students struct { ID int Name string } var record Students func Id ( i int ) int { record. ID = i return record. ID } func Name ( name string ) string { record. Name = name return record. Name } func main () { var id int = 0 var name string = " ali " fmt. Println ( " id: " , Id (id), " name: " , Name (name)) } When we want to create custom type such as Celsius type Celsius float64, same with structs type Students structs except ty...