Giter Site home page Giter Site logo

web2py_tutor's People

Contributors

dz0 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

web2py_tutor's Issues

Hint improvements

  • ignore quote diffs for string notation ' vs " (vs """)? -- maybe use ast.literal_eval

  • use smarter tokenizer -- for unmached parentheses

  • be smarter if input token is part of expected

  • option to split stuff inside string token

  • smarter option for ordering checking

Scatter ideas

scatter can split code lines into chunks and ask to join them back with placeholders

  • put back comments
  • put back code lines (having comments left in place)
  • put back either code or comment from line
  • put back one token (n tokens) per line

error if unicode characters in placeholder (except in comment)

tutor.py | UnicodeDecodeError: 'utf8' codec can't decode byte 0x85 in position 50: invalid start byte | 

Traceback (most recent call last):
  File "/home/jurgisVCS/web2py/gluon/restricted.py", line 227, in restricted
    exec ccode in environment
  File "/home/jurgisVCS/web2py/applications/web2py_tutor/controllers/tutor.py", line 266, in <module>
  File "/home/jurgisVCS/web2py/gluon/globals.py", line 417, in <lambda>
    self._caller = lambda f: f()
  File "/home/jurgisVCS/web2py/applications/web2py_tutor/controllers/tutor.py", line 85, in evaluate
    problems = placeholder_smart_compare( ph, expected=answer, limit_hints=5, human_nr=nr+1 ) # it gives hints about problems
  File "applications/web2py_tutor/modules/test_helper_4automation.py", line 256, in placeholder_smart_compare
    msgs = hints_by_token_comparison(placeholder, expected, **hints_kwargs)
  File "applications/web2py_tutor/modules/test_helper_4automation.py", line 171, in hints_by_token_comparison
    msgs = messages_by_fragments(input, expected, required=missing, unnecessary=unnecessary )
  File "applications/web2py_tutor/modules/test_helper_4automation.py", line 209, in messages_by_fragments
    msgs .append( msg % code_highlight(item)  )
UnicodeDecodeError: 'utf8' codec can't decode byte 0x85 in position 50: invalid start byte

scatter drag and drop UI alpha

Seems to do the job

<script>
    $(function () {
        $(".draggable").draggable({
            revert: function(valid) {
                if(!valid) {
                    //Dropped outside of valid droppable
                    console.log('bla');
                }
            }
        });
        


        $(".droppable").droppable({
            tolerance: "pointer", // http://api.jqueryui.com/droppable/#option-tolerance  // "touch" seems buggy (because of margin/pading?)?
            hoverClass: "onover",
            
            drop: function (event, ui) {
                console.log("drop");
                
                // d = ui.draggable;
                var dwidth = $(ui.draggable).parent().width();
                var dheight = $(ui.draggable).parent().height();
                // console.log( "dwidth", dwidth );
                // console.log( "dheight", dheight );
                
                var ex_dropped =  $(this).data('content');
                console.log( "ex_dropped", ex_dropped );
                
                if (ex_dropped) { // return previously dropped to its initial place
                    ex_dropped.position({
                    my: "left top",
                    at: "left+5 top-10",
                    of: ex_dropped.parent()
                  });
                  
                  
                
                }
                    
                
                $(this).addClass("filled")
                    .width( dwidth + 20 ).height( dheight )
                    
                    .data('content', ui.draggable );
                    
                $(this).next()
                    .prop('value', $(ui.draggable).text());
               

                
                $(ui.draggable).position({
                    my: "left top",
                    at: "left top-10",
                    of: $(this)
                  });
                
            }, 
            
            out: function( event, ui ) {
                $(this).removeClass("filled")
                        .removeData('content')
                        .next().prop('value', '')
                        // .width( $(this).data('initialWidth') );
                        .width( 30 ).css('width', 30);
                        
                
                
            }
        });


    });
    
    
     // $('.ui-droppable').each( function(){ 
                    // $(this)
                    // .data('initialWidth', $(this).width())
                    // .data('initialHeight', $(this).height());
                // }); 

    // https://stackoverflow.com/a/9879788/4217317
//    # http://jsfiddle.net/vjGY4/152/
//    # https://stackoverflow.com/questions/9317293/jquery-draggable-event-when-dropped-outside-of-parent-div
//    # maybe https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_ondragenter

</script>


<style>
    .filled {
        border: 1px silver solid;
    }

    .droppable {
        background-color: yellow;
        width: 30px;
        __height: 50px;
        __padding: 0.2em;
        __float: left;
        __margin: 5px;
    }
    .onover{
        background-color: #ffaa00;
    }
    
    input[type=text] {display: none}
    
</style>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.