Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 3rd, 2006, 6:38 AM   #31
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: WA, USA
Posts: 343
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
Quote:
Originally Posted by Writlaus
The reason I have words that long is this is going to be a site where people can put in any message they want. So of course, some guy thinking he's funny will just put in a message of all or almost all Ws.
then restrict the size of user input to a fixed value.
<input type="" name="" size="">
or how ever the input is done
mrynit is offline   Reply With Quote
Old May 3rd, 2006, 6:52 AM   #32
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Just because you don't want a long piece of garbage doesn't mean you don't want to allow longer things with multiple words. Besides, 'size' is a control-sizing doo-dad, I think you probably meant maxlength.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 3rd, 2006, 4:42 PM   #33
Writlaus
Hobbyist Programmer
 
Writlaus's Avatar
 
Join Date: Nov 2005
Posts: 149
Rep Power: 4 Writlaus is on a distinguished road
DaWei is correct. I want to have the phrases be at most 150 characters long, but I still want to be able to stop any insanely long words from messing up my tables.

I wish there were some line-breaking techniques like ­ and "word-wrap:break-word" that worked in Firefox.
Writlaus is offline   Reply With Quote
Old May 3rd, 2006, 6:31 PM   #34
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Well, you know what they say about wishing in one hand and...ahhhh nemmine. Seriously, think about this for a second. Almost universally, a browser renders what it received from the server as a response. One exception is form fields. If a user enters lebenty-zillion Ws into a form field and never hits 'submit', who's to know? If the form is submitted, the contents of the field are available to the form-processing software. That means this dastardly entry may be discarded, broken into appropriate lengths, or used to drive the hard-disk head up against the stops and make grinding sounds until the janitor goes crazy and hits the server with a mop. The fact that there's nothing 'universal' to handle this on the browser end probably means you're the third person to be seriously concerned about it. Fix it on the server side and wait for enough other people to go gray.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 3rd, 2006, 11:04 PM   #35
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: WA, USA
Posts: 343
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
@Writlaus
...wait a sec...if you know PHP shouldnt you know how to handle things like this?
mrynit is offline   Reply With Quote
Old May 5th, 2006, 1:14 AM   #36
Writlaus
Hobbyist Programmer
 
Writlaus's Avatar
 
Join Date: Nov 2005
Posts: 149
Rep Power: 4 Writlaus is on a distinguished road
mrynit, I said in a previous post in this thread that I would rather not use the wordwrap(); function because it makes decisions based on numbers of characters rather than physical lenght in pixels of the formatted string.
Writlaus is offline   Reply With Quote
Old May 5th, 2006, 1:26 AM   #37
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: WA, USA
Posts: 343
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
1. why cant you limit the number of characters to prevent such long stings that cause this problem??

2. dont use wordwrap(); if it doesnt work. develope your own way of handling really long strings using server side w/e you want.

3. :banana:
__________________
i dont know much about programming but i try to help
mrynit is offline   Reply With Quote
Old May 5th, 2006, 1:29 AM   #38
lectricpharaoh
SEXY SHOELESS GOD OF WAR!
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,193
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by Writlaus
mrynit, I said in a previous post in this thread that I would rather not use the wordwrap(); function because it makes decisions based on numbers of characters rather than physical lenght in pixels of the formatted string.
I don't think there is any standard HTML method to do what you want, and as you mention, you cannot reliably do it server-side, because you have no way of knowing exactly what size and shape font the client will render in. Even without the client substituting a different font, they may be altering the size, and some fonts don't scale quite linearly (not to mention the server is oblivious that such scaling has happened).

So, you're left with two options as I see it. First, you can forget about it, and just let it mess up the tables when it occurs. Second, you can do it server-side, and just accept that in some situations, it will be sub-optimal.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is online now   Reply With Quote
Old May 5th, 2006, 1:34 AM   #39
Writlaus
Hobbyist Programmer
 
Writlaus's Avatar
 
Join Date: Nov 2005
Posts: 149
Rep Power: 4 Writlaus is on a distinguished road
Yeah... I guess I'm going to have to use wordwrap(); or something like it afterall. If anyone has any other suggestions, go ahead and post 'em, but for now I'll start working on it server-side.

EDIT: Just to let everyone know, all I'm really looking for is a way to stop a long word from messing up my tables.
Writlaus is offline   Reply With Quote
Old May 5th, 2006, 1:37 AM   #40
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: WA, USA
Posts: 343
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
Quote:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce a lectus. Pellentesque faucibus, mauris et commodo posuere, enim erat iaculis nibh, sed venenatis lacus diam non pede. Mauris gravida sem in justo. Pellentesque lacus felis, tincidunt at, vulputate ac, commodo id, enim. Nullam sed dolor in odio accumsan lacinia. Pellentesque ac ante. Integer sollicitudin tempor urna. Vestibulum hendrerit. Integer tempor metus quis erat. Fusce turpis mauris, pellentesque a, eleifend non, ullamcorper eget, mi. Ut id risus. Proin vel mauris. Cras adipiscing. Proin molestie massa vel tortor rhoncus egestas. Nullam nisl risus, rhoncus sed, scelerisque et, rutrum nec, nibh. Nulla facilisi. Sed egestas ornare massa. Donec congue pretium tortor. Proin volutpat. Maecenas sit amet enim vitae nulla euismod consequat.

Phasellus quam purus, commodo ac, cursus eget, gravida quis, leo. Sed mattis interdum risus. Maecenas venenatis metus a est. Morbi imperdiet, ligula ac mollis dictum, enim ipsum dapibus risus, nec porttitor dui eros quis sem. Suspendisse ac pede at odio pellentesque aliquam. Nulla facilisi. Sed vestibulum. Sed vehicula, erat at ullamcorper tempor, mi lacus placerat arcu, ut faucibus magna orci quis tortor. Integer laoreet. Duis id neque vitae arcu auctor pulvinar. Donec laoreet lorem a turpis. Donec vel magna et nibh fringilla congue. Proin gravida massa vitae lectus. Nunc in orci laoreet nunc mollis pretium. Morbi commodo libero sit amet nulla.
find the standar deviation of the number of spaces for every 150 characters. if some one enters a string that is an outlier or how ever you want to determin than reject it. log the ip's of the ppl who enter regected strings so can prevent them from spaming.
__________________
i dont know much about programming but i try to help
mrynit is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:40 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC