r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

sqlab
1-Sep-2009
[14637]
http://tools.ietf.org/html/rfc1179

I remember that I  did once a rudimentary lpd/lpr, but i forgot on 
which pc
Geomol
1-Sep-2009
[14638]
Graham, because we can write to a printer with:
Graham
1-Sep-2009
[14639]
Interesting .. I never bothered before to find out what IPP was.
Geomol
1-Sep-2009
[14640]
write tcp://<ip-number>:9100 <some data>


it should be straight forward to act as a printer listening on port 
9100.
Graham
1-Sep-2009
[14641x4]
Since you can dump to a port on a jet print server on port 9100 ... 
I assumed it was dumb.
Yes, that's how I do it now .. I just write to port 9100 to print 
PS on a  network printer.
so if I have a daemon listening on port 9100 will windows recognise 
it as a IP printer??
basically the idea is to try and write a fax driver by acting as 
a printer port, and then sending the print to an internet fax.
Dockimbel
1-Sep-2009
[14645]
Ah, good idea...a virtual printer in REBOL! That would make a nice 
framework if you can expose a simple API.
Graham
1-Sep-2009
[14646x3]
I was just thinking that as soon as the driver receives a file, just 
popup a requester asking where to send it to ....
and pehaps a simple address book.
Cyphre's systray code could come in useful into making this a systray 
application
Graham
7-Sep-2009
[14649]
Any value in a function that swaps the values of two variables?

a: 1
b: 2
swap a b
b => 1, a => 2
BrianH
7-Sep-2009
[14650x2]
a: also b b: a
In R3:
>> help swap
USAGE:
        SWAP series1 series2

DESCRIPTION:
        Swaps elements of a series. (Modifies)
        SWAP is an action value.

ARGUMENTS:
        series1 (series! gob!)
        series2 (series! gob!)
>> swap a: "abc" skip a 2 a
== "cba"
Anton
7-Sep-2009
[14652]
Graham, I say yes. R3's SWAP could be extended to support words and 
enable your example to work.
Geomol
8-Sep-2009
[14653x2]
Or we can do this:
set [a b] reduce [b a]
But SWAP is probably more neat.
Graham
8-Sep-2009
[14655x4]
for english speaking countries, is it  a reasonable assumption that 
if you have a negative timezone you use mm/dd/yyyy but if you're 
not negative, you use dd/mm/yyyy ?
excluding western samoa .. but I don't have any users there AFAIK
and hawaii ...
oh well.... I guess I have to read the windows registry.
Geomol
8-Sep-2009
[14659]
http://en.wikipedia.org/wiki/Date_and_time_notation_by_country
Graham
8-Sep-2009
[14660]
Looks good to me ... I think I'll just keep my rule :)
Geomol
8-Sep-2009
[14661]
Graham, write a format-date function, that also take country code 
as input and produce the correct viewing format for a date. Then 
upload it to the library.
Graham
8-Sep-2009
[14662x4]
parse-out-date: func [trial [string!]
	/local day month year tmp white
] [
	; look for dd/mm/yy and dd/mm/yyyyy and dd/mmm/yyyy formats
	white: charset [#"/" #" " #"-" #"," ]
	either parse/all trial [
		copy day 1 2 digit white
		copy month [3 8 alpha | 2 digit]
		white
		copy year [4 digit | 2 digit]
		to end
	] [
            print [ day month year ]
            
		if parse/all month digits [
			; month is numeric
			if negative? now/zone [
				; swap the month and dd around
				tmp: month
				month: copy day
				day: copy tmp
			]
		]
		if error? set/any 'err try [
			return to-date rejoin [day "-" month "-" year]
		] [
			return none
		]
	] [
		; did't parse the date
		return none
	]
]
this is extracting the date from OCR'd text ...
also copes with 1 January, 2010
Hmm.. perhaps I need 

1 2 white copy year ....
Steeve
8-Sep-2009
[14666x4]
I think it's doing the same...

parse-out-date: func [
	trial [string!] /local day
][
	trial: parse trial "-,/"	

 if all [negative? now/zone day: take next trial][insert trial day]
	try [to-date form trial]
]
sorry, replace TRY by ATTEMPT
hum, didin't check if month is a number before swapping it...
Anyway, you see you don't need to make complex parse rules
more clean...

parse-out-date: func [
	trial [string!] /local day
][
	trial: parse trial "-,/"	
	all [
		negative? now/zone 
		integer? attempt [first to block! trial/2]
		;** swap day/month
		insert trial take next trial
	]
	attempt [to-date form trial]
]
Graham
8-Sep-2009
[14670x3]
nice if it works ... shall try it out :)
Ahh... can use spaces to separate date values .. forgot about that 
one.
don't even need the /local !
Steeve
8-Sep-2009
[14673]
and replace 
>> integer? attempt [first to block! trial/2]
by
>> attempt [to integer! trial/2]

Optimizations are a never ending task with Rebol ;-)
Graham
8-Sep-2009
[14674]
:)
Steeve
8-Sep-2009
[14675]
hum wrong !!!

don't do that optimization cause it returns TRUE if there is no trial/2 
value
Graham
8-Sep-2009
[14676]
don't you hate it when this happens??

>> do %synapse.r
** Syntax Error: Missing ] at end-of-script
** Near: (line 64507) [
Steeve
8-Sep-2009
[14677]
ahah, a pain in the ass
Graham
8-Sep-2009
[14678x2]
And it's only 10k LOC near the end ...
What I need is a utility that will take a rebol script, and parse 
it out by function, attempting to intepret it until it reaches an 
error.
Steeve
8-Sep-2009
[14680]
ok i do it now
Graham
8-Sep-2009
[14681x3]
hehe
With forth, you could at least tell by the words in the dictionary 
where things had gone sour
I've spent the last hour trying to find this unmatched bracket
Henrik
8-Sep-2009
[14684]
We could use a static analyzer, like LLVM has:

http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/9
Anton
8-Sep-2009
[14685]
It took you an hour?! What technique were you using to find the missing/extra 
bracket?
Graham
8-Sep-2009
[14686]
binary chop