BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-04-2005, 06:27 PM   #21
DavidE
Talking BlackBerry Encyclopedia
 
DavidE's Avatar
 
Join Date: Sep 2004
Location: East Coast
Model: 8320
Carrier: T-Mobile
Posts: 420
Default

Please Login to Remove!

Quote:
Originally Posted by ahovis
When I do that and try to spell check, I get an error suggesting that my username and password is not correct. Not sure what the problem is. On Cingular and BES with a 7290.
Leaving them blank worked for me, though my 7290 is with T-Mobile, and I'm not using BES.

DavidE
www.davidenglish.com
Offline  
Old 07-05-2005, 05:44 AM   #22
tzarcone
Thumbs Must Hurt
 
Join Date: Jun 2005
Model: 7520
Posts: 76
Default

Quote:
Originally Posted by ahovis
When I do that and try to spell check, I get an error suggesting that my username and password is not correct. Not sure what the problem is. On Cingular and BES with a 7290.

Make sure the URL is exact it is case sensitive and don't leave out the port 81 or you will goto my other server that may ask for a password.

"http://www.rebreathertech.com:81/cgi-bin/BBCorrectorServer.cgi"

Also if on BES they might not like the non standard port.
__________________
BB Model: 7520
PIN: 40098213
Blackberry Messenger
Offline  
Old 07-05-2005, 06:49 AM   #23
djbeenie
Thumbs Must Hurt
 
djbeenie's Avatar
 
Join Date: Feb 2005
Location: Jefferson Ga.
Model: 8900
PIN: 20F7C0E8
Carrier: TMO
Posts: 151
Default

Thank you so much!
__________________
Pin: 20F7C0E8
TMO 8900 - Exchange 2007 SP1 - BES 4.1.6
Offline  
Old 07-05-2005, 09:57 AM   #24
ahovis
Thumbs Must Hurt
 
Join Date: Feb 2005
Location: Raleigh, NC
Model: 8800c
Carrier: Cingular
Posts: 136
Default

Quote:
Originally Posted by tzarcone
Make sure the URL is exact it is case sensitive and don't leave out the port 81 or you will goto my other server that may ask for a password.

"http://www.rebreathertech.com:81/cgi-bin/BBCorrectorServer.cgi"

Also if on BES they might not like the non standard port.
Found the problem. This BBCorrector version uses the BES to get to your server not the WAP connection as the original version did. It was looking for a password into my BES. Once I did that all works fine until I have to refresh the password. I have the WEP set as the default browser so am not sure why it is going via the BES to your server but it is. Slight inconvience but well worth having a spell check available. Thanks for the hosting.
Offline  
Old 07-05-2005, 01:02 PM   #25
bbpoppa
New Member
 
Join Date: May 2005
Model: 7520
Posts: 6
Default Thanks

[QUOTE=tzarcone]Yes finally a FREE public server is now open for all to use......


THANK YOU TED!!!

Brian <><
Offline  
Old 07-05-2005, 09:19 PM   #26
Mr Pink57
CrackBerry Addict
 
Mr Pink57's Avatar
 
Join Date: Apr 2005
Location: a van down by the river
Model: 8330
Carrier: Sprint
Posts: 591
Default

Thanks Ted, I got it to work right away. Only thing I have noticed is I did a on purpose mispell to see what would happen and all it does is highlights the word and does not give me options to correct, did I do somehting wront here?

pink
__________________
[rubbing his thumb and forefinger together]
Mr. Pink: Do you know what this is? Its the world's smallest violin playing just for the waitresses.
Offline  
Old 07-05-2005, 09:21 PM   #27
Mr Pink57
CrackBerry Addict
 
Mr Pink57's Avatar
 
Join Date: Apr 2005
Location: a van down by the river
Model: 8330
Carrier: Sprint
Posts: 591
Default

Works great! Thanks Ted.

As for those who might care, I am using this on a Nextel 7520 and it worked flawlessly.

pink
__________________
[rubbing his thumb and forefinger together]
Mr. Pink: Do you know what this is? Its the world's smallest violin playing just for the waitresses.
Offline  
Old 07-06-2005, 06:18 AM   #28
ChrisPyLord
New Member
 
Join Date: Mar 2005
Posts: 9
Default I want to add to everyone - thanks for providing a great service

