Re: [dev] golang dwm status

2014-03-13 Thread Silvan Jegen
On Thu, Mar 13, 2014 at 10:13:25PM +0100, Markus Teich wrote: > Silvan Jegen wrote: > > When scanning the code I saw several cases where you declared and > > initialized variables on the same line like this > > > > var void = 0 // target for unused values > > var dev, rx, t

Re: [dev] golang dwm status

2014-03-13 Thread Markus Teich
Silvan Jegen wrote: > When scanning the code I saw several cases where you declared and > initialized variables on the same line like this > > var void = 0 // target for unused values > var dev, rx, tx, rxNow, txNow = "", 0, 0, 0, 0 > var scanner = bufio.N

Re: [dev] golang dwm status

2014-03-13 Thread Sebastián Ferrara
2014-03-13 16:50 GMT-03:00 Markus Teich : > > Thanks for the hint. However I wanted to avoid spawning other processes as > much > as possible. Is there another way to count the cpu cores just by reading a > file > in /proc or maybe /sys? See http://golang.org/pkg/runtime/#NumCPU func NumCPU()

Re: [dev] golang dwm status

2014-03-13 Thread Markus Teich
Paul Onyschuk wrote: > You can get there by using sysconf(3), from man page: Oh man, I just found this: http://golang.org/pkg/runtime/#NumCPU -.- --Markus signature.asc Description: Digital signature

Re: [dev] golang dwm status

2014-03-13 Thread Silvan Jegen
On Thu, Mar 13, 2014 at 04:33:16PM -0400, Charlie Andrews wrote: > On Thu, Mar 13, 2014 at 09:21:09PM +0100, Markus Teich wrote: > > > > If you like, please explain the benefits of the first 2 points a bit more > > detailed (see my other mail for my reasoning) > > In both cases, I believe it's mu

Re: [dev] golang dwm status

2014-03-13 Thread Markus Teich
Charlie Andrews wrote: > In both cases, I believe it's much more readable and maintainable to > have a section for imports and a section for vars (global-ish variabls). > Readability is subjective I guess, but maintainability is not, and it is > much easier this way to add imports and vars with few

Re: [dev] golang dwm status

2014-03-13 Thread Charlie Andrews
On Thu, Mar 13, 2014 at 09:21:09PM +0100, Markus Teich wrote: > > If you like, please explain the benefits of the first 2 points a bit more > detailed (see my other mail for my reasoning) In both cases, I believe it's much more readable and maintainable to have a section for imports and a section

Re: [dev] golang dwm status

2014-03-13 Thread Paul Onyschuk
On Thu, 13 Mar 2014 20:50:38 +0100 Markus Teich wrote: > Thanks for the hint. However I wanted to avoid spawning other > processes as much as possible. Is there another way to count the cpu > cores just by reading a file in /proc or maybe /sys? You can get there by using sysconf(3), from man pag

Re: [dev] golang dwm status

2014-03-13 Thread Markus Teich
Charlie Andrews wrote: > I write go for a living, and these 3 comments were the only ones off the > top of my head as well. If you like, please explain the benefits of the first 2 points a bit more detailed (see my other mail for my reasoning) > > 3. Instead of appending to the same slice several

Re: [dev] golang dwm status

2014-03-13 Thread Markus Teich
Silvan Jegen wrote: > 1. The usual way to import several packages is > > import ( > "fmt" > "whatever" > "etc" > ) I know that it is possible, but what benefits do I get? I decided against it, because on small laptop screens I get 2 loc more on the screen and the few bytes neces

Re: [dev] golang dwm status

2014-03-13 Thread Charlie Andrews
On Thu, Mar 13, 2014 at 09:00:58PM +0100, Silvan Jegen wrote: > On Thu, Mar 13, 2014 at 08:34:04PM +0100, Markus Teich wrote: > > Heyho, > > > > the recent discussion about Go motivated me to finally rewrite my > > dwm status shell script. Since this is one of my first programms > > written in Go

Re: [dev] golang dwm status

2014-03-13 Thread Silvan Jegen
On Thu, Mar 13, 2014 at 08:34:04PM +0100, Markus Teich wrote: > Heyho, > > the recent discussion about Go motivated me to finally rewrite my > dwm status shell script. Since this is one of my first programms > written in Go, I would love to get some feedback from you Go gurus out > there. The we

Re: [dev] golang dwm status

2014-03-13 Thread Alexander Huemer
On Thu, Mar 13, 2014 at 08:50:38PM +0100, Markus Teich wrote: > Alexander Huemer wrote: > > I don't have much clue about go, but I think that the content of > > /proc/cpuinfo > > differ greatly on different architecture. Maybe the output ls `lscpu` is > > better suited for that purpose. > > Thank

Re: [dev] golang dwm status

2014-03-13 Thread Markus Teich
Alexander Huemer wrote: > I don't have much clue about go, but I think that the content of /proc/cpuinfo > differ greatly on different architecture. Maybe the output ls `lscpu` is > better suited for that purpose. Thanks for the hint. However I wanted to avoid spawning other processes as much as p

Re: [dev] golang dwm status

2014-03-13 Thread Alexander Huemer
On Thu, Mar 13, 2014 at 08:34:04PM +0100, Markus Teich wrote: > the recent discussion about Go motivated me to finally rewrite my dwm > status shell script. Since this is one of my first programms written > in Go, I would love to get some feedback from you Go gurus out there. > The weird chara

[dev] golang dwm status

2014-03-13 Thread Markus Teich
Heyho, the recent discussion about Go motivated me to finally rewrite my dwm status shell script. Since this is one of my first programms written in Go, I would love to get some feedback from you Go gurus out there. The weird characters in the output are used for coloring and as icons/separators

Re: [dev] What is bad with Python

2014-03-13 Thread random832
On Wed, Mar 12, 2014, at 15:04, FRIGN wrote: > Impressive, but better use > $ LD_TRACE_LOADED_OBJECTS=1 t > instead of > $ ldd t > next time to prevent arbitrary code-execution[1] in case you're dealing > with unknown binaries. I don't know if it was here and you or somewhere else or someone els