Earlier quoted context omitted.
You may like, but it is an obvious security flaw. A 'real' product couldn't have this feature, at least not the way it is implemented here.
Please elaborate. ( i ask because i am writing a spreadsheet where every cell can be JSON or a JS expression ) What sort of vulnerabilities does this expose, besides letting the user shoot their feet repeatedly? Cross site scripting?
A spreadsheet in fewer than 30 lines of JavaScript, no library used
91–100 of 274 posts
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#92Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#93The blog post is very interesting to read, but here's the meat. We're looking for a function with type
loeb :: Functor f => f (f a -> a) -> f a
and without thinking about the meaning of it, we can implement it as loeb x = fmap (\a -> a (loeb x)) x
which embodies a certain, strange kind of recursion. It turns out that it's "spreadsheet recursion". We build a list of functions from lists of a to a like test :: [[Int] -> Int]
test = [ (!! 1), length, (!! 0) ] -- think [A1, length(A), A0]
then `loeb test` "completes" the list by applying the "result list" to each of the functions of the source list. loeb test == [3, 3, 3]
Laziness lets the recursion proceed despite "evaluating" the list from left to right. Infinite loops still fail loeb [(!! 0)] == [............ waiting
It's also interesting to think of how to do "spreadsheet recursion" on exotic data types like trees. data Binary a = Branch (Binary a) a (Binary a) | Tip
deriving (Show, Functor)
depth Tip = 0
depth (Branch l _ r) = succ (max (depth l) (depth r))
top default Tip = default
top _ (Branch _ a _) = a
> loeb (Branch Tip depth (Branch Tip (top 0) Tip))
Branch Tip 2 (Branch Tip 2 Tip)
[0] http://blog.sigfpe.com/2006/11/from-l-theorem-to-spreadsheet...Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#94Are there any more full-featured libraries that people use for this? I've found SpreadJS[0], GelSheet[1], jQuery.Sheet[2], and ZK Spreadsheet, but none seem like thriving open-source projects as far as I can tell. [0] http://wijmo.com/demo/spreadjs/samples/index.html [1] http://www.gelsheet.org/demo [2] http://visop-dev.com/Project+jQuery.sheet [3] http://www.zkoss.org/product/zkspreadsheet
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#95Earlier quoted context omitted.
with (context) + eval = user-space lexical environment ?
Yep, I'm using something very like this in a Node project I'm working on. However, with(context) has some pretty nasty side effects that I just couldn't sidestep, so I used the "contextify" module. If you're needing with and have access to npm, use contextify, It'll save you a lot of effort!
[1] I just finished skimming through eloquent js and js allonge, and this still eluded me.
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#96Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#97Earlier quoted context omitted.
And 80% of perceived functionality is what most users — even people who rely on spreadsheets for their work — need. I'm not saying including the other 20% of functionality isn't a good thing to do, but when you're creating a new product or open source project, you can get by (and thrive) building only the 20% of functionality that's used 80% of the time. Why? Because 1% of functionality is still better than 0% (never…
The problem is that the total economic value (as measured by market price) for the users who only use that 80% of perceived functionality is close to 0 (google docs and OO/LO are free) The incredibly difficult 20% is what people pay for. It's what the businesses that shell out billions of dollars a year pay for. And it's what a successful product in the space needs to tackle
Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#98Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used
#99Earlier quoted context omitted.
And 80% of perceived functionality is what most users — even people who rely on spreadsheets for their work — need. I'm not saying including the other 20% of functionality isn't a good thing to do, but when you're creating a new product or open source project, you can get by (and thrive) building only the 20% of functionality that's used 80% of the time. Why? Because 1% of functionality is still better than 0% (never…
The problem is that the total economic value (as measured by market price) for the users who only use that 80% of perceived functionality is close to 0 (google docs and OO/LO are free) The incredibly difficult 20% is what people pay for. It's what the businesses that shell out billions of dollars a year pay for. And it's what a successful product in the space needs to tackle