Home arrow Coding arrow I (want to) know what you did this Sunday

I (want to) know what you did this Sunday

PDF  | Print |  E-mail
(0 votes)
Written by ultrabeast   
Sunday, 16 March 2008
After an extended period of tweaking and customization and more tweaking to this back-end engine... Finally, at long last I get to sit down and actually type some content.
 
After a busy morning which involved a lot of exertion... had a hearty lunch before settling down to... yes... more exertion. In this case, throwing a lot of exceptional cases at this engine and template (that I put a lot of effort in) in an attempt to try to break it... not only that.. under both Mozilla Firefox and IE7.
 
As a result a lot of things were discovered that 'breaks' the template - i.e. if text runs off the right edge of the screen, the template layout breaks up and makes the hated horizontal scrollbar appear.
 
It seems that if I don't do anything funny, no one would notice that there could be anything wrong.. but I couldn't sleep peacefully at night with the knowledge that something could have been done, but wasn't. (That explains my distressing masochistic compulsion.)
 
One culprit is pasting of text formatted with the <pre> tag - which indicates a block of preformatted text, such as source code.. where lines are not wrapped, but run off the edge of the screen..
 
For this case a CSS hack serves to force the contents within <pre> tags to also wrap... however, only under FireFox. IE7 still breaks crap.
 
However, not to panic, there is a custom <code> tag that makes source code appear as below:

C Code
  1. for(i=0;i<10;i++) { printf("Lengchai boh?\n"); }
  2. while(1) { printf("Ini bagus punya\n"); }

C# also can
  1. /// <summary>
  2.   /// Initializes a new instance of the <see cref="TFTPClient"/> class.
  3.   /// </summary>
  4.   /// <param name="server">The server.</param>
  5.   public TFTPClient(string server)
  6.      : this(server, 69) {
  7.   }
  8.  
  9.   /// <summary>
  10.   /// Initializes a new instance of the <see cref="TFTPClient"/> class.
  11.   /// </summary>
  12.   /// <param name="server">The server.</param>
  13.   /// <param name="port">The port.</param>
  14.   public TFTPClient(string server, int port) {
  15.     Server = server;
  16.     Port = port;
  17.   }

How to write Tetris in VB.net...
  1. Public Function WillCollide(ByVal shape As Shape, ByVal direction As NewDirection)_
  2.     As Boolean
  3.  
  4.     Dim pntsToCheck As Collection(Of Point) = GetNewPoints(direction)
  5.     For Each pnt As Point In shape.Points
  6.         For Each pnts As Point In pntsToCheck
  7.             If (pnt.Equals(pnts)) Then
  8.                 Return True
  9.             End If
  10.         Next
  11.     Next
  12. End Function
  13. Public Function WillCollide(ByVal direction As NewDirection) As Boolean
  14.     Dim pntsToCheck As Collection(Of Point) = GetNewPoints(direction)
  15.     For Each pnt As Point In pntsToCheck
  16.         If (pnt.X < 0 Or pnt.X > 9 Or pnt.Y > 19 Or pnt.Y < 0) Then
  17.             Return True
  18.         End If
  19.     Next
  20. End Function

All automatically formatted! Especially...
1 Note the neat code line numbers and
2 Language-specific syntax highlighting!
3 Note the monospace char width!
 
However the template's auto margin style definition was still not enough to prevent the template from breaking up and the horiz scrollbar from appearing... This was solved in CSS by setting the <code> class width to 720px, fixed.
 
After these corrective measures:
In exceptional case of the source code being too long (as in code1.code2.code3.code4...codeN.dosth();
 
1) the template won't break, but horizontal scrollbar appears. still acceptable.
2) <pre> tag will break template in IE7, no matter what.. because CSS overriding the <pre> tag to word wrap (as below) doesn't work...

This still doesn't wrap <pre> tag code in IE7.. -_-"
  1. pre {
  2.  white-space: pre-wrap;       /* css-3 */
  3.  white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
  4.  white-space: -pre-wrap;      /* Opera 4-6 */
  5.  white-space: -o-pre-wrap;    /* Opera 7 */
  6.  word-wrap: break-word;       /* Internet Explorer 5.5+ */
  7.  width: 99%;   /* remove horizontal scroll-bar when viewing in IE7 */
  8. }
Can anyone give me any solution that works to wrap <pre> tag text in IE ???
 
The motivation behind making all these painstaking customizations were so that all these features are built into the rich text editor, so that I don't need to separately enter any HTML tags.. thanks to putting in the diligence in the one time job , (which was a long time job) to solve all these problems.
 
I still cannot foresee the drama of the effort to produce automated prettily formatted content being made into a movie.. I guess making Internet content robustly browser-friendly still does not carry the same glamour as internet hacking XD
 
Still, carrying the euphoria of achievement.. it was then time for more exertion in the form of a swim in the nice weather..
 
Next up: The lunch at Sungai Kob, Kulim (with photos! oh wow!)
Comments
Add New Search RSS
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

3.22 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 
< Prev
Advertisement

Latest Comments!

RSS Syndication


Save to FireFox Live Bookmarks:
feed-icon-12x12-orange.gif
View Feed XML

Search I, UltraBeast!

ShoutMix CB


Say No to Internet Explorer!

- This site will give an "Operation Aborted" error with IE whenever there are photo galleries on the page.

- MOZILLA FIREFOX is the recommended browser.

- Let me know if there are problems with Opera, Safari, etc.
Thanks ~

Problems Registering?

If you have problems getting your activation email, fret not:
  • Simply log in below using your Username and Password to get that mail sent again to you.
  • Check your bulk/junk/trash mail.
  • Rinse and repeat as many times as necessary.
Should all else fail - I can be contacted at
Email webmaster

Login





Live Traffic Feed

Who's Online

No Users Online
© 2008 Interview With The UltraBeast
Joomla! is Free Software released under the GNU/GPL License.