Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: limiting words

  1. #1
    Regular Coder
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts

    limiting words

    hi all,
    lets say i have a whole load of words as my content...but when u display it, u definitely won't want the whole thing....eg:

    Abstract Embedding of microprocessors within electronic devices is at the heart of the current era of electronic consumerism. Artificial Neural Networks (ANN’s) have played a relatively minor role in consumer electronics, so far. This is because, although ANN’s are a useful tool in many applications where PC based simulation of networks may be used to extract features from otherwise opaque collections of data, popular supervised networks such as the Multi-Layer Perceptron (MLP) suffer from slow training times and difficulty of hardware implementation. This presentation considers the potential of Weightless Neural Networks (WNN’s) in the area of intelligent embedded systems. WNN’s have been around for sometime, they are trained in a single pass through the data set and may easily be implemented in FPGA hardware. Unfortunately, until now, they have demonstrated only trivial powers of generalization. In this seminar, a new generation of WNN is described that shows generalization capabilities, which compete with that of the MLP. This should open up entirely new application areas. Some of the envisaged possibilities are discussed, e.g. adaptive control, image recognition, bio-informatics. This seminar is open to the public by invitation only. Please fax (03 - 8996 0253) or email your confirmation of participation on or before 20th. November 2002 with the following details, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut here ~~~~~~~~~~~~~ Name of Participant(s) : Company/Organisation : Address : Tel. : Fax. : email : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can contact Ms. Melissa Seah of the Adaptive Information Research Group at ext. 6409 or seah@mimos.my if you have any enquiries.
    i might just want to output(limit the output) to:

    Abstract Embedding of microprocessors within electronic devices is at the heart of the current era of electronic consumerism. Artificial Neural Networks (ANN’s) have played a relatively minor role in consumer electronics, so far. This is because, although ANN’s are a useful tool in many applications where PC based simulation of networks may be used to extract features from otherwise opaque collections of data, popular supervised networks such as the Multi-Layer Perceptron (MLP) suffer from slow training times and difficulty of hardware implementation.
    in php it is :

    Code:
    nl2br(substr($row->contents, 0, 50))
    how's it in asp??? thanking all of u in advance....
    Warm Regards,
    Mivec

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Look into Mid function. You can refer to devguru for other vbscript objects and functions.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Regular Coder
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by glenngv
    Look into Mid function. You can refer to devguru for other vbscript objects and functions.
    i used it...but i am getting this error:
    Error Type:
    Microsoft VBScript runtime (0x800A0005)
    Invalid procedure call or argument: 'Mid'
    /eventView.asp, line 178
    Code:
    <%=Mid((DBRecordset("Synopsis")),0, 50)%>
    so it doesn't work??
    Warm Regards,
    Mivec

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    In VBScript, character position in string starts at 1 not 0 unlike in other languages. You should also check if the field is null as it will throw an error if the field is null.
    Code:
    <%
    dim syn
    syn = DBRecordset("Synopsis")
    if IsNull(syn) then
      response.write "-"
    else
      response.write Mid(syn,1, 50)
    end if 
    %>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    And here's a related function I've written:

    Code:
    Function jpsvbParagraphAbbr(pvarFld, pintLen)
    	' Purpose:  Paragraph abbreviate.
    	' Remarks:  Doesn't chop up the final word.  Usually puts ... after.
    	'						Example: pintLen of 15, Can't stop   now. -> Can't stop...
    
    	' Dim var.
    	Dim varFld
    	Dim strChar
    	Dim intFinalWhiteSpaceBlockStartPos
    	Dim intFinalWhiteSpaceBlockEndPos
    	Dim I
    
    	' Set var.
    	varFld = pvarFld
    
    	' Quick exit if blank.
    	If IsNull(varFld) Or (Len(varFld) = 0) Then
    		jpsvbParagraphAbbr = ""
    		Exit Function
    	End If
    
    	' Convert to string.
    	varFld = CStr(varFld)
    
    	' Quick exit if not too long.
    	If Len(varFld) <= pintLen Then
    		jpsvbParagraphAbbr = varFld
    		Exit Function
    	End If
    
    	' Truncate to 1 more char than the needed len.
    	varFld = Left(varFld, pintLen + 1)
    
    	' Init.
    	intFinalWhiteSpaceBlockStartPos = 0
    
    	' Go back char by char to find the final white space block start pos.
    	' (There could be several white spaces in a row.)
    	' (I.e. if desired len is 15, find pos of the 1st space after the p in "Can't stop   now.")
       For I = pintLen + 1 To 1 Step -1
    		' Set var.
    		strChar = Mid(varFld, I, 1)
    
    		' If space, tab, CR, or LF.
    		If (strChar = " ") Or (strChar = Chr(9)) Or (strChar = Chr(13)) Or (strChar = Chr(10)) Then
    			intFinalWhiteSpaceBlockStartPos = I
    		Else
    			If intFinalWhiteSpaceBlockStartPos > 0 Then
    				Exit For
    			End If
    		End If
       Next	' Next I.
    
    	' Keep the proper num of chars from the left.	
    	If intFinalWhiteSpaceBlockStartPos > 0 Then
    		' Truncate to just before final white space.
    		varFld = Left(varFld, intFinalWhiteSpaceBlockStartPos - 1)
    	Else
    		' Keep the orig up to the desired len (i.e. drop the temp addtl char).
    		varFld = Left(varFld, pintLen)
    	End If
    
    	' Add ... at end.
    	' (If varFld already ends in ., then only add two more .'s)
    	If Right(varFld, 1) = "." Then
    		varFld = varFld & ".."
    	Else
    		varFld = varFld & "..."
    	End If
    
    	' Return val.
    	jpsvbParagraphAbbr = varFld
    End Function
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #6
    Regular Coder
    Join Date
    Sep 2004
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nice function Bull. Too many times if you are not careful, you'll end up cutting a word off in the middle.

  • #7
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Nice function Bull. Too many times if you are not careful, you'll end up cutting a word off in the middle.
    Thanks and it was designed not to only show part of a word (and that's actually why the function is so long).
    Last edited by Bullschmidt; 08-24-2005 at 08:37 PM.
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •