AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 5907 |
r3wp | 58701 |
total: | 64608 |
results window for this page: [start: 23201 end: 23300]
world-name: r3wp
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public] | ||
mhinson: 7-May-2009 | Unview! wow, that will save me exiting the console a hundred times a day!! That is a top tip & should be in a prominate place for newbies. | |
Henrik: 7-May-2009 | If you want to show a window and return to console immediately, use VIEW/NEW instead. | |
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. | |
Henrik: 7-May-2009 | make object! is the same as making a context. If you see an entire script wrapped in make object! [] or context [], it is because it was desired to use this script with other scripts without polluting the global namespace. | |
Henrik: 7-May-2009 | Try this: context [ a: 2 set 'b 3 set 'c does [return a] ] >> a >> b >> c A simple way to control what's private and public. | |
mhinson: 7-May-2009 | I see, that is good. I have seen the 'b syntax used but not understood it yet. I see in your example the set 'b 3 seems like b: 3 in the global context. Thanks very much for your tips, they are a great help. | |
Sunanda: 7-May-2009 | On the other hand, if you want 'a, 'b, 'c to be local to the context -- so other parts of your application can also have their own 'a. 'b and 'c without overwriting each other: my-api: context [ a: 2 b: 3 c: does [return a + b] ] my-api/a: 5 ;; override default value print my-api/c ;; executes function in context | |
mhinson: 7-May-2009 | I wondered how the xxx/xxx/xxx paths to data were constructed... I was thinking of this sort of thing as a way to refer to valuse in a multi demensional array by name rather than number house: context [ room1: context [ items: [bed chair table] ] room2: context [ items: [TV sofa HiFi] ] ] | |
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. | |
Sunanda: 7-May-2009 | :-) ..... You could think of it as a type of associative array. | |
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 :-) | |
mhinson: 7-May-2009 | oh, that was simpler than expected. Thanks very much. I must say I dont think Rebol is very easy to learn, but once all these tricks are known it must be very easy to write things quickly. Perl is like a tool shop & a tree for wood, while Rebol is like a high street full of all sorts of shops as well as tools. | |
mhinson: 7-May-2009 | There is a request-dir too, but it is a bit of a joke. Looks like the way to go is to use the request-file then extract the directory. Why would request-dir even exist in such a feeble state? Sorry, I hope I am not speaking out of turn, but if anyone had that pop up they would think it was a bit odd. | |
Henrik: 7-May-2009 | large parts of the GUI system was written in a very short time by Carl alone back early in this decade and has not been officially upgraded. | |
mhinson: 7-May-2009 | AH a string "*.txt" for the filter works Thanks for your help | |
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 | |
BrianH: 12-May-2009 | For f1, reduce the block before you return it. Then use set [a b] f1 "blah" to get the values. | |
Henrik: 12-May-2009 | vars: make object! [ b: c: none ] f1: func [a] [ vars/b: join a "-Bee" vars/c: join b "-Cee" vars ] | |
[unknown: 5]: 12-May-2009 | Only the things you define in a function as local are local. | |
PeterWood: 12-May-2009 | Each object has its own context. All variables in the object are local to the object's context. Only the object "variable" would be in the global context: >> a: 1 == 1 >> obj: make object! [ [ a: "one" [ b: "two" [ c: "three" [ ] >> a == 1 >> obj/a == "one" >> b ** Script Error: b has no value ** Near: b >> obj/b == "two" | |
mhinson: 13-May-2009 | Hi, I have been puzzeling over this all evening & would love a few tips please. I am trying to write a single parse rule that will extract the first number before the "/" in each case, but my logic must be faulty I think. digit: charset [#"0" - #"9"] data1: {random 10/2} data2: {2/33-35,2/48} parse/all data1 [ some [[h: 1 2 digit :h copy result to "/" thru end] | skip]] result parse/all data2 [ some [[h: 1 2 digit :h copy result to "/" thru end] | skip]] result | |
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. | |
Janko: 14-May-2009 | aha, that is easier to learn .. I also don't the advanced parsing that oldes gave you example, and I wrote a couple of finished programs that used "normal" parsing as a main featurea | |
mhinson: 14-May-2009 | I suppose I could add a comma to the end of the string then I would be able to use it as a marker. | |
Group: AGG ... to discus new Rebol/View with AGG [web-public] | ||
Graham: 18-May-2006 | Is there a way of applying translate to invert the y axis? | |
Cyphre: 18-May-2006 | Another solution is to apply own translation function on the dialect block or generate the dialect block with translated coords from scratch. (this shouldn't be a rocket science and would work with text too) | |
Volker: 18-May-2006 | Regarding text, maybe Graham is right and a graphics-only reverse would help? for diagrams. The current way is a bit complicated, until one gets the trick. | |
Volker: 19-May-2006 | Looks like magic :) But should not be required to draw a line through some data? | |
Graham: 5-Jun-2006 | So, why does the text move across the page ? view/new layout [ b: box 400x400 black effect [ draw []] ] for i 0 90 5 [ b/effect: compose/deep [ draw [ rotate (i) text vectorial "This is a string of text 1" 300x75 ]] show b wait .2 ] | |
Graham: 5-Jun-2006 | or set up a straight line "spline" for the text ... | |
Henrik: 5-Jun-2006 | speaking of which, it could be fun to see a LOGO like dialect for DRAW. fun for the kids. | |
Henrik: 5-Jun-2006 | got plenty of those around, not mine though. I don't know how interested they would be in it yet. I spent countless hours in COMAL80 when I was a kid drawing with the "turtle". | |
Graham: 5-Jun-2006 | Comal80 - a Danish product? | |
Graham: 5-Jun-2006 | I remember I had a Comal80 interpreter for my C64. | |
Henrik: 5-Jun-2006 | I think it was a great drawing tool. very straight forward approach to drawing. | |
Graham: 5-Jun-2006 | just labelling the y-axis is a problem because of the way AGG does the rotate vs PostScript rotate command | |
Graham: 5-Jun-2006 | and there's no way to save a graphic state in AGG. | |
Henrik: 5-Jun-2006 | ah, yeah that could be a problem | |
Anton: 5-Jun-2006 | Graham, AGG rotation: that's just an effect of the way AGG does its transformations which apply to the whole image. The rotate command is just a shortcut method of specifying just the rotation angle of a transformation. | |
Anton: 5-Jun-2006 | I agree that it is a bit uncomfortable at first. I was also expecting something simpler like in flash, but I suppose this way is more powerful. | |
Geomol: 4-Dec-2006 | Is there a reason, why SPLINE doesn't draw anything with just two points? view layout [box effect [draw [pen black spline 10x10 90x90]]] | |
Geomol: 5-Dec-2006 | Cyphre, it makes sense to have spline draw a line with only two points in a gfx application, where the user start a line with two points and may continue with more points or may just end the line after only two points. | |
Graham: 5-Dec-2006 | can't the drawing application change it to a line if it ends in two points? | |
Maxim: 7-Dec-2006 | example, sliding objects on a path, connecting lines along splines, etc... | |
Geomol: 7-Dec-2006 | Maxim, maybe a Bezier curve is what, you're after? Try do http://www.fys.ku.dk/~niclasen/rebol/fysik/bezier.r You can find the Bezier function inside the script. | |
Maxim: 8-Dec-2006 | Cyphre, was has to be done for R3 IMHO is a way for us to probe values, just like a 3d package allows you to get point, edge, curvature info out of transforming and deforming geometry. | |
Maxim: 8-Dec-2006 | using liquid I am already able to build a draw network, which recycles values and allows multiple elements to cooperate. but I can't get that within each element itself. | |
Pekr: 11-Dec-2006 | hmm, reading some of license related answers, GPL seems to prove itself being a cancer once again :-( | |
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." | |
Pekr: 11-Dec-2006 | but he also adds: We are working on a legal solution that allows us to prepare special releases of AGG under a commercial license along with GPL. Currently you can keep using AGG 2.4 for free, but I'll stop supporting it soon. We are also working on different fee plans, to make it as flexible as possible. It's hard to tell you concrete values right now, but there won't be anything extraordinary. Depending on the projects and your revenue we can even provide you a free commercial license". We will inform you soon about possible options. McSeem" | |
Volker: 20-Dec-2006 | Does someone have a demo-script with agg-fonts on debian? I have no deep clue how to use 'draws deper features and dont want to spend some hours figuring that out^^ | |
Volker: 20-Dec-2006 | i read it does not work beacuse of absolute font-pathes. i give it a try | |
Graham: 20-Dec-2006 | Yes, I have a demo that Cyphre gave me. | |
Volker: 22-Dec-2006 | Is there a performance-difference in using the old face/image or drawing images in the draw-block? | |
Dockimbel: 26-Feb-2007 | Is there a way in Draw/AGG to globally set TEXT rendering mode (aliased, antialiased, vectorial) instead of setting it each time you call TEXT ? | |
Dockimbel: 27-Feb-2007 | Oldes: you could make a REBOL wrapper around the GD library (used by PHP for image processing). | |
Pekr: 27-Feb-2007 | well, it is just that we talk about R3 as of a beast, not being compatible more than from 30% to R2. If it is going to be nearly 100% compatible, than continued development of R2 after R3 release is total vaste of resources ..... | |
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) | |
Henrik: 27-Feb-2007 | Maxim, I don't know. The output seems pretty similar to what is output with Freetype 2, but the AA is a little uneven, yes. | |
Maxim: 27-Feb-2007 | I find the issue is mostly with thin lines where the aa will be quite spectacular in its variations especially if you look at the difference from 45 angle and near 0 or 90 degre angles. I know that AA should be an energy based repartition, which is not linear. (gamma) such that two pixels at 0.5 are actually a quarter as bright as one full 1.0 brightness pixel to our vision (obviously subjective to user response, applied monitor gamma and superwhite levels, etc). | |
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. | |
Maxim: 27-Feb-2007 | so I guess a similar operation is needed for fonts (I have no concrete bg in fonts, only view a similarity) | |
Oldes: 27-Feb-2007 | The AA is the reason, why I want bitmap fonts. With such a bitmap it would be very easy to create pixel fonts. If you take a look at Flash you can see, that most of the sites is using pixel precision fonts, which are made for fixed height but anyway are much more smaller. http://fontsforflash.com/ | |
Oldes: 27-Feb-2007 | and if I can use such a image http://box.lebeda.ws/~hmm/rebol/projects/font-tools/latest/fonts/idea.png to create glyphs which I can use in flash: http://box.lebeda.ws/~hmm/rebol/projects/font-tools/latest/fonts/idea.html it would be nice to have a chance to use such a bitmap (or the vectorized glyphs) in Rebol as well | |
Graham: 27-Feb-2007 | Is carl going to release a linux sdk with agg enabled? | |
Oldes: 5-Mar-2007 | never mind, I already used my rebol/flash dialect to make the chart. I just wanted to say, that there is probably a bug, because this is working: view layout [ box 400x400 effect [draw [ rotate 15 fill-pen red arc 200x200 90x90 0 108 closed fill-pen green arc 200x200 90x90 108 252 closed ]] ] | |
Oldes: 5-Mar-2007 | Ach... ok my fault - the center point is in zero - that's why it was not visible - so it's probably not a bug | |
Steeve: 6-Mar-2007 | what about a library of draw snipsets handled by rebol.org ? | |
Steeve: 6-Mar-2007 | we could think too about a standardized form for draw animations | |
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. | |
Maxim: 7-Mar-2007 | Steve, I am about to release in the next few weeks a dataflow draw engine called glob. its allows selectable layers of assembled draw blocks, can VERY easily animate too. | |
Cyphre: 11-Apr-2007 | Yep, I wanted to make Contextfree parser in Rebol couple of years ago but still don't get to it. Anyway it would be a nice PARSE/DRAW exercise :) | |
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). | |
Cyphre: 21-May-2007 | To clarify it have a look at result this example: view layout [ box 600x400 effect [ draw [ fill-pen blue box 50x50 150x150 translate 50x50 fill-pen red box 50x50 150x150 reset-matrix translate 70x70 fill-pen yellow box 0x0 100x100 ] draw [ translate 200x0 fill-pen blue box 50x50 150x150 translate 50x50 fill-pen red box 50x50 150x150 translate 70x70 fill-pen yellow box 0x0 100x100 ] ] ] | |
Cyphre: 21-May-2007 | Yes, the example is a bit confusing :) I hope we will have better DRAW docs for R3. | |
ICarii: 31-May-2007 | ive experimented with various values and don't have a clue - please enlighten me :) | |
Geomol: 31-May-2007 | Maybe this give a clue? view layout [b: box 400x400 white effect [draw [shape [move 0x200 arc 90 200x400 false true]]] at 300x20 slider [b/effect/draw/shape/arc: to-integer value * 360 show b]] | |
Cyphre: 2-Jun-2007 | Yes, the ARC shape command is a bit confusing....we need to improve the syntax or make at least clear docs on it. | |
ICarii: 4-Jun-2007 | is it possible to add viewport rendering into AGG? eg virtual boundary limits - this would save using additional gobs/faces and simplify things a lot | |
ICarii: 4-Jun-2007 | no for clipping on retangular regions.. there is a command for that already and ive missed it havent I? ;) | |
ICarii: 4-Jun-2007 | so I guess after all that I still do want a viewport ;P | |
ICarii: 4-Jun-2007 | altho i can be munged with a translate after teh clip i suppose | |
ICarii: 4-Jun-2007 | it would be a nice effect | |
ICarii: 4-Jun-2007 | yeah - but im worried about event hit detection - or is it a pre-composited? | |
Gabriele: 4-Jun-2007 | or even have a single event function as event awake (you can do this in R2 too) | |
Gabriele: 4-Jun-2007 | basically... the event gives you the window gob and the offset in it. then there's a native that can map an offset inside the window to the gob it belongs too. so the mezz code just uses that, then maps the gob to the feel, eg via gob/data (user data field) | |
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 | since gob/data can be whatever... you can map any gob to any feel, gob b inside gob a may map to gob c which is elsewhere. | |
Gabriele: 4-Jun-2007 | or you don't map the offset to the gob at all, but use a bitmap to map the offset to something else, like max does in elixir etc. | |
Pekr: 4-Jun-2007 | it was a joke ;-) | |
Gabriele: 4-Jun-2007 | faces are higher level... they have a feel, other info needed for eg for vid, etc. | |
Gabriele: 4-Jun-2007 | but you don't need to use "faces" at all, you can just use gobs in a game for eg. and handle events your own way... maybe gob/data maps to the player object :) | |
Pekr: 4-Jun-2007 | how that gob/data points to face/feel/on-click? is there a mezz code in gob/data? | |
Pekr: 4-Jun-2007 | hmm, it would be coold, if you could post any simple actual code as a spoiler - we can already learn from studying :-) | |
Gabriele: 4-Jun-2007 | wait a month (less actually... it's 4 already) | |
ICarii: 4-Jun-2007 | id rather wait a month and have to docs out :) | |
ICarii: 4-Jun-2007 | or just adding a fill-at command | |
Gabriele: 4-Jun-2007 | fill-at - that's a problem with anti-alias | |
ICarii: 4-Jun-2007 | normally you set a tolerance |
23201 / 64608 | 1 | 2 | 3 | 4 | 5 | ... | 231 | 232 | [233] | 234 | 235 | ... | 643 | 644 | 645 | 646 | 647 |