AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 1023 |
r3wp | 10555 |
total: | 11578 |
results window for this page: [start: 4001 end: 4100]
world-name: r3wp
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public] | ||
mhinson: 18-Apr-2009 | I have written my first bit of code that is starting to do something useful. All the bad bits are mine & all the good bits are from the help I have been given here. My main intention is to start off with code that I can understand & develop so any criticism would be most welcome. My next step is to remove the debug code & replace it with code that stores all the information in a structured form for searching & further analysis. Thanks for all your help with this. filename: copy %/c/temp/cisco.txt ;; cisco config file host: copy [] interface: copy [] intDescription: copy [] intIpAddress: [] ipRoute: [] IntFlag: false spacer: charset " ^/" name-char: complement spacer lines: read/lines filename foreach line lines [ ;; move through lines parse/all line [copy temp ["interface" to end] ( ;; evaluated if "interface" found preceeded by nothing else interface: copy temp print interface ;; debug code IntFlag: true) | copy temp2 [" desc" to end] ( ;; evaluate if " desc" found preceeded by nothing else if IntFlag [print temp2] ;; debug ) | copy temp3 [" ip address" to end] ( ;; " ip address" print temp3 ;; debug ) | copy temp4 ["hostname" to end] ( ;; "hostname" print temp4 ;; debug ) | copy temp5 [name-char to end] ( ;; any char except space or newline. this must be last ; if IntFlag [print temp5] ;; debug if IntFlag [print "!"] ;; debug IntFlag: false ) ] ] ;###################################### the input file contains these lines which are extracted (except the !) plus it has a load more lines that are ignored at the moment. hostname pig interface Null0 ! interface Loopback58 description SLA changed this ! interface ATM0 ! interface ATM0.1 point-to-point ! interface FastEthernet0 description my first port ! interface FastEthernet1 description test1 ! interface FastEthernet2 description test2 ! interface FastEthernet3 ! interface Dot11Radio0 ! interface Vlan1 description User vlan (only 1 vlan allowed) ! interface Dialer0 description $FW_OUTSIDE$ ip address negotiated ! interface BVI1 description $FW_INSIDE$ ip address 192.168.0.1 255.255.255.0 ! !########### end ########## | |
Pekr: 19-Apr-2009 | Steeve - why a waste? REBOL's parse allows even lamers like me to produce the result, which in the end does what I want it to do, but you surely would not like to see my parse rules :-) I can't write single piece of regexp, yet REBOL's parse is usefull to me. | |
mhinson: 19-Apr-2009 | Thanks for the feed back, all is most welcome. I will try to avoid read/line if it is bad, is there a list of things I can't expect to load? Should I convert them to some symbolic value & then convert them back again for the final output? I don't yet understand why a block would be easier to parse than lines, by easier do you mean more efficient or easier to create the code? The optional rules (inside parents) are to change the behavior based on lines read previously so I don't yet understand any concept that would let me avoid those. I need the code to be very simple (like me) so I can understand how it is operating. I know my implementation goes against the Rebol ethos of small & efficient but perhaps in time I can understand enough to make it so & also start using relative expressions properly so it can be simple to understand. | |
Henrik: 19-Apr-2009 | I don't yet understand why a block would be easier to parse than lines, by easier do you mean more efficient or easier to create the code? Yes, it's easier, because REBOL is based around this concept. Without this concept, dialects wouldn't make much sense. Your configuration file shown above is a good candidate for a dialect with some tweaks. I suggest, you read again what I wrote above about the basics of words, context and meaning. I can't emphasize enough how important this is to REBOL and especially for block parsing. It's important to understand this before moving on, or REBOL will remain difficult to use for you. Or drop your parse project for now and stick with the basics until you understand more of REBOL. is there a list of things I can't expect to load? The LOAD function will error out, if a string (such as a file you read) can't be loaded into a block of data. Try these in the console, and see which ones work: load "hello" load "hello," load "hello." load "%" load "1 2 3 4" load "hostname pig interface Null0 ! interface Loopback58 description SLA changed this" load %/c/temp/cisco.txt | |
mhinson: 19-Apr-2009 | Good point about my temp1 temp2 etc. that was sloppy. It is true I cannot control what is inside the config files. They can contain any printable chars (eg in encrypted password fields or remarks/descriptions or embedded TCL code) and sometimes I am going to want to capture that text. I don't mind trying to do both methods as it will help me learn. Since I can't load the file directly I am thinking I will need to do a read %file.txt & replace the /\,[]%$()@:? with %xx etc. then load the result? I cant find a list of all the chars that I would need to treat like this yet. Henrik, I do continue to read what you have written, it is helpful & I think I am beginning to appreciate the concepts. I am probably not as clear as I should be about the specification of what I am trying to do so the code has tended towards listing the requirements rather than being elegant. Thanks /\/\ | |
mhinson: 19-Apr-2009 | I am still new and confused. where can I read about how to do this please? file: "%file.txt" host: "Router1" interface: "fa0" i: 25 description: [] ipaddr: "1.1.1.1 255.255.255.0" write/append/string %/c/temp/result.log [file tab i tab host tab interface tab description tab ipaddr newline] I want the output file to be a tab-seperated set of values but all I get is the text filetabitabhosttabinterfacetabdescriptiontabipaddrnewline | |
mhinson: 19-Apr-2009 | I have tried to understand & take on what I have been told, thanks. Is this worse or better. It does what I was looking to do & I know how to extend it in the same structure. I am sure it would be educational for me if anyone has time to tear it to shreds please. Should I stop using read/line now? Would I get the benefit still? Or is the requirement too fragmented for this approach now? Should I use functions anywhere instead? Have I initialised my variables in the right & appropriate way? filename: copy %/c/temp/cisco.txt ;; cisco config file outFile: copy %/c/temp/outFile.log ;; tab separated output hostname: copy [] interface: copy [] intDesc: copy [] intIpaddr: [] ipRoute: [] IntFlag: false spacer: charset " ^/" name-char: complement spacer lines: read/lines filename outInterface: [ write/append outFile reduce [filename tab i tab hostname tab interface tab intDesc tab intIpaddr newline] ] clearInterface: [ interface: copy [] intDesc: copy [] intIpaddr: [] ] interfaceRule: [ ["interface " copy temp-interface to end] ( ;; captures point-point as well if IntFlag outInterface ;; start of new interface section so output data collected previously. if IntFlag clearInterface interface: copy temp-interface print ["! found at line " i] ;; debug print current-line ;; debug IntFlag: true ) ] descRule: [ [" description " copy intDesc to end] ( if IntFlag [print current-line] ;; debug ) ] ipAddrRule: [[" ip address " copy intIpaddr to end] ( print current-line ;; debug ) ] hostnameRule: [["hostname " copy hostname to end] ( ;; "hostname" print current-line ;; debug ) ] iprouteRule: [copy iproute ["ip route" to end] ( ;; "ip route" print current-line ;; debug ) ] IntFlagRule: [copy tempZZ [name-char to end] ( ;; not space or newline. this must be out of the int section if IntFlag outInterface ;; end of interface section so output data collected. if IntFlag clearInterface if IntFlag [print "!"] ;; debug IntFlag: false ;; ) ] i: 0 foreach line lines [i: i + 1 ;; move through lines & track line number current-line: line ;; for debug output parse/all line [ ;; parse only using rules below interfaceRule ;; evaluated if "interface" found preceeded by nothing else | descRule ;; evaluate if " desc" found preceeded by nothing else | ipAddrRule ;; " ip address" | hostnameRule ;; " hostname" | iprouteRule ;; "ip route" | IntFlagRule ;; unset interface flag if no longer in interface section (no " ^/") ] ] | |
mhinson: 20-Apr-2009 | another very basic question. how can I pass a filename from the command line please? filename: %/c/temp/file.txt works fine, but if I pass the filename from the command line it get surrounded by "" do I have to parse the result to get the filename, or is there a simpler way for something so common? The only reference I could find was here http://www.rebol.com/docs/sdk/custom.html#section-3 It seems there is a great deal of Rebol documentation, but simple questions can be had to find answers to. | |
Geomol: 21-Apr-2009 | Well, it might confuse to talk about do-face. :-) When you create a face (style) with an action block, it's set in the face. You can see it like this: >> layout [s: slider [print "hm"]] >> probe get in s 'action func [face value][print "hm"] That function is called, when you operate the style (face). Makes sense? | |
Anton: 21-Apr-2009 | mhinson, if you want to see the SLIDER from which all slider instances are derived, then you can do this: print mold system/view/vid/vid-styles/slider (Instead of printing you could write to a file, etc.) You can easily be overwhelmed with information, however, as faces are complex objects. I usually aim for key facets like: print mold svv/vid-styles/slider/init print mold svv/vid-styles/slider/feel etc. | |
mhinson: 21-Apr-2009 | ok, thanks. I was sort of hoping to use the GUI for input too, rather than just drawing titles & pictures etc. I know how to do that with slider now, but it seems a bit over the top if I have to ask you guys every time I want to use a function. | |
Henrik: 21-Apr-2009 | I just wrote above a line of code how to do that... | |
Henrik: 22-Apr-2009 | mhinson, you've stumbled onto the first limitation. If we take the line of code apart, it does the following: view ; view the created layout layout ; create the layout (object tree of FACES) from the VID dialect block [ ; start of VID dialect block button ; the first element, a BUTTON "ok" ; the text for BUTTON [ ; start of the action block for the button. it's evaluated when the button is clicked. name: get-face face ; get the value of the button through the buttons GET-FACE accessor print name ; print the value (likely none) ] ; end of action block ] ; end of layout block Now when I say limitation, it's because you can't easily check for mouse button up, release, mouse movement, etc. The VID dialect directly uses a block right after the button description to describe what should happen after clicking the button. That's part of the syntax and above I wrote it as: <face style> <face text> [<action>] You can specify size, color, edge size, background image and a few grahpical effects. And with it being a dialect, you can leave things out or swap the ordering of some parameters. If you want more advanced control, you need to use the FEEL object, but you are definitely not ready for that. :-) Settle for working with VID and some layouts like above. VID was designed to be easy and very fast to use. If you go beyond VID, you will need a whole lot more knowledge on how to do things. | |
mhinson: 22-Apr-2009 | Thanks for your help again. Trust me to stumble on something ;-) I think I am getting there now. Would this be the right way to identify which button was pressed? view layout [button "ok" [print "button1"] button "ok" [print "button2"]] I was expecting the buttons to have names other than the text on the button. I guess identifying the button by its possition in the code is what I will need to do. Thanks. I have never done any GUI programming before so perhaps I am just in a muddle about how it is done in general terms. I was expecting the event that a button was pressed to pop up in another part of the code (are they called event handlers?) (thus needing to identify which button it was). If Rebol dosn't do it like that I may just be asking the wrong questions. | |
Henrik: 22-Apr-2009 | I guess identifying the button by its possition in the code is what I will need to do. Not necessary. That is what the set-word! prior to the style name is for. You can do that like this: layout [b: button "Hello!" [print "clicked"]] 'b is now a button face. You can access it like this: >> get-face b == none >> b/text == "Hello!" >> b/color == 44.80.132 >> do-face b none clicked From inside the action block, you can also access it by FACE, e.g.: [get-face face] | |
Henrik: 22-Apr-2009 | with that line, you need to know about SHOW and HIDE. If you set b/text like that, you need to do a: show b afterwards, or the face won't update. | |
mhinson: 22-Apr-2009 | Well, I modified the code from draw-controls.r in the script library to get this. It is more complex than I expected, Is it a reasonable way to do this sort of thing please? pos1: 20x20 pos2: 80x0 view layout [ scrn: box rate 0:0:0.1 feel [ engage: func [face action event] [ if action = 'time [ scrn/effect/draw: copy [] append scrn/effect/draw [line pos1 pos2] show scrn ] ] ] effect [ draw [] ] s1: slider [ ss1: to-integer (100 * get-face s1) pos2: (as-pair 80 ss1) ] ] Next step is to work out how to make the thing that moves leave a trail. | |
Anton: 22-Apr-2009 | To leave a trail, you could append to the draw block (without setting it to a new block each time, as you've done above), but that would mean your draw block would get very big over time. So a better thing to do is to draw onto an image!, which serves as a cache of your previous draw commands. For this, you can use an IMAGE instead of a BOX, and use the DRAW function to draw permanently onto the image. (The IMAGE style is very similar to BOX, but its 'image facet is set to an image! for us, ready to use.) | |
Anton: 23-Apr-2009 | Once you find a specific facet you are interested in, you can then probe it to see its value: print mold get in face 'color ; == 200.200.200 and you can do this, of course, with any face you make, such as the BOX above. | |
mhinson: 29-Apr-2009 | I have a plan, but I am stuck before that as I can't work out how to reference the value of a variable in a block. aa: 1 bb: 2 cc: [aa bb] print first cc I want it to print 1, but however I arange the brackets I can work out how to do it.. I know this is very basic, sorry. | |
mhinson: 29-Apr-2009 | I still dont feel up to the parse version of the first puzzel, so I have had a go at the first part of the second puzzel. I think I am a bit confused about where to use var: 0 var: copy 0 I have also got a bit mixed up with the use of global variables which I know is bad. This is the code, which now dosnt seem to work since I put the variable initalisation inside the compress function, and tried to pass the variables to the function.. Dont laugh, but this is about 3 hours work. raw-data: [1 2 3 10 11 99 101 2000 2001 2002 2003 2004] sequence-break: func [count store result][ if/else (count > 1) [ append result to-pair rejoin [store "x" count] count: 1 ][ append result store ] ] compress: func [raw-data][count: 1 store: reduce raw-data/1 result: [] repeat i ((length? raw-data) - 1) [ if/else ((raw-data/(i) + 1) = (raw-data/(i + 1))) [ count: count + 1 ][ sequence-break count store result store: reduce raw-data/(i + 1) ] ] sequence-break count store result ] probe compress raw-data I am happy if my code is functional & easy to maintain at the moment. I will never be an application developer but using small bits of code to increase personal productivity is IMHO a very worthwhile thing to try and do. | |
BrianH: 29-Apr-2009 | Object types are reference types too, but you usually need to do other tricks instead of COPY with them. | |
mhinson: 30-Apr-2009 | wow! so do I need to pass them my globals & copy them in the function? I expected that copy to be implicit.... I better look at DOES HAS & FUNCTION before I waste anymore of everyones time. sorry. | |
Graham: 1-May-2009 | what's a sample of what you are trying to do ? | |
Maxim: 1-May-2009 | since it only moves forward, its very fast. in order to do look ahead assertion and things like that (which are slow in regexp anyways) you must learn a few tricks in order to manually set and retrieve the "current" character index. | |
Maxim: 3-May-2009 | if we want to extract what is after that single tag, then you can easily use to or even better thru: but lets do it using skip. starting with a simple example will make the lesson 2 more obvious. | |
[unknown: 5]: 3-May-2009 | Here is a crude way to do what we did earlier that doesn't use parse but matches any part to any first occurence of the letter >> chars: charset "by" == make bitset! #{ 0000000000000000000000000400000200000000000000000000000000000000 } >> copy/part z: find {aabbyyc} chars next find z "c" == "bbyyc" | |
[unknown: 5]: 3-May-2009 | For example, I rather do this: parse/all {zzabyybc} [to charset copy result thru "c"] | |
mhinson: 3-May-2009 | I am trying to formulate an example that shows why I thought TO was useful. It mostly has to do with where I want to extract the data complete with the key I used to find it. Without using TO it seems that I need to add the string I was looking for back onto the data I have extracted. | |
mhinson: 4-May-2009 | I have been working out ways to extract IP addresses from a string today. Is this a good way to do it? What could catch me out? parse to-block "junk 111.111.111.111 0.0.0.0 255.255.255.128 junk" [ any [ set tup tuple! (print tup) | skip ] ] | |
mhinson: 4-May-2009 | I was hoping the TO-BLOCK would take care of that. do I need to parse the junk first to remove unloadable strings? or is there another TO- function that will do it for me please? | |
Henrik: 7-May-2009 | If you want to return the event handler to the UI, type DO-EVENTS. | |
mhinson: 7-May-2009 | I have been looking at the library examples & noticed that some of them start off with something like navigator: make object! [ The ones like this dont do anything so I am guessing I need to use this code in a way I have not come across yet. I have been madley trying things like make a: navigator and looking up make in the documentation, but not understanding the answers. | |
Sunanda: 7-May-2009 | That's the way I do it, using 'context / make object! Some people prefer using blocks rather than objects: blk: [a 4 b 5 c 6] blk/b == 5 blk/b: 99 probe blk == [a 4 b 99 c 6] There are advantages and disadvantages to each approach. | |
mhinson: 7-May-2009 | A question: if I want to provide a dialoge to navigate to a directory can I call up the ms windows file open & save dialogs, or do I have to do it all in rebol. I cant find any examples of this & dont have the skills to create my own... I like the idea of having a GUI interface, but I may have to go back to command line if it is too hard for me :-) | |
Gregg: 11-May-2009 | REBOL [] do %include.r include %file-list.r flash-wnd: flash "Finding test files..." if file: request-file/only [ files: read first split-path file ] if none? file [halt] items: collect/only item [ foreach file files [item: reduce [file none]] ] unview/only flash-wnd ;------------------------------------------------------------------------------- ;-- Generic functions call*: func [cmd] [ either find first :call /show [call/show cmd] [call cmd] ] change-each: func [ [throw] "Change each value in the series by applying a function to it" 'word [word!] "Word or block of words to set each time (will be local)" series [series!] "The series to traverse" body [block!] "Block to evaluate. Return value to change current item to." /local do-body ][ do-body: func reduce [[throw] word] body forall series [change/only series do-body series/1] ; The newer FORALL doesn't return the series at the tail like the old one ; did, but it will return the result of the block, which is CHANGE's result, ; so we need to explicitly return the series here. series ] collect: func [ "Collects block evaluations." [throw] 'word block [block!] "Block to evaluate." /into dest [block!] "Where to append results" /only "Insert series results as series" /local fn code marker at-marker? marker* mark replace-marker rules ][ block: copy/deep block dest: any [dest make block! []] fn: func [val] compose [(pick [insert insert/only] not only) tail dest get/any 'val get/any 'val ] code: 'fn marker: to set-word! word at-marker?: does [mark/1 = marker] replace-marker: does [change/part mark code 1] marker*: [mark: set-word! (if at-marker? [replace-marker])] parse block rules: [any [marker* | into rules | skip]] do block head :dest ] edit-file: func [file] [ ;print mold file call* join "notepad.exe " to-local-file file ;join test-file-dir file ] flatten: func [block [any-block!]][ parse block [ any [block: any-block! (change/part block first block 1) :block | skip] ] head block ] logic-to-words: func [block] [ change-each val block [either logic? val [to word! form val] [:val]] ] standardize: func [ "Make sure a block contains standard key-value pairs, using a template block" block [block!] "Block to standardize" template [block!] "Key value template pairs" ][ foreach [key val] template [ if not found? find/skip block key 2 [ repend block [key val] ] ] ] tally: func [ "Counts values in the series; returns a block of [value count] sub-blocks." series [series!] /local result blk ][ result: make block! length? unique series foreach value unique series [repend result [value reduce [value 0]]] foreach value series [ blk: first next find/skip result value 2 blk/2: blk/2 + 1 ] extract next result 2 ] ;------------------------------------------------------------------------------- counts: none refresh: has [i] [ reset-counts i: 0 foreach item items [ i: i + 1 set-status reform ["Testing" mold item/1] item/2: random/only reduce [true false] show main-lst set-face f-prog i / length? items wait .25 ] update-counts set-status mold counts ] reset-counts: does [counts: copy [total 0 passed 0 failed 0]] set-status: func [value] [set-face status form value] update-counts: has [pass-fail] [ counts/total: length? items pass-fail: logic-to-words flatten tally collect res [foreach item items [res: item/2]] ;result (e.g.): [true 2012 false 232] standardize pass-fail [true 0 false 0] counts/passed: pass-fail/true counts/failed: pass-fail/false ] ;--------------------------------------------------------------- main-lst: sld: ; The list and slider faces c-1: ; A face we use for some sizing calculations none ml-cnt: ; Used to track the result list slider value. visible-rows: ; How many result items are visible at one time. 0 lay: layout [ origin 5x5 space 1x0 across style col-hdr text 100 center black mint - 20 text 600 navy bold { This is a sample using file-list and updating progress as files are processed. } return pad 0x10 col-hdr "Result" col-hdr 400 "File" col-hdr 100 return pad -2x0 ; The first block for a LIST specifies the sub-layout of a "row", ; which can be any valid layout, not just a simple "line" of data. ; The SUPPLY block for a list is the code that gets called to display ; data, in this case as the list is scrolled. Here COUNT tells us ; which ~visible~ row data is being requested for. We add that to the ; offset (ML-CNT) set as the slider is moved. INDEX tells us which ; ~face~ in the sub-layout the data is going to. ; COUNT is defined in the list style itself, as a local variable in ; the 'pane function. main-lst: list 607x300 [ across space 1x0 origin 0x0 style cell text 100x20 black mint + 25 center middle c-1: cell cell 400 left cell [edit-file item/1] ] supply [ count: count + ml-cnt item: pick items count face/text: either item [ switch index [ 1 [ face/color: switch item/2 reduce [none [gray] false [red] true [green]] item/2 ] 2 [mold item/1] 3 ["Edit"] ] ] [none] ] sld: scroller 16x298 [ ; use SLIDER for older versions of View if ml-cnt <> (val: to-integer value * subtract length? items visible-rows) [ ml-cnt: val show main-lst ] ] return pad 0x20 f-prog: progress 600x16 return status: text 500 return button 200 "Run" [refresh show lay] pad 200 button "Quit" #"^q" [quit] ] visible-rows: to integer! (main-lst/size/y / c-1/size/y) either visible-rows >= length? items [ sld/step: 0 sld/redrag 1 ][ sld/step: 1 / ((length? items) - visible-rows) sld/redrag (max 1 visible-rows) / length? items ] view lay | |
mhinson: 12-May-2009 | Hi, I am trying to reduce the number of global variables I use in functions & so my functions return blocks, but I have not discovered any simple way to dereference the information in the variables, within the blocks.. I have written a function to do it, but I guess there is a built in function if I could find it. Or at least something a bit more elegant than this: "return_value_of_block_component" function. Any tips most welcome please. f1: func [a] [ b: join a "-Bee" c: join a "-Cee" return [b c] ] d: f1 {Hi} return_value_of_block_component: func [block component] [ foreach element block [ if element = component [return reduce [element]] ] ] H: return_value_of_block_component d 'b I: return_value_of_block_component d 'c print H print I | |
[unknown: 5]: 12-May-2009 | no you must use the /local switch to do that. | |
mhinson: 13-May-2009 | Thanks Oldes, that looks good. I didnt know I could use compliment in a parse like that either. I must have been doing it wrong when I tried as I kept getting errors. Thanks Steeve, I must go & study more about opt too now. I very much appreciate you clever guys coming in this group to help me with my simple questions. I am begining to get a bit more productive with some of the things I am trying to do, although I am still very much a beginner in most areas. Thanks. | |
Henrik: 14-May-2009 | yes, for something like that, I would do some simple splitting to get the numbers isolated. | |
Janko: 14-May-2009 | ... from where do you parse 5 out... is that supose NUM-NUM suppose to be ranges? | |
Group: AGG ... to discus new Rebol/View with AGG [web-public] | ||
Henrik: 5-Jun-2006 | which is what I figured you wanted to do. you need to make the text at 0x0, rotate it and then translate it to the position you want | |
Henrik: 5-Jun-2006 | that's good. I don't have to do it then. | |
Graham: 5-Jun-2006 | do you have to create the kids first? | |
Anton: 5-Jun-2006 | What you want to do is set the origin to the centre of your object, then change the angle and translate as you wish. | |
Pekr: 11-Dec-2006 | We can assume, Cairo is distributed under LGPL, right? If so, it becomes really incompatible with the GPL. For now I'd suggest you to keep using AGG 2.4, at least until we can come up with a better legal solution. Basically, I want to prevent some commercial monster corporations" from free use of AGG. But I do want the Linux world to keep using it for free. I'm not quite sure how well LGPL protects from uncontrolled free commercial use; if it does, I may re-think and switch to the LGPL. But I'm not willing to keep using totally free, BSD-like licences in future versions. Ideally, I'd like to come up with some kind of a QT-like licensing scheme." | |
Cyphre: 27-Feb-2007 | Pekr, the reason for backporting is that: 1) there will be high demand from R2 userbase for such feature 2) it would be easy to do it. So my note above is very hypothetical ;) | |
Maxim: 27-Feb-2007 | AGG wouldn't have this effect since it does not seem to use clear text. in fact, in general I find AGG font AA pretty ugly... is there a way to improve this? even if its slow? there are some situations which do not mind speed (generating HQ output graphics, for example) or small GUIs or when converting face looks to bitmaps before display.. (trades speed for ram) | |
Maxim: 27-Feb-2007 | for example, if you want to slide a picture of a stars, you must first boost the gamma of the picture by 2, do the move and then apply a .5 gamma. then, the AA will have spread out according to energy rather than color. which means that the 2 side-by-side pixels will be at much more than 0.5 of the original 1.0 single pixel brightness. | |
Sunanda: 7-Mar-2007 | 90+% of what you need to do that, Steeve, is already in the Library: [1] we could (in minutes) add extra valid domains or types so a script could be categorised as draw-snippet [2] the LIbrary doesn't use rebservices for an API. It has an API called LDS that predates rebservices (basically, the library team got there first). You can use it to download any script (among other things too) http://www.rebol.org/cgi-bin/cgiwrap/rebol/documentation.r?script=lds-local.r#toc-50 [3] using LS to download a snippet every time it is needed would be slow and wasteful.....But you could easily write get-draw-snippet that caches results locally. **** That would not be perfect as it would be good to have a page/pages showing the images the snippets produce. But if there were enough snippets, we could add that.....And, before we do someone else could beat us to it on their own website -- they could use LDS to get all the snippets and display the images. It'd be a neat bit of Community interaction. ====> Perhaps switch to Library for any detailed discussion. | |
Dockimbel: 20-May-2007 | BTW, I'm working on a DRAW-based visual CAPTCHA for web forms. I guess that if these commands are buggy, I'll have to do it the old-fashion way, making all the calculations in REBOL (instead of letting DRAW do the maths). | |
ICarii: 4-Jun-2007 | if viewport was to be done like shape - but contain the full AGG dialect we could do nesting. | |
Pekr: 4-Jun-2007 | what is the viewport? I do remember it from Amiga, but don't remember what it was about..... kind of separate gfx space/bitmap to draw on? | |
Gabriele: 4-Jun-2007 | if you had a game that was operated by keys only, for example, you would not need to do any of this, so it's even faster than R2 | |
Gabriele: 4-Jun-2007 | or you put an id in gob/data and then use that to do whatever you want | |
Pekr: 4-Jun-2007 | event > window + offset > gob at that offset > use gob/data to get to face object > face/feel/on-click etc. - that sentence might actually help me to better understand the concept. So gob is not necessarily child of face. It is completly separate concept - kind of gfx node. And that node points to higher concept - your face, or whatever you want, so you can do anything .... | |
Cyphre: 6-Jun-2007 | Anton: ofcourse you can do nested transformations. You don't CLIP for that. I had no problem to make 'robot arms' etc. in current DRAW. | |
Maxim: 6-Jun-2007 | yes please do :-) it will make it very easy to build cliping shapes which are often the easiest way to achieve advanced (multipass) fill effects in complex shapes. | |
ICarii: 9-Jun-2007 | it could be - ive got to catch up with geomol re how he wants to do the drawing :) | |
ICarii: 9-Jun-2007 | hmm.. one thing that i would like to do when R3 comes out is to make a rebol 3D model viewer with rotation | |
[unknown: 9]: 11-Jun-2007 | Henrik, funny you should post that.............I'm in need of a way to take a 2D diagram, and turn into exactly that (which is called an isometric view). A cool feature would be that the colour of a 2D rectangle, and perhaps even the line weight and colour would dictate the 3D height, colour, and treatment. The reason I want this is that I'm building a diagram of the architecture of Qtask, and want to make it easy to see and understand. What I'm planning to do right now is draw it in 2D first. Then pick a good angle (in my mind). Then build all the 3D objects on an isometric field (sort of like old video games like Zaxxon). Then scale them into place. Then add the text words in front of them. I like the words on top vs side as well of the image you posted. If you know what was used to generate that I would like to know. | |
amacleod: 9-Oct-2008 | Oh...You mean the effect append...Yeah I've been appending every time I do the search. But I probed bx/effect but it does not look like its growing unless i"m only seeing the tail in the probe I got an out of memory crash before that I've been trying to track down. This might be it. | |
Pekr: 29-Oct-2008 | Excellent, as always. Anton - don't you want to "volunteer" to do text handling for VID3.4? As per Henrik's words, Carl's VID so far has only basic text handling. And so far, as for REBOL GUI in overall, you text area is the best ... | |
Anton: 10-Nov-2008 | It's got some debugging lines still in it, so console will fill up. The demo also has a problem with control of the ellipse - which turns out to be a tough math problem to solve. More difficult than the line/ellipse intersection. Maybe it will take me a week to do... but anyway the demo works well enough for now. | |
Steeve: 21-Nov-2008 | i'm talking about that because i currently try to do a draw editor with R3 (like my old easy-drawer). | |
shadwolf: 4-Jan-2009 | well My svg engine is working and got trouble only with matrix calulations due to an odd bug in the adapted version. Next i don't like the way my SVG works I wish to be able to do it in plain parse way (My method in not really elegant but it works fine in most cases SVG is an XML file so the XML data is converted to REBOL objects using parse and then i process those objects to convert into draw/Agg instructions). That was the fastest way i found at that time since what was important to me was the result not the beauty of the processing way. | |
shadwolf: 21-Sep-2009 | BrianH yeah mpeg2 was pattented and what it ends too ? the endustry was fed up with it and found 2 new ways to do the tast better without having to pay royal ties (HD DVD and blue ray) | |
Maxim: 22-Sep-2009 | don't know really. but in any case, you don't have to use the library to do the rendering... We can always render them using AGG or OpenGL. as long as we have the coordinates. | |
Maxim: 5-Apr-2010 | there will be no gain when scaling and rotation are ALSO applied to the transformation. but if there is ONLY translation, then there is no need for any interpolation or matrix calculus... just a simple blit as if you do: draw [ image my-image 30x30] | |
Carl: 8-Apr-2010 | Now, about "resident extensions" that's simple: it's just an extension that is resides in the host part of the exe. It should not take much to do that (mostly docs.) | |
Cyphre: 27-Dec-2010 | I got 'yes' from the AGG author to be able use v2.4 but there is not much significant changes in 2.3 vs 2.4 except internal code cleanup and few new custom rasterizers so the priority for going to 2.4 was never high enough to spend time on it. The AGG in R3 uses some code from 2.4 as it was much easier to add it this way than merge all the custom changes to 2.4 and then do all the testing to see if something went wrong. Ofcourse any effeort to make the proper transition from the current 2.3 based code to v2.4 is welcome. | |
Group: Rebol School ... Rebol School [web-public] | ||
[unknown: 5]: 21-Nov-2008 | No he don't need any other solution. He just needs to use ports to do the work for him and preserve memory. | |
Henrik: 22-Nov-2008 | Carl has nothing to do with the Wikibook. We have an old group for the Wikibook. | |
Alexandr: 22-Nov-2008 | Sunanda, thanks for your help. Anyway, I tried all my fonts, which do have russian (cyrillic) letters, but still had no luck. Seems I really have to wait for Rebol3 as nobody knows how to solve this. | |
Janko: 2-Jan-2009 | if you are using blocks which seems fine as it's even shorter and more agile (and similar to quotations in factor), but how do blocks define which parameter is which , in case of map it must take 1 parameter in case of reduce 2 ? | |
Janko: 2-Jan-2009 | really? that would be nice, I imagine I "do" the block , but before I have to somehow set those variables, I mean words | |
BrianH: 2-Jan-2009 | Let me look at it for a sec (unless you want to do it - this is the School group). | |
Steeve: 2-Jan-2009 | and finaly, we can use a single var: map: func ['vars list exec][do reduce [:foreach to-block vars list reduce [:append [] :do exec]]] >> map [x][1 2 3 4][x * x] == [1 4 9 16] >> map x [1 2 3 4][x * x] == [1 4 9 16] | |
BrianH: 2-Jan-2009 | I'm going to do a study of all of the REBOL functions that generate series (even natives) and determine which would benefit from the /into option, then get it added. It might be tricky to modify actions though. REDUCE and COMPOSE are getting the /into option. | |
Steeve: 2-Jan-2009 | but we should use change to do that job, not insert | |
[unknown: 5]: 3-Jan-2009 | If you guys get some good mezzanines please post them on my Mezzanine thread. http://www.tretbase.com/forum/viewtopic.php?f=8&t=30Also, if anyone wants to make the current ones posted more efficient please do. | |
Gregg: 3-Jan-2009 | There are mezz groups in various places, but it does't look like we have a group for it here. Feel free to start one. Maybe add a checklist as well, for final versions and prioritizing. In any case, FOLD is not necessary, but nice for those that want it. REBOL lives in many worlds. One world is for imperative-minded folks, that don't know or care about HOFs and such, another is those that do. | |
BrianH: 4-Jan-2009 | This was a backport mezzanine, and for backports the compatibility with R3 is key. You have to do some extra work when writing mezzanine functions that you don't have to do with one-off functions. | |
Graham: 4-Jan-2009 | Ok, I am going to ask my question too. I have to run a report where I collect data from a number of different functions. Each of the functions runs asynchronously. So, one might return data before another. Not that the order matters. But the user can select from 1 to say 6 data functions/sources. Now since these functions are async, I have to use callbacks to deal with the data once it arrives. What would be the best way of programming this? At the end of this, I then need to do something with the collected data .... ie. generate a graph. | |
BrianH: 4-Jan-2009 | I really do want to make it fast though, because slow functions don't get used in optimal code. This is why most of the loop functions from R2 have been converted to natives: The non-native loop functions were getting optimized out of R2 code. | |
Steeve: 4-Jan-2009 | something i don't uderstand with your unset! test. >>head insert [] do [] == [] so, unset! values cause no problem with insert ??? why do you need to test that ? have you an example ? | |
BrianH: 4-Jan-2009 | It's a quandry. I already had to add a local function to get around the limits of FOREACH, because the alternatives were slower. Do you have a solution that handles both breaks and returns? | |
Maxim: 5-Jan-2009 | if you can do it within view... then you problem seems pretty simple to me... I did a 4 way async system with on-demand buttons, loading data from the net and bg transfers syncing all running clients with a central cerver. | |
Graham: 5-Jan-2009 | presumably when one transfer finishes, it could check the others and then render if they were all finished. Do I need to poll? | |
Maxim: 5-Jan-2009 | the checkup loop was something like you can do it that way too... but you might get into some strange stack issues, cause you end up handling port messages from one port to another within the messaging stack... but I guess a simple test sould suffice to see if its stable or not. in my case, the gui had to stay responsive, since the xfer-contexts had cancel methods, which interrupted any xfer in real-time, and the whole gui had to still handle events smoothly, like scrolling a huge list, while it was adding items to that list, as it parsed the return value from the google search engine :-) | |
Brock: 30-Jan-2009 | I'd really appreciate it if one of our graphic gurus can jump in and let me know how I can either use the code above to do this, or suggest an alternative. | |
Reichart: 30-Jan-2009 | Well, if you assume that your internal storage method is one which just needs to be "converted" to an other, like CSV => XML, you might be in for a suprise when trying to model a real time dynamic system with Undo like a paint program with a file format as export. For example, do you store a given object once, with the history of the object elsewhere, or do you store the object together, with the most recent at the top of the list. Also, Do you store objects, and actions, or both togther. | |
Brock: 1-Feb-2009 | It's pretty slow to transfer the files as well. I tried transfering a 49 MB file and it took near an hour to transfer. I don't do this often, but that seemed excessive to me. | |
DanielP: 4-Feb-2009 | Hi. I have a 2-VID-windows program and I want to modify the layout (e.g add images) of the first window by clicking on buttons of the second window. How can I do that please ? | |
Geomol: 6-Feb-2009 | :-) Now, is there any shorter/smarter way to do it? | |
Henrik: 6-Feb-2009 | particularly string parsing needs to be improved. the above code should be simpler to do. | |
shadwolf: 6-Feb-2009 | but i'm waiting for R3 stable to do so in fact ... as i'm sure parse in R3 will be much better than in R2 | |
shadwolf: 6-Feb-2009 | and once R3 is out i will do the efffort to restart from scratch this project and do it 1 pass pure parse | |
shadwolf: 6-Feb-2009 | but rebol is easy you don't have to practice it 10 hour a day to be able to do insane things with it | |
Geomol: 8-Feb-2009 | That may not be, what you want. I haven't figured out yet, what you want the function to do. :-) |
4001 / 11578 | 1 | 2 | 3 | 4 | 5 | ... | 39 | 40 | [41] | 42 | 43 | ... | 112 | 113 | 114 | 115 | 116 |