Nobun

Activity Graph

Page 1 of 2 | Next »

2018-12-25

[12:34:33] Nobun: has joined #ruby
[12:35:09] Nobun: hi. Any hint how to use rvm? I can't find a clear example how to use sandboxed ruby/gem installed with rvm instead of system one
[12:36:37] Nobun: I know that I should use /etc/profile.d or ~/.bashrc but it not clear how should I change it
[12:59:31] Nobun: Quit: WeeChat 2.1-dev

2018-12-24

[14:39:39] Nobun: has joined #ruby
[14:40:27] Nobun: hi. I am not very confident with ruby (I almost not use ruby). However I am writing a script which MUST use ruby so I need some help
[14:41:49] Nobun: 1) the script will be a kramdown builder (kramdown app is pretty limited on complex documentation with multiple files)
[14:43:00] Nobun: first problem is a very stupid one. I am trying to write a recursive file search and write it down to a list. When using Find.find nil values will found and I can't skip them. I will paste the part of code involving the problem
[14:44:56] Nobun: http://dpaste.com/243R5QG
[14:45:18] Nobun: the last comment is the error returned by ruby interpreter
[14:45:47] Nobun: xext_in is a string containing the extension
[14:51:33] Nobun: thank bougyman... I will try soon. However I found another issue not related to the lines I posted, but that could break also that function
[14:57:54] Nobun: yeah... I did also a bad mistake... I used OptionParser but I didn't provide a way to have a default value so all values ended to have nil instead of default. This way ext_in was nil -.-
[15:00:06] Nobun: now also the function works. However I am trying to understand your suggestion... what is "**/*" exactly?
[15:00:59] Nobun: I understand that #{xext_in} is a variable replacer for regexp, but i can't get what is **/* exactly
[16:09:53] Nobun: Quit: WeeChat 2.1-dev
[18:41:16] Nobun: has joined #ruby
[18:41:46] Nobun: problem with OptionParser: http://dpaste.com/268ZXFQ
[18:42:30] Nobun: if I run "script -x value" (where x is a flag) the option does not capture the 'value' I printed
[18:42:39] Nobun: in console
[18:43:55] Nobun: -b shortcut does not work?
[18:44:40] Nobun: Rudolph: in my code I have opt.on("-b", "--build=[DIR]", String, "...")
[18:44:49] Nobun: as you can see in my example
[18:45:21] Nobun: ah so I have to use " instead of ' right?
[18:47:32] Nobun: sorry so how the code should look instead? I don't get it
[18:48:25] Nobun: how should be written instead?
[18:48:25] Nobun: for example opt.on('-e', '--input-ext', String, 'Input extension (default=md)') { |o| $options.extension_in = o }
[18:49:23] Nobun: but I am not saying any differences (a part ' instead of ")
[18:50:04] Nobun: there is '-e', ther is '--input ext', ther is string and ther is description
[18:51:02] Nobun: ah now I got it
[18:51:16] Nobun: so I have to write '--input-ext EXT'
[18:52:02] Nobun: and the same change required in the first option or not?
[18:52:08] Nobun: I mean -b
[18:54:00] Nobun: yeah... now it works :)
[19:00:38] Nobun: the bad news is that the final result is not exactly as expected... but it is not a problem in my script, but in kramdown itself
[19:01:09] Nobun: for example, when creating html, links will refers to .md files and not .html files
[19:01:58] Nobun: I tried also kramdown -> latex and it is even worse... so probably I will focus my script to html output only in order to fix this issue
[21:14:34] Nobun: Ping timeout: 250 seconds
[23:12:19] Nobun: has joined #ruby
[23:12:40] Nobun: havenwood: thank for your link about OptionParser
[23:12:52] Nobun: good night
[23:12:57] Nobun: Client Quit

2018-03-25

