[Lift] (Scala and Lift) and (GWT and Google App Engine) A Double Marriage Made In Heaven?
Hi David, I saw your Twitter post a month ago "Walked out of a very bad keynote ... coding is more fun ... looking forward to learning about GWT" Do you see ways to incorporate GWT into Lift? Regards, Mal. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Customizing Javascript
Here is the current solution. It's not clean, but I cannot think of better idea for the code. bind("entry", xhtml, "js_realtimeoutput" -> {Unparsed (js_realtime_output(room_day, room))}) private def js_realtime_output(room_day: RoomDay, room: Room) : String = { def date_string(datetime : GregorianCalendar) : String = { String.format("new Date(%s,%s,%s,%s,%s,%s)", datetime.get(Calendar.YEAR).toString, datetime.get (Calendar.MONTH).toString, datetime.get(Calendar.DAY_OF_MONTH).toString, datetime.get (Calendar.HOUR_OF_DAY).toString, datetime.get(Calendar.MINUTE).toString, datetime.get (Calendar.SECOND).toString) } val s_datetime = new GregorianCalendar() val e_datetime = new GregorianCalendar() if (room_day.day_no.is == 0) { """function realtime_output() { php_now = """ + date_string(s_datetime) + """; local_now = new Date(); diff_sec = Math.floor( (local_now - php_now) / 1000); document.realtime_form.realtime_output.value = "伺服器與本地時間差:" + diff_sec + "秒"; }""" } else { s_datetime.setTime(room_day.created.is) e_datetime.setTime(room_day.created.is) var until_string = "" if (room_day.day_no.is % 2 == 0) { e_datetime.add(Calendar.MINUTE, room.day_minutes.is) until_string = "日落" } else { e_datetime.add(Calendar.MINUTE, room.night_minutes.is) until_string = "早上" } """starttime = """ + date_string(s_datetime) + """; endtime = """ + date_string(e_datetime) + """; diffseconds = Math.floor((endtime - starttime)/1000); function realtime_output() { nowtime = new Date(); leftseconds = diffseconds - Math.floor((nowtime - starttime)/ 1000); lefttime = new Date(0,0,0,0,0,leftseconds); virtual_left_seconds = Math.floor(12*60*60*(leftseconds / diffseconds)); virtual_lefttime = new Date(0,0,0,0,0,virtual_left_seconds); if(leftseconds > 0){ document.realtime_form.realtime_output.value = " """ + until_string + """剩餘 " + virtual_lefttime.getHours()+"時 間"+virtual_lefttime.getMinutes()+"分 (實際時間 "+lefttime.getMinutes() +"分"+lefttime.getSeconds()+"秒)"; } else { overseconds = Math.abs(leftseconds); overtime = new Date(0,0,0,0,0,overseconds); document.realtime_form.realtime_output.value = "超過時間 "+overtime.getMinutes()+"分"+overtime.getSeconds()+"秒"; } tid = setTimeout('realtime_output()', 1000); }""" } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] About Scala XML Manipulation
Hi : I want to ask why the won't appear in the following XML code. And if I want to make such effect ? the "if" is inside an outer tag following by a previous tag, how could I do ? Thanks scala> {if(1==1) } res26: scala.xml.Elem = --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] how to serve html fragments
hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads an html fragment and puts it into the dom using prototype. i have set up a template which contains the fragment at src/main/ webapp/fragment.html item then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems item so the question is, how can i make lift send back the raw html without meddling with it? i have tried out using ResourceServer to serve it statically which works, but this wouldn't allow me to generate the fragment dynamically. i would also prefer to have a separate html template file rather than embedding the markup code in a snippet. any thoughts gratefully received.. george --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: About Scala XML Manipulation
Howdy, Try this at the Scala REPL (the Scala command line): scala> if (true) scala> The type of a if expression (without and else) is always Unit. Unit is always blank in XML, and thus you never get anything. Please change to if (true) else NodeSeq.Empty scala> import scala.xml._ import scala.xml._ scala> if (true) else NodeSeq.Empty res1: scala.xml.NodeSeq = And it works. Thanks, David On Sun, Apr 26, 2009 at 3:51 AM, sailormoo...@gmail.com < sailormoo...@gmail.com> wrote: > > Hi : > > I want to ask why the won't appear in the following XML code. > And if I want to make such effect ? the "if" is inside an outer tag > following by a previous tag, how could I do ? > Thanks > > scala> {if(1==1) } > res26: scala.xml.Elem = > > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: (Scala and Lift) and (GWT and Google App Engine) A Double Marriage Made In Heaven?
On Sat, Apr 25, 2009 at 11:07 PM, mal3 wrote: > > Hi David, > > I saw your Twitter post a month ago > > "Walked out of a very bad keynote ... coding is more fun ... looking > forward to learning about GWT" > > Do you see ways to incorporate GWT into Lift? Not really. GWT is all about Java. There's no way to do GWT client code in Scala. Lex Spoon works at Google. And I hear he works on the GWT team. If he can't get Scala support for GWT, it's not going to happen. Also, I'm just not a fan of the GWT model. However, because Lift does web services very well, it could be the back end to your GWT app. I expect that the stuff we're doing with the Bespin folks will yield a much better way of building client side apps. > > > Regards, Mal. > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Customizing Javascript
Oh wow ... no offense but I haven't seen such code in a while :) .. I see the code but it's difficult to understand the problem that you are trying to solve ... looks like you are building a clock. For building reasonable small JavaScript I'd recommend using Lif't's JavaScript abstraction (JsExp/JsCmd etc). For bigger JS code I'd recommend writing the JavaScript code in the JS file and define your own JavaScript objects. So what I'd do: 1. Define the JavaScript function in a separate .js file (the function may be part of a JS JSON object ) 2. The function would take a JSON structure as argument 3. From the Lift's snippet generate the JSON structure that needs to be passed to you function using JsObj and generate the tag (using xml literals or even use the JsCmds.Script object). Potentially use JqOnLoad so that your function to be called after the DOM tree is loaded Br's, Marius On Apr 26, 1:31 pm, "sailormoo...@gmail.com"wrote: > Here is the current solution. It's not clean, but I cannot think of > better idea for the code. > > bind("entry", xhtml, > "js_realtimeoutput" ->