etorreborre | 1 Mar 01:42 2010
Picon

[Lift] Less boilerplate in your specifications / tests

Hi all Lift-developers,

I have noticed a few commits recently where the declarations for
specifications could be reduced to something simpler.

For example:

import org.specs._
import org.specs.runner._

class BindingsSpecTest extends Runner(BindingsSpec) with JUnit with
Console
object BindingsSpec extends Specification

can be written as

import org.specs._

class BindingsSpec extends SpecificationWithJUnit

 - the BindingsSpec class will run with maven, provided that you add
the proper include directive in the pom.xml file, like this, for
example:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.4.3</version>
        <configuration>
          <useSystemClassLoader>false</useSystemClassLoader>
(Continue reading)

Neil.Lv | 1 Mar 05:28 2010
Picon

[Lift] About the url rewrite (more thant one params and get 404 not found error)

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)
  )
###
(Continue reading)

aw | 1 Mar 08:17 2010

[Lift] ByList using OR instead of IN?

From reading Exploring Lift (Section 6.1, page 81), it says that
ByList corresponds to the “field IN (x,y,z)” syntax in SQL.
Well, that was what I needed, so I took it for a test drive.  However,
instead of seeing SQL like:  where some.id in (4, 9, 20)
I am seeing SQL like:  where some.id = 4 or some.id = 9 or some.id =
20.

I double checked the latest code:
  http://github.com/dpp/liftweb/blob/master/framework/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/MetaMapper.scala
and it looks like there isn't a magical workaround to get IN working
as I expected.

To me, this is a violation of SQL Tuning 101:  as a rule of thumb,
prefer the IN clause over an OR clause.

Is there a good reason why this code creates OR clauses instead of an
IN clause?

--

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

Jeppe Nejsum Madsen | 1 Mar 08:53 2010
Picon

Re: [Lift] About the url rewrite (more thant one params and get 404 not found error)

"Neil.Lv" <anim510@...> writes:

> 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)
(Continue reading)

Neil.Lv | 1 Mar 09:33 2010
Picon

[Lift] Re: About the url rewrite (more thant one params and get 404 not found error)


On Mar 1, 3:53 pm, Jeppe Nejsum Madsen <je...@...> 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()
(Continue reading)

Jeppe Nejsum Madsen | 1 Mar 10:10 2010
Picon

Re: [Lift] Re: About the url rewrite (more thant one params and get 404 not found error)

"Neil.Lv" <anim510@...> writes:

> On Mar 1, 3:53 pm, Jeppe Nejsum Madsen <je...@...> 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() .
>    -->
(Continue reading)

Neil.Lv | 1 Mar 10:21 2010
Picon

[Lift] Re: About the url rewrite (more thant one params and get 404 not found error)


On Mar 1, 5:10 pm, Jeppe Nejsum Madsen <je...@...> 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 liftweb@...
To unsubscribe from this group, send email to liftweb+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

Jeppe Nejsum Madsen | 1 Mar 10:30 2010
Picon

Re: [Lift] New logging code is in master

On Mon, Mar 1, 2010 at 12:20 AM, David Pollak
<feeder.of.the.bears@...> wrote:
> Excellent!
>
> We have the deprecations turned off in the pom.xml file by default... but
> gotta turn the deprecation warnings on post M3.

Not sure what this means? Do the generated jars on scala-tools not
contain deprecation info or does the compilation of Lift itself not
show deprecation warnings?

If the former, this would explain what I see. If the latter, I added

          <args>
            <arg>
          -deprecation
            </arg>
          </args>

to my own pom and would expect this to show the warnings....

/Jeppe

--

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

(Continue reading)

Jeppe Nejsum Madsen | 1 Mar 11:46 2010
Picon

[Lift] snakify and abbreviations

Hi,

Eager to use the new Mapper support for snake_case I discovered that
the snakify method doesn' handle abbreviations well:

StringHelpers.snakify("HTML")
res5: java.lang.String = h_t_m_l

StringHelpers.snakify("HTMLEditor")
res6: java.lang.String = h_t_m_l_editor

I would expect those to be html and html_editor respectively...

What do people think?

/Jeppe

--

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

Marius | 1 Mar 12:18 2010
Picon

[Lift] Re: Javascript Dependencies

Yes I believe this needs a bit more thinking. I didn;t spend too much
time into this but perhaps add a LiftRules function to describe the
dependency tree per page:

i.e.

var jsDependencies : (Req) => JsDependencyTree

where

case class JsDependencyTree (url: String, dependencies:
JsDependencyTree *) // not sure if we'd need more info

The head merge (and potentially tail merge as well) mechanism in Lift
would obtain the JsDependencyTree from LiftRules passing the Req
(hence you can have a different dependency tree per page, or per
application depending how you do pattern matching). Thus head merge
would arrange the scripts according to the dependency tree. If a
script is not in the dependency tree, it will just be appended to the
scripts "list". Adjacent features that I see:

1. Detect if a dependency is missing
2. Construct a suite of dependency trees for most used JQuery plugins
that people can easily re-use.

Br's,
Marius

On Mar 1, 1:54 am, Peter Robinett <pe...@...> wrote:
> Issue 281 is not going to make it into M3. The specific issue that
(Continue reading)


Gmane