Forum

  • Jun 15
    Re: [eiffel-users] Code Analysis
    This is excellent news!
  • Jun 15
    Re: [eiffel-users] Code Analysis
    At the moment, the option to suppress certain code analyzer messages is supported at the class level. This is done by using the note tag "ca_ignore" like note ca_ignore: "CA032", "CA032: very long routine" Only the first string "CA032" is taken into account, the second one is ignored,
  • Jun 15
    Code Analysis
    Hi folks, It would be nice to have a note-level mechanism to exempt certain routines from certain analysis failures. 2 CA032 Very long routine implementation HTML_ELEMENT_TEST_SET 36, 2 70 Routine 'html_element_creation_test' contains 92 instructions, which is above the defined threshold of 70.
  • Jun 15
    Re: Code Analysis
    Moreover—the whole thing breaks down if I do something like: 1. Misspell "exempt" as a note clause tag. 2. If I typo the code and write a code that does not exist. Also—if I type a wrong code, but a real code, then I will still get the failure when I re-analyze the code. Hopefully, upon inspectio
  • Jun 15
    Re: Code Analysis
    As an extension to this idea—the Code Analyzer could in fact create a wholly separate list of classes and routines that still fail, but which have been exempted. This would allow me to open the "exempted-but-still-failing" list when and if I choose or just continue to ignore it until I am ready
  • Jun 14
    RE: Re[2]: [eiffel-users] issue with EV_SPIN_BUTTON
    Thanks Alexander. Clear and rational. R -------- Original Message -------- Subject: Re[2]: [eiffel-users] issue with EV_SPIN_BUTTON From: "'Alexander Kogtenkov' via Eiffel Users" Date: Fri, June 14, 2019 9:30 am To: eiffel...@googlegroups.com Thank you for the update.
  • Jun 14
    Re[2]: [eiffel-users] issue with EV_SPIN_BUTTON
    Thank you for the update. Agent types are using TUPLE to mimic arbitrary number of arguments. And the conformance rule for tuples allows reattachments like empty_tuple := non_empty_tuple because there is nothing wrong to supply some values when no values are needed. This does not work well
  • Jun 14
    RE: [eiffel-users] issue with EV_SPIN_BUTTON
    Hmmm, indeed. I'll look into that, thanks. BTW, the seg fault is occurring with 18.1 on Windows 10 (so not a recent change to Eiffel, but might be a change to Windows). I'll try Linux later this AM and see what happens there. Thanks R -------- Original Message -------- Subject: Re: [eiffel-user
  • Jun 14
    RE: [eiffel-users] issue with EV_SPIN_BUTTON
    FOUND IT! With some more experimentation, I found the problem. It was a combination of factors, mostly of the the ID 10t variety. The agent I had added to the text change and return actions was the same agent that I added to the change actions. The compiler implied (by its silence) that I was
  • Jun 14
    Re: [eiffel-users] Has the segmentation fault associated with once ("OBJECT") been fixed?
    A self-contained example demonstrating the issue would be great to have. Then, we can test whether it works with the latest version of EiffelStudio. Thank you, Alexander Kogtenkov Четверг, 13 июня 2019, 17:29 +03:00 от Finnian Reilly : Hello all does anyone know if this bug
  • Jun 14
    Re: [eiffel-users] issue with EV_SPIN_BUTTON
    Mmm... strange. I'm using Eiffel Studio 19.05 on PCLinuxOS (64 bits) with Gtk 2.24.32 and Gtk 3.24.8 and all its requirements and it works. I remember I had to install other library due to a warning when I launched estudio from a terminal. But I don't remember the name of the library. Germán
  • Jun 14
    RE: [eiffel-users] issue with EV_SPIN_BUTTON
    I'm fully aware of how to assign actions. The issue is that doing so, I get a seg fault. I can catch change_actions, but the text change and return actions blow up. R -------- Original Message -------- Subject: Re: [eiffel-users] issue with EV_SPIN_BUTTON From: Germán_Arias
  • Jun 13
    Re: [eiffel-users] issue with EV_SPIN_BUTTON
    Hi, Like this: spin_button.text_change_actions.extend (agent change_text) spin_button.return_actions.extend (agent return_action) then: change_text do print("Text changed %N") end return_action do print("Return %N") end
  • Jun 13
    RE: [eiffel-users] issue with EV_SPIN_BUTTON
    Forget what I said about return_actions. That too blows up with a seg fault :( R -------- Original Message -------- Subject: [eiffel-users] issue with EV_SPIN_BUTTON From: Date: Thu, June 13, 2019 1:22 pm To: "Eiffel Users Group" I tried using an
  • Jun 13
    issue with EV_SPIN_BUTTON
    I tried using an EV_SPIN_BUTTON, and added an agent to its change_actions, without issue. Works just fine. Then, rummaging through the class, I found that it also had text_change_actions, triggered on a change to the text in the accompanying text field. Seemed like something I should use.
  • Jun 13
    Has the segmentation fault associated with once ("OBJECT") been fixed?
    Hello all does anyone know if this bug has already been fixed since version 16.05 of EiffelStudio? If not I can submit a bug report. Details The following code construct causes a segmentation fault in the finalized executable during calls to `Node_source'. Execution in workbench mode is as
  • Jun 12
    RE: [eiffel-users] unable to set font in rich text
    Hi German Very good point. That could help explain the need to apply the character format to the region. I have yet another observation: the behavior on Linux is quite different. Using the identical code, the font family _is_ applied. Hmmm. Thanks again R -------- Original Message --------
  • Jun 12
    Re: [eiffel-users] unable to set font in rich text
    Hi, I have not experience with this class. But add text programmatically is not the same that add text typing. The documentation for "set_current_format" say "Apply format to current caret position, applicable to next typed characters.". But since you are adding the text programmatically, the
  • Jun 12
    RE: [eiffel-users] unable to set font in rich text
    I created a brand new program, from the estudio opening menu (vision2, no concurrency, no menu bar, no toolbar, no about dialog). I reproduced the tests I had in my larger program, with the same results. A few observations: 1. It seems the 'set_current_format' does not behave as its feature
  • Jun 12
    RE: [eiffel-users] unable to set font in rich text
    Thanks for replying, but the example sheds no additional light on the issue. Neither do any of my earlier uses of the rich text widget. I will investigate further (unless somebody can offer additional insight into the problem). The issue is not that one cannot set the character format for a
  • Jun 12
    Re: [eiffel-users] unable to set font in rich text
    Hi, Check the rich_text example in the vison2 folder. The "examples" folder is located in the same folder where Eiffel is installed. Regards. On 11/06/19 14:34, r...@amalasoft.com wrote: Hi All While playing around with the EV_RICH_TEXT widget today, I discovered a problem, and I have no idea
  • Jun 11
    unable to set font in rich text
    Hi All While playing around with the EV_RICH_TEXT widget today, I discovered a problem, and I have no idea how to work around it. It seems that, most of the time, I am unable to apply character formatting to a region, or at least not completely, when that format includes a non-default font
  • Jun 11
    Configuration Files Made Easy
    Configuration Files Made Easy Introduction I have been busying adding some new classes to Eiffel-Loop that completely automate saving and restoring Eiffel objects form XML configuration files. The automation is made possible by combining the reflection classes from Base Library: Runtime and the
  • Jun 11
    Re: [eiffel-users] void-safe arg parsing
    Code based on Vision classes needs to follow a certain pattern of initialization in void-safe mode as described at https://www.eiffel.org/doc/solutions/Converting_EiffelVision_2_Systems_to_Void-Safety Therefore, if argument parsing happens in a class based on a Vision class, most likely,
  • Jun 11
    RE: [eiffel-users] void-safe arg parsing
    Well stated; very clear. I'll play around a little to see if there's a handy (and safe) seam to exploit, and maybe suggest a generalization (assuming I actually find one). Thanks Alexander. R -------- Original Message -------- Subject: Re: [eiffel-users] void-safe arg parsing From: "'Alexander
  • Jun 11
    € Symbol from commandline (Arguments)
  • 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 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
  • See more ...