Understanding structure of a URL

I need to extract the "domain name" part of a URL.
For example given the URL:
http://forum.java.sun.com/
I need to extract "sun" from the URL. However this is not easy as using java's inbuilt getHost() function, returns "forum.java.sun.com" - more than I need.
One approach I was looking at was to delete anything that occurs after the last dot to remove the ".com" however what happens when you have a URL ending in ".co.uk" (two dots)? And how could you distinguish between the actual domain name and a subdomain?
Basically I have thought about the problem for a while and am not getting anywhere fast, has anyone else tried to solve such a problem?
Any help is appreciated,
thanks

This seems alot of work for something that youdon't
really need to do.
I would suggest doing it more like browsers do it
(for cacheing).
Take the page - get a hash for it - then make amap
mapping the full url to the hash. Store all thefiles
in a directory using the hash as a name. Store the
map as an index somewhere. It could even really bea
properties file.I am going to be storing thousands and thousands of
pages, would this implementation make locating a file
harder (take longer)? I liked the idea of have a
structured mechanism for saving each page by URL,
rather than having every page saved in a single
folder.
However having said that, if your idea would be just
as efficient, could you explain it a little further?
I'm not too familiar with hashsets etc - is there any
chance of two pages being given the same hash for
example?
ThanksAs a guesstimate it would be faster. Because you would be using a Map of keys (URLs) to values (files).
By hash you could just get the hashcode for the object. It is possible to have collisions (duplicates) but if you used something like the URL String they are unlikely to happen unless the URL is actually the same.
Even so you could check for collisions and if they exist then just append a 1 or something to the end of the hash (as a String). Prob sol. Because you will never use the hash again. After the file is created the hash is stored only as the value where the URL is used as the key.

