[go-nuts] Re: Go Community Charity Work?

2017-12-25 Thread Tamás Gulácsi
https://github.com/boombuler/barcode is a MIT licensed Aztec code generator.

You'll have to become a trusted central authority for the drug companies - or 
at least provide the infrastructure for the government to force such a central 
registry for uuids and public keys.

I think here the technical solution is almost ready, you have to assemble 
already existing components. The bigger problem is to build the concept and 
make a lot of important people accept it.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: select multiple expressions per case

2017-12-25 Thread matthewjuran
Well my almost-use-case was just for signaling without assignment. The 
assignment cases are something that would need to be addressed by such a 
feature. I like your pattern as a Go 1 solution, but what are the 
unaddressed concerns?

Thanks for the feedback, happy holidays.

Matt

On Sunday, December 24, 2017 at 12:41:04 PM UTC-6, Michael Jones wrote:
>
> Many important concerns are unaddressed here.
>
> Inside the clause of a "v1 := <-c1" the identifier v1 has meaning -- it is 
> the value by which one refers to the successful receipt.
>
> Inside the clause of a "v1, ok1 := <-c1" v1 is either the value received 
> when ok1 is true or the zero value of the type when ok1 is false.
>
> Having multiple vNs and one Ok feels improper to me.
>
>
>
> How about this as a way to do the "grouped response metaphor" you seek:
>
> var v1, v2, ... vN appropriateValueTypes for channels c1..cN
> var ok1, ok2, ... okN bool
>
> // do the select with all case bodies empty
> select {
> case v1,ok1 = <- c1: 
> case v2,ok2 = <- c2: 
> :
> case vN,okN = <- cN: 
> }
>
> // decode the select
> switch {
> case ok1, ok2:
>// common stuff coded once
> case okN:
>   // solo stuff
> }
>
>
>
> On Fri, Dec 22, 2017 at 7:36 AM,  
> wrote:
>
>> David,
>>
>> There's a good argument for not spending time adding this to the spec and 
>> compilers: there are bigger issues for the existing language developers.
>>
>> Jason,
>>
>> I've suggested the non-receiving assignment is set to the zero value, ok 
>> only applies to the receiving assignment and can be used twice since both 
>> are bool, and yes there are a lot of commas. Perhaps there could be special 
>> syntax for the multiple ok:
>>
>> select{
>> case x := <-c1, y := <-c2, (ok):
>> // ok is for whichever is assigned or closed
>> }
>>
>> Maybe living with the commas isn't too bad:
>>
>> select{
>> case x, ok := <-c1, y, ok := <-c2, z, ok := <-c3:
>> // ok is for whichever is assigned or closed
>> }
>>
>> Or how about ;? Two examples:
>>
>> select{
>> case x, ok := <-c1; y, ok := <-c2:
>> if ok == false {
>> return
>> }
>> if x != false {
>> fmt.Println("true on c1")
>> break
>> }
>> fmt.Printf("non-zero %v on c2\n", y)
>> case x, ok := <-c3; y, ok := <-c4:
>> if ok == false {
>> return
>> }
>> if x != 0 {
>> fmt.Println(x)
>> } else {
>> fmt.Println(y)
>> }
>> continue
>> case c5<-v1; c6<-v2; c7<-v3:
>> break OUTER
>> }
>>
>> select{
>> case x, ok := <-c1
>>  y, ok := <-c2:
>> if ok == false {
>> return
>> }
>> if x != false {
>> fmt.Println("true on c1")
>> break
>> }
>> fmt.Printf("%v on c2\n", y)
>> case x, ok := <-c3
>>  y, ok := <-c4
>>  z := <-c8:
>> if ok == false {
>> return
>> }
>> if x != 0 {
>> fmt.Println(x)
>> } else if y != nil {
>> fmt.Println(y)
>> } else {
>> fmt.Println(z)
>> }
>> continue
>> case c5<-v1
>>  c6<-v2
>>  c7<-v3:
>> break OUTER
>> }
>>
>> ok would be set to true if the receiving assignment does not assign it 
>> but other parallel assignments have it.
>>
>> Matt
>>
>>
>> On Friday, December 22, 2017 at 12:44:03 AM UTC-6, Jason Phillips wrote:
>>>
>>> Matt,
>>>
>>> Would that mean that other receive expression(s) yield the zero value?
>>>
>>> select {
>>> case x := <-c1, y := <-c2:
>>> // If a value is received from c1, is y the zero value?
>>> }
>>>
>>> Would the multi-valued assignment form of the receive operator gain an 
>>> additional meaning?
>>>
>>> select {
>>> case x, ok := <-c1, y := <-c2:
>>> // If a value is received from c2, does "ok" designate unsuccessful 
>>> receive or channel close?
>>> }
>>>
>>> Additionally, the commas become awfully confusing with multiple 
>>> multi-valued assignments:
>>>
>>> select {
>>> case x, ok1 := <-c1, y, ok2 := <-c2:
>>> // Do something
>>> }
>>>
>>>
>>> Jason
>>>
>>> On Thursday, December 21, 2017 at 2:38:02 PM UTC-5, matthe...@gmail.com 
>>> wrote:

 I would assume only one would send/receive out of the comma list for a 
 case to be executed.

 Matt

 On Thursday, December 21, 2017 at 12:32:22 PM UTC-6, Jason Phillips 
 wrote:
>
> With a multiple expression switch statement, the associated case is 
> executed if any expression is equal to the switch expression. For a 
> multiple expression select, would all channel expressions have to proceed 
> for the associated case to execute?
>
> e.g.
>
> select {
> case x := <-c1, y := <-c2:
> // is it guaranteed that both c1 and c2 have produced a value, or 
> just one or the other?
> }
>
> What about send operations?
>
> select {
> case c1 <- 10, c2 <- 20:
> // is this only executed if both sends happened?
> }
>
>
> Jason
>
> On Thursday, December 21, 2017 at 

[go-nuts] Possible bug on os.Stat and mode is symlink

2017-12-25 Thread Shulhan
Environment

OS: Linux xenom-bubu 4.14.8-1-ARCH #1 SMP PREEMPT Wed Dec 20 21:27:44
UTC 2017 x86_64 GNU/Linux

Go: go1.10beta1 linux/amd64

Steps to reproduce

  $ mkdir testSymlink
  $ cd testSymlink
  $ touch test
  $ ln -s test link
  $ cd ..
  $ test -L testSymlink/link
  # true, exit status 0

Test script bugSymlink.go,

package main

import (
"os"
)

func main() {
in := "testSymlink/link"

fi, err := os.Stat(in)
if err != nil {
panic(err)
}

fileMode := fi.Mode()
if fileMode != 0 {
println(in, "is symbolic link")
} else {
println(in, "is not symbolic link")
}
}

  $ go run bugSymlink.go
  testSymlink/link is not symbolic link

Is it a bug or I miss something?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] implement something like writeback journal for writing files

2017-12-25 Thread Vasiliy Tolstov
2017-12-25 19:50 GMT+03:00 Tamás Gulácsi :
> Butthat package seems to be a perfect fit.
> Create a wal only for writers.

I have virtual disk that provided for client, disk represented by 4Mb
blocks, when user writes data inside vm, data written to specific
block at specific offset.
In this case i need wal for all blocks in current server. In case of
5gb disk i have 1255 files (because some files replicated across hdd
in single server via ketama hash ring.
And cache fd not very usable, because i think that that after write
and before flush from ssd to hdd i read at mostly one time.

> You'll have to cache the file descriptors anyway.




-- 
Vasiliy Tolstov,
e-mail: v.tols...@selfip.ru

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] implement something like writeback journal for writing files

2017-12-25 Thread Tamás Gulácsi
Butthat package seems to be a perfect fit.
Create a wal only for writers.
You'll have to cache the file descriptors anyway.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Go Community Charity Work?

