World: r3wp
[Core] Discuss core issues
older newer | first last |
Terry 24-Jan-2010 [15617] | I can try with SOAP api provided, but i get the feeling it's going to be just as much of a time sink. |
Maxim 24-Jan-2010 [15618x3] | for example, I did an interface for the meetup.com site in an hour, but their API docs are VERY well done and its really simple. |
is this a pubic site? | |
(but you need a paying account for it to be any usefull, cause its bound to the account number) | |
Terry 24-Jan-2010 [15621] | not public |
Maxim 24-Jan-2010 [15622] | do you have a client that works inside a browser? |
Terry 24-Jan-2010 [15623] | I'll stick with GET for now.. thanks for your help (no) |
Maxim 24-Jan-2010 [15624] | you can try something devious, using rebol. :-) |
Terry 24-Jan-2010 [15625x3] | (send you a pm) |
(send you a pm) | |
hmm | |
Maxim 24-Jan-2010 [15628] | -you open a tcp listen port -edit the hosts file so your remote server points to 127.0.0.1 -and then just print out the data which the client would have sent to the server. this works for just about every networked application I have tried and is a very powerfull way to learn how to build custom clients in rebol |
Terry 24-Jan-2010 [15629] | could use wireshark i suppose |
Maxim 24-Jan-2010 [15630] | yep good point |
Henrik 24-Jan-2010 [15631] | Cyphre made this new FORM-DECIMAL function. I've been allowed to share it, so it can be tested: form-decimal: func [ num cifre /local m n o p result ][ p: "" result: either find num: form num #"e" [ parse num [ any [copy m to "." skip] copy n to "E" skip o: ( all [ not m m: n n: "" ] if m/1 = #"-" [ m: copy next m p: "-" ] z: (length? m) + to-integer o result: to-string reduce either negative? z [ ["0." (head insert/dup copy "" "0" abs z) m n] ][ o: join m n ["" o (head insert/dup copy "" "0" (z - length? o))] ] ) ] result ][ num ] result: parse result "." o: result/1 o: skip tail result/1 -3 while [not head? o][insert o #"." o: skip o -3] all [ not result/2 insert tail result "" ] result/2: copy/part result/2 cifre insert/dup tail result/2 "0" cifre - length? result/2 all [cifre > 0 insert next result ","] all [result/1/1 = #"0" p: ""] join p result ] |
Graham 24-Jan-2010 [15632x2] | Have you seen Gabriele's version? |
The fact it uses the name "cifre" suggest it is related to Gab's vesion! | |
Steeve 24-Jan-2010 [15634] | What's that ? (seems messy at first glance) With which params is that supposed to work ? |
Graham 24-Jan-2010 [15635x2] | decimal! and integer! where the latter specifies the number of decimal places |
The task is to convert from scientific notation to numbers only | |
Steeve 24-Jan-2010 [15637x2] | I just have the feeling that it should be done with only few lines |
*could be | |
Henrik 24-Jan-2010 [15639x2] | Graham, this is a replacement for Gabriele's version. This one is more complete. |
The primary issue is overcoming REBOL's varying usage of scientific notation. That's one reason it's so big (but still smaller than Gabriele's). | |
Maxim 24-Jan-2010 [15641] | I've done my own, and its similar, in size and functionality... not much to do... the scientific notation is a pain to manage. |
Graham 24-Jan-2010 [15642x2] | I suggest we fix core so that it triggers scientific notation at 7 decimal places as it does in R3 instead of at 2 decimal places as it does no. |
w. | |
Steeve 24-Jan-2010 [15644] | well, using a "mask" approach, allows more capabilities then just providing the number of decimals. Like I've done here for R3: http://www.rebol.net/cgi-bin/r3blog.r?view=0302#comments (see fnum) It's true, it doesn't handle scientific notation as entry currently, but hey !, it should not take more than 2 or 3 more lines. |
Graham 24-Jan-2010 [15645] | I'd rather we didn't have the problem in the first place! |
Henrik 24-Jan-2010 [15646] | Yes, agree. I'm helping building a rather large app, where this is important and when things like this aren't trivial to solve... But what ever happens, I think we need a function like this in R3 and R2-Forward. |
Gregg 24-Jan-2010 [15647] | It should be part of a general FORMAT func IMO. |
BrianH 24-Jan-2010 [15648] | The disadvantage to that is that it makes the FORMAT function more complex, and thus slow. |
Gregg 24-Jan-2010 [15649] | It's just chocies. Format, as it stands, isn't something I'll use. And if someone shows me a case where the overhead has a noticable and visible impact on their code, I will refactor a custom version for them. :-) I'm open to discussion, scenarios, and the backs of envelopes. Where is FORMAT likely to be used, how often will it be called, and how slow is too slow? |
BrianH 24-Jan-2010 [15650] | Numeric formatting should be fast enough to get called in a tight loop for grid output. Thousands of times, really quickly. |
Graham 24-Jan-2010 [15651x2] | well, if you format you change the type |
in rebgui at least | |
BrianH 24-Jan-2010 [15653] | Sounds like RebGUI needs grid formatting. |
Gregg 24-Jan-2010 [15654] | Brian, great example. It also highlights that we may want it to accept sets of values as well as single values. |
BrianH 24-Jan-2010 [15655] | Single value formatting is exactly the kind of thing that could use the /into option, for buffer reuse. |
Gregg 24-Jan-2010 [15656] | I have a large, non-optimzed FORMAT function, but couldn't remember profiling it. I just did a few quick tests. >> time-it/count [format d "yyyy-mmm-dd"] 1000 == 0:00:00.094 >> time-it/count [format d 'rel-time] 1000 == 0:00:00.078 >> time-it/count [format 1000.01 'general] 1000 == 0:00:00.047 >> time-it/count [format 1000.01 'reb-general] 1000 == 0:00:00.031 >> time-it/count [format "Gregg" [10 right]] 1000 == 0:00:00.031 >> time-it/count [format "Gregg" [10 right #"."]] 1000 == 0:00:00.016 >> time-it/count [format true 'on-off] 1000 == 0:00 Are those results too slow? |
BrianH 24-Jan-2010 [15657] | I have no idea. It's easier to judge by DP than DT (the equivalent of time-it). |
Gregg 24-Jan-2010 [15658] | How so? I haven't used DP. |
BrianH 25-Jan-2010 [15659] | It will tell you evaluations and series created, which is a bit more cross-platform reliable than time. Don't know how fast your CPU is. |
Steeve 25-Jan-2010 [15660x3] | to compare our CPUs we can use SPEED? ==2100 on my Celeron |
(with R3) | |
SPEED? sould be ehnanced to output system informations (like the CPU, frequency and OS) | |
Henrik 25-Jan-2010 [15663] | seems there is a bug in it: form-decimal -100 1 == "-.100,0" Anyone with a fix? |
Pekr 25-Jan-2010 [15664] | Some time ago, I did form-decimal function too. But I am really a coding lamer, so dunno, if it cover at least half the cases other versions do. Here it is: form-decimal: func [num /local tmp main rest sign base][ either found? find tmp: to-string num "E" [ parse tmp [ [copy main to "." skip copy rest to "E" | copy rest to "E" (main: copy "") ] skip mark: (sign: copy/part mark 1) skip copy base to end ] either sign = "-" [ tmp: copy "0." loop ((to-integer base) - 1) [insert tail tmp "0"] insert tail tmp rest ][ tmp: copy "" insert tail tmp join main rest loop ((to-integer base) - (length? rest)) [insert tail tmp "0"] ] tmp ][num] ] |
Henrik 25-Jan-2010 [15665] | Graham, wouldn't it be more appropriate to simply never output scientific numbering and then create a scientific formatting function? |
Graham 25-Jan-2010 [15666] | Here's Gabriele's original version |
older newer | first last |