Similar Messages

  • Please send me a ticket sample view so that I understand , structure of tik

    please send me a ticket sample view so that I understand , structure of ticket,
    Points will be awarded,
    Jagrut Shukla

    Here is an eg of a ticket raise:
    End user is not able to 
    1. Create Sales order for a customer from a New plant , since shipping point determination is not happened . ( Without Shipping point the document becomes INCOMPLETE and he will not be able to proceed further like DELIVERY, BILLING).  
    He raises a ticket and the priority is set in one of the below:
    1. Low  2. Medium  3. High.
    Now you need to solve this ticket. You would analyze the problem and identify that the SP configuration has to be done for the new plant.
    You would request a transport for DEV CLIENT to BASIS. You do the change and Request one more Transport to BASIS for QA client. The End user will test the same by creating a sales order for the new plant and approve it.
    Finally, you request a transport to move the changes to PRODUCTION. Once the change is deployed in production the TICKET is closed.  What I have given is a small example. You would get some real issues with severity HIGH in your day-day support.

  • Configuring folder structure for custom url contents

    Hi Experts,
    We are trying to create a custom help link similar to the standard help links provided by SAP (example:  http://help.sap.com/saphelp_xrpm400/helpdata/en/AD/815F4283F26255E100000000A155106/content.htm).
    Our custom help link should look like this: http://help.mycompany.com/xrpm450/en/AD/815F4283F26255E100000000A155106/content.htm
    To achieve this we are following a SAP FAQ Note: 991559
    Based on the solution provided in this note for Q.4 we have implemented the following steps:
    Proposed solution by SAP:
    Yes it is possible to configure custom help. For instance, the default xRPM help doc url for Item Details looks like this: http://help.sap.com/saphelp_xrpm400/helpdata/en/AD/815F4283F26255E100000000A155106/content.htm
    The value of "http://help.sap.com/saphelp_xrpm400/helpdata/" and
    "http://help.sap.com/saphelp_xrpm450/helpdata/" is maintained in property sheet of com.sap.xapps.cprxrpm.common.component.CommonComp. To change the value to custom url, please follow the steps:
    1. log in to J2EE Visual Administrator
    2. go to J2EE instance -> Server -> Services -> Configuration Adapter
    3. at right panel, click on webdynpro -> sap.com->xappscprxrpmcommon-> Components -> com.sap.xapps.cprxrpm.common.component.CommonComp -> Propertysheet.profile
    4. Open Propertysheet.profile, replace default value for SAP_HELP_URL with custom help url, such as http://help.mycompany.com/xrpm400/
    5. Set up required folder structure such as /en/AD/815F4283F26255E100000000A155106/, and create content.htm with your custom help content.
    Now the complete path for custom doc could be: http://help.mycompany.com/xrpm400/en/AD/815F4283F26255E100000000A155106/content.htm
    However, in the 5th point SAP has mention about creating a folder structure like /en/AD/815F4283F26255E100000000A155106/ . We created this folder. However, we cannot access this folder through http url.
    Please let me know if any extra configuration needs to be done after creating this folder structure.
    Thanks & regards,
    Sujit

    Hi Experts,
    We are trying to create a custom help link similar to the standard help links provided by SAP (example:  http://help.sap.com/saphelp_xrpm400/helpdata/en/AD/815F4283F26255E100000000A155106/content.htm).
    Our custom help link should look like this: http://help.mycompany.com/xrpm450/en/AD/815F4283F26255E100000000A155106/content.htm
    To achieve this we are following a SAP FAQ Note: 991559
    Based on the solution provided in this note for Q.4 we have implemented the following steps:
    Proposed solution by SAP:
    Yes it is possible to configure custom help. For instance, the default xRPM help doc url for Item Details looks like this: http://help.sap.com/saphelp_xrpm400/helpdata/en/AD/815F4283F26255E100000000A155106/content.htm
    The value of "http://help.sap.com/saphelp_xrpm400/helpdata/" and
    "http://help.sap.com/saphelp_xrpm450/helpdata/" is maintained in property sheet of com.sap.xapps.cprxrpm.common.component.CommonComp. To change the value to custom url, please follow the steps:
    1. log in to J2EE Visual Administrator
    2. go to J2EE instance -> Server -> Services -> Configuration Adapter
    3. at right panel, click on webdynpro -> sap.com->xappscprxrpmcommon-> Components -> com.sap.xapps.cprxrpm.common.component.CommonComp -> Propertysheet.profile
    4. Open Propertysheet.profile, replace default value for SAP_HELP_URL with custom help url, such as http://help.mycompany.com/xrpm400/
    5. Set up required folder structure such as /en/AD/815F4283F26255E100000000A155106/, and create content.htm with your custom help content.
    Now the complete path for custom doc could be: http://help.mycompany.com/xrpm400/en/AD/815F4283F26255E100000000A155106/content.htm
    However, in the 5th point SAP has mention about creating a folder structure like /en/AD/815F4283F26255E100000000A155106/ . We created this folder. However, we cannot access this folder through http url.
    Please let me know if any extra configuration needs to be done after creating this folder structure.
    Thanks & regards,
    Sujit

  • Trying to understand structured Framemaker

    I want to start a very simple structured Framemaker file, so I can see how it works.
    If I select File > New > Explore Structured Templates > Book > Chapter
    and I save that file as Chapter,
    1. WHERE do I get the EDD from?
    The Chapter will compile as an epub.

    Use StructureTools > Export Element Catalog as EDD to create an EDD from the document's internal element definitions.
             --Lynne

  • Major trouble understanding structure

    Hello,
    This is my first time creating a Photoshop Plugin, and I am having a lot of trouble understanding how to do it. I am using Microsoft MFC to create it. Does anybody know of good references or sample code to look at? I simply don't get how to create this!!!
    I am trying to do a filter plugin that will let the user select a particular color, and turn all other colour in the image to black and white.
    Thanks.

    There is one MFC sample in the SDK. It doesn't sound like you are having trouble with MFC per say but more about getting pixels in and out of Photohsop. Where exactly are you having troubles? Maybe the Dissolve sample will help you out but it uses OS (Win32) API's and not MFC.

  • JavaFX image url

    Hello everybody!
    I have troubles understanding the way image urls work in JavaFX.
    The tutorials only use __DIR__, which of course references the package the script lies in or an absolute URL.
    But i dont want to place an image folder inside my package structure but on project level instead.
    Is there something like e.g: "platform:img/image.pgn" ?
    or is it absolutely necessary to place images inside the package itself?
    Thank in advance for your answers!
    Flowqi

    you can use an image URL instead of __DIR__ and path of image
    Stage {
        scene: Scene {
            width: 500
            height: 400
            content: [
                ImageView {
                    image: Image {
                        url: "http://farm2.static.flickr.com/1357/855466139_2c7537e555.jpg"
    }

  • Tree Structure Implementation in Java.

    1>
    How should i implement a "Tree Structure" in Java Based application.?How would i map the entries to the database table?how many tables will i require for this implementation.?
    List records<String> = new ArrayList<String>();
    records.add("null");
    records.add("Product");
    records.add("Category");
    records.add("P1");
    records.add("P2");
    records.add("P3");
    records.add("C1");
    records.add("C2");
    records.add("C3");
    so how should i implement a Tree Structure for the above record set.
    //P1,P2,P3 belong to Parent {Product}
    //C1,C2,C3 belong to Parent {Category}
    Sample code provided will be helpful

    How should i implement a "Tree Structure" in Java Based application.?The quotes suggest you don't know what a tree structure is, regardless of the development language. Fix that first (your understanding of what a tree structure is). [url http://en.wikipedia.org/wiki/Tree_structure]Here is probably a good start.
    How would i map the entries to the database table?how many tables will i require for this implementation.?It depends on what your tree structure represents, in particular it depends on whether the leaves and intermediate nodes of the trees have are homogeneous (e.g. have a common interface). There is no general rule.
    I suggest you start by looking in the Java API at all the classes whose names start with 'Tree' (TreeSet and TreeMap are probably the best ones to start with) and read the documentation carefully. Then try to write some code that uses one and come back if/when you have any problems.(sorry Winston) I think this is a very bad advice.
    These classes are particular implementations, respectively of a set (in the mathematical sense) and of a map (associative table), which happen to use a "tree structure" for their internal business. Their API doesn't help building a custom "tree structure" (they may be used that way, but it's certainly not the easiest nor even a particular handy way to build tree structures).
    Maybe their implementation may be a good example of how to build a Tree structure, but they use a particular type of tree (+red-black tree), not a general one. This may or may not be the OP's case, I wouldn't bet on it.
    OP you're welcome to come back with more specific questions and details. Good luck with Java.
    Edited by: jduprez on Oct 16, 2010 2:45 PM
    Edited by: jduprez on Oct 16, 2010 2:49 PM
    After checking the Javadoc: indeed TreeSet only uses a TreeMap for its implementation, so the only one out of the two which does directly uses a tree structure in its implementation is TreeMap.
    Edited by: jduprez on Oct 16, 2010 2:51 PM
    And, to reiterate, I stand by my claim that TreeMap is not a good example of a general Tree structure: in particular it uses a tree to map keys to values, its main business is the "mapping" part, not the tree as a storage medium. Neither the keys nor the values know anything about their "children".

  • A PDF document with links to other PDFs corrupts the URL and get 404. Works in IE.

    One of our supplier sites has manuals online that are PDF docs with links from one to another. For example, when I click on "Tanaka" I get a PDF menu of Tanaka service manuals, etc. When I click on a section, such as "Chainsaw" I get a 404. Part of the directory structure in the URL is missing. For example when in the Tanaka PDF menu I click on Chainsaw I go to http://www.parklands.net/Resources/Tana%20CSaw%20Menu.pdf which is wrong. It should be http://www.parklands.net/Resources/Tanaka/Tana%20CSaw%20Menu.pdf, and in IE it is.
    == URL of affected sites ==
    http://

    The linked documents will not be automatically converted to PDFs and merged
    with your file, neither in Acrobat Standard nor in Acrobat Pro. You can do
    it, but you'll need to do it manually by converting all the files to PDFs,
    merging them and then adding the links between them.

  • Is it possible to change the URL of an application?

    Hi All,
              I was working with the oracle apex and created few applications almost a year back, due to my higher studies there is a gap with the tool..and finally I am in.
    Am planning to create an application which will be similar like a personal website.My doubt here is ..whether it's possible to change the URL by keeping a simple one which includes my name also
    instead of having this big..
    http://apex.oracle.com/pls/apex/f?p=10221:1:116416608594529
    I can understand that the whole URL describes the appln no,page no and session ID but its my doubt possible or not..If possible then how to proceed?
    Thanks
    with Regards,
    Ramya.

    My doubt here is ..whether it's possible to change the URL by keeping a simple one which includes my name also
    instead of having this big..
    http://apex.oracle.com/pls/apex/f?p=10221:1:116416608594529
    I can understand that the whole URL describes the appln no,page no and session ID but its my doubt possible or not..If possible then how to proceed?
    If you are just looking for a nice and short URL to start your application, why not just use a URL shortener service like goo.gl ?
    Just put in your long URL and it will create a nice and short URL for you... for example, the above URL is now http://goo.gl/FijYxn
    - Morten
    http://ora-00001.blogspot.com

  • How to display the image which in KM folder using url iview

    Hi Friends
    How to display the image, which is under KM folder structur using the url iview.
    i trying using url iview url as  \document\testfolder\abc.jpg as url for the iview.
    but its now working .. so please help me how to slove this problem
    If is not the correct way then please suggest me best way to achive this.
    Thanks
    Mukesh

    Hi Mukesh,
    I think this may work,
    1, Create a HTML Layout.
        You can put your image wherever  u want with HTML Codes.
        Check this, [Article|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3915a890-0201-0010-4981-ad7b18146f81] & [Help|http://help.sap.com/saphelp_nw04/helpdata/en/cc/00c93e9b2c3d67e10000000a114084/frameset.htm]
        With this, u can use the standard KM commands also.
    2, U need to use KM Navigation iView for this rather than KM Doc iView.
    3, In the Nav iView, u can use &rndLayoutSet=nameOfUrHTMLLayout to force the view with this new layout.
    Regards
    BP

  • Referencing the default region via URL

    I need to expand the URL region= call to work with a template. I am creating a template for my users that will allow them to upload a file to the default region of the page. Normally I would simply use the region id, however, I do not want the file uploaded to the template, but to the region of the individual pages.
    Is there a way to dynamically generate the region id? Is there a region=DEFAULT option? Can anyone help?

    The Problem when used in conjuction with a template is that an item added to the template give the TemplateID instead of the pageID when you specify the associated function. The solution is to figure out the page ID yourself instead of passing it to the procedure. You can use the following code to do this:
    v_page := p101202_050720.wwpro_api_parameters.get_value('_pageid','a');
    v_page := substr(v_page, instr(v_page, ',')+1);
    This code is meant as a sample ... if you have tabs you will need to further substring to just get the pageID ..wwpro_api_parameters.get_value('_pageid','a'); returns in the following format:
    pagegroupID,pageID
    if there are tabs then:
    pagegroupID,pageID,tabID
    Please keep in mind that scraping the page off the URL is not a supported use of this procedure and may break in future release if Oracle changes the structure of the URL.
    Hope this helps,
    Candace

  • OBIEE Dashboard URL is navigating to a different path than specified

    I have been using the Dashboard URL for some time now at a client with no problems. All of the sudden, something started happening that I am having trouble reproducing. I am essentially relying on SSO to authenticate the user, so I do not have the need to pass the username/password through the query string. All I am passing is this:
    http://foobar/analytics/saw.dll?PortalPages&PortalPath=/shared/Real Estate Reporting/_portal/REPORTS: Financial Reporting UAT/&Page=DR - 3&Action=Navigate
    All of the sudden, I started noticing an error:
    Path not found: /shared/Reporting Samples/_portal/Exective Dashboard/blah/blah
    I do not understand why the Dashboard URL is trying to traverse down the path above when it has nothing in the link referencing Reporting Samples or Executive Dashboard. Another quirk is if I navigate through the UI to the correct dashboard and then try and use the Dashboard URL, it will navigate to it just fine. Once I am able to get the Dashboard URL to work properly, it works for about 1 day, and then when I come into work in the morning, I get the Path not found error again.
    Does anyone have any insight into this? Again, it is completely random, and I wish I had more information on reproducing this issue, but I am having trouble pin pointing the problem.
    Thanks.

    It was built from a blank catalog.
    One thing is that the folder that contains all the dashboards that I am trying to point to is owned by a user (and this user is not me, it is the BI Developer). I am doing portal development and accessing OBIEE through web services. So essentially, I am traversing the web catalog and getting report paths so that I can build a dynamic Report List Portlet. This all works great, and the report paths are accessed fine.
    The problem arises when the browser actually tries to access the Dashboard through this URL (from an html <a> tag), it occasionally navigates to a completely different path (the one I mentioned above). Should I try setting my user as the owner of the web catalog folder? I am just hesitant to do that since I have full admin access to all the dashboards, and it doesn't seem like this would make a difference. Eventually, the web catalog folder will be owned by a service account.
    Thoughts?

  • Possible? Recreate my original Homepage pages into iWeb but retain old URL?

    I have Tiger in the box and still have to install it.
    I just bought iLife '06 today and will install it after installing Tiger.
    I already have a .Mac homepage up — created with Homepage Manager.
    I am thinking now that I would like to recreate that original homepage but do it with iWeb.
    How do I end up with my original homepage pages all re-done into iWeb templates but retain my original .Mac homepage URL? All my friends know that URL. Could someone please explain?
    — Lorna in Southern California

    Well really it's not OR but AND. If you want to do away with your old >homepage-style pages and send people to your iWeb pages via the old URL, >then you must put the redirect on the old pages.
    Or you could leave the old pages up but add a link that says "Here's my new homepage..." or something like that...
    Hi... I see you live in Florida — and hope you are not in any of the traditional hurricane paths!
    I think that I want to start copying/recreating my Homepage pages into iWeb pages and accept that I will have a new URL someday in the near future (because I intend to do the copying as fast as I can and not stop). I can send a notice out and change a few other things. However, I have questions for that interim time when I am working on the iWeb pages but not finished with them.
    While I am working on iWeb pages, I am given a new URL, right? And thus, I would at that point have two URLs with .Mac. Is that possible? As I see it, the first URL would be the one I have now, which is the address of my present .Mac Homepage Manager Homepage. And the second URL, wouldn't it be the URL of the iWeb pages? That's possible???
    I understand the concept of having a redirect page from my original Homepage ultimatly to the new iWeb page, but is it an automatic redirect or one which the viewer can activate if he wants to? I would not want a redirect page to quickly, blindly switch a visitor from the old Homepage to the new iWeb pages which are incomplete.
    I don't understand the mechanics of URLs. I don't know what a Redirect Page looks like or how it works and I don't see how I could be working on my new iWeb pages with its new iWeb URL, all the while leaving my present Homepage alone, viewable by visitors with ITS OWN URL.
    [several minutes passed]
    And now that I have sat here and thought for several minutes, it seems that the easiest thing to do would be to have no redirect page for a while. All that I ask in that case is: Is it possible to do that? Is it possible to have my old/present Homepage viewable while I am working on my iWeb pages?
    I think I just solved one of my questions all by myself. If I begin to work on iWeb I will be given a new URL — an iWeb URL. Thus technically, when I Edit and Publish in iWeb, technically, people could view those pages, but chances are they will not if I don't announce the new iWeb URL to them. OK. I see......
    I am asking all of this now because I am the type that needs to envision and understand a project from start to finish before I start. I do not like surprises — and cyber surprises have the ability to unsettle me.
    Could someone please realign my erratic thoughts? Are my goals possible? Can I have my present .Mac Homepage Manager Homepage viewable and visitable while working away on copying them to my new iWeb site? (I bought iLife '06 yesterday and will install it and Tiger today. Tiger first and iWeb'06 second, as instructed.)
    — Lorna in Southern California

  • How to find table for structure field ???

    Hi..
    i need your expert help on this.
    i am working on printing of terms of payment description. here there are explanation fields. it is coming from structure R052. and field name is TXT 02. here as per my understanding structure is coming from multiple tables so how i can find that from which table this field is coming??
    thanks
    h shah

    Dear,
    Well I cant say this is the solution for your issue, but have a look.
    http://it.toolbox.com/wiki/index.php/Find_data_in_your_SAP_system_and_know_which_tables_do_what
    DD02L - table properties
    DD02T - table texts
    DD03L - field properties
    DD03T - field texts
    How to find data related to a structure? With GREAT difficulty, but here are some ways (which will NOT work sometimes) to find specific fields if you know the structure's fieldname.
    1) First, goto SE11, and enter your structure name. Goto the field that holds your data, and double-click on the element name. Once inside the element, do a where-used list for that element, searching tables only. Then go into each table, and see if you can find the one holding your data. There may sometimes be a huge number of tables displayed, but a lot of them will be empty.
    2) Get the name of the program behind your transaction, goto SE80, and enter the program name. 99% of the time it will be part of a module-pool and bring up the pool. Goto the dictionary structures, and search each table there for the one holding your data.
    3) Open a new session with transaction ST05, select SQL Trace, click on the Trace On button, and go back to your transaction (while leaving the session with ST05 open). Submit your transaction, and go back to the ST05 session. Click on the Trace Off button, then select the List Trace button. Continue with standard selections, and a BASIC TRACE LIST will appear. search thru the tables displayed under ObjectName.
    and have a look at below.
    You do know any transaction in which (related) data is used: 1) start the transaction 2) position the cursor on the field you want to have info about 3) press F1, then F9 4) now you see the technical information of the data element, such as table name and field name. 5) if the table mentioned is what you're looking for, you're done. It is also possible that the data element is in a structure and not in a table. Now you can either analyze the structure via trx SE11, or you can double click on the 'data element' field. In the next screen, use the 'Where used' button to find the tables in which this data element is used.
    Additional tip: if you have found the table name, you can use trx SE36 to see the relationships of this table to other tables. You can use these relationships when defining queries, designing custom ABAP programs, etc. If you're lucky, one or more standard SAP logical database exist which contain the table you found in the previous steps. Proceed as follows: 1) start trx SE36 2) use the search help for the logical database name 3) enter the name of the table in the search help 4) press enter and, if you're lucky, you'll see a list of logical databases. Select one, press enter, select the radio button 'Structure' and press the view button. Now you'll see how this table is related to other tables.
    And finally, I prefer, the simpliest way to contact the ABAP consultant for help.
    Regards,
    Syed Hussain.

  • Difference between Structural and Org. Based Security

    Hi
       Could anyone please explain the difference between Structural and Org. based security
    Also could anyone please point to relevant documents.
    Thanks

    Structural authorization:
    ex: assigning roles to position and not to userids.. Listed below are some links that may help you to get started in understanding "Structural authorization".
    http://www.sap-img.com/human/structural-authorization-vs-role-authorization.htm
    http://www.sap-press.de/katalog/buecher/inhaltsverzeichnis/gp/titelID-1071
    https://websmp205.sap-ag.de/~form/ehandler?_APP=00200682500000001337&_EVENT=DISPLAY&COURSE=ADM940
    HB