2017-12-25 Thread matthewjuran
We would write a scaling server with Go on one of these public datacenter 
services. A manufacturer or distributor could register a UUID with us that 
is then verified through us by the pharmacy and consumer later. The 
pharmacy/consumer has the aztec barcode with the UUID, manufacturer 
cryptographic number, and distributor cryptographic number, so maybe we’re 
talking about two barcodes and a distribution standard.

Capturing already-scanned UUIDs may mitigate some copying, or at least 
indicate to the consumer or pharmacy that there's a copier problem.

Would the picture be processed by the server or by the client? How are 
existing Go libs for these aztec barcodes?

We'd need an authentication system for people or organizations registering 
UUIDs.

Could we have data tied to the UUID on the target distributor, target 
pharmacy, or target consumer?

“when we are looking at the source, we are looking at the stock cards, and 
also cross-checking with the delivery sheet to confirm this is what is 
being supplied”

In Kenya one distributor handles 40% of the country’s medicine supply. They 
have a QA process. But: “Many small storefronts buy from unauthorized 
distributors” - we’re not fixing this part except maybe through consumer 
knowledge (“we’re expecting the bar code”). PBS pointed out barcoding as a 
solution put into place already.

Thomas Woods of the World Bank talks about “rapid authentication devices”. 
As a group of app implementers I think we’d be best served by partnering 
with an organization with connections to the industry instead of directly 
with manufacturers or distributors. Who can we talk to?

I think this is on-topic for golang-nuts as we’re discussing a use case of 
Go and programming: building global information services. Maybe somebody 
can use our designs for their Go service later.

Matt

On Sunday, December 24, 2017 at 4:14:22 PM UTC-6, Tamás Gulácsi wrote:
>
> A signed nonce is enough to prove private key ownership - as far as it 
> can. Replay attack is unavoidable.
> Uuid is useful for tracking.
>
> But how feasible is this? Here (Hungary, Eastern Europe) we have drugs 
> packed in preprinted boxes, and the serial ids are just pushed into the 
> paper.
> Per-box personalized aztec code would push up the packaging price 
> significantly.
>
> But for dangerous/pricey drugs this may be acceptable.
>
>
> But this is not Go related yet, so maybe we should move this to somewhere 
> else.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] implement something like writeback journal for writing files

2017-12-25 Thread Vasiliy Tolstov
25 Дек 2017 г. 13:54 пользователь "Jan Mercl" <0xj...@gmail.com> написал:

On Mon, Dec 25, 2017 at 10:11 AM Vasiliy Tolstov 
wrote:

What about a write ahead log? https://godoc.org/github.com/cznic/file#WAL


I know about this package, but I have many files like 3-5 and
create Wal for each file is overhead...


-- 

-j

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Where to stick temporary go files after an AST rewrite?

2017-12-25 Thread Matt Mueller
Hey folks!

I'm using the new https://godoc.org/golang.org/x/tools/go/ast/astutil#Apply 
function, but keep running into the question:

After I rewrite these files, where do I stick them so they're still 
buildable with the rest of the program? Is there anyway to call "go run" 
after modifying the AST of these files? 

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] implement something like writeback journal for writing files

2017-12-25 Thread Jan Mercl
On Mon, Dec 25, 2017 at 10:11 AM Vasiliy Tolstov 
wrote:

What about a write ahead log? https://godoc.org/github.com/cznic/file#WAL

-- 

-j

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Possible bug on os.Stat and mode is symlink

2017-12-25 Thread Jakob Borg
You want os.Lstat.

