Dear Scroll bars, I Hate You

As a brief update, no onscroll is not fast enough. Time for plan 4. (1 and 3 both failed, and i just skipped plan 2).

I did find some code that seemed to be able to get the width of the scroll bar independant of browser. I will look into more things like this as I continue to work on how the spreadsheet looks and how it is formatted.

-Asher

Presentation 2 and a bad git merge

Last Friday we gave our second presentation. It was a very good presentation in my opinion. We got a lot of good feedback and most of RCOS was able to participate in the presentation. After the presentation a few people even forked our repository and helped us implement some back-end functionality. Right now I am still trying to figure out the best way to implement the scrolling functionality. I am currently messing with the onscroll event listener to see if that can react fast enough to scrolling, if it can then our program will become very efficient when rendering the screen and the screen will be able to be completely refreshed when text boxes are edited instead of just a single text box being cleared. If this dosent work I think we will try to do something hackish with the scroll bars, like make their own div with only a scroll bar, or make our own scroll bars. I don’t like either of these ideas though. I also learned the difference, when trying to undo a commit, between git reset –hard and git checkout, and how to fix your repo if you pick checkout and accidentally go into a headless state (not fun). You can view the slides for the presentation here: Briefcase.

Recent Server Explosion and Second Presentation of the Semester

So I was hoping to have saving and loading files under user accounts done for this presentation, but unfortunately our server decided to die. So I won’t be presenting that till next time I suppose.

Asher and I met yesterday to work on the presentation. We also clarified/brainstormed future things we want to implement. Hopefully we can get the server back up and running so I can finish the basic backend and start helping Asher with the much more complicated frontend. While the server’s down I think I’ll start looking more at his code as well as working on some graphic UI elements.

 

Well this is quite a boring blog post, but what can I say….SKYRIM!

 

Writing Functions and Macros

Currently Functions can be implemented using simple naming methods.

function classname_functionname(arguments) {}

If a function is written like this then within the spreadsheets it can be called using

=classname.functionname(arguments)

If a function has a classname of “default” then no class is required to be specified when calling the function.

default_sum() {}

can be called using

=sum()

More information can be found on the github wiki https://github.com/AsherGlick/Briefcase/wiki/Creating-Custom-Functions. If anybody has any suggestions for making this process more efficient then please feel free to tell me. Thanks!

– Asher Glick

More about parsing math

A while back a wrote a c++ program that allowed me to type in a string and it would return an int with the correct mathematical value for the value of the equation inside the string. I ported that code over into javascript in order to get our math functions. The functions can be found in eparse.js inside the scrips folder in the spreadsheet. As of now you can type any arithmetic function into a cell and it will calculate it. Currently there is no support for variables nor the ability to access other cells. However you can add a number to a string, and strings to strings, and numbers to numbers. I think it’s quite nifty. What I will be working on next is fixing bugs currently in the code, adding the ability to access data from other cells, and the ability to call arbitrary functions from libraries. I think that the ability to access data from other cells will be the hardest because it will have to also make sure that there are no circles of cells that reference each other (which can be solved using graph theory). Furthermore there is a design feature that needs to come into question, should there be a second array of ‘values’ for the cells with equations, if not then whenever an equation access another cell with an equation, both will have to be calculated to obtain the final value.

As a side project I have also been messing with the UI to create a Menu and an Equations bar that syncs to the input box.

– Asher

Parsing Math for spreadsheet equations

For parsing equations from cell data became a slightly more complicated problem by adding a few more design questions. The first one was what to do about the ‘+’ sign. Well if you have a ‘number + number’ then it should return the sum of those numbers. Just as well, if you have a ‘string + string’ it should return the concatenation of the two strings. However what if you have something like ‘number + string’? In most cases programs just concatenate the number and the string to return a new string. That seems like a logical thing to do. The confusing part will become if you have a ‘string + number + number’ which can return either a concatenation of the string and the sum of the numbers or the concatenation of the string and the concatenation of the two numbers. A while back I had written a c++ header file that took a string containing a simple math equation, nothing more then PEMDAS however. I also am not sure if I want to include ‘^’ as a method of stating exponents. As we do more work the answers will become clearer.