[Lift] Re: Issue, The URL params can't contains ? ****

2010-03-09 Thread Neil.Lv

 I want get the these strings ( http://test.com/file.zip12345678 )
from the
 URL (http://localhost:8080/download.html?link=http://test.com/
file.zip12345678)



 Thanks very much!

Cheers,
  Neil





-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] Issue, The URL params can't contains ? ****

2010-03-09 Thread Neil.Lv
Hi all,

  I have a silly question about the URL rewrite .

  How to let the URL params can contains the  character.

  Here is the code:

###  The url rewrite.
case RewriteRequest(
   ParsePath(List(download,  link), html, _, _),
 GetRequest, _) =
   RewriteResponse(List(download),
 Map(link - link))
###

  When i input this link and get these value that the link param can't
contains the  char.
http://localhost:8080/download.html?link=http://test.com/file.zip12345678

  The link param is:  (that doesn't contains the  char  in the param)
  S.param(link)
  = http://test.com/file.zip

  So how can i get the 12345678 value from the link param ?

  Maybe the URL rewrite is not correctly ?

  Thanks for any help!

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Issue, The URL params can't contains ? ****

2010-03-09 Thread Neil.Lv


On Mar 9, 9:56 pm, Marius marius.dan...@gmail.com wrote:
 You need to do URL encoding first. Helpers.urlEcnode(str) does this.


  case RewriteRequest(
   ParsePath(List(download,  link), html, _, _),
 GetRequest, _) =
   RewriteResponse(List(download),
 Map(link -  Helpers.urlEncode(link) ))

   I add this code in here, but it doesn't work too.

   S.param(link)
  = Full(http://test.com/file.zip)

  Thanks!


Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 the url rewrite (more thant one params and get 404 not found error)

2010-03-01 Thread Neil.Lv


On Mar 1, 3:53 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

 I'm not sure if this can be handled with the standard ParsePath, but it
 is fairly easy to write your own extractor that can handle more complex
 scenarios. Here's an example:

 object ParamsExtractor {
   def unapply(pp:ParsePath): Option[(Account, OrgUnit)] = {
 val result:Box[(Account, OrgUnit)] = if 
 (pp.wholePath.startsWith(path)  pp.wholePath.length == (path.length + 2)) {
   val res = Full((XX,YY))
   debug(Decoded URL: %s=%s.format(pp,res))
   res
   }
 else
   None
 result
   }
 }
 used like this:

 case RewriteRequest(ParamsExtractor(account,orgUnit) , _, _) =
 (RewriteResponse(path), Full(account, orgUnit))

  I have some question about these code that i don't understand.

  The first one that contains the Map() in the RewriteResponse() .
   --
   case RewriteRequest() = RewriteResponse()

  but the second one that doesn't contain the Map in the
RewriteResponse(),
  what's the mean of the Full(account, orgUnit) in the
( RewriteResponse(path), Full(account, orgUnit) )
   --
   case RewriteRequest() = ( RewriteResponse(), Full() )

###

  case RewriteRequest(
  ParsePath(List(show, img, version, id), _, _,_), _, _) =
RewriteResponse(List(show, img),
  Map(version - version, id - id)
)


  case RewriteRequest(
  ParamsExtractor(account,orgUnit) , _, _) =
( RewriteResponse(path), Full(account, orgUnit) )
###

Thank you very much.

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 the url rewrite (more thant one params and get 404 not found error)

2010-03-01 Thread Neil.Lv


On Mar 1, 5:10 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 Ahh yes, the example was from a Loc rewrite, The principle is the same I
 guess, you should be able to do something like this:

 case RewriteRequest(ParamsExtractor(account,orgUnit) , _, _) =
   RewriteResponse(path, Map(account - account, orgUnit - orgUnit))

 The important part is the extractor which takes care of parsing the
 request into meaningful values...

 /Jeppe

  Got it, thanks for your reply.

  I'll  try it later.

  :)

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 the url rewrite (more thant one params and get 404 not found error)

2010-03-01 Thread Neil.Lv

  I add these code in the Boot class, but it doesn't work.

  How can write the correct code to parse the url ?

#
object ParamsExtractor {
  def unapply(pp: ParsePath): Option[(String)] = {
Log.info(wholePath:  + pp.wholePath)
val path = List(test)
val result:Box[(String)] = if (pp.wholePath.startsWith(path) 
pp.wholePath.length == (path.length + 2)) {
  val res = Full((test2))
Log.info(Decoded URL: %s=%s.format(pp, res))
res
} else None
Log.info(result:  + result)
result
  }
}

class Boot {
  def boot {
...
LiftRules.statelessRewrite.prepend {
 case RewriteRequest(ParamsExtractor(param) , _, _) =
   RewriteResponse(List(test), Map(param - param))
}
...
  }
}
#

  Thanks!~~

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 the url rewrite (more thant one params and get 404 not found error)

2010-03-01 Thread Neil.Lv
OK, Got it, Thank you very much!

On Mar 2, 3:01 am, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Sun, Feb 28, 2010 at 8:28 PM, Neil.Lv anim...@gmail.com wrote:
  Hi all,

   I have a silly question about the url rewrite in the lift.
   It has another two params in the url after the img.

   http://localhost:8080/show/img/version/id

   The url works fine.
   =http://localhost:8080/show/img
   =http://localhost:8080/show/img/v1/
   =http://localhost:8080/show/img/v1/1

   Get 404 error if the / string is not added at the end of the url
  (the id param isn't supplied)
   =http://localhost:8080/show/img/v1

   So, how can i rewrite the url and set the sitemap can make this link
  (  http://localhost:8080/show/img/v1 )
   works fine as (  http://localhost:8080/show/img/v1/ ) when the id
  is not supplied.

   Here is the code:

  ###
   case RewriteRequest(
   ParsePath(List(show, img, version, id), _, _,_), _, _) =
 RewriteResponse(List(show, img),
   Map(version - version, id - id)
   )
  ###

 This is just basic pattern matching stuff.  So,

 case RewriteRequest(
  ParsePath(show :: img :: version :: rest, _, _,_), _, _) =
 RewriteResponse(List(show, img),
  Map(version - version, id - (rest.firstOption getOrElse N/A))
  )

 Please pick up a copy of one of the Scala books and look at the pattern
 matching section related to Lists.  There's a lot of flexibility that's no
 Lift-specific, but that Lift leverages.

 val entries = Menu(Loc(Home, List(index), Home)) ::



  Menu(Loc(show, List(show), show, Hidden)) :: User.sitemap

  ###

   BTW, I use the LiftView to handle the request.

  ###
  class show extends LiftView {
   def dispatch = {
 case img = imgDispatch _
 case _ = allDispatch _
   }

   def imgDispatch(): Box[NodeSeq] = {
 ...
   }

   def allDispatch(): Box[NodeSeq] = {
 ...
   }
  }
  ###

   Thanks very much!

  Cheers,
   Neil

  --
  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 the url rewrite (more thant one params and get 404 not found error)

2010-02-28 Thread Neil.Lv
Hi all,

  I have a silly question about the url rewrite in the lift.
  It has another two params in the url after the img.

  http://localhost:8080/show/img/version/id

  The url works fine.
  = http://localhost:8080/show/img
  = http://localhost:8080/show/img/v1/
  = http://localhost:8080/show/img/v1/1

  Get 404 error if the / string is not added at the end of the url
(the id param isn't supplied)
  = http://localhost:8080/show/img/v1

  So, how can i rewrite the url and set the sitemap can make this link
(  http://localhost:8080/show/img/v1  )
  works fine as (  http://localhost:8080/show/img/v1/  ) when the id
is not supplied.

  Here is the code:

###
  case RewriteRequest(
  ParsePath(List(show, img, version, id), _, _,_), _, _) =
RewriteResponse(List(show, img),
  Map(version - version, id - id)
  )
###
val entries = Menu(Loc(Home, List(index), Home)) ::
Menu(Loc(show, List(show), show, Hidden)) :: User.sitemap

###

  BTW, I use the LiftView to handle the request.

###
class show extends LiftView {
  def dispatch = {
case img = imgDispatch _
case _ = allDispatch _
  }

  def imgDispatch(): Box[NodeSeq] = {
...
  }

  def allDispatch(): Box[NodeSeq] = {
...
  }
}
###

  Thanks very much!

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: (ISSUE) How to use the sbt with lift project ?

2010-01-30 Thread Neil.Lv


  I have changed the code. use this code in the G:\project\test\project
\TestProject.scala file,
and get this error.

 The jetty val you are overriding is an internal val that you shouldn't
 be doing anything with. If you change that line to:

 val jetty6 = org.mortbay.jetty % jetty % 6.1.22 % test-default


   Here is the error message, i use mvn jetty:run to start the
server and it works fine, but instead of using sbt jetty and get
this error that can't find the value net ?

#

G:\project\testsbt jetty

G:\project\testset SCRIPT_DIR=G:\cygwin\home\

G:\project\testjava -Xmx64M -jar G:\cygwin\home\sbt-
launcher-0.5.6.jar jetty
[info] Building project test 1.0 using TestProject
[info]with sbt 0.5.6 and Scala 2.7.7
[info]
[info] == compile ==
[info]   Source analysis: 10 new/modified, 0 indirectly invalidated, 0
removed.
[info] Compiling main sources...
[error] G:\project\test\src\main\scala\com\test\lib
\DepencyFactory.scala:3: not found: value net
[error] import net.liftweb._
[error]^
[error] G:\project\test\src\main\scala\com\test\lib
\DepencyFactory.scala:16: wrong number of arguments for construct
or Object: ()java.lang.Object
[error]   implicit object time extends FactoryMaker(Helpers.now _)
[error]^
[error] G:\project\test\src\main\scala\com\test\snippet
\HelloForm4.scala:4: value net is not a member of package ro
ot
[error] import _root_.net.liftweb.util._

#

   I don't know what's wrong with it.


 A colleague of mine did a skeleton project for sbt. It may give you
 some hints how to proceed.
 http://github.com/vvilhonen/SBT-Lift-Skeleton
   OK, I'll try it again.


   Thanks very much!

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: (ISSUE) How to use the sbt with lift project ?

2010-01-30 Thread Neil.Lv
Hi,

  Lift version is: 2.0-M1, i deleted all the files in the G:/Documents
and Settings/Ruby/.ivy2/ directory but get these errors too.

#
[warn]  ::
[warn]  ::  UNRESOLVED DEPENDENCIES ::
[warn]  ::
[warn]  :: com.rabbitmq#amqp-client;1.7.0: not found
[warn]  ::
[info]
[warn] :: problems summary ::
[warn]  WARNINGS
[warn]  module not found: com.rabbitmq#amqp-client;1.7.0
[warn]   local: tried
[warn]G:/Documents and Settings/Ruby/.ivy2/local/com.rabbitmq/amqp-
client/1.7.0/ivys/ivy.xml
[warn]-- artifact com.rabbitmq#amqp-client;1.7.0!amqp-client.jar:
[warn]G:/Documents and Settings/Ruby/.ivy2/local/com.rabbitmq/amqp-
client/1.7.0/jars/amqp-client.jar
[warn]   m2-repository-smack: tried
[warn]
http://maven.reucon.com/public/com/rabbitmq/amqp-client/1.7.0/amqp-client-1.7.0.pom
[warn]-- artifact com.rabbitmq#amqp-client;1.7.0!amqp-client.jar:
[warn]
http://maven.reucon.com/public/com/rabbitmq/amqp-client/1.7.0/amqp-client-1.7.0.jar
[warn]   public: tried
[warn]
http://repo1.maven.org/maven2/com/rabbitmq/amqp-client/1.7.0/amqp-client-1.7.0.pom
[warn]-- artifact com.rabbitmq#amqp-client;1.7.0!amqp-client.jar:
[warn]
http://repo1.maven.org/maven2/com/rabbitmq/amqp-client/1.7.0/amqp-client-1.7.0.jar
[warn]   Scala-Tools Maven2 Repository: tried
[warn]
http://scala-tools.org/repo-releases/com/rabbitmq/amqp-client/1.7.0/amqp-client-1.7.0.pom
[warn]-- artifact com.rabbitmq#amqp-client;1.7.0!amqp-client.jar:
[warn]
http://scala-tools.org/repo-releases/com/rabbitmq/amqp-client/1.7.0/amqp-client-1.7.0.jar
[warn]  ::
[warn]  ::  UNRESOLVED DEPENDENCIES ::
[warn]  ::
[warn]  :: com.rabbitmq#amqp-client;1.7.0: not found
[warn]  ::
[info]
[info] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
[info] == update ==
[error] Error running update: unresolved dependency: com.rabbitmq#amqp-
client;1.7.0: not found
#

import sbt._

class MyProject(info: ProjectInfo) extends DefaultWebProject(info)
{
  val lift = net.liftweb % lift-core % 2.0-M1 % compile-
default
  val jetty6 = org.mortbay.jetty % jetty % 6.1.22 % test-
default
  val servlet = javax.servlet % servlet-api % 2.5 % provided-
default
  val specs = org.scala-tools.testing % specs % 1.6.1 % test-
default

  // required because Ivy doesn't pull repositories from poms
  val smackRepo = m2-repository-smack at http://maven.reucon.com/
public
}



  Thanks,

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: (ISSUE) How to use the sbt with lift project ?

2010-01-30 Thread Neil.Lv

  I use this command ~ jetty-restart and it can get continuous
compilation and deployment.

  Thanks!

Cheers,
  Neil


On Jan 31, 1:10 pm, Neil.Lv anim...@gmail.com wrote:
   It works now, but when i changing a file(HelloWorld.scala) in the
 snippet, it doesn't re-compile the HelloWorld.scala fle.

   How to let it automatically compile the changed files and don't need
 to restart the server ?

   Thank you very much!

 Cheer,
   Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] (ISSUE) How to use the sbt with lift project ?

2010-01-29 Thread Neil.Lv
Hi all,

   How to use the sbt with lift project ?

   I try to use the sbt and get this errors, Does anybody know what's
wrong with it ?

   Maybe i missing something else ?

   Here is the log:

#

I create this file like this in the build directory.
G:\project\test\project\build\TestProject.scala

import sbt._
class TestProject(info: ProjectInfo) extends DefaultWebProject(info)
{
  override lazy val jetty = org.mortbay.jetty % jetty % 6.1.22 %
test-default
}

#
G:\project\testsbt
G:\project\testset SCRIPT_DIR=G:\cygwin\home\
G:\project\testjava -Xmx64M -jar G:\cygwin\home\sbt-
launcher-0.5.6.jar

Project does not exist, create new project? (y/N/s) : y
Name: test
Organization []:
Version [1.0]:
Scala version [2.7.7]:
sbt version [0.5.6]:
:: retrieving :: sbt#boot
confs: [default]
2 artifacts copied, 0 already retrieved (9911kB/625ms)
:: retrieving :: sbt#boot
confs: [default]
3 artifacts copied, 0 already retrieved (3409kB/547ms)
[success] Successfully initialized directory structure.
[info] Building project test 1.0 using sbt.DefaultProject
[info]with sbt 0.5.6 and Scala 2.7.7
[info] No actions specified, interactive session started. Execute
'help' for more information.


  1:  Get this error when use sbt update command

G:\project\testsbt update
G:\project\testset SCRIPT_DIR=G:\cygwin\home\
G:\project\testjava -Xmx64M -jar G:\cygwin\home\sbt-
launcher-0.5.6.jar update

[error] G:\project\test\project\build\TestProject.scala:5: error
overriding lazy value jetty in class BasicWebScalaP
roject of type TestProject.this.Task;
[error]  value jetty needs `override' modifier
[error]   val jetty = org.mortbay.jetty % jetty % 6.1.22 % test-
default

-  2:  When I add the override in the definition, and get this
error.

[error] G:\project\test\project\build\TestProject.scala:5: error
overriding lazy value jetty in class BasicWebScalaP
roject of type TestProject.this.Task;
[error]  value jetty must be declared lazy to override a concrete lazy
value
[error]   override val jetty = org.mortbay.jetty % jetty %
6.1.22 % test-default
[error]^
[error] one error found
Compilation unsuccessful.

-  3:  Add lazy into the statement and get this error.

[error] G:\project\test\project\build\TestProject.scala:5: error
overriding lazy value jetty in class BasicWebScalaP
roject of type TestProject.this.Task;
[error]  lazy value jetty has incompatible type sbt.ModuleID
[error]   override lazy val jetty = org.mortbay.jetty % jetty %
6.1.22 % test-default

#

  Thanks for any help!

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Solr (or external API), curl, scala dispatch library, Quartz scheduling questions

2010-01-26 Thread Neil.Lv
 Hi,

   I have a silly question about the http package.

  What's the package should be imported when using the dispatch?

  I try this code of the wiki, and get this error.
  error: not found: value http

###  I have import the dispatch package, and where is the http ?
import dispatch._
###

  Thanks,

Cheers,
  Neil

On Jan 26, 12:14 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Mon, Jan 25, 2010 at 7:53 PM, Strom strommo...@gmail.com wrote:
  Wiki article for how to POST to an external XML API.

 Thank you for your contribution!





 http://wiki.github.com/dpp/liftweb/how-to-post-xml-to-an-external-url...

  On Jan 25, 1:47 pm, Strom strommo...@gmail.com wrote:
   Ok thanks!

   For those of you looking to do add Databinder's dispatch to your Lift
   project, you should add these to your pom.xml:

   within repositories...
   repository
 idnet.databinder/id
 urlhttp://databinder.net/repo/url
 snapshots /
   /repository

   within dependencies...
   dependency
 groupIdnet.databinder/groupId
 artifactIddispatch-http_2.7.7/artifactId
 version0.6.6/version
   /dependency

   Of course, please replace 2.7.7 in the dependency above with your
   version of scala, and 0.6.6 with whatever version of Dispatch you
   plan to use. You can browse their repository online (http://
   databinder.net/repo/) and see what's most up to date if you're into
   that.

   Strom

   On Jan 25, 12:28 pm, Strom strommo...@gmail.com wrote:

One more simple question. How do I go about incorporating Quartz or
Dispatch into my current lift project? Is it as simple as adding
dependencies to my pom.xml, or do I have to download the files and put
them in my netbeans project? n00b...

Thanks,
Strom

On Jan 25, 11:30 am, Strom strommo...@gmail.com wrote:

 Thank you David and Ewan. Very helpful!

 Strom

 On Jan 25, 10:51 am, Ewan ehar...@gmail.com wrote:

  I used apache camel (6 months ago or so) to send/receive the
  requests
  then parsed the xml response.  Works fine.

  -- Ewan

  On Jan 25, 8:41 am, Strom strommo...@gmail.com wrote:

   Hey all,
   I'm planning on using solr for a web project that I'm doing, and
  I was
   wondering if anyone had experience with using Solr or
  communicating
   with another external xml api? I've got a few questions.

   1. What is the most straightforward way to POST to an external
  url?
   I'm going to be sending Solr server XML commands to index and
  commit
   data for search within my app, and I've seen people discuss
  Scala's
   Dispatch library, but I'm not exactly sure what its strengths are
  or
   if I should use it over apache http library or curl.

   2. Would it be safe to say that this use case (sending POSTs to
  an
   external URL asynchronously) is a good thing for Lift's actors to
   handle? I'm very green to the concept of actors, so I'm trying to
  find
   when it's best to use them.

   3. I'm planning on doing a monthly rebuild of the index (or
  possibly
   some other timespan tbd), and I've read that Quartz is good for
   scheduling. Is there documentation I can read for information on
  how
   to integrate this Java library (or any java library for that
  matter)
   into my lift app and use it?

   Thanks!
   Strom

  --
  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Solr (or external API), curl, scala dispatch library, Quartz scheduling questions

2010-01-26 Thread Neil.Lv

  Thanks, I have found it here, 
http://dispatch.databinder.net/Stdout_Walkthrough

  I have imported the Http package and it works now,
###
import Http._
###

   Thanks again, this article is very helpful.

Cheers,
  Neil

On Jan 27, 9:57 am, Neil.Lv anim...@gmail.com wrote:
  Hi,

I have a silly question about the http package.

   What's the package should be imported when using the dispatch?

   I try this code of the wiki, and get this error.
   error: not found: value http

 ###  I have import the dispatch package, and where is the http ?
 import dispatch._
 ###

   Thanks,

 Cheers,
   Neil

 On Jan 26, 12:14 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:

  On Mon, Jan 25, 2010 at 7:53 PM, Strom strommo...@gmail.com wrote:
   Wiki article for how to POST to an external XML API.

  Thank you for your contribution!

  http://wiki.github.com/dpp/liftweb/how-to-post-xml-to-an-external-url...

   On Jan 25, 1:47 pm, Strom strommo...@gmail.com wrote:
Ok thanks!

For those of you looking to do add Databinder's dispatch to your Lift
project, you should add these to your pom.xml:

within repositories...
repository
  idnet.databinder/id
  urlhttp://databinder.net/repo/url
  snapshots /
/repository

within dependencies...
dependency
  groupIdnet.databinder/groupId
  artifactIddispatch-http_2.7.7/artifactId
  version0.6.6/version
/dependency

Of course, please replace 2.7.7 in the dependency above with your
version of scala, and 0.6.6 with whatever version of Dispatch you
plan to use. You can browse their repository online (http://
databinder.net/repo/) and see what's most up to date if you're into
that.

Strom

On Jan 25, 12:28 pm, Strom strommo...@gmail.com wrote:

 One more simple question. How do I go about incorporating Quartz or
 Dispatch into my current lift project? Is it as simple as adding
 dependencies to my pom.xml, or do I have to download the files and put
 them in my netbeans project? n00b...

 Thanks,
 Strom

 On Jan 25, 11:30 am, Strom strommo...@gmail.com wrote:

  Thank you David and Ewan. Very helpful!

  Strom

  On Jan 25, 10:51 am, Ewan ehar...@gmail.com wrote:

   I used apache camel (6 months ago or so) to send/receive the
   requests
   then parsed the xml response.  Works fine.

   -- Ewan

   On Jan 25, 8:41 am, Strom strommo...@gmail.com wrote:

Hey all,
I'm planning on using solr for a web project that I'm doing, and
   I was
wondering if anyone had experience with using Solr or
   communicating
with another external xml api? I've got a few questions.

1. What is the most straightforward way to POST to an external
   url?
I'm going to be sending Solr server XML commands to index and
   commit
data for search within my app, and I've seen people discuss
   Scala's
Dispatch library, but I'm not exactly sure what its strengths 
are
   or
if I should use it over apache http library or curl.

2. Would it be safe to say that this use case (sending POSTs to
   an
external URL asynchronously) is a good thing for Lift's actors 
to
handle? I'm very green to the concept of actors, so I'm trying 
to
   find
when it's best to use them.

3. I'm planning on doing a monthly rebuild of the index (or
   possibly
some other timespan tbd), and I've read that Quartz is good for
scheduling. Is there documentation I can read for information on
   how
to integrate this Java library (or any java library for that
   matter)
into my lift app and use it?

Thanks!
Strom

   --
   You received this message because you are subscribed to the Google Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.

  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to use prepareStatement to select *** from DB (two db vender)?

2010-01-21 Thread Neil.Lv

  I have added the demo code on the Github now.
  ( Mabye it's a bug with DB.runQuery and DB.use in the two db
vender )

  Here is the address:
  http://github.com/anim510/two_db_demo

  Thanks very much!

Cheers,
  Neil

On Jan 21, 11:26 am, Neil.Lv anim...@gmail.com wrote:
   My email is :   anim...@gmail.com

 On Jan 21, 11:17 am, Neil.Lv anim...@gmail.com wrote:

  Mabye it's a bug with DB.runQuery and DB.use in the two db vender 

  Two question: (problem)

  1: I don't know why the HelloWorld snippet code will be execute 2
  times in this code. (See the HelloWorld.scala file.)
  2: The dbDefaultConnectionIdentifier method in the Model that it works
  fine when using Mapper's method such as ModelName.findAll(),
  it doesn't work when using DB.runQuery and DB.use(...) --- (Maybe it
  can't find the default db identifier)

  The question 2 I test it many times that found this problem.

  In the test app , the Hot.getHots2 and Hot.getHots3 method can't work.

  I comment the code now in the HelloWorld.scala file, you can try it.

  

    I can push the code on the github, and get this errors fatal:
  unable to fork

    So If anyone know what's wrong with it and I can send the demo.tar
  file through the email.

    Thanks very much!

  

  Cheers,
    Neil

  On Jan 21, 1:56 am, Neil.Lv anim...@gmail.com wrote:

     The DB.runQuery can works now, but the DB.prepareStatement also
   cant' work.

     Here is the test app address:
    http://github.com/anim510/two_db_demo

   Cheers,
     Neil

   On Jan 21, 1:16 am, Neil.Lv anim...@gmail.com wrote:

   Thank you very much,

   But it doesn't work yet, maybe because of using two db connections.

   I'll test it later again.

On Jan 21, 12:44 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

 Neil.Lv anim...@gmail.com writes:
  Hi all,

    I use two db connections in my app, and I want to use
  DB.prepareStatement to select
  the records from the second db.

    It failed, Here is the code:
  ###
    def getHotByTid(id : Long) =
      DB.use(bootstrap.liftweb.TwoDB) {
        conn =
       DB.prepareStatement(SELECT * FROM hots WHERE id=? , conn) {
               stmt =
                       stmt.setLong(1, id)
  Log.info(stmt : + stmt)   // The information is correctly now, but
  after call executeUpdate method
                       stmt.executeUpdate()
        }
     }

 Not sure what your problem is really, but I think you should use
 DB.runQuery to execute a select statement

 Ie

   val (_,result) = DB.runQuery(SELECT COUNT(*), contract_length  
 FROM +
                     vehicles_current v +
                     WHERE v.account_id=? +
                     GROUP BY contract_length +
                     ORDER BY contract_length,
                     List(42))

 /Jeppe
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to use prepareStatement to select *** from DB (two db vender)?

2010-01-21 Thread Neil.Lv

  The users table in the OneDB, and the hots table in the TwoDB, they
are separated!

  I have changed the method that like this:
###
  # I specify the TwoDB for hots table.
  override def dbDefaultConnectionIdentifier = bootstrap.liftweb.TwoDB


  def getHots3(id : Long) = {
DB.use(bootstrap.liftweb.OneDB) {
  firstConn =
 DB.use(bootstrap.liftweb.TwoDB) {
conn =
 DB.prepareStatement(SELECT * FROM hots WHERE id?, conn) {
 stmt =
 stmt.setLong(1, id)
 stmt.executeUpdate()
}
}
}
  }
###

  But it doesn't work.

  Thanks very much!  :)

Cheers,
  Neil


On Jan 22, 12:49 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 What is wrong with:

 DB.use(FirstDB) {
   firstConnection =
   DB.use(SecondDB) {
   secondConnection =

   // do transactional query between two DBs here

 }
 }

 Note that DB.use nests such that the transaction will only be committed when
 the last DB.use block for a given ConnectionIdentifier is exited.



 On Thu, Jan 21, 2010 at 3:17 AM, Neil.Lv anim...@gmail.com wrote:

   I have added the demo code on the Github now.
   ( Mabye it's a bug with DB.runQuery and DB.use in the two db
  vender )

   Here is the address:
   http://github.com/anim510/two_db_demo

    Thanks very much!

  Cheers,
   Neil

  On Jan 21, 11:26 am, Neil.Lv anim...@gmail.com wrote:
     My email is :   anim...@gmail.com

   On Jan 21, 11:17 am, Neil.Lv anim...@gmail.com wrote:

Mabye it's a bug with DB.runQuery and DB.use in the two db vender 

Two question: (problem)

1: I don't know why the HelloWorld snippet code will be execute 2
times in this code. (See the HelloWorld.scala file.)
2: The dbDefaultConnectionIdentifier method in the Model that it works
fine when using Mapper's method such as ModelName.findAll(),
it doesn't work when using DB.runQuery and DB.use(...) --- (Maybe it
can't find the default db identifier)

The question 2 I test it many times that found this problem.

In the test app , the Hot.getHots2 and Hot.getHots3 method can't work.

I comment the code now in the HelloWorld.scala file, you can try it.



  I can push the code on the github, and get this errors fatal:
unable to fork

  So If anyone know what's wrong with it and I can send the demo.tar
file through the email.

  Thanks very much!



Cheers,
  Neil

On Jan 21, 1:56 am, Neil.Lv anim...@gmail.com wrote:

   The DB.runQuery can works now, but the DB.prepareStatement also
 cant' work.

   Here is the test app address:
  http://github.com/anim510/two_db_demo

 Cheers,
   Neil

 On Jan 21, 1:16 am, Neil.Lv anim...@gmail.com wrote:

     Thank you very much,

     But it doesn't work yet, maybe because of using two db
  connections.

     I'll test it later again.

  On Jan 21, 12:44 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

   Neil.Lv anim...@gmail.com writes:
Hi all,

  I use two db connections in my app, and I want to use
DB.prepareStatement to select
the records from the second db.

  It failed, Here is the code:
###
  def getHotByTid(id : Long) =
    DB.use(bootstrap.liftweb.TwoDB) {
      conn =
     DB.prepareStatement(SELECT * FROM hots WHERE id=? ,
  conn) {
             stmt =
                     stmt.setLong(1, id)
Log.info(stmt : + stmt)   // The information is correctly
  now, but
after call executeUpdate method
                     stmt.executeUpdate()
      }
   }

   Not sure what your problem is really, but I think you should use
   DB.runQuery to execute a select statement

   Ie

     val (_,result) = DB.runQuery(SELECT COUNT(*), contract_length
   FROM +
                       vehicles_current v +
                       WHERE v.account_id=? +
                       GROUP BY contract_length +
                       ORDER BY contract_length,
                       List(42))

   /Jeppe

  --
  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr

[Lift] Re: How to use prepareStatement to select *** from DB (two db vender)?

2010-01-21 Thread Neil.Lv

  Thanks guys very very much!

  I'm using the Windows XP,  I  reset the height buffer for the CMD
now, and can see the full error message now.

  The code can work fine now ( it's so strange that I run this code on
the another computer , and it's all OK... )

  Maybe I need to delete all the target files.

  :)

Cheers,
  Neil

On Jan 22, 3:09 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 If you are using Windows and CMD.EXE does not hold enough lines to view the 
 error, click the control menu of the CMD window and click Properties, then on 
 the Layout tab you set the height of the screen buffer size.

 -

 Neil.Lvanim...@gmail.com wrote:

 Here is the lastest code now, g...@github.com:anim510/two_db_demo.git

 start server and visit:http://localhost:8080/and get this error, In
 the cmd I can't see all the error message,
 here is the all the message on the cmd screen.

 
 at net.liftweb.http.LiftSession$$anonfun
 $processSurroundAndInclude$1$$an
 onfun$apply$72.apply(LiftSession.scala:1041)
 at net.liftweb.http.LiftSession$$anonfun
 $processSurroundAndInclude$1$$an
 onfun$apply$72.apply(LiftSession.scala:1041)
 at net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
 $processOrD
 efer(LiftSession.scala:1026)
 at net.liftweb.http.LiftSession$$anonfun
 $processSurroundAndInclude$1.app
 ly(LiftSession.scala:1040)
 at net.liftweb.http.LiftSession$$anonfun
 $processSurroundAndInclude$1.app
 ly(LiftSession.scala:1034)
 at scala.Seq$class.flatMap(Seq.scala:294)
 at scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
 at net.liftweb.http.LiftSession.processSurroundAndInclude
 (LiftSession.sc
 ala:1033)
 at net.liftweb.http.LiftSession$$anonfun
 $processSurroundAndInclude$1.app
 ly(LiftSession.scala:1054)
 at net.liftweb.http.LiftSession$$anonfun
 $processSurroundAndInclude$1.app
 ly(LiftSession.scala:1034)
 at scala.Seq$class.flatMap(Seq.scala:294)
 at scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
 at net.liftweb.http.LiftSession.processSurroundAndInclude
 (LiftSession.sc
 ala:1033)
 at net.liftweb.builtin.snippet.Surround$$anonfun$render$1$
 $anonfun$apply
 $2.apply(Surround.scala:37)
 at net.liftweb.builtin.snippet.Surround$$anonfun$render$1$
 $anonfun$apply
 $2.apply(Surround.scala:34)
 at net.liftweb.common.Full.map(Box.scala:330)
 at net.liftweb.builtin.snippet.Surround$$anonfun$render$1.apply
 (Surround
 .scala:34)
 at net.liftweb.builtin.snippet.Surround$$anonfun$render$1.apply
 (Surround
 .scala:33)
 at net.liftweb.common.Full.flatMap(Box.scala:332)
 at net.liftweb.builtin.snippet.Surround$.render(Surround.scala:
 33)
 at net.liftweb.builtin.snippet.Surround$$anonfun$dispatch$1$
 $anonfun$app
 ly$1.apply(Surround.scala:29)
 at net.liftweb.builtin.snippet.Surround$$anonfun$dispatch$1$
 $anonfun$app
 ly$1.apply(Surround.scala:29)
 at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
 $anonfun$a
 pply$61$$anonfun$apply$63.apply(LiftSession.scala:846)
 at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
 $anonfun$a
 pply$61$$anonfun$apply$63.apply(LiftSession.scala:830)
 at net.liftweb.common.EmptyBox.openOr(Box.scala:372)
 at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
 $anonfun$a
 pply$61.apply(LiftSession.scala:830)
 at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
 $anonfun$a
 pply$61.apply(LiftSession.scala:830)
 at net.liftweb.common.EmptyBox.openOr(Box.scala:372)
 at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply
 $58.apply(Lift
 Session.scala:829)
 at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply
 $58.apply(Lift
 Session.scala:829)
 at net.liftweb.http.S$.doSnippet(S.scala:1677)
 at net.liftweb.http.LiftSession$$anonfun$18.apply
 (LiftSession.scala:827)

 at net.liftweb.http.LiftSession$$anonfun$18.apply
 (LiftSession.scala:826)

 at net.liftweb.common.Full.map(Box.scala:330)
 at net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
 $processSni
 ppet(LiftSession.scala:826)
 at net.liftweb.http.LiftSession$$anonfun
 $_defaultLiftTagProcessing$1.app
 ly(LiftSession.scala:942)
 at net.liftweb.http.LiftSession$$anonfun
 $_defaultLiftTagProcessing$1.app
 ly(LiftSession.scala:930)
 at net.liftweb.util.NamedPF.apply(NamedPartialFunction.scala:
 33)
 at net.liftweb.util.NamedPF$.apply(NamedPartialFunction.scala:
 79)
 at net.liftweb.http.LiftSession$$anonfun
 $processSurroundAndInclude$1$$an
 onfun$apply$72$$anonfun$apply$73$$anonfun$apply$74$$anonfun$apply
 $75.apply(LiftS
 ession.scala:1044)
 at net.liftweb.http.LiftSession$$anonfun
 $processSurroundAndInclude$1$$an
 

[Lift] Re: How to use prepareStatement to select *** from DB (two db vender)?

2010-01-21 Thread Neil.Lv


On Jan 22, 10:06 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 'mvn clean' deletes them for you.

 -

 Got it, Thank you very much!

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 use prepareStatement to select *** from DB (two db vender)?

2010-01-20 Thread Neil.Lv
Hi all,

  I use two db connections in my app, and I want to use
DB.prepareStatement to select
the records from the second db.

  It failed, Here is the code:
###
  def getHotByTid(id : Long) =
DB.use(bootstrap.liftweb.TwoDB) {
  conn =
  DB.prepareStatement(SELECT * FROM hots WHERE id=? , conn) {
  stmt =
  stmt.setLong(1, id)
Log.info(stmt : + stmt)   // The information is correctly now, but
after call executeUpdate method
  stmt.executeUpdate()
   }
   }
###

  The update statement can works well:
###
  def updateCountsById(id : Long) =
DB.use(bootstrap.liftweb.TwoDB) {
  conn =
  DB.prepareStatement(UPDATE hots set count=count+1 WHERE id=?,
conn) {
stmt =
   stmt.setLong(1, id)
   stmt.executeUpdate()
  }
   }
###

   Thanks for any suggestion that will be appreciated.

Cheers,
  Neil
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to use prepareStatement to select *** from DB (two db vender)?

2010-01-20 Thread Neil.Lv

   Thank you very much,

   But it doesn't work yet, maybe because of using two db connections.

   I'll test it later again.


On Jan 21, 12:44 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 Neil.Lv anim...@gmail.com writes:
  Hi all,

    I use two db connections in my app, and I want to use
  DB.prepareStatement to select
  the records from the second db.

    It failed, Here is the code:
  ###
    def getHotByTid(id : Long) =
      DB.use(bootstrap.liftweb.TwoDB) {
        conn =
       DB.prepareStatement(SELECT * FROM hots WHERE id=? , conn) {
               stmt =
                       stmt.setLong(1, id)
  Log.info(stmt : + stmt)   // The information is correctly now, but
  after call executeUpdate method
                       stmt.executeUpdate()
        }
     }

 Not sure what your problem is really, but I think you should use
 DB.runQuery to execute a select statement

 Ie

   val (_,result) = DB.runQuery(SELECT COUNT(*), contract_length  FROM +
                     vehicles_current v +
                     WHERE v.account_id=? +
                     GROUP BY contract_length +
                     ORDER BY contract_length,
                     List(42))

 /Jeppe
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to use prepareStatement to select *** from DB (two db vender)?

2010-01-20 Thread Neil.Lv


Mabye it's a bug with DB.runQuery and DB.use in the two db vender 

Two question: (problem)

1: I don't know why the HelloWorld snippet code will be execute 2
times in this code. (See the HelloWorld.scala file.)
2: The dbDefaultConnectionIdentifier method in the Model that it works
fine when using Mapper's method such as ModelName.findAll(),
it doesn't work when using DB.runQuery and DB.use(...) --- (Maybe it
can't find the default db identifier)

The question 2 I test it many times that found this problem.

In the test app , the Hot.getHots2 and Hot.getHots3 method can't work.

I comment the code now in the HelloWorld.scala file, you can try it.



  I can push the code on the github, and get this errors fatal:
unable to fork

  So If anyone know what's wrong with it and I can send the demo.tar
file through the email.

  Thanks very much!



Cheers,
  Neil

On Jan 21, 1:56 am, Neil.Lv anim...@gmail.com wrote:
   The DB.runQuery can works now, but the DB.prepareStatement also
 cant' work.

   Here is the test app address:
  http://github.com/anim510/two_db_demo

 Cheers,
   Neil

 On Jan 21, 1:16 am, Neil.Lv anim...@gmail.com wrote:

 Thank you very much,

 But it doesn't work yet, maybe because of using two db connections.

 I'll test it later again.

  On Jan 21, 12:44 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

   Neil.Lv anim...@gmail.com writes:
Hi all,

  I use two db connections in my app, and I want to use
DB.prepareStatement to select
the records from the second db.

  It failed, Here is the code:
###
  def getHotByTid(id : Long) =
DB.use(bootstrap.liftweb.TwoDB) {
  conn =
 DB.prepareStatement(SELECT * FROM hots WHERE id=? , conn) {
 stmt =
 stmt.setLong(1, id)
Log.info(stmt : + stmt)   // The information is correctly now, but
after call executeUpdate method
 stmt.executeUpdate()
  }
   }

   Not sure what your problem is really, but I think you should use
   DB.runQuery to execute a select statement

   Ie

 val (_,result) = DB.runQuery(SELECT COUNT(*), contract_length  FROM +
   vehicles_current v +
   WHERE v.account_id=? +
   GROUP BY contract_length +
   ORDER BY contract_length,
   List(42))

   /Jeppe
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to use prepareStatement to select *** from DB (two db vender)?

2010-01-20 Thread Neil.Lv

  My email is :   anim...@gmail.com

On Jan 21, 11:17 am, Neil.Lv anim...@gmail.com wrote:
 Mabye it's a bug with DB.runQuery and DB.use in the two db vender 

 Two question: (problem)

 1: I don't know why the HelloWorld snippet code will be execute 2
 times in this code. (See the HelloWorld.scala file.)
 2: The dbDefaultConnectionIdentifier method in the Model that it works
 fine when using Mapper's method such as ModelName.findAll(),
 it doesn't work when using DB.runQuery and DB.use(...) --- (Maybe it
 can't find the default db identifier)

 The question 2 I test it many times that found this problem.

 In the test app , the Hot.getHots2 and Hot.getHots3 method can't work.

 I comment the code now in the HelloWorld.scala file, you can try it.

 

   I can push the code on the github, and get this errors fatal:
 unable to fork

   So If anyone know what's wrong with it and I can send the demo.tar
 file through the email.

   Thanks very much!

 

 Cheers,
   Neil

 On Jan 21, 1:56 am, Neil.Lv anim...@gmail.com wrote:

The DB.runQuery can works now, but the DB.prepareStatement also
  cant' work.

Here is the test app address:
   http://github.com/anim510/two_db_demo

  Cheers,
Neil

  On Jan 21, 1:16 am, Neil.Lv anim...@gmail.com wrote:

  Thank you very much,

  But it doesn't work yet, maybe because of using two db connections.

  I'll test it later again.

   On Jan 21, 12:44 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

Neil.Lv anim...@gmail.com writes:
 Hi all,

   I use two db connections in my app, and I want to use
 DB.prepareStatement to select
 the records from the second db.

   It failed, Here is the code:
 ###
   def getHotByTid(id : Long) =
 DB.use(bootstrap.liftweb.TwoDB) {
   conn =
  DB.prepareStatement(SELECT * FROM hots WHERE id=? , conn) {
  stmt =
  stmt.setLong(1, id)
 Log.info(stmt : + stmt)   // The information is correctly now, but
 after call executeUpdate method
  stmt.executeUpdate()
   }
}

Not sure what your problem is really, but I think you should use
DB.runQuery to execute a select statement

Ie

  val (_,result) = DB.runQuery(SELECT COUNT(*), contract_length  FROM 
+
vehicles_current v +
WHERE v.account_id=? +
GROUP BY contract_length +
ORDER BY contract_length,
List(42))

/Jeppe
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Two database are broken in 1.1-M8, works fine in 1.1-M7 .

2010-01-13 Thread Neil.Lv
Hi David,

   I'm sorry about it that i write it wrong.

   But I change the second DBVendor name to DBVendor_2, and it create
a db file named lift_proto2.db.h2.db.
And it doesn't work, I add this method to the User model to specify
the default db connection.

###
override def dbDefaultConnectionIdentifier = bootstrap.liftweb.OneDB
###

   I use this code in M7 and it's fine.

   How can i define a vendor for the DefaultConnectionIdentifier in
M8?

   Thank you very much!

Cheers,
  Neil

On Jan 13, 1:35 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 The problem with this code is you are using the same connection vendor
 for both connection identifiers *and* you're not defining a vendor for
 the DefaultConnectionIdentifier

 On Jan 11, 7:05 am, Neil.Lv anim...@gmail.com wrote:

  Hi all,

     There is a problem when i upgrading the 1.1-M7 to 1.1-M8, the db
  connection is broken.

     I use two database connection in my app, it's broken in 1.1-M8.
  ###
  object OneDB extends ConnectionIdentifier {
   override def jndiName = lift_proto}

  object TwoDB extends ConnectionIdentifier {
   override def jndiName = lift_proto2}

  ###

     The error message is:
  ###
  HTTP ERROR 500

  Problem accessing /. Reason:

      Looking for Connection Identifier ConnectionIdentifier(lift) but
  failed to find either a JNDI data source with the name lift or a lift
  connection manager with the correct name
  ###

    Maybe I missing something else configure in M8 that it's different
  from M7.

    The test demo address is :http://github.com/anim510/two_db_demo

    Thanks for any help very much!

  Cheers,
    Neil
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Two database are broken in 1.1-M8, works fine in 1.1-M7 .

2010-01-13 Thread Neil.Lv
  David, Thank you very much!

  It works now, I'm so sorry about that I didn't see the yak demo
yesterday .

  :)

Cheers,
  Neil

On Jan 14, 12:43 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Wed, Jan 13, 2010 at 6:18 AM, Neil.Lv anim...@gmail.com wrote:
  Hi David,

I'm sorry about it that i write it wrong.

But I change the second DBVendor name to DBVendor_2, and it create
  a db file named lift_proto2.db.h2.db.
  And it doesn't work, I add this method to the User model to specify
  the default db connection.

  ###
  override def dbDefaultConnectionIdentifier = bootstrap.liftweb.OneDB
  ###

I use this code in M7 and it's fine.

How can i define a vendor for the DefaultConnectionIdentifier in
  M8?

 The same way you define it in every version of Lift:
 DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)





Thank you very much!

  Cheers,
   Neil

  On Jan 13, 1:35 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   The problem with this code is you are using the same connection vendor
   for both connection identifiers *and* you're not defining a vendor for
   the DefaultConnectionIdentifier

   On Jan 11, 7:05 am, Neil.Lv anim...@gmail.com wrote:

Hi all,

   There is a problem when i upgrading the 1.1-M7 to 1.1-M8, the db
connection is broken.

   I use two database connection in my app, it's broken in 1.1-M8.
###
object OneDB extends ConnectionIdentifier {
 override def jndiName = lift_proto}

object TwoDB extends ConnectionIdentifier {
 override def jndiName = lift_proto2}

###

   The error message is:
###
HTTP ERROR 500

Problem accessing /. Reason:

Looking for Connection Identifier ConnectionIdentifier(lift) but
failed to find either a JNDI data source with the name lift or a lift
connection manager with the correct name
###

  Maybe I missing something else configure in M8 that it's different
from M7.

  The test demo address is :http://github.com/anim510/two_db_demo

  Thanks for any help very much!

Cheers,
  Neil

  --
  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: **IMPORTANT** Lift 2.0 Milestone1 is coming and it's time to test the SNAPSHOT in master

2010-01-12 Thread Neil.Lv
Hi all,

   Maybe the mapper is broken in M8 ?

   I use only one database in M8 ( upgrade from M7) it works fine, but
use two db connection and it doesn't work. (works fine in M7).

   Here is the topic about this issue.

   Thank you very much for any help!

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: **IMPORTANT** Lift 2.0 Milestone1 is coming and it's time to test the SNAPSHOT in master

2010-01-12 Thread Neil.Lv

  Oh, I'm sorry about that I forget pasting the topic url.

  Here is : 
http://groups.google.com/group/liftweb/browse_thread/thread/6ca3fd7deb41b1f9

  Thank you very much!

Cheers,
  Neil

On Jan 13, 2:48 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Tue, Jan 12, 2010 at 6:47 AM, Neil.Lv anim...@gmail.com wrote:
  Hi all,

Maybe the mapper is broken in M8 ?

 I'm in meetings for most of today, but I will look at the DB issues you've
 reported tonight.



I use only one database in M8 ( upgrade from M7) it works fine, but
  use two db connection and it doesn't work. (works fine in M7).

Here is the topic about this issue.

Thank you very much for any help!

  Cheers,
Neil

  --
  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: JNDI error when switching to M8 ?

2010-01-11 Thread Neil.Lv
  Does anyone know that what's wrong with it ?

Cheers,
  Neil

On Jan 10, 9:50 pm, Neil.Lv anim...@gmail.com wrote:
   Here is the test code .

   g...@github.com:anim510/two_db_demo.git

   It works fine when using only one database, it failed when using two
 db connection.

   Thanks.!

 Cheers,
   Neil

 On Jan 10, 5:04 pm, Neil.Lv anim...@gmail.com wrote:

  Hi all,

 There is a problem that i switch the M7 to M8, the JNDI is error.

 I didn't change anything before moving M7 to M8.

 It seems that the Lift looks for the lift ConnectionIdentifier not
  the OneDB or TwoDB.

  ###
  java.lang.NullPointerException: Looking for Connection Identifier
  ConnectionIden
  tifier(lift) but failed to find either a JNDI data source with the
  name lift or
  a lift connection manager with the correct name
  ###

I have two DB connection, in the Boot.scala
  ###
  object OneDB extends ConnectionIdentifier {
   def jndiName = one}

  object TwoDB extends ConnectionIdentifier {
   def jndiName = two}

  ---
  class Boot {
def boot {
  if (!DB.jndiJdbcConnAvailable_?) {
 DB.defineConnectionManager(OneDB, DBVendor)
 DB.defineConnectionManager(TwoDB, DBVendor_2)
  }
}}

  ###

This work fine under the M7, but is broken in the M8,

Does anyone know what's wrong with it ?

Thanks for any suggestion!

  Cheers,
Neil
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] Two database are broken in 1.1-M8, works fine in 1.1-M7 .

2010-01-11 Thread Neil.Lv
Hi all,

   There is a problem when i upgrading the 1.1-M7 to 1.1-M8, the db
connection is broken.

   I use two database connection in my app, it's broken in 1.1-M8.
###
object OneDB extends ConnectionIdentifier {
 override def jndiName = lift_proto
}
object TwoDB extends ConnectionIdentifier {
 override def jndiName = lift_proto2
}
###

   The error message is:
###
HTTP ERROR 500

Problem accessing /. Reason:

Looking for Connection Identifier ConnectionIdentifier(lift) but
failed to find either a JNDI data source with the name lift or a lift
connection manager with the correct name
###

  Maybe I missing something else configure in M8 that it's different
from M7.

  The test demo address is : http://github.com/anim510/two_db_demo

  Thanks for any help very much!

Cheers,
  Neil
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] JNDI error when switching to M8 ?

2010-01-10 Thread Neil.Lv
Hi all,

   There is a problem that i switch the M7 to M8, the JNDI is error.

   I didn't change anything before moving M7 to M8.

   It seems that the Lift looks for the lift ConnectionIdentifier not
the OneDB or TwoDB.

###
java.lang.NullPointerException: Looking for Connection Identifier
ConnectionIden
tifier(lift) but failed to find either a JNDI data source with the
name lift or
a lift connection manager with the correct name
###

  I have two DB connection, in the Boot.scala
###
object OneDB extends ConnectionIdentifier {
 def jndiName = one
}
object TwoDB extends ConnectionIdentifier {
 def jndiName = two
}
---
class Boot {
  def boot {
if (!DB.jndiJdbcConnAvailable_?) {
   DB.defineConnectionManager(OneDB, DBVendor)
   DB.defineConnectionManager(TwoDB, DBVendor_2)
}
  }
}
###

  This work fine under the M7, but is broken in the M8,

  Does anyone know what's wrong with it ?

  Thanks for any suggestion!

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: JNDI error when switching to M8 ?

2010-01-10 Thread Neil.Lv

  Here is the test code .

  g...@github.com:anim510/two_db_demo.git

  It works fine when using only one database, it failed when using two
db connection.

  Thanks.!

Cheers,
  Neil

On Jan 10, 5:04 pm, Neil.Lv anim...@gmail.com wrote:
 Hi all,

    There is a problem that i switch the M7 to M8, the JNDI is error.

    I didn't change anything before moving M7 to M8.

    It seems that the Lift looks for the lift ConnectionIdentifier not
 the OneDB or TwoDB.

 ###
 java.lang.NullPointerException: Looking for Connection Identifier
 ConnectionIden
 tifier(lift) but failed to find either a JNDI data source with the
 name lift or
 a lift connection manager with the correct name
 ###

   I have two DB connection, in the Boot.scala
 ###
 object OneDB extends ConnectionIdentifier {
  def jndiName = one}

 object TwoDB extends ConnectionIdentifier {
  def jndiName = two}

 ---
 class Boot {
   def boot {
     if (!DB.jndiJdbcConnAvailable_?) {
        DB.defineConnectionManager(OneDB, DBVendor)
        DB.defineConnectionManager(TwoDB, DBVendor_2)
     }
   }}

 ###

   This work fine under the M7, but is broken in the M8,

   Does anyone know what's wrong with it ?

   Thanks for any suggestion!

 Cheers,
   Neil
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Example project -- Image gallery

2010-01-06 Thread Neil.Lv
  Thanks for sharing this, it's very useful and helpful to us
(beginner).

Cheers,
  Neil

On Jan 7, 1:20 am, David Pollak feeder.of.the.be...@gmail.com wrote:
 Thanks for sharing!

 Double thanks for spelling my last name correctly!!



 On Wed, Jan 6, 2010 at 9:12 AM, Jim Wise jw...@draga.com wrote:
  I've put the image gallery code I've been working on up at:

 http://github.com/jimwise/shared

  as a runnable project, both in hope that it will be useful to other
  people learning lift, and in hope of some (gentle) pointers as to what I
  could do better with this.

  Oh, one caveat -- I've set Jetty to run on port 9080 within this code,
  so use accordingly when playing with this.

  This code, building on David Pollak's image upload example, provides an
  image gallery with support for uploading, renaming, categorizing and
  deleting images, as well as browsing uploaded images by category.

  This is still very much a work in progress -- next steps from where I'm
  sitting are:

   a.) some corner cases of form validation -- don't allow categories to
   be created with a '/' in their name, as this breaks the URL
   rewrites

   b.) Ajax, Ajax, Ajax

   c.) make it easier to use this within a larger project -- this is
   already split into a separate package hierarchy from the
   surrounding project, but I'd like to follow the ProtoUser stuff
   in, eg, providing a canned Sitemap fragment for a surrounding
   project to use.

   d.) require a logged in user to upload or edit, but anyone can view
   (easy enough to add -- I've done it in other code -- but I haven't
   done it here)

   e.) reduce the number of queries this makes -- it's not too heavy, but
   some convenience functions encapsulating joins could still save some.

  Anyway, I'd love any thoughts on what I could be doing differently here,
  and hope this helps anyone else who is, like me, just starting out with
  lift.

  --
 Jim Wise
 jw...@draga.com

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Happy New Year!

2009-12-30 Thread Neil.Lv

  Thank you and Happy New Year to all the Lifter!

Cheer,
  Neil

On Dec 30, 9:48 pm, Marius marius.dan...@gmail.com wrote:
 Thank you. Happy new year to you too.

 Br's
 Marius

 On Dec 30, 2:12 pm, koveen liep...@xs4all.nl wrote:

  I would like to wish everybody on this list a happy new year.
  A year in which it will be fun to  learn more about Lift

  Greetings,

  Ko

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to reRender the page via js in Chat demo of the lift ?

2009-12-28 Thread Neil.Lv

  OK, Thank you very much!

Cheers,
  Neil

On Dec 28, 11:01 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 If you never want to show more than 5 chats, you need to move the logic for
 trimming to 5 chats into the line where you calculate the update. It looks
 like you're trying to just update the difference between the incoming
 updates and your current chats.

 Derek

 On Sat, Dec 19, 2009 at 3:47 AM, Neil.Lv anim...@gmail.com wrote:
  Hi all,

   How to reRender the page via js in Chat demo of the lift ?

   Here is an example:
  ###  In the index page, show all the message that the users sent
  user 1: message 1
  user 2: message 2
  user 3: message 3
  user 4: message 4
  user 5: message 5
  ###

   Here are 5 messages, then i want to refresh the messages when the
  message count 5,
  ###
  user 1: message 1
  user 2: message 2
  user 3: message 3
  user 4: message 4
  user 5: message 5
  refresh:  can't refresh, also show 6 messages, i want to show 5
  messages.
  ###

   Here is code in the Comet:
  ###
  lass Chat extends CometActor with CometListener {
  ...
   override def lowPriority = {
     case ChatServerUpdate(value) =
       val update = (value -- chats).reverse.map(b = AppendHtml
  (infoId, line(b)))
       partialUpdate(update)
       chats = value.take(5)
   }
  ...
  }
  ###

    In the example, when the message counts =5, i set the count to 5
  via
   ###
   chats = value.take(5)
  ###

    Is there a js function can do this, when the chats's size is bigger
  than 5, then refresh the messages.

   Thanks for any suggestion!

  Cheers,
   Neil

  --

  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How could i send a HTTP get or post request in the Snippet or Views in the Lift?

2009-12-22 Thread Neil.Lv
  Ok, Thanks guys!

  I'll be try it .

Cheers.
  Neil

On Dec 22, 4:36 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 You might want to checkout the scala http library, dispatch:

 http://databinder.net/dispatch/

 Cheers, Tim

 On Dec 22, 7:46 am, Marius marius.dan...@gmail.com wrote:

  Well from your Snippet method you can just use HttpURLConnection, or
  Apache Commons Client to make remote requests to other services. Of
  course typically you won't do this directly from the snippet method
  but from a Service layer of your application. One you get the response
  (say it's an XML) you parse it using Scala XML class and the extract
  relevant information using pattern matching or by some other means.
  From here you just construct the NodeSeq that the Snippet/View needs
  to return.

  As a side note ...
  If those requests are taking a long time, you can wrap your snippet in
  lift:lazy-load ... and it will be loaded asynchronously. There is
  another attribute (lift:parallel=true)that you could specify to a
  snippet that it will be run asynchronously allowing other snippets to
  process and the result will be merged into the HTTP response right
  before sending the response to the client. Note that you need to set
  LiftRules.allowParallelSnippets

  Br's,
  Marius

  On Dec 22, 8:39 am, Neil.Lv anim...@gmail.com wrote:

   Hi all,

  How could i send a HTTP get or post request in the Snippet or Views
   in the Lift?

  For example, the weather API .

   I want to send an HTTP get request or post request to another
   website that it supplies some
   APIs, then in the lift we can receive the return data such as XML
   data, so we can use these XML or Json data
   in the Snippet or the Views.

   Thanks for any help!

   Cheers,
 Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 the Chat demo of the Lift?

2009-12-21 Thread Neil.Lv
Hi all

   I have a silly question about the Chat demo.

   How could i create a Chat room in this demo ?

   Maybe i can define a variable or some other method to achieve the
purpose !

   Now all the people are in the same Chat room ( global ) in the
example, so i want to create more than one
Chat rooms that every one can contain 100 people.

   Thanks for any suggestion!

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 could i send a HTTP get or post request in the Snippet or Views in the Lift?

2009-12-21 Thread Neil.Lv
Hi all,

   How could i send a HTTP get or post request in the Snippet or Views
in the Lift?

   For example, the weather API .

I want to send an HTTP get request or post request to another
website that it supplies some
APIs, then in the lift we can receive the return data such as XML
data, so we can use these XML or Json data
in the Snippet or the Views.

Thanks for any help!

Cheers,
  Neil


--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 the Chat demo of the Lift?

2009-12-21 Thread Neil.Lv

  OK, and Where is the code about the Creating more Chat Rooms?

   Thanks very much!

Cheers,
  Neil

On Dec 22, 2:34 pm, Margaret mawei...@gmail.com wrote:
 see this

 http://github.com/maweis1981/chatOnLift

 -
 mawei...@gmail.com
 13585201588http://maweis.com

 On Tue, Dec 22, 2009 at 2:31 PM, Neil.Lv anim...@gmail.com wrote:
  Hi all

I have a silly question about the Chat demo.

How could i create a Chat room in this demo ?

Maybe i can define a variable or some other method to achieve the
  purpose !

Now all the people are in the same Chat room ( global ) in the
  example, so i want to create more than one
  Chat rooms that every one can contain 100 people.

Thanks for any suggestion!

  Cheers,
   Neil

  --

  You received this message because you are subscribed to the Google Groups 
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to 
  liftweb+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/liftweb?hl=en.

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How can i get the user IP address in the lift ?

2009-12-20 Thread Neil.Lv
  OK, Got it.

  Thank guys!

  Thanks for these useful information!

Cheers,
  Neil

On Dec 20, 5:38 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Personally, i'd drop the lambda, and do:

 S.containerRequest.map(_.remoteAddress).openOr(localhost)

 the map returns a Box[String], so we can get access and provide a
 handy default if need be. If you dont want that, just do a pattern
 match or whatever you want.

 Cheers, Tim

 On Dec 20, 2:38 am, Jarod Liu liuyuan...@gmail.com wrote:

  S.containerRequest.map(r=println(r.remoteAddress))

  On Dec 20, 4:18 am, Neil.Lv anim...@gmail.com wrote:

   Hi all,

      I want to get the IP address of the users.

      How can i get the remote IP address in the lift?

      Thanks for any suggestion!

   Cheers,
     Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 reRender the page via js in Chat demo of the lift ?

2009-12-19 Thread Neil.Lv
Hi all,

  How to reRender the page via js in Chat demo of the lift ?

  Here is an example:
###  In the index page, show all the message that the users sent
user 1: message 1
user 2: message 2
user 3: message 3
user 4: message 4
user 5: message 5
###

  Here are 5 messages, then i want to refresh the messages when the
message count 5,
###
user 1: message 1
user 2: message 2
user 3: message 3
user 4: message 4
user 5: message 5
refresh:  can't refresh, also show 6 messages, i want to show 5
messages.
###

  Here is code in the Comet:
###
lass Chat extends CometActor with CometListener {
...
  override def lowPriority = {
case ChatServerUpdate(value) =
  val update = (value -- chats).reverse.map(b = AppendHtml
(infoId, line(b)))
  partialUpdate(update)
  chats = value.take(5)
  }
...
}
###

   In the example, when the message counts =5, i set the count to 5
via
 ###
 chats = value.take(5)
###

   Is there a js function can do this, when the chats's size is bigger
than 5, then refresh the messages.

  Thanks for any suggestion!

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to redirect to a specify url when logged in successfully?

2009-12-19 Thread Neil.Lv
   Thanks David,

   Override the homePage method, and it works now!

   But the loginFirst method can't work.

Cheers,
  Neil

On Dec 19, 8:09 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 I did a override def homePage = /all_users and that's where I go after I
 log in.



 On Thu, Dec 3, 2009 at 5:44 AM, Neil.Lv anim...@gmail.com wrote:
   I added this code in the User model, but it doesn't work yet.

   This println method is never executed.

   Maybe some configuration need to be set ?

  ###
  object User extends User with MetaMegaProtoUser[User] {
   ...
    override def loginFirst = If(
     loggedIn_? _,
     () = {
       import net.liftweb.http.{RedirectWithState, RedirectState}
        val uri = Full(/all_users)
  println( xxx )
        RedirectWithState(
         loginPageURL,
         RedirectState( ()={loginRedirect.set(uri)})
       )
     }
   )
    ...
  }
  ###

  Cheers,
   Neil

  On Dec 1, 8:15 am, David Pollak feeder.of.the.be...@gmail.com wrote:
   On Sun, Nov 29, 2009 at 12:17 AM, Neil.Lv anim...@gmail.com wrote:
Hi all,

  I want to redirecto to a specify URL like this /all_users when
logged in successfully via the default link,
   http://localhost:8080/user_mgt/login

 Is there a help method (i dont't find it) to configure it?

 When i logged in successfully via /user_mgt/login link and redirect
to the /all_users link not the /index page.

   In your User object (singleton):
     override def loginFirst = If(
       loggedIn_? _,
       () = {
         import net.liftweb.http.{RedirectWithState, RedirectState}
         val uri = /all_users
         RedirectWithState(
           loginPageURL,
           RedirectState( ()={loginRedirect.set(uri)})
         )
       }
     )

 Thanks for any help.

Cheers,
 Neil

--

You received this message because you are subscribed to the Google
  Groups
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com

.
For more options, visit this group at
   http://groups.google.com/group/liftweb?hl=en.

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Surf the harmonics

  --

  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 can i specify the Interval time for the Comet ?

2009-12-19 Thread Neil.Lv
Hi all,

  How can i specify the Interval time for the Comet ?

  Just like the chat demo in the lift examples, i have a problem that
how to set
the interval time for the every http request ?

  That means the user only post the message to the comet every 3
seconds, and doesn't post
the message all the time.

 Thanks for any suggestion!

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How can i specify the Interval time for the Comet ?

2009-12-19 Thread Neil.Lv

   If there are many people in the Chat room, and there is a person
(not friendly) post the same message all the time,

   So i want to limit the time that post the messages to the server.

   Maybe i can use an variable to record the last person that post
message to the server.

   Thanks!

Cheers,
  Neil

On Dec 19, 10:16 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Neil,

 The polling is not periodic, it's constant and the polling for Comet takes
 place immediately (well 100ms after the page loads).

 What is the advantage that you see to a periodic poll rather than the
 continuous long poll that is currently implemented?

 Thanks,

 David



 On Sat, Dec 19, 2009 at 5:01 AM, Neil.Lv anim...@gmail.com wrote:
  Hi all,

   How can i specify the Interval time for the Comet ?

   Just like the chat demo in the lift examples, i have a problem that
  how to set
  the interval time for the every http request ?

   That means the user only post the message to the comet every 3
  seconds, and doesn't post
  the message all the time.

   Thanks for any suggestion!

  Cheers,
   Neil

  --

  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How can i update and insert record into database via Raw sql in Lift?

2009-12-19 Thread Neil.Lv
  Got it, thank you very much!

   :)

Cheers,
  Neil

On Dec 19, 11:02 pm, Marcin Jurczuk mjurc...@gmail.com wrote:
 Neil,

 from java.SQL:
  return INT - executeUpdate()
           Executes the SQL statement in this PreparedStatement object,
 which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL
 statement that returns nothing, such as a DDL statement.

  return ResultSet       executeQuery()
           Executes the SQL query in this PreparedStatement object and
 returns the ResultSet object generated by the query.

 FYI

 Marcin,

 On 19 Gru, 08:26, Neil.Lv anim...@gmail.com wrote:

   It works now.

   I use the same executeUpdate method, and it can insert into the db.

   Thanks Marcin,

  Cheers,
    Neil

  On Dec 19, 1:29 am, Neil.Lv anim...@gmail.com wrote:

   Hi Marcin,

      Thank you very much! The update statement works now!

      There is a question about the insert statement, how can i use the
   prepareStatement ?

   ###
     INSERT INTO blogs click_counts=100 WHERE id=1
   ###

      I'm not familiar with it,

      Thanks very much!

      :)

   Cheers,
     Neil

   On Dec 18, 11:13 pm, Marcin Jurczuk mjurc...@gmail.com wrote:

Hi,

You have few options:
- DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
id=1)
- DBprepareStatement(UPDATE blogs set click_counts=click_counts+1
WHERE id=?,yourDBConnection) {
stmt =
stmt.setLong(1,1)
stmt.executeUpdate()}

Where first 1 in setLong is position in prepared statment where you
will put second value. Since You have only one ? it always will be
1.

WARNING:
runQuery is vulnerable to SQL injection in many situations (mostly
where string is passed to query)

Marcin,

On 18 Gru, 15:45, Neil.Lv anim...@gmail.com wrote:

 Hi all,

    How can i update and insert record into database via Raw sql in
 Lift?

    I write some code but it failed, here is :

 ### In the model

   def updateClickCountsById(id: Long) =
     DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
 id=1)

   def insertRecord() =
     DB.runQuery(INSERT INTO blogs click_counts=100 WHERE id=1)

 ###

    This two method doesn't work, so how can i update and insert via
 raw SQL in the lift with Mapper?

    Thanks for any suggestion !

 Cheers,
   Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How can i specify the Interval time for the Comet ?

2009-12-19 Thread Neil.Lv

  Thanks guys!

  Thank you for these useful messages.

  I know how to do it now !

 Cheers,
  Neil

On Dec 20, 12:06 am, Marius marius.dan...@gmail.com wrote:
 That should be hold in your application logic (potentially your
 CometActor logic) and it has nothing to do with the actual Comet
 polling. You could probably keep for each message the timestamp and
 look for the frequencies when the same message is posted.

 Br's,
 Marius

 On Dec 19, 5:37 pm, Neil.Lv anim...@gmail.com wrote:

     If there are many people in the Chat room, and there is a person
  (not friendly) post the same message all the time,

     So i want to limit the time that post the messages to the server.

     Maybe i can use an variable to record the last person that post
  message to the server.

     Thanks!

  Cheers,
    Neil

  On Dec 19, 10:16 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:

   Neil,

   The polling is not periodic, it's constant and the polling for Comet takes
   place immediately (well 100ms after the page loads).

   What is the advantage that you see to a periodic poll rather than the
   continuous long poll that is currently implemented?

   Thanks,

   David

   On Sat, Dec 19, 2009 at 5:01 AM, Neil.Lv anim...@gmail.com wrote:
Hi all,

 How can i specify the Interval time for the Comet ?

 Just like the chat demo in the lift examples, i have a problem that
how to set
the interval time for the every http request ?

 That means the user only post the message to the comet every 3
seconds, and doesn't post
the message all the time.

 Thanks for any suggestion!

Cheers,
 Neil

--

You received this message because you are subscribed to the Google 
Groups
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
.
For more options, visit this group at
   http://groups.google.com/group/liftweb?hl=en.

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 can i get the user IP address in the lift ?

2009-12-19 Thread Neil.Lv
Hi all,

   I want to get the IP address of the users.

   How can i get the remote IP address in the lift?

   Thanks for any suggestion!

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How can i update and insert record into database via Raw sql in Lift?

2009-12-18 Thread Neil.Lv
Hi Marcin,

   Thank you very much! The update statement works now!

   There is a question about the insert statement, how can i use the
prepareStatement ?

###
  INSERT INTO blogs click_counts=100 WHERE id=1
###

   I'm not familiar with it,

   Thanks very much!

   :)

Cheers,
  Neil

On Dec 18, 11:13 pm, Marcin Jurczuk mjurc...@gmail.com wrote:
 Hi,

 You have few options:
 - DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
 id=1)
 - DBprepareStatement(UPDATE blogs set click_counts=click_counts+1
 WHERE id=?,yourDBConnection) {
 stmt =
 stmt.setLong(1,1)
 stmt.executeUpdate()}

 Where first 1 in setLong is position in prepared statment where you
 will put second value. Since You have only one ? it always will be
 1.

 WARNING:
 runQuery is vulnerable to SQL injection in many situations (mostly
 where string is passed to query)

 Marcin,

 On 18 Gru, 15:45, Neil.Lv anim...@gmail.com wrote:

  Hi all,

     How can i update and insert record into database via Raw sql in
  Lift?

     I write some code but it failed, here is :

  ### In the model

    def updateClickCountsById(id: Long) =
      DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
  id=1)

    def insertRecord() =
      DB.runQuery(INSERT INTO blogs click_counts=100 WHERE id=1)

  ###

     This two method doesn't work, so how can i update and insert via
  raw SQL in the lift with Mapper?

     Thanks for any suggestion !

  Cheers,
    Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How can i update and insert record into database via Raw sql in Lift?

2009-12-18 Thread Neil.Lv
 It works now.

 I use the same executeUpdate method, and it can insert into the db.

 Thanks Marcin,

Cheers,
  Neil


On Dec 19, 1:29 am, Neil.Lv anim...@gmail.com wrote:
 Hi Marcin,

    Thank you very much! The update statement works now!

    There is a question about the insert statement, how can i use the
 prepareStatement ?

 ###
   INSERT INTO blogs click_counts=100 WHERE id=1
 ###

    I'm not familiar with it,

    Thanks very much!

    :)

 Cheers,
   Neil

 On Dec 18, 11:13 pm, Marcin Jurczuk mjurc...@gmail.com wrote:

  Hi,

  You have few options:
  - DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
  id=1)
  - DBprepareStatement(UPDATE blogs set click_counts=click_counts+1
  WHERE id=?,yourDBConnection) {
  stmt =
  stmt.setLong(1,1)
  stmt.executeUpdate()}

  Where first 1 in setLong is position in prepared statment where you
  will put second value. Since You have only one ? it always will be
  1.

  WARNING:
  runQuery is vulnerable to SQL injection in many situations (mostly
  where string is passed to query)

  Marcin,

  On 18 Gru, 15:45, Neil.Lv anim...@gmail.com wrote:

   Hi all,

      How can i update and insert record into database via Raw sql in
   Lift?

      I write some code but it failed, here is :

   ### In the model

     def updateClickCountsById(id: Long) =
       DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
   id=1)

     def insertRecord() =
       DB.runQuery(INSERT INTO blogs click_counts=100 WHERE id=1)

   ###

      This two method doesn't work, so how can i update and insert via
   raw SQL in the lift with Mapper?

      Thanks for any suggestion !

   Cheers,
     Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 can bind more than one element in the render method in CometActor ?

2009-12-08 Thread Neil.Lv
Hi all,

   How can bind more than one element in the render method in
CometActor ?

   The msg1 is an
###
class TestComet extends CometActor {
  override def defaultPrefix = Full(info)
  ...
  def render = { bind(One   - span1/span,
 Two   - span2/span,
 Three - span3/span,
 Four  - span4/span,
 Five  - span5/span,
 Six   - span6/span ) }
  ...
}
###

  And in the index.html page
###
...
lift:comet type=TestComet
  info:One/
/lift:comet
span/span
lift:comet type=TestComet
  info:Two/
/lift:comet
span/span
lift:comet type=TestComet
  info:Three
/lift:comet
span/span
lift:comet type=TestComet
  info:Four
/lift:comet
...
###

  And these four comet all show the same result  span3/span,
not 1, 2, 3, 4, 5, 6 

  I don't know what's wrong with it ?

  Dose anybody know what's the problem with this render metho?

  Thanks for any help.

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How can bind more than one element in the render method in CometActor ?

2009-12-08 Thread Neil.Lv

  BTW, when the partialUpdate method is called , the result is
correct.

  But when refreshing the browser or open a new browser, the result
also is 3,

Cheers,
  Neil

On Dec 9, 12:44 am, Neil.Lv anim...@gmail.com wrote:
 Hi all,

    How can bind more than one element in the render method in
 CometActor ?

    The msg1 is an
 ###
 class TestComet extends CometActor {
   override def defaultPrefix = Full(info)
   ...
   def render = { bind(One   - span1/span,
                              Two   - span2/span,
                              Three - span3/span,
                              Four  - span4/span,
                              Five  - span5/span,
                              Six   - span6/span ) }
   ...}

 ###

   And in the index.html page
 ###
 ...
 lift:comet type=TestComet
   info:One/
 /lift:comet
 span/span
 lift:comet type=TestComet
   info:Two/
 /lift:comet
 span/span
 lift:comet type=TestComet
   info:Three
 /lift:comet
 span/span
 lift:comet type=TestComet
   info:Four
 /lift:comet
 ...
 ###

   And these four comet all show the same result  span3/span,
 not 1, 2, 3, 4, 5, 6 

   I don't know what's wrong with it ?

   Dose anybody know what's the problem with this render metho?

   Thanks for any help.

 Cheers,
   Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How can bind more than one element in the render method in CometActor ?

2009-12-08 Thread Neil.Lv

  Whether I have to create six comet to archieve this purpose ?

  I want to use only one comet to update the six parts.

  The layouf is like this:
###
part1 part2


part3 part6
part4
part5
###

###
...
lift:comet type=TestComet
  info:One/
/lift:comet
span/span
lift:comet type=TestComet
  info:Two/
/lift:comet
span/span
lift:comet type=TestComet
  info:Three
/lift:comet
span/span
lift:comet type=TestComet
  info:Four
/lift:comet
...
lift:comet type=TestComet
  info:Sixr
/lift:comet
###

   Thanks!

Cheers,
  Neil


On Dec 9, 12:49 am, Neil.Lv anim...@gmail.com wrote:
   BTW, when the partialUpdate method is called , the result is
 correct.

   But when refreshing the browser or open a new browser, the result
 also is 3,

 Cheers,
   Neil

 On Dec 9, 12:44 am, Neil.Lv anim...@gmail.com wrote:

  Hi all,

     How can bind more than one element in the render method in
  CometActor ?

     The msg1 is an
  ###
  class TestComet extends CometActor {
    override def defaultPrefix = Full(info)
    ...
    def render = { bind(One   - span1/span,
                               Two   - span2/span,
                               Three - span3/span,
                               Four  - span4/span,
                               Five  - span5/span,
                               Six   - span6/span ) }
    ...}

  ###

    And in the index.html page
  ###
  ...
  lift:comet type=TestComet
    info:One/
  /lift:comet
  span/span
  lift:comet type=TestComet
    info:Two/
  /lift:comet
  span/span
  lift:comet type=TestComet
    info:Three
  /lift:comet
  span/span
  lift:comet type=TestComet
    info:Four
  /lift:comet
  ...
  ###

    And these four comet all show the same result  span3/span,
  not 1, 2, 3, 4, 5, 6 

    I don't know what's wrong with it ?

    Dose anybody know what's the problem with this render metho?

    Thanks for any help.

  Cheers,
    Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How can bind more than one element in the render method in CometActor ?

2009-12-08 Thread Neil.Lv

   Here is the code:
###
override def defaultPrefix = Full(info)

def show(in: NodeSeq): NodeSeq = {
  bind(show, in,
   list1 - Text(1),
   list2 - Text(2)
   )
}

def render = {
  bind(
   list1 - Text(1),
   list2 - Text(2)
   )
}
###

   In the index.html page:

###
lift:comet type=ForumComet
  info.show:list1/
  info.show:list2/
/lift:comet

lift:comet type=ForumComet
  info.list1/
  info.list2/
/lift:comet
###

  Both of them don't work, In the Snippet, the render method could be
write like this:
###
def render(in : NodeSeq) : NodeSeq = {
   bind( info, in,
   list1 - Text(1),
list2 - Text(2)
  )
}
###

  It's different with Comet's render method .

  Thanks!

Cheers,
  Neil


On Dec 9, 11:53 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Neil,

 bind() works the same everywhere... CometActors, Helpers.bind, etc.

 If you are having a problem with bind, I would strongly recommend writing a
 test with a template that allows your to figure out how bind works and then
 take the template and binding and put it in your CometActor.

 Thanks,

 David



 On Tue, Dec 8, 2009 at 7:51 PM, Neil.Lv anim...@gmail.com wrote:

   Whether I have to create six comet to archieve this purpose ?

   I want to use only one comet to update the six parts.

   The layouf is like this:
  ###
  part1             part2

  part3             part6
  part4
  part5
  ###

  ###
  ...
  lift:comet type=TestComet
   info:One/
  /lift:comet
  span/span
  lift:comet type=TestComet
   info:Two/
  /lift:comet
  span/span
  lift:comet type=TestComet
   info:Three
  /lift:comet
  span/span
  lift:comet type=TestComet
   info:Four
  /lift:comet
  ...
  lift:comet type=TestComet
    info:Sixr
  /lift:comet
  ###

    Thanks!

  Cheers,
    Neil

  On Dec 9, 12:49 am, Neil.Lv anim...@gmail.com wrote:
     BTW, when the partialUpdate method is called , the result is
   correct.

     But when refreshing the browser or open a new browser, the result
   also is 3,

   Cheers,
     Neil

   On Dec 9, 12:44 am, Neil.Lv anim...@gmail.com wrote:

Hi all,

   How can bind more than one element in the render method in
CometActor ?

   The msg1 is an
###
class TestComet extends CometActor {
  override def defaultPrefix = Full(info)
  ...
  def render = { bind(One   - span1/span,
                             Two   - span2/span,
                             Three - span3/span,
                             Four  - span4/span,
                             Five  - span5/span,
                             Six   - span6/span ) }
  ...}

###

  And in the index.html page
###
...
lift:comet type=TestComet
  info:One/
/lift:comet
span/span
lift:comet type=TestComet
  info:Two/
/lift:comet
span/span
lift:comet type=TestComet
  info:Three
/lift:comet
span/span
lift:comet type=TestComet
  info:Four
/lift:comet
...
###

  And these four comet all show the same result  span3/span,
not 1, 2, 3, 4, 5, 6 

  I don't know what's wrong with it ?

  Dose anybody know what's the problem with this render metho?

  Thanks for any help.

Cheers,
  Neil

  --

  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: (Maybe it's a bug ?) About the Schedule's execute counts in the ActorComet

2009-12-07 Thread Neil.Lv

   I think maybe it's a bug ~?

   Btw, Does anybody know how to convert the CometActor to LiftActor.

   And how the write the render method and use the ActorPing.schedule
(this, Tick, 10 seconds)
in LiftActor.

   Thanks for any suggestion!

Cheers,
  Neil
###
package com.liftcode.comet

import net.liftweb._
import http._
import js._
import JsCmds._
import net.liftweb.common._
import net.liftweb.util._
import Helpers._
import net.liftweb.http._
import _root_.scala.xml._
import scala.actors._
import scala.collection.mutable.Queue
import net.liftweb.http.SessionVar

case class Foo(getValue: String)

object FooManager {
  private var foos: List[Foo] = Nil
  def getFoos: List[Foo] = synchronized {
println(  foos size:  + foos.size)
foos ::= Foo(System.currentTimeMillis.toString)
foos
  }

}

class MyComet extends CometActor {

  override def defaultPrefix = Full(auth)

  private var foos = FooManager.getFoos

  def createDisplay(foos:List[Foo]):NodeSeq = {
span id=gotable
{
  for {foo - foos} yield trtd{foo.getValue}/td/tr
}

/table/span
  }

  def render = { bind(foo - createDisplay(foos)) }

  override def localSetup = {
println(  localSetup:  )
super.localSetup
this ! Tick
  }

  override def lowPriority = {
case Tick = {
println(   Tick )
  foos = FooManager.getFoos
  reRender(false)
  ActorPing.schedule(this, Tick, 10 seconds)
}
  }

}

case object Tick
###

On Dec 7, 9:40 pm, Neil.Lv anim...@gmail.com wrote:
   Here is the server log,

 ###
 INFO - Service request (GET) /comet_request/27036331510/b0iubsv7usc1
 took 0 Mill
 iseconds
 INFO - Service request (GET) /comet_request/24195135706/1geup5f5uelih
 took 0 Mil
 liseconds
 INFO - Service request (GET) /comet_request/15421125743/b0iubsv7usc1
 took 0 Mill
 iseconds
 INFO - Service request (GET) /comet_request/4886038816/b0iubsv7usc1
 took 15 Mill
 iseconds
 INFO - Service request (GET) /comet_request/70554035677/b0iubsv7usc1
 took 0 Mill
 iseconds
 INFO - Service request (GET) /comet_request/80058340958/b0iubsv7usc1
 took 0 Mill
 iseconds
 INFO - Service request (GET) /comet_request/16073680948/b0iubsv7usc1
 took 0 Mill
 iseconds
 INFO - Service request (GET) /comet_request/48475840285/b0iubsv7usc1
 took 16 Mil
 liseconds
 ###

    I set the time is 10 seconds, but here is wrong.

    Does anybody know about the issue ?

 Cheers,
   Neil

 On Dec 4, 3:00 pm, Neil.Lv anim...@gmail.com wrote:

  Hi all,

     Here is an example code that about the ActorComet.

  ###
  package com.liftcode.comet

  import net.liftweb._
  import http._
  import js._
  import JsCmds._
  import net.liftweb.common._
  import net.liftweb.util._
  import Helpers._
  import net.liftweb.http._
  import _root_.scala.xml._
  import scala.actors._
  import scala.collection.mutable.Queue
  import net.liftweb.http.SessionVar

  case class Foo(getValue: String)

  object FooManager {
    private var foos: List[Foo] = Nil
    def getFoos: List[Foo] = synchronized {
  println(  foos size:  + foos.size)
      foos ::= Foo(System.currentTimeMillis.toString)
      foos
    }

  }

  class MyComet extends CometActor {

    override def defaultPrefix = Full(auth)

    private var foos = FooManager.getFoos

    def createDisplay(foos:List[Foo]):NodeSeq = {
      span id=gotable
      {
        for {foo - foos} yield trtd{foo.getValue}/td/tr
      }

      /table/span
    }

    def render = { bind(foo - createDisplay(foos)) }

    override def localSetup = {
  println(  localSetup:  )
      super.localSetup
      this ! Tick
    }

    override def lowPriority = {
      case Tick = {
  println(   Tick )
        foos = FooManager.getFoos
        reRender(false)
        ActorPing.schedule(this, Tick, 10 seconds)
      }
    }

  }

  case object Tick
  ###

     When i run  mvn jetty:run  to start the server, and type 
  thehttp://localhost:8080inthe browser.
  The result will be like this, the println(   Tick ) method
  only execute 1 time every 10 seconds.

  ###
  INFO - Service request (GET) /comet_request/50054201120/farmqqw03xkm
  took 46 Mil
  liseconds
     Tick 
    foos size: 2
  INFO - Service request (GET) /comet_request/87077494133/farmqqw03xkm
  took 8625 M
  ###

     Then i don't close the browser, and Ctrl+C stop the jetty server,
  and  mvn jetty:run  restart the server, the result will be like this:
  The  println(   Tick ) method will be execute 3 times every
  10 seconds.

  ###
  INFO - Service request (GET) /comet_request/74875169086/farmqqw03xkm
  took 0 Mill
  iseconds
    foos size: 8
    localSetup:
     Tick 
    foos size: 9
  INFO - Service request (GET) / took 109 Milliseconds
    foos size: 10
    localSetup:
     Tick 
    foos size: 11
  INFO - Service request (GET) / took 31 Milliseconds
  ###

     I don't know what's wrong with it .
     If when you stop

[Lift] Re: (Maybe it's a bug ?) About the Schedule's execute counts in the ActorComet

2009-12-07 Thread Neil.Lv
 Hi David,

   The demo is sent to you, please check it.

   Thanks !

Cheers,
  Neil

On Dec 7, 10:26 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Mon, Dec 7, 2009 at 5:45 AM, Neil.Lv anim...@gmail.com wrote:

    I think maybe it's a bug ~?

    Btw, Does anybody know how to convert the CometActor to LiftActor.

 A CometActor is a subclass of LiftActor

 If you can package up a complete simple implementation of the problem (an
 app I can run with mvn jetty:run), I'll take a look at it.





    And how the write the render method and use the ActorPing.schedule
  (this, Tick, 10 seconds)
  in LiftActor.

    Thanks for any suggestion!

  Cheers,
   Neil
  ###
  package com.liftcode.comet

  import net.liftweb._
  import http._
  import js._
  import JsCmds._
  import net.liftweb.common._
  import net.liftweb.util._
  import Helpers._
  import net.liftweb.http._
  import _root_.scala.xml._
  import scala.actors._
  import scala.collection.mutable.Queue
  import net.liftweb.http.SessionVar

  case class Foo(getValue: String)

  object FooManager {
   private var foos: List[Foo] = Nil
   def getFoos: List[Foo] = synchronized {
  println(  foos size:  + foos.size)
     foos ::= Foo(System.currentTimeMillis.toString)
     foos
   }

  }

  class MyComet extends CometActor {

   override def defaultPrefix = Full(auth)

   private var foos = FooManager.getFoos

   def createDisplay(foos:List[Foo]):NodeSeq = {
     span id=gotable
     {
       for {foo - foos} yield trtd{foo.getValue}/td/tr
     }

     /table/span
   }

   def render = { bind(foo - createDisplay(foos)) }

   override def localSetup = {
  println(  localSetup:  )
     super.localSetup
     this ! Tick
   }

   override def lowPriority = {
     case Tick = {
  println(   Tick )
       foos = FooManager.getFoos
       reRender(false)
       ActorPing.schedule(this, Tick, 10 seconds)
     }
   }

  }

  case object Tick
  ###

  On Dec 7, 9:40 pm, Neil.Lv anim...@gmail.com wrote:
     Here is the server log,

   ###
   INFO - Service request (GET) /comet_request/27036331510/b0iubsv7usc1
   took 0 Mill
   iseconds
   INFO - Service request (GET) /comet_request/24195135706/1geup5f5uelih
   took 0 Mil
   liseconds
   INFO - Service request (GET) /comet_request/15421125743/b0iubsv7usc1
   took 0 Mill
   iseconds
   INFO - Service request (GET) /comet_request/4886038816/b0iubsv7usc1
   took 15 Mill
   iseconds
   INFO - Service request (GET) /comet_request/70554035677/b0iubsv7usc1
   took 0 Mill
   iseconds
   INFO - Service request (GET) /comet_request/80058340958/b0iubsv7usc1
   took 0 Mill
   iseconds
   INFO - Service request (GET) /comet_request/16073680948/b0iubsv7usc1
   took 0 Mill
   iseconds
   INFO - Service request (GET) /comet_request/48475840285/b0iubsv7usc1
   took 16 Mil
   liseconds
   ###

      I set the time is 10 seconds, but here is wrong.

      Does anybody know about the issue ?

   Cheers,
     Neil

   On Dec 4, 3:00 pm, Neil.Lv anim...@gmail.com wrote:

Hi all,

   Here is an example code that about the ActorComet.

###
package com.liftcode.comet

import net.liftweb._
import http._
import js._
import JsCmds._
import net.liftweb.common._
import net.liftweb.util._
import Helpers._
import net.liftweb.http._
import _root_.scala.xml._
import scala.actors._
import scala.collection.mutable.Queue
import net.liftweb.http.SessionVar

case class Foo(getValue: String)

object FooManager {
  private var foos: List[Foo] = Nil
  def getFoos: List[Foo] = synchronized {
println(  foos size:  + foos.size)
    foos ::= Foo(System.currentTimeMillis.toString)
    foos
  }

}

class MyComet extends CometActor {

  override def defaultPrefix = Full(auth)

  private var foos = FooManager.getFoos

  def createDisplay(foos:List[Foo]):NodeSeq = {
    span id=gotable
    {
      for {foo - foos} yield trtd{foo.getValue}/td/tr
    }

    /table/span
  }

  def render = { bind(foo - createDisplay(foos)) }

  override def localSetup = {
println(  localSetup:  )
    super.localSetup
    this ! Tick
  }

  override def lowPriority = {
    case Tick = {
println(   Tick )
      foos = FooManager.getFoos
      reRender(false)
      ActorPing.schedule(this, Tick, 10 seconds)
    }
  }

}

case object Tick
###

   When i run  mvn jetty:run  to start the server, and type
  thehttp://localhost:8080inthebrowser.
The result will be like this, the println(   Tick ) method
only execute 1 time every 10 seconds.

###
INFO - Service request (GET) /comet_request/50054201120/farmqqw03xkm
took 46 Mil
liseconds
   Tick 
  foos size: 2
INFO - Service request (GET) /comet_request/87077494133/farmqqw03xkm
took 8625 M
###

   Then i don't

[Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv
In the Boot.scala
###
class Boot {
  def boot {
if (!DB.jndiJdbcConnAvailable_?)
  DB.defineConnectionManager(DefaultConnectionIdentifier,
DBVendor)
...
  }
}

object WahDB extends ConnectionIdentifier {
  def jndiName = one
}
object WahereDB extends ConnectionIdentifier {
  def jndiName = two
}

object DBVendor extends ConnectionManager {
  ...
  private def createOne(name: ConnectionIdentifier): Box[Connection] =
try {
val dbUrl1: String = Props.get(db.url1) openOr
jdbc:derby:lift_example;create=true

val dbUrl2: String = Props.get(db.url2) openOr
jdbc:derby:lift_example;create=true

var dbUrl: String = dbUrl1

try{
   name match {
  case One = {
dbUrl = dbUrl1
  }
  case Two = {
dbUrl = dbUrl2
  }
  case lift = {
dbUrl = dbUrl1
  }
   }
} catch {
  case e : Exception = e.printStackTrace; Empty
}
   ...
  }
  ...

}

In the every models:
class User extends MegaProtoUser[User] {
  def getSingleton = User // what's the meta server

  ...

  override def dbCalculateConnectionIdentifier = {  //
## dbCalculateConnectionIdentifier
case _ = One
  }
}

class Blog extends LongKeyedMapper[Item] with IdPK {
  def getSingleton = Blog // what's the meta server

  ...

  override def dbCalculateConnectionIdentifier = {  //
## dbCalculateConnectionIdentifier
case _ = Two
  }
}
###

I add the override def dbCalculateConnectionIdentifier method in
every models

But everytime it uses the database One, never uses the database Two.

Thanks very much!

Cheers,
  Neil

On Dec 6, 3:02 pm, Neil.Lv anim...@gmail.com wrote:
   The two databases that have different structure of the tables, such
 as two applications databases.

 Cheers,
   Neil

 On Dec 6, 2:38 pm, Neil.Lv anim...@gmail.com wrote:

     Btw, there is the error message when the server is started.
  ###
  scala.MatchError: ConnectionIdentifier(lift)
  ###

  On Dec 6, 1:47 pm, Neil.Lv anim...@gmail.com wrote:

   Hi all,

     I want to use two databases, but i don't know how to configure it.

     Does anybody know that how to configure two database connection in
   Lift?

   1:
     I add two ConnectionIdentifier in the Boot.class
   ###
   object OneDB extends ConnectionIdentifier {

     def jndiName = one

   }

   object TwoDB extends ConnectionIdentifier {

     def jndiName = two

   }

   ###

   2: In the User model

      How can i write the code in the method,
   ###
     override def dbCalculateConnectionIdentifier = {
       Two
     }
   ###

     Thanks for any suggestion!

   Cheers,
     Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv

Here is the db url,

db.url1=jdbc:mysql://localhost:3306/blog1
db.url2=jdbc:mysql://localhost:3306/blog2

Cheers,
  Neil

On Dec 6, 4:00 pm, Neil.Lv anim...@gmail.com wrote:
 In the Boot.scala
 ###
 class Boot {
   def boot {
     if (!DB.jndiJdbcConnAvailable_?)
       DB.defineConnectionManager(DefaultConnectionIdentifier,
 DBVendor)
     ...
   }

 }

 object WahDB extends ConnectionIdentifier {
   def jndiName = one}

 object WahereDB extends ConnectionIdentifier {
   def jndiName = two

 }

 object DBVendor extends ConnectionManager {
   ...
   private def createOne(name: ConnectionIdentifier): Box[Connection] =
 try {
     val dbUrl1: String = Props.get(db.url1) openOr
     jdbc:derby:lift_example;create=true

     val dbUrl2: String = Props.get(db.url2) openOr
     jdbc:derby:lift_example;create=true

     var dbUrl: String = dbUrl1

     try{
            name match {
                   case One = {
                         dbUrl = dbUrl1
                   }
                   case Two = {
                     dbUrl = dbUrl2
                   }
                   case lift = {
                     dbUrl = dbUrl1
                   }
            }
     } catch {
       case e : Exception = e.printStackTrace; Empty
     }
    ...
   }
   ...

 }

 In the every models:
 class User extends MegaProtoUser[User] {
   def getSingleton = User // what's the meta server

   ...

   override def dbCalculateConnectionIdentifier = {  //
 ## dbCalculateConnectionIdentifier
     case _ = One
   }

 }

 class Blog extends LongKeyedMapper[Item] with IdPK {
   def getSingleton = Blog // what's the meta server

   ...

   override def dbCalculateConnectionIdentifier = {  //
 ## dbCalculateConnectionIdentifier
     case _ = Two
   }}

 ###

 I add the override def dbCalculateConnectionIdentifier method in
 every models

 But everytime it uses the database One, never uses the database Two.

 Thanks very much!

 Cheers,
   Neil

 On Dec 6, 3:02 pm, Neil.Lv anim...@gmail.com wrote:

    The two databases that have different structure of the tables, such
  as two applications databases.

  Cheers,
    Neil

  On Dec 6, 2:38 pm, Neil.Lv anim...@gmail.com wrote:

      Btw, there is the error message when the server is started.
   ###
   scala.MatchError: ConnectionIdentifier(lift)
   ###

   On Dec 6, 1:47 pm, Neil.Lv anim...@gmail.com wrote:

Hi all,

  I want to use two databases, but i don't know how to configure it.

  Does anybody know that how to configure two database connection in
Lift?

1:
  I add two ConnectionIdentifier in the Boot.class
###
object OneDB extends ConnectionIdentifier {

  def jndiName = one

}

object TwoDB extends ConnectionIdentifier {

  def jndiName = two

}

###

2: In the User model

   How can i write the code in the method,
###
  override def dbCalculateConnectionIdentifier = {
    Two
  }
###

  Thanks for any suggestion!

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv

  If i remove the  DB.defineConnectionManager
(DefaultConnectionIdentifier, DBVendor)

  This error message occurs.
###
java.lang.NullPointerException: Looking for Connection Identifier
ConnectionIden
tifier(lift) but failed to find either a JNDI data source with the
name lift or
a lift connection manager with the correct name
###

Cheers,
  Neil


On Dec 6, 7:54 pm, Tim Nelson tnell...@gmail.com wrote:
 Hi,

 This line configures the database connections:

 DB.defineConnectionManager(DefaultConnectionIdentifier,
 DBVendor)

 This is using only the DefaultConnectionIdentifier, which you don't
 want to use. You want to change this to use your 2 defined
 identifiers. Ie:

 DB.defineConnectionManager(OneDB, DBVendor)
 DB.defineConnectionManager(TwoDB, DBVendor)

 Tim

 On Sun, Dec 6, 2009 at 4:17 AM, Neil.Lv anim...@gmail.com wrote:

  Here is the db url,

  db.url1=jdbc:mysql://localhost:3306/blog1
  db.url2=jdbc:mysql://localhost:3306/blog2

  Cheers,
   Neil

  On Dec 6, 4:00 pm, Neil.Lv anim...@gmail.com wrote:
  In the Boot.scala
  ###
  class Boot {
    def boot {
      if (!DB.jndiJdbcConnAvailable_?)
        DB.defineConnectionManager(DefaultConnectionIdentifier,
  DBVendor)
      ...
    }

  }

  object WahDB extends ConnectionIdentifier {
    def jndiName = one}

  object WahereDB extends ConnectionIdentifier {
    def jndiName = two

  }

  object DBVendor extends ConnectionManager {
    ...
    private def createOne(name: ConnectionIdentifier): Box[Connection] =
  try {
      val dbUrl1: String = Props.get(db.url1) openOr
      jdbc:derby:lift_example;create=true

      val dbUrl2: String = Props.get(db.url2) openOr
      jdbc:derby:lift_example;create=true

      var dbUrl: String = dbUrl1

      try{
             name match {
                    case One = {
                          dbUrl = dbUrl1
                    }
                    case Two = {
                      dbUrl = dbUrl2
                    }
                    case lift = {
                      dbUrl = dbUrl1
                    }
             }
      } catch {
        case e : Exception = e.printStackTrace; Empty
      }
     ...
    }
    ...

  }

  In the every models:
  class User extends MegaProtoUser[User] {
    def getSingleton = User // what's the meta server

    ...

    override def dbCalculateConnectionIdentifier = {  //
  ## dbCalculateConnectionIdentifier
      case _ = One
    }

  }

  class Blog extends LongKeyedMapper[Item] with IdPK {
    def getSingleton = Blog // what's the meta server

    ...

    override def dbCalculateConnectionIdentifier = {  //
  ## dbCalculateConnectionIdentifier
      case _ = Two
    }}

  ###

  I add the override def dbCalculateConnectionIdentifier method in
  every models

  But everytime it uses the database One, never uses the database Two.

  Thanks very much!

  Cheers,
    Neil

  On Dec 6, 3:02 pm, Neil.Lv anim...@gmail.com wrote:

     The two databases that have different structure of the tables, such
   as two applications databases.

   Cheers,
     Neil

   On Dec 6, 2:38 pm, Neil.Lv anim...@gmail.com wrote:

   Btw, there is the error message when the server is started.
###
scala.MatchError: ConnectionIdentifier(lift)
###

On Dec 6, 1:47 pm, Neil.Lv anim...@gmail.com wrote:

 Hi all,

   I want to use two databases, but i don't know how to configure it.

   Does anybody know that how to configure two database connection in
 Lift?

 1:
   I add two ConnectionIdentifier in the Boot.class
 ###
 object OneDB extends ConnectionIdentifier {

   def jndiName = one

 }

 object TwoDB extends ConnectionIdentifier {

   def jndiName = two

 }

 ###

 2: In the User model

    How can i write the code in the method,
 ###
   override def dbCalculateConnectionIdentifier = {
     Two
   }
 ###

   Thanks for any suggestion!

 Cheers,
   Neil

  --

  You received this message because you are subscribed to the Google Groups 
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to 
  liftweb+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/liftweb?hl=en.

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv

  I don't understand the jndiName whether the jndiName is whatever
string that i can specify ?

###
object OneDB extends ConnectionIdentifier {
  def jndiName = one
}
###

Cheers,
  Neil

On Dec 6, 7:54 pm, Tim Nelson tnell...@gmail.com wrote:
 Hi,

 This line configures the database connections:

 DB.defineConnectionManager(DefaultConnectionIdentifier,
 DBVendor)

 This is using only the DefaultConnectionIdentifier, which you don't
 want to use. You want to change this to use your 2 defined
 identifiers. Ie:

 DB.defineConnectionManager(OneDB, DBVendor)
 DB.defineConnectionManager(TwoDB, DBVendor)

 Tim

 On Sun, Dec 6, 2009 at 4:17 AM, Neil.Lv anim...@gmail.com wrote:

  Here is the db url,

  db.url1=jdbc:mysql://localhost:3306/blog1
  db.url2=jdbc:mysql://localhost:3306/blog2

  Cheers,
   Neil

  On Dec 6, 4:00 pm, Neil.Lv anim...@gmail.com wrote:
  In the Boot.scala
  ###
  class Boot {
    def boot {
      if (!DB.jndiJdbcConnAvailable_?)
        DB.defineConnectionManager(DefaultConnectionIdentifier,
  DBVendor)
      ...
    }

  }

  object WahDB extends ConnectionIdentifier {
    def jndiName = one}

  object WahereDB extends ConnectionIdentifier {
    def jndiName = two

  }

  object DBVendor extends ConnectionManager {
    ...
    private def createOne(name: ConnectionIdentifier): Box[Connection] =
  try {
      val dbUrl1: String = Props.get(db.url1) openOr
      jdbc:derby:lift_example;create=true

      val dbUrl2: String = Props.get(db.url2) openOr
      jdbc:derby:lift_example;create=true

      var dbUrl: String = dbUrl1

      try{
             name match {
                    case One = {
                          dbUrl = dbUrl1
                    }
                    case Two = {
                      dbUrl = dbUrl2
                    }
                    case lift = {
                      dbUrl = dbUrl1
                    }
             }
      } catch {
        case e : Exception = e.printStackTrace; Empty
      }
     ...
    }
    ...

  }

  In the every models:
  class User extends MegaProtoUser[User] {
    def getSingleton = User // what's the meta server

    ...

    override def dbCalculateConnectionIdentifier = {  //
  ## dbCalculateConnectionIdentifier
      case _ = One
    }

  }

  class Blog extends LongKeyedMapper[Item] with IdPK {
    def getSingleton = Blog // what's the meta server

    ...

    override def dbCalculateConnectionIdentifier = {  //
  ## dbCalculateConnectionIdentifier
      case _ = Two
    }}

  ###

  I add the override def dbCalculateConnectionIdentifier method in
  every models

  But everytime it uses the database One, never uses the database Two.

  Thanks very much!

  Cheers,
    Neil

  On Dec 6, 3:02 pm, Neil.Lv anim...@gmail.com wrote:

     The two databases that have different structure of the tables, such
   as two applications databases.

   Cheers,
     Neil

   On Dec 6, 2:38 pm, Neil.Lv anim...@gmail.com wrote:

   Btw, there is the error message when the server is started.
###
scala.MatchError: ConnectionIdentifier(lift)
###

On Dec 6, 1:47 pm, Neil.Lv anim...@gmail.com wrote:

 Hi all,

   I want to use two databases, but i don't know how to configure it.

   Does anybody know that how to configure two database connection in
 Lift?

 1:
   I add two ConnectionIdentifier in the Boot.class
 ###
 object OneDB extends ConnectionIdentifier {

   def jndiName = one

 }

 object TwoDB extends ConnectionIdentifier {

   def jndiName = two

 }

 ###

 2: In the User model

    How can i write the code in the method,
 ###
   override def dbCalculateConnectionIdentifier = {
     Two
   }
 ###

   Thanks for any suggestion!

 Cheers,
   Neil

  --

  You received this message because you are subscribed to the Google Groups 
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to 
  liftweb+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/liftweb?hl=en.

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv

  Yeah, i don't want to use sharding, i just want select some
information from another databases,

###
object Blog extends Blog with LongKeyedMetaMapper[Blog ] {
  ...
  override def dbDefaultConnectionIdentifier  = OneDB
  ...
}
###

  It doesn't work, maybe the code that i write is wrong ?

Cheers,
  Neil



On Dec 6, 8:28 pm, Tim Nelson tnell...@gmail.com wrote:
 I think there might be a problem with the way you are specifying which
 db to use in your mapper classes. Here's the relevant text from the
 The Lift Book:

 dbSelect... is used to find an instance by primary key, and takes a
 partial function (typically a match clause) to determine which
 connection to use.

 dbCalculate... is used when a new instance is created to decide where
 to store the new instance.

 Those 2 methods are used for sharding. Are you sharding? If not I
 think you just want to override dbDefaultConnectionIdentifier

 Tim

 On Sun, Dec 6, 2009 at 6:01 AM, Neil.Lv anim...@gmail.com wrote:

   If i remove the  DB.defineConnectionManager
  (DefaultConnectionIdentifier, DBVendor)

   This error message occurs.
  ###
  java.lang.NullPointerException: Looking for Connection Identifier
  ConnectionIden
  tifier(lift) but failed to find either a JNDI data source with the
  name lift or
  a lift connection manager with the correct name
  ###

  Cheers,
   Neil

  On Dec 6, 7:54 pm, Tim Nelson tnell...@gmail.com wrote:
  Hi,

  This line configures the database connections:

  DB.defineConnectionManager(DefaultConnectionIdentifier,
  DBVendor)

  This is using only the DefaultConnectionIdentifier, which you don't
  want to use. You want to change this to use your 2 defined
  identifiers. Ie:

  DB.defineConnectionManager(OneDB, DBVendor)
  DB.defineConnectionManager(TwoDB, DBVendor)

  Tim

  On Sun, Dec 6, 2009 at 4:17 AM, Neil.Lv anim...@gmail.com wrote:

   Here is the db url,

   db.url1=jdbc:mysql://localhost:3306/blog1
   db.url2=jdbc:mysql://localhost:3306/blog2

   Cheers,
    Neil

   On Dec 6, 4:00 pm, Neil.Lv anim...@gmail.com wrote:
   In the Boot.scala
   ###
   class Boot {
     def boot {
       if (!DB.jndiJdbcConnAvailable_?)
         DB.defineConnectionManager(DefaultConnectionIdentifier,
   DBVendor)
       ...
     }

   }

   object WahDB extends ConnectionIdentifier {
     def jndiName = one}

   object WahereDB extends ConnectionIdentifier {
     def jndiName = two

   }

   object DBVendor extends ConnectionManager {
     ...
     private def createOne(name: ConnectionIdentifier): Box[Connection] =
   try {
       val dbUrl1: String = Props.get(db.url1) openOr
       jdbc:derby:lift_example;create=true

       val dbUrl2: String = Props.get(db.url2) openOr
       jdbc:derby:lift_example;create=true

       var dbUrl: String = dbUrl1

       try{
              name match {
                     case One = {
                           dbUrl = dbUrl1
                     }
                     case Two = {
                       dbUrl = dbUrl2
                     }
                     case lift = {
                       dbUrl = dbUrl1
                     }
              }
       } catch {
         case e : Exception = e.printStackTrace; Empty
       }
      ...
     }
     ...

   }

   In the every models:
   class User extends MegaProtoUser[User] {
     def getSingleton = User // what's the meta server

     ...

     override def dbCalculateConnectionIdentifier = {  //
   ## dbCalculateConnectionIdentifier
       case _ = One
     }

   }

   class Blog extends LongKeyedMapper[Item] with IdPK {
     def getSingleton = Blog // what's the meta server

     ...

     override def dbCalculateConnectionIdentifier = {  //
   ## dbCalculateConnectionIdentifier
       case _ = Two
     }}

   ###

   I add the override def dbCalculateConnectionIdentifier method in
   every models

   But everytime it uses the database One, never uses the database Two.

   Thanks very much!

   Cheers,
     Neil

   On Dec 6, 3:02 pm, Neil.Lv anim...@gmail.com wrote:

  The two databases that have different structure of the tables, such
as two applications databases.

Cheers,
  Neil

On Dec 6, 2:38 pm, Neil.Lv anim...@gmail.com wrote:

    Btw, there is the error message when the server is started.
 ###
 scala.MatchError: ConnectionIdentifier(lift)
 ###

 On Dec 6, 1:47 pm, Neil.Lv anim...@gmail.com wrote:

  Hi all,

    I want to use two databases, but i don't know how to configure 
  it.

    Does anybody know that how to configure two database connection 
  in
  Lift?

  1:
    I add two ConnectionIdentifier in the Boot.class
  ###
  object OneDB extends ConnectionIdentifier {

    def jndiName = one

  }

  object TwoDB extends ConnectionIdentifier {

    def jndiName = two

  }

  ###

  2: In the User model

     How can i write the code in the method,
  ###
    override def

[Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv

  Thanks Tim,

  I have tried it in my code but it doesn't work yet!

  The lift version is:  1.1-M7
  Scala Version is:  2.7.7

Cheers,
  Neil

On Dec 6, 10:52 pm, Tim Nelson tnell...@gmail.com wrote:
 I did some more digging and got a sample app to work. You can see the code 
 here:http://github.com/eltimn/lift_1_1_sample

 There are 2 things I had to do. The first is to pass in the DbId when
 calling Schemifier;

 Schemifier.schemify(true, Log.infoF _, OneDB, User)
 Schemifier.schemify(true, Log.infoF _, TwoDB, Dog)

 This was the cause of the NPE earlier.

 The second thing I did was to create 2 separate DBVendor objects. I
 could not get this to work with one that matches on the
 ConnectionIdentifier, like the example in The Lift Book. I didn't dig
 into why this wasn't working, so it could be the way the code is
 written.

 DB.defineConnectionManager(OneDB, DBVendor_1)
 DB.defineConnectionManager(TwoDB, DBVendor_2)

 Tim

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv

  It works now, I missing the dbDefaultConnectionIdentifier definition
in the others models.

  Thank you very much!

  :)

Cheers,
  Neil

On Dec 7, 12:06 am, Neil.Lv anim...@gmail.com wrote:
   Thanks Tim,

   I have tried it in my code but it doesn't work yet!

   The lift version is:  1.1-M7
   Scala Version is:  2.7.7

 Cheers,
   Neil

 On Dec 6, 10:52 pm, Tim Nelson tnell...@gmail.com wrote:

  I did some more digging and got a sample app to work. You can see the code 
  here:http://github.com/eltimn/lift_1_1_sample

  There are 2 things I had to do. The first is to pass in the DbId when
  calling Schemifier;

  Schemifier.schemify(true, Log.infoF _, OneDB, User)
  Schemifier.schemify(true, Log.infoF _, TwoDB, Dog)

  This was the cause of the NPE earlier.

  The second thing I did was to create 2 separate DBVendor objects. I
  could not get this to work with one that matches on the
  ConnectionIdentifier, like the example in The Lift Book. I didn't dig
  into why this wasn't working, so it could be the way the code is
  written.

  DB.defineConnectionManager(OneDB, DBVendor_1)
  DB.defineConnectionManager(TwoDB, DBVendor_2)

  Tim

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 configure two database connection in Lift?

2009-12-05 Thread Neil.Lv
Hi all,

  I want to use two databases, but i don't know how to configure it.

  Does anybody know that how to configure two database connection in
Lift?


1:
  I add two ConnectionIdentifier in the Boot.class
###
object OneDB extends ConnectionIdentifier {

  def jndiName = one

}

object TwoDB extends ConnectionIdentifier {

  def jndiName = two

}
###

2: In the User model

   How can i write the code in the method,
###
  override def dbCalculateConnectionIdentifier = {
Two
  }
###

  Thanks for any suggestion!

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to configure two database connection in Lift?

2009-12-05 Thread Neil.Lv


   Btw, there is the error message when the server is started.
###
scala.MatchError: ConnectionIdentifier(lift)
###

On Dec 6, 1:47 pm, Neil.Lv anim...@gmail.com wrote:
 Hi all,

   I want to use two databases, but i don't know how to configure it.

   Does anybody know that how to configure two database connection in
 Lift?

 1:
   I add two ConnectionIdentifier in the Boot.class
 ###
 object OneDB extends ConnectionIdentifier {

   def jndiName = one

 }

 object TwoDB extends ConnectionIdentifier {

   def jndiName = two

 }

 ###

 2: In the User model

    How can i write the code in the method,
 ###
   override def dbCalculateConnectionIdentifier = {
     Two
   }
 ###

   Thanks for any suggestion!

 Cheers,
   Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to configure two database connection in Lift?

2009-12-05 Thread Neil.Lv

  The two databases that have different structure of the tables, such
as two applications databases.

Cheers,
  Neil

On Dec 6, 2:38 pm, Neil.Lv anim...@gmail.com wrote:
    Btw, there is the error message when the server is started.
 ###
 scala.MatchError: ConnectionIdentifier(lift)
 ###

 On Dec 6, 1:47 pm, Neil.Lv anim...@gmail.com wrote:

  Hi all,

    I want to use two databases, but i don't know how to configure it.

    Does anybody know that how to configure two database connection in
  Lift?

  1:
    I add two ConnectionIdentifier in the Boot.class
  ###
  object OneDB extends ConnectionIdentifier {

    def jndiName = one

  }

  object TwoDB extends ConnectionIdentifier {

    def jndiName = two

  }

  ###

  2: In the User model

     How can i write the code in the method,
  ###
    override def dbCalculateConnectionIdentifier = {
      Two
    }
  ###

    Thanks for any suggestion!

  Cheers,
    Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to redirect to a specify url when logged in successfully?

2009-12-03 Thread Neil.Lv
  I added this code in the User model, but it doesn't work yet.

  This println method is never executed.

  Maybe some configuration need to be set ?

###
object User extends User with MetaMegaProtoUser[User] {
  ...
  override def loginFirst = If(
loggedIn_? _,
() = {
  import net.liftweb.http.{RedirectWithState, RedirectState}
  val uri = Full(/all_users)
println( xxx )
  RedirectWithState(
loginPageURL,
RedirectState( ()={loginRedirect.set(uri)})
  )
}
  )
  ...
}
###


Cheers,
  Neil


On Dec 1, 8:15 am, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Sun, Nov 29, 2009 at 12:17 AM, Neil.Lv anim...@gmail.com wrote:
  Hi all,

    I want to redirecto to a specify URL like this /all_users when
  logged in successfully via the default link,
 http://localhost:8080/user_mgt/login

   Is there a help method (i dont't find it) to configure it?

   When i logged in successfully via /user_mgt/login link and redirect
  to the /all_users link not the /index page.

 In your User object (singleton):
   override def loginFirst = If(
     loggedIn_? _,
     () = {
       import net.liftweb.http.{RedirectWithState, RedirectState}
       val uri = /all_users
       RedirectWithState(
         loginPageURL,
         RedirectState( ()={loginRedirect.set(uri)})
       )
     }
   )





   Thanks for any help.

  Cheers,
   Neil

  --

  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] (Maybe it's a bug ?) About the Schedule's execute counts in the ActorComet

2009-12-03 Thread Neil.Lv
Hi all,

   Here is an example code that about the ActorComet.

###
package com.liftcode.comet

import net.liftweb._
import http._
import js._
import JsCmds._
import net.liftweb.common._
import net.liftweb.util._
import Helpers._
import net.liftweb.http._
import _root_.scala.xml._
import scala.actors._
import scala.collection.mutable.Queue
import net.liftweb.http.SessionVar

case class Foo(getValue: String)

object FooManager {
  private var foos: List[Foo] = Nil
  def getFoos: List[Foo] = synchronized {
println(  foos size:  + foos.size)
foos ::= Foo(System.currentTimeMillis.toString)
foos
  }
}

class MyComet extends CometActor {

  override def defaultPrefix = Full(auth)

  private var foos = FooManager.getFoos

  def createDisplay(foos:List[Foo]):NodeSeq = {
span id=gotable
{
  for {foo - foos} yield trtd{foo.getValue}/td/tr
}

/table/span
  }

  def render = { bind(foo - createDisplay(foos)) }

  override def localSetup = {
println(  localSetup:  )
super.localSetup
this ! Tick
  }

  override def lowPriority = {
case Tick = {
println(   Tick )
  foos = FooManager.getFoos
  reRender(false)
  ActorPing.schedule(this, Tick, 10 seconds)
}
  }
}

case object Tick
###

   When i run  mvn jetty:run  to start the server, and type the
http://localhost:8080 in the browser.
The result will be like this, the println(   Tick ) method
only execute 1 time every 10 seconds.

###
INFO - Service request (GET) /comet_request/50054201120/farmqqw03xkm
took 46 Mil
liseconds
   Tick 
  foos size: 2
INFO - Service request (GET) /comet_request/87077494133/farmqqw03xkm
took 8625 M
###

   Then i don't close the browser, and Ctrl+C stop the jetty server,
and  mvn jetty:run  restart the server, the result will be like this:
The  println(   Tick ) method will be execute 3 times every
10 seconds.

###
INFO - Service request (GET) /comet_request/74875169086/farmqqw03xkm
took 0 Mill
iseconds
  foos size: 8
  localSetup:
   Tick 
  foos size: 9
INFO - Service request (GET) / took 109 Milliseconds
  foos size: 10
  localSetup:
   Tick 
  foos size: 11
INFO - Service request (GET) / took 31 Milliseconds
###

   I don't know what's wrong with it .
   If when you stop the server, and close the browser immediately,
then use mvn jetty:run to start the server, and open a new browser to
visit http://localhost:8080,  the result is correctly.

   Thanks for any suggestion!

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 fix the bug in firefox that application/xhtml+xml doesn't have the write() method ?

2009-12-02 Thread Neil.Lv
Hi all,

   How to fix the bug in firefox that application/xhtml+xml doesn't
have the write() method ?

   The document object created in Firefox when the mime type is
application/xhtml+xml does not have the write() method.

   I have a script that need to use the document.write method in the
lift page.

###
script charset=utf-8 language=JavaScript src=http://..php/
###

  I try that create a test.html ( /src/main/webapp/test.html ) and the
use the iframe to embed the test.html.

###
iframe frameborder=1 scrolling=yes style=height: 5px; width:
5px; src=test.html name=lift/iframe
###

   It works fine in the IE, but not in the Firefox.

   Does anybody know that how to resolve this problem in the lift ?


Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to fix the bug in firefox that application/xhtml+xml doesn't have the write() method ?

2009-12-02 Thread Neil.Lv

  I set the XhtmlMimeType to false, and it can works now!

###
LiftRules.useXhtmlMimeType = false
###

  Thanks very much!

Cheers,
  Neil

On Dec 2, 9:03 pm, Arthur avand...@gmail.com wrote:
 Hi Neil

 document.write() isn't allowed for real xml files like xhtml+xml
 where an xml parser checks for well-formedness of the xml. You should
 be able to use things like appendChild().

 Regards

 Arthur

 On 2 Dez., 13:42, Neil.Lv anim...@gmail.com wrote:

  Hi all,

     How to fix the bug in firefox that application/xhtml+xml doesn't
  have the write() method ?

     The document object created in Firefox when the mime type is
  application/xhtml+xml does not have the write() method.

     I have a script that need to use the document.write method in the
  lift page.

  ###
  script charset=utf-8 language=JavaScript src=http://..php/
  ###

    I try that create a test.html ( /src/main/webapp/test.html ) and the
  use the iframe to embed the test.html.

  ###
  iframe frameborder=1 scrolling=yes style=height: 5px; width:
  5px; src=test.html name=lift/iframe
  ###

     It works fine in the IE, but not in the Firefox.

     Does anybody know that how to resolve this problem in the lift ?

  Cheers,
    Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 use the ActorPing schedule ? in the lift .

2009-12-02 Thread Neil.Lv
Hi all,

   I want to query the records of the RMDBS every several minutes.

   Does use the ActorPing or something else to achieve this purpose ?

   Is there an example that about the ActorPing ?

   Thanks for any suggestion !

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to use the ActorPing schedule ? in the lift .

2009-12-02 Thread Neil.Lv

   Thanks very much, yeah, that what i want.

   Is there a wiki example tutorial ?

Cheers,
  Neil


On Dec 3, 12:46 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Neil,

 ActorPing is what you want, yes. Essentially, calling it says in X time span 
 call Z method - if you need repeating behaviour, just put a call to actor 
 ping at the end of the Z method to reschedule it.

 That should be all you need.

 Cheers, Tim

 On 2 Dec 2009, at 16:39, Neil.Lv wrote:

  Hi all,

I want to query the records of the RMDBS every several minutes.

Does use the ActorPing or something else to achieve this purpose ?

Is there an example that about the ActorPing ?

Thanks for any suggestion !

  Cheers,
   Neil

  --

  You received this message because you are subscribed to the Google Groups 
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to 
  liftweb+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/liftweb?hl=en.

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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 redirect to a specify url when logged in successfully?

2009-11-29 Thread Neil.Lv
Hi all,

   I want to redirecto to a specify URL like this /all_users when
logged in successfully via the default link, 
http://localhost:8080/user_mgt/login

  Is there a help method (i dont't find it) to configure it?

  When i logged in successfully via /user_mgt/login link and redirect
to the /all_users link not the /index page.

  Thanks for any help.

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to redirect to a specify url when logged in successfully?

2009-11-29 Thread Neil.Lv

  The /user_mgt/login link is supported by the Lift's User Module.

  Maybe can i override some method to change the param of the
redirectTo method .?

  What's the DispatchPF that how to use it ?

  I haven't use the DispathPF yet!~

  Thanks very much!

  :)

Cheers,
  Neil

On Nov 29, 5:36 pm, Marius marius.dan...@gmail.com wrote:
 You can use a DispatchPF for /user_mgt/login, do your logic, and
 return a Full(RedirectResponse(/all_users)).

 If /user_mgt/login is a login page rendering a login form, then in
 your bound function when processing the form after doing the login
 processing you can call S.redirectTo(/all_users) from your submit
 function.

 Br's,
 Marius

 On Nov 29, 10:17 am, Neil.Lv anim...@gmail.com wrote:

  Hi all,

     I want to redirecto to a specify URL like this /all_users when
  logged in successfully via the default 
  link,http://localhost:8080/user_mgt/login

    Is there a help method (i dont't find it) to configure it?

    When i logged in successfully via /user_mgt/login link and redirect
  to the /all_users link not the /index page.

    Thanks for any help.

  Cheers,
    Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: How to redirect to a specify url when logged in successfully?

2009-11-29 Thread Neil.Lv

  Got it,  Thank you very much!

  I'm looking forward to your replied about the DispatchPF.

Cheers,
  Neil

On Nov 29, 11:55 pm, Marius marius.dan...@gmail.com wrote:
 About DisptachPF I replied privately to your email.

 I didn't realize that you were using Mapper. Here are a few threads
 that may help you:

 http://groups.google.com/group/liftweb/browse_thread/thread/bdd5accd4...http://groups.google.com/group/liftweb/browse_thread/thread/fe78925ab...

 Also the examples application (liftweb\lift-examples\example from lift
 git repository) could help.

 Br's,
 Marius

 On Nov 29, 11:55 am, Neil.Lv anim...@gmail.com wrote:

The /user_mgt/login link is supported by the Lift's User Module.

Maybe can i override some method to change the param of the
  redirectTo method .?

What's the DispatchPF that how to use it ?

I haven't use the DispathPF yet!~

Thanks very much!

:)

  Cheers,
Neil

  On Nov 29, 5:36 pm, Marius marius.dan...@gmail.com wrote:

   You can use a DispatchPF for /user_mgt/login, do your logic, and
   return a Full(RedirectResponse(/all_users)).

   If /user_mgt/login is a login page rendering a login form, then in
   your bound function when processing the form after doing the login
   processing you can call S.redirectTo(/all_users) from your submit
   function.

   Br's,
   Marius

   On Nov 29, 10:17 am, Neil.Lv anim...@gmail.com wrote:

Hi all,

   I want to redirecto to a specify URL like this /all_users when
logged in successfully via the default 
link,http://localhost:8080/user_mgt/login

  Is there a help method (i dont't find it) to configure it?

  When i logged in successfully via /user_mgt/login link and redirect
to the /all_users link not the /index page.

  Thanks for any help.

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Building war for production mode.

2009-11-28 Thread Neil.Lv
  Now the lift app runs in the production mode,

###
  put the JAVA_OPTIONS=-Drun.mode=production on the top, and it can
workd.
###

 But it will create the database in the jetty's folder
 /home/jetty6/derby.log
 /home/jetty6/lift_example

  It can's find the jdbc:mysql ?  (It the development mode it can find
the jdbc:mysql driver)

  I don't know what's the problem with it .

  Thanks for any help!

Cheers,
  Neil


On Nov 28, 3:48 pm, Neil.Lv anim...@gmail.com wrote:
 I have the same issue, is add this statement into /home/jetty6/bin/
 jetty.sh

 ###
   echo JAVA_OPTIONS=-Drun.mode=production  /home/jetty6/bin/
 jetty.sh
 ###

  then restart the jetty server, but it alwasy show the Development
 Mode information
  The requested page was not defined in your SiteMap, so access was
 blocked

   The server is CentOS 5.3

 Cheers,
   Neil

 On Nov 27, 7:13 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

  Marcin Jurczuk mjurc...@gmail.com writes:
   Hello,

   I'm trying to first test deploy of my app :)

   I created package (mvn package), uploaded created war as root.war in
   webapp folder of jetty server and when running app it looks that lift
   app is running in development mode (no 404 is showed but:
   The requested page was not defined in your SiteMap, so access was
   blocked.  (This message is displayed in development mode only

   How inform maven that I'm building production package ?
   I tried mvn -Drun.mode=production package  - no effect ?

  You don't build for deployment, it is the same war (modulus any compiler
  settings or other build steps you've specified)

  The lift run mode is determined at runtime, so you need to specify the
  run.mode=production as a system property when launching jetty

  (This is what happens with the maven command above: It starts jetty with
  this system property set)

  If you happen to run jetty on a Debian based Linux you can accomplish
  this by:

  echo JAVA_OPTIONS=-Drun.mode=production /etc/default/jetty6

  /Jeppe

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Building war for production mode.

2009-11-28 Thread Neil.Lv
  Now the lift app runs in the production mode,

###
  put the JAVA_OPTIONS=-Drun.mode=production on the top, and it can
workd.
###

 But it will create the database in the jetty's folder
 /home/jetty6/derby.log
 /home/jetty6/lift_example

  It can's find the jdbc:mysql ?  (It the development mode it can find
the jdbc:mysql driver)

  I don't know what's the problem with it .

  Thanks for any help!

Cheers,
  Neil


On Nov 28, 3:48 pm, Neil.Lv anim...@gmail.com wrote:
 I have the same issue, is add this statement into /home/jetty6/bin/
 jetty.sh

 ###
   echo JAVA_OPTIONS=-Drun.mode=production  /home/jetty6/bin/
 jetty.sh
 ###

  then restart the jetty server, but it alwasy show the Development
 Mode information
  The requested page was not defined in your SiteMap, so access was
 blocked

   The server is CentOS 5.3

 Cheers,
   Neil

 On Nov 27, 7:13 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

  Marcin Jurczuk mjurc...@gmail.com writes:
   Hello,

   I'm trying to first test deploy of my app :)

   I created package (mvn package), uploaded created war as root.war in
   webapp folder of jetty server and when running app it looks that lift
   app is running in development mode (no 404 is showed but:
   The requested page was not defined in your SiteMap, so access was
   blocked.  (This message is displayed in development mode only

   How inform maven that I'm building production package ?
   I tried mvn -Drun.mode=production package  - no effect ?

  You don't build for deployment, it is the same war (modulus any compiler
  settings or other build steps you've specified)

  The lift run mode is determined at runtime, so you need to specify the
  run.mode=production as a system property when launching jetty

  (This is what happens with the maven command above: It starts jetty with
  this system property set)

  If you happen to run jetty on a Debian based Linux you can accomplish
  this by:

  echo JAVA_OPTIONS=-Drun.mode=production /etc/default/jetty6

  /Jeppe

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread Neil.Lv
Hi all,

   I have a silly question about the lift app that deployed on the
Jetty server.


   Can't find the jdbc:mysql driver in Production Mode ? It will use
the derby to instead of the mysql.

  But it works fine in the Development Mode.

  I will craete the derby file in the jetty folder.
  /home/jetty6/derby.log
  /home/jetty6/lift-example

  Thanks for any suggestion!

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread Neil.Lv
  Thanks very much!

  It's in the production mode now.

  This snippet's result is production

Cheers,
  Neil


David Pollak wrote:
 Write a snippet:

 import net.liftweb.util.Props
 import scala.xml._

 class WhatMode {
   def render = Text(Props.modeName)
 }

 On a page:

 lift:WhatMode/

 And the mode will be listed (or blank for development mode)

 On Sat, Nov 28, 2009 at 6:23 AM, Neil.Lv anim...@gmail.com wrote:

 
   I missing the production.default.props file in the /src/main/
  resources/props folder
 
   I create a file named production.default.props(copy from
  default.props) in this folder.
 
   When i enter a invalid URL like:
 http://192.168.1.102/fsdf
 
   The browser will show this message:
 The Requested URL/fsdfwas not found on this server
 
Is it in the production mode now?
 
  Cheers,
   Neil
 
 
  David Pollak wrote:
   Do a println to output the value of Props.get(db.driver)
  
   On Sat, Nov 28, 2009 at 6:06 AM, Neil.Lv anim...@gmail.com wrote:
  
   
 It generated by the archetype lift-archetype-basic.
   
##  in the Boot.scala
object DBVendor extends ConnectionManager {
 private var pool: List[Connection] = Nil
 private var poolSize = 0
 private val maxPoolSize = 4
   
 private def createOne: Box[Connection] = try {
   val driverName: String = Props.get(db.driver) openOr
   org.apache.derby.jdbc.EmbeddedDriver
   
   val dbUrl: String = Props.get(db.url) openOr
   jdbc:derby:lift_example;create=true
   
   Class.forName(driverName)
   
   val dm = (Props.get(db.user), Props.get(db.password)) match {
 case (Full(user), Full(pwd)) =
   DriverManager.getConnection(dbUrl, user, pwd)
   
 case _ = DriverManager.getConnection(dbUrl)
   }
   
   Full(dm)
 } catch {
   case e: Exception = e.printStackTrace; Empty
 }
   
 def newConnection(name: ConnectionIdentifier): Box[Connection] =
   synchronized {
 pool match {
   case Nil if poolSize  maxPoolSize =
 val ret = createOne
   poolSize = poolSize + 1
   ret.foreach(c = pool = c :: pool)
   ret
   
   case Nil = wait(1000L); newConnection(name)
   case x :: xs = try {
 x.setAutoCommit(false)
 Full(x)
   } catch {
 case e = try {
   pool = xs
   poolSize = poolSize - 1
   x.close
   newConnection(name)
 } catch {
   case e = newConnection(name)
 }
   }
 }
   }
   
 def releaseConnection(conn: Connection): Unit = synchronized {
   pool = conn :: pool
   notify
 }
}
   
##
   
  And this is my default.props (In src\main\resources\props )
  Only this file in the props folder.
   
###
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/project
db.user=root
db.password=root
###
   
Cheers,
 Neil
   
   
On Nov 28, 7:57 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Paste your database connection object? its probably that you copied
  the
one from lift examples and you are now missing the correct properties
file...

 Cheers, Tim

 On 28 Nov 2009, at 10:26, Neil.Lv wrote:

  Hi all,

I have a silly question about the lift app that deployed on the
  Jetty server.

Can't find the jdbc:mysql driver in Production Mode ? It will use
  the derby to instead of the mysql.

   But it works fine in the Development Mode.

   I will craete the derby file in the jetty folder.
   /home/jetty6/derby.log
   /home/jetty6/lift-example

   Thanks for any suggestion!

  Cheers,
   Neil

  --

  You received this message because you are subscribed to the Google
Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
  
.
  For more options, visit this group athttp://
groups.google.com/group/liftweb?hl=en.
   
--
   
You received this message because you are subscribed to the Google
  Groups
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
  
.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.
   
   
   
  
  
   --
   Lift, the simply functional web framework http://liftweb.net
   Beginning Scala http://www.apress.com/book/view/1430219890
   Follow me: http://twitter.com

[Lift] Re: Building war for production mode.

2009-11-28 Thread Neil.Lv

  Thanks very much,

  I missing the production.default.props file .

Cheers,
  Neil

On Nov 28, 9:33 pm, Leo Lännenmäki leo.lannenm...@gmail.com wrote:
 Hi,

 I'm a Lift newbie so I don't know if my way is the right way but
 here goes:

 I generated my app using the archetype lift-archetype-basic in order
 to get the database configuration stuff to Boot.scala. Then i created
 two files src/main/webapp/WEB-INF/classes/props/default.props and
 production.default.props. When developing I want to use an in memory
 database so I added:

 db.driver = org.apache.derby.jdbc.EmbeddedDriver
 db.url = jdbc:derby:my_database_name;create=true

 to default.props. I want to use MySQL on the production server so I
 added:

 db.driver = com.mysql.jdbc.Driver
 db.url = jdbc:mysql://localhost:3306/my_database_name
 db.user = my_user
 db.password = my_pass

 to production.default.props. On the production server I user Tomcat
 with -Drun.mode=production.

 I hope you get some ideas about my configuration.

 Leo

 On Nov 28, 11:02 am, Neil.Lv anim...@gmail.com wrote:

    Now the lift app runs in the production mode,

  ###
    put the JAVA_OPTIONS=-Drun.mode=production on the top, and it can
  workd.
  ###

   But it will create the database in the jetty's folder
   /home/jetty6/derby.log
   /home/jetty6/lift_example

    It can's find the jdbc:mysql ?  (It the development mode it can find
  the jdbc:mysql driver)

    I don't know what's the problem with it .

    Thanks for any help!

  Cheers,
    Neil

  On Nov 28, 3:48 pm, Neil.Lv anim...@gmail.com wrote:

   I have the same issue, is add this statement into /home/jetty6/bin/
   jetty.sh

   ###
     echo JAVA_OPTIONS=-Drun.mode=production  /home/jetty6/bin/
   jetty.sh
   ###

    then restart the jetty server, but it alwasy show the Development
   Mode information
    The requested page was not defined in your SiteMap, so access was
   blocked

     The server is CentOS 5.3

   Cheers,
     Neil

   On Nov 27, 7:13 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

Marcin Jurczuk mjurc...@gmail.com writes:
 Hello,

 I'm trying to first test deploy of my app :)

 I created package (mvn package), uploaded created war as root.war in
 webapp folder of jetty server and when running app it looks that lift
 app is running in development mode (no 404 is showed but:
 The requested page was not defined in your SiteMap, so access was
 blocked.  (This message is displayed in development mode only

 How inform maven that I'm building production package ?
 I tried mvn -Drun.mode=production package  - no effect ?

You don't build for deployment, it is the same war (modulus any compiler
settings or other build steps you've specified)

The lift run mode is determined at runtime, so you need to specify the
run.mode=production as a system property when launching jetty

(This is what happens with the maven command above: It starts jetty with
this system property set)

If you happen to run jetty on a Debian based Linux you can accomplish
this by:

echo JAVA_OPTIONS=-Drun.mode=production /etc/default/jetty6

/Jeppe

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Building war for production mode.

2009-11-27 Thread Neil.Lv
I have the same issue, is add this statement into /home/jetty6/bin/
jetty.sh

###
  echo JAVA_OPTIONS=-Drun.mode=production  /home/jetty6/bin/
jetty.sh
###

 then restart the jetty server, but it alwasy show the Development
Mode information
 The requested page was not defined in your SiteMap, so access was
blocked

  The server is CentOS 5.3

Cheers,
  Neil


On Nov 27, 7:13 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 Marcin Jurczuk mjurc...@gmail.com writes:
  Hello,

  I'm trying to first test deploy of my app :)

  I created package (mvn package), uploaded created war as root.war in
  webapp folder of jetty server and when running app it looks that lift
  app is running in development mode (no 404 is showed but:
  The requested page was not defined in your SiteMap, so access was
  blocked.  (This message is displayed in development mode only

  How inform maven that I'm building production package ?
  I tried mvn -Drun.mode=production package  - no effect ?

 You don't build for deployment, it is the same war (modulus any compiler
 settings or other build steps you've specified)

 The lift run mode is determined at runtime, so you need to specify the
 run.mode=production as a system property when launching jetty

 (This is what happens with the maven command above: It starts jetty with
 this system property set)

 If you happen to run jetty on a Debian based Linux you can accomplish
 this by:

 echo JAVA_OPTIONS=-Drun.mode=production /etc/default/jetty6

 /Jeppe

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] Jetty or Tomcat, Which web container is recommended to use to deploy the Lift app ?

2009-11-19 Thread Neil.Lv
Hi all,

  I have a silly question about the deploy.

  Which web container is recommended to use to deploy the Lift app ?
Jetty or Tomcat ?

  I want to use the Comet to push the data in the app.

  * Apache + Tomcat ?
  * Apache + what  ?
  * Nginx + what ?

  Thanks for any suggestion !

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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=.




[Lift] Re: Jetty or Tomcat, Which web container is recommended to use to deploy the Lift app ?

2009-11-19 Thread Neil.Lv

  If i use LVS + Nginx + Haproxy + Tomcat  to deploy the app, Can it
work with Apache at simultaneously ?

Cheers,
  Neil

On Nov 20, 9:35 am, Neil.Lv anim...@gmail.com wrote:
 Hi all,

   I have a silly question about the deploy.

   Which web container is recommended to use to deploy the Lift app ?
 Jetty or Tomcat ?

   I want to use the Comet to push the data in the app.

   * Apache + Tomcat ?
   * Apache + what  ?
   * Nginx + what ?

   Thanks for any suggestion !

 Cheers,
   Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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=.




[Lift] RequestVar doesn't work in the Lift1.1-SNAPSHOT ?

2009-11-17 Thread Neil.Lv
Hi all,

  The RequestVar doesn't work in the Lift1.1-SNAPSHOT,

   The error message is:
###
object creation impossible, since method testWasSet in trait
AnyVarTrait of type (String)Boolean is not defined
  object currentItemVar extends RequestVar[Item]({
###

  The code is :
###
  object currentItemVar extends RequestVar[Item]({
Item.getItemById(S.param(id).toString.toLong)
  })
###

  When updating the lift1.1's jars file, this code is broken.

  Any help must be appreciated!

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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=.




[Lift] Re: RequestVar doesn't work in the Lift1.1-SNAPSHOT ?

2009-11-17 Thread Neil.Lv

   It doesn't work too.

   The error message is the same as before :
###
object creation impossible, since method testWasSet in trait
AnyVarTrait of type (String)Boolean is not defined
  object currentItemVar extends RequestVar[Item]({
###

  What is the testWasSet in trait AnyVarTrait  ... ?

  I use the RequestVar to save the item that will be edited in the
edit page.

Cheers,
  Neil


On Nov 18, 12:42 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Tue, Nov 17, 2009 at 8:23 AM, Neil.Lv anim...@gmail.com wrote:
  Hi all,

   The RequestVar doesn't work in the Lift1.1-SNAPSHOT,

The error message is:
  ###
  object creation impossible, since method testWasSet in trait
  AnyVarTrait of type (String)Boolean is not defined
   object currentItemVar extends RequestVar[Item]({
  ###

   The code is :
  ###
   object currentItemVar extends RequestVar[Item]({
 Item.getItemById(S.param(id).toString.toLong)
   })
  ###

   When updating the lift1.1's jars file, this code is broken.

   Any help must be appreciated!

 Please do a mvn -U clean install





  Cheers,
   Neil

  --

  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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=.




[Lift] Re: RequestVar doesn't work in the Lift1.1-SNAPSHOT ?

2009-11-17 Thread Neil.Lv

  When i delete all the repository file, then use mvn jetty:run,
this information will be shown.

  It doesn't find the webkit jar file, when i can download it manually
so that i can use the mvn install:install-file
to install it.

  I use the 1.1-SNAPSHOT to develop the app not 1.1-M7.

  I see the (http://scala-tools.org/repo-releases) website that the
1.1-SNAPSHOT doesn't exist ?

##
Missing:
--
1) net.liftweb:lift-webkit:jar:1.1-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
  mvn install:install-file -DgroupId=net.liftweb -DartifactId=lift-
webkit -D
version=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the
file there:

  mvn deploy:deploy-file -DgroupId=net.liftweb -DartifactId=lift-
webkit -Dve
rsion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -
Drepository
Id=[id]

  Path to dependency:
1) demo.helloworld:helloworld:war:1.0-SNAPSHOT
2) net.liftweb:lift-webkit:jar:1.1-SNAPSHOT

2) net.liftweb:lift-mapper:jar:1.1-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
  mvn install:install-file -DgroupId=net.liftweb -DartifactId=lift-
mapper -D
version=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the
file there:

  mvn deploy:deploy-file -DgroupId=net.liftweb -DartifactId=lift-
mapper -Dve
rsion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -
Drepository
Id=[id]

  Path to dependency:
1) demo.helloworld:helloworld:war:1.0-SNAPSHOT
2) net.liftweb:lift-mapper:jar:1.1-SNAPSHOT

--
2 required artifacts are missing.

for artifact:
  demo.helloworld:helloworld:war:1.0-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  scala-tools.org (http://scala-tools.org/repo-releases)

##


Cheers,
  Neil


On Nov 18, 9:34 am, Neil.Lv anim...@gmail.com wrote:
It doesn't work too.

The error message is the same as before :
 ###
 object creation impossible, since method testWasSet in trait
 AnyVarTrait of type (String)Boolean is not defined
   object currentItemVar extends RequestVar[Item]({
 ###

   What is the testWasSet in trait AnyVarTrait  ... ?

   I use the RequestVar to save the item that will be edited in the
 edit page.

 Cheers,
   Neil

 On Nov 18, 12:42 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:

  On Tue, Nov 17, 2009 at 8:23 AM, Neil.Lv anim...@gmail.com wrote:
   Hi all,

The RequestVar doesn't work in the Lift1.1-SNAPSHOT,

 The error message is:
   ###
   object creation impossible, since method testWasSet in trait
   AnyVarTrait of type (String)Boolean is not defined
object currentItemVar extends RequestVar[Item]({
   ###

The code is :
   ###
object currentItemVar extends RequestVar[Item]({
  Item.getItemById(S.param(id).toString.toLong)
})
   ###

When updating the lift1.1's jars file, this code is broken.

Any help must be appreciated!

  Please do a mvn -U clean install

   Cheers,
Neil

   --

   You received this message because you are subscribed to the Google Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=.

  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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=.




[Lift] Re: RequestVar doesn't work in the Lift1.1-SNAPSHOT ?

2009-11-17 Thread Neil.Lv

   I didn't add this code before.

   Now the jars can be download.

   Thank you very much!

Cheers,
  Neil

On Nov 18, 10:41 am, Ross Mellgren dri...@gmail.com wrote:
 1.1-SNAPSHOT is in the scala-tools snapshots repo. Do you have this in your 
 pom.xml?

 repository
 idscala-tools.org.snapshots/id
 nameScala-Tools Maven2 Repository for Snapshots/name
 urlhttp://scala-tools.org/repo-snapshots/url
 snapshots/
 /repository

 On Nov 17, 2009, at 9:32 PM, Neil.Lv wrote:



   When i delete all the repository file, then use mvn jetty:run,
  this information will be shown.

   It doesn't find the webkit jar file, when i can download it manually
  so that i can use the mvn install:install-file
  to install it.

   I use the 1.1-SNAPSHOT to develop the app not 1.1-M7.

   I see the (http://scala-tools.org/repo-releases) website that the
  1.1-SNAPSHOT doesn't exist ?

  ##
  Missing:
  --
  1) net.liftweb:lift-webkit:jar:1.1-SNAPSHOT

   Try downloading the file manually from the project website.

   Then, install it using the command:
   mvn install:install-file -DgroupId=net.liftweb -DartifactId=lift-
  webkit -D
  version=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

   Alternatively, if you host your own repository you can deploy the
  file there:

   mvn deploy:deploy-file -DgroupId=net.liftweb -DartifactId=lift-
  webkit -Dve
  rsion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -
  Drepository
  Id=[id]

   Path to dependency:
 1) demo.helloworld:helloworld:war:1.0-SNAPSHOT
 2) net.liftweb:lift-webkit:jar:1.1-SNAPSHOT

  2) net.liftweb:lift-mapper:jar:1.1-SNAPSHOT

   Try downloading the file manually from the project website.

   Then, install it using the command:
   mvn install:install-file -DgroupId=net.liftweb -DartifactId=lift-
  mapper -D
  version=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

   Alternatively, if you host your own repository you can deploy the
  file there:

   mvn deploy:deploy-file -DgroupId=net.liftweb -DartifactId=lift-
  mapper -Dve
  rsion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -
  Drepository
  Id=[id]

   Path to dependency:
 1) demo.helloworld:helloworld:war:1.0-SNAPSHOT
 2) net.liftweb:lift-mapper:jar:1.1-SNAPSHOT

  --
  2 required artifacts are missing.

  for artifact:
   demo.helloworld:helloworld:war:1.0-SNAPSHOT

  from the specified remote repositories:
   central (http://repo1.maven.org/maven2),
   scala-tools.org (http://scala-tools.org/repo-releases)

  ##

  Cheers,
   Neil

  On Nov 18, 9:34 am, Neil.Lv anim...@gmail.com wrote:
It doesn't work too.

The error message is the same as before :
  ###
  object creation impossible, since method testWasSet in trait
  AnyVarTrait of type (String)Boolean is not defined
   object currentItemVar extends RequestVar[Item]({
  ###

   What is the testWasSet in trait AnyVarTrait  ... ?

   I use the RequestVar to save the item that will be edited in the
  edit page.

  Cheers,
   Neil

  On Nov 18, 12:42 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:

  On Tue, Nov 17, 2009 at 8:23 AM, Neil.Lv anim...@gmail.com wrote:
  Hi all,

  The RequestVar doesn't work in the Lift1.1-SNAPSHOT,

   The error message is:
  ###
  object creation impossible, since method testWasSet in trait
  AnyVarTrait of type (String)Boolean is not defined
  object currentItemVar extends RequestVar[Item]({
  ###

  The code is :
  ###
  object currentItemVar extends RequestVar[Item]({
Item.getItemById(S.param(id).toString.toLong)
  })
  ###

  When updating the lift1.1's jars file, this code is broken.

  Any help must be appreciated!

  Please do a mvn -U clean install

  Cheers,
  Neil

  --

  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=.

  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

  --

  You received this message because you are subscribed to the Google Groups 
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to 
  liftweb+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/liftweb?hl=.

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group

[Lift] Re: How to save the uploaded image into the folder via fileUpload in Lift?

2009-11-15 Thread Neil.Lv

Tim,

  I'm not clear that how to do use the caching proxy and maps a URL to
the dispatcher.

  I didn't find the archive about the SoftReferenceCache.

  Is there some exmaple that descript how to use is ~?

  :)

  Thanks very much!

Cheers,
  Neil

On Nov 15, 6:33 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Neil,

 If you want to save the byte array, save it into the database, then just 
 write a caching proxy that maps a URL to the dispatcher. That is, use 
 SoftReferenceCache to cache the database read so that the next time the image 
 is requested there is no database hit.

 This has been discussed a fair few times on the list if i remember rightly, 
 so best off searching the archives if your not sure where to start.

 Cheers, Tim

 On 15 Nov 2009, at 04:16, Neil.Lv wrote:



   I want to save the images to a directory, because this images will
  be used in the flash params.

   This file path will be used in the javascript code .
  ###
   var imag=new Array();
   imag[3]=/images/01.jpg;
  ###

  Cheers,
   Neil

  On Nov 15, 12:05 pm, Neil.Lv anim...@gmail.com wrote:
  Hi all,

    Thanks for your tips, and I have some silly question about this.

    1:)  a directory that's not part of the app's exploded WAR file

    The direcotry tree like this, and Where is i can create a well
  defined directory
  that's not part of the app's exploded WAR file ? I'm not        familiar
  with this.

  ###
  demo
    --src
      --main
        --resources
          --i18n
          --props
        --scala
        --webapp
      --test
    --target
  ###

    2:) If I store images to the RDBMS, and how can it be shown in the
  webpage ?
  ###
     FileParamHolder(_, mime, name, data)
     
     item.receipt(data).receiptMime(mime)   // ( Array[Byte] that saved
  into database )
  ###

    :)

    Thanks very much !

  Cheers,
    Neil

  On Nov 15, 5:43 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:

  On Sat, Nov 14, 2009 at 10:25 AM, Neil.Lv anim...@gmail.com wrote:

  Tim,

   haha, yeah.

   I use this code to get the images folder(the full path) of the app.

   LiftRules.getResource(/images/).open_!.toString.substring(6)
  (The code is so redundant !)
     - G:\project\demo\src\main\webapp\images\

  You cannot rely on being able to write to a directory in an application.
  This is dependent on how the specific web app container handles things, 
  but
  I would strongly suggest you write images to a directory that's not part 
  of
  the app's exploded WAR file.  And strongly is a very weak description of
  how forceful I'm being about this.  This kind of code may change behaviour
  between your dev box and production, between versions of your app 
  container.

  If you want to store images to serve, either use a well defined directory
  outside your WAR file or put stuff in your RDBMS or put stuff up on Amazon
  (like Twitter does with images).  Amazon has much better infrastructure 
  for
  dealing with serving static content than just about anyone else.

   :)

   Thank you very much !

  Cheers,
    Neil

  On Nov 15, 1:50 am, Timothy Perrett timo...@getintheloop.eu wrote:
  Hmm, I guess you must be new to the JVM - you cant write a file inside a
  WAR file; it does not work like that.

  You'll need to write to a fully qualified path (as per my example).

  Cheers, tim

  On 14 Nov 2009, at 17:34, Neil.Lv wrote:

   It show this error message:

   ERROR - java.io.FileNotFoundException: \images\003.jpg

  #  this is the code

  val receiptOk = fileHolder match {
  case Full(FileParamHolder(_, null, _, _)) = true
  case Full(FileParamHolder(_, mime, name, data))
   if mime.startsWith(image/) = {
     var buff = new java.io.BufferedInputStream(new ByteArrayInputStream
  (data))
     try {
      var fos = new java.io.FileOutputStream(new File(/images/ +
  name))
      var in = 0
     do {
        in = buff.read()
        if (in != -1){
          fos.write(in)
        }
      } while((in != -1))
     fos = null
     in = 0
    } catch {
       case e = Log.error(e)
    } finally {
      buff.close()
    }
    buff = null
     true
   }
  case Full(_) = {
  S.error(S.??(invalid.receipt.attachment))
  false
  }
  case _ = true
  }

  #

    Maybe this code is wrong ?

    new File(/images/ + name)

    I want to save it in the main\webapp\images\  folder.
      - main\webapp\images\ 003.jpg

    :)

  Cheers,
   Neil

  On Nov 15, 12:23 am, Timothy Perrett timo...@getintheloop.eu wrote:
  Neil,

  Try something like:

  var buff = new java.io.BufferedInputStream(input)
  try {
    var fos = new java.io.FileOutputStream(new File(/some/root/
  filepath/ + image_hash_filename))
    var in = 0
    do {
      in = buff.read()
      if (in != -1){
        fos.write(in)
      }
    } while((in != -1))
    fos = null
    in = 0} catch {

    case e = Log.error(e)

  } finally {
    buff.close()
  }
  buff = null
  }

  In my case, I had the data as an input stream - manipulate

[Lift] Re: How to save the uploaded image into the folder via fileUpload in Lift?

2009-11-15 Thread Neil.Lv


  It try to deploy the war to the tomcat5.5.25, and the path is
different.

  Use LiftRules.getResource(/images/) to get this information:

   In the dev box:
   -- Path:Full(file:/G:/project/demo/src/main/webapp/images/

   In the tomcat:
   -- Path:Full(jndi:/localhost/demo-1.0/images/

   The war of the demo path:  D:\tomcat_5.5.25\webapps\demo-1.0

   So that how can i resolve this problem ?

Cheers,
  Neil

On Nov 15, 9:57 pm, Neil.Lv anim...@gmail.com wrote:
 Tim,

   I'm not clear that how to do use the caching proxy and maps a URL to
 the dispatcher.

   I didn't find the archive about the SoftReferenceCache.

   Is there some exmaple that descript how to use is ~?

   :)

   Thanks very much!

 Cheers,
   Neil

 On Nov 15, 6:33 pm, Timothy Perrett timo...@getintheloop.eu wrote:

  Neil,

  If you want to save the byte array, save it into the database, then just 
  write a caching proxy that maps a URL to the dispatcher. That is, use 
  SoftReferenceCache to cache the database read so that the next time the 
  image is requested there is no database hit.

  This has been discussed a fair few times on the list if i remember rightly, 
  so best off searching the archives if your not sure where to start.

  Cheers, Tim

  On 15 Nov 2009, at 04:16, Neil.Lv wrote:

    I want to save the images to a directory, because this images will
   be used in the flash params.

    This file path will be used in the javascript code .
   ###
    var imag=new Array();
    imag[3]=/images/01.jpg;
   ###

   Cheers,
    Neil

   On Nov 15, 12:05 pm, Neil.Lv anim...@gmail.com wrote:
   Hi all,

     Thanks for your tips, and I have some silly question about this.

     1:)  a directory that's not part of the app's exploded WAR file

     The direcotry tree like this, and Where is i can create a well
   defined directory
   that's not part of the app's exploded WAR file ? I'm not        familiar
   with this.

   ###
   demo
     --src
       --main
         --resources
           --i18n
           --props
         --scala
         --webapp
       --test
     --target
   ###

     2:) If I store images to the RDBMS, and how can it be shown in the
   webpage ?
   ###
      FileParamHolder(_, mime, name, data)
      
      item.receipt(data).receiptMime(mime)   // ( Array[Byte] that saved
   into database )
   ###

     :)

     Thanks very much !

   Cheers,
     Neil

   On Nov 15, 5:43 am, David Pollak feeder.of.the.be...@gmail.com
   wrote:

   On Sat, Nov 14, 2009 at 10:25 AM, Neil.Lv anim...@gmail.com wrote:

   Tim,

    haha, yeah.

    I use this code to get the images folder(the full path) of the app.

    LiftRules.getResource(/images/).open_!.toString.substring(6)
   (The code is so redundant !)
      - G:\project\demo\src\main\webapp\images\

   You cannot rely on being able to write to a directory in an application.
   This is dependent on how the specific web app container handles things, 
   but
   I would strongly suggest you write images to a directory that's not 
   part of
   the app's exploded WAR file.  And strongly is a very weak description 
   of
   how forceful I'm being about this.  This kind of code may change 
   behaviour
   between your dev box and production, between versions of your app 
   container.

   If you want to store images to serve, either use a well defined 
   directory
   outside your WAR file or put stuff in your RDBMS or put stuff up on 
   Amazon
   (like Twitter does with images).  Amazon has much better infrastructure 
   for
   dealing with serving static content than just about anyone else.

    :)

    Thank you very much !

   Cheers,
     Neil

   On Nov 15, 1:50 am, Timothy Perrett timo...@getintheloop.eu wrote:
   Hmm, I guess you must be new to the JVM - you cant write a file 
   inside a
   WAR file; it does not work like that.

   You'll need to write to a fully qualified path (as per my example).

   Cheers, tim

   On 14 Nov 2009, at 17:34, Neil.Lv wrote:

    It show this error message:

    ERROR - java.io.FileNotFoundException: \images\003.jpg

   #  this is the code

   val receiptOk = fileHolder match {
   case Full(FileParamHolder(_, null, _, _)) = true
   case Full(FileParamHolder(_, mime, name, data))
    if mime.startsWith(image/) = {
      var buff = new java.io.BufferedInputStream(new 
   ByteArrayInputStream
   (data))
      try {
       var fos = new java.io.FileOutputStream(new File(/images/ +
   name))
       var in = 0
      do {
         in = buff.read()
         if (in != -1){
           fos.write(in)
         }
       } while((in != -1))
      fos = null
      in = 0
     } catch {
        case e = Log.error(e)
     } finally {
       buff.close()
     }
     buff = null
      true
    }
   case Full(_) = {
   S.error(S.??(invalid.receipt.attachment))
   false
   }
   case _ = true
   }

   #

     Maybe this code is wrong ?

     new File(/images/ + name)

     I want to save it in the main\webapp\images\  folder

[Lift] Re: How to save the uploaded image into the folder via fileUpload in Lift?

2009-11-15 Thread Neil.Lv


  Where is the images directory that should i create ?

  Out side of the webapp in the tomcat  or in the webapps?

  like this:   D:\tomcat_5.5.25\webapps\images

  And the lift how to know and find the images folder in the webapps
of the tomcat, not the demo/src/main/webapp/images .

  Thanks very much!

Cheers,
  Neil

On Nov 15, 11:10 pm, Neil.Lv anim...@gmail.com wrote:
   It try to deploy the war to the tomcat5.5.25, and the path is
 different.

   Use LiftRules.getResource(/images/) to get this information:

In the dev box:
-- Path:Full(file:/G:/project/demo/src/main/webapp/images/

In the tomcat:
-- Path:Full(jndi:/localhost/demo-1.0/images/

The war of the demo path:  D:\tomcat_5.5.25\webapps\demo-1.0

So that how can i resolve this problem ?

 Cheers,
   Neil

 On Nov 15, 9:57 pm, Neil.Lv anim...@gmail.com wrote:

  Tim,

I'm not clear that how to do use the caching proxy and maps a URL to
  the dispatcher.

I didn't find the archive about the SoftReferenceCache.

Is there some exmaple that descript how to use is ~?

:)

Thanks very much!

  Cheers,
Neil

  On Nov 15, 6:33 pm, Timothy Perrett timo...@getintheloop.eu wrote:

   Neil,

   If you want to save the byte array, save it into the database, then just 
   write a caching proxy that maps a URL to the dispatcher. That is, use 
   SoftReferenceCache to cache the database read so that the next time the 
   image is requested there is no database hit.

   This has been discussed a fair few times on the list if i remember 
   rightly, so best off searching the archives if your not sure where to 
   start.

   Cheers, Tim

   On 15 Nov 2009, at 04:16, Neil.Lv wrote:

 I want to save the images to a directory, because this images will
be used in the flash params.

 This file path will be used in the javascript code .
###
 var imag=new Array();
 imag[3]=/images/01.jpg;
###

Cheers,
 Neil

On Nov 15, 12:05 pm, Neil.Lv anim...@gmail.com wrote:
Hi all,

  Thanks for your tips, and I have some silly question about this.

  1:)  a directory that's not part of the app's exploded WAR file

  The direcotry tree like this, and Where is i can create a well
defined directory
that's not part of the app's exploded WAR file ? I'm not
familiar
with this.

###
demo
  --src
--main
  --resources
--i18n
--props
  --scala
  --webapp
--test
  --target
###

  2:) If I store images to the RDBMS, and how can it be shown in the
webpage ?
###
   FileParamHolder(_, mime, name, data)
   
   item.receipt(data).receiptMime(mime)   // ( Array[Byte] that saved
into database )
###

  :)

  Thanks very much !

Cheers,
  Neil

On Nov 15, 5:43 am, David Pollak feeder.of.the.be...@gmail.com
wrote:

On Sat, Nov 14, 2009 at 10:25 AM, Neil.Lv anim...@gmail.com wrote:

Tim,

 haha, yeah.

 I use this code to get the images folder(the full path) of the app.

 LiftRules.getResource(/images/).open_!.toString.substring(6)
(The code is so redundant !)
   - G:\project\demo\src\main\webapp\images\

You cannot rely on being able to write to a directory in an 
application.
This is dependent on how the specific web app container handles 
things, but
I would strongly suggest you write images to a directory that's not 
part of
the app's exploded WAR file.  And strongly is a very weak 
description of
how forceful I'm being about this.  This kind of code may change 
behaviour
between your dev box and production, between versions of your app 
container.

If you want to store images to serve, either use a well defined 
directory
outside your WAR file or put stuff in your RDBMS or put stuff up on 
Amazon
(like Twitter does with images).  Amazon has much better 
infrastructure for
dealing with serving static content than just about anyone else.

 :)

 Thank you very much !

Cheers,
  Neil

On Nov 15, 1:50 am, Timothy Perrett timo...@getintheloop.eu wrote:
Hmm, I guess you must be new to the JVM - you cant write a file 
inside a
WAR file; it does not work like that.

You'll need to write to a fully qualified path (as per my example).

Cheers, tim

On 14 Nov 2009, at 17:34, Neil.Lv wrote:

 It show this error message:

 ERROR - java.io.FileNotFoundException: \images\003.jpg

#  this is the code

val receiptOk = fileHolder match {
case Full(FileParamHolder(_, null, _, _)) = true
case Full(FileParamHolder(_, mime, name, data))
 if mime.startsWith(image/) = {
   var buff = new java.io.BufferedInputStream(new 
ByteArrayInputStream
(data))
   try {
var fos = new java.io.FileOutputStream(new File(/images/ +
name))
var in = 0

[Lift] Re: How to save the uploaded image into the folder via fileUpload in Lift?

2009-11-14 Thread Neil.Lv


  It show this error message:

  ERROR - java.io.FileNotFoundException: \images\003.jpg

#  this is the code

val receiptOk = fileHolder match {
case Full(FileParamHolder(_, null, _, _)) = true
case Full(FileParamHolder(_, mime, name, data))
  if mime.startsWith(image/) = {
var buff = new java.io.BufferedInputStream(new ByteArrayInputStream
(data))
try {
 var fos = new java.io.FileOutputStream(new File(/images/ +
name))
 var in = 0
do {
   in = buff.read()
   if (in != -1){
 fos.write(in)
   }
 } while((in != -1))
fos = null
in = 0
   } catch {
  case e = Log.error(e)
   } finally {
 buff.close()
   }
   buff = null
true
  }
case Full(_) = {
S.error(S.??(invalid.receipt.attachment))
false
}
case _ = true
}

#

   Maybe this code is wrong ?

   new File(/images/ + name)

   I want to save it in the main\webapp\images\  folder.
 - main\webapp\images\ 003.jpg

   :)

Cheers,
  Neil


On Nov 15, 12:23 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Neil,

 Try something like:

 var buff = new java.io.BufferedInputStream(input)
 try {
   var fos = new java.io.FileOutputStream(new File(/some/root/
 filepath/ + image_hash_filename))
   var in = 0
   do {
     in = buff.read()
     if (in != -1){
       fos.write(in)
     }
   } while((in != -1))
   fos = null
   in = 0} catch {

   case e = Log.error(e)

 } finally {
   buff.close()
 }
 buff = null
 }

 In my case, I had the data as an input stream - manipulate this code
 to take it however you need.

 Cheers, Tim

 On Nov 14, 7:55 am, Neil.Lv anim...@gmail.com wrote:

    Here is some code , but it's wrong!

    --  java.io.FileNotFoundException: \images\1.jpeg

   if mime.startsWith(image/) = {
    try{
      var file: File  = new File(/images/1.jpeg);
      var fos:FileOutputStream = new FileOutputStream(file);
      fos.write(data)
    } catch {
      case e = println(exception:   + e)
    }
    e.receipt(data).receiptMime(mime)
     true
   }

    I don't know how to write the code in the try catch statement.

    Does anyone can help  me ?~

    Thanks very much !

  Cheers,
    Neil

  On Nov 14, 1:58 pm, Neil.Lv anim...@gmail.com wrote:

   Hi all,

      How to save the uploaded image into the folder via fileUpload in
   Lift?

      I don't want to save it in the database, the example code in the
   Pocketchangeapp

   ###
             val receiptOk = fileHolder match {
               case Full(FileParamHolder(_, null, _, _)) = true
               case Full(FileParamHolder(_, mime, _, data))
                         if mime.startsWith(image/) = {
   //  How can i save the data into a image in the folder.
                           e.receipt(data).receiptMime(mime)
                           true
                         }
               case Full(_) = {
                 S.error(Invalid receipt attachment)
                 false
               }
               case _ = true
             }
   ###

      To save the image into the webapp\images folder, and it's shown
   just use this link:
      /images/img1.jpg

     Thanks for any suggestion!

   Cheers,
     Neil
--~--~-~--~~~---~--~~
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: How to save the uploaded image into the folder via fileUpload in Lift?

2009-11-14 Thread Neil.Lv

Tim,

  haha, yeah.

  I use this code to get the images folder(the full path) of the app.

  LiftRules.getResource(/images/).open_!.toString.substring(6)
(The code is so redundant !)
- G:\project\demo\src\main\webapp\images\

  :)

  Thank you very much !

Cheers,
  Neil


On Nov 15, 1:50 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Hmm, I guess you must be new to the JVM - you cant write a file inside a WAR 
 file; it does not work like that.

 You'll need to write to a fully qualified path (as per my example).

 Cheers, tim

 On 14 Nov 2009, at 17:34, Neil.Lv wrote:



   It show this error message:

   ERROR - java.io.FileNotFoundException: \images\003.jpg

  #  this is the code

  val receiptOk = fileHolder match {
  case Full(FileParamHolder(_, null, _, _)) = true
  case Full(FileParamHolder(_, mime, name, data))
   if mime.startsWith(image/) = {
     var buff = new java.io.BufferedInputStream(new ByteArrayInputStream
  (data))
     try {
      var fos = new java.io.FileOutputStream(new File(/images/ +
  name))
      var in = 0
     do {
        in = buff.read()
        if (in != -1){
          fos.write(in)
        }
      } while((in != -1))
     fos = null
     in = 0
    } catch {
       case e = Log.error(e)
    } finally {
      buff.close()
    }
    buff = null
     true
   }
  case Full(_) = {
  S.error(S.??(invalid.receipt.attachment))
  false
  }
  case _ = true
  }

  #

    Maybe this code is wrong ?

    new File(/images/ + name)

    I want to save it in the main\webapp\images\  folder.
      - main\webapp\images\ 003.jpg

    :)

  Cheers,
   Neil

  On Nov 15, 12:23 am, Timothy Perrett timo...@getintheloop.eu wrote:
  Neil,

  Try something like:

  var buff = new java.io.BufferedInputStream(input)
  try {
    var fos = new java.io.FileOutputStream(new File(/some/root/
  filepath/ + image_hash_filename))
    var in = 0
    do {
      in = buff.read()
      if (in != -1){
        fos.write(in)
      }
    } while((in != -1))
    fos = null
    in = 0} catch {

    case e = Log.error(e)

  } finally {
    buff.close()
  }
  buff = null
  }

  In my case, I had the data as an input stream - manipulate this code
  to take it however you need.

  Cheers, Tim

  On Nov 14, 7:55 am, Neil.Lv anim...@gmail.com wrote:

    Here is some code , but it's wrong!

    --  java.io.FileNotFoundException: \images\1.jpeg

   if mime.startsWith(image/) = {
    try{
      var file: File  = new File(/images/1.jpeg);
      var fos:FileOutputStream = new FileOutputStream(file);
      fos.write(data)
    } catch {
      case e = println(exception:   + e)
    }
    e.receipt(data).receiptMime(mime)
     true
   }

    I don't know how to write the code in the try catch statement.

    Does anyone can help  me ?~

    Thanks very much !

  Cheers,
    Neil

  On Nov 14, 1:58 pm, Neil.Lv anim...@gmail.com wrote:

  Hi all,

     How to save the uploaded image into the folder via fileUpload in
  Lift?

     I don't want to save it in the database, the example code in the
  Pocketchangeapp

  ###
            val receiptOk = fileHolder match {
              case Full(FileParamHolder(_, null, _, _)) = true
              case Full(FileParamHolder(_, mime, _, data))
                        if mime.startsWith(image/) = {
  //  How can i save the data into a image in the folder.
                          e.receipt(data).receiptMime(mime)
                          true
                        }
              case Full(_) = {
                S.error(Invalid receipt attachment)
                false
              }
              case _ = true
            }
  ###

     To save the image into the webapp\images folder, and it's shown
  just use this link:
     /images/img1.jpg

    Thanks for any suggestion!

  Cheers,
    Neil
--~--~-~--~~~---~--~~
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: How to save the uploaded image into the folder via fileUpload in Lift?

2009-11-14 Thread Neil.Lv

Hi all,

  Thanks for your tips, and I have some silly question about this.

  1:)  a directory that's not part of the app's exploded WAR file

  The direcotry tree like this, and Where is i can create a well
defined directory
that's not part of the app's exploded WAR file ? I'm notfamiliar
with this.

###
demo
  --src
--main
  --resources
--i18n
--props
  --scala
  --webapp
--test
  --target
###

  2:) If I store images to the RDBMS, and how can it be shown in the
webpage ?
###
   FileParamHolder(_, mime, name, data)
   
   item.receipt(data).receiptMime(mime)   // ( Array[Byte] that saved
into database )
###

  :)

  Thanks very much !

Cheers,
  Neil

On Nov 15, 5:43 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Sat, Nov 14, 2009 at 10:25 AM, Neil.Lv anim...@gmail.com wrote:

  Tim,

   haha, yeah.

   I use this code to get the images folder(the full path) of the app.

   LiftRules.getResource(/images/).open_!.toString.substring(6)
  (The code is so redundant !)
     - G:\project\demo\src\main\webapp\images\

 You cannot rely on being able to write to a directory in an application.
 This is dependent on how the specific web app container handles things, but
 I would strongly suggest you write images to a directory that's not part of
 the app's exploded WAR file.  And strongly is a very weak description of
 how forceful I'm being about this.  This kind of code may change behaviour
 between your dev box and production, between versions of your app container.

 If you want to store images to serve, either use a well defined directory
 outside your WAR file or put stuff in your RDBMS or put stuff up on Amazon
 (like Twitter does with images).  Amazon has much better infrastructure for
 dealing with serving static content than just about anyone else.



   :)

   Thank you very much !

  Cheers,
    Neil

  On Nov 15, 1:50 am, Timothy Perrett timo...@getintheloop.eu wrote:
   Hmm, I guess you must be new to the JVM - you cant write a file inside a
  WAR file; it does not work like that.

   You'll need to write to a fully qualified path (as per my example).

   Cheers, tim

   On 14 Nov 2009, at 17:34, Neil.Lv wrote:

 It show this error message:

 ERROR - java.io.FileNotFoundException: \images\003.jpg

#  this is the code

val receiptOk = fileHolder match {
case Full(FileParamHolder(_, null, _, _)) = true
case Full(FileParamHolder(_, mime, name, data))
 if mime.startsWith(image/) = {
   var buff = new java.io.BufferedInputStream(new ByteArrayInputStream
(data))
   try {
    var fos = new java.io.FileOutputStream(new File(/images/ +
name))
    var in = 0
   do {
      in = buff.read()
      if (in != -1){
        fos.write(in)
      }
    } while((in != -1))
   fos = null
   in = 0
  } catch {
     case e = Log.error(e)
  } finally {
    buff.close()
  }
  buff = null
   true
 }
case Full(_) = {
S.error(S.??(invalid.receipt.attachment))
false
}
case _ = true
}

#

  Maybe this code is wrong ?

  new File(/images/ + name)

  I want to save it in the main\webapp\images\  folder.
    - main\webapp\images\ 003.jpg

  :)

Cheers,
 Neil

On Nov 15, 12:23 am, Timothy Perrett timo...@getintheloop.eu wrote:
Neil,

Try something like:

var buff = new java.io.BufferedInputStream(input)
try {
  var fos = new java.io.FileOutputStream(new File(/some/root/
filepath/ + image_hash_filename))
  var in = 0
  do {
    in = buff.read()
    if (in != -1){
      fos.write(in)
    }
  } while((in != -1))
  fos = null
  in = 0} catch {

  case e = Log.error(e)

} finally {
  buff.close()
}
buff = null
}

In my case, I had the data as an input stream - manipulate this code
to take it however you need.

Cheers, Tim

On Nov 14, 7:55 am, Neil.Lv anim...@gmail.com wrote:

  Here is some code , but it's wrong!

  --  java.io.FileNotFoundException: \images\1.jpeg

 if mime.startsWith(image/) = {
  try{
    var file: File  = new File(/images/1.jpeg);
    var fos:FileOutputStream = new FileOutputStream(file);
    fos.write(data)
  } catch {
    case e = println(exception:   + e)
  }
  e.receipt(data).receiptMime(mime)
   true
 }

  I don't know how to write the code in the try catch statement.

  Does anyone can help  me ?~

  Thanks very much !

Cheers,
  Neil

On Nov 14, 1:58 pm, Neil.Lv anim...@gmail.com wrote:

Hi all,

   How to save the uploaded image into the folder via fileUpload in
Lift?

   I don't want to save it in the database, the example code in the
Pocketchangeapp

###
          val receiptOk = fileHolder match {
            case Full(FileParamHolder(_, null

[Lift] Re: How to save the uploaded image into the folder via fileUpload in Lift?

2009-11-14 Thread Neil.Lv


  I want to save the images to a directory, because this images will
be used in the flash params.

  This file path will be used in the javascript code .
###
  var imag=new Array();
  imag[3]=/images/01.jpg;
###

Cheers,
  Neil

On Nov 15, 12:05 pm, Neil.Lv anim...@gmail.com wrote:
 Hi all,

   Thanks for your tips, and I have some silly question about this.

   1:)  a directory that's not part of the app's exploded WAR file

   The direcotry tree like this, and Where is i can create a well
 defined directory
 that's not part of the app's exploded WAR file ? I'm not        familiar
 with this.

 ###
 demo
   --src
     --main
       --resources
         --i18n
         --props
       --scala
       --webapp
     --test
   --target
 ###

   2:) If I store images to the RDBMS, and how can it be shown in the
 webpage ?
 ###
    FileParamHolder(_, mime, name, data)
    
    item.receipt(data).receiptMime(mime)   // ( Array[Byte] that saved
 into database )
 ###

   :)

   Thanks very much !

 Cheers,
   Neil

 On Nov 15, 5:43 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:

  On Sat, Nov 14, 2009 at 10:25 AM, Neil.Lv anim...@gmail.com wrote:

   Tim,

    haha, yeah.

    I use this code to get the images folder(the full path) of the app.

    LiftRules.getResource(/images/).open_!.toString.substring(6)
   (The code is so redundant !)
      - G:\project\demo\src\main\webapp\images\

  You cannot rely on being able to write to a directory in an application.
  This is dependent on how the specific web app container handles things, but
  I would strongly suggest you write images to a directory that's not part of
  the app's exploded WAR file.  And strongly is a very weak description of
  how forceful I'm being about this.  This kind of code may change behaviour
  between your dev box and production, between versions of your app container.

  If you want to store images to serve, either use a well defined directory
  outside your WAR file or put stuff in your RDBMS or put stuff up on Amazon
  (like Twitter does with images).  Amazon has much better infrastructure for
  dealing with serving static content than just about anyone else.

    :)

    Thank you very much !

   Cheers,
     Neil

   On Nov 15, 1:50 am, Timothy Perrett timo...@getintheloop.eu wrote:
Hmm, I guess you must be new to the JVM - you cant write a file inside a
   WAR file; it does not work like that.

You'll need to write to a fully qualified path (as per my example).

Cheers, tim

On 14 Nov 2009, at 17:34, Neil.Lv wrote:

  It show this error message:

  ERROR - java.io.FileNotFoundException: \images\003.jpg

 #  this is the code

 val receiptOk = fileHolder match {
 case Full(FileParamHolder(_, null, _, _)) = true
 case Full(FileParamHolder(_, mime, name, data))
  if mime.startsWith(image/) = {
    var buff = new java.io.BufferedInputStream(new ByteArrayInputStream
 (data))
    try {
     var fos = new java.io.FileOutputStream(new File(/images/ +
 name))
     var in = 0
    do {
       in = buff.read()
       if (in != -1){
         fos.write(in)
       }
     } while((in != -1))
    fos = null
    in = 0
   } catch {
      case e = Log.error(e)
   } finally {
     buff.close()
   }
   buff = null
    true
  }
 case Full(_) = {
 S.error(S.??(invalid.receipt.attachment))
 false
 }
 case _ = true
 }

 #

   Maybe this code is wrong ?

   new File(/images/ + name)

   I want to save it in the main\webapp\images\  folder.
     - main\webapp\images\ 003.jpg

   :)

 Cheers,
  Neil

 On Nov 15, 12:23 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Neil,

 Try something like:

 var buff = new java.io.BufferedInputStream(input)
 try {
   var fos = new java.io.FileOutputStream(new File(/some/root/
 filepath/ + image_hash_filename))
   var in = 0
   do {
     in = buff.read()
     if (in != -1){
       fos.write(in)
     }
   } while((in != -1))
   fos = null
   in = 0} catch {

   case e = Log.error(e)

 } finally {
   buff.close()
 }
 buff = null
 }

 In my case, I had the data as an input stream - manipulate this code
 to take it however you need.

 Cheers, Tim

 On Nov 14, 7:55 am, Neil.Lv anim...@gmail.com wrote:

   Here is some code , but it's wrong!

   --  java.io.FileNotFoundException: \images\1.jpeg

  if mime.startsWith(image/) = {
   try{
     var file: File  = new File(/images/1.jpeg);
     var fos:FileOutputStream = new FileOutputStream(file);
     fos.write(data)
   } catch {
     case e = println(exception:   + e)
   }
   e.receipt(data).receiptMime(mime)
    true
  }

   I don't know how to write the code in the try catch statement.

   Does anyone can

[Lift] Is there a paginate plug in the lift ?

2009-11-13 Thread Neil.Lv

Hi all,

  Is there a paginate plug in the lift ?

  Just like the WillPaginate in the Rails.

  Thanks for any suggestion !

Cheers, Neil

--~--~-~--~~~---~--~~
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: How to specify the SELECT statement in the Mapper ?

2009-11-13 Thread Neil.Lv

  Is there a some simple code ~?

  Thanks very much!

Cheers,
  Neil

On Nov 13, 10:50 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 MetaMapper.findAllFields may work for what you're doing, but with the
 DAYOFWEEK conversion you may just have to go directly against the DB.

 Derek

 On Sun, Nov 8, 2009 at 11:44 PM, Neil.Lv anim...@gmail.com wrote:

  Hi all,

   There is some example code:
  ###
  SELECT id,  name, sex, created_at,  DAYOFWEEK(created_at,) as week,
  (CURRENT_DATE) as t
  FROM users
  WHERE created_at  (CURRENT_DATE ) AND created_at  (CURRENT_DATE +
  interval 2 day)
  ORDER BY created_at ASC
  ###

   How can i specify the SELECT statement that i don't want all the
  columns and i want add the column as week
  in the example code ?

   Any help would be much appreciated!

  Cheers,
   Neil
--~--~-~--~~~---~--~~
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: How to specify the SELECT statement in the Mapper ?

2009-11-13 Thread Neil.Lv

  Ok, Thanks for all your suggestion!

  I'll try it again,

  :)

Cheers,
  Neil

On Nov 14, 2:52 am, harryh har...@gmail.com wrote:
 You'll be better off if you don't do it that way.  Compute the day of
 week from created_at in your scala code (personally I prefer joda time
 for this sort of thing), instead of having the database do it for you.

 Use the database to store and retrieve data, not to perform
 calculations.

 -harryh

 On Nov 9, 1:44 am, Neil.Lv anim...@gmail.com wrote:

  Hi all,

    There is some example code:
  ###
  SELECT id,  name, sex, created_at,  DAYOFWEEK(created_at,) as week,
  (CURRENT_DATE) as t
  FROM users
  WHERE created_at  (CURRENT_DATE ) AND created_at  (CURRENT_DATE +
  interval 2 day)
  ORDER BY created_at ASC
  ###

    How can i specify the SELECT statement that i don't want all the
  columns and i want add the column as week
  in the example code ?

    Any help would be much appreciated!

  Cheers,
    Neil
--~--~-~--~~~---~--~~
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 save the uploaded image into the folder via fileUpload in Lift?

2009-11-13 Thread Neil.Lv

Hi all,

   How to save the uploaded image into the folder via fileUpload in
Lift?

   I don't want to save it in the database, the example code in the
Pocketchangeapp

###
  val receiptOk = fileHolder match {
case Full(FileParamHolder(_, null, _, _)) = true
case Full(FileParamHolder(_, mime, _, data))
  if mime.startsWith(image/) = {
//  How can i save the data into a image in the folder.
e.receipt(data).receiptMime(mime)
true
  }
case Full(_) = {
  S.error(Invalid receipt attachment)
  false
}
case _ = true
  }
###

   To save the image into the webapp\images folder, and it's shown
just use this link:
   /images/img1.jpg

  Thanks for any suggestion!

Cheers,
  Neil
--~--~-~--~~~---~--~~
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 Embed the flash dynamic in Snippet in the Lift ?

2009-11-12 Thread Neil.Lv

Hi all,

  How to Embed the flash dynamic in Snippet in the Lift?

  I use the swfobject to embed my flash and want to specify the
flashVar dynamic, but this is doesn't work!

  Here is the code in the Snippet:

  The flashSrc  can shown correctly in the index page, but the
falshvar doesn't work!

###
  var flashSrc = /flash/test.swf
  var flashVar = {name1=helloname2=worldname3=foobar}
  def initFlash(in: NodeSeq) : NodeSeq = {
bind(init, in,
flash - Text(swfobject.embedSWF(' + {flashSrc} + ',
'myContent', '300', '120', '9.0.0', 'expressInstall.swf', ' +
{flashVar} + ');)
)
  }
###

  Any help would be much appreciated!

Cheers,
  Neil
--~--~-~--~~~---~--~~
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: How to Embed the flash dynamic in Snippet in the Lift ?

2009-11-12 Thread Neil.Lv

Tim,

  Here is the html code when i use the code in my Snippet, but it
doesn't work.

### Code in the Snippet ###
  var flashSrc = /flash/test.swf
  var flashVar = {name1=helloname2=worldname3=foobar}
  val script = swfobject.embedSWF(' + flashSrc + ', 'myContent',
'300', '120', '9.0.0', 'expressInstall.swf', ' + flashVar + ');

  def whatever(xhtml: NodeSeq): NodeSeq = bind(flash, xhtml,
flashVar - Text(/flash/focus.swf),
object - Script(Run(script))
  )
### Code in the Snippet ###

### Code in the index.html ###
head
  script type=text/javascript src=/scripts/swfobject.js/script
  lift:HelloWorld.whatever
flash:object /
  /lift:HelloWorld.whatever
/head
div id=myContent
  h1Alternative content/h1
  pa href=http://www.adobe.com/go/getflashplayer;img src=http://
www.adobe.com/images/shared/download_buttons/get_flash_player.gif
alt=Get Adobe Flash player //a/p
/div
### Code in the index.html ###

  This is the source html code when i use this code.

head
script type=text/javascript
//
swfobject.embedSWF(' + flashSrc + ', 'myContent', '300', '120',
'9.0.0', 'expressInstall.swf', ' + flashVar + ');
//
/script
/head
body
object height=120 width=300 type=application/x-shockwave-flash
data=' + flashSrc + ' id=myContent style=visibility: visible;/
/body

  Why the  flashSrc is a string in the Script ? Maybe it should be /
flash/test.swf ?

  Thanks very much!

Cheers,
  Neil



On Nov 12, 5:39 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Neil,

 Try this:

   import net.liftweb.http.js._
   import net.liftweb.http.js.JE._
   import net.liftweb.http.js.JsCmds._

   val script = swfobject.embedSWF(' + flashSrc + ','myContent', '300', 
 '120', '9.0.0', 'expressInstall.swf', ' + flashVar + ');

   def whatever(xhtml: NodeSeq): NodeSeq = bind(flash, xhtml,
     object - Script(Run(script))
   )

 That should give you enough to work out what it is you need to do.

 Cheers, Tim

 On 12 Nov 2009, at 09:04, Neil.Lv wrote:



  Hi all,

   How to Embed the flash dynamic in Snippet in the Lift?

   I use the swfobject to embed my flash and want to specify the
  flashVar dynamic, but this is doesn't work!

   Here is the code in the Snippet:

   The flashSrc  can shown correctly in the index page, but the
  falshvar doesn't work!

  ###
   var flashSrc = /flash/test.swf
   var flashVar = {name1=helloname2=worldname3=foobar}
   def initFlash(in: NodeSeq) : NodeSeq = {
     bind(init, in,
     flash - Text(swfobject.embedSWF(' + {flashSrc} + ',
  'myContent', '300', '120', '9.0.0', 'expressInstall.swf', ' +
  {flashVar} + ');)
     )
   }
  ###

   Any help would be much appreciated!

  Cheers,
   Neil
--~--~-~--~~~---~--~~
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: How to Embed the flash dynamic in Snippet in the Lift ?

2009-11-12 Thread Neil.Lv

Tim,

   It can be shown correctly now!

   It's so cool and easy to use.

   Thank you very much !

Cheers,
  Neil

On Nov 12, 9:08 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Its a string because you havent properly escapped it... note that the code i 
 sent used the CONTENT markers, thus you need to escape them properly.

 Cheers, Tim

 On 12 Nov 2009, at 12:02, Neil.Lv wrote:

   Why the  flashSrc is a string in the Script ? Maybe it should be /
  flash/test.swf ?
--~--~-~--~~~---~--~~
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 the localization with lift:loc !

2009-11-10 Thread Neil.Lv

yk,

  But if only one person change the language ( to ms_MY).

  Then the other users of the website will also see the page as ms_MY
language not the default language en_US.

  I test in my computer it will affect the other browsers.

  So...

Cheers,
  Neil

On Nov 10, 3:16 pm, YING-KWANG TU ying.kwang...@gmail.com wrote:
 Neil,

 In my Boot.scala:

 def localeCalculator(request : Box[HTTPRequest]): Locale =
   request.flatMap(
 _.param(locale) match {
   case Nil = Full(Locale.getDefault())
   case myLocale :: _ = {
 def iLocale = new Locale(myLocale.substring(0, 2),
 myLocale.substring(3, 5))
 Locale.setDefault(iLocale) *// this is where I set the default
 locale to the new one*
 Full(iLocale)
   }
 }
   ).openOr(Locale.getDefault())
 LiftRules.localeCalculator = localeCalculator _

 On Tue, Nov 10, 2009 at 3:10 PM, Neil.Lv anim...@gmail.com wrote:

  yk,

   About the setLocale method in the demo (  http://219.94.110.243 )

   1:) First, I open the Firefox and type this link, i see the menu
  label is English.

   2:) Second, I open the IE or other browser to view this page, and
  click the  ms_MY link to change the language,
it works fine.

   3:) Then I refresh the index page in the Firefox (First step), the
  menu label is not English now, it's ms_MY.

   4:) Is there the set locale is global for whole website or only in
  my computer ?

  Cheers,
   Neil

  
   
   def iLocale = new Locale(myLocale)
Locale.setDefault(iLocale)
Full(iLocale)
   ...
  

  On Nov 10, 1:58 pm, Neil.Lv anim...@gmail.com wrote:
  Maybe it's a bug with lift:loc locid=/  

  It's so confused.

   Cheers,
 Neil

   On Nov 10, 12:11 pm, YING-KWANG TU ying.kwang...@gmail.com wrote:

By adding a println line in my localeCalculator churned the following
output:

en_US
en_us
en_us
en_us
en_us
INFO - Service request (GET) / took 53 Milliseconds
en_us
ms_my
ms_my
ms_my
ms_my
INFO - Service request (GET) / took 37 Milliseconds
ms_my
th_th
th_th
th_th
th_th
INFO - Service request (GET) / took 37 Milliseconds

It almost seems like it is java.util.Locale... Mysteriously, adding
  symlinks
helps. For e.g.

lift-core_en_us.properties - lift-core_en_US.properties

On Tue, Nov 10, 2009 at 9:58 AM, YING-KWANG TU 
  ying.kwang...@gmail.comwrote:

 Tim,

 You can browse tohttp://219.94.110.243forthetest site running on
 Ubuntu Server 9.10.
 There is a down-loadable test project which you can test out.

 Before this discussion thread on UTF-8 or ISO8859-1,

1. localization is running great on
  windows+maven2.2.1+liftweb1.1-M7
2. lift:loc locid=/ yet to work for both platform
3. on linux, even S.??() not working at all.

 Cheers,
   yk

 On Sat, Nov 7, 2009 at 8:29 PM, Timothy Perrett
  timo...@getintheloop.euwrote:

 You should always be working with UTF-8 files for properties /
 localisation - I think the encoding reported by jetty is something
 different (that it reads from the system)... ensure your props files
 are UTF-8 and go from there.

 Cheers, Tim

 On Nov 7, 12:48 am, yk ying.kwang...@gmail.com wrote:
  Hi Tim,

  I've developed n tested localization on windows and it worked
  perfectly. however, localization of the same project placed on
  ubuntu
  server 9.10 did not.

  WinXP
  ---
  jdk1.6
  maven 2.2.1
  lifeweb 1.1-M7
  encoding=cp1252 (as reported by mvn jetty:run)

  Ubuntu 9.10 server
  ---
  openjdk OR sun-jdk6
  maven 2.2.1
  liftweb 1.1-M7
  encoding=UTF-8 (as reported by mvn jetty:run)

  I can't quite point my finger on why it worked on windows but not
  on
  linux. Do i have to convert all files that need to be deployed to
  UTF-8 encoding?

  Thank you in advance.

  Cheers,
yk

  On Oct 26, 9:12 pm, Timothy Perrett timo...@getintheloop.eu
  wrote:

   The browser already knows the locale, you have it backward! Your
   localeCalculator is so that the browser can get lift to return
  the
   right content.

   Take a look at:

 http://scala-tools.org/mvnsites/liftweb-1.1-M6/lift-webkit/scaladocs/.
 ..

   I would start with just getting lift to explicitly set locale
  based on

   a query string or something... it will help you understand how
  the
   mechanism works.

   Cheers, Tim

   On 26 Oct 2009, at 12:34, Neil.Lv wrote:

 ...

 Where is the locale to be set that the browser can know the
locale ?

 Thanks very much!

Cheers,
 Neil

On Oct 26, 7:50 pm, Timothy Perrett timo...@getintheloop.eu
 wrote:
setLocale was a method created by me, specific to my
  application

[Lift] Re: About the localization with lift:loc !

2009-11-10 Thread Neil.Lv

  Thanks Tim, we're looking forward to your detail reply!

  :)

Cheers,
  Neil

On Nov 10, 4:40 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Don't call Locale.setDefault - that is a global configuration for the
 JVM

 I would urge you to re-read my article -in it you'll see how I take a
 note of the requested locale, and then hold that in a cookie for later
 reference or use on a future visit. Study the locale calculator
 carefully - there has been a breaking API change since it was written,
 but with a slight modification it will work fine.

 Moreover, ISO country codes are in the format en_US, not en_us... Lift
 is leveraging some base java localization and you have to stick to the
 rules :-)

 I'll try to reply in more detail later.

 Cheers, Tim

 Sent from my iPhone

 On 10 Nov 2009, at 08:19, Neil.Lv anim...@gmail.com wrote:



   Maybe the Locale.setDefault(iLocale) method's scope is the whole
  website not for the single user ?

  Cheers,
   Neil

  On Nov 10, 4:16 pm, Neil.Lv anim...@gmail.com wrote:
  yk,

   But if only one person change the language ( to ms_MY).

   Then the other users of the website will also see the page as ms_MY
  language not the default language en_US.

   I test in my computer it will affect the other browsers.

   So...

  Cheers,
   Neil

  On Nov 10, 3:16 pm, YING-KWANG TU ying.kwang...@gmail.com wrote:

  Neil,

  In my Boot.scala:

 def localeCalculator(request : Box[HTTPRequest]): Locale =
   request.flatMap(
 _.param(locale) match {
   case Nil = Full(Locale.getDefault())
   case myLocale :: _ = {
 def iLocale = new Locale(myLocale.substring(0, 2),
  myLocale.substring(3, 5))
 Locale.setDefault(iLocale) *// this is where I set the
  default
  locale to the new one*
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



  1   2   >