> On 25 Dec 2017, at 11:36, Shulhan  wrote:
> 
> Environment
> 
> OS: Linux xenom-bubu 4.14.8-1-ARCH #1 SMP PREEMPT Wed Dec 20 21:27:44
> UTC 2017 x86_64 GNU/Linux
> 
> Go:
> - go1.10beta1 linux/amd64
> - go1.9.2
> 
> Steps to reproduce
> 
>  $ mkdir testSymlink
>  $ cd testSymlink
>  $ touch test
>  $ ln -s test link
>  $ cd ..
>  $ test -L testSymlink/link
>  # true, exit status 0
> 
> Test script bugSymlink.go,
> 
> package main
> 
> import (
>   "os"
> )
> 
> func main() {
>   in := "testSymlink/link"
> 
>   fi, err := os.Stat(in)
>   if err != nil {
>   panic(err)
>   }
> 
>   fileMode := fi.Mode()
>   if fileMode != 0 {
>   println(in, "is symbolic link")
>   } else {
>   println(in, "is not symbolic link")
>   }
> }
> 
>  $ go run bugSymlink.go
>  testSymlink/link is not symbolic link
> 
> Is it a bug or I miss something?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Possible bug on os.Stat and mode is symlink

2017-12-25 Thread Shulhan
Environment

OS: Linux xenom-bubu 4.14.8-1-ARCH #1 SMP PREEMPT Wed Dec 20 21:27:44
UTC 2017 x86_64 GNU/Linux

Go:
- go1.10beta1 linux/amd64
- go1.9.2

Steps to reproduce

  $ mkdir testSymlink
  $ cd testSymlink
  $ touch test
  $ ln -s test link
  $ cd ..
  $ test -L testSymlink/link
  # true, exit status 0

Test script bugSymlink.go,

package main

import (
"os"
)

func main() {
in := "testSymlink/link"

fi, err := os.Stat(in)
if err != nil {
panic(err)
}

fileMode := fi.Mode()
if fileMode != 0 {
println(in, "is symbolic link")
} else {
println(in, "is not symbolic link")
}
}

  $ go run bugSymlink.go
  testSymlink/link is not symbolic link

Is it a bug or I miss something?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: golang for AI

2017-12-25 Thread Sebastien Binet
Not sure what Fabien is using but the Go equivalent of numpy is Gonum:
https://gonum.org.
(At least it's the closest to numpy that I know of)

-s

sent from my droid

On Dec 25, 2017 7:47 AM, "Lee Rick"  wrote:

Can you share some name What package is used?  python has a package called
numpy,  it is useful, but ,i can't find similar package in golang, do you
use similar numpy package in golang ?

在 2017年12月22日星期五 UTC+8下午10:08:28,Fabien写道:

> I'm working in an AI research lab and use golang a lot, so I would tend to
> say yes. We're working in the symbolic AI field though (ontologies,
> constraint solving and that stuff), not machine learning.
>
> Le vendredi 22 décembre 2017 07:33:04 UTC+1, Lee Rick a écrit :
>>
>> hi,
>>Artificial intelligence is a big trend, and i want to know whether or
>> not to consider golang playing a role in artificial intelligence?
>>Whether to consider developing some basic artificial intelligence
>> package with support package, use just as python.
>>
> --
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] implement something like writeback journal for writing files

2017-12-25 Thread Vasiliy Tolstov
Hi. I have some servers with sata hdd and 2 ssd.
I want to use ssd for writeback journal to provide faster speed in
case of writing and not lost durability.
Client connects to server and send some chunk of data with file name and offset.
As of sata hdd is slow, i want to write data chunks to journal and
with additional thread flush to disks.
Main problems:
client can send write requests to single file but different offsets
client can send read request after/before write and sometimes client
try to read data that presented only in journal. And sometimes client
can read data with len bigger when written before (so i need to read
some data from journal and some from hdd)
I'm try to check ceph journal format on disk layout
http://irq0.org/articles/ceph/journal but don't understand how it
helps with read data after write. Also i'm try to read jbd2 code from
linux kernel, but have no luck =(.
I know about bcache, lvm cache, flashcache and other solutions, but i
need pure go and pure application solution.
Does somebody already thinks about such problems or know some link
where i can find ideas?
Thanks!


-- 
Vasiliy Tolstov,
e-mail: v.tols...@selfip.ru

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.