473,789 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

maximum number of code lines

Hallo,

my task is to establish some kind of full text file search in
Javascript. The files and it's contents are fixed, the HTML/JavaScript
pages lie offline on a server.

As far as Javascript cannot access files via any i/o operations, I
have written a routine in Delphi. It parses files in one folder and
generates a Javascrip tfile. The first lines build up a file table,
then the word index is build.

Example:
addTable("Filen ame1.txt")
addTable("Filen ame2.txt")
....
addTable("Filen amen.txt")
addIndex("Word1 ", "1,5,9")
addIndex("Word2 ", "30,156,100 2")
....
addIndex("Wordn ", "40")

This script can be rather huge when there are lots of files and lots
of different words in those files. An example script I generated had
approx.160.000 lines.

In additon I wrote a Javascript that contains the needed functions for
building the search Index. When the HTML-file that should realize the
search is opened, the script I built with Delphi is opened and
executed, which calls the functions in the other Javascript and
generates the serach index in the working memory.

In Firefox, the script runs fine, but in IExplorer 7 I get an error
message stating an error in line 32769 of the Delphi generated script.
There is absolutely no error in this line, and I guess it has more to
do with some code line limit, because 32768 is a power of 2.

Is this a known Internet Explorer issue? WHat should I do as a work
around? subdivide the script in multiple scripts, each not longer than
32768 code lines, and than write a wrapper script that calls those
subdivided script?

Are there any other good approaches for buildung and using a search
index in Javascript for realizing a full text search?

Regards,

Christian Kirchhoff

Apr 16 '07 #1
3 2942
ck******@direct media.de said the following on 4/16/2007 5:29 PM:
Hallo,

my task is to establish some kind of full text file search in
Javascript. The files and it's contents are fixed, the HTML/JavaScript
pages lie offline on a server.

As far as Javascript cannot access files via any i/o operations, I
have written a routine in Delphi. It parses files in one folder and
generates a Javascrip tfile. The first lines build up a file table,
then the word index is build.

Example:
addTable("Filen ame1.txt")
addTable("Filen ame2.txt")
...
addTable("Filen amen.txt")
addIndex("Word1 ", "1,5,9")
addIndex("Word2 ", "30,156,100 2")
...
addIndex("Wordn ", "40")

This script can be rather huge when there are lots of files and lots
of different words in those files. An example script I generated had
approx.160.000 lines.

In additon I wrote a Javascript that contains the needed functions for
building the search Index. When the HTML-file that should realize the
search is opened, the script I built with Delphi is opened and
executed, which calls the functions in the other Javascript and
generates the serach index in the working memory.

In Firefox, the script runs fine, but in IExplorer 7 I get an error
message stating an error in line 32769 of the Delphi generated script.
There is absolutely no error in this line, and I guess it has more to
do with some code line limit, because 32768 is a power of 2.

Is this a known Internet Explorer issue? WHat should I do as a work
around? subdivide the script in multiple scripts, each not longer than
32768 code lines, and than write a wrapper script that calls those
subdivided script?
Yes, it is a known issue in IE.
<URL:
http://groups.google.c om/group/microsoft.publi c.scripting.jsc ript/browse_thread/thread/fcb104c0dbd08fb e/49ce2e37e7e980c 6?q=32768&lnk=o l&>

The simplest work around would be to have Delphi count the lines. When
it reaches thirty thousand or so insert a function like so:

function IEFix(){}

And then continue on with your lines.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 16 '07 #2
On Apr 17, 12:54 am, Randy Webb <HikksNotAtH... @aol.comwrote:
ckirc...@direct media.de said the following on 4/16/2007 5:29 PM:
Hallo,
my task is to establish some kind of full text file search in
Javascript. The files and it's contents are fixed, the HTML/JavaScript
pages lie offline on a server.
As far as Javascript cannot access files via any i/o operations, I
have written a routine in Delphi. It parses files in one folder and
generates a Javascrip tfile. The first lines build up a file table,
then the word index is build.
Example:
addTable("Filen ame1.txt")
addTable("Filen ame2.txt")
...
addTable("Filen amen.txt")
addIndex("Word1 ", "1,5,9")
addIndex("Word2 ", "30,156,100 2")
...
addIndex("Wordn ", "40")
This script can be rather huge when there are lots of files and lots
of different words in those files. An example script I generated had
approx.160.000 lines.
In additon I wrote a Javascript that contains the needed functions for
building the search Index. When the HTML-file that should realize the
search is opened, the script I built with Delphi is opened and
executed, which calls the functions in the other Javascript and
generates the serach index in the working memory.
In Firefox, the script runs fine, but in IExplorer 7 I get an error
message stating an error in line 32769 of the Delphi generated script.
There is absolutely no error in this line, and I guess it has more to
do with some code line limit, because 32768 is a power of 2.
Is this a known Internet Explorer issue? WHat should I do as a work
around? subdivide the script in multiple scripts, each not longer than
32768 code lines, and than write a wrapper script that calls those
subdivided script?