[15:26:50] Nobun: has joined #ruby
[15:27:19] Nobun: some one of you here suggested to use mruby instead of ruby if I want to embed ruby in my application.
[15:27:58] Nobun: I'd like to know if those advantages (in terms of easier embedding) are still valid if you use mruby static library WITHOUT using ruby/rake/minirake
[15:28:37] Nobun: becouse my project need to use cmake as build system (or, eventually, scons, but not rake) since it uses qt5 framework
[16:11:39] Nobun: darix: I mean that usually (if I understood correctly) mruby is thinked to create applications wich embeds ruby, using ruby/rake/minirake to build the application
[16:13:13] Nobun: yeah. I will use another approach, instead, but it is almost the same (I will include mruby in my source tree and let mruby build itself then add the library to my application)
[16:14:19] Nobun: why? I think it is not a nasty thing. Simply build mruby with mruby/rake than use cmake/scons to build the rest. You can setup cmake and scons in order to do it.
[16:15:17] Nobun: my question is more about how mruby ensures less "headaches" to developers than ruby itself when coming to possible issues on managing library in the application
[16:15:34] Nobun: I mean things like possible problems with segmentation fault and similar issues.
[18:00:34] Nobun: darix: sorry but I didn't understand (intree libraries are a maintanance burden)... I don't understand what "burden" means in this context, very sorry
[18:29:37] Nobun: darix: now I understood. You surely got a shot. But I have good reason to inherit some external libraries in my source
[18:31:34] Nobun: those are mruby and lua 5.2 (however it is a desktop application and not a net application)
[18:33:48] Nobun: darix: not if the libraries re static
[18:35:10] Nobun: however the suggestion of letting use the system libraries (if present) is nice
[18:36:04] Nobun: for lua I had a reason why I added it. Becouse I choosed to use lua 5.2 and the lua C api I use is that one. It was a choice to avoid possible issues on linking on a newest library (even if lua usage is very very minimal in my application)
[18:36:58] Nobun: for mruby the only reason is becouse it is hard to figure that mruby can be installed in a system by default. However letting check it could be a nice solution
[18:40:59] Nobun: yeah this could be an idea, but I am afraid since 5.2 is a bit old lua release and usually the system version could be at least 5.3
[18:41:38] Nobun: I'd like void to avoid possible compile issues, but I can allow this chance and see if my code is compatible with 5.3
[18:41:46] Nobun: (or newer version)
[18:42:30] Nobun: well my lua code is pretty short
[18:42:55] Nobun: so probably it could not contain too many troubles for most recent lua releases
[18:43:13] Nobun: yeah, but as I said lua usage is very minimal
[18:43:48] Nobun: it is used to scan and update the information about extra packages that are available
[18:47:42] Nobun: 23 + 126 = 149 <==> those are the total lines where lua api is used (only two files in my source actually use lua api - if you exclude lua state initialization and finalizing)
[18:57:43] Nobun: Ping timeout: 256 seconds
[18:59:24] Nobun: has joined #ruby
[20:22:39] Nobun: Quit: good night all

2018-03-24

[11:36:03] Nobun: has joined #ruby
[12:16:20] Nobun: Quit: WeeChat 2.1-dev

2018-03-22

[09:49:50] Nobun: has joined #ruby
[09:50:27] Nobun: well... I'd like to give a try to mruby instead of ruby in order to embed ruby in my application.
[09:51:54] Nobun: but, since I'm developing a rather complex application I need to understand how mruby works in a lot of different aspects.
[09:53:29] Nobun: first of all. Mruby uses rake in order to compile c sources, as far as I understand. But in my situatuation is not suggested to use rake (I am developing a qt application using cmake)
[09:53:57] Nobun: I could simply let compile mruby in my source code and use static libs but...
[09:54:33] Nobun: it seems that mruby wants to use gems in order to extend/embed ruby. This thing is totally unclear to me.
[09:55:05] Nobun: I need a way in order to let ruby talk with my application and vice-versa
[09:55:16] Nobun: and it is a c++ application.
[09:56:02] Nobun: Is there anyone that can help me understand how mruby should correctly used? And that can points me what additional documentation I should read?
[19:03:40] Nobun: Quit: WeeChat 2.1-dev

2018-03-21

