IRC Logs for #crux Friday, 2017-09-29

*** onodera has quit IRC00:11
cruxbot[opt.git/3.3]: meson: don't depend on python3-setuptools but don't remove egg-info as that will break pip3 for meson, manually clean up footprint so no mising files appear02:17
Romstere11even check prt-get deptree vlc02:29
*** _________mavric6 has quit IRC02:43
*** _________mavric6 has joined #crux02:44
*** emmett1 has quit IRC03:25
*** tilman_ has joined #crux04:08
*** tilman has quit IRC04:11
nullspoonDo we have a C programmer present?04:50
ryu0Nope.04:51
ryu0ACTION runs for the hills.04:51
nullspoon:)04:51
nullspoonMaybe I'll just leave my question on the floor here and will come back to see if anyone took the bait.04:51
nullspoonI've got a problem that's been plaguing me for a couple of days here. I want to write a trim function. Trimming the end of a string is easy (I think) by just inserting a null byte at the beginning of the last continuous whitespace.04:52
nullspoonTrimming the front though, I was thinking of just moving the char array start pointer forwards and re-setting the variable to point X bytes forwards.04:52
nullspoonIs that a terrible idea?04:52
ryu0It depends what you're trying to do.04:53
nullspoonJust strip whitespace from the front and end of a string04:54
ryu0yea, but there's multiple ways to get that effect.04:54
nullspoonPlease, do enlighten me. I'm a self-upstarter with c, so just about everytime I talk to someone I learn a lot of new stuff.04:55
ryu0produce a sub-string immutably. IOW, slice it up into the chunk that only includes that string chunk.04:55
ryu0but that requires string functions that can take length arguments.04:55
ryu0another option... copy the chunk to the beginnning of the string and then terminate it correctly.04:56
ryu0memmove would work for this.04:57
ryu0or, OFC, your choice, but i don't normally recommend this approach. it all depends what you're doing with that buffer.04:57
nullspoonI thought about doing that. I suppose modifying the source string is probably a bad idea.04:57
ryu0like, your method would be undesirable for malloced memory because the04:58
ryu0pointer needs to stay the same for later when you free it.04:58
nullspoonoh yeah, good point.04:58
ryu0you can do whatever you want for temporary copies of the pointer though.04:58
ryu0you just can't permanently change your master copy of the reference.04:59
ryu0nullspoon: if you intend to primarily use it on temporary stack allocated buffers, then go for it. just beware of what your changes may do to things.05:00
ryu0the safest course of action is to not write to it at all.05:00
nullspoonheh05:00
ryu0this operation, strictly speaking, doesn't require it.05:01
ryu0example...05:01
ryu0trim(" foo bar  ", &start, &end)05:01
ryu0first is 105:01
ryu0end is 8.05:02
ryu0printf("%.*s", end - start, s + start)05:02
ryu0tadda.05:02
nullspoonAh, true.05:03
nullspoonI was kind of hoping to result in a string that I could pass the pointer to index 0 and it'd print to the null byte, without extra logic. Trying to balance higher processing requirements for more readable code.05:03
nullspoonThough that might be the old C#/php developer in me.05:04
ryu0I guess. But, mutable operations can screw you over if you're not careful.05:04
ryu0You could use strndup to produce a copy.05:04
ryu0:)05:05
nullspoonYeah, I was trying to avoid that. Was thinking of a copy.05:05
ryu0course, if you only need it temporarily...05:05
nullspoonThing is, I'd like it to work with mallocd strings and stack strings.05:05
ryu0malloced strings are things i tend to avoid unless i need the copy to persist.05:06
nullspoonI agree, though I am somewhat warming up to them, provided they exist inside a struct which makes them easy to free with the destructor.05:06
ryu0... C has no destructors.05:07
nullspooner, making my own.05:07
ryu0Ok.05:07
ryu0You can simulate them with GNU extensions if you really want to.05:07
nullspoonPlease, tell me how I'm doing it wrong. For somewhat complex data structures, I make a struct of preallocated memory or of pointers that a constructor mallocs and a destructor function frees.05:08
nullspoonSound like a bad idea?05:08
nullspoonI haven't had anyone really pick through my c concepts, so the feedback is really appreciated.05:08
ryu0That sounds like typical C OO patterns.05:09
ryu0But w/o code, I can't really tell you.05:09
nullspoonthat's what I'm trying for. Pretty much anything I know, I've taken from other language I used or learned from reading other people's c.05:09
ryu0Are you familiar with function pointers?05:09
nullspoonHell yeah!05:10
nullspoonI love callback functions. :)05:10
ryu0Right... well, they lack closure in C, so don't expect to be able to do fancy stuff like you can with those other languages.05:10
nullspoonclosure? How do you mean?05:11
ryu0Meaning, you can't nest functions and they can't reference another function's scope transparently.05:11
ryu0Any such access can only be done through pointers.05:11
nullspoonAh, yes.05:12
nullspoonThat's what I've been doing when I need that kind of functionality.05:12
ryu0I do have a question though. Given your background, why C?05:12
nullspoonI can't tell you how many times I've heard that question.05:12
ryu0It sounds like D might be more fun for you.05:12
nullspoonI like knowing how things work. So much stuff is written in c, I figured it'd be good to learn.05:13
ryu0Well, when you get tired of how much work it takes to do anything, consider looking at something between C and C#. To me that's stuff like Go and D, since they produce native executables.05:14
nullspoonOnce I started grasping the concepts of pointers, structs, callbacks, simple primitive data types, I just couldn't get enough.05:14
nullspoonI looked at D a few years ago. Didn't seem to have much of a community at the time.05:14
nullspoonI'll take a look again. I have been looking for something between the two.05:14
ryu0Fair point.05:14
ryu0But the people that use D seem to consider it a middle language between C# and C.05:15
nullspoonI don't want garbage collection, but growable arrays, reasonable socket programming expectations, and a larger core library set would be great.05:15
ryu0You hate GC then?05:15
nullspoonI just like doing memory management really.05:15
ryu0Well, then...05:16
nullspoonWhen you're not trusting something else quite so much, you understand better when your stuff breaks.05:16
nullspoonThough I haven't really dug in to memory management inside of a garbage collector. I could just be making stuff up right now.   :)05:16
ryu0C++ is manual too, but has so much automatic behavior it can throw you for a loop.05:16
nullspoonYeah, I actually started in c++.05:16
nullspoonWell, crom c# that is. c++ was my first foray into compiler languages.05:17
nullspoonfrom*05:17
ryu0uh... you do realize C# is also compiled?05:17
nullspoonI read Linus' rant about c++ and thought I'd give his beloved language a try. It was like a gateway drug. I just kept getting further and further in.05:17
nullspoonYeah, I mean c++ was my first outside of c#. I started as a windows guy. When I moved to linux, it was all perl, php, bash.05:18
nullspoonC++ was my first compiler language when I came back to them.05:18
*** e11even has joined #crux05:18
ryu0e11even: < Romster> e11even check prt-get deptree vlc05:19
nullspoonI'll never stop learning. Fortunately, the open source comunnity has lots to teach, so I'll just keep soaking it in.05:19
ryu0nullspoon: Free Pascal. You might like it too. lol05:20
ryu0Everything is manually allocated too.05:20
ryu0the type checking is more rigorous than C.05:21
nullspoonI'll have to take a look.05:21
nullspoonSo far, D is looking pretty good.05:21
nullspoonI guess I have to be honest. There's practical me, then there's hobby me. At work, I don't use C because it's far too cumbersome.05:22
ryu0Fair point. FP has a *very* fast compiler, so that's a plus. Most languages compile slowly.05:22
nullspoonAt home, when I have time to waste, it's all C. It's like a big puzzle.05:22
ryu0C++ especially.05:23
nullspoonThat's a fact.05:23
nullspoonWhen crux moved from compiling libreoffice to pulling in the binary from another distro, I didn't complain.05:23
nullspoonThat, amongst mesa3d and firefox, was the worst package on my system.05:23
ryu0but if you're going to insist on using C, you'd better master the CPP.05:24
ryu0it does a lot of stuff you can't do with raw C.05:24
nullspoonOh, I won't insist on C. I like learning, I just prefer C right now because having to do everything from scratch teaches me so much.05:24
ryu0Ok..05:25
nullspoonFor work-related purposes, I'd love to find a higher level language that wasn't as heavy as java.05:25
ryu0Free Pascal offers a lot of what C++ does, but in a faster to compile language.05:25
ryu0Define heavy.05:25
ryu0Nearly all languages require a modest SDK and runtime environment.05:26
nullspoonIt's more in the packaged output that I'm referring to.05:26
ryu0Free Pascal Compiler produces static executables mostly, so its actual runtime is small.05:26
nullspoonI do a lot of systems automation, which scripting is ideal for. Unfortunately however, I often lack the ability to install interpreters, so I'm stuck with pre-installed bash and perl, without many of the cpan libraries.05:27
ryu0nullspoon: i've used C for years and one thing i hate about higher level languages is that you often also have to wait a longer time for programs to compile too.05:27
ryu0but not all languages force that.05:28
nullspoonDon't get me wrong, I really like bash and perl.05:28
nullspoonA lot of the tools I write though don't exceed a few thousand lines of code, so compile time is usually pretty quick.05:28
abenzryu0: with CPUs being incredibly fast now, is that really an issue anymore?05:28
ryu0abenz: yes, yes it is.05:28
nullspoonabenz: Case and point. I've been compiling mariadb for the last hour.  :)05:29
ryu0compile times will always matter as long as you have to compile software.05:29
abenzin the end its time you are trying to save, so pick your poison as they say: compile time, or programming time ;)05:29
ryu0not necessarily.05:30
ryu0it depends on the language.05:30
ryu0Pascal was ahead of its time for its high level features and is surprisingly fast to compile.05:30
ryu0nullspoon: https://freepascal.org/advantage.var05:31
][_R_][nullspoon: I'd just look up the source of a strcpy (or write one myself) then add a conditional to not start copying until I've found a non-whitespace, then after that track how many whitespaces I've seen (reset when I see non-whitespace) so that I can add the NUL in the right place.05:32
nullspoon][_R_][: I actually just used strcpy in one iterration of my function. I set the end by inserting the null byte, then did strcpy &str[ind];05:33
][_R_][Not what I meant05:33
nullspoonWorked pretty well, but I'm also trying to find the most efficient way to do it. Granted, I am using C, so efficiency isn't exactly a must.05:33
*** JanC_ has joined #crux05:33
][_R_][You kind of want to reimpliment strcpy here, unless you want to explicitly state that you'll mutate the input string.05:34
nullspoonDerp. Took me a second apparently. I'll do that.  :)05:34
][_R_][If you want to do it mutably: have your trim return a pointer to the input string at the point where non-whitespace starts, and add the NUL where the non-whitespace ends.05:34
nullspoonI tried that, but it kept segfaulting.05:35
][_R_][What string are you trying to mutate here?05:35
][_R_][Somelike like argv?05:35
nullspoonActually, let me go back and try that again. I could be wrong.05:35
][_R_][Something like*05:35
nullspoonIt's read from a config.05:35
][_R_][So the string is just malloc'd?05:36
nullspoonThe config syntax is colon delimited, but for ease of human readability, I want to be able to have an arbitrary amount of whitespace so things line up.05:36
nullspoonIt is, though that's just how I'm doing it now because I didn't want to hardcode a maximum string width.05:36
nullspoonI'm on the fence. I try to avoid the heap generally.05:37
][_R_][Also: RE interpreters, there are variants of JS, Ruby and Python that run in the JWM.05:37
][_R_][ACTION forgets what he did with his config parser for returning strings.05:39
][_R_][Looks like I just did what I did with the rest of it, write the result to the address provided.05:41
nullspoonI suppose I could do that.05:43
nullspoonI'll have to play with it. Right now I'm passing a struct of pointers around, each pointing to a config value.05:43
nullspoonHmmm05:44
nullspoonOh, I gotta get to bed. Need to get up early.05:45
nullspoonThanks very much for the input everyone. I learned a lot, and have even more to read on. As usual, the crux community is great.05:46
*** p4cman has joined #crux05:48
*** j_v has quit IRC05:50
*** j_v has joined #crux05:52
*** e11even has quit IRC05:52
*** e11even has joined #crux06:53
*** e11even has quit IRC07:11
frinnsthttps://github.com/aksakalli/gtop08:48
frinnstwritten in nodejs08:48
frinnstheh the issues are pretty funny: Insane memory usage #5408:49
joacimnodejs desktop applications was an excellent idea09:00
*** fnords has quit IRC09:00
*** fnords has joined #crux09:01
*** jue has quit IRC09:05
*** onodera has joined #crux09:10
*** druid_droid has quit IRC09:29
*** druid_droid has joined #crux09:30
pedjaprogrammer I know, on refactoring/optimizing software :"Nah, just add more RAM/more cores to the build/development machine"09:41
*** jue has joined #crux09:51
frinnstone of our customers currently have a problem with a business application. printing invoices takes like 5 minutes per invoice. The vendor suggested we add more cores and ram09:52
frinnsteven though the program only uses 1 cpu and does something stupid which causes it to use 100% cpu on one core during the printing09:52
*** abenz_ has joined #crux10:04
pedjathere is a theme going on in sw development, apparently. 'add MOAR cores/RAM', 'disk space is cheap', 'curl $random_script | sudo bash'10:04
frinnstdiskspace is NOT cheap10:05
frinnsta 8TB disk is cheap10:05
frinnsta 8TB SAN is far from cheap10:05
pedjatell that to Appimage developers10:05
frinnstwe charge about 4SEK/GB on our san, depending on the expected load10:06
pedjaso, for basic Windows VM, thats 400SEK right off the bat :)10:08
pedjaidk, packaging software for Linux is a hard problem, given the fragmentation/differences between distributions10:17
pedjaOpen Build System can help with the build part for various distros, but someone still has to do the work to get there10:21
pedjanice timing. if AMDs graphics stack gets merged in 4.15, people buying Zen+ and entry level Vega's should have working systems OOTB10:25
joacimcould make your software depend on the more distro agnostic frameworks/package managers10:40
joacimi forget the name of them10:40
frinnstor you know.. ship the source11:28
*** p4cman has quit IRC12:36
*** p4cman has joined #crux12:38
*** druid_droid has quit IRC13:15
*** druid_droid has joined #crux13:17
*** abenz_ has joined #crux13:36
*** emmett1pc has joined #crux13:50
*** BitPuffin|osx has quit IRC15:05
*** g0relike has quit IRC15:33
*** g0relike has joined #crux15:34
*** abenz has joined #crux15:43
*** abenz has quit IRC15:48
*** john_cephalopoda has joined #crux15:50
john_cephalopodaHi15:51
*** abenz has joined #crux16:05
*** emmett1pc has quit IRC16:21
*** abenz_ has joined #crux16:31
*** abenz has quit IRC16:35
*** tsaop has joined #crux17:09
*** p4cman has quit IRC17:26
*** JanC has joined #crux17:59
SitriAnything in the repos that works with joysticks (I just need something to test some with)20:33
*** tsaop has quit IRC20:39
john_cephalopodaI don't know anything from the repo that does.20:40
pedjaSitri, contrib/rocksndiamonds, perhaps?20:52
SitriThank you!20:55
pedjais this how the Web looked 10-15 years ago? http://goldenmean.info/20:56
pedjareminds me of, what was it called, Time Cube?21:02
SitriNo, just crazy sites21:09
john_cephalopodapedja: http://www.rdrop.com/21:13
john_cephalopodaThat's a well-designed website ^21:15
*** vlnx_ has quit IRC22:08
*** abenz_ has joined #crux22:47
abenz_pedja: no thats not how websites looked like23:06
abenz_thats what a wall of text looks like23:06
jaegerSitri: I used to use d1x to test joysticks, might still be a decent way :) Doubt there's any port, though23:50
jaegerhttp://www.dxx-rebirth.com/23:51
john_cephalopodaFlightgear (not in the repos) has some controller stuff, too.23:57
john_cephalopodaBut difficult to pack. Some program versions didn't line up perfectly, so I didn't get it to compile.23:58

Generated by irclog2html.py 2.14.0 by Marius Gedminas - find it at mg.pov.lt!