[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Tree Assistance

Posted on 2006-11-20
13
Medium Priority
?
230 Views
Last Modified: 2016-08-29
Fernado,
Here is the new posting for the previous thread. I uploaded the data, which includes the tool and source data as a attachment to this question.
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_22043310.html


Thank you for all your help,
Gr8life
0
Comment
Question by:gr8life
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 17985458
Hi Gr8life;

I ran your program and all the lines in the file c:\results\SkeletonKey\SkeletonKey20061121.txt stated that the IP was not in the database. I also noticed that you had combined the original files in the resource directory into 1 file with the  fields 1-4 having valid data and fields 0, 5-6 having a value of s which seemed to be OK because fields 0, 5-6 are not used in the code. I commented out the combined.latest file and uncommented the original files and re-ran the program and found that out of the 804 entires in the  Altered Data.txt file approximately 154 now were entries with Not In Database and 650 with valid entries in it. I then wrote a small program to convert the 4 files in the resource directory into a single file and re-ran the program and got 154 lines Not In Database and 650 with valid entries. I suspect that your combined.latest file has errors in it although the format looks correct. I did see a entry that the IP address was the same in both combined.latest file but had a different country code and a different field 4 which is used to find the length of the range of IP's. I have upload the following 3 files NewCombined.latest, my version of the original 4 files, NotInDatabase.txt, the list of all the Not In Database entries and SkeletonKey20061121.txt.

Please check this out and let me know what you find out with the 150 Not In Database entries.

    https://filedb.experts-exchange.com/incoming/ee-stuff/1459-TestResults.zip

Fernando
0
 

Author Comment

by:gr8life
ID: 17990626
The reason I made the combined.latest file was to make it easy to find problems, like IP addresses that are not in the database.  I used newer data than what was in the original file, because IP ranges are constantly changing and the database needs to be reflective so the results are as accurate as possible.  I looked at the data in the not in database file and it appears some of the IP ranges are not in the NewCombined.latest file.  I did find some with ranges that were in the database, but reported not in database.  I think I found the problembut,  I'm not sure if the problem is the building of the tree or the traversal of the tree. I need to research a little further to be certain.

Thanks,
Gr8life
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:gr8life
ID: 17997697
Is there a way to output the tree structure once it is populated with data to examine it for building errors?

Thanks,
Gr8life
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 17998109
Hi gr8life;

I have found this tool to be excelent UltraCompare, it is a stand alone tool or can be added to there other products as a add in. You can download a trial version to see if you like it.

        http://www.ultraedit.com/index.php?name=Content&pid=34

UltraCompare Professional is a powerful compare/merge application loaded with features to enable users to track differences between files, directories, and .zip archives! File Compare features include text and binary compare of two or three files at a time and users can merge differences between compared files.

Folder Compare supports comparison of local/network directories (and subdirectories with recursive compare) and .zip archives as well and users may merge differences between them. With automatic integration with UltraEdit-32 or UEStudio '05, UltraCompare Professional is a tool no user should be without!

Fernando
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 17998126
Sorry posted this one to the wrogn thread.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 17998143
To this question, "Is there a way to output the tree structure once it is populated with data to examine it for building errors? ", Let me take a look at how this may be done.

Fernando
0
 

Author Comment

by:gr8life
ID: 18007982
I was able to locate a C++ recursive code snippet.

http://www.fredosaurus.com/notes-cpp/ds-trees/binarytreetraversal.html

void print_inorder(tree_node *p) {
    if (p != NULL) {
        print_inorder(p->left);  // print left subtree
        cout << p->data << endl; // print this node
        print_inorder(p->right); // print right subtree
    }
}

Not sure if this approach could be applied.
Also I will be on vacation until November 28.

Thank you for your time and hope you have a great holiday,
Gr8life
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 18012946
Hi Gr8life;

I had to make a change in the IPCountryLookup.vb and BinaryTrie.vb classes in the project. When I was converting the code I ran into the situation where in C# if you add to an integer variable which would exceed the max value it would overflow and make the value negative but in VB it throws an error. So what I did was to simulate the C# in VB and the results were the same. The problem comes in when doing the reverse. So to properly correct the issue I just used a data type of long so that the calculations would not cause an overflow. So I made the code in VB to the same in C3 except I used a long for one variable.

I put together a package to print the Trie to a log file. The below link is that project with the corrected IPCountryLookup.vb and BinaryTrie.vb. Use those two file in your SK Tool project.

        https://filedb.experts-exchange.com/incoming/ee-stuff/1510-IPLookupTri.zip

Sorry about the blunder. ;=)

Fernando
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18015430
Hi Gr8life;

I have looked at the problem with the program after I made the last correction which I have posted above and this is what I have found. I have single stepped through the program looking at how the Trie was being built with an address that should have been found in the table but was not, the address was 12.106.65.236. The way the Trie is built is that it uses the first two parts of the IP to find the index into the main root node of the Trie that should hold this address; the Trie has 65536 such root nodes. In this case 12.106, bit shifting the first part of the address, 12, 8 bits to the left will result in a value of 3072. Now adding the second part of the address to the first part results in an index of 3178 in the Trie array of nodes. Now the range of valid IP’s is determined by the IP address plus the field 4 of the line from the file, for example:

s|US|ipv4|12.106.65.88|182040|s|s

The above line is from your combined.latest file. Note that field 4 has a value of 182040 and needs 18 bits to represent it but only 16 are available for use and so the way the Trie is written it will use the base address itself to store the node. Therefore when you go to see if the node 12.106.65.236 is valid it will not find it because the Trie only knows about 12.106.65.88.

I did not verify that all of the approximately 500 values that were Not In Database were for the same reason but what I did do was to download the most current versions of the files from “The Address Supporting Organizations” web site  at http://aso.icann.org/stats/index.html and used them in place of your combined.latest file. The result was that the file your program creates did not have 1 “Not In Database” message in it.

I hope that this was of some help to you.

Fernando
0
 

Author Comment

by:gr8life
ID: 18051447
Thank you for all your help.  

I am going to look at the changes tomorrow and again THANK YOU!!

Gr8life
0
 

Author Comment

by:gr8life
ID: 18092943
Works excellent

THANK YOU VERY MUCH!!
Gr8life
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18095297
No problem, always glad to help. ;=)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question