Hello,
why the method Read of rot13Reader run twice?
This is the code:
package main
import (
"fmt"
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
}
var k int
func (rot *rot13Reader) Read(p []byte) (n int, err error) {
k++
n,
Sorry but the method work twice.
try this:
}
func (rot *rot13Reader) Read(p []byte) (n int, err error) {
k++
n, err = rot.r.Read(p)
for i := 0; i < len(p); i++ {
if (p[i] >= 'A' && p[i] < 'N') || (p[i] >= 'a' && p[i] < 'n') {
p[i] +=
Anyway thank you for the answer.
I know whats the problem.
This is an example of "cargo cult programming"
This is where I read the solutions.
https://gist.github.com/zyxar/2317744
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe fr
1.
Because with 2 there is a problem. The method is called twice and is
inefficient.
Il giorno venerdì 30 giugno 2017 11:31:31 UTC+2, Jan Mercl ha scritto:
>
> On Fri, Jun 30, 2017 at 9:48 AM Franco Marchesini > wrote:
>
> > Why after the execution the k value is 2?
>
>
Yes, after Dave's answer I realized the mistake.
This is a solution.
Il giorno venerdì 30 giugno 2017 11:42:45 UTC+2, Sebastien Binet ha scritto:
>
>
>
> On Fri, Jun 30, 2017 at 11:38 AM, Franco Marchesini > wrote:
>
>> 1.
>>
>> Because with 2 there is
Aside from the correction, however, I did not understand why the method is
called 2 times.
Il giorno venerdì 30 giugno 2017 12:51:20 UTC+2, Franco Marchesini ha
scritto:
>
> Yes, after Dave's answer I realized the mistake.
> This is a solution.
>
> Il giorno venerdì 30 giug
orno venerdì 30 giugno 2017 15:01:55 UTC+2, Jan Mercl ha scritto:
>
>
> On Fri, Jun 30, 2017 at 2:42 PM Franco Marchesini > wrote:
>
> > Aside from the correction, however, I did not understand why the method
> is called 2 times.
>
> HTH: https://play.golang.org/p/Na7GtgZ
If you really have over 100 simultaneous connection you need to configure
postgresql engine
Regards
Franco
Il giorno mercoledì 21 giugno 2017 14:56:14 UTC+2, Tieson Molly ha scritto:
>
> I am running into an issue I have seen mentioned on here years ago. I am
> seeking the current best solution
enConns(config.MaxOpenConns)
> db.SetMaxIdleConns(config.MaxIdleConns)
>
>
> On Friday, June 30, 2017 at 10:22:11 AM UTC-4, Franco Marchesini wrote:
>>
>> If you really have over 100 simultaneous connection you need to configure
>> postgresql engine
>> Regards
>> F
Help,
how I can translate this shell command :
echo -n 123456 | dmtxwrite -s 16x48 -o image.png
to golang
exec.Commad()
Thanks in advance
Franco
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop recei
Ciao,
I had read this tutorial, but my mistake was not having called the shell
command
Il giorno lunedì 22 giugno 2020 18:01:04 UTC+2, Michael Jones ha scritto:
>
> https://tutorialedge.net/golang/executing-system-commands-with-golang/
>
> On Mon, Jun 22, 2020 at 8:54 AM Franc
ugno 2020 18:19:36 UTC+2, Bakul Shah ha scritto:
>
> You can avoid calling the shell by observing that you are simply passing
> "123456" as input, which you can do in a Go Program itself.
> See https://golang.org/pkg/os/exec/#example_Command
>
>
> On Jun 22, 2020, a
12 matches
Mail list logo