[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[QUIZ] LCD Numbers (#14

James Gray

1/7/2005 1:49:00 PM

The three rules of Ruby Quiz:

1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.

2. Support Ruby Quiz by submitting ideas as often as you can:

http://www.grayproductions.net/...

3. Enjoy!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This week's quiz is to write a program that displays LCD style numbers at
adjustable sizes.

The digits to be displayed will be passed as an argument to the program. Size
should be controlled with the command-line option -s follow up by a positive
integer. The default value for -s is 2.

For example, if your program is called with:

> lcd.rb 012345

The correct display is:

-- -- -- --
| | | | | | | |
| | | | | | | |
-- -- -- --
| | | | | | |
| | | | | | |
-- -- -- --

And for:

> lcd.rb -s 1 6789

Your program should print:

- - - -
| | | | | |
- - -
| | | | | |
- - -

Note the single column of space between digits in both examples. For other
values of -s, simply lengthen the - and | bars.


26 Answers

Robert McGovern

1/7/2005 2:57:00 PM

0

Question, I assume the idea is for a 7 seqment LCD?

Also just wanted to say that the formatting on the quiz page

http://www.grayproductions.net/ruby_quiz/q...

is broken for the examples.


Robert McGovern

1/7/2005 3:02:00 PM

0

> Also just wanted to say that the formatting on the quiz page
>
> http://www.grayproductions.net/ruby_quiz/q...
>
> is broken for the examples.

In Internet Explorer 6 but fine in Firefox 1.0


James Gray

1/7/2005 3:35:00 PM

0

On Jan 7, 2005, at 8:57 AM, Robert McGovern wrote:

> Question, I assume the idea is for a 7 seqment LCD?

When -s == 1, yes.

James Edward Gray II



James Gray

1/7/2005 3:42:00 PM

0

On Jan 7, 2005, at 9:02 AM, Robert McGovern wrote:

>> Also just wanted to say that the formatting on the quiz page
>>
>> http://www.grayproductions.net/ruby_quiz/q...
>>
>> is broken for the examples.
>
> In Internet Explorer 6 but fine in Firefox 1.0

I'm unhappy with the current Ruby Quiz Web site and intend to replace
it as soon as I can find the time. Because of that, I'm not spending
too much time fiddling with the CSS myself, but I'll accept a working
patch if you're up to bug hunting.

I hope I don't sound uncaring. I'm not. I do want Ruby Quiz to have a
great site, but the current version has some built-in weaknesses I want
to get past, so I would rather spend my time replacing it.

I do thank you for the information.

James Edward Gray II



Douglas Livingstone

1/7/2005 4:12:00 PM

0

> but I'll accept a working
> patch if you're up to bug hunting.

Replace

<p class="example">

with

<pre class="example">

and update the corresponding </p>s to </pre>

The examples are prefromatted text, so mark them up that way and you
make life easier for yourself :) You'll probably want to remove the
"white-space: pre" bits too.

Douglas

On Sat, 8 Jan 2005 00:42:19 +0900, James Edward Gray II
<james@grayproductions.net> wrote:
> On Jan 7, 2005, at 9:02 AM, Robert McGovern wrote:
>
> >> Also just wanted to say that the formatting on the quiz page
> >>
> >> http://www.grayproductions.net/ruby_quiz/q...
> >>
> >> is broken for the examples.
> >
> > In Internet Explorer 6 but fine in Firefox 1.0
>
> I'm unhappy with the current Ruby Quiz Web site and intend to replace
> it as soon as I can find the time. Because of that, I'm not spending
> too much time fiddling with the CSS myself, but I'll accept a working
> patch if you're up to bug hunting.
>
> I hope I don't sound uncaring. I'm not. I do want Ruby Quiz to have a
> great site, but the current version has some built-in weaknesses I want
> to get past, so I would rather spend my time replacing it.
>
> I do thank you for the information.
>
> James Edward Gray II
>
>


James Gray

1/7/2005 4:32:00 PM

0

On Jan 7, 2005, at 10:12 AM, Douglas Livingstone wrote:

>> but I'll accept a working
>> patch if you're up to bug hunting.
>
> Replace
>
> <p class="example">
>
> with
>
> <pre class="example">
>
> and update the corresponding </p>s to </pre>
>
> The examples are prefromatted text, so mark them up that way and you
> make life easier for yourself :) You'll probably want to remove the
> "white-space: pre" bits too.

This is a hold-over of the original site design when I didn't use
pre-formatted whitespace for the examples. (Yes, that was dumb.)

The change you purpose requires me to correct every quiz page. <br />s
will need to be translated to \ns as well.

Also, this change is incompatible with the Ruby code blocks, which are
probably suffering from the same problems. (I assume.)

I should have said "a working CSS patch", because if it's not that
simple it's a waste of time on a doomed site.

These, and other reasons, are why I'm planning a replacement.

James Edward Gray II



Douglas Livingstone

1/7/2005 7:09:00 PM

0

> I should have said "a working CSS patch", because if it's not that
> simple it's a waste of time on a doomed site.

True, you did say that.

As you have a doctype in there already, you could get off with putting this:

_white-space: pre;

After the following line:

white-space: pre-wrap; /* avoid overflow */

(The underscore at the start will make it apply only in IE, leaving
other browsers to display as they do already.)

Douglas


James Gray

1/7/2005 8:06:00 PM

0

On Jan 7, 2005, at 1:09 PM, Douglas Livingstone wrote:

>> I should have said "a working CSS patch", because if it's not that
>> simple it's a waste of time on a doomed site.
>
> True, you did say that.
>
> As you have a doctype in there already, you could get off with putting
> this:
>
> _white-space: pre;
>
> After the following line:
>
> white-space: pre-wrap; /* avoid overflow */
>
> (The underscore at the start will make it apply only in IE, leaving
> other browsers to display as they do already.)

I dropped this in and saw no change in any of my browsers, just as you
said. I've updated the site with the change. Does this fix the
examples in IE 6?

Thanks for the tips.

James Edward Gray II



Zach Dennis

1/7/2005 8:50:00 PM

0

This quiz got my attention. I can't wait until I get home from work and
can do this one...this one just looks so fun

=)

Zach


Robert McGovern

1/7/2005 9:49:00 PM

0

> > (The underscore at the start will make it apply only in IE, leaving
> > other browsers to display as they do already.)
>
> I dropped this in and saw no change in any of my browsers, just as you
> said. I've updated the site with the change. Does this fix the
> examples in IE 6?

It does indeed fix the problem for IE6, thanks Douglas for finding a
fix and James for putting it in place.

Rob