[11:35:56] Nobun: has joined #ruby
[11:36:19] Nobun: Any hint how to properly debug an application embedding ruby?
[11:36:39] Nobun: this is my application code: http://dpaste.com/17CVBA7
[11:36:55] Nobun: and this is the ruby file I tested: http://dpaste.com/2P62H3Y
[11:37:27] Nobun: the application encounter a sort of segmentation fault, with a VERY LOOOOONG message
[13:02:49] Nobun: dminuoso: yeah. I saw. But it is my best choice for dependency build
[13:03:30] Nobun: however this first problem was solved. Don't know why but erasing corevxa_rubylib function will solved the issue
[13:03:50] Nobun: I instead changed the approach and setted rubyvxa_rubylib as a global ruby variable
[13:04:07] Nobun: that way (with the same code) the segmentation fault problem was solved.
[13:04:37] Nobun: I mean THAT problem is solved
[13:04:51] Nobun: dminuoso: yeah. This is why I executed script more than once
[13:05:25] Nobun: it is a problem of memory allocation (a memory address is not anymore valid)
[13:05:50] Nobun: however I didn't have properly a SISVEG, but a core dump with a long message on ruby side
[13:06:40] Nobun: I always thinked that segmentation faults are related to memory management (or garbage collectors). Do I miss something?
[13:08:26] Nobun: it is not impossible. Also becouse ruby is not the only language I embed, but I embed ruby together with python and lua.
[13:10:34] Nobun: However I can say that usually a segmentation fault will happen after less than 10 tries. I mean in practical test I did in past (not with ruby specifically) when a segmentation fault problem happened, it showed not exactly randomly (even if not exactly happens at the point where the actual problem is located)
[13:11:30] Nobun: dminuoso: I had a speculation. I think that doing a c++ operation on ruby Kernel side (global function should be added there, if I understood the problem) probably could explain the original issue.
[13:12:09] Nobun: dminuoso: I never been able to be sure about the CAUSE. Usually with segmentation fault I try to trace gdb and do experiments until things are fine.
[13:13:19] Nobun: dminuoso: it is only becouse I am a non-professional programmer. All I learnt I learnt by myself. But if you can show me a nicer way to approach to debugging, I will be happy to hear.
[13:14:32] Nobun: I mean... I use gdb as debugger (I usually use breakpoints to try to guess where problems could be located. Even if it is not a very good way, hearing your words)
[13:16:00] Nobun: dminuoso: I mean that not always breakpoints on gdb will actually crash to actual problem. You must do some try-and-guess, trying to understand what the problem is. I don't know, for example, how to interpret a memory address alone.
[13:16:23] Nobun: unluckly I don't know ASM at all. Only C++
[13:17:49] Nobun: the only thing I could manage is 0x0 that I now it means "null pointer"
[13:19:15] Nobun: well but now, if I cannot reproduce the problem (i mean with the new code) how could I verify what went wrong to gdb? should I re-write the original (bugged) code?
[13:19:54] Nobun: I am afraid it was deleted.
[13:20:33] Nobun: the best thing is to try to re-write the original code and paste the original core dump informations
[13:22:38] Nobun: yeah I am rebuilding the code with the original solution (with the issue) and try to run it with gdb (it is compiled with debugging flags, so no problem on using gdb)
[13:25:05] Nobun: ok reintroducing the original code reproduced the problem. Now I pastebin the core dump (happened without calling gdb)
[13:26:09] Nobun: http://dpaste.com/3MSZ143
[13:26:18] Nobun: now I try to run it with gdb
[13:26:35] Nobun: this is only the stderr
[13:27:17] Nobun: but the stdout could be able to print the $corevxa_rubylib varible but not corevxa_rubylib2 function
[13:28:09] Nobun: dminuoso: hmm I am using the ruby library provided by ubuntu. But it should be used in the debugging
[13:28:25] Nobun: let me see my CmakeLists.txt
[13:29:09] Nobun: -DCMAKE_BUILD_TYPE=Debug
[13:29:28] Nobun: so it should use the debugging version of every library found with find_package()
[13:29:45] Nobun: strange, since I installed development version
[13:30:04] Nobun: it should have both and cmake should link to the debugging with the flag I posted some lines ago
[13:30:28] Nobun: let me see what happens with VERBOSE build
[13:33:44] Nobun: it seems you are right. For some strange reasons it links to standard libraries and not debug ones as expected.
[13:33:58] Nobun: and not only with ruby, also with qt
[13:35:14] Nobun: dminuoso: yeah but building ruby means using ruby to build ruby wich it seems very strange to me
[13:35:53] Nobun: yeah but it is strange. Becouse ruby is a dependency in order to build ruby.
[13:36:23] Nobun: well in Ubuntu 14.04 forced me to install ruby in order to be allowed to compile it.
[13:37:25] Nobun: however I must check what it happens exactly (compiling a custom qt would be very painful. And I like to see if I am missing something in my system)
[13:38:00] Nobun: dminuoso: don't know too. I don't remember exactly how I built ruby.
[13:38:31] Nobun: however at first I investigate my system before building anything
[13:38:47] Nobun: then I will build ruby etc
[13:39:28] Nobun: dminuoso: out of curiosity: how did you understand that debugging symbols were disabled?
[13:41:40] Nobun: that is strange: libruby is only that one? I mean... both for debug and release?
[13:41:58] Nobun: I mean. I am expecting to see librubyd or something similar
[13:43:23] Nobun: dminuoso: let me paste you my link flags (they will be displayed as one-line-only sorry)
[13:44:19] Nobun: http://dpaste.com/2D73F3R
[13:46:15] Nobun: I say "no debugging symbols" becouse I expected to be linked with debugging libraries (qt libraries for debug should end with "d" for example, and they're not)
[14:23:32] Nobun: dminuoso: ok I will sorry for late reply but I had to go out for a while
[14:24:54] Nobun: dminuoso: Thread 1 "vxapo" received signal SIGSEGV, Segmentation fault.
[14:24:57] Nobun: 0x00007ffff74440f6 in ?? () from /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3
[14:25:12] Nobun: this is what gdb says
[14:25:34] Nobun: it seems that debugging symbols are all whipped out :(
[14:35:04] Nobun: dminuoso: no SSD here and a slow pc. However I will follow your suggestion. At least for developing state it could be the best choice.
[14:36:04] Nobun: however I will use 2.3.0 since ubuntu use 2.3.SOMETHING_ELSE in order to be sure that the code will be compatible with my distro ruby version
[14:37:08] Nobun: yeah. I don't think it can be as painful as trying to compile qt after all :P (I don't remember how much time required with ubuntu 14.04, but I remember it should be not so much time)
[14:37:48] Nobun: dminuoso: ah it is possible that in my case ruby required an external ruby since I compiled from github source?
[14:38:17] Nobun: havenwood: I can use -j2 at max and I never see so much difference
[14:38:45] Nobun: havenwood: it depends of processor. You cannot do make -j64 without crash :P
[14:39:25] Nobun: cloning github...
[14:48:19] Nobun: dminuoso: did you use any particular configure flag in order to ensure to build "debug" version of ruby? (I mean with debugging symbols)
[14:56:48] Nobun: darix when you compile autotools package (like ruby) you cannot add manually flags, but you should use "configure" options
[15:06:38] Nobun: thank dminuoso and darix. I will re-compile ruby than
[15:08:44] Nobun: needed to recompile becouse otherwhise -g will not have effect to previously builded source
[15:10:21] Nobun: yeah bit I have to rebuild. I deleted the previous build :P
[15:12:39] Nobun: ok builded and installed in a custom prefix (under home)
[15:13:14] Nobun: now I have to check how to allow cmake to recognize it instead of the default system library
[15:28:14] Nobun: cmake cannot find the new builded library :(
[15:28:35] Nobun: even if I tried to specify directory. Perhaps it is related to pkg-config directories...
[15:37:17] Nobun: ruby_: the code you pasted is not enough to reply you. This becouse it uses python decorators
[15:37:32] Nobun: @app.route("/record", methods=['GET', 'POST'])
[15:37:46] Nobun: you must investigate what this decorator exactly does
[15:42:38] Nobun: you can see |r| as current element in the iteration
[15:44:01] Nobun: example: (0..7).each do |i|
[15:44:17] Nobun: in that case i will be the current value in the iteration in the range 0..7
[15:49:28] Nobun: still having troubles on building the application to the new ruby library (I cannot setup cmake properly in order to find and configure custom ruby)
[15:49:38] Nobun: so sorry for delay
[15:57:59] Nobun: it seems it compiled ONLY libruby static version
[15:58:15] Nobun: I cannot find libruby-2.3.0.so or similar
[16:00:03] Nobun: I can confirm. No libruby...so but only .a
[16:00:06] Nobun: very strange
[16:00:13] Nobun: any suggestion?
[16:08:35] Nobun: and moreover it didn't install config.h
[16:09:17] Nobun: I did CFLAGS="-g" ./configure --prefix=/home/user/programmi/ruby
[16:09:22] Nobun: than make and make install
[16:32:18] Nobun: I compiled ruby enabling also shared library, but config.h again not installed. How to solve this issue?
[16:44:56] Nobun: dminuoso: no finally I'm in on this issues, but adding some cflags
[16:45:28] Nobun: but even if I pass --enable-rpath in configure it seems that run-time cannot find shared library in my custom path during run
[16:45:50] Nobun: I am trying to compile with static ruby now and see if it can compile successfully
[16:47:49] Nobun: as I figured I cannot use static library. Well... I will rebuild again and run with LD_PATH=
[16:50:40] Nobun: ok, dminuoso now I have a more verbose gdb
[16:51:28] Nobun: dminuoso: http://dpaste.com/2J3FXDD
[16:51:40] Nobun: (I had to run with LD_LIBRARY_PATH)
[16:54:57] Nobun: dminuoso: when you can... this case I really need your help becouse debugging message is not understandable to me.
[22:48:00] Nobun: Quit: ronf

2018-03-20

[09:51:31] Nobun: has joined #ruby
[09:51:44] Nobun: Hi I have two questions about ruby and embedding
[09:52:36] Nobun: 1) question is more about ruby in general, (remembering that the final objective is to embed ruby into an application) and it is "how to properly add directories to LOAD_PATH)?
[09:53:13] Nobun: the examples I saw googling are not clear. I mean... how should I add a specific path?
[09:54:14] Nobun: yeah I saw but: A) what unshift exactly does?
[09:54:40] Nobun: so it is like prepending instead of appending?
[09:55:22] Nobun: dminuoso: could this be done also in an application wich will embed ruby?
[09:55:32] Nobun: I mean in the C code?
[09:56:34] Nobun: I don't know the difference, to be honest. I need ruby for some specific task in my applications. Let me see my CMakeFile...
[09:59:04] Nobun: At the current state I am embedding ruby (since I use 'find_package(Ruby 1.9)' on CMakeLists.txt)
[09:59:38] Nobun: but I will consider also mruby. At the moment I focus my question to full ruby
[10:00:57] Nobun: my application will (optionally) embed ruby to try to extract informations from some ruby mashalized binary files
[10:01:37] Nobun: the task of ruby will be limited to this task (as my application will embed python as primary scripting language)
[10:03:22] Nobun: Yeah... I assume. But not sure, since it is not completely a ruby file. I am developing an application for translating RpgMaker VX Ace projects (and also MV, but MV uses json files so not problem there)
[10:04:34] Nobun: at the current state (without embed) the "extract text phase into .po files" can be done within Rpgmaker itself with two ruby script. But the process could be a little problematic for the end-user
[10:05:11] Nobun: the idea is to allow the application to perform directly this task.
[10:05:51] Nobun: dminuoso: however those files should be marshalled with Marshal
[10:07:30] Nobun: (however writing an additional line in ruby_file instead of embedding in the application could be not a problem, after all)
[10:08:04] Nobun: the question 2 is about embedding itself. More in detail about managing error (more or less like the interpreter).
[10:08:59] Nobun: The problem is that I did a first embedding test, adding an Embedded C Ruby Class and it works
[10:10:15] Nobun: but if I will have errors, they will be not displayed like I could do in the interpreter. So I would like to ask if there is an API function I should use to "capture" all error messages cought in the script (like the interpreter does)
[10:30:08] Nobun: dminuoso: thank for your replies. However I taked a look at mruby, but I think that mruby introduces some additional problems so I will be stick in the full Ruby.
[11:56:40] Nobun: I try to bump my second question, with a code snippet: http://dpaste.com/3VJSP8V
[11:57:29] Nobun: this piece of c++ code should keep some paramaters (not important for the question) and then run the "edb.rb" script
[11:58:55] Nobun: I follow a code snippet I found around the net. However the "if status" seems not working, since the function rubycall::errormsg (a function wich should print into a window the error catched by line 13-14) seems not called at all.
[11:59:21] Nobun: So... how to "capture" error messages and show them in my application wich embeds (full) ruby?
[12:18:15] Nobun: momomo_: Bish | momomo_: what is your framework? │ agrecascino
[12:18:16] Nobun: │11:40:58 Bish | rails?
[12:18:50] Nobun: momomo_: Bish | http://api.rubyonrails.org/classes/ActionView/PartialRenderer.html
[12:19:02] Nobun: those are the last replies
[20:09:58] Nobun: I try to bump my second question, with a code snippet: │ __main__
[20:09:59] Nobun: │ | http://dpaste.com/3VJSP8V
[20:10:39] Nobun: http://dpaste.com/3VJSP8V (pasted from question I asked some hours ago)
[20:11:08] Nobun: the question is. How to properly have the error log from ruby when I embed it into application.
[20:11:45] Nobun: In the code snippet I did, the pycall:rubyerr seems is never executed, so it seems that "status" thing didn't work. Any idea?
[21:10:33] Nobun: Ping timeout: 264 seconds
[21:12:00] Nobun: has joined #ruby
[22:56:29] Nobun: Quit: ronf

