Exceptions, odd behavior of streaming data to outputstream

I have a servlet which writes mp3 data to the dataoutputstream of a servlet response object. For some reason, the servlet method writes the data out and gets an exception. Then the method/servlet is called again automatically and begins to write the data out again. The exception is below. In the end the mp3 is delivered to the client fine, however with server side exceptions and odd behavior.
try {
          int len = 0;
          resp.setContentType("audio/mpeg");
          String filename = req.getParameter("file");
          File mp3 = new File(mediaDir + filename);
          byte[] buf = new byte[1024];
          FileInputStream fis = new FileInputStream(mp3);
          DataOutputStream o = new DataOutputStream(resp.getOutputStream());
          while( (len = fis.read(buf)) != -1) {            
             o.write(buf, 0, len);            
          o.flush();
          resp.flushBuffer();
          o.close();
          fis.close();
       catch(Exception e) {
          System.out.println(e.getMessage());
          e.printStackTrace();
null
ClientAbortException:  java.net.SocketException: Connection reset by peer: socket write error
     at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:366)
     at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
     at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:323)
     at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:392)
     at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:381)
     at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:76)
     at java.io.DataOutputStream.write(DataOutputStream.java:90)
     at TrafficControl.streamAudio(TrafficControl.java:639)
     at TrafficControl.processRequest(TrafficControl.java:136)
     at TrafficControl.doGet(TrafficControl.java:61)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
     at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
     at java.lang.Thread.run(Thread.java:595)thanks
Edited by: black_lotus on 19-Feb-2009 3:08 PM

There are some versions of some browsers (MS IE) that can call a servlet twice; they only look at the headers at the first request, in order to decide whether to display a "save or open" dialog, or some such reason. Try different browsers; also log the User-Agent header to see if it is "contype", which is present when the multiple request thing happens.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q293792
"Connection reset" can also happen if the client closes the connection without reading the entire response. Occasional resets will happen as users cancel download.
Not a source of exceptions but something you may still want to consider when sending large responses: by default, the servlet container will have to buffer the entire file in memory to find out its length. To save memory, either set content length before writing the data, or use chunked encoding (google should find details.) That way your write() actually streams data to the user.