Yes, it is a known issue in IE.
<URL:http://groups.google.c om/group/microsoft.publi c.scripting.jsc ript/bro...>

The simplest work around would be to have Delphi count the lines. When
it reaches thirty thousand or so insert a function like so:

function IEFix(){}

And then continue on with your lines.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptT oolbox.com/bestpractices/
Thanks very much, Randy. I tried that, but unfortunately I got the
same error. Did I understand you correctly? You suggest to simply
insert the definition of a dummy function every thirty thousand
lines?

Best regards,

Christian

Apr 17 '07 #3
ck******@direct media.de said the following on 4/17/2007 4:55 AM:

<snip>
Thanks very much, Randy. I tried that, but unfortunately I got the
same error. Did I understand you correctly? You suggest to simply
insert the definition of a dummy function every thirty thousand
lines?
It seems that when that thread was going on that the IEFix() function
seemed to clear the errors. I will try to test it some more tonight and
post back about it. It may take breaking it up into separate script blocks.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 17 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4730
by: Hal Vaughan | last post by:
Is there a maximum length for Javascript program lines? What about strings? Is there a limit on string length? I found some references that said the maximum string length was 256 characters, but I have a program that created a string of over 25,000 characters (the browser was Konqueror). Are there limits on these lengths? If I require a newer browser for the program I'm writing, would that change the situation?
2
28601
by: Kums | last post by:
What is the maximum permissible size of a database? Is there any limitation. What is the maximum # of tablespace's allowed in a database? Thanks for your response.
15
12139
by: Lauren Wilson | last post by:
Access 2K dim MyStr as string What is the maximum amount of text or bytes that this variable can store? Does anyone know?
3
8546
by: Kriston-Vizi Janos | last post by:
Dear Mr. Kern, and Members, Thank you very much for the fast answer, my question became over-simplified. My source code is appended below. It uses two text files (L.txt and GC.txt) as input and merges them. Please find these two files here: http://kristonvizi.hu/L.txt http://kristonvizi.hu/GC.txt
2
1920
by: ArtOfSpeech | last post by:
hi.... Can anyone tell me plz how to set a maximum number of (lines) to a rich text control and show only last linse when number of lines exceeds the maximum number??? i've tried to use richtext.lines array to determine lines length but i can remove from it cause its of system array type and is length fixed which means i cant add or remove elements from it...
29
5115
by: garyusenet | last post by:
I'm trying to investigate the maximum size of different variable types. I'm using INT as my starting variable for exploration. I know that the maximum number that the int variable can take is: 65,535. But i'm trying to write a program to test this, assuming I didn't know this number in advance. I came up with the following but have two questions. Maybe someone can help? using System; using System.Collections.Generic; using System.Text;
6
10706
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I'm using the VScrollBar and set it as follow: m_vScrollBar.Minimum = -19602; m_vScrollBar.Maximum = 0; m_vScrollBar.SmallChange = 1; m_vScrollBar.LargeChange = 1089; m_vScrollBar.Value = m_vScrollBar.Maximum; The scroll bar is set to start from the bottom.
7
1178
by: Curious | last post by:
Hi, I need advice on how to set the maximum property of my progress bar. I read a huge file so I need a progress bar when I read it. However, I don't know how many records are there in the file until I finish reading it. Anyone can advise me on how to set accurate maximum?
53
12131
by: Gianni Mariani | last post by:
Do you have a preference on maximum line width for C++ code? I've seen the craziest debates on this most silly of topic. I have witnessed engineers spent oodles of time fiddling with line breaks just to get it right. I find in general a prescriptive rule makes for markedly less readable code, which unfortunately is a subjective argument, however, the waste of time modifying code when it does not need to is not.
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9499
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5404
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5539
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4076
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.