I want to add to everyone - thanks for providing a great service
Offline  
Old 07-06-2005, 06:35 AM   #29
tzarcone
Thumbs Must Hurt
 
Join Date: Jun 2005
Model: 7520
Posts: 76
Default

Quote:
Originally Posted by Mr Pink57
Thanks Ted, I got it to work right away. Only thing I have noticed is I did a on purpose mispell to see what would happen and all it does is highlights the word and does not give me options to correct, did I do somehting wront here?

pink
After it underlines it and you move the trackwheel over the word so it is highlighted press the wheel once and click on suggest spelling it will than come up with words you can pick or ignore the word.
__________________
BB Model: 7520
PIN: 40098213
Blackberry Messenger
Offline  
Old 07-06-2005, 10:49 AM   #30
pharma1
Thumbs Must Hurt
 
Join Date: Oct 2004
Location: Castro Valley, California
Model: 7100t
Posts: 148
Default

Ted, Thanks for setting this up. Now I don't have to write my emails using small/easy words.
Offline  
Old 07-07-2005, 10:28 PM   #31
Soapm
BlackBerry Extraordinaire
 
Soapm's Avatar
 
Join Date: Apr 2005
Location: The Mile Hi City
Model: 9900
OS: 7.0
Carrier: TMO
Posts: 2,794
Default

I got ticked at all the little problems I was having and went back to the previous OS. Spelling and reply to now show up on my menus. When corrector tries to connect to the server I get an error saying, "bbcorrector could not find a service book entry for IPPP". When I look in service book I see an entry called IPPP for BIBS [IPPP] so what gives?
Offline  
Old 07-08-2005, 11:01 AM   #32
bossj52
Thumbs Must Hurt
 
Join Date: Jan 2005
Location: Plano, TX
Posts: 103
Default

I got it installed alright, however, when I select the suggested word after it checks the spelling, it changes the word then deletes all or part of the previous word. Anyone else experience this?
Offline  
Old 07-08-2005, 11:14 AM   #33
tzarcone
Thumbs Must Hurt
 
Join Date: Jun 2005
Model: 7520
Posts: 76
Default

Quote:
Originally Posted by Soapm
I got ticked at all the little problems I was having and went back to the previous OS. Spelling and reply to now show up on my menus. When corrector tries to connect to the server I get an error saying, "bbcorrector could not find a service book entry for IPPP". When I look in service book I see an entry called IPPP for BIBS [IPPP] so what gives?
Tired to send you a message on Blackberry Messenger, try to disable your firewall and see if that helps. Also can try to toggle the MDS on and off to see if that changes things too.
__________________
BB Model: 7520
PIN: 40098213
Blackberry Messenger
Offline  
Old 07-08-2005, 11:15 AM   #34
tzarcone
Thumbs Must Hurt
 
Join Date: Jun 2005
Model: 7520
Posts: 76
Default

Quote:
Originally Posted by bossj52
I got it installed alright, however, when I select the suggested word after it checks the spelling, it changes the word then deletes all or part of the previous word. Anyone else experience this?

Nope haven't seen that yet but maybe someone might have an idea on that one.
__________________
BB Model: 7520
PIN: 40098213
Blackberry Messenger
Offline  
Old 07-08-2005, 11:52 AM   #35
DavidE
Talking BlackBerry Encyclopedia
 
DavidE's Avatar
 
Join Date: Sep 2004
Location: East Coast
Model: 8320
Carrier: T-Mobile
Posts: 420
Default

Quote:
Originally Posted by Soapm
When corrector tries to connect to the server I get an error saying, "bbcorrector could not find a service book entry for IPPP".
I get that error when I leave the "Disable MDS Proxy" box unchecked. When it is checked, the program runs fine.

DavidE
www.davidenglish.com
Offline  
Old 07-09-2005, 12:23 AM   #36
tateu
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2005
Location: Los Angeles, CA USA
Model: 9000
OS: 4.6.0.247
Carrier: AT&T
Posts: 209
Default Found the fix for Incorrect Misspelled Word Replacement

Quote:
Originally Posted by bossj52
I got it installed alright, however, when I select the suggested word after it checks the spelling, it changes the word then deletes all or part of the previous word. Anyone else experience this?
Do you have any non-alphanumeric characters in your email, such as but not limited to the following? ” “ » €

