06-27-2012, 03:29 AM
(This post was last modified: 07-12-2012, 02:05 PM by Omniscient.)
[VB.NET]GeoIP Using XML[Source]
|
06-27-2012, 11:36 AM
thanks Ch4ng3m3 i was looking for this code.
06-30-2012, 01:05 PM
I'm not clicking that adfly link for you. I'd be surprised to see if these 2 members are not one in the same.
07-02-2012, 07:00 AM
complaint and complaint..?... mind your own business kid
07-02-2012, 04:25 PM
07-02-2012, 07:19 PM
07-02-2012, 08:35 PM
I haven't looked at the link yet, but if it's just source, then why not post it in a code tag? You're still a new member here, so your reputation in terms of trust among other things around here is still low. You're not going to gain respect here by posting your first 5 or so posts here as adfly links.
07-03-2012, 12:53 AM
Here's the code.
Code: Imports System.Xml
If you are willing to join SF Webmasters.
07-03-2012, 08:06 PM
(This post was last modified: 07-03-2012, 08:07 PM by AceInfinity.)
The method you have here is practically useless unless somebody else has your exact setup, you could have simplified this much further as well, and used parameters (that's what they are there for, and this is a prime example of where it could be useful to have some).
If you're going to release a source like this you should expect some feedback, whether it's good or bad. I would have also used a class for this, another prime example of where it could be useful. Maybe not in your mind for something so simple, although what if now you have a program that keeps track of multiple geolocations? You're going to do that all manually? What about multi-threading here? Code: For i = 0 To xmlnode.Count - 1 That would be the equivalent of For i = 0 To 0 here in this case lol Also you have a stray line here which doesn't do anything: Code: xmlnode(i).ChildNodes.Item(0).InnerText.Trim() Code: Dim i As Integer You don't have to do that here... If you want to loop through all nodes and childnodes of those nodes you'd do something like this: Code: For i As Integer = 0 To xmlnode.Count - 1 Otherwise, since we know here that there is only 1 xmlnode (xmlnode(0)), then we could avoid this loop entirely as we also know how many childnodes there is. It really doesn't do you any good to use a loop if you're going to write all of the values out manually like that anyways lol. So you'd be better off just not using the loop. If you want to use a loop though then you'd do what I suggested above. I would have done this like so: Code: Private Function GetGeoLocation(IP As String) As GEOLocation Now say we could return multiple GeoLocations for some reason from this website, then I would create a List(Of GEOLocation) and return that from the function for each iteration through the nodes after all childnodes have been looped through. But that's not the case, so perhaps a loop here is overkill. Regardless, there's still many anomalies in the code i've seen there... Not good. One last thing, don't ever name your variables with the names of existing Classes from the .NET namspaces you've referenced. VB is case-insensitive: Code: Dim xmlnode As XmlNodeList XmlNode is already a Class: http://msdn.microsoft.com/en-us/library/...lnode.aspx The reason i'm using a class with properties there is for encapsulation of the Trim() method, you could create a function to do whatever you want with the input strings before setting the values in stone, so this was just a demonstration, I wouldn't repeat that though if it's anything more complicated than Trim(), create a function to do it and return a modified value if you want. |
« Next Oldest | Next Newest »
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Free Advanced Port Scanner SOURCE [ VB.NET ] | Filefinder | 6 | 5,750 |
01-22-2013, 04:27 AM Last Post: TalishHF |
|
[VB.NET]Console app Menu example (amortization calculator)[Source] | KoBE | 8 | 8,172 |
12-28-2012, 06:55 AM Last Post: mouse719 |
|
[VB.NET] Get Region Info [Source] | ƃu∀ ıʞƃu∀ | 0 | 1,254 |
11-28-2012, 04:38 AM Last Post: ƃu∀ ıʞƃu∀ |
|
How To Make And Use A Builder And Stub. [VB.NET] [Source] | Vorfin | 35 | 23,289 |
11-25-2012, 10:34 PM Last Post: ƃu∀ ıʞƃu∀ |
|
[Source] Tricks Using PictureBox Control [VB.NET] | Fragma | 8 | 6,500 |
11-25-2012, 10:32 PM Last Post: ƃu∀ ıʞƃu∀ |
Users browsing this thread: 3 Guest(s)