Maybe you are looking for

  • HT1386 i am having a problem w/iTunes and iPhone.

    when i hook my iPhone up to my laptop it opens up iTunes. after it gets through syncing i click the arrow by my phone and look under the music. it says i have 465 songs, but on my iPhone i have 365. the songs that i have on my iPhone are correct but

  • WRT54G2 and WRT54G locks-up (freezes) when blocking web sites using Access Restrictions

    I am convinced that a few Linksys routers such as WRT54G2 and WRT54G have a major issue when blocking web sites using Access Restrictions (Internet Access Policy). After a few hours of internet access by 15 wired users the Linksys locks-up and blocks

  • Powerpoint embedded fonts from Windows

    I've got a powerpoint presentation created in Windows. I've saved it with fonts embedded but when I open it on my Mac the fonts are not the same. Can anyone exlpain how to keep this from happening? My real goal here is to get the presentation into Ke

  • Do I have to "enable" icloud on PC to get already purchased music on ipad?

    Does anyone know if I can just login to itunes from my ipad from the same itunes/apple id that I used on my pc....and download already purchased music from my account? OR do I have to install the icloud control panel on my PC first to "enable" icloud

  • Sprite movement using arrow keys

    Hello, I have been working on a dragonball z game recently and I have encountered a problem with the sprites.I have traced the bitmap and everything else and even created a movieclip of the sprite.I have put this code on the movieclip- Code: ( text )