I've found the problem when using some of those characters. The text sent from the Blackberry to BBCorrectorServer.cgi seems to be in UTF-8 format. BBCorrectorServer.cgi correctly handles this but either the Blackberry or, more specifically, BBCorrector running on the Blackberry does not.

The way the spell check works is the Blackberry sends it's email to the server. The server then Spell checks it, taking note of the absolute position from the beginning of the file of any misspelled words by counting the number of bytes that each character takes up. It then sends that data back to the Blackberry which marks the position of the misspelled words. The Blackberry, however, uses the number of characters to count position. This is where the problem lies.

As an example, this is the text you sent to get spell checked:
Ths is jst an example for the spell checker.
The server would note that you misspelled "Ths" at position 1 and "jst" at position 8 and send that data back to the Blackberry. With this example, you would have no problems because each of the characters in the above example only takes up one byte.

As an example of a sentence that would cause problems, this is the text you sent to get spell checked:
Ths ”is” jst an example for the spell checker.
The server would note that you misspelled "Ths" at position 1 and "jst" at position 14 and send that data back to the Blackberry. The Blackberry, though, thinks that "jst" is at position 10. In UTF-8, ” is 3 bytes long even though it is only one character, so this is where the position indexes get screwed up. There are several other characters that behave similarly.

If you add two lines of code to BBCorrectorServer.cgi, you can fix this issue. I've also fixed it in my PHP version of BBCorrectorServer.php. I will post the PHP code in another post below this one, just in case anyone was trying to use that.

In the original BBCorrectorServer.cgi file, after line 16, which is "use File::Temp qw/ tempfile tempdir /;"

add this line:
use utf8;

In the original file, after line 31, which is "my $text2Check = "$FORM{check}";"

add this line which removes utf8 formatting:
utf8::decode($text2Check);

And here is the entire file, just in case:

Code:
#!/usr/bin/perl

#
# BBCorrector Server
#
# This script accepts a block of text from the BlackBerry software
# BBCorrector, runs it through Aspell, and returns an XML packet
# indicating spelling errors.
#
# NOTES:
#
# - It is recommended you protect this script with some form of HTTP
#   authentication. BBCorrector is setup to handle Basic Authentication.
#
use CGI qw(:standard Vars);
use File::Temp qw/ tempfile tempdir /;
use utf8;

# The Aspell executable
my $cmdAspellExe = "aspell";

# Language is US English
my $lang = "en_US";

# Options for Aspell. Puts Aspell into Ispell compatibility mode
# so that its output is written to stdout
my $cmdAspellOptions = "-a --lang=$lang";

my %FORM = Vars();

# Get the block of text from the HTTP parameter "check"
my $text2Check = "$FORM{check}";

#Remove utf8 formatting
utf8::decode($text2Check);

# Convert line endings to a common format. In this case whatever
# line ending combination we get (CRLF, LF, etc), we convert to a standard
# format of LF
$text2Check =~ s/\x0D\x0A|\r/\n/g;

# Create a temporary file to store our block of text
my $dirTemp = tempdir( CLEANUP => 1 );
my( $tempHandle, $tempFilename ) = tempfile( DIR => $dir );

# Split block of text into lines and write to temp file
@lines = split( /\n/, $text2Check );
for my $line ( @lines ) {
  # Force Aspell to check whole line via ^ contol character
  print $tempHandle "^$line\n";
}
close $tempHandle;

# XML packet has format such as:
# <spell-results>
#   <error>
#     <word>maan</word>
#     <position>12</position>
#     <suggest>Man</suggest>
#     <suggest>man</suggest>
#     <suggest>moan</suggest>
#   </error>
#   <error>
#     <word>helllo</word>
#     <position>33</position>
#     <suggest>hello</suggest>
#   </error>
#   <error>
#     <word>chris</word>
#     <position>41</position>
#     <suggest>Chris</suggest>
#     <suggest>Charis</suggest>
#   </error>
# </spell-results>
my $xmlPacket = "<spell-results>";

# Do this here so that when we are debugging we can display it in return output
print header;

# Keeps track of current line number
my $lineNum = 0;

# Keeps track of the absolute position in the block of text
my $posAbsolute = 0;

# Execute Aspell
my $cmd = "$cmdAspellExe $cmdAspellOptions < $tempFilename 2>&1";
# TODO: $status most likely only tracks wether the fork failed or not, not
# whether the actual command we are running (ie: aspell) failed
my $status = open ASPELL, "$cmd |";

