poniedziałek, 9 listopada 2020

[Let`s go with golang] Image progressing

 There are many issues to simple programs. For me The most intresting is change image.

Golang have good library to image so was funny. 

I had problem to type of values. Libs use RGB in uint8 (0,255) but I need avarage in to greater scope (3x255) so I converted values to int32, I was doing my job and converted back.

I wanted do "black and white"  and "sepia" transformation

SOURCE






piątek, 6 listopada 2020

[Let`s go with golang] Simple Challange

 I found task, but maybe it found me.

Task to PHP:

"Write a 10x5 table with values ​​from 1-50".

I prefer go so I write in go :)

func main() {
var index int =1
var x=5
var y=10
for i := 0; i < x; i++ {
for j := 0; j < y; j++ {
fmt.Print("___")
}
fmt.Println()
fmt.Print("|")
for j := 0; j < 10; j++ {
strconv.Itoa(index)
fmt.Printf("%2s|",strconv.Itoa(index))
index++
}
fmt.Println()
}
for j := 0; j < 10; j++ {
fmt.Print("___")
}
}

And effect:





sobota, 26 września 2020

[Java Example] How use ORM?

 Today I description simple project, which connection to database.

In java There is two most popular ORM ( Maybe three but it use in spring boot):

😀 Java Persistence Api

😁 Hibernate (most known)

In fact they are the same. They have some other method name, but work identicaly and use the same class.

Code show select and insert/update. Configuration allows conection to Postgres(my preference) and Mysql.

Of course You can simple add other database for example Oracle( add maven lib and configuration connection in xml)




😌The project was created especially for my colleague Marek.😏

czwartek, 11 czerwca 2020

[Let`s go with golang] Interface and letters

I came back to golang. So today ->Interface.
I write in Java a long time, so I have interface imagination, but Golang has other.
In java There is class with some interface. If class not implement interface, cant use function requring it.
But in Go There is type with methods and interface with same methods thats all( of course I think type and function use type)

I see difference thats in Java first is interface, in Go function.
------------------------------------------------------------------
Letter in golang
Intresting idea use letter to hermetization. I always know what is public and what is private.

CODE:
https://github.com/mikoxp/Go_code/commit/4e407545d7245926c892a7cd68ec56b00b0f2f0d
and fix
https://github.com/mikoxp/Go_code/commit/e25873731649d0c93de0e2f957a480cf0da262dc