Similar Messages

  • Very odd behavior regarding variable naming with DataService.fill()

    I'm experiencing this odd behavior in LCDS 2.5, wich pertains
    to variable naming for the objects returned by a DataService.fill()
    call. I ceated a simple destination with a Java adapter. the Server
    side Java data object is defined as follows)
    package test;
    public class RepositoryObject
    private String m_strObjectId;
    private boolean m_bIsValid;
    private long m_lSize;
    [public setters and getters here]
    On Flex side, the ActionScript value object is defined as
    follows:
    package test
    [Bindable]
    [RemoteClass(alias="test.RepositoryObject")]
    public class RepositoryObject
    public var m_strObjectId:String;
    public var m_bIsValid:Boolean;
    public var m_lSize:Number;
    public function RepositoryObject()
    The FDS destination definition (in
    data-management-config.xml):
    <destination id="testDs">
    <adapter ref="java-dao" />
    <properties>
    <source>test.TestDS</source>
    <scope>application</scope>
    <metadata>
    <identity property="m_strObjectId"/>
    </metadata>
    <network>
    <session-timeout>20</session-timeout>
    <paging enabled="false" pageSize="10" />
    <throttle-inbound policy="ERROR" max-frequency="500"/>
    <throttle-outbound policy="REPLACE"
    max-frequency="500"/>
    </network>
    <server>
    <fill-method>
    <name>getObjects</name>
    </fill-method>
    </server>
    </properties>
    </destination>
    What I figured while debugging into the client was is the
    data returned by the service (I'm using the mx:DataService call)
    returns objects whose variable names
    do not match my definition:
    m_strObjectId becomes objectId
    m_lSize becomes size
    m_bIsValid becomes isValid
    I wonder why that renaming??? Basically "m_str" prefix was
    stripped and capital "O" became lower case "o" for my first
    variable etc.
    For instance, in a datagrid cell renderer I could not
    reference the returned value as {data.m_strObjectId}, but if I use
    {data.objectId}, it works.
    Any ideas why this behavior (which I found confusing and odd)
    would be greately appreciated.
    Robert

    The latter, as "getM_strObjectId " is an ugly name... don't
    tell me that causes issue...ok kidding, I got you. The
    setter/getter names are important in this context.
    Thanks a lot.
    Robert

  • Streaming data to LONG columns in Oracle 7.3.2.3.0

    I am trying to stream data to a LONG column. I'm using Oracle
    Server 7.3.2.3.0 on AIX and JDBC driver 8.0.4 on Windows NT 4
    SP5.
    I include sample tables/programs at the end, but here's the
    summary of what's happening:
    I'm creating a byte array of length 2500. If I use
    setAsciiStream I get the following exception when I execute the
    prepared statement:
    java.sql.SQLException: Data size bigger than max size for this
    type
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java)
    at oracle.jdbc.ttc7.TTCItem.setArrayData(TTCItem.java)
    at oracle.jdbc.driver.OraclePreparedStatement.setItem
    (OraclePreparedStat
    ement.java)
    at
    oracle.jdbc.driver.OraclePreparedStatement.setAsciiStream
    (OraclePrepa
    redStatement.java)
    at TestOracle.main(TestOracle.java:26)
    If I use setBinaryStream I get this exception:
    java.sql.SQLException: ORA-01461: can bind a LONG value only for
    insert into a LONG column
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7
    (TTC7Protocol.java)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch
    (TTC7Protocol.java)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther
    (OracleStatement.jav
    a)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch
    (OracleStatement
    .java)
    at oracle.jdbc.driver.OracleStatement.doExecute
    (OracleStatement.java)
    at
    oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout
    (OracleStateme
    nt.java)
    at
    oracle.jdbc.driver.OraclePreparedStatement.executeUpdate
    (OraclePrepar
    edStatement.java)
    at oracle.jdbc.driver.OraclePreparedStatement.execute
    (OraclePreparedStat
    ement.java)
    at TestOracle.main(TestOracle.java:27)
    My Oracle7 manual states that LONG columns can store 2GB of text.
    I tried the above with LONG RAW columns and it worked fine.
    Can anyone explain why I get this error? I've tried it with
    different sizes and when the data is <2000 bytes it works fine
    for LONG columns.
    My table is simple:
    create table TestLongs (key INTEGER PRIMARY KEY, data LONG);
    My Java code is also very simple:
    public class TestOracle
    public static void main(String[] args)
    Connection con = null;
    PreparedStatement pstmt = null;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection(
    "jdbc:oracle:thin:@itchy:1526:test",
    "System", "<OMITTED>");
    byte[] data = new byte[2500];
    for (int i=0; i< 2500; i++)
    data[i] = 53;
    String sql = "INSERT INTO TestLongs (key, data)
    VALUES(1, ?)";
    pstmt = con.prepareStatement(sql);
    ByteArrayInputStream bis = new ByteArrayInputStream
    (data);
    pstmt.setAsciiStream(1, bis, data.length);
    pstmt.execute();
    catch (SQLException e)
    System.err.println("An error occurred with the
    database: " + e);
    e.printStackTrace();
    catch (Exception e)
    System.err.println("Oracle JDBC driver not found." +
    e);
    e.printStackTrace();
    finally
    try
    if (pstmt != null)
    pstmt.close();
    if (con != null)
    con.close();
    catch (SQLException e)
    System.err.println("Unable to close
    statement/connection.");
    null

    Robert Greig (guest) wrote:
    : I am trying to stream data to a LONG column. I'm using Oracle
    : Server 7.3.2.3.0 on AIX and JDBC driver 8.0.4 on Windows NT 4
    : SP5.
    I tried it with the old 7.3.x JDBC driver and it works fine. I
    also noticed after further testing that it sometimes worked
    with the 8.0.4 driver. Looks like a bug in the 8.0.4 driver or
    some wacky incompatibility.
    null

  • Issues Exiting Sleep Mode and Odd Behavior On Restart with GPU

    I'm running a completely stock HP P7-1240 desktop except for an EVGA GeForce GTX 750 TI SC GPU. The GPU runs fine when the computer is up and running (which is odd because the forums have several other threads mentioning that the 700 series should be incompatible with my BIOS).
    However, there are two main strange problems that have arisen since installing the GPU. One is that, whenever the computer enters sleep mode, it refuses to wake back up properly. It seems to me that the computer activates but does not send any signals out from the back panel (at the very least, no video signal because my monitors stay blank). On a rare occasion, it will wake back up properly, but at least 90% of the time, it needs to be restarted. Upon restart, sometimes the same issue occurs (no video output), and the computer needs to be restarted a second time before it will boot up again.
    This leads to the second problem. When starting, the computer goes to a black screen listing basic computer specs (see attached photo. At this screen, the computer does not respond to any input.  It proceeds to beep 3 times, all the same length and pitch spaced about 30 seconds apart. After the third beep, the screen goes black and then the computer boots up normally with no further odd behavior.
    Without the GPU, none of these issues happen. At the very least, not regularly.
    I have seen another thread mentioning that, although the HP support page for my desktop does not list it, there is a BIOS update for my motherboard that has fixed issues relating to more modern GPU's. By nature of it being a BIOS update that does not (appear to) officially support Windows 7, I'm hesitant to move forward with that potential solution.
    Although I'm planning to build myself a new computer from scratch at some point, I was hoping to at least get another year out of this machine, if not 2.  While this issue doesn't appear to be immediately threatening the stability of the computer, I can't help but think that this is an issue I should iron soon to avoid future issues (not to mention it would save me a fair amount of electricity to be able to enter sleep mode on a regular basis).
    Any suggestions would be greatly appreciated!
    This question was solved.
    View Solution.

    Hello @johnmwalker,
    I understand that you are having some issues with your HP Pavilion p7-1240 Desktop PC waking up from sleep mode. I am not sure how much can be done for the delay on your startup with an OEM BIOS you are limited in what you can do and since your graphic card works I think you would be better off not messing too much with the BIOS at this point. The one thing I would try is going into the BIOS using the HP Support document:BIOS Setup Utility Information and Menu Options, and under Advanced > Power-On Options set POST Messages to Disable and POST Delay (in seconds) to None.
    Now the waking from sleep mode issue  could just be the hybrid sleep setting causing you an issue with sleep mode. Use the following steps to disable hybrid sleep:
    Step 1. Click Start
    Step 2. Click Control Panel.
    Step 3. Click System and Security
    Step 4. Click Power Options
    Step 5. Click High Performance from Power Options
    Step 6. Click Change plan settings
    Step 7. Select Change advanced power settings
    Step 8. Click the plus (+) sign next to Sleep
    Step 9. Click the plus (+) sign next to Allow hybrid sleep
    Step 10. Select Off from the drop-down menu
    Step 11. Click OK
    Please re-post if you require additional support. Thank you for posting on the HP Forums. Have a great day!
    Please click the "Thumbs Up" on the bottom right of this post to say thank you if you appreciate the support I provide!
    Also be sure to mark my post as “Accept as Solution" if you feel my post solved your issue, it will help others who face the same challenge find the same solution.
    Dunidar
    I work on behalf of HP
    Find out a bit more about me by checking out my profile!
    "Customers don’t expect you to be perfect. They do expect you to fix things when they go wrong." ~ Donald Porter

  • Streaming data into LONG results in ORA-24307

    I am migrating an application to a new environment. During testing I am receiving the following error when trying to insert a record into an Oracle 8.1.7.4 table:
    Error saving report: update BlobPiece osetpi(): ORA-24307: invalid length for piece
    The table has a column defined as LONG. I am using a prepared staement and setAsciiStream to perform the insert. I have been able to determine that the error happens when the data being streamed exceeds 4000 bytes (i.e. 4001 bytes).
    Connection to the table is made by using a datasource with the ORACLE_OCI driver. If I change the connection to use an Oracle thin driver, the insert is performed (code provided below).
    I would prefere not to change the connection method if possible. Any help resolving this problem would be appreciated. Thanks.
    Here is the insert code being used:
    public void create(SavedReportImpl report, String userId)
    throws ReportManagerException {
    StringBuffer sql = new StringBuffer();
    // NOTE: Must utilize a prepared statement since this insert contains
    // an Oracle Long column type
    java.sql.PreparedStatement statement = null;
    String modelCd = report.getModel().getModelCd().toUpperCase();
    if (modelCd.length() != 7) {
    modelCd = " " + modelCd;
    sql.append("INSERT ");
    sql.append("INTO ");
    sql.append("PRCT012 ");
    sql.append("(");
    sql.append("MODL_YR_NBR, ");
    sql.append("PRICE_CD, ");
    sql.append("MDSNG_MODL_DESGTR, ");
    sql.append("EFFECTIVE_DT, ");
    sql.append("REPORT_TP, ");
    sql.append("REPORT_SUBTP, ");
    sql.append("RESTRICTION, ");
    sql.append("PRICE_DESC, ");
    sql.append("VEHICLE_LINE, ");
    sql.append("MODL_DESC, ");
    sql.append("CURRENCY_CD, ");
    sql.append("CURRENCY_NM, ");
    sql.append("SOP_INDCTR, ");
    sql.append("LAST_UPDT_USERID, ");
    sql.append("LAST_UPDT_TMSTM, ");
    sql.append("REPORT_HTML_STRING) ");
    sql.append("VALUES (" );
    sql.append("'" + report.getModel().getModelYear() + "', ");
    sql.append("'" + report.getPriceCd().toUpperCase() + "', ");
    sql.append("'" + modelCd + "', ");
    sql.append("'" + dateFormatter.formatDatetoDBDateString(report.getEffectiveDate()) + "', ");
    sql.append(report.getReportType() + ", ");
    sql.append(report.getReportSubtype() + ", ");
    if (report.getModel().getRestriction() == null || report.getModel().getRestriction().length() == 0) {
    sql.append("NULL, ");
    } else {
    sql.append("'" + report.getModel().getRestriction().toUpperCase() + "', ");
    sql.append("'" + report.getPriceCdDescription() + "', ");
    sql.append("'" + report.getModel().getVehicleLine().toUpperCase() + "', ");
    sql.append("'" + report.getModel().getDescription() + "', ");
    sql.append("'" + report.getCurrency().getCurrencyCd().toUpperCase() + "', ");
    sql.append("'" + report.getCurrency().getCurrencyNm() + "', ");
    sql.append(report.isSOP() ? "'Y', " : "'N', ");
    sql.append("'" + userId.toUpperCase() + "', ");
    sql.append("'" + dateFormatter.formatDatetoDBDateTimeString(new java.util.Date()) + "', ");
    sql.append("?) "); // LONG COLUMN TO BIND
    //NOTE: only bind one column when there is an ORACLE LONG
    try {
    statement = connection.prepareStatement(sql.toString());     
    String html = com.eds.csdd.util.StringUtils.replaceAll(report.getHTML(), "'", "''");
    byte[] bytes = html.getBytes();
    java.io.InputStream is = new java.io.ByteArrayInputStream(bytes);
    statement.setAsciiStream(1, is, bytes.length);
    int resultCode = statement.executeUpdate();
    } catch (java.sql.SQLException sqle) {
    throw new ReportManagerException(sqle.getMessage());
    } catch (Exception e) {
    e.printStackTrace();
    throw new ReportManagerException(e.getMessage());                    
    } finally {                                   
    if (statement != null) {
    try { statement.close(); } catch (java.sql.SQLException re) {}
    Here is the connection code using the datasource:
    public java.sql.Connection getConnection(String dataSourceName) throws java.sql.SQLException {
    javax.naming.InitialContext               dsCTX          = null;
    javax.sql.DataSource               ds1          = null;
    java.sql.Connection                    conn          = null;
    String dataSource = rte.getProperty(dataSourceName, "datasource","datasourcenotfound");
    try {
         dsCTX = new javax.naming.InitialContext();
         ds1 = (javax.sql.DataSource)dsCTX.lookup("java:comp/env/" + dataSource);
    } catch (javax.naming.NamingException e){
         throw new java.sql.SQLException("Naming Exception:" + e.getMessage());
    if (ds1 == null)
         throw new java.sql.SQLException("datasource not provided");
    else
         conn = ds1.getConnection();
    return conn;
    Here is the connection code using the thin driver:
    public java.sql.Connection getConnection(String dataSourceName) throws java.sql.SQLException {
    java.sql.DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
    // open a connection to the database
    java.sql.Connection conn = java.sql.DriverManager.getConnection (
                             "jdbc:oracle:thin:@###.##.###.###:1521:SID",
                             "userid",
                             "password");
    return conn;
    }

    Robert Greig (guest) wrote:
    : I am trying to stream data to a LONG column. I'm using Oracle
    : Server 7.3.2.3.0 on AIX and JDBC driver 8.0.4 on Windows NT 4
    : SP5.
    I tried it with the old 7.3.x JDBC driver and it works fine. I
    also noticed after further testing that it sometimes worked
    with the 8.0.4 driver. Looks like a bug in the 8.0.4 driver or
    some wacky incompatibility.
    null

  • Streaming data in java

    My applet needs to stream data from a server.
    Server is .NET/C#
    I have two implementations but both are not the exact thing which i want.
    So if anyone have any better ideas please do give suggestions.
    1) My server application will write to a hidden variable.
    My client java program representing the applet have a thread which checks the value of this variable and once the variable gets data use that to do the task.
    The task in my scenario is printing.
    2) My server will send some text in a specified format using the Response.Write() function
    My java program reads it using
    DataInputStream in = new DataInputStream(urlconnection.getInputStream());Now the problem with the second implementation is response.write() displays the content on the page also which makes it visible to all.Also in addition to the text written using Reponse.Write() the input stream returns all the html tags also.
    So can anyone tell me a better way to stream data in java.
    I know both these implementations are not implementing the concept of streaming.
    Thank You.

    here is my applet code.
    checkJavaScriptEvent obj=new checkJavaScriptEvent();
                   obj.start();
                   URL currentPage=getCodeBase();
                   String protocol = currentPage.getProtocol();
                   String host=currentPage.getHost();
                   int port=currentPage.getPort();
                   String urlSuffix="/PrintAppletCSharp/Default.aspx";
                   System.out.println("currentPage : " + currentPage + "\nprotocol : " + protocol + "\nhost : " + host + "\nport : " + port);
                   try {
                        URL dataUrl=new URL(protocol,host,port,urlSuffix);
                        URLConnection connection=dataUrl.openConnection();
                        connection.setUseCaches(false);
                        //connection.setRequestProperty("header", "value");
                        System.out.println("Got a connection");
                        //BufferedReader in=new BufferedReader(new InputStreamReader(connection.getInputStream()));
                         DataInputStream in = new DataInputStream(connection.getInputStream());
                        //byte[] b=new byte[20];
                        //int count =is.read(b);
                        System.out.println("After Getting a connection");// + count + " : " + b.toString());
                        String line="";
                        while(!line.equals("EndScriptPrint"))
                             line=in.readLine();
                             if(!line.equals("StartScriptPrint") && !line.equals("EndScriptPrint"))
                                  fromServer+=line + "\n";
                             System.out.println("Line " + line);
                        FileWriter fw=new FileWriter("t.txt");
                        fw.write(fromServer);
                        fw.close();
                        Process p=Runtime.getRuntime().exec("notepad.exe t.txt");
                        repaint();
                   } catch (Exception ex) {
                        ex.printStackTrace();
                   }

  • Streaming data full of Session_Started event - is that expected?

    My streaming data is full of the following event:
    ASP.NET Application+Telemetry/Session_Started
    Every page I visit - I see this message logged - what does it mean and is that expected?
    I looked into the documentation but did not find this event - want to make sure this is not the same as asp.net server sessions... (I think it does not, just making sure?)

    Hello Mauro,
    It seems to be an expected behavior in that particular version of AI SDK, no need to worry about this.
    Could you please try the latest AI SDK?  I think that way how AI works with sessions/users was changed over the past 8 months, so you will have a different experience (note that AI data is now showing up in Azure Portal)
    Dmitry Matveev

  • [svn:fx-trunk] 9174: revert rev# 9148 until some odd behavior can be tracked down.

    Revision: 9174
    Author:   [email protected]
    Date:     2009-08-07 10:37:23 -0700 (Fri, 07 Aug 2009)
    Log Message:
    revert rev# 9148 until some odd behavior can be tracked down.
    checkintests: pass
    rev# 9148:Changing enabled on GroupBase to set the alpha to the new "disabledAlpha" CSS style (0.5 by default) when the container is disabled. 
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/defaults.css
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as

  • App-V 5.0 connection group odd behavior

    I am having some odd behavior with an application that I've packaged in App-V 5.0.  We are running App-V for RDS on Server 2012, and I'm on SP2.
    The problem I'm having is with a program called SQL Tools 1.6 (a 3rd party tool, not from MS or Oracle).  It's a fairly straightforward program, and it runs fine on App-V 4.6.  But it requires an Oracle client to run.  On App-V 4.6, we have
    the Oracle client installed locally on the server.  But with App-V 5, I wanted to make use of connection groups, so that we could use multiple Oracle versions, if necessary, and so that updating Oracle would be easier.  So I have a connection group
    that contains SQL Tools and the Oracle client.
    What is happening is that when I try to launch SQL Tools, I get an error saying it can't find OCI.DLL (which is in the Oracle path).  I took apart both packages, trying to make sure that the Oracle path variable was correct. I even added the Oracle
    path to the SQL Tools package (I even tried hard-coding the local path to the Oracle package).  I always get the same error.  I also swapped the priority of the two packages, but it didn't help.  Then I tried launching a command prompt in the
    context of the SQL Tools package.  When I checked the path variable, it was correct, and had the path to oci.dll.  Out of curiosity, I tried running SQL Tools, and it launched no problem.  Then I closed it and tried to launch it from the shortcut
    on the desktop, and got the same error as before.  I've tried launching it from various places (desktop shortcut, direct path to the executable, a command prompt without specifying the context of the SQL Tools package, etc.), checking compatibility mode
    and setting it to various settings (XP SP3, Windows 7, Run as Administrator on and off, etc.), but nothing seems to work except opening a command prompt in the context of the SQL Tools package, and then running SQL Tools from there.  As a workaround,
    I created this short script that launches a command prompt in the context of the SQL Tools package, and then runs SQL Tools from that command prompt: 
    $p = Get-AppvClientPackage -Name "SQL Tools 1.6"
    $cmd = '"C:\ProgramData\App-V\BB0D9EC0-3876-42EB-A5E9-92A149D52FB5\37F941F9-B4BA-425F-9FB4-9B699843E767\Root\VFS\ProgramFilesX86\SQLTools 1.6\SQLTools.exe"'
    Start-AppvVirtualProcess -FilePath cmd.exe -ArgumentList "/k $cmd" -AppvClientObject $p
    It works, but I would rather not have to use this type of workaround for something that should work natively.
    Any help would be greatly appreciated.
    Thanks,
    Sam

    Hello,
    What happens if you launch CMD instead of your tool when starting an application, and from that CMD you start sqltools.exe
    So the command to start the application would be;
    cmd.exe /c sqltools.exe
    Nicke Källén | The Knack| Twitter:
    @Znackattack

  • Odd behavior when using custom Composite/CompositeContext and antialiasing

    Hi,
    I created a custom Composite/CompositeContext class and when I use it with antialiasing it causes a black bar to appear. I seems it has nothing to do with the compose() code but just that fact that I set my own Composite object. The submitted code will show you what I mean. There are 3 check boxes 1) allows to use the custom Composite object, 2) allows to ignore the compose() code in the CompositeContext and 3) toggles the antialiasing flag in the rendering hints. When the antialiasing flag is set and the Composite object is used the bar appears regardless of if the compose() method is executed or not. If the Composite object is not used the bar goes away.
    The Composite/CompositeContext class performs clipping and gradient paint using a Ellipse2D.Float instance.
    a) When the Composite is not used the code does a rectangular fill.
    b) When the Composite is used it should clip the rectangular fill to only the inside of a circle and do a gradient merge of background color and current color.
    c) If the compose() method is ignored then only the background is painted.
    d) When antialiasing is turned on the black bar appears, i) if you ignore the compose() method it remains, ii) if you do not use the Composite object the bar disappears (???)
    NOTE: the compose method's code is only for illustration purposes, I know that AlphaComposite, clipping and/or Gradient paint can be used to do what the example does. What I am trying to find out is why the fact of simply using my Composite object with antialiasing will cause the odd behavior.  Been trying to figure it out but haven't, any help is appreciated.
    Thx.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class TestCustomComposite2
    extends JFrame
    implements ActionListener {
        private JCheckBox useCompositeChk, useAntialiasingChk, useCompositeContextChk;
        private Shape clippingShape = new Ellipse2D.Float(100, 100, 100, 100);
        private MergeComposite composite = new MergeComposite();
        public TestCustomComposite2() {
            super("Test Custom Composite");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JPanel cp = (JPanel) getContentPane();
            cp.setLayout(new BorderLayout());
            cp.add(new TestCanvas(), BorderLayout.CENTER);
            JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
            panel.add(useCompositeChk = new JCheckBox("Use Composite", true));
            useCompositeChk.addActionListener(this);
            panel.add(useCompositeContextChk = new JCheckBox("Use Composite Context", true));
            useCompositeContextChk.addActionListener(this);
            panel.add(useAntialiasingChk = new JCheckBox("Use Antialiasing"));
            useAntialiasingChk.addActionListener(this);
            cp.add(panel, BorderLayout.SOUTH);
            pack();
            setVisible(true);
        public void actionPerformed(ActionEvent evt) {
            useCompositeContextChk.setEnabled(useCompositeChk.isSelected());
            invalidate();
            repaint();
        private class TestCanvas
        extends JComponent {
            public TestCanvas() {
                setSize(300, 300);
                setPreferredSize(getSize());
            public void paint(Graphics gfx) {
                Dimension size = getSize();
                Graphics2D gfx2D = (Graphics2D) gfx;
                gfx2D.setColor(Color.GRAY);
                gfx2D.fillRect(0, 0, size.width, size.height);
                RenderingHints rh = null;
                if(useAntialiasingChk.isSelected()) {
                    rh = gfx2D.getRenderingHints();
                    gfx2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                Rectangle r = clippingShape.getBounds();
                //gfx2D.setColor(Color.GREEN);
                //gfx2D.drawRect(r.x, r.y, r.width, r.height);
                gfx2D.setColor(Color.YELLOW);
                gfx2D.fill(clippingShape);
                Composite oldComposite = null;
                if(useCompositeChk.isSelected()) {
                    oldComposite = gfx2D.getComposite();
                    gfx2D.setComposite(composite);
                gfx2D.setColor(Color.ORANGE);
                gfx2D.fillRect(r.x, r.y, r.width + 1, r.height + 1);
                if(oldComposite != null)
                    gfx2D.setComposite(oldComposite);
                if(rh != null)
                    gfx2D.setRenderingHints(rh);
        public class MergeComposite
        implements Composite, CompositeContext {
            public CompositeContext createContext(ColorModel srcColorModel,
                                                  ColorModel dstColorModel,
                                                  RenderingHints hints) {
                return this;
            public void compose(Raster src,
                                Raster dstIn,
                                WritableRaster dstOut) {
                if(!useCompositeContextChk.isSelected())
                    return;
                int[] srcPixel = null;
                int[] dstPixel = null;
                for(int sy = src.getMinY(); sy < src.getMinY() + src.getHeight(); sy++) {
                    for(int sx = src.getMinX(); sx < src.getMinX() + src.getWidth(); sx++) {
                        int cx = sx - dstOut.getSampleModelTranslateX();
                        int cy = sy - dstOut.getSampleModelTranslateY();
                        if(!clippingShape.contains(cx, cy)) continue;
                        srcPixel = src.getPixel(sx, sy, srcPixel);
                        int ox = dstOut.getMinX() + sx - src.getMinX();
                        int oy = dstOut.getMinY() + sy - src.getMinY();
                        if(ox < dstOut.getMinX() || ox >= dstOut.getMinX() + dstOut.getWidth()) continue;
                        if(oy < dstOut.getMinY() || oy >= dstOut.getMinY() + dstOut.getHeight()) continue;
                        dstPixel = dstIn.getPixel(ox, oy, dstPixel);
                        float mergeFactor = 1.0f * (cy - 100) / 100;
                        dstPixel[0] = merge(mergeFactor, srcPixel[0], dstPixel[0]);
                        dstPixel[1] = merge(mergeFactor, srcPixel[1], dstPixel[1]);
                        dstPixel[2] = merge(mergeFactor, srcPixel[2], dstPixel[2]);
                        dstOut.setPixel(ox, oy, dstPixel);
            protected int merge(float mergeFactor, int src, int dst) {
                return (int) (mergeFactor * src + (1.0f - mergeFactor) * dst);
            public void dispose() {
        public static void main(String[] args) {
            new TestCustomComposite2();
    }

    I got a better version to work as expected. Though there will probably be issues with the transformation to display coordinates as mentioned before. At least figured out some of the kinks of using a custom Composite/CompositeContext object.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class TestCustomComposite2
    extends JFrame
    implements ActionListener {
        private JCheckBox useCompositeChk, useAntialiasingChk, useCompositeContextChk;
        private Shape clippingShape = new Ellipse2D.Float(100, 100, 100, 100);
        private MergeComposite composite = new MergeComposite();
        public TestCustomComposite2() {
            super("Test Custom Composite");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JPanel cp = (JPanel) getContentPane();
            cp.setLayout(new BorderLayout());
            cp.add(new TestCanvas(), BorderLayout.CENTER);
            JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
            panel.add(useCompositeChk = new JCheckBox("Use Composite", true));
            useCompositeChk.addActionListener(this);
            panel.add(useCompositeContextChk = new JCheckBox("Use Composite Context", true));
            useCompositeContextChk.addActionListener(this);
            panel.add(useAntialiasingChk = new JCheckBox("Use Antialiasing"));
            useAntialiasingChk.addActionListener(this);
            cp.add(panel, BorderLayout.SOUTH);
            pack();
            setVisible(true);
        public void actionPerformed(ActionEvent evt) {
            useCompositeContextChk.setEnabled(useCompositeChk.isSelected());
            invalidate();
            repaint();
        private class TestCanvas
        extends JComponent {
            public TestCanvas() {
                setSize(300, 300);
                setPreferredSize(getSize());
            public void paint(Graphics gfx) {
                Dimension size = getSize();
                Graphics2D gfx2D = (Graphics2D) gfx;
                gfx2D.setColor(Color.GRAY);
                gfx2D.fillRect(0, 0, size.width, size.height);
                RenderingHints rh = null;
                if(useAntialiasingChk.isSelected()) {
                    rh = gfx2D.getRenderingHints();
                    gfx2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                Rectangle r = clippingShape.getBounds();
                //gfx2D.setColor(Color.GREEN);
                //gfx2D.drawRect(r.x, r.y, r.width, r.height);
                gfx2D.setColor(Color.YELLOW);
                gfx2D.fill(clippingShape);
                Composite oldComposite = null;
                if(useCompositeChk.isSelected()) {
                    oldComposite = gfx2D.getComposite();
                    gfx2D.setComposite(composite);
                gfx2D.setColor(Color.ORANGE);
                gfx2D.fillRect(r.x, r.y, r.width + 1, r.height + 1);
                if(oldComposite != null)
                    gfx2D.setComposite(oldComposite);
                if(rh != null)
                    gfx2D.setRenderingHints(rh);
        public class MergeComposite
        implements Composite, CompositeContext {
            public CompositeContext createContext(ColorModel srcColorModel,
                                                  ColorModel dstColorModel,
                                                  RenderingHints hints) {
                return this;
            public void compose(Raster src,
                                Raster dstIn,
                                WritableRaster dstOut) {
    //            dumpRaster("SRC   ", src);
    //            dumpRaster("DSTIN ", dstIn);
    //            dumpRaster("DSTOUT", dstOut);
    //            System.out.println();
                if(dstIn != dstOut)
                    dstOut.setDataElements(0, 0, dstIn);
                if(!useCompositeContextChk.isSelected())
                    return;
                int[] srcPixel = null;
                int[] dstPixel = null;
                int w = Math.min(src.getWidth(), dstIn.getWidth());
                int h = Math.min(src.getHeight(), dstIn.getHeight());
                int xMax = src.getMinX() + w;
                int yMax = src.getMinY() + h;
                for(int x = src.getMinX(); x < xMax; x++) {
                    for(int y = src.getMinY(); y < yMax; y++) {
                        try {
                            // THIS MIGHT NOT WORK ALL THE TIME
                            int cx = x - dstIn.getSampleModelTranslateX();
                            int cy = y - dstIn.getSampleModelTranslateY();
                            if(!clippingShape.contains(cx, cy)) {
                                dstPixel = dstIn.getPixel(x, y, dstPixel);
                                dstOut.setPixel(x, y, dstPixel);
                            else {
                                srcPixel = src.getPixel(x, y, srcPixel);
                                dstPixel = dstIn.getPixel(x, y, dstPixel);
                                float mergeFactor = 1.0f * (cy - 100) / 100;
                                dstPixel[0] = merge(mergeFactor, srcPixel[0], dstPixel[0]);
                                dstPixel[1] = merge(mergeFactor, srcPixel[1], dstPixel[1]);
                                dstPixel[2] = merge(mergeFactor, srcPixel[2], dstPixel[2]);
                                dstOut.setPixel(x, y, dstPixel);
                        catch(Throwable t) {
                            System.out.println(t.getMessage() + " x=" + x + " y=" + y);
            protected int merge(float mergeFactor, int src, int dst) {
                return (int) (mergeFactor * src + (1.0f - mergeFactor) * dst);
            protected void dumpRaster(String lbl,
                                      Raster raster) {
                System.out.print(lbl + ":");
                System.out.print(" mx=" + format(raster.getMinX()));
                System.out.print(" my=" + format(raster.getMinY()));
                System.out.print(" rw=" + format(raster.getWidth()));
                System.out.print(" rh=" + format(raster.getHeight()));
                System.out.print(" tx=" + format(raster.getSampleModelTranslateX()));
                System.out.print(" ty=" + format(raster.getSampleModelTranslateY()));
                System.out.print(" sm=" + raster.getSampleModel().getClass().getName());
                System.out.println();
            protected String format(int value) {
                String txt = Integer.toString(value);
                while(txt.length() < 4)
                    txt = " " + txt;
                return txt;
            public void dispose() {
        public static void main(String[] args) {
            new TestCustomComposite2();
    }

  • IMac 21" late 09: Slow, screen flickering/tearing and odd behavior - the problem that puzzles everyone

    PLEASE HELP!
    My iMac 21" late -09, started acting a bit wierd a year ago. Things got worse rapidly, it got slower, the screen flickers/tears (see link below), short moments of lost internet connection, lost connection whit the keyboard (might be keyboard that is broken), almost overheats when gaming and odd behavior on some webbsites whit galleries and/or videos.
    Let's begin whit the screen: it's not vertikal lines or major distortions, just a subtle horisontal line that "wanders" from bottom to topp and some lagging from time to time. Looks like this: http://cl.ly/3i2W2o3S1D2T
    The wierd thing is that hi-res does not mean more "tearing". Yes the lagg and risk of tearing increases, but the connection seems to be: lots of movement=tearing. So a pixeld 240p video of people dancing can be way worse than a news debbate in1080p!?!
    Lost connection whit internet and keyboard rarely happens and is probably due to something else, but thought that was good to have in mind.
    Odd behavior: galleries ex: when browsing images on Facebook in fullscreen, the image sometimes jumps around in the beginning and when clicking on next the same picture might appear again or just nothing at all. When scrolling down overwiewing a gallery, the updating stops and you can't scroll down further. This problem appers mainly on FB, deviantart also acts a bit wierd but there is often small issues whit image sites. Doesn't help to switch browsers either!
    Videos: Youtube is horrible to use, stops loading, dosen't start loading, erases everything loaded (grey bar disapears and reloads), refuse to switch ressolution and suddenly stops the video like it was done! "ehh.. wasn't this 2min long? Not anymore, now its 34sec!". Mainly a Youtube problem but many similar sites can be a bit problematic to use.
    NO, it's not the HTML-5 problem or any standard flash issue and using a different browser dosen't help!
    Worst is the fact that most of these errors are not constant! One day your watching youtube or mabey a movie in VLC, a bit laggy, but almost no problem. Next day **** brakes lose and after 2hours of struggling you are ready to stabb yourself in the face!
    What i tried: Most easy buggfixes that might cause the above problems, updating most things, Switched from OS X SL to OS X ML, complete reinstall and some things i probably forgot by now. Then went to MacStore for repair, they didn't find anything wrong and said it worked fine after the standard diagnostic/repair program!?! Went home and everything was the same! Went a second time to MacStore, same result.
    So I'v reinstalled a few times and it seems to improve the Mac. But 2-3weeks later every error is back, even if I barely installed or downloaded anything!?!
    Any idea what this could be? Or is the graphic card broken and MacStore has a blind, inbred muppet as a technician?

    No I didn't. The first time i explained the problem thoroughly and thought that they just couldn't miss such a visual error. I was wrong. The second time the technician wasn't there so i showed the above clip to the salesstaff and explained everything onceagain. Later the technician called me and we talked for 10min.
    Btw, the problems always "manifests themselves", just varies between strenght and frequence.
    But all other issues aside, what could cause the tearing of the screen as seen int the above clip?

  • Parse Exception : java.text.ParseException: Unparseable date

    I have inherited a UDF in some mapping that on the whole, works okay...
    but it throws an error after mapping a few dates:
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-18T00:00:00.000Z"
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-23T23:59:00.000Z"
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-18T00:00:00.000Z"
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-23T23:59:00.000Z"
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-18T00:00:00.000Z"
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-23T23:59:00.000Z"
    the first few map okay...  then i get the exception.
    the UDF is as follows:
    public String convertDateTimeToUTC(String strDate, Container container) throws StreamTransformationException{
    AbstractTrace trace = container.getTrace();
    Date date=null;
    SimpleDateFormat sdfSource = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
    try{
    String dt = strDate;
    date = sdfSource.parse(dt);
    trace.addInfo("Local Date:"+date);
    SimpleDateFormat sdfDestination = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    strDate = sdfDestination.format(date);
    catch(ParseException pe){
    trace.addInfo("Parse Exception : " + pe);
    return strDate;
    can anyone see why this fails after successfully mapping a few fields???

    the first mapping works correctly...
    then we reuse the same fields to map to the additional segments.
    the context is correct as it is trying to pull the same fields in...  it just throw the error with the same data in the same UDF/Function Library but for different segments! :o(
    http://img199.imageshack.us/img199/3104/dateconversion.jpg
    as you can see from the screenshot above, the mapping works in the first instance, then fails on subsequent nodes.

  • HT4623 I just updated my iphone 4s and lost all my photos except in the photo stream.

    I just updated my iphone, but lost all my photos except in the photo stream.... I did back it up before i updated.  Anyone know where they could be?

    /Are you using itunes or icloud backup?  http://support.apple.com/kb/HT1766

  • Stream data from a subvi to the main vi

    Hi
    I’m wondering if someone can help me. I’m trying to stream data from a sub vi to the main vi without opening and closing the sub vi continuously. The data also needs to be extracted from a while loop within the sub vi.  background info: The sub vi controls a photomultipler tube, which once it is on it is best kept on. The PMT signal is generated in while loop of the sub vi. Attached are some basic vis showing what I’m trying to do.
    Thanks
    Attachments:
    Main page.vi ‏11 KB
    test2.vi ‏13 KB

    If you are streaming measurements continously I would consider using a circular buffer instead of the queued producer/consumer approach.
    Check out this implementataion of such a buffer, use only this if your DAQ device does not have an internal circular buffer.
    https://decibel.ni.com/content/docs/DOC-20403
    Alternatively if you are using a DAQmx device, consider using the device buffer for sharing DAQ data between loops.
    Br,
    /Roger

  • Stream data from a subvi to the main vi - path refnum

    hello everyone
    sorry my english
    http://forums.ni.com/t5/LabVIEW/stream-data-from-a-subvi-to-the-main-vi/m-p/2205150/highlight/true#M...
    - refnum boolean worked
    - refnum graph worked
    - refnum numeric worked
    how to create a  path refnum? stream data from a subvi to the main vi
    where do I start?
    thank
    Solved!
    Go to Solution.

    Bom Dia Saille,
    Eu acredito que o que você tenha hoje seja isso aqui (Desenho bem simplificado):
    Hoje o que você tem é o Aplicativo do Medidor + USB Driver controlando o seu medidor. Basicamente, sua aplciação está dividida em três camadas:
    Aplicação - Onde estão as funcionalidades principais do programa (interface com o usuário, apresentação de dados, geração de arquivos, etc.)
    VISA - Uma arquitetura de Software para controle de instrumentos. Basicamente, ele se comunica com o Driver USB para poder enviar e receber pacotes de dados através do barramento USB.
    Device Driver - Intruções de SW de baixo nível para controlar um periférico através de um barramento.
    No desenho, eu aponto duas camadas onde você pode tentar atuar para automatizar suas medições:
    Aplicação - Você pode usar o VI Server para controlar o Aplicativo do Medidor (Se este aplicativo tiver sido desenvolvido em LabVIEW, o que eu suponho ser verdade). No entanto é necessário saber se o desenvolvedor do produto permitiu isso (Veja Using VI Server to Pass Data Between a VI and a LabVIEW Executable). Outra alternativa é conversar com o fabricante para ver se ele desenvolveu alguma API (Application Programming Interface) para que você consiga controlar o instrumento diretamente.
    VISA - O LabVIEW Fornece uma API chamada NI-VISA para poder enviar e receber informações através de diversos barramentos (Veja Serial Instrument Control Tutorial)
    É possível acessar o Driver diretamente também, mas eu não recomendo. O resultado não compensa o esfroço!
    Espero ter esclarecido suas dúvidas e espero que você tenha sucesso na sua aplicação!!
    Atenciosamente.
    Felipe Flores
    Engenharia de Aplicações
    National Instruments Brasil

Maybe you are looking for