Code Monkey home page Code Monkey logo

massspring's Introduction

Hi there ๐Ÿ‘‹

My name is Pooya Shams kolahi and I'm a student of Allame-helli highschool in Tehran, Iran.

here are some of my coolest projects:

  • massspring : A physical simulator.
  • face-tracker : A simple assistant for scrolling through pages only moving your head. (no hands required!)
  • Digi-Board : An open-source breadboard simulator used to predict the outcome of circuits without wiring them in real world. (A collaboration with my friend Ali Mozdian)

I'm currently busy with school. That means all of these projects are abandoned for now, but all pull requests are welcome Although I might not check them so frequently. If you have created a pull request to any of my repositories please be patient, I will review it one day.

Have a nice time

massspring's People

Contributors

pooya-shams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

massspring's Issues

clients might not receive data from handle_client function in networklib.py properly.

when receiving data from the server created by handle_client, I sometimes can not get the full data mostly because I just try to receive 4096 bytes of data and if I get all 4096 bytes of it, I assume that there is more and try to receive again until the received data is less than 4096 bytes.
this approach causes tons of bugs so I thought maybe I could change the way handle_client work so that it sends the length of the data first and then sends the actual data.

isinstance instead of type(...) == ...

there are bunch of asserts in functions in all files that use type(obj) == type to check if the passed object is from the right type or not. python suggests that it's better to use isinstance instead of this.
the code will change from something like this:

assert type(obj) == type, TypeError("error msg")

to this

assert isinstance(obj, type), TypeError("error msg")

response of analyse_request is not splitable

the response that analyse_request returns is just simple concatenation of all little responses from functions. they are not really easy to split and determine which part of the response is for which request.
I can do 2 things to solve this.

  • 1 : use another character as delimiter of the responses and concatenate them using this special character.
  • 2 : send multiple packets. client can not send all it's requests for one at once and receive all of them in that frame but it can send all of them at one request and receive in multiple responses. so we will send a response for each of the requests that the client sent us. However, there is a little problem with this approach. there are not a fixed number of responses being transferred so if the client makes a mistake and doesn't do a recv and/or do an extra one, both programs will halt and misfunction. but it is possible to manage it.

bug in networklib.py/start_sever_mainloop

this function won't respond to the dictionary passed as the kwargs for the mainloop function, whatever they are. seems to be because the dictionary which is passed to the start_server_mainloop will not be used in the function and is not passed anywhere.

analyse_request is so limited.

analyse_request function in networklib.py can only handle three types of requests which are all hardcoded. also the delimiter ('|') is not optional and can not be changed.
this function should be refactored in a way that can handle every possible request for the value of any variable specified by the user.
this can be done in a way that uses eval function but I hate eval and exec so I will probably implement it in a way that the function gets a dictionary with bytes objects as keys and functions as values. the function will act like getters for specified variable.
for example assume that the user wants the server to be capable of sending the width of the window. in this case the dictionary that will be passed to analyse_request and the function that is given as the value for "WINW" should be something like this:

def get_winw():
    return ms.WINW
{b"WINW": get_winw}

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.