Forum

  • Apr 25
    Re: [eiffel-users] Passing STRINGs to 'separate' objects
    Thanks Alexander, well explained. On Thursday, 25 April 2019 07:55:11 UTC+1, Alexander Kogtenkov wrote: > > The difference between STRING types and numerical types is in the > reattachment semantics. STRING types have reference semantics, i.e. during > reattachment, a reference to the object is
  • Apr 25
    Re: [eiffel-users] Passing STRINGs to 'separate' objects
    The difference between STRING types and numerical types is in the reattachment semantics. STRING types have reference semantics, i.e. during reattachment, a reference to the object is passed, there is just a single copy of that object. Basic numerical types (REAL_32, INTEGER, etc.) have copy
  • Apr 24
    Passing STRINGs to 'separate' objects
    I'm trying to use SCOOP for the first time, and am having trouble making sense of the compiler messages. I have a class I wish to run concurrently: class RACE feature {NONE} -- Initialization starttime: STRING course: STRING going: STRING distance: REAL make (passed_st
  • Apr 23
    RE: Re[2]: [eiffel-users] another strange one
    The problem is indeed quite specific, you're correct. I did some testing and I can save pretty much any EV_PIXMAP I choose, using the save_to_named_path and it works like a charm. There remains a CAT call problem when using save_to_named_file, having nothing to do with pixmaps, I suspect, but
  • Apr 23
    Re[2]: [eiffel-users] another strange one
    The issue seems to be quite specific. For example, EiffelStudio uses EV_PIXMAP.save_to_named_path to export a diagram to the PNG format. It opens the target file for writing to check that this can be done, then it closes the file, and, finally, it calls `save_to_named_path (create {EV_PNG_FORMAT
  • Apr 23
    RE: [eiffel-users] another strange one
    Not so fast. While it's true, I did not see the CAT call when using save_to_named_path, I still failed to accomplish my objective. The issue is not related to the CAT call at all. I am attempting to create a simple image in a drawing area. So far, easy as pie. Then, I'm attempting to save the
  • Apr 23
    RE: [eiffel-users] another strange one
    Hi I just tried the save_to_named_path equivalent and did not see the problem. R -------- Original Message -------- Subject: [eiffel-users] another strange one From: Date: Mon, April 22, 2019 7:09 pm To: "Eiffel Users Group" Hi All I dusted off a
  • Apr 22
    another strange one
    Hi All I dusted off a feature I haven't used in, .. Never mind how long it's been. With 18.07, I tried saving a pixmap to a file using EV_PIXMAP.save_to_named_file (fmt, fname) Where: fmt was an instance of EV_PNG_FORMAT and fname was the ever-adventurous "test.png" The save_to_named_file
  • Apr 20
    Problems compiling Traffic library

    I attempted to install the Traffic library for the book "A Touch of Class" but was not able to compile the examples. EiffelStudio complained about a base2.ecf file. Error code: VD00

    General configuration parsing error. What to do: fix the configuration file.

    Could not open file: \base2.ecf $EIFFELBASE2\base2.ecf

    base2.ecf is found in where Windows installed Eiffel: C:\Program Files\Eiffel Software\EiffelStudio 18.11 GPL\unstable\library\base2.ecf The offending line of code seems to be this in the Traffic configuration files:

    I have attempted to change this configuration file pointing directly to where the file is, using the actual path, to no avail.

  • Apr 13
    RE: [eiffel-users] Re: pixmap transparency
    Hi Finnian The mere mention of SVG gets me all-a-twitter. Love them vectors, but (believe it or not) Windows is my platform of choice for such experiments, and I've moved to the more-or-less latest versions of stuff in that environment. I will, however, take a good long (or is that longing?)
  • Apr 13
    RE: [eiffel-users] pixmap transparency
    Hi Manu Yes, I was hoping to use this as a widget (i.e. take the easy way out), but I can do the drawing approach. I'll give that a try. Thanks R -------- Original Message -------- Subject: Re: [eiffel-users] pixmap transparency From: Emmanuel Stapf Date: Sat, April 13, 2019
  • Apr 13
    Re: pixmap transparency
    I forgot to mention Eiffel-Loop also has an Image Utilities library that does not depend on Vision2. This library has two classes for rendering SVG. 1. EL_PNG_IMAGE_FILE (Recommended) 2. EL_SVG_IMAGE_UTILS Again the Windows implementation requires GTK dlls compiled with Mingw,
  • Apr 13
    Re: pixmap transparency
    Hello Roger, there are some caveats but Eiffel-Loop has a solution for what you are asking. Specifically you can use class EL_DRAWABLE_PIXEL_BUFFER which serves as a wrapper for the Cairo 2D graphics library, and is compatible with Vision2 16.05. There is also a class for rendering SVG EL_SVG_PIX
  • Apr 13
    Re: [eiffel-users] pixmap transparency
    Hi Roger, Are you using an EV_PIXMAP because you want to use it as a widget? In this case, I suggest using an EV_DRAWING_AREA and draw the EV_PIXEL_BUFFER object on it. There are some limitations with EV_PIXMAP as it represents two completely different paradigm: an image and a container with
  • Apr 12
    pixmap transparency
    Hi All This is not a new topic, but I can't find a resolution, so here goes again. I need to be able to create transparent pixmaps (i.e. pixmaps that have some areas that are transparent). When working with EV_PIXMAPs , and applying an EV_BITMAP mask, the effect is only the mask or unmask the
  • Apr 10
    Re: Can't compile EiffelBuild project
    You're welcome!
  • Apr 09
    Re: Can't compile EiffelBuild project
    That sounds like good advice. Thanks! On Saturday, April 6, 2019 at 8:26:14 PM UTC-4, Larry Rix wrote: > > The other choice is to remove the precompile reference. We tended to shy > away from precompiles because of small issues. While there are simple > solutions and small problems, we found it
  • Apr 09
    Re: EiffelBuild Tips Window dropping last word of each line
    The issue isn't with EiffelBuild, but the tool tip window that is part of EiffelBuild. I agree with your points on visual builders in general though. The bug in the Tip of the Day dialog doesn't affect the usability of the tool in any way. It just gives a bad first impression - makes one think
  • Apr 09
    RE: [eiffel-users] Re: EiffelBuild Tips Window dropping last word of each line
    Thanks Larry; I couldn't agree more. R -------- Original Message -------- Subject: Re: [eiffel-users] Re: EiffelBuild Tips Window dropping last word of each line From: Larry Rix Date: Tue, April 09, 2019 11:22 am To: Eiffel Users The key
  • Apr 09
    Re: [eiffel-users] Re: EiffelBuild Tips Window dropping last word of each line
    The key to successful use of a generator is unchanging consistency. It hardly matters if code is hand-written or generated by a computer program. What counts is that the result is consistent in feature signature and naming. As long as it remains relatively constant, one can use the Bridge
  • Apr 09
    RE: [eiffel-users] Re: EiffelBuild Tips Window dropping last word of each line
    Thanks Larry. Does it help make up for my idiot-fest on missing libraries? :) I did have to do a fair amount up front to make it work with my custom vision classes, but by doing that, I ended up with a handy-dandy and relatively painless process. The key element is to have a kind of template
  • Apr 09
    RE: Re[2]: [eiffel-users] stuck on process
    Mea Culpa. I might need to adjust my prescription (whether that's eyeglasses or something else, I leave to your imagination) Suffice to say they'll be revoking my keyboarding license after this one. Sorry for the confusion R -------- Original Message -------- Subject: Re[2]: [eiffel-users] stuck
  • Apr 09
    Re: [eiffel-users] Re: EiffelBuild Tips Window dropping last word of each line
    R! Now, this is an interesting post. I was unaware anyone had taken EiffelBuild seriously. Good for you!
  • Apr 09
    Re[2]: [eiffel-users] stuck on process
    Indeed, this looks really strange. Could you send the ECF by a direct email or by submitting a bug report at support.eiffel.com? Thank you, Alexander Kogtenkov Понедельник, 8 апреля 2019, 22:05 +03:00 от r...@amalasoft.com: That makes sense, but what I am seeing does not. The base_process
  • Apr 08
    RE: [eiffel-users] stuck on process
    That makes sense, but what I am seeing does not. The base_process library is included - as evidenced by it showing up in the libraries section of the screen shot I attached. Here are the entries from the .ecf file. Apr 08
    stuck on process
    Hi All Perhaps the solution is obvious and I've just gone stupid, but it strikes me that this can't happen. I'm trying to access the process_factory function. Even after nuking EIFGENs, compiling from scratch, standing on one leg, and making noises like a chicken, the process classes seem to
  • Apr 08
    Re: [eiffel-users] stuck on process
    You need to include "base_process" library in your project. At the moment it is included in the system, because some library (called "process") uses it. But classes of a library become accessible to the project classes only when the library is listed directly. Hope this helps, Alexander
  • Apr 07
    RE: [eiffel-users] Re: EiffelBuild Tips Window dropping last word of each line
    I've used EiffelBuild quite a bit over the years, though not for an _end_product_. I have developed a library that works with what EiffelBuild creates, allowing me to bootstrap projects with EiffelBuild, and even make some GUI changes (using EiffelBuild) after incorporating almost entirely
  • Apr 07
    Re: EiffelBuild Tips Window dropping last word of each line
    I am unaware of anyone using EiffelBuild for production. It does not seem to be an issue with EiffelBuild, but with Visual Builders in general. The perform poorly in several ways: - Difficult to integrate custom visual classes. - Impossible to show deterministic complex visual changes in
  • Apr 07
    Re: Can't compile EiffelBuild project
    The other choice is to remove the precompile reference. We tended to shy away from precompiles because of small issues. While there are simple solutions and small problems, we found it easier to just not have precompiles at all.
  • Apr 06
    Re: Can't compile EiffelBuild project
    Solved it, found a menu item called Tools | Precompilation Wizard... After running the wizard, the missing folder is created. On Saturday, April 6, 2019 at 1:48:49 PM UTC-4, Stephen Smith wrote: > > Error code: C Compiler Error > > Error: External C/C++ compilation failed. > What to do: Check the
  • Apr 05
    Eiffel: passing argument to agent received as argument

    I'm really stuck in how to pass an argument to a second level of an Eiffel agent call. Hope my example is enough self explaining:

    main_call
        do
            b (agent d(?, ?))
        end
    
    b (a_proc: PROCEDURE[STRING])
        local
            l_something_else: INTEGER
        do
            l_something_else := 1
    --        z("a_line", a_proc(l_something_else)) -- How can I pass at this stade l_something_else to the d procedure!!!
        end
    
    d (line: STRING; something_else: INTEGER)
        do
    --        do_some_stuff_with_line (line, something_else)
            do_nothing
        end
    
    z (a_line: STRING; a_proc: PROCEDURE[STRING])
        do
            a_proc.call([a_line])
        end
    

    I would have liked to be able to do something like

    z("a_line", a_proc(?, something_else))
    

    But its not possible, as I try with the agent keyword, the a_proc argument is not recognized!

    So what would be the syntax? I even tried to add an argument to a_proc with a_proc.set_operands but am lost with the OPEN_ARGS class

    Implementation case

    If you need a goal... just imagine I'd like to have 2 different implementations of the d function, and in my case its using UT_CSV_HANDLER that I'd like to have 2 different functions for each line of a CVS

    The following code gives a Non-compatible actual argument in feature call

    Feature: import_from_csv_impl
    Called feature: import_from_csv_impl (a_rest_request: REST_REQUEST; a_procedure: PROCEDURE [DS_ARRAYED_LIST [STRING_8], INTEGER_64, STRING_8]): [detachable like items] detachable SIT_LINKED_LIST [MEASURING_POINT] from MEASURING_POI...
    Argument name: ia_name
    Argument position: 2
    Formal argument type: STRING_8
    Actual argument type: INTEGER_64
    Line: 258
                    ia_procedure.call (ia_measuring_point_id, ia_name)
    ->            end (?, l_measuring_point_id, l_s)
                l_csv_handler.read_file (l_is, l_partially_closed)
    

    The complete example:

    -- Main call
    import_from_abb_csv (a_rest_request: REST_REQUEST): detachable like items 
        do
            Result := import_from_csv_impl (a_rest_request, agent impl_for_each_csv_line_import_from_abb_csv)
        end
    
    -- Second call
    import_from_csv_impl (a_rest_request: REST_REQUEST; a_procedure: PROCEDURE[DS_ARRAYED_LIST [STRING_8], INTEGER_64, STRING]): detachable like items
        local
            l_csv_handler: UT_CSV_HANDLER
            l_is: KL_STRING_INPUT_STREAM
            l_measuring_point_id: INTEGER_64
            l_s: STRING
            l_partially_closed: PROCEDURE[DS_ARRAYED_LIST[STRING]]
        do
            l_s := "whatever"
            l_measuring_point_id := 12
            create l_csv_handler.make_with_separator (',')
    
            l_partially_closed := agent (i_al: DS_ARRAYED_LIST[STRING]; ia_measuring_point_id: INTEGER_64; ia_name: STRING; ia_procedure: PROCEDURE[INTEGER_64, STRING])
                do
                    ia_procedure.call (ia_measuring_point_id, ia_name)
                end (?, l_measuring_point_id, l_s)
    
            l_csv_handler.read_file (l_is, l_partially_closed)
    
        end
    
    -- end call
    impl_for_each_csv_line_import_from_abb_csv (a_csv_line: DS_ARRAYED_LIST [STRING_8]; a_measuring_point_id: INTEGER_64; l_cu_name: STRING)
        do
            -- do_my_business
        end
    
    
    -- for information signature of read_file is:
    --     read_file (a_file: KI_TEXT_INPUT_STREAM; a_action: PROCEDURE [DS_ARRAYED_LIST [STRING]])
    
  • Apr 05
    Eiffel: type conformance, how to give a type instead of an instance

    General

    I don't understand why there are like 2 generating_type kinds, the one with exclamation point, and the other not.

    My case

    I have a function returning a DB_SERVICE[G] from a given instance from a collection of db_services so that from another service I can retrieve it and call it. When I pass an instance generating_type to that function, the conforms_to returns True, as when I give ({ENUMERATE}).generating_type it doesn't.

    Why is that so?

    -- Humanly unreadable
    if attached {ENUMERATE_DB_SERVICE} {SIT_ENVIRONMENT}.app_instance.db_service_from_entity_type (item_prototype.charge_unit_relationship.secondary_prototype.an_index_relationship.secondary_prototype.generating_type) as l_enum_dbs then
    
    -- Humanly readable but not working
    if attached {ENUMERATE_DB_SERVICE} {SIT_ENVIRONMENT}.app_instance.db_service_from_entity_type (({ENUMERATE}).generating_type) as l_enum_dbs then
    

    My function

    db_service_from_entity_type (an_entity_type: TYPE[detachable DB_ENTITY]): detachable like db_services.item
        do
            across
                db_services as l_dbs
            until
                Result /= Void
            loop
                if l_dbs.item.item_prototype.generating_type.conforms_to (an_entity_type) then
                    Result := l_dbs.item
                end
            end
        ensure
            service_found: attached Result
        end
    

    Edit (20190405-11:26 UTC)

    As the screenshot shows, giving {ENUMERATE} instead of ({ENUMERATE}).generating_type doesn't work either

    enter image description here

  • Mar 29
    Eiffel: Creating a datetime with '' format

    Seems I'm wrong creating a datetime from string using this method, any idea why? The precondition violates on date_time_valid: date_time_valid (s, code)

    create l_date_time.make_from_string ("2019-03-28T15:28:02Z", "yyyy-mm-ddThh:mi:ssZ")
    
  • Mar 10
    Eiffel shortest statement for object creation and result of function

    If I'd like to add a DATE_TIME to a logger for example I'd like to avoid creating a local variable for that. Is there any similar statement as

    create {DATE_TIME}.make_now.formatted_out ("yyyy-mm-dd hh:mi:ss")
    

    which is not possible?

  • Feb 18
    Eiffel: a way to display assertion violation on runtime of executable

    As I have the choice on finalizing a project to keep assertions, I'd think that assertion violation would be shown or displayed on console (hopefully on stderr on linux). What would be the proper way to do such, like seems that I have to add it or enable something to get it...

  • Feb 11
    Eiffel: how do I set the command line arguments of an autotest?

    Some of my tests needs something like

    {EXECUTION_ENVIRONMENT}.arguments.separate_character_option_value ('l')
    

    to be attached (not Void), how do I set commandline arguments to eiffel autotest?

  • Feb 11
    Eiffel: a proper way to inherit from a class and convert Current object to it

    It's not the first time I'm trying to inherit from a class and convert an object to it, in this case extend functionalities of HTTP_CLIENT_RESPONSE with valid_http_response => response.status = 200, valid_http_json_body => validate json content, etc...

    For that, I'd like to inherit from HTTP_CLIENT_RESPONSE and add features and create my custom DB_ENTITY_HTTP_CLIENT_RESPONSE from an HTTP_CLIENT_RESPONSE

    test_case
        local
            l_http_client_r: HTTP_CLIENT_RESPONSE
            l_db_entity_http_client_r: DB_ENTITY_HTTP_CLIENT_RESPONSE
        do
            l_http_client_r := execute_get("someURL") -- returns an HTTP_CLIENT_RESPONSE
            l_db_entity_http_client_r := l_http_client_r
            assert("valid response", l_db_entity_http_client_r.valid_response)
        end
    

    it seems I've difficulties having the internal properties set... what would be the best way to do this? I had the same case trying to create a WATT class inheriting from NATURAL_32 which is an expanded.

    In my strategy, I tried to call in creator

    • a parent creation procedure
    • then call a deep_copy

    Here is the rest of my class attempt:

    class
        DB_ENTITY_HTTP_CLIENT_RESPONSE
    
    inherit
        HTTP_CLIENT_RESPONSE
    
    create
        make_from_http_client_response
    
    convert
        make_from_http_client_response ({HTTP_CLIENT_RESPONSE})
    
    feature -- Initialization
    
        make_from_http_client_response (a_client_response: HTTP_CLIENT_RESPONSE)
            do
                make (a_client_response.url)
                deep_copy (a_client_response)
            end
    
    feature -- Status report
    
        valid_response: BOOLEAN
            do
                Result := status = 200
            end
    

    The only way I found working for now is by setting all attributes to other which is the semantic of deep_copy normally...

    make_from_http_client_response (a_client_response: HTTP_CLIENT_RESPONSE)
        do
            make (a_client_response.url)
            set_body (a_client_response.body)
            set_http_version (a_client_response.http_version)
            set_error_occurred (a_client_response.error_occurred)
            set_error_message (a_client_response.error_message)
            set_raw_header (a_client_response.raw_header)
            set_status_line (a_client_response.status_line)
            ... I surely forgot something...
        end
    
  • Feb 10
    Eiffel: is there a way with do_all or do_if to search for an element in a collection without having to write a whole feature?
    across
        collection as l_item
    until 
        Result /= Void
    loop
        if l_item.item.name.is_equal ("foo") then
            Result := l_item.item
        end
    end
    

    is there a way and if so which one to do something like

    collection.do_if (agent ...)
    

    an example of use can be:

    search_item_with_id (an_id: INTEGER)
            -- Moves items cursor if not found is_after
        local
            l_found: BOOLEAN
        do
            from
                items.start
            until
                items.after or l_found
            loop
                l_found := items.item.primary_key = an_id
                if not l_found then
                    items.forth
                end
            end
        ensure
            cursor_on_element_if_found: not items.after implies items.item.primary_key = an_id
        end
    
  • Feb 01
    Eiffel: ODBC Dealing with BIGINT

    Eiffel

    Seems I'm getting an INTEGER_32_REF from a BIGINT from ODBC with Eiffel DB_SELECTION.cursor. Sometimes I seem to have the adecuate value, but sometimes not...

    946383958 => good INTEGER_32_REF (id->4 of following table)
    9475984837 => 886050245 WRONG INTEGER_32_REF (id->4 of following table)
    
    646383958 => good INTEGER_32_REF (id->3 of following table)
    6475984837 => -2113949755 WRONG INTEGER_32_REF (id->4 of following table)
    
    ...
    

    It seems to behave like not treating the BIGINT and giving the INTEGER_32_REF value directly interpreted from the DB value, typical case passing over the 2^32

    Postgresql

    Having a table with following data as electricity_amount BIGINT NOT NULL DEFAULT 0

    id |   a_date   |  amount   | electricity_amount | consumption_sector_id | electricity_rate_id
    ----+------------+-----------+--------------------+-----------------------+---------------------
    1 | 2019-01-01 | 746383958 |         7475984837 |                     1 |                   1
    2 | 2019-02-01 | 846383958 |         8475984837 |                     1 |                   1
    3 | 2019-03-01 | 646383958 |         6475984837 |                     1 |                   1
    4 | 2019-04-01 | 946383958 |         9475984837 |                     1 |                   1
    

    enter image description here

  • Jan 31
    Eiffel: non-compatible actual argument in feature call

    I don't understand why it is so.

    • If I say attached {G} it works
    • If I say nothing which would be the expected behavior for me calling_entity: detachable RELATED_DB_ENTITY should be conform (once attached) to G which is -> DB_ENTITY
    • If I say DB_ENTITY it doesn't
    • If I say RELATED_DB_ENTITY either does it pass

    Why do I have to specify {G}???

    SIT_HANDLER

    class
        SIT_HANDLER[G -> DB_ENTITY create default_create, make_from_db_service, make_from_json end]
    
    feature --
    
        some_feature
            do
                if attached {G} l_rest_request.calling_entity as l_calling_entity then
                    db_service.set_item_prototype (l_calling_entity) -- Complains here!!!!!!!!!!!!
                    db_service.load_with_relationships (l_rest_request)
                ...
            end
    end -- class
    

    REST_REQUEST

    class
        REST_REQUEST
    
    feature -- Access
        calling_entity: detachable RELATED_DB_ENTITY -- RELATED_DB_ENTITY inherits DB_ENTITY
    ...
    end -- class
    

    DB_SERVICE

    class
        DB_SERVICE [G -> DB_ENTITY create default_create, make_from_db_service, make_from_json end]
    
    feature -- Status setting
    
        item_prototype: G
    
        set_item_prototype (v: like item_prototype)
            do
                item_prototype := v
            ensure
                item_prototype = v
            end
    
    ...
    end -- class
    

    enter image description here

  • Jan 30
    Eiffel: setting a constant with reference to other class constant

    How to set a constant refering to another class constant in Eiffel?

    Something like that doesn't compile unfortunately

    Default_log_level: like {MY_LOGGER}.log_level = {MY_LOGGER}.Log_level_info
    
  • Jan 27
    Eiffel: REAL_32.to_double gives a strange value

    Trying to transform a real_32 to real_64, I'm getting

    real_32: 61.55
    real_64: 61.54999923706055 
    

    Am I wrong with the to_double function?

    enter image description here

  • Jan 26
    Eiffel: multilines string formating

    Didn't find a better way to format a multiline string than this way... seems complicated. What would be the best way to format this type of code?

    l_qry := "SELECT%
        %    * %
        %FROM %
        %    enumerate %
        %WHERE %
        %    " + {like item_prototype}.Primary_key_db_column_name + " = " + l_category_id + " %
        %UNION %
        %   SELECT %
        %       e.* %
        %   FROM %
        %       enumerate e %
        %INNER JOIN  %
        %   enumerates_leaves s ON s." + {like item_prototype}.Primary_key_db_column_name + " = e." + {like item_prototype}.Category_db_column_name + " %
        %) SELECT * FROM enumerates_leaves WHERE enumerates_leaves." + {like item_prototype}.Category_db_column_name + " IS NOT NULL;"
    
  • Jan 26
    eiffel: does the across structure move the cursor of current iterable structure?

    I was wondering if the across structure uses an own cursor or a separated one? does it ensure that cursor hasn't moved and if so how can it be expressed for other examples?

  • Jan 25
    Eiffel: how to use old keyword in ensure contract clause with detached

    How to use the old keyword into ensure clause of a feature, the current statement doesn't seem to be valid at runtime

    relationships: CHAIN -- any chain
    
    some_feature
        do
        (...)
        ensure
            relationship_added: attached relationships as l_rel implies
                attached old relationships as l_old_rel and then
                l_rel.count = l_old_rel.count
        end
    

    For the whole case, following screenshots demonstrate the case

    start of routine execution enter image description here end of routine execution enter image description here

  • Jan 24
    Eiffel: void safety, a concise way to test if an object exists and then call its feature

    I was wondering if there is a clearer statement then

    if not attached foo then
        create foo
    end
    if attached foo as l_foo then
        l_foo.bark
    end
    

    as

    if not attached foo then
        create foo
        foo.bark
    else
        foo.bark
    end
    

    would repeat the foo.bark and obviously I want to avoid it... and even the last statement won't compile with void-safety as foo on else could be void...

  • Jan 24
    Eiffel: a way to ensure db_cursor: DB_RESULT has not moved

    I'm looking for a way to ensure that cursor: detachable DB_RESULT from DB_SELECTION class hasn't moved. I didn't find any method to get access to it. Does the following statement ensure it?

        ensure
            cursor_not_moved: a_db_service.cursor.is_equal(old a_db_service.cursor)
    

    The item method for example doesn't seem to ensure that even if it is only consulting a value of a given row index

  • Jan 13
    Eiffel: Error: variable is not properly set. in make calling default_create or any parent calling/redefining default_create

    Not sure exactly, but it makes various time I got a Error: variable is not properly set. in creation procedures' calling order. I figured out that creating class attributes before calling default_create seemed to solve the problem. Why is that so? It doesn't seem that default_create calls something in my make routine??!!!

    Try to make an example even if I don't think I can reproduce it with a simple example...

    Working

    class A
    
    feature
    
        attr: B
    
        make
            do
                create attr
                default_create
            end
    
    end
    

    Error: variable is not properly set.

    class A
    
    feature
    
        attr: B
    
        make
            do
                default_create
                create attr
            end
    
    end
    
  • Jan 13
    Eiffel: change the signature of a inherited feature

    How is the correct way to change the signature of a feature in Eiffel if any? if there is no option as I understood, how would be the correct way to define in a parent class that there will be a feature to be able to select but still don't know arguments number and types (types are resolvable with polymorphism...)

    Is the only available playing with polymorphism having an argument into class a to select of type ANY?

    class SELECTABLE

    class SELECTABLE
    
        select
            deferred 
            end
    
    end -- class
    

    class DB_SERVICE

    class DB_SERVICE
    
    inherit
        SELECTABLE
            (...)
    
    feature -- Status setting
    
    
        select (a_db_connection: DB_CONNECTION)
            local
                l_qry: STRING
            do
                item := first_item_from_qry (l_qry)
            end
    
    end -- class
    
  • Jan 11
    Eiffel: Error: type is based on unknown class

    Trying to implement some test cases on EWF application with rest web services and JSON objects, I'm gettint a Error: type is based on unknown class. after adding my first class inheriting from EQA_TEST_SET

    Seems pretty complicated to implement test cases for a simple curl -v --header "Content-Type: application/json" --request POST --data '{"id":11,"name":"someName","enumerate":{"id":5}}' http://localhost:9997/someEntity curl command! How can I do that? Where is there some example? I'm trying to copy-paste the example from $ISE_LIBRARY/contrib/library/web/framework/ewf/wsf/tests/src/test_wsf_request.e as a base, but for the moment....

    I can find the class when browsing the dependencies as shown in screenshot, but the compiler not! strange behaviour!

    My app_ewf_app.ecf

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <system xmlns="http://www.eiffel.com/developers/xml/configuration-1-19-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-19-0 http://www.eiffel.com/developers/xml/configuration-1-19-0.xsd" name="sit_ewf_app" uuid="0AB55F0B-014A-4775-B93F-ACC31C9300D5">
        <target name="common" abstract="true">
            <file_rule>
                <exclude>/CVS$</exclude>
                <exclude>/EIFGENs$</exclude>
                <exclude>/\.svn$</exclude>
            </file_rule>
            <option warning="true">
                <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
            </option>
            <capability>
                <catcall_detection support="none"/>
                <concurrency support="scoop"/>
                <void_safety support="all" use="all"/>
            </capability>
            <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
            <library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
            <library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf"/>
            <library name="lexical" location="$ISE_LIBRARY\contrib\library\gobo\library\lexical\library.ecf"/>
            <library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
            <library name="odbc" location="$ISE_LIBRARY\library\store\dbms\rdbms\odbc\odbc.ecf"/>
            <library name="store" location="$ISE_LIBRARY\library\store\store.ecf"/>
            <library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
            <library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
            <library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension.ecf"/>
            <cluster name="database" location=".\database\" recursive="true"/>
            <cluster name="entity" location=".\entity\" recursive="true"/>
            <cluster name="error" location=".\error\" recursive="true"/>
            <cluster name="handler" location=".\handler\" recursive="true"/>
            <cluster name="logger" location=".\logger\" recursive="true"/>
            <cluster name="misc" location=".\misc\" recursive="true"/>
            <cluster name="relationship" location=".\relationship\" recursive="true"/>
            <cluster name="rest" location=".\rest\" recursive="true"/>
            <cluster name="service" location=".\service\" recursive="true"/>
            <cluster name="sit-json" location=".\sit-json\" recursive="true"/>
            <!-- TESTS -->
            <cluster name="tests" location=".\tests\" recursive="true"/>
        </target>
        <target name="ewf_app_any" extends="common">
            <root class="EWF_APP" feature="make_and_launch"/>
            <capability>
                <concurrency support="scoop"/>
            </capability>
            <library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>
            <library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>
            <library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>
            <cluster name="launcher" location=".\launcher\">
                <cluster name="any_launcher" location="$|any\"/>
            </cluster>
            <cluster name="src" location=".\src\" recursive="true"/>
        </target>
        <target name="ewf_app_standalone" extends="common">
            <root class="EWF_APP" feature="make_and_launch"/>
            <capability>
                <catcall_detection support="none"/>
                <concurrency support="scoop"/>
                <void_safety support="all"/>
            </capability>
            <variable name="httpd_ssl_disabled" value="true"/>
            <library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone-safe.ecf"/>
            <library name="eel" location="$ISE_LIBRARY\contrib\library\text\encryption\eel\eel.ecf"/>
            <library name="ewsgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\ewsgi\ewsgi.ecf"/>
            <library name="http_client" location="$ISE_LIBRARY\contrib\library\network\http_client\http_client.ecf"/>
            <library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
            <cluster name="launcher" location=".\launcher\">
                <cluster name="default_launcher" location="$|default\"/>
            </cluster>
            <cluster name="src" location=".\src\" recursive="true"/>
        </target>
        <target name="ewf_app_cgi" extends="common">
            <root class="EWF_APP" feature="make_and_launch"/>
            <capability>
                <concurrency support="scoop" use="none"/>
            </capability>
            <library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
            <cluster name="launcher" location=".\launcher\">
                <cluster name="default_launcher" location="$|default\"/>
            </cluster>
            <cluster name="src" location=".\src\" recursive="true"/>
        </target>
        <target name="ewf_app_libfcgi" extends="common">
            <root class="EWF_APP" feature="make_and_launch"/>
            <capability>
                <concurrency support="scoop" use="none"/>
            </capability>
            <library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
            <cluster name="launcher" location=".\launcher\">
                <cluster name="default_launcher" location="$|default\"/>
            </cluster>
            <cluster name="src" location=".\src\" recursive="true"/>
        </target>
        <target name="ewf_app" extends="ewf_app_any">
        </target>
    </system>
    

    My error

    enter image description here

  • Jan 11
    Eiffel: unknown identifier `cursor` on LINKED_LIST[STRING]

    I have an unknown identifier on the local like some_values.cursor, I really don't understand why!

    qry_update_set_fields (some_keys, some_values, some_unstored_field_names: LINKED_LIST[STRING]): STRING
        require
            same_some_keys_some_values_count: some_keys.count = some_values.count
        local
            l_val_c: like some_values.new_cursor
        do
            Result := ""
            l_val_c := some_values.new_cursor
            across
                some_keys as l_key_c
            loop
                Result := l_key_c.item + "=" + l_val_c.item + ","
                l_val_c.forth
            end
            if Result.ends_with (",") then
                Result.remove_tail (1)
            end
        ensure
            dont_modify_parameters: old some_keys.is_equal (some_keys) and old some_values.is_equal (some_values)
        end
    

    working

    l_val_c: LINKED_LIST_CURSOR [STRING]
    

    Neither working

    l_val_c: LINKED_LIST_CURSOR [like some_values.item]
    
  • Jan 11
    Eiffel: Call use obsolete feature. Call to feature `to_string_8': Use `name_32' instead

    I have a warning I cannot get rid of neither understand:

    Eiffel: Call use obsolete feature. Call to feature `to_string_8': Use 'name_32' instead

    item_prototype is a DB_SERVICE where I redefine out

    if attached {APP_CONFIGURATION}.application_instance.selected_entity_primary_key ({SIT_UTIL}.class_name_lowercase ({like item_prototype})) as l_pk then
    

    enter image description here enter image description here

    One more point is that I wasn't able to copy the warning msg to my clipboard, how do I do that? if there is a way into EiffelStudio.

  • 2018, Dec 26
    Eiffel Web Framework, app run on linux raises `Address already in use: IO_FAILURE raised`

    After stopping an EWF app and starting it again in a Address already in use: c_bind Address already in use: IO_FAILURE raised

    enter image description here

    As explained here, it seems that TCP socket timeout is not available for some time before being released by OS.

  • 2018, Dec 20
    Eiffel library: JSON_OBJECT.item and common method to get content

    If I want to have the content value as string of a JSON_OBJECT.item ("key") without having to

    some_json_value_as_string: STRING
        do
            if attached {JSON_STRING} l_json_o as l_s then
                Result := l_s.unescaped_string_8
            elseif attached {JSON_NUMBER} l_json_o as l_n then
                Result := l_n.item.out
            else
                check
                    you_forgot_to_treat_a_case: False
                end
            end
        end
    

    for a json object like

    {
    |       |       "datasource_name": "DODBC",
    |       |       "datasource_username": "dev_db_usr",
    |       |       "datasource_password": "somePassword",
    |       |       "ewf_listening_port": 9997,
    |       |       "log_file_path": "/var/log/ewf_app.log",
    |       |       "default_selected_company": 1,
    |       |       "default_selected_branch": 1,
    |       |       "default_selected_consumption_sector": 1,
    |       |       "default_selected_measuring_point": 1,
    |       |       "default_selected_charge_unit": -1
    |       }
    

    the {JSON_VALUE}.representation with io.putstring is:

    datasource_username=dev_db_usr
    

    and not the value only!!!

    is there a way to do that? I didn't find intuitive the different methods of JSON_VALUE: values as the out method gives the class and pointer address, which is really far from a string representation of the associated json object for me...

  • 2018, Dec 20
    How do I initialize and fill a linked list in Eiffel?

    Here's what I have so far.

    create {LINKED_LIST[INTEGER]} list.make
    from
        i := 0
        list.start
    until
        i = 11
    loop
        list.put(i)
        i := i + 1
        list.forth
    end
    

    The debugger points to line list.put(i). I think the problem is that list is not properly initialized? I'm having a bit of an issue with figuring out how to use linked_list because I can't find any proper tutorial to help with. As you can see, I am just trying to write a LINKED_LIST program that adds numbers [0,10] in a linked list. Not a school project. Just practicing ahead of an upcoming course. Please help!

  • 2018, Dec 17
    Eiffel: How do I handle timezones?

    I didn't find any notion of timezone DATE_TIME class and TIME class. Am I wrong?

    How do I handle timezones with Eiffel library?

    Is there a way to specify it from the {DATE_TIME}.formated_out ("YYYY-MM-DD [0]hh:[0]mi:[0]ss")

    Is there a setter for timezone?

    I already got this problem with the logger which is logging with UTC...

    The only workaround I found was l.hour_add (-3) before the formated_out which is really dirty

  • 2018, Dec 17
    How to check if file exists in Eiffel
    feature 
    
        open_file_sample
            local
                l_file: UNIX_FILE_INFO
                l_path: STRING
            do
                make
                l_path := "/var/log/syslog"
                l_file.update (l_path)
                if l_file.parent_directory.exists and then l_file.parent_directory.is_writtable then
                    create l_file.make
                end
                 -- AS the above statement doesn't exist!
                check
                    syslog_file_exists_and_is_readable: l_file.exists and then l_file.is_readable
                end
            end
    

    Is this the proper way to check for file existence in Eiffel?

    I was wondering if there is a way not to create 2 objects. I'll complete my check with following statement:

    • define path `l_file_path := "/some/path/with_file.log"
    • check if parent directory exists and has rights to write into
    • create log file
  • 2018, Dec 13
    Eiffel compilation through Makefile and `dpkg-buildpackage -us -uc` generating an error
  • 2018, Dec 10
    How to use CURSOR_TREE class in Eiffel?

    Does this work for removing first two children from a node?

    remove_children(current_node : CURSOR_TREE[EXPRESSION]) 
            do
                current_node.down (1)
                current_node.remove
                current_node.forth
                current_node.remove
            end
    

    Or does that only remove the current_node?

  • See more ...