I don't know if it increases compile time but I avoid wildcard imports  
like the plague because I think they're perhaps the most confusing  
thing reading scala code. Thinking to yourself that two types don't  
match, but you can't be sure if you're reading it wrong or if there's  
an implicit in scope, with explicit imports at least you can look at  
the import list to see if there are any applicable implicits in scope,  
whereas with wildcard imports you're left searching through a perhaps  
large list of perhaps large modules looking for implicits. And then  
there's the somewhat simpler pain of "where the heck is this name  
imported from" even where it's explicit.

-Ross

On Oct 12, 2009, at 4:27 PM, Naftoli Gugenheim wrote:

>
> Thanks. I actually looked at the source code of HTTPCookie but I
> didn't put two and two together reading my code in Boot.
> I think the reason I did the math manually is because I was trying to
> minimize the number of imports. Do you think a lot of wildcard imports
> increase compile time, or not significantly (for clean build of what's
> currently 17 files / 70+ kb)?
>
>
> On Mon, Oct 12, 2009 at 4:11 PM, Ross Mellgren <[email protected]>  
> wrote:
>>
>> setMaxAge is unfortunately named -- looking at the code it appears
>> that HTTPCookies are actually immutable, and what setMaxAge does is
>> returns you a new cookie with the new settings.
>>
>> Try:
>> val cookie = net.liftweb.http.provider.HTTPCookie(cookieName, 
>> user.uniqueId.is
>> ).setMaxAge(2 weeks)
>> S.addCookie(cookie)
>>
>> (I took the liberty of rewriting your manual date arithmetic to
>> TimeSpan syntax)
>>
>> -Ross
>>
>> On Oct 12, 2009, at 4:06 PM, Naftoli Gugenheim wrote:
>>
>>>
>>> Firecookie (a Firebug extension) says the cookie's Expires is  
>>> Session.
>>> When I log in Firebug's Net panel shows the following response  
>>> header
>>> (I changed the cookie name):
>>> Set-Cookie mycookiename=Z0GZIXFRBQMVTOITYSICI1XZN23ROYLN
>>>
>>> My code in Boot looks like this:
>>>     User.autologinFunc = Full(()=>{
>>>       for(uid <- S.findCookie(cookieName);
>>>           userId <- uid.value;
>>>           user <- User.find(net.liftweb.mapper.By(User.uniqueId,
>>> userId))
>>>       ) {
>>>           User.logUserIn(user)
>>>           S.redirectTo(User.homePage)
>>>         }
>>>       }
>>>     )
>>>     User.onLogIn ::= {
>>>       case user =>
>>>         val cookie = net.liftweb.http.provider.HTTPCookie 
>>> (cookieName,
>>> user.uniqueId.is)
>>>         cookie.setMaxAge(2 * 7 * 24 * 60 * 60) // 2 weeks in seconds
>>>         S.addCookie(cookie)
>>>     }
>>>     User.onLogOut ::= {
>>>       case _ =>
>>>         S.deleteCookie(cookieName)
>>>     }
>>> What am I doing wrong? Why is the max-age not getting set?
>>>
>>>
>>> On Mon, Oct 12, 2009 at 3:37 PM, Ross Mellgren <[email protected]>
>>> wrote:
>>>>
>>>> I usually use FireBug or Safari Web Inspector to look at the Set-
>>>> Cookie / Cookie headers going back and forth, or use the browser's
>>>> built in cookie index (usually buried in preferences). You could  
>>>> also
>>>> use something like Wireshark or tcpdump to watch the headers go  
>>>> by if
>>>> you're using a browser that doesn't have debugging extensions.
>>>>
>>>> -Ross
>>>>
>>>> On Oct 12, 2009, at 3:15 PM, Naftoli Gugenheim wrote:
>>>>
>>>>> I'm writing an app in Lift that uses cookies to remember the  
>>>>> user as
>>>>> logged in. When I run it from my local computer, and when I run it
>>>>> from the server and view it from my local computer, it works fine.
>>>>> But from my client's computer it doesn't work (it seems to expire
>>>>> with the session). How can I debug this?
>>>>> Thanks.
>>>>>
>>>>>
>>>>>>
>>>>
>>>>
>>>>>
>>>
>>>>
>>
>>
>>>
>>
>
> >


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

Reply via email to