World: r3wp
[Rebol School] Rebol School
older newer | first last |
Ashley 6-Aug-2009 [2838] | Here's a QAD I use: >> i: 1 == 1 >> join skip "0000" length? form i i == "0001" |
Graham 6-Aug-2009 [2839x4] | next form 10000 + now/month == "0008" |
and for that mailing list question ... on how to format yyyymmdd rejoin [ now/year next form 100 + now/month next form 100 + now/day ] == "20090806" | |
now/year * 100 + now/month * 100 + now/day == 20090806 guess have to benchmark to see which is fastest | |
last version is 5x faster | |
Anton 6-Aug-2009 [2843] | Nice one. |
WuJian 7-Aug-2009 [2844] | NIce |
Gregg 7-Aug-2009 [2845] | Doesn't measure that much faster here, and you have to add the FORM call as well. Still nice. :-) If performance is important, you can do two things: 1) cache NOW, 2) cache the whole result once a day. |
Graham 7-Aug-2009 [2846x3] | I ran 10,000 iterations with 'form and found it was 5x faster :) |
It's something I learned from Forth .. math is always faster than logic. | |
BTW, you can use the same trick for those pesky apis that want leading zeros for time >> time: now/time - 5:00 == 6:29:02 >> next form 100:00 + time == "06:29:02" | |
Maxim 7-Aug-2009 [2849] | wow a bug with experience :-) |
CharlesW 20-Oct-2009 [2850] | I am trying to retrieve email from a godaddy account. Their server however uses a username with the @ sign. I am not sure but I think this is messing up the pop protocol. The error I receive is: connecting to: companyname.com ** Access Error: Cannot connect to companyname.com ** Where: open-proto Notice that my pop statment has two @ signs in it but is needed to login to goDaddy's multi-tenent pop server. foreach message read pop://[user-:-companyname-:-com]:[password-:-pop-:-secureserver-:-net] [ print message ] Any Suggestions? |
Henrik 20-Oct-2009 [2851x2] | I think there is a fix for that, but I can't remember what it is. |
found it | |
Pekr 20-Oct-2009 [2853x2] | you can use block specification, instead of URL scheme ... or fix url-chars ... |
net-utils/url-parser/user-char: union net-utils/url-parser/user-char make bitset! #"@" | |
Henrik 20-Oct-2009 [2855x2] | This is for the backslash: net-utils/url-parser/user-char: union net-utils/url-parser/user-char make bitset! #"\" |
use Pekr's code | |
Pekr 20-Oct-2009 [2857x2] | :-) now I was first :-) |
I have it in my user.r, so I almost forgot about it ... | |
Henrik 20-Oct-2009 [2859] | you were first, because it took 3 minutes to swap into textmate. :-) have too many things running here. |
CharlesW 20-Oct-2009 [2860] | Thank guys. |
Graham 1-Jan-2010 [2861x4] | The Rebol School site is now working again after 4 years of malfunctions. |
Andreas helped me today to debug the vanilla issue that was causing a server error for most pages ... | |
http://www.compkarori.com/vanilla/ | |
Basically the data about the user Graham was set to a zero byte file when my site was hacked .. and vanilla looks at the user file when it displays a snip authored by that user. It was unable to load this data causing an error, and since I authored many of the snips, it caused most of the site to go down. | |
PatrickP61 7-Mar-2010 [2865x5] | Question: I'd like to define a function that essentially prints out a stored message like this: |
debug?: on | |
debug: func [a] [print a] | |
but I want it to print only when debug? is on. Since debug? is outside of the function, how can I define it so that it checks this value before printing a | |
debug: funct [a] [if debug? print a] | |
Steeve 7-Mar-2010 [2870x2] | Kidding ? |
debug: funct [a] [if debug? [print a]] | |
PatrickP61 7-Mar-2010 [2872] | Hi Steeve, it doesnt work. If debug? is on or off, it still prints a |
Steeve 7-Mar-2010 [2873] | hmm... |
PatrickP61 7-Mar-2010 [2874x2] | oops I made a mistake |
Sorry steve, You were right, I did a typo on my test. Thank you | |
BrianH 7-Mar-2010 [2876] | And you don't need funct here because there are no locals (though it's a cool function) :) |
PatrickP61 7-Mar-2010 [2877] | So the main difference between FUNC and FUNCT is that variables outside of the function can be referenced ... right? |
Steeve 7-Mar-2010 [2878x2] | not exactly |
funct "Defines a function with all set-words as locals" | |
Henrik 7-Mar-2010 [2880] | so you don't have to write func [/local blahblah]... |
PatrickP61 7-Mar-2010 [2881] | to clarify, locals is all variables that is local to the main script, outside of the function. Is that a good way to describe it? |
Steeve 7-Mar-2010 [2882x2] | no :) |
actually it's the revese, those ones are called 'global | |
BrianH 7-Mar-2010 [2884] | All variables that are local to the function itself. |
PatrickP61 7-Mar-2010 [2885] | I see -- got my terminology mixed up |
BrianH 7-Mar-2010 [2886] | Look at the source of FUNCT, it's a good lesson on function creation tricks. And compare the R2 and R3 versions. |
PatrickP61 7-Mar-2010 [2887] | will do -- thank you very much |
older newer | first last |