2017-10-10

[05:24:07] Nobun: unlike python and lua, infact, I didn't see any clear way to allow script to comunicate to the application
[05:25:15] Nobun: this way the script will be executed and the CoreVxa class (or module) will be used to obtain informations from application and to return informations to application
[05:27:13] Nobun: can I do it in ruby... but how? As long as I am defining the CoreVxa class in C++ how I supposed to add method to the same class in Ruby? (sorry but I have a bit difficulties on understanding this language)
[05:28:26] Nobun: that should be very nice if I can avoid to implement some additional C++ code
[05:28:41] Nobun: that I could avoid using few lines of Ruby instead
[05:30:18] Nobun: ah but perhaps I can simply make a derived class....
[05:30:53] Nobun: and I can add this into Ruby even if CoreVxa is already defined?
[05:31:40] Nobun: ah ok. so you can have multiple class SameClassName to add features at different points... interesting
[05:36:56] Nobun: but, however, to communicate with application (for the retval the script should be set in corevxa... for that value it is better to have a setter and not an attr_accessor so I can convert VALUE to string
[05:37:15] Nobun: (a setter in C++, I mean)
[06:41:12] Nobun: matthewd: I cannot find a good way to convert RUBY string to c_string
[06:46:03] Nobun: YEAH. Finally worked
[06:46:15] Nobun: StringValueCStr(v) works very fine
[06:46:27] Nobun: this is the final (working) code:
[06:47:15] Nobun: c++ code: http://dpaste.com/0FVF7GZ
[06:48:15] Nobun: ruby code (test.rb): http://dpaste.com/2M2MH83
[06:50:20] Nobun: now I will work in the actual application... last question
[06:50:54] Nobun: In my application I will need to run two scripts with this same method, and all of them will use this CoreVxa to communicate with application
[06:51:22] Nobun: is it good if I will add this CoreVxa class this way to both script?
[13:44:08] Nobun: Quit: Salve a tutti