[Ur] AJAX style in-page replacement?
Hi all, I'm wondering what the nicest way to achieve client-side content replacement is - conceptually, I have a server-side function that generates a bit of XML, and on a client-side button press, I want some the XML generated on the server-side to end up inside a div without a page reload. I managed to make this work by doing the RPC call in the event handler for the button click, and pushing the resulting xbody fragment into a source. The div then contains a dyn ... tag, and everything works fine. However, my first attempt was to place an active tag with the RPC call inside a dyn tag --- this appears to be disallowed (at runtime!). Here's a minimal example: fun serverSide (x : int) = return xml{[x]}/xml fun main () = foo - source 0; return xml body dyn signal={ x - signal foo; return xml active code={ f - rpc(serverSide x); return f}/ /xml }/ a onclick={fn _ = set foo 123}Foo/a a onclick={fn _ = set source 456}Bar/a /body /xml I'm unsure why this fails --- the error message generated on the client (Error: May not 'rpc' in main thread of 'code' for active) is a little cryptic, and my intuition does not extend far enough to understand why the compiler accepts this in the first place only to have it fail immediately at runtime. If my intuition around how 'active' is meant to work, this would seem the nicest way to achieve what I'm trying to do (if it actually worked...). In any case, this seems a relatively common task. Is my current approach with pushing around bits of XML using signals really the best way? Is there some nicer mechanism I'm missing? Thanks, Gian ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] 3rd day on Ur tutorial
On 7/20/11 2:20 PM, Adam Chlipala wrote: As Gergely said, Gian's tutorial contains information on how to get started with MySQL, but not Postgres. If you read to the end of that step, you'll see all the information you need to get the code running. The MySQL choice is mostly because I was trying to make the tutorial something resembling how perform using Ur/Web some task that I might perform using PHP or Ruby on Rails?, and with both of those environments, MySQL is the de facto standard (for good for for bad). If anyone figures out the correct parameters necessary to make Postgres work with the existing tutorial application, I'd be happy to add those. Also, Gian's tutorial isn't official, and there's not much I can do about any pedagogical deficiencies you find in it. ;) I would hasten to add that the entire tutorial is in GitHub, and I would gladly accept changes that might make things easier to follow :) Now that Adam has started constructing an official tutorial, it might make sense for me to rename the unofficial one to something like Creating a blog with Ur/Web to avoid any future confusion ;) --Gian ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] A direction for Ur/Web
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gentlemen, On 3/26/11 6:51 PM, Marc Weber wrote: The low entry point can only be achieved by - teaching its theory (eg give hints about which books to read) - write many tutorials. To this end, I finally got around to starting something I've been intending to do for some time, which is restructuring my (long-since-abandoned) 'UrBlog' application into a tutorial-style project. I figure that while the example applications on the Ur/Web site are helpful, they perhaps do not give a novice user the full picture of how to develop idiomatic Ur/Web code to achieve a complete application. I'm hoping to go some way towards this goal. http://www.expdev.net/urtutorial/ There is almost nothing there (yet), but it is still being actively developed. My intention is to basically demonstrate how to develop the basics of the application, and then how Ur/Web encourages code re-use (by employing the CRUD example to create an editor interface). Finally, I was hoping to demonstrate how to theme an application with minimal modification to the code. The source for this tutorial is in Git: https://github.com/gian/urtutorial I would be very interested in talking to anyone who might be willing to contribute towards this (or some complementary) effort. Thanks, Gian -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNjmlXAAoJEDd5xfOXfbYMFtkH/1pApg/honOAN6t68biXsJ4V 8Qle5C/sebsvdx985MvxocCNUWsfo0vhJvLDyhpFjHCMEzXzTVZZ7rj2h1d/UvHp FAsMMlxRTyIGeKs8MnjfDMCw0ln03cbCUWPU/eSRxFPG6vMwrQZrVo5RDteL5jP6 yr4JId0Nc/rS3FONG6+MuzCzM0UHje+uLH6S7VqVhsH0ViDqUlWFhUvrjloYxzKO cvc4WAaITCuYGz2gTjAT1NZ5SG/E1BOD7mSYpiWaEse8kYNhq7qMCeg/7d10WnMU eWaMFziHqFgiWayY/q1lP5CpFStU1tF/ovK0ckr2xBFGApiUg0zT6AVCCmz4lwE= =g9Ok -END PGP SIGNATURE- ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] little benchmark on querying a table only
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/20/10 6:08 PM, Marc Weber wrote: PHP: 2.7 total urweb (http): benchmark PHP (run by apache) (5.3): ab -n 100 -c1 http://l/pg_speed.php 0.01s user 0.03s system 3% cpu 1.242 total benchmark ur (http): ab -n 100 -c1 http://l:8090/St/list 0.01s user 0.02s system 1% cpu 2.147 total benchmark ur (fastcgi): ab -n 100 -c1 http://l/fcgid/pg_fcgi.fcgi/St/list 0.01s user 0.02s system 1% cpu 2.522 total -c1 means no threading. data: 1000 rows I know that that simple loop is a very bad benchmark. Yet it surprises me that PHP is significantly faster than urweb. I'm not sure how one is meant to interpret these results, exactly, but I'm not convinced that PHP _is_ faster according to the benchmark you've posted there. The 'user' and 'system' values are smaller for the Ur implementations. What is the final 'total' column meant to mean? I thought the output from 'ab' indicated how many requests you can serve per second in total, and hence a larger number in the final column would be better? - --Gian -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNDv6KAAoJEDd5xfOXfbYMjhkH/0H2Hp9N3B0yv7jezY7LFfhQ i7SHxIUGY7tw4H+N+1nN6rvz23sZ24OZBNNcuiFglZetYb6j3Ru0eK9MvE5xg1QZ h05ESJ8+fpXZfGQ5kKu7YAzLZwPxjwuWCMF9dhSIQ0uECmSdzQz1bzPo/zQ/Xmzc OuQMYU11IvZY3hSTQAyVdu4xvkmfAoq46AAZtj5JsA2Ek3xYtT/N6PWWQpmdQADf uybynOYmxZbFlTbmgIa2nrZKUky0zAGcSPDriIaz01YHTjRpyVDdcu35xFVsqLo2 QkdRsRnvMXLTnjz/KaxrNsKkUi0WfJyI6Ak20UC1zOj0P7msh3CM1eBq1feS0cA= =Nf1S -END PGP SIGNATURE- ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] little benchmark on querying a table only
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/20/10 8:29 PM, Marc Weber wrote: Its the time output of zsh. ab is the benchmark tool which ships with apache. So you don't see the CPU time of the server process, but the one of the benchmark tool. The total time is the time it takes until you see the shell prompt again. I see. Is the server and client running on the same machine? If they are, I can't see that as being a particularly valid test. I also compared with http -t20 and -c 10 (concurrency). Apache + PHP was a lot faster as well. The effect of caches in the database couldn't be ignored, either, unless you are purging the tables in-between requests. PHP time drops very fast if you start load configuration options loading classes. In a real application urweb would outperform PHP very fast. Yeah. I think on these very small workloads it's probably not statistically meaningful to make comparisons unless they are averaged over a large number of samples. For larger applications and workloads the comparisons could become meaningful. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNDwb8AAoJEDd5xfOXfbYMn64IALBDZNCUMvUeksIQMj6R4r+m wA0zwQOMaAN381GxdPKBcqryu42EYjH3/1Oz7qe2Ka5vEZ5IANncibCakaPgYWMD OqTaVse9uHGCXBLdo/eI8hcM6rmCFPCKHEBVOGDIKza/YFkxZygZJftbGBmMfA+e BRTRu+prTKHYp+Y+QEyYyNeyz8RNyEz+LbgoJsdDD0+XsSQ6rk3OfdJkYfzGPW4r hT5I8+YQrlcOztEJT8lsI/6O7fmJgwgg0TPWNeZoX/rGLbrP8KBDIMOdqsaaGXRS pB3LhfPKN6lhT4cjiCZZwNBENbfpUqMRD5sVIPLzix286Mkdy/y0egCvgBP5b8Y= =UXZy -END PGP SIGNATURE- ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] NEW USER NEED HELP WITH INSTALLATION
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/1/10 5:45 PM, sampath kirupa shankar wrote: Hi everybody, I am Kirupashankar Sampath, a grad student at CSU Fresno, CA. I am interested in Ur and have started a project of proving the safety theorems of Ur language. I am not able to install Ur from the instructions on the home page. I have a windows vista.could anybody please give me a step by step procedure for the installation. Thank you. To the best of my knowledge, there is no Windows support in the current implementation of Ur/Web. Consequently, it's very unlikely to work without someone doing a lot of work to port it. You could possibly try using a Windows build of mlton to build it, and then running it from within a Cygwin environment, but I'm not sure that's going to necessarily work. I would suggest finding another machine which has a supported platform that will allow you to install according to the instructions in the manual. - --Gian -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJM9dPvAAoJEDd5xfOXfbYMX8gH/j0kIBIfv8f5f/Sod2vR0XMZ Q4q0l9sbdmsv8lJ2WgrTeFv56zsleRAODGuknd/mBwZ4oxau9Ih6SrjVtlCkEtMa 7WObv18A9c8KrIcVf0bKHquvQnVr1nQZdOYF3FMh1IF7JEIyu3jEFD16Ne36lucs 1rbKzIuNWOkvWsN8sK0eCv9JXuqyQl5bBbdoJJkyHTBtIVV0ouC2cg8QrASuyN4N agpAKvvV5xF9+FyGeJKqlDCujrCihL6va9jNpGRNnVJKW1ynpJGjuKqmh8+xPI1f sfV8+F99n0pAPNMQ3U8EPV3AAK/WxSp+Mc6j/klgqCNLeBB1rtaKxZBiGTxckf4= =/66o -END PGP SIGNATURE- ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur