|
Hi all..
this is my first post here..
I'm working on a dictionary for the pocket pc platform.. using .NET CF..
the dictionary is 140,000 words..
ofcourse using Ado.net would run my 128mb ram pocke pc "out of memory"(whether it's xml or readline() with a text file)..
so i tried writing the words to an ordinary text file..
it was like 7mb. i thought that using readline() and ArrayList or String array would do just fine... but this was also not efficient...
it will take about 70seconds to load on 400mhz,128 ram..
my question is.. is there any faster way??
i don't want to use c++ as i'm trying to do all my programs in .Net..
Regards,
|
|
|
|
|
You should check this out:
Its a good site, and if I remember it correctly, that would potentially help you sort out your words. I recognize that that wont help your memory problem though, so I would propose something like this:
Keep them in the external file (I suppose you dont really have a choice seeing as you cant load them into memory). Then, on the first time you load the dictionary (also when you make changse but I will let you figure that out) you can document the spot in the file that they are.
How do you find a word? Keep a subset in memory with this algorithm. When you obtain the closest match, go to wherever you need to, and from there search throught the file.
This is just a guess as to how you could do it thought, Im sure there are much better ways,
Luck,
Jim
|
|
|
|
|
Uhhh... What site?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Wow, it goes to show how baaaaad I am at HTML!
The site was this: http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/opt_bin.html
|
|
|
|
|
first a disclaimer: I have zero experience with PDA apps (Im used to Server Apps where I can almost rely on there be more memory than I could use )
Just wanted to throw an idea out to you, maybe its something you could investigate. It strikes me that what you need is some form of index - so that you can start by making some sort of educated guess as to where the word is.. then you can load a subset of the entire dictionary into memory and search through that for the correct word.
So lets assume you have all the words/meanings in a text file, separated by a newline.
aardvark - An animal
antelope - Another animal
bird - A flying animal
branch - Where birds make their nests
bukakke - er, not suitable
cat - A feline animal
When you install your application, or update your dictioanry data, you could also update/install smaller textfile with an index of where each starting letter begins and ends.. for the above this would be
a, 0, 1
b, 2, 4
c, 5, 5
etc
Now, when you start your app load up the index for future use. When somebody enters a word to lookup, grab the first letter of the word, and query your "index" for the starting and ending location for that letter. Now load up the dictionary data but only store in memory the lines between start->end. Now enumerate this smaller list until you find the right word.
Not sure if this helps but thought it may give you some extra things to think about
|
|
|
|
|
This was the site I was talking about (for ref in my response to this).
http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/opt_bin.html
What J4amieC is proposing is in essence similar to what I am saying. Sadly, if you are doing a lot of things really quickly with this dictionary (eg, you were writing a word document!) this would be far too slow! At least, if your memory were really small. Having a read call every time would be pretty taxing. By having this 'weighted tree' you could likely keep a local copy in RAM (as it could be quite small). Thats not to say you couldnt keep a copy of J4amieCs approach in there too. The nice thing is that his is a lot easier Also, you dont need to calculate the weights the first time through.
|
|
|
|
|
Message Closed
-- modified 22-Dec-14 16:55pm.
|
|
|
|
|
Sorry, can you explain what that restriction was a little better? I dont understand you.
As for speed in accessing the indexed files, dont forget that you can cache them too So if you have a listing that you access all of the time then you might consider building up a cache of those words. Hell, you could even have two caches... a bus... a microprocessor...
^^
Jim
|
|
|
|
|
i can get pixel information using bitmap.getpixel(..) function.
How can i add a semi-trasnsparen color (blue transparent 50%) over another color, that is:
Color myFirstColor = Color.Red;
myFirstColor += Color.FromARGB(50, 0, 0, 255);
That is how can i get a new color got putting over the original color (RED) the new one Blue transparent at 50%?
Thanks
|
|
|
|
|
Christian Graus made a beautiful series of articles on just this topic. Search the articles for "Image Processing" and ye shall find that which ye seeks.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm watching but i've founded nothing about ever if i use pointers.
|
|
|
|
|
I don't understand what your post was supposed to mean. Perhaps in English next time?
The techniques are covered in the code. You'll have to adapt them to your environment.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i have two projects in my c# solution and i want to pass an event from a form in the 1st project (a dll) to a class in the 2nd project (the program).
but the declaration
public delegate void SomeEventHandler();
in the receiving class is obviously not visible to the sending one, so i cant declare a
public event SomeEventHandler Some;
does anyone have an idea how to do this?
thanks a lot,
frank
|
|
|
|
|
Regex(@"[_A-Za-z]+[A-Za-z]\w*") Can it be improved ?
|
|
|
|
|
improved to do....?
|
|
|
|
|
I want to make it smaller and faster.
|
|
|
|
|
Once again, what does this expression DO?
Smaller and faster is directly influenced by the quality of the data that this expression is supposed to parse. If the incoming data is tight and follows formatting rules properly, then you can probably relax the expression a bit. But if the data is messy, your expression is going to have to be written to deal with that mess.
So, unless you get more specific about what this expression is supposed to do and with what quality of data, there's nothing we can do to help you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
It finds all the words which start with _ or letter and contains only _ letters numbers.
|
|
|
|
|
In that case, no, it can't be done any quicker.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
|
Hi,
I have a situation where WIN CryptAPI functions are used in C#.Net for Encryption and Decryption.
System.IntPtr (.NET Type) is used for defining the prototype of the CryptAPI functions at the time of importing the "advapi32.dll" using "DLLImport".
As doing so, will my code be under the control of the CLR i.e Managed Code or will become an Unmanaged Code (Not under the control of the CLR).
I shall be thankful for the following clarification:
When the code written in C#.NET will be Unmanaged?
1. when Win API's are used in C#.NET
2. when System.IntPtr is used.
3. when C# pointers are used.
4. combination of any above.
Thank You,
Subrahmanyam.
|
|
|
|
|
Subrahmanyam Kallakuri wrote:
As doing so, will my code be under the control of the CLR i.e Managed Code or will become an Unmanaged Code (Not under the control of the CLR).
I shall be thankful for the following clarification:
When the code written in C#.NET will be Unmanaged?
1. when Win API's are used in C#.NET
2. when System.IntPtr is used.
3. when C# pointers are used.
4. combination of any above.
None of the above. C# runs in the CLR environment no matter what happens. It can makes calls into unmanaged code (i.e. Win32 API functions) that the CLR can only partially control, like passing parameters back and forth, but your C# code NEVER becomes unmanaged. The CLR, of course, can't control what happens outside of the managed environment, like what the unmanaged function does or doesn't do correctly.
If you call unmanaged code, your code is still repsonsible for calling that code correctly and abiding by the requirements that unmanaged code has. If the caller is supposed to call another function to free resources, then your managed code still has to call whatever function to free those resources. Calling into unmanaged code does NOT magically make your C# code unmanaged.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
is it not supported?
iam getting the following error:
[edited error message as i was feeling lazy to write all text]
System.data.oledb doesn`t support oledb provider for ODBC(MSDASQL)
and the connection which threw the exception is given below:
Provider=MSDASQL.1; Persist Security Info=False;Data Source=Adnan;Initial Catalog=C:\iconfigAlso notice that Initial Catalog didnt add .mdb extension in end
if there is no support then why was it mentinoed in the dataLink Provider list?
the Oledb provider for same Access works fine
kindly guide me
-adnan
|
|
|
|
|
Hi all,
I want to pass chunks of binary data from client to server by http protocol, and I need to write C# for both the client and http.
And I want to ask what is the difference of the following two approaches,
1. using the methodology as in web browser form for uploading files to server (i.e. treat each chunk of binary data as a file)
2. encode the binary data into stream and put at the multipart of
the http stream
Are the two methods actually using the same mechanism or any different between the two ?
Thanks
|
|
|
|