• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Xcode and Ruby function menu

Scheduled Pinned Locked Moved Developers' Forum
12 Posts 5 Posters 2.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    AdamB
    last edited by 18 Jan 2008, 11:46

    I use XCode as my development IDE which works great as my project has Ruby, C, C++, Javascript and HTML files (for that special "syntax-overload" feeling!). However, for Ruby only, XCode is generating madly indented function-menu pop-ups.

    I just spent some time figuring out what is going on and it turns out to be just that it gets confused by loop constructs which have an optional "do" keyword. (Guess the parser for syntax coloring is too picky).

    eg:

    for faces in container do
    blah
    end

    causes the function menu pop-up to be wrong. Removing the (unneccessary) "do" fixes it.

    Anyway, hope this tidbit helps others.

    Developer of LightUp Click for website

    1 Reply Last reply Reply Quote 0
    • T Offline
      todd burch
      last edited by 18 Jan 2008, 13:08

      Thanks for the tidbit. For Ruby, I currently use TextWrangler (free), but might be moving to TextMate (fee).

      I use XCode a lot for C, C++ and Java. It has some quirks, but is basically a pretty good editor. I just recently figured out how to turn on code completion. That sure is nice.

      Todd

      1 Reply Last reply Reply Quote 0
      • A Offline
        azuby
        last edited by 18 Jan 2008, 13:58

        Has anybody tried the Netbeans 6.1 IDE (there also is a Ruby-only IDE)? Till now I haven't had any breaks in syntax highlighting with that IDE (you know Scite? ^^).

        One year ago I tried XCode, but it wasn't good for me. I also tried TextMate - seemed to have a good syntax highlighting (but is it really free? I don't think so.)

        azuby

        *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

        Bad English? PM me, correct me. :smile:**

        1 Reply Last reply Reply Quote 0
        • T Offline
          todd burch
          last edited by 18 Jan 2008, 14:14

          I use Scite occasionally too - on Windows, when I need line numbers. I said "fee" for TextMate, not "free".

          Last year, I went to a Ruby conference and Sun demonstrated NetBeans 6.0. It looked good, but I have yet to download it. I really liked the interactive debugger built into it, but alas, that won't work for SU. I told Sun I would pay $1,000 for an interactive debugger that works in SU.

          Todd

          1 Reply Last reply Reply Quote 0
          • A Offline
            azuby
            last edited by 18 Jan 2008, 15:26

            It's possible to hook into all methods like all Ruby debugger are doing. And we also need to change $STDOUT, $STDIN and $STDERR. So it would be possible to have an own console. But a debugger talking to NetBeans hm ... And all still works for XCode and TextMate?

            Don't know, why Ruby programmers use "for" statements - they aren't "the Ruby way" 😄 Ruby provides iterators and the "each" (each_index, each_with_index, reverse_each, to, upto, downto, times) method.

            azuby

            *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

            Bad English? PM me, correct me. :smile:**

            1 Reply Last reply Reply Quote 0
            • A Offline
              AdamB
              last edited by 18 Jan 2008, 23:07

              Hmm. When I first came across Ruby I was enamored with these constructs. However, there is no such thing as a free lunch and the fact is that they are all slow. For my stuff, significantly slower than plain old simple for-loops - now you can argue they're semantically identical until your blue in the face.. Not as sexy, I know, but I'm old and wise and detest fancy language features that have hidden costs almost as much as I detest feats-of-engineering for engineering's sake. Been there, done that, got the t-shirt. Move on. 😉

              Adam

              Developer of LightUp Click for website

              1 Reply Last reply Reply Quote 0
              • A Offline
                azuby
                last edited by 19 Jan 2008, 15:49

                Hehe, blue? OK, maybe you really need half of a second. Time is money. But sex sells 😛

                azuby

                *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

                Bad English? PM me, correct me. :smile:**

                1 Reply Last reply Reply Quote 0
                • A Offline
                  AdamB
                  last edited by 19 Jan 2008, 16:45

                  Well perhaps I was just grumpy last night. 😉 But that link shows what I know, which is a simple for-loop is around 10% faster for pretty much zero loss in readability. I'll take the 10% thanks.

                  There is a real danger with Ruby of not understanding how much work you're asking for in using these cool constructs. Look at the Struct stuff - obscenely slow. Ditto expressions in which one is making Ruby do a lot of copying behind the scenes. It might look nice and compact on the outside, but... And some of the self-serving arguments you hear about "hardware is cheap" are a bit, well, self serving!

                  </rant_off>

                  Bon weekend!

                  Developer of LightUp Click for website

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    driven
                    last edited by 29 Jan 2010, 13:10

                    Hi,

                    I'm extremely unknowledgeable about scripting in general, and SU ruby in particular, but have a need (more a desire) to go through and Mac'ify any of my ruby set that give me Console(system) messages on start-up and in use,

                    It seems the main error (that I see) lies within SU itself and is there as soon as I load a clean instal of SU, before adding any additional rubies. It may or may not be a problem, but it generates pages of reports, which can't be good.

                    [0x0-0x45045].com.google.sketchupfree7[548] SketchUp(548,0xa015e720) malloc: *** error for object 0xa03eb6d8: Non-aligned pointer being freed
                    [0x0-0x45045].com.google.sketchupfree7[548] *** set a breakpoint in malloc_error_break to debug

                    as soon as I start adding rubies, I get additional error messages mostly like the examples below, usually telling me what line in which script, is at 'fault'

                    [0x0-0x3b03b].com.google.sketchupfree7[373] /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/Xyz/Abc.rb:218: warning: parenthesize argument(s) for future ver
                    [0x0-0x45045].com.google.sketchupfree7[548] (eval):4632: warning: don't put space before argument parentheses
                    [0x0-0x45045].com.google.sketchupfree7[548] (eval):27: warning: already initialized constant ZERO_TOL
                    [0x0-0x45045].com.google.sketchupfree7[548] #<NoMethodError: undefined method `rendering_options' for nil:NilClass>

                    from time to time I send these reports to Google (to no avail) and to individual authors who have then, tidied up the code.

                    I have also used Xcode to clean some scripts, and solve some glitches, so I know it all helps.

                    My first question is, On a script by script basis, can Xcode be set-up to 'find all>repair all' for these types of errors?

                    john

                    learn from the mistakes of others, you may not live long enough to make them all yourself...

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      AdamB
                      last edited by 1 Feb 2010, 10:31

                      @driven said:

                      [0x0-0x45045].com.google.sketchupfree7[548] SketchUp(548,0xa015e720) malloc: *** error for object 0xa03eb6d8: Non-aligned pointer being freed
                      [0x0-0x45045].com.google.sketchupfree7[548] *** set a breakpoint in malloc_error_break to debug

                      Sketchup has always emitted these (scary) messages. I've never figured out why.

                      @driven said:

                      0x0-0x3b03b].com.google.sketchupfree7[373] /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/Xyz/Abc.rb:218: warning: parenthesize argument(s) for future ver

                      You'd have to write a prtty sophisticated regular expression to catch and change all these. You'd be running the risk of screwing up the scripts if you get anything wrong..

                      @driven said:

                      [0x0-0x45045].com.google.sketchupfree7[548] (eval):4632: warning: don't put space before argument parentheses

                      A simple search and replace of " (" with "(" should work.

                      @driven said:

                      [0x0-0x45045].com.google.sketchupfree7[548] (eval):27: warning: already initialized constant ZERO_TOL

                      A script is being required/loaded twice.

                      @driven said:

                      [0x0-0x45045].com.google.sketchupfree7[548] #<NoMethodError: undefined method `rendering_options' for nil:NilClass>

                      This is just an error in the script. My total guess would be a script that is reading the rendering_options when there is no active_model and thus getting nil as the result.

                      Developer of LightUp Click for website

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by 1 Feb 2010, 11:27

                        @adamb said:

                        My total guess would be a script that is reading the rendering_options when there is no active_model and thus getting nil as the result.

                        That's a mac thing? Or does SU load scripts before a model is ready?

                        Thomas Thomassen — SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          driven
                          last edited by 1 Feb 2010, 15:32

                          AdamB,

                          cheers for the reply, before attempting to write any rubies myself I'm trying to analyze what I can and can't see using Xcode and Console (in combination)

                          it appears (to me) that if a ruby or it's loader.rb and subfolder reside in SU Plugin folder they will be initiated on start-up whether required or not and generate error reports if they have a prerequisite for "xxx" which is not available/selected prior to start-up(which, of course it's not)

                          This type of error does't seem to be generated for rubies that are placed inside their own sub-folder with a non-automatic step in their path i.e. rudy console, or a separate toolbar ruby that has it's own sub-folder that contains a on/off-button for an in-folder loader ruby that opens/closes the desired ruby.

                          Not even sure I follow that myself, but main lightup ruby (for example) appears to have to a degree of separation (for activation at least) and cannot generate errors and cause conflicts, unless it's actually being used and there's a problem.

                          What I think I'm after is a way to active/de-active any ruby, from within SU using a single(per ruby) external action.

                          Do you know if that's even realistic en-mass?

                          Which Xcode template is appropriate for SU rubies? or is there an importable or custom layout that's preferable?

                          cheers

                          john

                          learn from the mistakes of others, you may not live long enough to make them all yourself...

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post
                          Buy SketchPlus
                          Buy SUbD
                          Buy WrapR
                          Buy eBook
                          Buy Modelur
                          Buy Vertex Tools
                          Buy SketchCuisine
                          Buy FormFonts

                          Advertisement