Accessing a webpage from inside a program

Hi there,
I have an html webpage with some statistics.
I wish to write a program that:
- downloads the webpage from the internet and saves it on my computer,
- reads through it character by character like a text file, extracting the bits of interest
- displays them in a nice little window.
Ideally it would run as a "daemon" (I think) in the background, updating itself every x minutes.
I have never written any internet related java programs before, can anyone explain to me how I could carry out the first part or point me in the direction of a suitable tutorial.
I thought one possible (but definitely non-ideal) solution would be to use external command line ftp to download the html page, but that wouldn't be very portable. I had considered writing this program as a firefox extension but I would prefer it to be stand alone.
Thanks for any help,
Austin.

can anyone explain to me how I could carry out the first part or point me in the direction of a suitable tutorial.Sun's Tutorial deals with reading a URL here: http://java.sun.com/docs/books/tutorial/networking/urls/readingURL.html Other sections deal with writing the output to a file (instead of just using System.out.println()).

Similar Messages

  • Is it possible to insert a url link into the itunes description tag. I want the user to be able to access my webpage from within itunes

    Hi,
    Is it possible to insert a url link into the itunes description tag in a feed. I want the user to be able to access my webpage from within itunes
    Thanks

    In the next release, we will be making adding our Measurement Studio components to existing projects much easier, but for now what you would need to do is add the support for Measurement Studio to your MFC project manually as detailed in our Knowledgbase at:
    http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/0cb6707522e92c958625689e0052bb77?OpenDocument
    Best Regards,
    Chris Matthews
    Measurement Studio Support Manager

  • Accessing Sql Server from AS400 Java program

    Hi everybody,
    I am trying to access Sql Server from an AS400 Java program. I have tried various Sql Server JDBC drivers including the Microsoft one but no luck yet. When i try to compile my Java program (with driver file in the classpath) it gives some errors on the driver jar file and also it throws out lots of unreadable text characters. This gave me a feeling that probably its a character coding issue with the jar file, so i tried ftp the file in binary mode as well as copying through the Operations Navigator. But still compilation is giving the same kind of errors.
    Do I need to have some special JDBC Drivers compiled for AS400 specifically. My understanding was that Java is platform independent so any JDBC Type 4 driver will work.
    We are running Java 1.3 on the AS400. Any help on this issue would be great.
    Thanks
    Inder

    Thanks for the help. I am writing a Java program after a long time that's why was making that mistake. Now the program gets compiled correctly but on running the program i am getting the following error message:
    java 001-0070: Exception JVAB544 not expected
    /myjava/test/msbase.jar: 001-0050 Syntax error on Line 1: token ')' not expected
    /myjava/test/msutil.jar: 001-0050 Syntax error on Line 1: token ')' not expected
    /myjava/test/mssqlserver.jar: 001-0050 Syntax error on Line 1: token ')' not expected
    I have no idea what is this error about. Though the same driver files don't give any error when running on a Windows machine.
    Thanks

  • Accessing a binding from inside a servlet

    Hey all,
    So I'm attempting to access a binding from a servlet instead of using the ApplicationModule approach which is recognized as a bad idea (http://blogs.oracle.com/jdevotnharvest/2010/11/when_to_use_createrootapplicationmodule_in_oracle_adf.html). However, when the code is executing in the servlet the line BindingContent.getCurrentBindingsEntry() returns null! I think there's something missing in my configuration that's causing ADFm to not recognize the servlet as having a binding file. Anything stand out?
    So inside of a servlet I have the following:
    public class RSSNewsServlet extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("AllPapers1Iterator");
    Row [] rows = dciter.getAllRowsInRange();
    Web.xml:
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <servlet-name>NewsServlet</servlet-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <servlet>
    <servlet-name>NewsServlet</servlet-name>
    <servlet-class><path-to-servlet>.RSSNewsServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>NewsServlet</servlet-name>
    <url-pattern>/servlet/news.rss</url-pattern>
    </servlet-mapping>
    newsServletPageDef.xml:
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="11.1.1.56.60" id="newsServletPageDef"
    Package="<path-to-pagedefs>pageDefs">
    <parameters/>
    <executables>
    <variableIterator id="variables"/>
    <iterator Binds="AllPapers1" RangeSize="25"
    DataControl="GatewayNewsAppModuleDataControl"
    id="AllPapers1Iterator"/>
    </executables>
    <bindings>
    <tree IterBinding="AllPapers1Iterator" id="AllPapers1">
    <nodeDefinition DefName="<path-to-model>AllPapers"
    Name="AllPapers10">
    <AttrNames>
    <Item Value="PapId"/>
    <Item Value="PapTitle"/>
    <Item Value="PapPublishDate"/>
    <Item Value="PapExpireDate"/>
    <Item Value="PapAuthor"/>
    <Item Value="PapType"/>
    <Item Value="PapIssueDate"/>
    <Item Value="PapFileName"/>
    <Item Value="PapUserName"/>
    <Item Value="PapPostedDate"/>
    <Item Value="PapModifiedDate"/>
    <Item Value="PapNeverExpire"/>
    <Item Value="PapFile"/>
    </AttrNames>
    </nodeDefinition>
    </tree>
    </bindings>
    </pageDefinition>
    DataBindings.cpx:
    <pageMap>
    <page path="/servlet/news.rss" usageId="MyAlmacTemplate_view_newsServletPageDef"/>
    </pageMap>
    <pageDefinitionUsages>
    <page id="MyAlmacTemplate_view_newsServletPageDef"
    path="com.almac.aurora.gateway.pageDefs.newsServletPageDef"/>
    </pageDefinitionUsages>

    when the code is executing in the servlet the line BindingContent.getCurrentBindingsEntry() returns null!The method BindingContext.getCurrentBindingsEntry() returns from the requestScope the variable with key "bindings". When using ADF Faces this variable is set at ADF Faces' Prepare Model phase (by the PageLifecycleImpl.prepareModel() method). But when using a plain servlet this variable is not set (because the ADF Faces' page lifecycle is not executed) and this is the reason why you get a null result. As a workaround you can use the following code in your servlet:
    BindingContext bctx = BindingContext.getCurrent();
    DCBindingContainer pagedef = bctx.findBindingContainerByPath(request.getServletPath());
    bctx.setCurrentBindingsEntry(pagedef); // Invoke this method only if for some reason you need the "bindings" variable set in the environmentDimitar

  • How to copy/access a string from inside the driver

    is there any equivalent to strncpy() to use inside
    the driver for copying user sent data to local buffer .
    i used I_STRioctl and assigned struct to strioctl.ic_dp
    as shown below..
    char * buf;
    struct user-data
    int minor;
    char* data;
    struct user_data u_data;
    buf="hello world"
    u_data.minor=0;
    u_data.data=buf;
    strioctl.ic_dp=&u_data;
    strioctl.ic_len=sizeof(struct user_data);
    ioctl(fd,I_STR,&strioctl);
    when i tried to copy/access the string sent by the user application from inside the driver, machine gets into
    booting ...
    here what i did was
    in wput routine
    struct user_data *u_data;    
    u_data =(struct user_data*)mp->b_cont->b_rptr;      
    cmn_err(CE_NOTE,"minor= %d",u_data->minor);
    till here working well..
    where as..
    cmn_err(CE_NOTE,"data= %s",u_data->data);
    causing panic to the system...booting happens.
    please help me out ..
    thank u all
    ss vasu

    looks like the data pointed to by 'data' is not copied from user space to kernel space.
    u_data.data=buf, just makes pointer assignment, does not copy data pointed to by buf.
    two solutions:
    1. Declare data as a array(char data[10] or something
    2. Copy buf after the structure and point data to it. strioctl.ic_len should be set to sizeof(struct) +
    data size.
    -Vijay
    is there any equivalent to strncpy() to use inside
    the driver for copying user sent data to local buffer
    i used I_STRioctl and assigned struct to
    strioctl.ic_dp
    as shown below..
    char * buf;
    struct user-data
    int minor;
    char* data;
    struct user_data u_data;
    buf="hello world"
    u_data.minor=0;
    u_data.data=buf;
    strioctl.ic_dp=&u_data;
    strioctl.ic_len=sizeof(struct user_data);
    ioctl(fd,I_STR,&strioctl);
    when i tried to copy/access the string sent by the
    user application from inside the driver, machine gets
    into
    booting ...
    here what i did was
    in wput routine
    struct user_data *u_data;
    u_data =(struct user_data*)mp->b_cont->b_rptr;
    r;
    cmn_err(CE_NOTE,"minor= %d",u_data->minor);
    till here working well..
    where as..
    cmn_err(CE_NOTE,"data= %s",u_data->data);
    causing panic to the system...booting happens.
    please help me out ..
    thank u all
    ss vasu

  • Execute several UNIX OS commands from inside Java program

    Greetings,
    I would like to be able to execute from a Java program several of the following UNIX commands
    script filename
    cd
    date
    grep
    diff
    I have been able to get a single command to work with
    Runtime rt = Runtime.getRuntime();
    Process p = rt.exec("dir");
    My goal here is to accomplish a Java program which will use JDBC to access an Oracle database with SQL and then compare the resultant flat file with a diff command in Unix to another delimited file from an Excel spreadsheet. Your input is appreciated.
    Thank you

    I would suggeat to use JDBC to get the data from database and then read your file and then use existing java diff program from following link to find the differences between the files
    http://www.bmsi.com/java/
    I hope this helps
    VAN

  • Access java properties from C++/JNI program

    Hello all,
    Is it possible to access the Java properties of a JNI VM from a C++ program?
    If so, could the code or process be explained to me.
    I want to be able to identify a specific VM that is retrieved by the JNI_GetCreatedJavaVMs
    call. I set a user property when the VM was created, and would like to verify its value
    before calling AttachCurrentThread.
    Thanks in advance.
    Mark

    Are you saying that you set a system property (via System.setProperty() or -D)?
    If so, just use the JNI invocation API to call System.getProperty().
    Without error checking, that looks something like this:bool isMySystem( JNIEnv* env ) {
      const string PropertyName = "IsMySystem";
      jclass systemClass = env->FindClass( "java/lang/System" );
      jmethodID getPropertyMethod = env->GetStaticMethodID( systemClass, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;" );
      jstring propertyNameString = env->NewStringUTF( PropertyName.c_str() );
      jstring propertyString = env->CallStaticObjectMethod( systemClass, getPropertyMethod, propertyNameString );
      if ( propertyString == 0 ) {
        return false;
      const char* property = env->GetStringUTFChars( propertyString, 0 );
      boolean isMine = ! strcmp( property, "Yes" );
      env->ReleaseStringUTFChars( propertyString, property );
      return isMine;
    }Using Jace, http://jace.reyelts.com/jace (a free, open-source toolkit), this would look more like:bool isMySystem() {
      String property = System::getProperty( "IsMySystem" );
      return property.isNull() ? false : prop == "Yes";
    }In the end, Jace ends up making all of the exact same calls, but you can see how much easier it is to use.
    God bless,
    -Toby Reyelts

  • Accessing oracle DB from a java program - question for oracle driver

    Hi,
    I have Oracle 10 G under vista on my desktop. I am trying to write a simple java program to access/update database tables. I saw in one of oracle example to import 2 packages - namely --- import oracle.jdbc.driver.*; import oracle.sql.*;
    Where do I find these 2 packages. Also I read some documentation to download drivers. I would like to use 2 drivers, the thin driver and the OCI driver. Can someone tell me where I can find these drivers and where do I copy these two drivers - so javac and java command can recognize it.
    I will greatly appreciate the help. Julia
    My program is as follows
    (It was working few years ago but things have changed now and I have Vista because my old machine died):
    import java.sql.*; // JDBC package
    //import com.inet.tds.JDBCRowSet;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import oracle.sql.*;
    public class HomeDB
    run as follows:
    C:\Documents and Settings\MMM>cd \jj
    C:\john>set CLASSPATH=.;c:\oracle9i\classes12;%CLASSPATH%
    C:\john>javac HomeDB.java
    C:\john>java HomeDB
    King: 24000.0
    Kochhar: 17000.0
    De Haan: 17000.0
    Hunold: 9000.0
    Ernst: 6000.0
    Austin: 4800.0
    public static void main(String[] argv)throws SQLException
    Connection conn=null;
    try // may throw a SQLException
    conn = getConnection();
    doQuery (conn);
    catch (SQLException e)
    System.err.println(e.getErrorCode() + ": " + e.getMessage());
    finally // make sure the connection is closed
    if (conn != null) try {conn.close();} catch (SQLException e) {};
    //out.close(); // close PrintWriter stream
    private static Connection getConnection() throws SQLException
    String username = "scott";
    String password = "tiger";
    String url = "jdbc:oracle:thin:@localhost:1521:newora";
    // "jdbc:oracle:thin:@localhost:1521:COCKYJOB";
    Connection conn = null;
    String driver = "oracle.jdbc.driver.OracleDriver";
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    } catch ( ClassNotFoundException cnfex ) {
    System.err.println(
    "Failed to load JDBC/ODBC driver." );
    cnfex.printStackTrace();
    }catch (Exception e){
    e.printStackTrace();
    //DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    conn = java.sql.DriverManager.getConnection(url,username,password);
    conn.setAutoCommit(false);
    return conn;
    private static void doQuery (Connection c) throws SQLException
    // statement to be executed
    String query = "SELECT ename, job, mgr FROM EMP";
    Statement st = null;
    ResultSet rs = null;
    try // make sure the close statements are executed (in the finally block)
    // create the statement
    st = c.createStatement();
    // execute the query
    rs = st.executeQuery(query);
    // process results
    while (rs.next())
    // get the employee last name
    String eName = rs.getString("ename");
    String eJob = rs.getString("job");
    String eMgr = rs.getString("mgr");
    System.out.println("Emp Name:" + eName +
    "Job: " + eJob +
    "MGR: " + eMgr);
    finally // make sure the close statements are executed
    // close the result set if it exists
    if (rs != null) try {rs.close();} catch (Exception e) {};
    // close the statement if it exists
    if (st != null) try {st.close();} catch (Exception e) {};
    Edited by: user455788 on Dec 19, 2008 9:13 PM

    You can download the drivers from http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html.
    Note that oracle.jdbc.driver is desupported after 10.2, http://forums.oracle.com/forums/ann.jspa?annID=201, so you might want to consider using a DataSource to provide Connections.
    E.G.
    {message:id=2819114}

  • Is there any way to access your favourites from inside Illustrator?

    I have saved a series of favourites in Kuler but can't work out how/if you can access them from Illustrator. TIA for your assistance. Jo

    Hi JoJoBally1,
    I'm not seeing a really easy way to just view favorites specifically. Here are my thoughts/suggestions
    The Kuler extension Window>Extension>Kuler is not user specific but does allow you to search by author and has the option send to the swatch panel. I probably wouldn't go this route as it is kind of labor intensive.
    I'd probably save all your favorites as local files and then just either load them individually as needed or put them in the presets folder.
    Something like this:
    1. Sign in Kuler.adobe.com with your Adobe ID that has all your favorites
    2. Select the Favorites section under MyKuler
    3. Create a folder on the desktop of your computer named Favorites
    4. Save each of the favorites as a .ase file into the folder you created on the desktop by selecting it and hitting the save button on the webpage
    5. Close Illustrator
    6. Copy the entire Favorites folder into the Swatches Presets folder on your computer, not sure what OS your are on but probably something like \Adobe Illustrator CS6\Presets\en_US\Swatches\
    7. Launch Illustrator, open the Swatch panel (Window>Swatches), in the flyout menu in the top lefthand corner Open Swatch Library towards the bottom of the menu
    8. Favorites should be in the list there and you should be able to select any of the themes you put in the folder
    Thats probably the process I would use
    -Dave

  • Best way to access a cache from inside AbstractProcessor::process()

    I would prefer a light-weight way of doing this, I see the Command Pattern stuff but I need to understand what is really happening, and I only have a single point in my code where this needs to be handled anyway, so I'd really like the implementation right there. So... should I fork a thread to do the work? Is there anything I should be careful of if I do this? Any other suggestions?
    Cheers,
    Luke

    Some context to prevent confusion:
    target cache-item = cache-item against which you want to invoke AbstractProcessor.process()
    secondary cache = cache you want to access from within the AbstractProcessor.process()
    put the "secondary cache" (that you need to access from within the AbstractProcessor.process) in a different service. You do this by giving the service (that the secondary-cache is on) a different <service-name> in the config.
    The downside to spending more time in the process() method is that an EntryProcessor that needs to work against the same target cache-item would need to wait until the current EntryProcessor is done, no matter how many service threads you have. This is because Coherence queues EntryProcessors that need to work against the same target cache-item. This provides free thread-safety.
    I think the above is correct, unless Tangosol experts differ.
    Thanks
    Ghanshyam

  • How to access external IPs from inside

    Hello,
    We have several servers that we NAT to internal IPs on the inside interface. Normally we just setup DNS on the inside to point to the private IPs.
    But I have always been curious, how do you configure the ASA so a host on the inside can talk to a public IP address behind that same ASA?

    AAArrrrgggghhh!!! I misread the original post.
    But for Karthik's suggestion to work, DNS requests would need to pass through the ASA to a DNS server in either a DMZ or out on the internet.  If DNS requests do not pass through the ASA then you will need to NAT the public IP to the private IP on the inside interface in a hairpinning manner.
    Keep in mind that when using DNS doctoring you would need to have an ACL permitting traffic from the internal IP to the private IP of the server if traffic is being denied to the private IP.
    For NATing the public IP to the private IP on the inside interface you could do something like the following:
    object network SERVER
      host 10.0.0.100 (keeping with Karthik's example ;-)  )
    object network LAN
      subnet 192.168.100.0 255.255.255.0
    object network SERVER-PUB-IP
      host 1.1.1.1
    same-security-traffic permit intra-interface
    nat (inside,inside) source static LAN LAN destination static SERVER SERVER-PUB-IP
    Please remember to select a correct answer and rate helpful posts

  • How to access a variable from inside another symbol

    So i did this tutorial, Leveraging Independent Symbol Timelines created by Eliane...it's rockin, btw.  ;-)
    All's well but now i have a symbol on the stage called mc-home.  inside of mc-home is a button called btn-go.
    On the stage in composition ready there's a variable sym.setVariable("current", "mc-home");
    This code works for a symbol that's on the stage but, how do i get this code to work on a button that's inside another symbol that's on the stage?
    var current = sym.getVariable("current");
    if (current != "") {
        sym.getSymbol(current).play("OUT");
    sym.getSymbol("mc-something").play("IN");
    sym.setVariable("current", "mc-something");

    sorry, i was kind of confused myself too, don't worry about it but thanks for your patience for reading it anyway

  • How to Access v$ views from inside PL/SQL?

    I cannot grant select on these v$'s for users. Could someone recommned a solution for something like:
    function conn_cnt(v_name in varchar2, v_stat varchar2) return number
    is
    p_val number := 0;
    begin
    EXECUTE IMMEDIATE
    'SELECT COUNT(*) FROM V$SESSION WHERE ' ||
    'USERNAME = :1 AND STATUS <> :2 ' ||
    'AND SID NOT IN (SELECT SID FROM V$MYSTAT WHERE ROWNUM < 2)'
    INTO p_val USING v_name, v_stat;
    return p_val;
    exception
    when others then
    raise_application_error(-20011, sqlerrm);
    end;
    Thanks.

    Thanks John,
    but:
    SQL> conn sys as sysdba
    Enter password:
    Connected.
    SQL> grant select on v$session to <id>;
    grant select on v$session to <id>
    ERROR at line 1:
    ORA-02030: can only select from fixed tables/views
    - Zack

  • Change webpage from inside Flex 3 App

    Hello!
    How can I change the page displayed when an event happens?
    For example: if I have a flex 3 Login form and login is
    successful, I want to redirect the user to another page.
    How can I do this, please?
    Thank you!

    navigateToURL(new URLRequest("URL"));
    Where URL can be either relative (myfile.extension) or
    absolute (
    http://www.mysite.domain/myfile.extension).
    If I am wrong, let me know please. :)

  • Accessing buttons on main stage from inside of a movie clip

    Greetings...
          here is the scenario:
                 - I have buttons on main stage, and a swf file which is loaded to scene using a LOADER in AS3
                 - this is a website, so the problem rises when user moves its cursor around the page and now  buttons in main stage,
                    are still active since they are behind the loaded swf file.
                 - i would like to learn, how can i CODE inside the loaded SWF file, to either remove the buttons in main page, or remove
                    the event listeners. not sure if my case has anything to do with .Parent or .roo, (I want to access those main stage
                    buttons from the SWF file which is loaded)
                 - The general case is, i have SWF files loading inside another SWF files, is it possible to access items on each stage from
                    inside of loaded SWF files on that specific stage. Similarly i would be interested to learn about accessing main stage from inside
                    of movieclips running on stage. how can i access something not in present FLA file yet, in FLA file that is loading the page as SWF.
                    Thanks.

    If you load an swf into another using the Loader class, then the Loader itself is the parent of the loaded swf., so MovieClip(parent.parent) might help you to target the timeline that the Loader was born from.  The more proper way to have a loaded file talk to a parent file is thru dispatching events that the parent assigns listeners for after the file has loaded.  Here's a link to a posting that might help explain how to implement this.
    http://forums.adobe.com/thread/470135?tstart=120
    As for the buttons that you want to disable, you could either use the removeEventListener() method to remove the listeners you have assigned, or you could set their mouseEnabled property to false, or you could set their visible property to false.

Maybe you are looking for

  • File from AIX to AS/400 via FTP

    Hi, i need to transfer a file as it is from AIX to AS/400. Doing that with WS-FTP works fine. So i set up a scenario in XI, getting the file from the AIX with NFS and putting the file to the AS/400 with FTP. The runtime workbench tells me that everyt

  • ICloud child account - Can't log into Apple ID or iCloud with child account

    Nightmare!  Created three kids accounts.  Loaded the ID on iTouchs.  Then went to https://appleid.apple.com/account/home to change info... couldn't log in. I also couldn't log into iCloud with the new ID's. After a call to apple (no help) and thinkin

  • Upgrading hard drive and OS - time machine suitable?

    I've been keeping regular copies of my system using time machine, but am not sure of it's overall capabilities. I am about to replace my internal hard drive (2008 macbook) and upgrade to Snow Leopard. Once this is done can I simply restore my old set

  • How to restore the original copy of OS.

    The hard disk of my notebook got damaged and now I have installed new hard disk but since I didnt had any backup the windows 8.1 OS also got lost. Now I have installed trial version, can anyone let me know how to restore the original copy of OS. 

  • RFC sender error

    Hi, I created RFC at SAP . RFC Sender. SM59 registered progam ID i am suing same program id and gateway server, host in XI when i execute the FM from se37 using the RFC DEST it is showing the error "JCO.Server could not find server function 'Z_BANK_R