--- Log opened Fri Nov 05 00:00:15 2010
00:05 -!- virtualsue [~chatzilla@nat/cisco/x-mdrjmiuxvsnfteah] has quit [Ping
timeout: 240 seconds]
00:16 -!- MashPotato [~ed@unaffiliated/mashpotato] has quit [Read error:
Connection reset by peer]
00:25 -!- enherit [~enherit@cpe-98-149-170-48.socal.res.rr.com] has quit [Quit:
leaving]
00:37 -!- zeroXten [~zeroXten@0x10.co.uk] has quit [Ping timeout: 276 seconds]
00:40 -!- adu [~ajr@pool-74-96-89-94.washdc.fios.verizon.net] has quit [Quit: adu]
00:43 -!- zeroXten [~zeroXten@0x10.co.uk] has joined #go-nuts
00:49 < MaybeSo> wrtp: thanks for your help, using your advice and samples
I've got this stuff working exactly the way I wanted
00:50 < wrtp> cool.  glad to be of help.
00:50 -!- Venom_X [~pjacobs@74.61.90.217] has quit [Quit: Venom_X]
00:52 -!- Thomas1 [~kvirc@188-23-2-10.adsl.highway.telekom.at] has joined #go-nuts
00:54 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has joined #go-nuts
00:55 -!- Thomas3467 [~kvirc@188-23-102-20.adsl.highway.telekom.at] has quit [Ping
timeout: 240 seconds]
01:03 -!- tvw [~tv@e176006024.adsl.alicedsl.de] has quit [Ping timeout: 245
seconds]
01:03 -!- mikespook [~mikespook@219.137.253.133] has joined #go-nuts
01:09 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has quit [Quit:
Leaving.]
01:26 -!- tav [~tav@92.7.93.11] has quit [Read error: Connection reset by peer]
01:26 -!- tav [~tav@92.7.93.11] has joined #go-nuts
01:42 -!- raylu [raylu@c-24-131-193-106.hsd1.pa.comcast.net] has left #go-nuts []
01:44 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has joined #go-nuts
01:47 -!- artefon [~thiago@189.115.131.94] has joined #go-nuts
01:48 -!- wrtp [~rog@92.17.68.10] has quit [Quit: wrtp]
01:54 -!- niemeyer [~niemeyer@189-72-21-191.pltce701.dsl.brasiltelecom.net.br] has
quit [Ping timeout: 245 seconds]
01:58 -!- d_m [d6@SDF.ORG] has joined #go-nuts
02:25 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has joined #go-nuts
02:26 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has joined
#go-nuts
02:34 -!- dacc1 [~Adium@c-24-19-50-69.hsd1.wa.comcast.net] has joined #go-nuts
02:38 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has quit [Ping
timeout: 276 seconds]
02:39 -!- artefon [~thiago@189.115.131.94] has quit [Read error: Connection reset
by peer]
02:40 -!- fumblebee [~kgay@blk-138-44-93.eastlink.ca] has quit [Ping timeout: 245
seconds]
02:58 -!- fumblebee [~kgay@blk-142-24-126.eastlink.ca] has joined #go-nuts
03:17 -!- gnuvince [~vince@70.35.165.60] has quit [Ping timeout: 252 seconds]
03:17 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has quit [Ping
timeout: 245 seconds]
03:19 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has joined #go-nuts
03:31 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has quit [Ping
timeout: 245 seconds]
03:32 -!- artefon [~thiago@189.115.131.94] has joined #go-nuts
03:32 -!- artefon [~thiago@189.115.131.94] has quit [Client Quit]
03:33 -!- fumblebee [~kgay@blk-142-24-126.eastlink.ca] has quit [Ping timeout: 240
seconds]
03:35 -!- rejb [~rejb@unaffiliated/rejb] has quit [Ping timeout: 276 seconds]
03:35 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has joined #go-nuts
03:39 -!- mikespook [~mikespook@219.137.253.133] has quit [Read error: Connection
reset by peer]
03:41 -!- mikespook [~mikespook@219.137.75.81] has joined #go-nuts
03:47 -!- binarypie [~binarypie@c-24-6-151-185.hsd1.ca.comcast.net] has joined
#go-nuts
04:00 -!- lmoura [~lauromour@187.112.11.189] has quit [Ping timeout: 250 seconds]
04:07 -!- binarypie [~binarypie@c-24-6-151-185.hsd1.ca.comcast.net] has quit
[Remote host closed the connection]
04:20 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has quit [Quit:
This computer has gone to sleep]
04:30 -!- iant [~iant@216.239.45.130] has quit [Ping timeout: 255 seconds]
04:32 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has joined
#go-nuts
04:33 -!- rbraley [~rbraley@ip72-222-128-78.ph.ph.cox.net] has quit [Ping timeout:
255 seconds]
04:33 -!- dj2 [~dj2@CPE001f5b35feb4-CM0014048e0344.cpe.net.cable.rogers.com] has
quit [Remote host closed the connection]
04:36 -!- rbraley [~rbraley@ip72-222-128-78.ph.ph.cox.net] has joined #go-nuts
04:47 -!- iant [~iant@adsl-71-133-8-30.dsl.pltn13.pacbell.net] has joined #go-nuts
04:47 -!- mode/#go-nuts [+v iant] by ChanServ
04:48 -!- reportingsjr [~Jon@pysoy/developer/JonNeal] has joined #go-nuts
04:48 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has quit [Quit:
This computer has gone to sleep]
04:49 -!- binarypie [~binarypie@c-24-6-151-185.hsd1.ca.comcast.net] has joined
#go-nuts
04:51 -!- tumdum [~tumdum@auk219.neoplus.adsl.tpnet.pl] has joined #go-nuts
04:51 -!- tumdum [~tumdum@auk219.neoplus.adsl.tpnet.pl] has quit [Changing host]
04:51 -!- tumdum [~tumdum@unaffiliated/tumdum] has joined #go-nuts
05:07 -!- zozoR [~zozoR@5634798d.rev.stofanet.dk] has joined #go-nuts
05:12 -!- bjarneh [~bjarneh@1x-193-157-199-167.uio.no] has joined #go-nuts
05:19 -!- bjarneh [~bjarneh@1x-193-157-199-167.uio.no] has quit [Quit: leaving]
05:19 -!- bjarneh [~bjarneh@1x-193-157-199-167.uio.no] has joined #go-nuts
05:25 -!- iant [~iant@adsl-71-133-8-30.dsl.pltn13.pacbell.net] has quit [Ping
timeout: 245 seconds]
05:26 -!- iant [~iant@216.239.45.130] has joined #go-nuts
05:26 -!- mode/#go-nuts [+v iant] by ChanServ
05:26 < plexdev> http://is.gd/gJGNe by [Nigel Tao] in go/doc/ -- doc: make
root.html's blog section less cluttered.
05:29 -!- gnuvince [~vince@70.35.170.156] has joined #go-nuts
05:33 -!- b00m_chef [~watr@66.183.108.186] has joined #go-nuts
05:39 -!- jcao219 [~Jimmy_Cao@pool-96-226-238-248.dllstx.fios.verizon.net] has
joined #go-nuts
05:40 < nsf> has anyone seen the bin2go tool around?  (like bin2c, but for
Go) :)
05:42 < jcao219> cool
05:42 < jcao219> where?
05:42 < nsf> that's what I'm asking
05:42 < nsf> I guess I should write one
05:46 -!- Eridius [~kevin@unaffiliated/eridius] has quit [Ping timeout: 272
seconds]
05:48 < jcao219> i wonder if there is bin2d
05:48 < nsf> I think I had seen it somewhere
06:00 -!- b00m_chef [~watr@66.183.108.186] has quit [Ping timeout: 255 seconds]
06:03 -!- jcao219 [~Jimmy_Cao@pool-96-226-238-248.dllstx.fios.verizon.net] has
quit [Quit: Leaving.]
06:07 -!- zozoR [~zozoR@5634798d.rev.stofanet.dk] has quit [Quit: Morten.  Desu~]
06:10 -!- dacc1 [~Adium@c-24-19-50-69.hsd1.wa.comcast.net] has quit [Quit:
Leaving.]
06:15 -!- binarypie [~binarypie@c-24-6-151-185.hsd1.ca.comcast.net] has quit
[Remote host closed the connection]
06:20 -!- tumdum [~tumdum@unaffiliated/tumdum] has quit [Ping timeout: 272
seconds]
06:29 < plexdev> http://is.gd/gJLLJ by [Alex Brainman] in
go/src/pkg/runtime/windows/ -- runtime: fix windows build
06:32 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has joined #go-nuts
06:33 -!- tumdum [~tumdum@unaffiliated/tumdum] has joined #go-nuts
06:37 < nsf> http://github.com/nsf/bin2go
06:37 < nsf> done
06:37 < nsf> although looks like both go/parser and Go compiler have
problems with long []byte{} literals
06:40 < nsf> maybe it is reasonable to add binary inclusion feature like in
D
06:40 < nsf> something like: var x = import("filename.binary")
06:41 < nsf> reads the file and converts it to []byte
06:41 < nsf> and import is a keyword, therefore it will be easily identified
by the compiler
06:47 -!- Tv [~tv@cpe-76-168-227-45.socal.res.rr.com] has quit [Ping timeout: 240
seconds]
06:50 -!- tumdum [~tumdum@unaffiliated/tumdum] has quit [Quit: tumdum]
06:53 -!- iomox [~ios@180.191.93.163] has joined #go-nuts
06:59 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has quit [Quit:
Leaving.]
07:04 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has joined #go-nuts
07:04 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has quit [Client Quit]
07:04 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has joined #go-nuts
07:04 < uriel> nsf: I'm not convinced
07:04 < nsf> and I don't really care
07:04 < nsf> :)
07:05 < nsf> bin2go works for me
07:05 < uriel> nsf: you can either load the file at runtime, or doing it
inline should be fine (use a separate .go file if you like)
07:05 < uriel> if there are bigs with long []byte{} literals then that
obviously should be fixed
07:05 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has quit [Client Quit]
07:06 < nsf> well, go/parser is a bit slow with that kind of literals
07:06 < nsf> hopefully after Position compressing it will be a bit faster
07:06 < nsf> it just allocates an AST node for each byte in this long array
07:06 < uriel> why do you need to use go/parser on that stuff?
07:06 < uriel> (just curious)
07:06 < nsf> 1.  gofmt
07:06 < nsf> 2.  gocode
07:06 < uriel> yea, but just put it in its own .go file which you do not
gofmt
07:07 < nsf> when you type gofmt -w *.go
07:07 < nsf> it sucked in
07:07 < uriel> yea, I agree
07:07 < nsf> :)
07:07 < nsf> and gocode does that as well
07:07 < uriel> well, lets hope it gets fixed
07:07 < nsf> it just scans for every .go file in the dir
07:07 < uriel> and I guess godoc might suffer a bit too
07:07 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Ping timeout: 255
seconds]
07:07 < nsf> but it's not like really slow
07:07 < nsf> it's fine
07:08 < nsf> for example
07:08 < nsf> I have 200kb file with []byte{} literals only
07:08 < nsf> gofmt -w thisfile.go
07:08 < nsf> executes in 2.5 secs
07:09 < nsf> no one dies, but it's not carriage return time anymore :D
07:09 < uriel> get faster hardware ;P
07:13 -!- tumdum [~tumdum@avd4.neoplus.adsl.tpnet.pl] has joined #go-nuts
07:13 -!- tumdum [~tumdum@avd4.neoplus.adsl.tpnet.pl] has quit [Changing host]
07:13 -!- tumdum [~tumdum@unaffiliated/tumdum] has joined #go-nuts
07:13 < nsf> good advice
07:13 < nsf> i'll live with it
07:17 -!- tumdum [~tumdum@unaffiliated/tumdum] has quit [Ping timeout: 260
seconds]
07:19 < nsf> I thought defer is evil in its dynamic form
07:19 < nsf> but it turns out it is a very nice feature
07:19 < nsf> http://pastie.org/1274337
07:19 < nsf> for snippets like this one
07:20 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
07:29 -!- bortzmeyer [~bortzmeye@batilda.nic.fr] has joined #go-nuts
07:31 -!- rbraley [~rbraley@ip72-222-128-78.ph.ph.cox.net] has quit [Ping timeout:
240 seconds]
07:37 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Quit: |Craig|]
07:40 -!- rbraley [~rbraley@ip72-222-128-78.ph.ph.cox.net] has joined #go-nuts
07:42 -!- ronnyy [~quassel@2001:6f8:12c6:1c86:224:1dff:fed7:9541] has joined
#go-nuts
07:43 -!- awidegreen [~quassel@p5DF1E2C3.dip.t-dialin.net] has joined #go-nuts
07:43 < uriel> defer is great
07:58 -!- unhygienix [~unhygieni@host86-135-185-97.range86-135.btcentralplus.com]
has quit [Quit: unhygienix]
07:59 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
08:00 -!- tensorpudding [~user@99.148.202.191] has quit [Remote host closed the
connection]
08:15 < nsf> http://pastie.org/1274411
08:15 < nsf> I like this stuff in Go :)
08:21 -!- SirPsychoS [~sp@c-24-13-132-255.hsd1.il.comcast.net] has quit [Ping
timeout: 272 seconds]
08:21 < nsf> i mean seriously, io.Writer and io.Reader rocks, no stream
bullshit (hello STL, hello .NET)
08:23 -!- Fish [~Fish@86.65.182.207] has joined #go-nuts
08:25 < Rennex> that is very little work to unpack a gzip, but loads of work
(verbose typing) to open the i/o handles :P
08:26 < nsf> agreed, we should have good old fopen stuff
08:26 < nsf> which represents buffered file handle
08:27 < nsf> because this is the most common thing everyone wants
08:27 < nsf> and all that "w" "r" "a" stuff is very familiar
08:29 < nsf> btw, the snippet above misses "Flush"
08:29 < nsf> :\
08:29 < nsf> I forget to add it third time this day :\
08:32 -!- ExtraSpice [~XtraSpice@88.118.33.48] has joined #go-nuts
08:33 -!- Mantis[] [bryan_c1_@76.14.59.168] has joined #go-nuts
08:33 -!- Mantis[] [bryan_c1_@76.14.59.168] has left #go-nuts []
08:37 -!- glsubri [~glsubri@144.85.121.224] has joined #go-nuts
08:37 < glsubri> hello all
08:38 < glsubri> does smbdy knows why my program doesn't show anything after
compilation (without error) ?
08:39 -!- glsubri [~glsubri@144.85.121.224] has quit [Client Quit]
08:40 < nsf> :\
08:41 * TheSeeker asks his magic 8 ball.
08:43 < uriel> wow, the trolling in golang-nuts has got a bit out of hand
08:44 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has quit [Quit: WeeChat
0.3.2]
08:45 < nsf> it is boring if no one trolls
08:45 < nsf> :)
08:47 < nsf> func panicIf(err os.Error) { if err != nil { panic(err.String)
} }
08:47 < nsf> :P
08:47 < nsf> oops
08:47 < nsf> func panicIf(err os.Error) { if err != nil {
panic(err.String()) } }
08:47 < nsf> here we go
08:48 < nsf> looks nice in the code: panicIf(err)
08:48 < nsf> :P
08:48 -!- wrtp [~rog@92.16.112.146] has joined #go-nuts
08:49 < TheSeeker> not PanicIf(err) ?
08:49 < nsf> well, it's local
08:49 < nsf> why bother exporting it?
08:51 < nsf> actually it's ok to write: panic(err)
08:51 < nsf> I should remember that
08:53 < TheSeeker> Is there really any time you want to close a file handle
without flushing it first?
08:53 -!- Thomas1|2 [~kvirc@188-23-8-178.adsl.highway.telekom.at] has joined
#go-nuts
08:53 < nsf> it's not the file handle that flushes, it's the bufio.Buffer
08:53 < nsf> and it doesn't have Close
08:53 < nsf> oops
08:53 < nsf> i mean bufio.Writer
08:54 < nsf> file handle doesn't have Flush as well
08:54 < nsf> because it's not buffered
08:54 < nsf> but I agree
08:54 < nsf> there should be a BufferedFile type
08:54 < nsf> that has Close and is buffered
08:55 < nsf> which calls Flush before Close :)
08:55 < TheSeeker> yeah, that seems like a pretty common use case for files.
08:55 -!- zot [546c0cce@gateway/web/freenode/ip.84.108.12.206] has joined #go-nuts
08:56 < zot> anyone here?
08:56 < nsf> nope
08:56 -!- Thomas1 [~kvirc@188-23-2-10.adsl.highway.telekom.at] has quit [Ping
timeout: 265 seconds]
08:56 < zot> clever
08:56 < nsf> as the question
08:57 < zot> cheaper than waiting for a spontaneous clever remark
08:57 < TheSeeker> "Is it OK if I ask a question in here?"
08:57 < zot> I registered a project on the projects dashboard and I must
have entered the wrong URL
08:57 < zot> anyone know who I can talk to about that?  I didn't see an
email address for a maintainer or anything
08:57 -!- sahid [~sahid@LNeuilly-152-21-22-10.w193-253.abo.wanadoo.fr] has joined
#go-nuts
08:57 -!- awidegreen_ [~quassel@p5DF1E32F.dip.t-dialin.net] has joined #go-nuts
08:59 < TheSeeker> what was the package?
08:59 -!- awidegreen [~quassel@p5DF1E2C3.dip.t-dialin.net] has quit [Ping timeout:
245 seconds]
08:59 < zot> go-fltk
09:00 < nsf> don't know how about others, but I never look for packages on
that page
09:00 < nsf> go-lang.cat-v.org is better
09:01 < nsf> and uriel maintains it
09:01 < zot> pretty sure I sent Uriel info already
09:01 < nsf> good :)
09:01 < zot> it's not on the page yet, though
09:01 < nsf> it will be :)
09:02 < TheSeeker> hmm, I see go-fltk - FLTK2 GUI toolkit bindings for Go li
09:02 < TheSeeker> but it links to http://godashboard.appspot.com/gui
09:02 < zot> yeah, but the URL is wrong
09:03 < zot> I'm doing this for an Acme-like tool I'm writing in Go
09:03 < zot> I like to reinvent wheels, I guess, but the Oberon UI still
hasn't gotten the use it deserves
09:06 -!- photron [~photron@port-92-201-240-76.dynamic.qsc.de] has joined #go-nuts
09:11 -!- mbohun [~mbohun@ppp115-156.static.internode.on.net] has joined #go-nuts
09:12 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has joined #go-nuts
09:13 -!- mikespook [~mikespook@219.137.75.81] has quit [Quit: Leaving.]
09:20 -!- itrekkie [~itrekkie@ip72-211-128-9.tc.ph.cox.net] has joined #go-nuts
09:21 -!- itrekkie [~itrekkie@ip72-211-128-9.tc.ph.cox.net] has quit [Client Quit]
09:41 -!- zot [546c0cce@gateway/web/freenode/ip.84.108.12.206] has quit [Quit:
Page closed]
09:48 < wrtp> nsf, TheSeeker: making your own BufferedFile type is quite
easy: http://pastie.org/1274504
09:49 < wrtp> although it's arguable that bufio.Writer could implement Close
and dynamically check the type of its argument to see if it implements Closer, and
call that if so
09:51 < nsf> it is easy
09:51 < nsf> but I don't like your implementation :)
09:52 < wrtp> what don't you like about it?
09:53 < nsf> oh..
09:53 < nsf> it should really combine bufio.Writer/Reader and os.File
interfaces
09:53 < wrtp> why?
09:53 < nsf> because that's what you get if you wrap os.File with
bufio.Writer/Reader
09:54 < wrtp> the way i've done it, it works on anything that wraps a Writer
but doesn't have a close method.
09:55 < nsf> but the interface!
09:55 < nsf> who needs just "Write"
09:55 < nsf> it should be the same as bufio.  stuff + Close
09:56 < nsf> especially if we're making a reader
09:56 < wrtp> ah yeah, good point :-)
09:56 < nsf> because bufio.Reader has things like ReadString
09:56 < nsf> we can't just throw them away
09:56 < wrtp> agreed
09:58 < wrtp> perhaps bufio could get a new function NewWriteCloser(rc
io.WriteCloser) *Writer
09:59 < nsf> I don't know, maybe
09:59 < wrtp> no dynamic type checking required.
09:59 < nsf> but I think it's more reasonable to have something like:
09:59 < nsf> func NewBufferedFileWriter(name string, mode string)
*BufferedFileWriter
09:59 < nsf> looks a bit long
10:00 < nsf> but that's what people will use most of the time
10:00 < wrtp> but what if you want it to work on a network connection?
10:00 < nsf> :)
10:00 < nsf> I don't
10:01 < nsf> network code shouldn't be that simple
10:01 < wrtp> the problem is that bufio doesn't know about close, not that
os.File doesn't know about buffering :-)
10:01 -!- niemeyer [~niemeyer@189-72-21-191.pltce701.dsl.brasiltelecom.net.br] has
joined #go-nuts
10:02 < nsf> I mean it's just a very common combination
10:02 < nsf> file + bufio
10:02 < nsf> reader or writer
10:03 < nsf> C's API actually buffers stdio/stdout/stderr as well
10:03 < nsf> afaik
10:03 < wrtp> sure, but there's no bufio.Open function...
10:04 < nsf> well, I've noticed that
10:04 < nsf> I guess we just need a new entity
10:04 < nsf> bufio.File
10:04 < wrtp> i don't think so
10:04 < nsf> well, ok then
10:04 < wrtp> there's no need for bufio to depend on os.File
10:05 < wrtp> it's more general than that.
10:06 -!- TheSeeker [~n@99-153-250-110.lightspeed.irvnca.sbcglobal.net] has quit
[Ping timeout: 240 seconds]
10:11 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has quit [Ping
timeout: 245 seconds]
10:14 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has joined #go-nuts
10:21 -!- boscop [~boscop@f055011212.adsl.alicedsl.de] has joined #go-nuts
10:22 -!- boscop_ [~boscop@f055159129.adsl.alicedsl.de] has quit [Ping timeout:
252 seconds]
10:30 < wrtp> nsf: how about this: http://codereview.appspot.com/2916042
10:31 < nsf> I don't know
10:31 < nsf> I'm not good at API design
10:31 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has quit [Ping
timeout: 245 seconds]
10:31 < nsf> and I don't like generic stuff
10:32 < nsf> I was talking about commonly used specific combination
10:32 < nsf> it is a buffered file I/O (file in terms of os package)
10:33 -!- wrtp [~rog@92.16.112.146] has quit [Read error: Operation timed out]
10:36 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has joined #go-nuts
10:40 -!- wrtp [~rog@92.16.112.146] has joined #go-nuts
10:46 < wrtp> you can then use it like: b :=
bufio.NewWriteCloser(os.Stdout); b.Write([]byte("hello, world\n"); b.Close()
10:46 < nsf> why do I want to close os.Stdout?  :)
10:47 < nsf> the complaint was about very specific part of Go
10:47 < nsf> os.Open..  and os.File
10:48 < nsf> I'm sure most people don't even know that they should wrap
os.File in bufio.Reader or Writer
10:48 < nsf> and openning file with os.O_CREATE | os.O_TRUNC | os.O_WRONLY
isn't the most intuitive thing either
10:49 < nsf> I'm not saying that os.File should be removed, it would be nice
to have a wrapper which exists in most programming languages
10:49 < nsf> aka fopen("file.txt", "r")
10:49 < nsf> that's just a very common use case
10:50 < nsf> but I'm not sure about the idea of having generic version of
that in bufio
10:50 < nsf> like you've proposed
10:54 -!- wrtp [~rog@92.16.112.146] has quit [Read error: Connection reset by
peer]
10:54 -!- fabled [~fabled@mail.fi.jw.org] has quit [Quit: Ex-Chat]
10:54 -!- wrtp [~rog@92.16.112.146] has joined #go-nuts
11:21 -!- napsy [~luka@88.200.89.13] has joined #go-nuts
11:22 -!- napsy [~luka@88.200.89.13] has quit [Client Quit]
11:23 < yiyus> nsf: http://pastebin.com/V0CULJWt
11:24 < nsf> I know that it's easy
11:24 < nsf> add wrapper for bufio.Writer/Reader and you're done
11:25 < yiyus> I just had that around, but I was not really using it
11:26 < wrtp> yiyus: that code would be better if the map wasn't created
each time the function was called (just use a global)
11:27 < nsf> actually the map here is not required at all
11:27 < nsf>
http://www.koders.com/c/fid4AC8E5A6CAFCF1D081122F3CA5866F8ADCA5D1C4.aspx
11:27 < nsf> the fopen logic is quite straightforward
11:27 < wrtp> depends if you think that "r+" is more convenient
11:28 < wrtp> i quite like the simplicity of the map code.  (if you wanna
deal with stdio-like descriptors)
11:29 -!- devrim [~Adium@cpe-72-225-239-227.nyc.res.rr.com] has joined #go-nuts
11:29 < wrtp> (i don't)
11:29 < yiyus> wrtp: true, but as I said I'm not using that code
11:29 < wrtp> sure
11:30 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has quit [Quit: WeeChat
0.3.2]
11:39 < wrtp> nsf: http://pastebin.com/aaVCuwZN
11:40 < nsf> well, yeah, something like that
11:41 < nsf> but ReadWriter isn't Closer isn't it?
11:41 < nsf> :D
11:48 < nsf> http://pastie.org/1274667
11:48 < nsf> my version
11:48 < nsf> and vision
11:59 < wrtp> nsf: ReadWriter is Closer if my patch was applied.
11:59 < nsf> if
11:59 < wrtp> sure
11:59 < nsf> as I've said
11:59 < nsf> I'm not sure about that generic proposal
12:00 < nsf> for adding Closer stuff into bufio
12:00 < wrtp> did you have a look at the CL?
12:00 < nsf> I took a glance
12:01 < nsf> well, currently bufio has 5 functions
12:01 < nsf> and you're adding more
12:01 < nsf> and more types
12:01 < nsf> or wait
12:01 < nsf> there were no new types :)
12:02 < nsf> but new functions for sure
12:02 < wrtp> yup, 4 more functions.
12:02 < wrtp> but not heavyweight.
12:02 < nsf> still, I like my version
12:03 < wrtp> your version is fine if you only care about os.File
12:03 < nsf> that's what I care about :)
12:03 < nsf> and trying to tell you that few hours
12:04 < nsf> common use case: file handle + buffer == buffered file I/O
12:04 < wrtp> yeah, but other people might care about, for instance, having
the same functionality on top of io.PipeWriter
12:04 < wrtp> and my code caters fine for that (and your own scenario) but
yours does not.
12:04 < nsf> few other people, but most people want FOpen :) (I don't know
for sure, but I'm pretty convinced about that fact)
12:05 < nsf> the tricky part is that if you really want to use ReadWriter as
Closer as well, you can do that as I did it now for BufferedFile
12:06 < nsf> but what's important here is common use cases, what _most_
people would like to see in the lib
12:06 < wrtp> that works with my stuff too.
12:06 < wrtp> generality is also important, particularly if it comes at low
cost.
12:06 < nsf> like how should I read a file line by line: FOpen +
ReadString..  done
12:07 < nsf> ok, I see your point, but I don't like your patch and nothing
will convince me that it's good
12:07 < nsf> :D
12:07 < nsf> maybe it's good that I'm not the person who decides what gets
in and what's not
12:07 < nsf> :)
12:07 -!- XenoPhoenix [~Xeno@cpc5-aztw24-2-0-cust39.aztw.cable.virginmedia.com]
has quit [Remote host closed the connection]
12:08 < wrtp> i still don't see what you don't like about it.
12:08 < wrtp> combining os.Open and bufio is a different thing from
combining Close with bufio.
12:08 < nsf> I'm bad at explaining things and here it is possible that I'm
wrong
12:08 < wrtp> i reckon.
12:09 < nsf> so..  we'll see
12:09 < nsf> maybe Go guys will tell something about it
12:09 < wrtp> yeah, we'll see what they think.
12:11 -!- XenoPhoenix [~Xeno@cpc5-aztw24-2-0-cust39.aztw.cable.virginmedia.com]
has joined #go-nuts
12:20 -!- wrtp [~rog@92.16.112.146] has quit [Ping timeout: 240 seconds]
12:25 -!- wrtp [~rog@92.16.112.146] has joined #go-nuts
12:26 -!- artefon [~thiago@189.26.237.181.dynamic.adsl.gvt.net.br] has joined
#go-nuts
12:27 -!- napsy [~luka@193.2.72.254] has joined #go-nuts
12:33 -!- DerHorst [~Horst@e176106047.adsl.alicedsl.de] has joined #go-nuts
12:40 -!- fabled [~fabled@mail.fi.jw.org] has joined #go-nuts
12:41 -!- bjarneh [~bjarneh@1x-193-157-199-167.uio.no] has quit [Ping timeout: 255
seconds]
12:42 -!- DerHorst [~Horst@e176106047.adsl.alicedsl.de] has quit [Remote host
closed the connection]
12:44 -!- napsy [~luka@193.2.72.254] has quit [Quit: leaving]
12:44 -!- napsy [~luka@193.2.72.254] has joined #go-nuts
12:44 -!- napsy [~luka@193.2.72.254] has quit [Client Quit]
12:56 -!- femtoo [~femto@95-89-197-196-dynip.superkabel.de] has joined #go-nuts
12:58 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.3]
13:03 -!- mpl [~mpl@213.251.175.204] has quit [Ping timeout: 240 seconds]
13:04 -!- mpl [~mpl@smgl.fr.eu.org] has joined #go-nuts
13:12 -!- cmarcelo [~cmarcelo@186.212.113.34] has joined #go-nuts
13:12 -!- cmarcelo [~cmarcelo@186.212.113.34] has quit [Changing host]
13:12 -!- cmarcelo [~cmarcelo@enlightenment/developer/cmarcelo] has joined
#go-nuts
13:20 -!- kanru [~kanru@61-228-159-162.dynamic.hinet.net] has joined #go-nuts
13:25 -!- lmoura [~lauromour@186.212.109.42] has joined #go-nuts
13:26 -!- GutenLinux [~chatzilla@115.194.235.143] has joined #go-nuts
13:26 -!- artefon [~thiago@189.26.237.181.dynamic.adsl.gvt.net.br] has quit [Quit:
bye]
13:30 -!- iant [~iant@216.239.45.130] has quit [Ping timeout: 240 seconds]
13:34 -!- MaksimBurnin [~max@44.188-224-87.telenet.ru] has quit [Ping timeout: 245
seconds]
13:35 -!- Tv [~tv@cpe-76-168-227-45.socal.res.rr.com] has joined #go-nuts
13:40 -!- skejoe [~skejoe@188.114.142.231] has joined #go-nuts
13:44 -!- GutenLinux [~chatzilla@115.194.235.143] has quit [Quit: ChatZilla 0.9.86
[Firefox 3.6.12/20101027204347]]
13:44 -!- iant [~iant@67.218.104.238] has joined #go-nuts
13:44 -!- mode/#go-nuts [+v iant] by ChanServ
13:46 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has quit [Read
error: Connection reset by peer]
13:49 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has joined #go-nuts
13:53 -!- Innominate [~sirrobin@cpe-076-182-074-143.nc.res.rr.com] has quit [Ping
timeout: 250 seconds]
13:53 -!- Innominate [~sirrobin@cpe-076-182-074-143.nc.res.rr.com] has joined
#go-nuts
13:57 -!- dj2 [~dj2@216.16.242.254] has joined #go-nuts
13:58 -!- liron [~liron@guest-fw.dc4.itasoftware.com] has joined #go-nuts
13:58 -!- liron [~liron@guest-fw.dc4.itasoftware.com] has quit [Remote host closed
the connection]
13:58 -!- liron [~liron@ita4fw1.itasoftware.com] has joined #go-nuts
14:00 -!- rickard8 [~rickard@netra.esec.du.se] has quit [Ping timeout: 272
seconds]
14:02 -!- sauerbraten [~sauerbrat@p508CFB05.dip.t-dialin.net] has joined #go-nuts
14:02 -!- iomox [~ios@180.191.93.163] has quit [Quit: Leaving]
14:04 < plexdev> http://is.gd/gKt3f by [Adam Langley] in
go/src/pkg/crypto/tls/ -- crypto/tls: use pool building for certificate checking
14:10 -!- zozoR [~zozoR@5634798d.rev.stofanet.dk] has joined #go-nuts
14:12 -!- Innominate [~sirrobin@cpe-076-182-074-143.nc.res.rr.com] has quit [Ping
timeout: 245 seconds]
14:17 -!- adu [~ajr@pool-74-96-89-94.washdc.fios.verizon.net] has joined #go-nuts
14:20 -!- Innominate [~sirrobin@cpe-076-182-074-143.nc.res.rr.com] has joined
#go-nuts
14:20 -!- skelterjohn [~jasmuth@lawn-gw.rutgers.edu] has joined #go-nuts
14:23 -!- ucasano [~ucasano@host69-192-static.38-79-b.business.telecomitalia.it]
has joined #go-nuts
14:24 < sauerbraten> what's the easiest way to append something to a string?
14:25 < skelterjohn> strings are constant, so you can only create a new
string
14:25 < skelterjohn> s3 := s1 + s2
14:25 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
14:26 < sauerbraten> oh -.- and I looked at strings.Join and such things :D
yes that should be easy, thank you skelterjohn :)
14:27 < skelterjohn> my pleasure
14:27 < sauerbraten> what about s1 = s1 + s2?
14:27 < sauerbraten> will it work?
14:27 < skelterjohn> yes
14:27 < sauerbraten> k
14:27 < skelterjohn> when i said strings are constant, i meant what they
point to is constant
14:28 < skelterjohn> the string type is really a reference to something
constant, i think.
14:29 < wrtp> that's only an implementation detail.  integers have similar
semantics...
14:29 < skelterjohn> so passing a string to another function doesn't involve
a copy of bytes
14:29 < wrtp> that's certainly useful to know however...
14:29 < skelterjohn> right - behaves the same either way, but it's good to
know if you want to be efficient
14:30 < exch> s1 += s2 used to be very slow, cos it allocates a new string
everytime you concatenate 2 strings.  Not sure if that is still the case.  Using a
bytes.Buffer to write stringdata into is faster
14:31 < skelterjohn> i think using bytes.Buffer will be naturally faster -
since you can write into the buffer (which means it can overallocate without
wasting the extra bits)
14:32 < exch> For a couple of string cats here and there it wont matter
much, but if you are doing some kind of intensive string parsing code, I really
recommend working with byte buffers
14:32 < skelterjohn> right
14:32 < Tv> afaik the bestest way is to first compute the final length,
preallocate exact right amount, and then sum everything together once; but really,
you will most likely not be able to measure the difference in the final product
14:32 -!- prip [~foo@host243-124-dynamic.35-79-r.retail.telecomitalia.it] has quit
[Ping timeout: 240 seconds]
14:32 < sauerbraten> why does length := 20
14:32 < sauerbraten> key := "0"
14:32 < sauerbraten> for z0 := 0; z0 < length; z0++ {
14:32 < sauerbraten> key = key + strconv.Itoa(rand.Intn(2))
14:32 < sauerbraten> } create me the same key over and over again?  Is there
a better method to get random numbers?
14:32 < skelterjohn> Tv: certainly that is the most efficient, but the
allocation strategy that bytes.Buffer uses is very good
14:33 < skelterjohn> sauerbraten: seed your generator
14:33 < skelterjohn> rand.Seed(time.Nanoseconds())
14:33 < skelterjohn> i feel like i've had this conversation before...  with
you!
14:33 < sauerbraten> oh ok
14:33 < Tv> or just read from /dev/urandom, for actual good randomness..
14:33 < sauerbraten> no you didn't :/
14:33 < skelterjohn> ok :) my mistake
14:34 < sauerbraten> Tv: interesting :-)
14:34 < skelterjohn> Tv: platform specific
14:34 < Tv> skelterjohn: and i'm happy with that ;)
14:34 -!- ct529 [~quassel@77-44-78-159.xdsl.murphx.net] has joined #go-nuts
14:36 < sauerbraten> I'm happy with that platform, too, but I did
time.Nanoseconds() :P
14:37 < skelterjohn> the wiki for /dev/random claims it's a true random
number generator
14:37 < skelterjohn> which i'm finding hard to swallow
14:38 < skelterjohn> though i will continue reading
14:38 <+iant> what would count as a true random generator in your opinion?
14:38 < Tv> skelterjohn: one does not generate true random numbers, one
gathers entropy; that's what it does
14:38 <+iant> /dev/random is certainly unpredictable
14:39 -!- tvw [~tv@212.79.9.150] has joined #go-nuts
14:39 < Tv> you can debate on whether its estimates on the amount of entropy
are correct
14:39 < Thomas1|2> :D
14:39 < Tv> but they are fairly conservative, i understand
14:40 < Tv> SSDs might make it less nice, i think it used the
unpredictability of the mechanical movement of hard drives as one source
14:40 < skelterjohn> iant, Tv: it's not that i have a good understanding of
"true random", i've just been under the impression that computers couldn't really
do that
14:40 < Tv> skelterjohn: it's gathering real world events
14:40 < skelterjohn> yes, i see that
14:40 <+iant> pure software can't generate random numbers because it is
perfectly predictable
14:41 < exch> What's really going to bake your noodle is whether or not true
randomness actually exists at all; In a computer or outside of it.  Some people
will have you believe that even the universe itself is never truly random :p
14:41 <+iant> /dev/random uses a different approach, involving hardware in
the mix
14:41 -!- Fish [~Fish@86.65.182.207] has quit [Remote host closed the connection]
14:41 <+iant> thus the arguments saying that computers can not generate
randomness do not hold for /dev/random
14:41 < Tv> exch: well, chaos theory is good enough for most of us
14:41 < Tv> exch: gathering entropy is just outsourcing your PRNG to reality
14:41 < exch> hehe
14:41 < skelterjohn> chaos theory, i've heard, is not all it's cracked up to
be
14:41 <+iant> exch: really it depends on your definition of "random"
14:41 < Tv> big bang was PRNG seeding ;)
14:41 < wrtp> you *might* be able to get some randomness by duelling clocks,
as long as GOMAXPROC > 1
14:42 < wrtp> without using /dev/random
14:42 <+iant> you can get hung up on "random" the same way you can get hung
up on "free will"
14:42 < skelterjohn> well, there is a difference between "random" and
"nondeterministic"
14:42 < exch> yup
14:42 <+iant> but all that really matters is whether you can be reliably
predicted or not
14:42 <+iant> that is, predicted by a real world entity, rather than an
omniscient being
14:42 < Tv> "stochastic", then
14:43 < Tv> iant: even more importantly, predicted by your attackers
14:43 < Tv> i'm fairly ok with aliens being able to abduct me & decrypt my
hard drive
14:43 <+iant> your real-world attackers, rather than, say, Satan
14:44 -!- ronnyy [~quassel@2001:6f8:12c6:1c86:224:1dff:fed7:9541] has quit [Remote
host closed the connection]
14:45 -!- prip [~foo@host243-124-dynamic.35-79-r.retail.telecomitalia.it] has
joined #go-nuts
14:45 < sauerbraten> from wiki's one-time pad article: "Even those
generators that are suitable for normal cryptographic use, including /dev/random
and many hardware random number generators, make some use of cryptographic
functions whose security is unproven."
14:46 < Tv> oh sure you could attack the algos
14:46 < Tv> but that's a *yawn*, just not quite that likely to work outside
the lab
14:46 < Tv> it's enough to push it to be far from the easiest avenue of
attack
14:47 -!- bortzmeyer [~bortzmeye@batilda.nic.fr] has quit [Quit: Leaving.]
14:47 < Tv> real solution is to get more modern cpus to include entropy
generators on die
14:52 < skelterjohn> you cannot attack the one-time-pad algorithm
14:52 < Tv> sure you can
14:53 < skelterjohn> if you have a truly random pad, then it cannot be
broken
14:53 < skelterjohn> there is simply no information there without the pad
14:53 < Tv> ah but real attacks reside in the real world
14:53 < skelterjohn> we're talking about the algorithm?
14:53 < Tv> and the attacks have included e.g.  realizing that the pad was
reused
14:53 < skelterjohn> the algorithm says to never re-use a pad
14:54 < Tv> and you attack the implementation
14:54 < Namegduf> An attack on an implementation is not an attack on an
algorithm
14:54 < skelterjohn> my point was, there are cryptography algorithms that
are perfect
14:54 < skelterjohn> even if they cannot be put into use perfectly
14:54 < Tv> your point is unrelated to the real world ;)
14:54 < skelterjohn> so?
14:54 < Namegduf> I think what you mean is that there are attack avenues
outside the algorithm.
14:55 < skelterjohn> if /dev/random is a "true random number generator",
then using it w/ one-time-pad is unbeatable
14:55 < Tv> what i mean is there's academical "attacks" and there's actual
"attacks"; academical ones are a tiny, tiny subset of the real ones, and most
often the hardest ones; no sane attacker is going for those
14:56 < Namegduf> It's a false division.
14:56 < sauerbraten> which package should I use to convert a string into a
binary string, something like: "asd" to "110000111100111100100" this would use the
7-bit ascii table, I don't mind if it uses 8bit strings
14:56 < Tv> if you focus on pure academic attacks, you screw up real world
security, bad
14:56 < Namegduf> Sure, if you're building a real world system.
14:56 < Tv> i'd argue if it's not in the real world, you're not building ;)
14:56 < Namegduf> If you're just implementing cryptographic algorithms for
people building a real world system to later use
14:56 < sauerbraten> actually, a one-time pad is exactly what I'm trying to
implement at the moment :)
14:57 < skelterjohn> heh, neat
14:57 < skelterjohn> sauerbraten: i don't know of a package that does it
14:57 < Namegduf> Then focusing on the algoritihm's reliability and security
is important.
14:57 -!- Venom_X [~pjacobs@adsl-99-20-147-171.dsl.aus2tx.sbcglobal.net] has
joined #go-nuts
14:57 < skelterjohn> you can certainly write a charToBinaryString function
easily enough
14:57 < Tv> Namegduf: even more so, ease of using it correctly, etc
14:57 < Namegduf> It is a false division, though.  You can analyse a larger
system the same way you analyse an algorithm.
14:58 < sauerbraten> skelterjohn, how?  create a map of the whole ascii
table and then search the char in it and return the bitstring?
14:59 < skelterjohn> no - ""+((char<<7) % 2)+((char<<6) % 2) etc
14:59 < skelterjohn> (char << 7) % 2 will get the eigth bit
14:59 < skelterjohn> eighth bit
14:59 < skelterjohn> either that or (char >> 7) % 2
15:00 < sauerbraten> uhuuh...  mhmm I'll try to understand that first :P
what is << doing?  I never used it
15:00 < skelterjohn> or better might be (char | 1 << n) != 0
15:00 < skelterjohn> for the nth bit
15:00 < skelterjohn> << is the shift operator
15:00 < sauerbraten> I'll look it up
15:00 < skelterjohn> it shifts all the bits over by one
15:00 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
15:00 < skelterjohn> x << b is equivalent to x * 2^b
15:00 -!- Innominate [~sirrobin@cpe-076-182-074-143.nc.res.rr.com] has quit [Ping
timeout: 250 seconds]
15:01 -!- Innominate [~sirrobin@cpe-076-182-074-143.nc.res.rr.com] has joined
#go-nuts
15:02 -!- iant [~iant@67.218.104.238] has quit [Ping timeout: 272 seconds]
15:04 -!- tumdum [~tumdum@aty62.neoplus.adsl.tpnet.pl] has joined #go-nuts
15:04 -!- tumdum [~tumdum@aty62.neoplus.adsl.tpnet.pl] has quit [Changing host]
15:04 -!- tumdum [~tumdum@unaffiliated/tumdum] has joined #go-nuts
15:08 < sauerbraten> skelterjohn, what does (char | 1 << n) return?  I
don't get the english explanation in the docs for all the operators :/
15:08 < skelterjohn> let's say you want the 5th bit
15:08 < skelterjohn> 1 << 5 -> 10000
15:08 < skelterjohn> in binary, not decimal
15:09 < Tv> 1<<5 == b10000
15:10 < skelterjohn> when you do char | b10000, it does a bitwise or between
char and the binary number
15:10 -!- iant [~iant@nat/google/x-bsgclhzflyrbeiqh] has joined #go-nuts
15:10 -!- mode/#go-nuts [+v iant] by ChanServ
15:10 < skelterjohn> so for instance, b1234567 | b10000 -> b30000
15:10 < skelterjohn> err, that was nonsense
15:10 < skelterjohn> b101010101 | b10000 -> b10000
15:10 < Tv> "b3" is fairly confusing ;)
15:10 < skelterjohn> if what you get from the bitwise or is not zero, it
means that bit was set in your original number
15:11 < skelterjohn> if that bit was set, it means it's a "1" in your binary
string
15:11 < skelterjohn> otherwise, "0"
15:11 -!- Fish [~Fish@9fans.fr] has joined #go-nuts
15:16 < skelterjohn> sauerbraten: make sense?
15:17 < sauerbraten> yes a bit :-)
15:17 < sauerbraten> I know how I convert decimal numbers into binary
strings by hand, your method is a bit too compressed for my brain :D but I think
I'm getting it :)
15:17 < skelterjohn> if you don't mind me asking, what stage are you in
education?  a lot of universities don't teach C anymore, and as a result people
miss out on this kind of thing
15:18 < Thomas1|2> :p
15:19 < sauerbraten> I'm in 12th class in german gymnasium, making abitur in
2 years which is like the A-levels in USA or GB, one of them, I forgot which one
has the A-levels.  :-) and in school we only learn Java atm, but we will learn
about microcontrollers, too
15:19 < skelterjohn> GB
15:19 < sauerbraten> ok GB then
15:19 < skelterjohn> i don't know what an A-level is besides the fact that
they have them in GB :)
15:20 < MaybeSo> skelterjohn:
http://store.aqa.org.uk/qual/gce/pdf/WITHDRAWAL_OF_COMP1.PDF
15:20 < photron> skelterjohn: in a university lecture about java (i attended
like 6 years ago) they covered basic bit manipulation stuff :)
15:21 < Namegduf> A-Level == End-of-highschool at 18 qualification, also
available from colleges.
15:21 < sauerbraten> :D It's the highest gradiuation you can get in school,
after that you have to study to get more :P
15:21 < Namegduf> You don't have to go on to get them, and they're the main
qualification for getting into university from a high school.
15:21 < MaybeSo> oh, and:
http://www.stsc.hill.af.mil/CrossTalk/2008/01/0801DewarSchonberg.html
15:21 < Namegduf> In GB.
15:22 < skelterjohn> here at rutgers (where i am a grad student), we have
recently added a course on straight C programming to the requirements list
15:22 < sauerbraten> rutgers university camden?
15:22 < skelterjohn> new brunswick
15:23 < photron> skelterjohn: i think thats a good idea
15:24 < sauerbraten> skelterjohn, coming back to your explanation of
<<, b1000 would be a decimal 8?
15:25 < skelterjohn> yes
15:25 < sauerbraten> ok
15:26 < sauerbraten> by hand, I would take the decmial value of the
characters and then try out wether 128 fits into it, when yes, save a 1 for that,
subtract 128 of the char's value and go on with 64 etc.
15:26 < liron> skelterjohn: out of curiosity what does the class actually
cover?
15:26 < sauerbraten> *if, not when
15:27 < skelterjohn> liron: i haven't taken it, but i assume competence with
linux+gcc+writing c code to do basic things that they learn in the algorithms/data
structures course
15:27 < skelterjohn> sauerbraten: yeah, more or less
15:27 < sauerbraten> why less?
15:28 < sauerbraten> isn't it done like that?  o.O
15:28 -!- SirPsychoS [~sp@c-24-13-132-255.hsd1.il.comcast.net] has joined #go-nuts
15:28 < skelterjohn> well, you don't have to subtract the 128
15:29 < skelterjohn> "c | (1 << n) != 0" will be true if the nth bit
is set in c
15:29 < skelterjohn> c | (1 << (n-1)), maybe
15:29 < skelterjohn> depending if you start at 1 or 0
15:30 < sauerbraten> oh right...  but then I would need to have the
bytestring of the char already, wouldn't I?
15:30 -!- pocket_ [~pocket_@p4252-ipbf3210hodogaya.kanagawa.ocn.ne.jp] has joined
#go-nuts
15:30 < sauerbraten> cause c == b1010100 for example
15:30 < skelterjohn> i think i'm doing something wrong, actually
15:31 < skelterjohn> 64 | 32 -> 96?
15:31 < skelterjohn> that's what the go playground is telling me
15:31 < skelterjohn> is | not bitwise or?
15:31 < skelterjohn> oooh duh
15:31 < skelterjohn> i need bitwise and
15:31 < skelterjohn> whenever i said "|" i meant "&"
15:31 < sauerbraten> if I can bitwise compare a char with something else,
then go already knows the bytesring of that char, right?
15:32 < sauerbraten> ok that makes a bit more sense with & :)
15:32 < skelterjohn> i think the == operator does a bitwise compare, yeah
15:33 < skelterjohn> yeah - sorry for that mental meltdown
15:33 < skelterjohn> i'm surprised no one here noticed and made fun of me
15:33 < sauerbraten> but still, go already knows my bytestring, doesn't it
15:33 < skelterjohn> not in string form
15:33 < skelterjohn> it knows the bytes because...these data structures are
bytes
15:33 < skelterjohn> any other interpretation is purely for your convenience
15:34 < sauerbraten> but it can compare bitwise?  o.O
15:34 < skelterjohn> how else could it compare?  :)
15:34 < skelterjohn> it's a computer
15:35 < sauerbraten> but then it HAS to know if the bit is set or not :-/
15:35 < skelterjohn> what is your goal, here?
15:35 < skelterjohn> is it to encode a bunch of bits to a string?
15:35 < skelterjohn> a string of 1s and 0s, that is
15:35 -!- skejoe [~skejoe@188.114.142.231] has quit [Quit: Lost terminal]
15:36 < sauerbraten> I want to encode a string like "asd" to
"110000111100111100100"
15:36 < skelterjohn> then doing this (char & (1 << n)) is a good way
to do it
15:37 -!- TheMue [~TheMue@p5DDF5E26.dip.t-dialin.net] has joined #go-nuts
15:37 < sauerbraten> ok, though I don't get why I have to it like that while
Go already can compare bitwise, and know the bytestring of the char already :D
15:38 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Ping timeout: 240
seconds]
15:38 < skelterjohn> it's not that "go compares bitwise", although it's true
15:38 < skelterjohn> it's that CPUs compare bitwise and have instructions to
do it
15:38 < skelterjohn> and go makes use of that instruction
15:39 < skelterjohn> it also has instructions for bitwise-and, and for left
shift
15:39 < sauerbraten> oh alright I didn't know that :)
15:39 < skelterjohn> and for comparison to zero
15:39 < skelterjohn> there is no basic instruction (as far as i know) for
"is the nth bit on or off?"
15:39 < skelterjohn> so to do that operation we string a bunch of the basic
ones together
15:40 < sauerbraten> n is 0 to 7 if I only have to encode chars contained in
the standard ( 7bit) ASCII table, not in the extended one, right?
15:40 < skelterjohn> if all your chars fit into a byte, yeah
15:43 -!- artefon [~thiagon@150.164.2.20] has joined #go-nuts
15:44 -!- artefon [~thiagon@150.164.2.20] has quit [Client Quit]
15:45 < sauerbraten> (char & (1 << n)) returns 1 if the nth bit is
set, else 0?
15:46 < skelterjohn> no - you have to compare it to 0
15:46 < skelterjohn> if it is != 0, then that bit is 1
15:46 < skelterjohn> otherwise that bit is 0
15:46 < skelterjohn> for instance, 32 & (1 << 5) is 32
15:46 < skelterjohn> since 32 != 0, the fifth bit is on
15:46 < skelterjohn> but 32 & (1 << anyOtherNumber) is 0
15:47 < skelterjohn> meaning all other bits are off
15:47 -!- artefon [~thiago@dhcp58.usuarios.dcc.ufmg.br] has joined #go-nuts
15:48 < sauerbraten> ok, then 33 & (1 << 5) is also 32?  and 33 & (1
<< 1) is 1?  everything else is 0?
15:49 -!- SirPsychoS [~sp@c-24-13-132-255.hsd1.il.comcast.net] has quit [Ping
timeout: 260 seconds]
15:49 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
15:49 < skelterjohn> as long as i'm not making a mistake in what i'm telling
you, yes
15:50 -!- nickaugust [~nickaugus@li181-40.members.linode.com] has joined #go-nuts
15:50 < sauerbraten> good.  and in 1 << n, n has to be an unsigned
int, right?  since I'm doing that in a loop with a counter z1 of type int, how do
I convert it to uint?
15:52 < skelterjohn> uint(z1)
15:54 -!- tumdum [~tumdum@unaffiliated/tumdum] has quit [Read error: Operation
timed out]
15:54 < sauerbraten> doing: s:="asd"; what type is s[1] of?  uint?
15:54 -!- gnuvince1 [~vince@205.198-ppp.3menatwork.com] has joined #go-nuts
15:54 < skelterjohn> byte
15:54 < sauerbraten> ok
15:55 -!- gnuvince_ [~vince@64.235.204.88] has quit [Ping timeout: 240 seconds]
15:55 < skelterjohn> the compiler should tell you if you get it wrong
15:55 < skelterjohn> bbl, lunch
15:59 -!- Tv [~tv@cpe-76-168-227-45.socal.res.rr.com] has quit [Ping timeout: 240
seconds]
15:59 -!- gnuvince_ [~vince@70.35.167.208] has joined #go-nuts
16:00 -!- gnuvince1 [~vince@205.198-ppp.3menatwork.com] has quit [Ping timeout:
276 seconds]
16:00 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has quit [Ping
timeout: 245 seconds]
16:01 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
16:01 -!- kanru [~kanru@61-228-159-162.dynamic.hinet.net] has quit [Read error:
Operation timed out]
16:02 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
16:10 < sauerbraten> I have a file otp.go which is of package otp, and a
file main.go of package main.  eclipse tells me it can't import "./otp" :( If I
compile, link and run it via eclipse, console reutrns "file src/main.go was not
properly built (there is no obj for it)".  when compiling and linking by hand,
everything is alrigth O.o
16:10 < sauerbraten> any idea?
16:13 < sauerbraten> nevermind, cleaned the project, works now
16:14 -!- noktoborus_ [debian-tor@gateway/tor-sasl/noktoborus] has joined #go-nuts
16:21 < nsf> has anyone tried xgb (X11 go bindings)?
16:21 < nsf> I'm wondering what's the status of the project
16:21 < sauerbraten> what is invalid in here?  ciphertext = ciphertext +
(bytestring[z0] ^ key[z0])
16:22 -!- boscop [~boscop@f055011212.adsl.alicedsl.de] has quit [Ping timeout: 276
seconds]
16:23 -!- boscop [~boscop@f055152224.adsl.alicedsl.de] has joined #go-nuts
16:24 -!- binarypie [~binarypie@c-24-6-151-185.hsd1.ca.comcast.net] has joined
#go-nuts
16:25 < Venom_X> is the + concatenating strings?
16:25 -!- ucasano [~ucasano@host69-192-static.38-79-b.business.telecomitalia.it]
has quit [Ping timeout: 276 seconds]
16:26 -!- boscop [~boscop@f055152224.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
16:26 -!- boscop_ [~boscop@f055023125.adsl.alicedsl.de] has joined #go-nuts
16:26 < wrtp> sauerbraten: you should use += :-)
16:27 < wrtp> what error message do you get?
16:27 -!- flaguy48 [~gallard@user-0c6s350.cable.mindspring.com] has left #go-nuts
[]
16:28 -!- Tv [~tv@gige.bur.digisynd.com] has joined #go-nuts
16:28 -!- pocket_ [~pocket_@p4252-ipbf3210hodogaya.kanagawa.ocn.ne.jp] has quit
[Remote host closed the connection]
16:29 < sauerbraten> none anymore :D I forgot to convert bytestring[z0] to
an int, then I forgot to get err var of Atoi, but now everything works
16:29 -!- ucasano [~ucasano@host69-192-static.38-79-b.business.telecomitalia.it]
has joined #go-nuts
16:29 < sauerbraten> btw I was told += would be sloooow
16:31 < wrtp> a += b is exactly the same as a = a + b
16:31 < wrtp> if ciphertext is a string, i don't see how the above
expression can work, because the result of ^ is always an integer
16:35 -!- liron [~liron@ita4fw1.itasoftware.com] has quit [Quit: liron]
16:37 -!- femtoo [~femto@95-89-197-196-dynip.superkabel.de] has quit [Quit:
Leaving]
16:41 -!- tumdum [~tumdum@unaffiliated/tumdum] has joined #go-nuts
16:41 < sauerbraten> yes wrtp, I got that too, that's why I'm converting
now, works fine now :)
16:45 -!- flaguy48 [~gallard@user-0c6s350.cable.mindspring.com] has joined
#go-nuts
16:46 < sauerbraten> skelterjohn, how to do the whole thing backwards?
create a char out of it's binary encoding?
16:47 -!- liron [~liron@guest-fw.dc4.itasoftware.com] has joined #go-nuts
16:47 -!- liron [~liron@guest-fw.dc4.itasoftware.com] has quit [Remote host closed
the connection]
16:47 < skelterjohn> for b, i := range myByteString { if b == "1" { num +=
1<< i } }
16:47 < skelterjohn> or something similar
16:47 < skelterjohn> there might be some off-by-one or type errors in there
16:47 -!- liron [~liron@ita4fw1.itasoftware.com] has joined #go-nuts
16:47 -!- preflex [~preflex@unaffiliated/mauke/bot/preflex] has quit [Ping
timeout: 245 seconds]
16:48 < skelterjohn> i also might have value and index reversed
16:53 -!- Thomas1|3 [~kvirc@188-23-103-209.adsl.highway.telekom.at] has joined
#go-nuts
16:53 -!- preflex [~preflex@unaffiliated/mauke/bot/preflex] has joined #go-nuts
16:56 -!- Thomas1|2 [~kvirc@188-23-8-178.adsl.highway.telekom.at] has quit [Ping
timeout: 264 seconds]
16:57 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.3]
17:01 -!- artefon [~thiago@dhcp58.usuarios.dcc.ufmg.br] has quit [Ping timeout:
276 seconds]
17:07 -!- ct529 [~quassel@77-44-78-159.xdsl.murphx.net] has quit [Remote host
closed the connection]
17:09 -!- flaguy48 [~gallard@user-0c6s350.cable.mindspring.com] has quit [Ping
timeout: 245 seconds]
17:10 -!- binarypie [~binarypie@c-24-6-151-185.hsd1.ca.comcast.net] has quit
[Remote host closed the connection]
17:16 < sauerbraten> how to convert a byte to string?  I can't find out how
to do that :(
17:18 < wrtp> string([]byte{someByte})
17:18 < sauerbraten> thanks
17:19 -!- tumdum_ [~tumdum@auc148.neoplus.adsl.tpnet.pl] has joined #go-nuts
17:19 -!- tumdum_ [~tumdum@auc148.neoplus.adsl.tpnet.pl] has quit [Changing host]
17:19 -!- tumdum_ [~tumdum@unaffiliated/tumdum] has joined #go-nuts
17:21 -!- tumdum [~tumdum@unaffiliated/tumdum] has quit [Ping timeout: 252
seconds]
17:26 < wrtp> sauerbraten: if you're appending to a string, it makes more
sense to use []byte anyway.  then you can just use append()
17:27 < sauerbraten> mhm at least everything works now :) I'll have a look
at replacing my strings with byte arraeys
17:28 < Namegduf> You're sure that string(someByte) doesn't work?
17:28 < Namegduf> string(someInt) works, and the only difference between int
and byte is size.
17:29 < Namegduf> I guess maybe it being interpreted as a codepoint could be
bad, but that's only a problem if you're going outside the realm of ASCII
17:30 < Namegduf> And appending arbitrary bytes which aren't ASCII can
generate strings which aren't valid UTF-8.
17:32 < skelterjohn> string(someByte) works fine
17:32 < skelterjohn> even if you can get yourself into trouble by doing it
17:34 -!- sahid [~sahid@LNeuilly-152-21-22-10.w193-253.abo.wanadoo.fr] has quit
[Quit: Ex-Chat]
17:34 -!- TheMue [~TheMue@p5DDF5E26.dip.t-dialin.net] has left #go-nuts []
17:34 -!- TheMue [~TheMue@p5DDF5E26.dip.t-dialin.net] has joined #go-nuts
17:38 < plexdev> http://is.gd/gKPFs by [Rob Pike] in go/src/pkg/gob/ -- gob:
when sending an interface value, indirect down to the
17:38 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Quit: |Craig|]
17:40 -!- binarypie [~binarypie@c-24-6-151-185.hsd1.ca.comcast.net] has joined
#go-nuts
17:46 -!- tensorpudding [~user@99.148.202.191] has joined #go-nuts
17:51 -!- ShadowIce
[~pyoro@HSI-KBW-109-193-120-162.hsi7.kabel-badenwuerttemberg.de] has joined
#go-nuts
17:51 -!- ShadowIce
[~pyoro@HSI-KBW-109-193-120-162.hsi7.kabel-badenwuerttemberg.de] has quit
[Changing host]
17:51 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
17:54 -!- liron [~liron@ita4fw1.itasoftware.com] has quit [Quit: liron]
17:56 < plexdev> http://is.gd/gKRjM by [Rob Pike] in go/ -- CLA: Benny
Siegert <bsiegert@gmail.com>
17:56 < plexdev> http://is.gd/gKRjW by [Benny Siegert] in go/src/pkg/path/
-- path: add Glob
17:56 -!- liron [~liron@guest-fw.dc4.itasoftware.com] has joined #go-nuts
17:58 -!- tvw [~tv@212.79.9.150] has quit [Read error: Connection reset by peer]
18:02 -!- ville- [~ville@a107.ath.cx] has quit [Remote host closed the connection]
18:02 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-152-44.clienti.tiscali.it] has
joined #go-nuts
18:06 < wrtp> oh!  i had totally forgotten that
18:13 < plexdev> http://is.gd/gKSPY by [Evan Shaw] in go/src/cmd/6l/ -- 6l:
More SSE instruction fixes
18:13 < plexdev> http://is.gd/gKSQ4 by [Russ Cox] in
go/src/pkg/runtime/nacl/386/ -- runtime: explain nacl closure failure
18:13 < plexdev> http://is.gd/gKSQh by [Russ Cox] in go/ -- A+C: Keith
Rarick (individual CLA)
18:13 < plexdev> http://is.gd/gKSQy by [Keith Rarick] in go/src/pkg/net/ --
net: provide public access to file descriptors
18:14 -!- Fish [~Fish@9fans.fr] has quit [Remote host closed the connection]
18:14 < sauerbraten> Namegduf, yes, it said it can't convert a uint8 to
string
18:15 < Namegduf> Weird
18:15 -!- viirya [~viirya@cml506-25.csie.ntu.edu.tw] has quit [Read error:
Connection reset by peer]
18:15 < sauerbraten> but it works now :) I tested my Java implementation of
the one-time pad and measurde runtime of encoding and decoding of 2600 characters
using 8bit blocks.  result: Java nearly needs double of the time go needs :)
18:15 -!- viirya [~viirya@cml506-25.csie.ntu.edu.tw] has joined #go-nuts
18:15 -!- ville- [~ville@a107.ath.cx] has joined #go-nuts
18:16 -!- boscop [~boscop@f055023125.adsl.alicedsl.de] has quit [Quit:
OutOfTimeException: Allocation of TimeFrame failed due to lack of time.
Terminating...]
18:16 < skelterjohn> 2600 might be a bit of a small test set
18:16 < skelterjohn> java more initial overhead than go
18:16 < skelterjohn> java has
18:17 -!- Venom_X [~pjacobs@adsl-99-20-147-171.dsl.aus2tx.sbcglobal.net] has quit
[Quit: Venom_X]
18:17 -!- artefon [~thiago@189.26.237.181.dynamic.adsl.gvt.net.br] has joined
#go-nuts
18:18 -!- Fish [~Fish@9fans.fr] has joined #go-nuts
18:19 < sauerbraten> ok, I'll do it again with 2600000 characters :P
18:20 < skelterjohn> good to be thorough when making a comparison :)
18:22 < sauerbraten> yep, maybe I should even make 100 measurments and get
the average of it, but I'm too lazy to do that
18:22 -!- boscop [~boscop@f055023125.adsl.alicedsl.de] has joined #go-nuts
18:24 < cbeck> That's what scripts are for
18:24 < skelterjohn> well, there is accounting for experimental variance
(what you suggest) and trying to get comparable numbers (what i suggest)
18:24 < skelterjohn> both are important
18:27 -!- liron [~liron@guest-fw.dc4.itasoftware.com] has quit [Quit: liron]
18:31 -!- liron [~liron@guest-fw.dc4.itasoftware.com] has joined #go-nuts
18:31 < plexdev> http://is.gd/gKUOM by [Eric Clark] in go/src/cmd/gc/ -- gc:
doc nit
18:31 -!- liron [~liron@guest-fw.dc4.itasoftware.com] has quit [Remote host closed
the connection]
18:31 < plexdev> http://is.gd/gKUOV by [Rob Pike] in go/src/pkg/gob/ -- gob:
don't add "." if package path is empty when registering a type.
18:32 -!- liron [~liron@ita4fw1.itasoftware.com] has joined #go-nuts
18:35 -!- rbraley [~rbraley@ip72-222-128-78.ph.ph.cox.net] has quit [Ping timeout:
260 seconds]
18:35 -!- rbraley [~rbraley@ip72-222-128-78.ph.ph.cox.net] has joined #go-nuts
18:51 -!- napsy [~luka@88.200.96.18] has quit [Quit: leaving]
18:51 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
18:54 -!- Venom_X [~pjacobs@74.61.90.217] has joined #go-nuts
18:57 -!- liron_ [~liron@guest-fw.dc4.itasoftware.com] has joined #go-nuts
18:57 -!- liron_ [~liron@guest-fw.dc4.itasoftware.com] has quit [Remote host
closed the connection]
18:58 -!- liron_ [~liron@guest-fw.dc4.itasoftware.com] has joined #go-nuts
18:59 -!- liron [~liron@ita4fw1.itasoftware.com] has quit [Read error: Operation
timed out]
19:00 -!- dj2 [~dj2@216.16.242.254] has quit [Remote host closed the connection]
19:01 -!- dj2 [~dj2@216.16.242.254] has joined #go-nuts
19:02 < MaybeSo> how insidious, I wrote a code loop that used 'defer
part.Close()' within a for {...} w/o stopping to consider that the defered close
only occurs when the entire subroutine exits.
19:03 < skelterjohn> how else would it work?
19:03 < skelterjohn> it's not a scope operator
19:04 < MaybeSo> I know that
19:04 < MaybeSo> It's not a complaint, I'm just saying it was an insidious
little bug on my part
19:04 < plexdev> http://is.gd/gKXTG by [Christopher Wedgwood] in
go/src/pkg/io/ -- io: use SetFinalizer more elegantly in Pipe
19:07 -!- ucasano [~ucasano@host69-192-static.38-79-b.business.telecomitalia.it]
has quit [Quit: ucasano]
19:17 -!- Peet__ [~Peet__@unaffiliated/peet--/x-2416233] has quit [Read error:
Connection reset by peer]
19:43 -!- IRWolfie1 [irwolfie@69.162.126.237] has quit [Read error: Connection
reset by peer]
19:53 -!- TheSeeker [~n@99-153-250-110.lightspeed.irvnca.sbcglobal.net] has joined
#go-nuts
19:55 -!- nickaugust [~nickaugus@li181-40.members.linode.com] has quit [Remote
host closed the connection]
19:55 -!- nickaugust [~nickaugus@li181-40.members.linode.com] has joined #go-nuts
19:58 -!- liron [~liron@guest-fw.dc4.itasoftware.com] has quit [Remote host closed
the connection]
19:59 -!- liron [~liron@ita4fw1.itasoftware.com] has joined #go-nuts
20:05 -!- rbraley [~rbraley@ip72-222-128-78.ph.ph.cox.net] has quit [Ping timeout:
260 seconds]
20:06 -!- adu [~ajr@pool-74-96-89-94.washdc.fios.verizon.net] has quit [Quit: adu]
20:12 -!- skelterjohn [~jasmuth@lawn-gw.rutgers.edu] has quit [Quit: skelterjohn]
20:15 -!- rbraley [~rbraley@ip72-222-128-78.ph.ph.cox.net] has joined #go-nuts
20:15 -!- IRWolfie- [irwolfie@ircnoob.com] has joined #go-nuts
20:20 -!- tumdum [~tumdum@unaffiliated/tumdum] has quit [Quit: tumdum]
20:33 -!- zozoR [~zozoR@5634798d.rev.stofanet.dk] has quit [Quit: Morten.  Desu~]
20:43 -!- gnuvince_ [~vince@70.35.167.208] has quit [Quit: Lost terminal]
20:47 -!- Eridius [~kevin@unaffiliated/eridius] has joined #go-nuts
20:53 < plexdev> http://is.gd/gL7UX by [Peter Mundy] in go/src/pkg/syscall/
-- syscall: use 64-bit file size for truncation on Linux
21:03 -!- femtoo [~femto@95-89-197-196-dynip.superkabel.de] has joined #go-nuts
21:09 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
21:10 -!- dj2 [~dj2@216.16.242.254] has quit [Remote host closed the connection]
21:24 -!- Fish [~Fish@9fans.fr] has quit [Remote host closed the connection]
21:29 -!- Fish [~Fish@9fans.fr] has joined #go-nuts
21:33 -!- napsy [~luka@88.200.96.18] has quit [Quit: Lost terminal]
21:40 -!- Chopinn [~Chopin@ti0018a380-dhcp2647.bb.online.no] has joined #go-nuts
21:44 -!- TheMue [~TheMue@p5DDF5E26.dip.t-dialin.net] has quit [Quit: TheMue]
21:48 -!- dw [~dw@unaffiliated/dw] has joined #go-nuts
21:59 -!- ronnyy [~quassel@2001:6f8:12c6:1c86:224:1dff:fed7:9541] has joined
#go-nuts
22:01 -!- aho [~nya@fuld-4d00d7c2.pool.mediaWays.net] has joined #go-nuts
22:02 -!- femtoo [~femto@95-89-197-196-dynip.superkabel.de] has quit [Quit:
Leaving]
22:05 -!- tumdum [~tumdum@aug191.neoplus.adsl.tpnet.pl] has joined #go-nuts
22:05 -!- tumdum [~tumdum@aug191.neoplus.adsl.tpnet.pl] has quit [Changing host]
22:05 -!- tumdum [~tumdum@unaffiliated/tumdum] has joined #go-nuts
22:07 -!- tumdum [~tumdum@unaffiliated/tumdum] has quit [Client Quit]
22:17 -!- liron [~liron@ita4fw1.itasoftware.com] has quit [Quit: liron]
22:32 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-152-44.clienti.tiscali.it] has
quit [Quit: E se abbasso questa leva che succ...]
22:39 -!- artefon [~thiago@189.26.237.181.dynamic.adsl.gvt.net.br] has quit [Quit:
bye]
22:40 -!- adu [~ajr@pool-74-96-89-94.washdc.fios.verizon.net] has joined #go-nuts
22:43 -!- skelterjohn [~jasmuth@c-76-124-135-199.hsd1.nj.comcast.net] has joined
#go-nuts
22:45 -!- skelterjohn [~jasmuth@c-76-124-135-199.hsd1.nj.comcast.net] has quit
[Client Quit]
22:46 -!- exch [~exch@h78233.upc-h.chello.nl] has quit [Read error: Connection
reset by peer]
22:46 -!- exch [~exch@h78233.upc-h.chello.nl] has joined #go-nuts
22:46 -!- Fish [~Fish@9fans.fr] has quit [Remote host closed the connection]
22:49 -!- tumdum [~tumdum@aug191.neoplus.adsl.tpnet.pl] has joined #go-nuts
22:49 -!- tumdum [~tumdum@aug191.neoplus.adsl.tpnet.pl] has quit [Changing host]
22:49 -!- tumdum [~tumdum@unaffiliated/tumdum] has joined #go-nuts
22:50 -!- skelterjohn [~jasmuth@c-76-124-135-199.hsd1.nj.comcast.net] has joined
#go-nuts
23:01 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
Verlassend]
23:01 -!- wrtp [~rog@92.16.112.146] has quit [Quit: wrtp]
23:04 < |Craig|> I've got myself a go optimization problem.  Here is several
versions of my inner loop along with their corresponding runtimes:
http://dpaste.com/271108/ I think what I need is to use a bool as a int (0 or 1),
but I can't see a good way to do that.
23:08 < |Craig|> thats the 5th deep nested loop, and is running in these
tests on 2.86 MB arrays (though I often use much larger ones), runtimes are for
the entire process, which is a bit more than just that inner loop.
23:10 -!- creack [~charme_g@163.5.84.215] has quit [Read error: Connection reset
by peer]
23:13 < anticw> |Craig|: without checking the code details ...  have you
tried gccgo ?
23:15 -!- tumdum_ [~tumdum@aun93.neoplus.adsl.tpnet.pl] has joined #go-nuts
23:15 -!- tumdum_ [~tumdum@aun93.neoplus.adsl.tpnet.pl] has quit [Changing host]
23:15 -!- tumdum_ [~tumdum@unaffiliated/tumdum] has joined #go-nuts
23:15 -!- tumdum [~tumdum@unaffiliated/tumdum] has quit [Ping timeout: 240
seconds]
23:16 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
23:18 < |Craig|> anticw: gccgo won't let me cast a bool to an int anymore
than anything else, which would be the preferred solution.  But no, I havent tried
it, and it would probably optimize it somewhat better.
23:18 < |Craig|> maybe I should use unsafe, I'll look into that
23:18 -!- gid [~gid@220-253-109-211.VIC.netspace.net.au] has joined #go-nuts
23:19 < anticw> |Craig|: i mean't checking the perf using the code in it's
expanded form
23:20 -!- unhygienix [~unhygieni@host86-135-185-97.range86-135.btcentralplus.com]
has joined #go-nuts
23:20 < anticw> |Craig|: do you have a large snippet of code that builds, i
can test it here if that helps
23:21 -!- sauerbraten [~sauerbrat@p508CFB05.dip.t-dialin.net] has quit [Remote
host closed the connection]
23:21 < |Craig|> It runs fine, and I understand why the versions run at the
different speeds, I just can't see how to do the right thing with go's safty
23:22 < MaybeSo> have you tried just having two branches computing the ft2
update using variables for 0.5 or 4.0 that were declared outside the loop?
23:22 < |Craig|> I basically need this key expression float32(int(k==utn))
23:22 < anticw> |Craig|: i'm suggesting gccgo might generate code that would
run as if the case worked as you expected
23:22 < anticw> iant or not
23:25 < MaybeSo> for example, does this run as slowly as your other rejected
examples?  http://paste.pocoo.org/show/286706/
23:25 -!- enherit [~enherit@cpe-98-149-170-48.socal.res.rr.com] has joined
#go-nuts
23:26 < MaybeSo> oops, I'm missing an 'else {' in there
23:26 -!- iant [~iant@nat/google/x-bsgclhzflyrbeiqh] has quit [Ping timeout: 240
seconds]
23:26 < anticw> make x1 & x2 untyped consts
23:26 < MaybeSo> I'm thinking it's a bad idea to run too much conditional
logic inside a deep loop
23:27 -!- skelterjohn [~jasmuth@c-76-124-135-199.hsd1.nj.comcast.net] has quit
[Quit: skelterjohn]
23:28 < MaybeSo> anticw: good point
23:28 < |Craig|> MaybeSo: 1252 ms, slightly better than some of my
conditional versions
23:29 < |Craig|> constants made no difference
23:30 < |Craig|> MaybeSo: my non conditional version with math hacks are
fastest, so yes, conditionals in loops are bad
23:32 < |Craig|> using unsafe, how do I make a bool into some 0 or 1 number?
23:32 -!- dj2 [~dj2@CPE001f5b35feb4-CM0014048e0344.cpe.net.cable.rogers.com] has
joined #go-nuts
23:34 -!- iant [~iant@nat/google/x-lkkthymffaprkone] has joined #go-nuts
23:34 -!- mode/#go-nuts [+v iant] by ChanServ
23:35 -!- iant [~iant@nat/google/x-lkkthymffaprkone] has quit [Client Quit]
23:35 -!- iant [~iant@67.218.104.238] has joined #go-nuts
23:35 -!- mode/#go-nuts [+v iant] by ChanServ
23:37 -!- gnuvince_ [~vince@70.35.170.156] has joined #go-nuts
23:38 < MaybeSo> hrm...  possibly stupid idea: use a map[bool]int ?
23:39 < anticw> will be much slower
23:39 < MaybeSo> ah well
23:39 < |Craig|> MaybeSo: right concept though
23:39 < anticw> that will invoke the runtime ...  i think a variant of what
you posted would be fine
23:39 < anticw> and with a decewnt compiler as good as abuse unsafe
23:40 < MaybeSo> Do you folks use gccgo?  I've never bothered to since it
seemed like such a hassle to build.
23:41 < anticw> for perf stuff i do
23:41 < anticw> it used to trail in perf (mem footprint/cache issues) but
now for tight loops, etc i see it sometimes 2x the speed
23:41 < anticw> wrt to building it ...  it's not that bad
23:41 < anticw> at least on a recent distro ...  apt-get install ...  ; cvs
co ...  ; ./configure ...
23:42 < |Craig|> calling math.Fabs, and doing some subtractions and
multiplies and a type conversion came out faster than a basic conditional.  Maybe
goGcc would be faster, but I have my doubts as it can't exploit the math I'm doing
as there could be round of differences
23:42 < anticw> iant: append append append append
23:42 -!- gid [~gid@220-253-109-211.VIC.netspace.net.au] has quit [Quit: Leaving.]
23:42 < MaybeSo> yeah, I'm on a mac and cross compile for linux
23:42 < anticw> |Craig|: that's quite unexpected it would be faster
23:43 < anticw> i would think the call overhead would kill the conditional
cost
23:43 < |Craig|> anticw: and you would also think abs would contain a
conditional, but I suspect its getting inlined
23:43 < MaybeSo> One question I had, are you positive about your timings?
Are you making multiple runs and have you tried timing "all the rest" by taking
out the contents of the innermost loop you're looking at?
23:44 < anticw> |Craig|: for 6g?  i bet it's not
23:44 < anticw> |Craig|: can you post a bit more code along with the data
you're working with?
23:45 < |Craig|> anticw: I need to recheck the abs approach, it has a bug
that causes it ti output slightly different stuff that mat cause a perforamce
change, but it still stands that a basic conditional more than doubles my runtime
23:45 <+iant> anticw: I committed append support on Wednesday
23:45 < |Craig|> anticw: I can upload my project somewhere, give me a bit
and I'll github it.
23:45 < |Craig|> its just a fractal generator
23:46 < |Craig|> my first go project
23:46 < anticw> iant: yeah ...  i was a bit quick on that, building now
23:46 < anticw> iant: ...T ...  also?
23:46 <+iant> yep
23:47 < anticw> how can i rip on you for being a slacker if you keep doing
that
23:47 <+iant> ha
23:48 -!- zhaozhou [~zhaozhou@linfast76.bitnet.nu] has joined #go-nuts
23:49 < anticw> did you see the comments about about wanting to have an
efficient 'float32(int(x==y))' ?
23:49 <+iant> not really, but gccgo should be able to compute that more or
less optimally
23:50 <+iant> can you convert a bool to an int?
23:50 -!- rlab [~Miranda@91.200.158.34] has quit [Read error: Connection reset by
peer]
23:51 < anticw> that's my thinking, write it cleanly and let gccgo deal
23:51 <+iant> I think you may have to write if x == y { f = 1.0 } else { f =
0.0 }
23:51 <+iant> anyhow, yeah, once it gets into the gcc optimizers it should
be handled well
23:51 < anticw> no, a boot can't become and int
23:51 < anticw> bool
23:51 < anticw> boots can't either
23:52 < anticw> gcc got even slower to build
23:52 <+iant> making forward progress every day
23:53 < anticw> yeah ...  i dont mind that much ...  3m22s ...  whilst not
great ...  and not as fast as older versions, my cpus were slower then
23:54 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
23:54 < anticw> iant: ok, ...T works great ...  as does append
23:55 -!- photron [~photron@port-92-201-240-76.dynamic.qsc.de] has quit [Ping
timeout: 265 seconds]
23:56 < anticw> iant: ok, there are recent copy changes that don't work
23:56 <+iant> Hmmm, guess I've missed that
23:57 < anticw> the byte/string variant
23:57 <+iant> oh yeah
23:57 < anticw> i didnt even know i was using that ...
23:58 -!- cmarcelo [~cmarcelo@enlightenment/developer/cmarcelo] has quit [Quit:
Leaving]
23:58 < anticw> iant: pathcanon.go:121:2: error: both arguments must be
slices
23:58 < anticw> (fwiw)
23:58 -!- Venom_X [~pjacobs@74.61.90.217] has quit [Quit: Venom_X]
23:58 < |Craig|> anticw: here is my horrible code:
https://github.com/Craig-Macomber/goFlame (its really really messy and bad, I
know)
23:59 < |Craig|> loop in question is in hello.go
--- Log closed Sat Nov 06 00:00:00 2010