if ($status > 0) {
  # Parse Aspell output
  for my $cmdReturn (<ASPELL>) {
    chomp($cmdReturn);
#print "$cmdReturn<br>\n";

    if( $cmdReturn =~ /^\*/ ) {
      # Line begins with *. Do nothing.

    } elsif( $cmdReturn =~ /^(&|#)/ ) {
      # Line begins with & or #.

      # Start error element
      $xmlPacket .= "<error>";

      # Split return line up for easier access
      my @tokens = split(" ", $cmdReturn, 5);

      # Add word element which contains original misspelled word
      $xmlPacket .= "<word>$tokens[1]</word>";

      # Need to work out absolute position in file, not just position in current line
      my $offsetIdx = 3;
      if ($cmdReturn =~ /^\#/) {
        $offsetIdx--;
      }
      my $pos = $posAbsolute + ($tokens[$offsetIdx] - 1);
      $xmlPacket .= "<position>".$pos."</position>";

      # Add suggestions
      my @suggestions = ();
      if ($tokens[4]) {
        @suggestions = split(", ", $tokens[4]);
        for my $suggestion (@suggestions) {
          $xmlPacket .= "<suggest>$suggestion</suggest>";
        }
      }

      # End error element
      $xmlPacket .= "</error>";

    } elsif( $cmdReturn =~ /^$/ ) {
      # We have a blank line which indicates a line of text has been processed

      my $line = $lines[$lineNum];
      $posAbsolute += (length($line) + 1);
      $lineNum++;
    }
  }
  close ASPELL;

} else {
  $xmlPacket .= "<exception>BBCorrector Server has encountered an error ($!)</exception>";
}

# Delete the temp file
unlink $tempFilename;

# End results XML packet
$xmlPacket .= "</spell-results>";

#print "check = $text2Check<p>\n";

# Return XML packet back to client
print "$xmlPacket\n";
Offline  
Old 07-09-2005, 12:29 AM   #37
tateu
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2005
Location: Los Angeles, CA USA
Model: 9000
OS: 4.6.0.247
Carrier: AT&T
Posts: 209
Default PHP Fixed for Incorrect Misspelled Word Replacement

Here is the server translated into PHP with the UTF-8 fix:

Code:
<?php
	$text = $_POST['check'];

	//BBCorrector sends data via POST
	//but in case it is run via web URL with Get
	//Try this
	if ( $text == NULL )
		$text = $_GET['check'];
	
	//If no text is found exit with an error
	if ( $text == NULL )
	{
		print "Error";
		exit;
	}
	
	$tmpFile = tempnam("/", "bbCorrector");
	
	$aspellcmd = "cat $tmpFile | aspell -a";
	
	//Remove UTF8 formatting
	$text = utf8_decode($text);
	
	//Remove extra escape backslashes that were added by PHP
	$text = stripslashes($text);

	if ($mFile = fopen($tmpFile,"w")) {
		$textArray = explode("\n",$text);
		// Force Aspell to check whole line via ! ^ contol character
		fwrite($mFile,"!\n");
		foreach($textArray as $key=>$value) {
			fwrite($mFile,"^$value\n", strlen($value) + 2);
		}
	}
	fclose($mFile);
	
	$mAspellOutput = shell_exec($aspellcmd);

	//Delete temp file
	$mDeleteOutput = unlink($tmpFile);

	//parse $mAspellOutput
	$mAspellOutputArray = explode("\n",$mAspellOutput);

	$xmlPacket = "<spell-results>";
	
	$lineIdx = -1;
	$charCount = 0;

	foreach($mAspellOutputArray as $key=>$value) {
		if (substr($value,0,1) == "&") { //There is an error with suggestion
			$corVals = explode(" ",$value);
			$word = $corVals[1];
			$posAbsolute = substr($corVals[3],0,-1) - 1 + $charCount;
			$startPos = strpos($value,":") + 2;
			$suggestion = substr($value,$startPos);
			$suggestionArray = explode(", ",$suggestion);

			// Start error element
			$xmlPacket .= "<error>";
			
			// Add word element which contains original misspelled word
			$xmlPacket .= "<word>$word</word>";
			$xmlPacket .= "<position>$posAbsolute</position>";
			
			// Add each suggestion
			foreach ($suggestionArray as $key=>$value) {
				$xmlPacket .= "<suggest>$value</suggest>";
			}
			
			// Close error element
			$xmlPacket .= "</error>";
		}
		elseif (substr($value,0,1) == "#") { //There is an error but no suggestion
			$corVals = explode(" ",$value);
			$word = $corVals[1];
			$posAbsolute= $corVals[2] - 1;
			
			// Start error element
			$xmlPacket .= "<error>";
			
			// Add word element which contains original misspelled word
			$xmlPacket .= "<word>$word</word>";
			$xmlPacket .= "<position>$posAbsolute</position>";
			
			// Close error element
			$xmlPacket .= "</error>";
		}
		elseif (substr($value,0,1) == "*") {//No error
		}
		elseif (substr($value,0,1) == "@") {//Apsell About Line
		}
		else {
			$lineIdx++;
			$charCount += strlen($textArray[$lineIdx]) + 1;
		}
	}
	
	$xmlPacket .= "</spell-results>\n";
	
	print $xmlPacket;
?>
Offline  
Old 07-09-2005, 01:36 AM   #38
tateu
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2005
Location: Los Angeles, CA USA
Model: 9000
OS: 4.6.0.247
Carrier: AT&T
Posts: 209
Default More UTF-8 Problems with Perl CGI Version

Well, my above mentioned fix has led me to find more UTF-8 problems with the Perl cgi version of BBCorrectorServer.cgi. My example text of:
Ths ”is” jst an example for the spell checker.
works in the PHP version the I translated but the Perl cgi version (both the original and my modified version above) come back on the Blackberry with malformed UTF-8 errors. I'll continue to look into it, but you may want to give my PHP version a try, since it seems to handle it without an error.
Offline  
Old 07-09-2005, 08:15 AM   #39
tzarcone
Thumbs Must Hurt
 
Join Date: Jun 2005
Model: 7520
Posts: 76
Default

Quote:
Originally Posted by tateu
Well, my above mentioned fix has led me to find more UTF-8 problems with the Perl cgi version of BBCorrectorServer.cgi. My example text of:
Ths ”is” jst an example for the spell checker.
works in the PHP version the I translated but the Perl cgi version (both the original and my modified version above) come back on the Blackberry with malformed UTF-8 errors. I'll continue to look into it, but you may want to give my PHP version a try, since it seems to handle it without an error.

I am working on modification right now on the server on a test file will let everyone know when that fix has been completed I also am putting on the php so will be able to use either.

Ted
__________________
BB Model: 7520
PIN: 40098213
Blackberry Messenger
Offline  
Old 07-09-2005, 08:42 AM   #40
tzarcone
Thumbs Must Hurt
 
Join Date: Jun 2005
Model: 7520
Posts: 76
Default

The change has been made to the server I just updated the cgi and tested it.
Always post your problems here and everyone can help in fixing them.

I want to thank Tateu for his help finding the fix to this problem and also finding the solution as well. Great job Tateu!!!

I removed the old cgi and replaced it with the new modified version so other than a few minutes down time in renaming the file no one has to change anything on thier BB's

Ted
__________________
BB Model: 7520
PIN: 40098213
Blackberry Messenger
Offline  
Closed Thread


Thread Tools

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


Schneider Electric Energy Server EBX510 Server For Energy Management- picture

Schneider Electric Energy Server EBX510 Server For Energy Management-

$4350.00



3 Section Buffet Server & Food Warmer in Stainless Steel picture

3 Section Buffet Server & Food Warmer in Stainless Steel

$25.10



Leviton Server Racks + Cabinet Flush Mount Premium Vented Hinged Door White picture

Leviton Server Racks + Cabinet Flush Mount Premium Vented Hinged Door White

$58.75



Server Note Pads Paper, Guest Check Books, Total 1000 Sheets, 10 Pads, 100 Sheet picture

Server Note Pads Paper, Guest Check Books, Total 1000 Sheets, 10 Pads, 100 Sheet

$29.92



Schweitzer Engineering Laboratories - Intelligent Server Model: SEL3332 picture

Schweitzer Engineering Laboratories - Intelligent Server Model: SEL3332

$239.99



Discover Guest Check Presenters - 50 Books - Restaurant Server Books Double... picture

Discover Guest Check Presenters - 50 Books - Restaurant Server Books Double...

$44.50







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.