AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 4382 |
r3wp | 44224 |
total: | 48606 |
results window for this page: [start: 401 end: 500]
world-name: r4wp
Group: Rebol School ... REBOL School [web-public] | ||
Gregg: 27-Apr-2012 | date-to-epoch: func [ "Returns a unix time (epoch) format from a date." date [date!] ][ ; If no time is given, negate our zone to give us 0:00 UTC if none? date/time [date/time: negate now/zone] ; This uses the epoch base in UTC, so we assume that either ; the date is also in UTC, or has a zone offset included. ; DIFFERENCE fails for huge time differences, so we subtract ; them instead, giving us a difference in days, and multiply ; by the number of seconds in a day. either attempt [positive? res: to integer! difference date 1-Jan-1970/0:0:0] [res] [date - 1-Jan-1970/0:0:0 * 86400.0] ] | |
GrahamC: 27-Apr-2012 | eg. next form 100 + now/day will give you 2 digits, and those less than 10 will have a leading zero | |
Sunanda: 27-Apr-2012 | A similar problem has been reported in the past, and dismissed -- so not considered a bug by the developers: http://curecode.org/rebol3/ticket.rsp?id=1767&cursor=12 | |
Evgeniy Philippov: 28-Apr-2012 | Not intending to start a religious war, but it's interesting what opinions about such and other qualities of rebol people have. | |
Evgeniy Philippov: 28-Apr-2012 | Or is Rebol an OverForth type language which is too syntactically *liquid* to use in long-term industrial and long-term stable projects? Could anyone comment? | |
Gregg: 28-Apr-2012 | REBOL is a full-fledged, high-level language. I use it for commercial work. R2 is very stable, but does have a small number of things that may never be fixed. Only you can say if they would cause you problems. The bigger issue is that RT doesn't seem to be maintaining REBOL anymore. The hope is that Red, World, and others will mature enough to be viable options. | |
Sujoy: 3-May-2012 | beginner question: i'm opening a file using d: open/direct/lines %bigfile.nt i am then looping through each line using: while [ln: first d] [ ;do something here ] i need to record the byte position of the start and end of each line... how? | |
PeterWood: 3-May-2012 | I think you will have to calculate them yourself using length? ln and adjust for newline/cr as appropriiate. | |
Maxim: 3-May-2012 | wrt mod-api... yes, and no, I was temporarily assigned to another project, but should get back to it tomorow, so I hope to have a release next week. | |
PeterWood: 3-May-2012 | how do i detect the newline used in %bigfile.nt? - you can read the first line from the port to work out it's length and then read the fiirst line + the two subsequent bytes in binary mode to check whether they are lf + first char of second line or cr +lf. | |
Kaj: 3-May-2012 | Watch out for text files that are edited on Windows and other systems and end up mixing different newlines | |
Endo: 7-May-2012 | Or give a name to your window: view lay: layout [...] and call "show lay" when you make changes. This will refresh the whole widgets in the window. It's better to refresh what you've updated, not the whole window, as it is much more slower. But when you are testing it is easier. | |
Henrik: 7-May-2012 | This is only partly true. It is in fact faster to SHOW the whole window, rather than calling SHOW multiple times for single elements, when there are sufficiently many elements in the window. Still, SHOW also depends on the size of the area to display, so if you have, say 10 fields, wrap them in a PANEL style and then perform the SHOW on the PANEL instead of the whole window or the individual fields. | |
Henrik: 7-May-2012 | The number of lines may go up or down at times. There is a lot of experimental code and some dead code in it. | |
Henrik: 7-May-2012 | The dialect way and setting it outside the dialect is different. I prefer never to use the dialect to set face data, other than button names and fixed labels, as they don't change anyway. | |
Henrik: 7-May-2012 | Remove the argument to FUNC in the UPDATE-WINDOW function, and it should work | |
Endo: 8-May-2012 | NOW returns current datetime and GMT. If I changed my GMT settings REBOL doesn't reflect the new settings. Is there anything I can do to get new GMT settings? Otherwise long-running tasks cannot get the correct GMT. Any idea? | |
BrianH: 8-May-2012 | If you are running your app on a system that might switch time zones, it's best to keep track of time internally in the UTC zone (+0:00). This is a little different for R3 and R2. R3: Use now/utc to get the UTC version of a datetime, or for a stored datetime d use d/utc. It does the math for you. R2: Whenever you get the time, subtract the zone offset from the datetime, like this: >> d: now == 8-May-2012/11:36:01-5:00 >> d: d - d/zone == 8-May-2012/16:36:01-5:00 >> d/zone: none == none >> d == 8-May-2012/16:36:01 | |
BrianH: 8-May-2012 | These should probably be wrapped into TO-UTC-DATE and TO-LOCAL-DATE functions, so the R3 vs. R2 differences can be resolved. | |
Endo: 8-May-2012 | Thank you BrianH. My question is, REBOL process (console or encapped app.) doesn't automatically detect of the time zone settings change of the PC. >> now/zone == 3:00 >> ;I changed my local time zone to +2 GMT or it changed automatically >> now/zone == 3:00 Is there a way to "refresh" zone in NOW, without closing and reopening the app. Let's say I get the Windows time zone using a Win32 API. Then something like >> now/zone: 2:00 == 2:00 >> now == 8-May-2012/23:45:16+3:00 ;doesn't work | |
GiuseppeC: 8-May-2012 | Hi, I need again your help: I have an invalid image in my database. I update images inside my window and I use this code: if not error? [to-image load news/immagine] [ immagine/image: to-image load news/immagine ] I have tried this code too: if not error? [picture: to-image load news/immagine] [ immagine/image: to-image load news/immagine ] However I get the following error: Script Error: Invalid argument: make image! [170x78 #{ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFF... ** Where: to-image ** Near: to image! :value The error is generated from the block following the IF Why I am not able to catch the wrong image ? | |
GiuseppeC: 8-May-2012 | Now I have another problem: I have a "description" text field I get from internet and it is "untagged". The field is very long. When I update the field with an empty string in VID I get strange characters. | |
GiuseppeC: 8-May-2012 | It seemd that when the size of the text returns to 0 the text area is not correctly updated and some characthers are being taken from memory. | |
Endo: 8-May-2012 | Here is some info: http://www.rebol.com/docs/view-face-object.html A block that holds text line information. This block is created, updated, and used by the system to optimize the updating of text. When you modify large areas of text (greater than 200 characters) you should set this variable to zero to force the system to recompute the positions of all lines. If you do not, you may see garbage characters appearing within the text. | |
GiuseppeC: 8-May-2012 | However I use RebDB to retrieve the text and it returns an empty string | |
GiuseppeC: 9-May-2012 | Next level ! Any suggestion about creating a dynamic built GUI ? I whish to create a GUI from a Block of data, each data is a button and each button has an action attached to it. Could you please point me to some code to analize? Thanks in advance | |
james_nak: 9-May-2012 | Giuseppe, you can experiment by creating your gui code as a block and then "do" it. Then view it. a: [layout [button "hi" [print "hello"]]] b: do a view b | |
Endo: 9-May-2012 | BrianH: Thanks for the info. It corrupts when I try it on objects. And wierd effects on blocks.. I've added "unset 'path" to my rebol.r file, so I won't be confused anymore. | |
BrianH: 10-May-2012 | Let us know whether you find that it's safe to unset 'path and reuse it for other stuff. There's no reason to think that the action! mechanism would call the function through its name (that's more of an R3 intrinsics thing), but any unpredictable behavior you find would be good to know. | |
Gregg: 10-May-2012 | Keep asking questions Giuseppe. Dynamic GUIs is a big subject, so if you ask more specific questions, that makes it easier to craft small answers and examples. | |
Henrik: 10-May-2012 | Perhaps it helps to learn about the mechanisms: There are several ways to generate a dynamic UI: The LAYOUT function works by creating an object tree, a tree of faces that are simply ordinary objects. When passing this to the VIEW function, a layout is displayed. The layout function is part of VID and is as such a high level function. VIEW is a low level function to interpret the face tree. The face tree consists of objects that contain other objects through the FACE/PANE word. If the FACE/PANE contains an object, that object is a single face, that is displayed inside the parent face. If the PANE contains a block, that block may contain multiple objects that are simply multiple faces. As such, a typical window is a face with a FACE/PANE that is a block that contains other objects. Graphically, the face is represented by a region on the screen that has the size and offset, possibly an effect, such as coloring, blur or mirroring or a text attached to it, and image or other faces that are only visible inside that region. A window is also a face. To navigate to the parent face from a face, use the FACE&/PARENT-FACE word. Note that FACE/PARENT-FACE is many times not set by VID, which is sometimes problematic. You can manipulate the face tree by adding removing objects dynamically and calling the SHOW function. You can also change values in existing face objects in the tree, such as for resizing or moving the faces and then calling SHOW again. You can also build a face tree entirely by hand, and this is usually the starting point for different layout engines, such as RebGUI, that simply build face trees in their own way. The prototype face is FACE, which is a minimum requirement face for the View engine. The prototype face for a VID face, which contains a few more words, is SYSTEM/VIEW/VID/VID-FACE, which is the minimum requirement face for VID. One condition for the face tree is to not use the same object in multiple locations. The VIEW or SHOW function will return an error if that is the case. A simpler way is also to generate a new face tree every time you want to change the layout. Although this is slightly more computationally heavy, it allows you to manipulate the block that was passed to the LAYOUT function instead of manipulating the face tree directly. This technique is best used, when the face tree changes dramatically by each manipulation. Another important concept is the DRAW engine which is a separate entity in REBOL2. It can be called to draw on an image bitmap, using the DRAW function or as in effect for a face object, by adding a parameter in the VID dialect block or by changing the FACE/EFFECT word. DRAW is used by calling a dialect. if you just want to use fields, buttons and simple user interface designs, you may not need to use DRAW. | |
Henrik: 10-May-2012 | I should add that it is possible for FACE/PANE also to be a function. This makes the face into an iterated face, where using a loop, you can "stamp" the face in various positions during a single SHOW, making it possible to use one face with different texts, sizes and offsets to produce a grid or a table. | |
Henrik: 10-May-2012 | You can do this by adding the buttons to a panel and update the contents of this panel. view/new layout [p: panel 500x500 []] ; start with an empty panel. note that VID does not support scrolling panels out-of-the-box. For this you need the VID Extension Kit. append p/pane make get-style 'button [] ; you will need to adjust for offset here, otherwise the new phase will be placed on top of the old one. do in last p/pane 'init ; you will need to initialize the face, which is the FACE/INIT block that resides in the face style definition. once the init block has been run, the face will set itself up and then you can show it show p This is just a simple version of what can be done. To clear it again: clear p show p If you want to do more than this, I think you need to use the VID Extension Kit, because you will be spending a lot of time managing scrollbars and panels. It has styles that are meant for this purpose. | |
ChristianE: 14-May-2012 | If it's inserting whitespace according to the first line I'm afraid there isn't such functionality available out-of-the-box. And if there was, TRIM wouldn't probably be a good name for it, then ;-) | |
JohnM: 14-May-2012 | Hello, all. I am new to REBOL4 and while having followed Lava to REBOL and looked through tutorials every year once a year for more than 10 years I have only recently began making an actual REBOL script. | |
JohnM: 14-May-2012 | I hope it is not rude to leave a question here as opposed to be here for the disucssion live, ala IRC. Please forgive me if so, and if so I will ask again when others are present. I will break down my script into smaller part questions as time goes on. First thing, I am under the impression that if I can generate a random number between 1 and 1 billion and assign this result to an aribtray variable word like so token: random/secure 1000000000 I want to email my newly generated random number to someone. So I thought of this: send [person-:-example-:-com] "Thank you. Your number is token." One second later I realized that will just the send the actial word token, not the number the variabkle word token represents. Is the above a correct way to generate a random number? How do I insert that random number into the body of the text of an email to send someone? (send [person-:-example-:-com] "Thank you. Your number is [token]" maybe?) Thanks for your help in advance, apologies for any breach of rules or etiquette. etiquetteetiquette | |
GrahamC: 14-May-2012 | You need to seed the random generator first eg. with the datestamp or something, and then generate your random number. But a better way is to create a UUID if you want something guaranteed to be unique. The library has code for windows http://www.rebol.org/view-script.r?script=guid.r Just using random, something like this should work random/seed form now/precise send [person-:-example-:-com] rejoin [ "Thank you. Your number is " random/secure 1000000 "." ] | |
Maxim: 14-May-2012 | even the simplest questions are good to keep our memories intact, and I've learned quite a few things when trying to respond to some seemingly simple questions (often by looking at other people's innovative answers). | |
Gregg: 15-May-2012 | And don't wait for people to be online. One of the great things about AltMe is the async nature. | |
JohnM: 15-May-2012 | Thank you all for addressing my concerns and for your answers about my first coding question. Ahh.. rejoin. Reading up on it makes me better understand how some things are to be done in Rebol. Continuing to the final goal... I have to extract an email address from a GET transfer. The methoed of sending the info to me is completely out of my control. An email address will be entered into a form on a website not controled by me. GET methoed will send the data to my script. The people who created the form on the external site advised that they label the email address as "trnEmailAddress". So now I want to see if I am correct in thinking how to extract and use the email address. Will using the decode a cgi form command (I know they are not commands in the tradiational sense) work. How does it work, does it create variables out of the GET (or Post when using Post, but I am forced to recieve the info via GET) stream? The GET stream in my case will include "&trnEmailAddress=person%40example%2Ecom. So can I do this? decode-cgi system/options/cgi/query-string send trnEmailAddress "Thank you. Rest of message." Thanks for your help. | |
JohnM: 16-May-2012 | Sunanda: Thanks again for issuing the World invitation. Everyone thanks for the continuing help. I have read the cited document, but it just leaves me with more questions. Is the following literal? cgi-string: read-cgi cgi-block: decode-cgi cgi-string cgi-obj: make object! cgi-block That is to say should I type exactly that? Or is cgi-string for example a theoretical variable assignment that I could call anything? Are they all proper commands, or is any part of that just for example purposes? I am thinking I should copy and paste it verbatium. I am also thinking I mispelt verbatum. I am stuck with GET. Does this mean I can leave out some code that makes up for not knowing if the original data is POST vs GET? These are hypothetical questions for better long term learning. I for now will go with the idea that everything is as straight fowarrd as it seems. I know that my GET stream will have "trnEmailAddress" in it which is a field that will contains an email address. So will the following generate a random number, extract the address and email the same random number to that email address? token: random/seed now/percise cgi-string: read-cgi cgi-block: decode-cgi cgi-string cgi-obj: make object! cgi-block send trnEmailAddress rejoin [ "Thank you. Your number is" token "." ] Graham: Thank you for the extra info on GUID, but Windows is not involved here. I realize that random number generating really isn't unless you have a monkey throwing darts at a numbered board. Regardless extra effort to make a number unique is useful and your advice appreciated. I do not think the corner cases will come up and the people who control the original form assured me that web page issues warnings if the form is not filled out correct which should help. I do realize that people are idiots, systems are not fool proof, etc. What I am saying is my basic needs are basic and I should be OK so I am not fretting over those examples. It is great though to know the solutions are out there when I need them. Tahnks. | |
GrahamC: 16-May-2012 | John you have to seed the generator first and then generate your number And you can dispense with the cgi-string by cg-block: make object! decode-cgi read-cgi | |
GrahamC: 16-May-2012 | cgi-block is your variable, and the rest are functions | |
JohnM: 19-May-2012 | Thanks guys. Endo: Special thanks for going so far as type out an example that includes checking out that everything is OK. I realize that one cannot trust outside sources of info and that one has to always be prepared to outsmart dumb users, but the needs of this project are straightdforward and I am in unfamilar territory so if it can make things easier I can go on a bit of faith for now. That being said, better code that covers mistakes is better code and I am appreciative of it. Sunanda: That is what I thought, but I had to be sure. Thanks for helping with the details. Graham: Is that general advice or a comment on code examples I posted? I thought I had done what you just said. | |
Arnold: 19-May-2012 | Hi, I have a small problem playing an mp3 file I have so far player: "/Applications/Vox.app/Contents/MacOS/Vox" thissong: "/Users/Arnold/Music/A song.mp3" thatsong: "/Users/Arnold/Music/A-song.mp3" And then call reform [player thissong] call reform [player thatsong] Playing thissong will start the musicplayer, but no music was found and playing thatsong starts the player and is being played without problem. Because most of my mp3's and directories they are in have spaces in their names so starting to play them from REBOL gets hard this way. I tried to-file thissong but this produces "%/......&20song.mp3" so it was not successful. (Allthough thatsong just played without a problem) :( Any ideas please? | |
Arnold: 19-May-2012 | Another thing, I want to make an 'application' using REBOL that plays an mp3, an mp3 with a story for kids and I want to display the pictures from the book depending on maybe a timer(file) so the pictures are displayed acoording to the storyline. This also could be a helping aid for making presentations. I do not want to binary save my mp3 in the source of the application or in any other rebol-script so I just want to use the mp3 file and not convert it. Furthermore I do not want an external app to be started unless it can be done under the hood and/or it can be controlled by my app because the presentation could be paused by the user. Any ideas where and how to start such script. | |
Arnold: 19-May-2012 | Yet another task I think REBOL could help me with. Say I could not find the subtitles for an ancient tv-series i stumbled upon on the net. But I found subtitles in English. I can translate but some words will reoccur often, so I imagine a rebol script showing an original line or words to be translated. I type some translations and when I translate a word, all equal words in the rest of the document will change, saving me quite some time. | |
Arnold: 19-May-2012 | Okay now the words are almost all translated. Unfortunately the words are in the wrong order. Now the app shows me the lines again and this time the words are little blocks that I can click and drag to the desired position. | |
Arnold: 19-May-2012 | Found the answer to my first task: Had to read the documentation a little further and needed a function localize-file: func [file] [ rejoin [{"} to-local-file clean-path file {"}] ] Now call reform [player localize-file to-file thissong] does play the song! | |
GrahamC: 20-May-2012 | @JohnM You have to do it like this random/seed now/precise token: random/secure 1000000 and not like this token: random/seed now/precise | |
JohnM: 20-May-2012 | Graham: Thanks. That makes sense out of something someone else told me. I thought the information was contradicting what you guys said earlier, it just means I misunderstood the order of things. The modiffer after the slash is closer to making a new command than it is an agrument than I had envisioned. The fact that random is part of both made me think they could be done together. Thank you for catching that I did not know that detail. Next part of myscrip enters something into a database. The server will have an mySQL database installed. It is possible that alternative could be used, but knowing for sure I have at no extra charge this options means I am starting with this option. So I found a MySQL Driver for REBOL from here: http://softinnov.org/rebol/mysql.shtml I am following the instructions that came with the download. Is there anything I should know. Maybe it is not the driver people use because there are better ones. Maybe the author kills kittens on the weekend and it is consider bad form to use it. Maybe it is harder than it looks. Basically, please just tell me if there is general info about it I should know that is not obvious. Thanks. Hey, someone else is asking questions? i thought this was all about me! :-) :-) | |
Gregg: 20-May-2012 | On filename quoting, I have an ENQUOTE func (and a more generic ENCLOSE, ENCLOSED?, etc.) to make the intent clear. MOLD is shorter, but if you pass things around, not knowing if they've already been molded, you can get tripped up. At least I have. | |
Ladislav: 21-May-2012 | The principle is that the token calculated that way: 1) depends only on now/precise, in fact 2) since there are the is the RANDOM/SEED and RANDOM calls, it is still possible that in some cases distinct NOW/PRECISE results lead to the same TOKEN value | |
Arnold: 23-May-2012 | Today I tried combining some tables in Excel, but without (frustrating!) no success. So tomorrow I will try and build a quicky REBOL script to put the data in one Rebdb databasetable and then do a dump of that and import that again in Excel. So I combine data NAME PROP1 with NAME PROP2 giving a table NAME PROP1 PROP2 Any tips suggestions for lookalike scripts? Tia! | |
james_nak: 23-May-2012 | Arnold, you can also take a look at an .xml file that Excel produces and see how that is configured. I've had better success with xml files than csv (though I use those as well) since you can add all kinds of formatting with XML. | |
Arnold: 23-May-2012 | @kaj and balance-line through the files. A possibility, has some tricky attentionpoints in it, and the preferred way when efficiency is in the picture or more than once usage. Db seems to be pretty straight forward and its a nice exercise in using that. Thanks Endo, I mailed the links to my work. @James To me xml just looks like a whole lot of <> characters and a lot of description extra. Having to deal with that too seems a lot of work more, need a tool for working quick with xml. Thank you for all of your suggestions! | |
Arnold: 24-May-2012 | I had the cvs file (one at a time is easiest) read/lines, parsed the comma's and then depending on the record with the key name = currentrecname being already in the table an insert or an update. But the update using db-update/where just gave me trouble beyond belief. Trying update within SQL (I am talking about Rebdb here) was no problem at least using 1 property at a time (had no more time testing). But how to do it using db-update is a mystery to me. Tried many things to no avail. My table I created using db-create bt [name additive papertype department weight weightline] How do I update the record where name = ABCD and I need only to update columns weight and weigthline, both integer (but that's a coincidence, don't mind if it could be anything)? | |
Arnold: 24-May-2012 | And I thought this would be a quicky! :-) | |
Arnold: 25-May-2012 | After some trial and error getting surprised with some thing that seemed to work yeterday but didn't today I got it figured out. I will post the scripts somewhere when there is interest in it. | |
caelum: 27-May-2012 | A view question. Can the name of a button be changed after it has been created? view layout [button "Text in Button"] I want to change "Text in Button" to "New Text in Button" and redisplay it. I have not come across this anywhere so far? | |
Arnold: 7-Jun-2012 | When I use rename function to rename a file, the file date on my Mac OS X changes too. When I change a name using finder, carefully clicking the file and renaming it, the date does not change. Doe sthis happen on other platforms too? How to steer this behaviour? | |
GrahamC: 7-Jun-2012 | You can use rebol to get the mod date and change it back after the move | |
Evgeniy Philippov: 10-Jun-2012 | I got an idea from a friend. So I got ready to start my two scripts (maybe someone wrote smth similar???) - one window; left pane has file system folders tree with top at the script's dir, right pane has some content. I want two scripts, every of them is a standalone app for its own like-minded audience: 1) plaintext.r, and 2) activetext.r. The plaintext.r will have right pane editor for plain text, saving it on the fly while editing (when the window is navigated away or closed, the text is saved); and activetext.r which has a plaintext-with-rebol-applets or .r content at the right pane. | |
Evgeniy Philippov: 10-Jun-2012 | Well. The activetext.r script will have plaintext-with-embedded-rebol applets. And the rtext.r will have .r content at the right pane. | |
Evgeniy Philippov: 10-Jun-2012 | Activetext and rtext will have editor and viewer on the right, however plaintext.r will have only editor. | |
Evgeniy Philippov: 10-Jun-2012 | hmm. How to display a tree of folders and files in REBOL??? | |
Ladislav: 19-Jun-2012 | If you do want to leave out the </br> and </div> substrings, the simplest way probably is: s1: "a http://xxx</div>b http://yyy</br>" parse/all s1 [any [to "http://"start: any [end: </br> break | </div> break | skip] (print copy/part start end)]] | |
Pekr: 20-Jun-2012 | I use Artisteer to prototype web pages, and it saves content in UTF-8. Later on, I need to do few adaptations to such generated pages, so I opened it in R2, reparsed, inserted some stuff, deleted other, but it did not work out .... | |
Pekr: 20-Jun-2012 | Use some external tool to convert it to ANSI, do adaptations, and covert it back to UTF-8? | |
Pekr: 20-Jun-2012 | I am trying now. I somehow lost interest in R3, as it is non-finished, and dead product. But probably still easier than to use iconv together with R2, although I did it in the past that way, using CALL | |
Pekr: 20-Jun-2012 | I mean - text I need to input into the resulting file (UTF-8) is ANSI. I do print to-string read %text-slider.html, and in R3 console, Czech text is not correct .... | |
Pekr: 20-Jun-2012 | in editor, it's correct. Simply put - I read czech text from an ansi file, and it is distorted in console, ditto when writing it back to file of course .... | |
Kaj: 20-Jun-2012 | When you cut and paste it from the console, or when you write it with REBOL? | |
Endo: 20-Jun-2012 | Guiseppe: "I am not ablie to understand the use of Break. Why it is useful ?" I'll try to explain: >> parse/all "http://a.txthttp://b.dat"[any [to "http://"copy x any [".txt" | ".dat" | skip] (print x)]] http://a.txthttp://b.dat;it prints just one line, from the first http:// to the last .dat >> parse/all "http://a.txthttp://b.dat"[any [to "http://"copy x any [".txt" break | ".dat" break | skip] (print x)]] http://a.txt;now it works as expected, from http:// to .txt and breaks http://b.dat;and from the next http:// to .dat | |
Endo: 20-Jun-2012 | Guiseppe: "Could it be written as: ..." TO ANY doesn't work. but ANY [TO "..." BREAK | TO "..." BREAK] works. just be careful using ANY and TO together, because they both don't advance the series pointer. So you can easily put the console in an infinit loop (escape key also doesn't work) | |
Endo: 20-Jun-2012 | hmm.. links look weird in AltME, select all text, copy and paste to a text editor to see it correctly. | |
BrianH: 20-Jun-2012 | Petr, R3 can't decode any 8bit encodings with its built-in code, just ASCII (which is 7bit) and UTF-8. However, its binary handling is better so it should be easy to write your own converters. For R2, I would suggest looking at Gabriele's PowerMezz package; it has some great text converters. Of course you lose out on R3's PARSE if you use R2. | |
Pekr: 21-Jun-2012 | Rebolek - thanks, I forgot about it. I needed it only once in the past, and so I used iconv command line tool via CALL .... | |
GiuseppeC: 21-Jun-2012 | End I have tried. Exchanging the position of .txt and .dat I have only a single line. How it could be solved ? | |
Ladislav: 21-Jun-2012 | Also in the second example why there isn't a end:" before "</div> break" ?" - it is because the first END: was already used and the position is remembered. (however, you can use end: twice if you like) | |
Ladislav: 21-Jun-2012 | Finally, which is the purpose of the SKIP keywork in this context ? - that is the easiest question. The expression any [end: </div> break | </br> break | skip] simply checks whether it "sees" the </div> terminator. If it does then the search for the terminator is over. If it does not then we check immediately whether we do not "see" the second possible terminator. However, if we are not at the terminator, both alternatives fail and the third alternative has to advance to the next position to be able to finally find the terminator. | |
PeterWood: 21-Jun-2012 | Arnold: I believe that Rebol/View uses Windows Codepages under Windows, MacRoman on OS X and ISO-8859-1 on Linux. Sadly this means it only really supports true ASCII characterrs cross platform unless you manage encoding your self. | |
GiuseppeC: 22-Jun-2012 | Ladislav, some questions are still open. I am currently remotely connected to my machine. I'll study your "lesson" tomorrow and I'll reply. | |
Arnold: 22-Jun-2012 | Peter, seeing your conversion routine on rebol.org, you know the ins and outs ;-) All the special ones I need are in the next 127. On the windows they show up. That's one of the points to be taken into account for Red development. | |
Arnold: 22-Jun-2012 | And knowing even this small community has less members then the diacrits they are using in everyday living it is a requirement to deal with UTF-8 UCS or other encodings. | |
BrianH: 22-Jun-2012 | Because all of the to-somedatatypeword functions are specifically only for datatype conversion, and we don't have a dir! or directory! type. | |
Evgeniy Philippov: 22-Jun-2012 | What are your status re: strict rebol clone and plans about it? | |
Evgeniy Philippov: 22-Jun-2012 | I currently read his blog. I am also liker of Robert Piersig's books, and that's fantastic about Brian... | |
PeterWood: 22-Jun-2012 | Evegeniy: I will contact Brian and give him your email address. | |
Arnold: 23-Jun-2012 | I have a problem renaming files. rename does not change the filename on MacOSx. In the terminal it is no problem but in my script the filenames are not changed. fileo: to-file rejoin [what-dir add-suffix naam-oud-z-ext extensie] filen: to-file add-suffix naam-oud-z-ext extensie rename fileo filen I have tested with probe that the types are ok and with the resulting values for fileo and filen the rename command worked like a charm. Any more ideas what is happening and how to debug this further? Thanks. | |
Arnold: 23-Jun-2012 | In the original script I use a change-dir to get into the right directory. Then renaming is just the rename filename newname. I stuffed the renaming into a function and changed the variable names. Everywhere but in this place where I wanted to rename the file for real and I forgot to change old to new.... so here I tried debugging it while using the complete path and filename, because I was afraid there could be an issue there. | |
Henrik: 26-Jun-2012 | If the number of texts doesn't vary, it might be simpler to make the fields manually instead of using an iterated face. The reason for this is that you need to write the SUPPLY code yourself, which will run every time you run the code and will run on every mouse move, if your text has a FEEL object with ENGAGE, OVER or DETECT functions, whereas simply making 8 texts once with VID is both faster and requires less code. | |
Endo: 27-Jun-2012 | I wrote another function which returns in the above format, so I can SELECT/SKIP 2, to get the number of occurence of the value, and it doesn't use SORT, uses REMOVE-EACH instead. it: >> f: func [b /local c r n1 n2] [r: copy [] foreach v unique b [c: copy b n1: length? c remove-each w c [v = w] n2: length? c append r reduce [v n1 - n2]] r] >> a: [a b c c a a b b c d d e e e f f h f f g h] >> f a == [a 3 b 3 c 3 d 2 e 3 f 4 h 2 g 1] | |
Endo: 27-Jun-2012 | Interesting, my tally function and Joel's, work almost in same speed, 53 sec. for 1 million execution for both. | |
Maxim: 27-Jun-2012 | just found a very handy idiom ( not new, just rarely discussed and possibly missed by many ): help function! this lists all known functions in the global scope (same for help native! help action!) obviously you can do this for all datatypes, so its very handy to get the names of stuff you often forget, like the internal color names (help tuple! ) | |
Ladislav: 27-Jun-2012 | Interesting, my tally function and Joel's, work almost in same speed, 53 sec. for 1 million execution for both. - I guess that the version using SORT should be much faster. | |
Ladislav: 27-Jun-2012 | Aha, I checked and Joel's code actually *is* using SORT, which means it is O(n * log n) algorithm. While, at the same time, the above REMOVE-EACH is O(n * n), which is *much* slower as far as I am concerned. | |
Steeve: 27-Jun-2012 | (Search for fast-tally in Altme groups) using the unique trick: fast-tally: func [b [block!] /local u i] [ b: sort b u: unique b i: 1 until [ b: any [find b u/2 tail b] u/1: as-pair u/1 negate i - i: index? b tail? u: next u ] head u ] And also, the radix algo is pretty good (if the max value is not too large) radix: func [b [block!] /local u maxv] [ maxv: 0 foreach v b [maxv: max maxv v] u: head insert/dup make block! maxv 0 maxv foreach v b [ u/:v: u/:v + 1 ] u ] | |
Ladislav: 27-Jun-2012 | ...and its speed cannot exceed the speed of more universal tallies in a significant way | |
Group: !Syllable ... Syllable free operating system family [web-public] | ||
Cyphre: 29-Jun-2012 | For example my Smasung Galaxy mini phone :-) AFAIK these low-ends are owned by a lot of people who doesn't have big enough pockets to handle the much bigger, expensive and powerful ones. |
401 / 48606 | 1 | 2 | 3 | 4 | [5] | 6 | 7 | ... | 483 | 484 | 485 | 486 | 487 |