Andy Nutter-Upham, I just realized I didn't answer this exact question by
you in full details (I read the original message on the phone while being
quite busy with something a couple of weeks ago, and I somehow missed some
of intricacies of your question):
"If I missed the documentation and someone knows where it is, I'd love to
read it. I think though that since this is a wrapper library there is
instead reference to the underlying documentation (whose method names are a
bit different, and whose arguments are a bit different) and I find that
translation very challenging; especially since glimmer-dsl-libui is not yet
complete, so your run into ineffective keywords if you rely on the
underlying glimmer docs."
Glimmer DSL for LibUI actually does have full documentation for the Ruby
API:
https://github.com/AndyObtiva/glimmer-dsl-libui#supported-keywords
Someone asked me to add the documentation early on when the project was
new, and I added it to that person's satisfaction. I hope it's helpful to
you too.
By the way, I also do mention under the "Original API" section that you
could use the LibUI Go documentation as a reference:
https://pkg.go.dev/github.com/andlabs/ui
But, the most complete reference is the actual C headers:
https://github.com/andlabs/libui/blob/master/ui.h
And, the C headers are exposed as low-level FFI functions in Ruby as per
the Original API (but it's not recommended that you use these method
directly of course):
https://github.com/AndyObtiva/glimmer-dsl-libui#original-api
To give you an example of how the mapping from the C API to Ruby happens,
suppose we have this C function:
uiWindowSetTitle('My Application')
The word before the "Set" or "Get" operation is the control object (e.g.
window), and the word after it is the attribute (e.g. title).
So, the equivalent of that in the Glimmer GUI DSL:
window {
title 'My Application'
}
Basically, we are declaring a window control with one nested attribute of
title having the value 'My Application'
The C API is procedural and imperative whereas the Glimmer GUI DSL is
object-oriented and declarative, better mapping to the way we think of
concepts visually while looking at a screen given that you could nest
controls (widgets) within each other.
If you need further help, do not hesitate to ask further questions at the
Glimmer Gitter chat:
https://app.gitter.im/#/room/#AndyObtiva_glimmer:gitter.im
You shouldn't really get bogged down unless you are missing foundational
grounding in software engineering concepts relating to desktop development
in general, like MVC (Model View Controller). I've done GUI development
professionally in older technologies like Java Swing in the past, and by
comparison, Glimmer lets me leapfrog past productivity by 4x at least,
sometimes 10x or even more (and it's that much faster in productivity than
web development too, so it's great for building quick local apps or tools
that don't need the web as it's much simpler, demanding a tiny fraction of
web code only). But, it does assume you know MVC (Model View Controller)
very well, and it benefits from also knowing MVP (Model View Presenter).
Once you get the main ideas behind Glimmer, everything clicks, and things
like exact APIs or detailed documentation wouldn't matter much anymore
because the way you think with MVC/MVP is you start with the View layer
from a GUI mockup to support a specific user workflow, and you either use
native controls (like text and button, by looking them up in examples or
the docs mentioned above) or you invent your own custom controls (both
options are available in Glimmer DSL for LibUI). Of course, the native
controls are only as complete as what is implemented by the underlying
LibUI library. I know the authors of it are working on adding many new
features, like a Tree control, Table sorting listeners, and some other
missing features. They will all be added to Glimmer DSL for LibUI in due
time when they get released in C LibUI. But, that shouldn't stop someone
from learning the library and using whatever is available in it for now, or
at least mastering the current features until more features are added in
the future (especially given that you could always temporarily polyfill
missing features by building your own custom controls if really needed).
Cheers,
Andy Maleh
On Tue, Feb 14, 2023 at 9:27 PM grigoris charam <xargrigoris(a)gmail.com>
wrote:
> Stop reply all
>
> On Feb 15, 2023, at 03:05, Andy Maleh via ruby-talk <
> ruby-talk(a)ml.ruby-lang.org> wrote:
>
>
> The Glimmer Gitter Chat:
>
> https://app.gitter.im/#/room/#AndyObtiva_glimmer:gitter.im
>
> If you create any Glimmer related projects, libraries, or tools, you could
> alert of us of them in the Gitter Chat.
>
> And, you can open issues or pull requests on any of the Glimmer projects
> if needed:
> <glimmer.png>
> AndyObtiva/glimmer: DSL Framework consisting of a DSL Engine and a
> Data-Binding Library used in Glimmer DSL for SWT (JRuby Desktop Development
> GUI Framework), Glimmer DSL for Opal (Pure Ruby Web GUI), Glimmer DSL for
> LibUI (Prerequisite-Free Ruby Desktop Development GUI Library), Glimmer DSL
> for Tk (Ruby Tk Desktop Development GUI Library), Glimmer DSL for GTK
> (Ruby-GNOME Desktop Development GUI Library), Glimmer DSL for XML (& HTML),
> and Glimmer DSL for CSS <https://github.com/AndyObtiva/glimmer>
> github.com <https://github.com/AndyObtiva/glimmer>
> <https://github.com/AndyObtiva/glimmer>
>
>
> Andy Maleh
>
>
> LinkedIn: https://www.linkedin.com/in/andymaleh
> <https://www.linkedin.com/in/andymaleh>
> Blog: https://andymaleh.blogspot.com
> GitHub: https://github.com/AndyObtiva
> Twitter: https://www.twitter.com/AndyObtiva
>
> On Feb 14, 2023, at 7:51 PM, Fellipe Fingoli via ruby-talk <
> ruby-talk(a)ml.ruby-lang.org> wrote:
>
>
> really good content! I want to help to develop this ecosystem. Does
> anybody know where I can reach the community?
>
> Em ter., 7 de fev. de 2023 às 18:29, Andy Maleh via ruby-talk <
> ruby-talk(a)ml.ruby-lang.org> escreveu:
>
>> My RubyConf 2022 talk video on "Building Native GUI Apps in Ruby" using
>> the Fukuoka Award Winning Glimmer DSL for LibUI has just been released!
>>
>> https://youtu.be/1Bh4CnJqHyY
>>
>> Andy Maleh
>>
>> LinkedIn: https://www.linkedin.com/in/andymaleh
>> <https://www.linkedin.com/in/andymaleh>
>> Blog: http://andymaleh.blogspot.com
>> GitHub: http://www.github.com/AndyObtiva
>> Twitter: @AndyObtiva <https://twitter.com/AndyObtiva>
>>
>> ______________________________________________
>> ruby-talk mailing list -- ruby-talk(a)ml.ruby-lang.org
>> To unsubscribe send an email to ruby-talk-leave(a)ml.ruby-lang.org
>> ruby-talk info --
>> https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-talk.ml.ruby-lang.or…
>
>
>
> --
> Fellipe Fingoli
> ______________________________________________
> ruby-talk mailing list -- ruby-talk(a)ml.ruby-lang.org
> To unsubscribe send an email to ruby-talk-leave(a)ml.ruby-lang.org
> ruby-talk info --
> https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-talk.ml.ruby-lang.or…
>
> ______________________________________________
> ruby-talk mailing list -- ruby-talk(a)ml.ruby-lang.org
> To unsubscribe send an email to ruby-talk-leave(a)ml.ruby-lang.org
> ruby-talk info --
> https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-talk.ml.ruby-lang.or…
>
>
--
Andy Maleh
LinkedIn: https://www.linkedin.com/in/andymaleh
<https://www.linkedin.com/in/andymaleh>
Blog: http://andymaleh.blogspot.com
GitHub: http://www.github.com/AndyObtiva
Twitter: @AndyObtiva <https://twitter.com/AndyObtiva>
Hi Everyone,
For a long time, I wanted to do a series of posts called "Learning by
Reversing" where I look at something that exists and is useful, and try
to work back and explain it.
For this, my first series is about Native Gems in Ruby. So, I've picked
a simple native Ruby gem called fast-polylines and am looking at all the
code, how to develop it, how to test it, how it loads, how it works,
etc. with the aim of helping people understand Native Ruby gems better.
The first 2 parts are now online on my blog:
* Part 1 - This covers the background to the gem we explore
Link:
https://notepad.onghu.com/2023/learning-by-reversing-s1-e1-native-gems/
* Part 2 - This goes into the details of how ruby loads the native gem
and extension (and includes a nice sequence diagram of how all the bits
happen together)
Link:
https://notepad.onghu.com/2023/learning-by-reversing-s1-e2-native-gems/
Future posts are planned to go into details like:
* The interface between Ruby and C
* The Makefile
* A Makefile that also works on Windows
* Running the specs
* Running the performance benchmark
* Enhancements:
- Providing an executable
- A gem that also works on JRuby
- Making the gem ractor friendly
- Patching an existing gem rather than a new module
Comments on the posts or the plans welcome.
Best regards,
Mohit.
Hi, thx for the suggestion.
Unfortunately, it doesn't work with a bundled gem, at least in a mac: gems
get distributed in .bundle packages, so:
```ruby
spec = Gem::Specification.find_by_name("openssl")
source_dir = File.join(spec.full_gem_path)
Dir.glob(source_dir + "/*/**")
=> []
# ruby-install installs bundled gem extensions under
/Users/tiagocardoso/src/ruby-3.2.1/.ext/x86_64-darwin21/
```
I believe that Frank may be correct here, in that "openssl" does not
declare its header files as external in extconf.rb .
Thx,
Tiago
Ruby users (Avocadostore) <support(a)avocadostore.zendesk.com> escreveu no
dia segunda, 27/02/2023 à(s) 21:24:
> ##- Bitte geben Sie Ihre Antwort über dieser Zeile ein. -##
>
> Sie sind in dieser Supportanfrage (1955167) auf CC gesetzt. Antworten Sie
> auf diese E-Mail, um Kommentare zur Anfrage hinzuzufügen.
>
> *Ruby users*
>
> 27. Feb. 2023, 22:24 MEZ
>
> Hi,
>
> In <CAD489_xmJUsZkPzzbhJPXi3naKn18fpt+Dj1_uVYf945p9FeZA(a)mail.gmail.com>
> "[ruby-talk:444148] How to load ruby-openssl headers in a C extension" on
> Mon, 27 Feb 2023 11:27:52 +0000,
> Tiago Cardoso via ruby-talk <ruby-talk(a)ml.ruby-lang.org> wrote:
>
> > I'm writing a C extension which interfaces with ruby-openssl objects, and
> > the openssl API. In the process, I'm needing access to some functions
> which
> > ruby-openssl declares in the header file:
> >
> https://github.com/ruby/openssl/blob/ea0a112a0c6a0498629e778af7991c9b4e3495…
> > (example: ossl_raise). However, it's not clear to me how should I declare
> > the #include in order to access it, for a header file coming from stdlib.
> > Seems that ruby itself correctly places its header files (examples:
> ruby.h,
> > or ruby/io.h), but I don't see the openssl gem ones.
>
> You can use Gem::Specification for it in your extconf.rb:
>
> spec = Gem::Specification.find_by_name("openssl")
> source_dir = File.join(spec.full_gem_path, "ext", "openssl")
> $INCFLAGS += " -I#{source_dir}"
>
> See also:
>
> https://github.com/groonga/mysql2-replication/blob/main/ext/mysql2-replicat…
>
> Thanks,
> --
> kou
> ______________________________________________
> ruby-talk mailing list -- ruby-talk(a)ml.ruby-lang.org
> To unsubscribe send an email to ruby-talk-leave(a)ml.ruby-lang.org
> ruby-talk info --
> https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-talk.ml.ruby-lang.or…
>
> *Ruby users*
>
> 27. Feb. 2023, 21:28 MEZ
>
> On 2/27/23, Tiago Cardoso via ruby-talk <ruby-talk(a)ml.ruby-lang.org>
> wrote:
> > Hi Mohit,
> > ... I want to access the headers of openssl "the ruby library", or more
> specifically its C extension headers.
>
> So, you mean, e.g., these:
> https://github.com/ruby/openssl/blob/master/ext/openssl/
> https://github.com/ruby/openssl/blob/master/ext/openssl/ossl.h
>
> It doesn't look like the extension installs those headers:
> https://github.com/ruby/openssl/blob/master/ext/openssl/extconf.rb
>
> E.g., ruby/digest installs digest.h
> https://github.com/ruby/digest/blob/master/ext/digest/extconf.rb
>
> $INSTALLFILES = {
> "digest.h" => "$(HDRDIR)"
> } if $extmk
> ______________________________________________
> ruby-talk mailing list -- ruby-talk(a)ml.ruby-lang.org
> To unsubscribe send an email to ruby-talk-leave(a)ml.ruby-lang.org
> ruby-talk info --
> https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-talk.ml.ruby-lang.or…
>
> *Ruby users*
>
> 27. Feb. 2023, 20:34 MEZ
>
> Hi Mohit,
>
> Thx for the reply. "#include <openssl/ossl.h>" is to access headers from
> openssl "the library", whereas I want to access the headers of openssl "the
> ruby library", or more specifically its C extension headers.
>
> Both "#include <ruby/ruby.h>" and "#include <sys/time.h>" do not apply to
> my use-case: the first is a header file from the ruby distribution, not an
> stdlib, whereas the latter is a (non-ruby related) system library.
>
> Best regards,
> Tiago
>
> Mohit Sindhwani <mo_mail(a)onghu.com> escreveu no dia segunda, 27/02/2023
> à(s) 16:35:
>
> Hi Tiago,
>
> On 2023-2-27 7:27 pm, Tiago Cardoso via ruby-talk wrote:
>
> I'm writing a C extension which interfaces with ruby-openssl objects, and
> the openssl API. In the process, I'm needing access to some functions which
> ruby-openssl declares in the header file:
> https://github.com/ruby/openssl/blob/ea0a112a0c6a0498629e778af7991c9b4e3495…
> (example: ossl_raise). However, it's not clear to me how should I declare
> the #include in order to access it, for a header file coming from stdlib.
> Seems that ruby itself correctly places its header files (examples: ruby.h,
> or ruby/io.h), but I don't see the openssl gem ones.
>
> The beginning of my C file looks like:
>
> ```C
> #include <ruby.h>
> #include <openssl/evp.h>
>
> #include <pathto/openssl/ossl.h> // how to do this?
> ```
>
> What is the error that you are getting? I would have that it should just
> work with "#include <openssl/ossl.h>" on the idea that it's relative to the
> system include directory but I am still exploring how C native extensions
> work but I thought it should have worked since I see other gems (e.g.,
> grpc) include other items like:
>
> #include <ruby/ruby.h>
> #include <sys/time.h>
>
> Best regards,
> Mohit.
>
> *Ruby users*
>
> 27. Feb. 2023, 12:28 MEZ
>
> Hi,
>
> I'm writing a C extension which interfaces with ruby-openssl objects, and
> the openssl API. In the process, I'm needing access to some functions which
> ruby-openssl declares in the header file:
> https://github.com/ruby/openssl/blob/ea0a112a0c6a0498629e778af7991c9b4e3495…
> (example: ossl_raise). However, it's not clear to me how should I declare
> the #include in order to access it, for a header file coming from stdlib.
> Seems that ruby itself correctly places its header files (examples: ruby.h,
> or ruby/io.h), but I don't see the openssl gem ones.
>
> The beginning of my C file looks like:
>
> ```C
> #include <ruby.h>
> #include <openssl/evp.h>
>
> #include <pathto/openssl/ossl.h> // how to do this?
> ```
>
> Thx,
> Tiago
> Avocado Store GmbH
> Cremon 32, 20457 Hamburg
> avocadostore.de <https://www.avocadostore.de> - Eco Fashion & Green
> Lifestyle
> [image: Instagram] <https://www.instagram.com/avocadostore.de>
> [image: Facebook] <https://de-de.facebook.com/avocadostore>
> [image: Pinterest] <https://pinterest.com/avocadostore>
> [image: TikTok] <https://www.tiktok.com/@avocadostore.de>
> [image: LinkedIn] <https://www.linkedin.com/company/avocadostore>
>
> Eine E-Mail verursacht durchschnittlich 4 g CO2, mit Anhang bis zu 50 g.
> Jährlich bedeutet das 135 kg CO2-Emissionen pro Kopf. Verringere deine
> Emissionen, indem du nur notwendige E-Mails verschickst und regelmäßig
> E-Mails löschst.
> Registergericht: Amtsgericht Hamburg, HRB 113545
> Umsatzsteuer-Identifikationsnummer: DE270706065
> Geschäftsführung: Mimi Sewalski & Till Junkermann
> [V03OR4-EQ4Z8]
>
Hi,
I'm writing a C extension which interfaces with ruby-openssl objects, and
the openssl API. In the process, I'm needing access to some functions which
ruby-openssl declares in the header file:
https://github.com/ruby/openssl/blob/ea0a112a0c6a0498629e778af7991c9b4e3495…
(example: ossl_raise). However, it's not clear to me how should I declare
the #include in order to access it, for a header file coming from stdlib.
Seems that ruby itself correctly places its header files (examples: ruby.h,
or ruby/io.h), but I don't see the openssl gem ones.
The beginning of my C file looks like:
```C
#include <ruby.h>
#include <openssl/evp.h>
#include <pathto/openssl/ossl.h> // how to do this?
```
Thx,
Tiago
Hi Everyone,
I started on a series to learn by reversing a native Ruby gem. Part 3 is
now published! The step continues the examination by seeing how we
package and ensure that the native extension is actually built during
installation. Also, why are there 2 Makefiles?
Part 3 - How do we ensure that we have everything and that it actually
gets built at installation?
Link:
https://notepad.onghu.com/2023/learning-by-reversing-s1-e3-native-gems/
The first 2 parts are also online on my blog:
* Part 1 - This covers the background to the gem we explore
Link:
https://notepad.onghu.com/2023/learning-by-reversing-s1-e1-native-gems/
* Part 2 - This goes into the details of how ruby loads the native gem
and extension (and includes a nice sequence diagram of how all the bits
happen together)
Link:
https://notepad.onghu.com/2023/learning-by-reversing-s1-e2-native-gems/
Future posts are planned to go into details like:
* The interface between Ruby and C
* The Development Makefile and a Makefile that also works on Windows
* Running the specs and the performance benchmark
* Enhancements:
- Providing an executable
- A gem that also works on JRuby
- Making the gem ractor friendly
- Patching an existing gem rather than a new module
Comments on the posts or the plans welcome. I'm @onghu on Twitter or
@onghu@ruby.social on Mastodon if you're on either.
Best regards,
Mohit.
Hi list,
I'm working on replacing URI.escape/unescape before moving a project to Ruby 3.x.
I was wondering what most of you have used as alernatives and how they have worked for you.
AFAIK, these are the options:
CGI.escape
URI.encode_www_form
URI.encode_www_form_component
Also, if you have any links to interesting posts, articles, videos about this, do send them through.
Thanks!
Guilherme
anthropologist
programmer
code-anth.xyz
Sent with Proton Mail secure email.
Hi, everybody!
I'm developing a gem called "guess_os" to try guess local or remote (using SSH conn) OS.
Could you try "guess_os" on your system an give me feedback, please!
Installation: gem install guess_os
Running command: guess_os
Responds with ip? [ENTER] to guess your localhost.
Thanks!
:-)
Enviado con [Proton Mail](https://proton.me/) correo electrónico seguro.