C# - Excel Interop (Parallel.For)

Hi All,
I had a Excel Macro which i converted into C#. (Interop)  It has 5 different methods for some calculations for report creation.
2 method out of these are running very slow due  to complex calculation. (10 minutes each for 40 mb data)
After checking these methods, I found that there are few "FOR" loops which takes the time. (It iterate each row in sheet and do some calculation for each cell in row)
After some searching, i found that i can use "parallel.For" loop for enhance performance.
But Thread throws error "Exception from HRESULT: 0x800AC472".  After searching
i found that it because of STA.
Any pointers for better performance with C# to Excel (Interop) parallel programming would be helpful.
Thanks.
Thanks & Regards, Rakesh Parmar

Perhaps you will be also interested in one more optimisation approach. Instead of reading each cell separately, you can transfer a larger range (the entire filled row, or even all of the needed rows) into an array, such as
‘object [,] data = (object [,])someRange.Value2’. Then use this bi-dimensional array. See:
http://www.bing.com/search?q=c%23+increase+excel+performance+range+array.
You can probably also create several Threads manually (if
Parallel.For cannot be used) and control the AppartmentState property. Or process the previous array in parallel with threads or with
Parallel.For.

Similar Messages

  • Excel Interop

    Hi there!  We have a proposal template in Excel that, in my code, I export to a JPG and attach to an e-mail.  I've been using Excel Interop for this.  Since we've upgraded to .NET 4.5 it isn't working.  I understand there's been some
    changes.  I'll admit I don't understand this stuff.  I grabbed some code off the internet, modified it and have been using it.
    The thing is, the code is working on my development machine, but not on a couple of my test machines once I compile it and deploy.  I don't quite know why.  The Interop assemblies are on all the machines.  Here's my code:
    Sub ExportProposalToJPG(ByVal path As String)
    '' See if excel is open, if so, need to close
    Dim excelCount As Integer = 0
    For Each myProcess As Process In System.Diagnostics.Process.GetProcesses
    If UCase(Mid$(myProcess.ProcessName, 1, 5)) = "EXCEL" Then
    myProcess.Kill()
    excelCount += 1
    End If
    Next
    MsgBox(Str(excelCount) + " instances of Excel closed.")
    If My.Computer.FileSystem.FileExists(Environ("Temp") & "\proposal.jpg") Then
    My.Computer.FileSystem.DeleteFile(Environ("Temp") & "\proposal.jpg")
    End If
    Dim excel As Microsoft.Office.Interop.Excel.Application
    Dim wb As Microsoft.Office.Interop.Excel.Workbook
    Dim ws As Microsoft.Office.Interop.Excel.Worksheet
    Dim MyChart As Microsoft.Office.Interop.Excel.Chart
    Dim objPict As Object
    Dim RgCopy As Microsoft.Office.Interop.Excel.Range
    Try
    excel = New Microsoft.Office.Interop.Excel.Application
    excel.DisplayAlerts = False
    Dim myFilename As String
    myFilename = System.IO.Path.GetDirectoryName(path) & "\" & "~$" & System.IO.Path.GetFileName(path)
    If My.Computer.FileSystem.FileExists(myFilename) Then
    My.Computer.FileSystem.DeleteFile(myFilename)
    End If
    wb = excel.Workbooks.Open(path, 2, True)
    '' CHANGE THIS BACK TO FALSE!!!
    excel.Visible = False
    wb.Activate()
    ws = wb.ActiveSheet
    'RgCopy = Application.InputBox("Select the range to copy / Saveas", "Selection Save", Selection.Address, Type:=8)
    RgCopy = excel.Range("A1", "K63")
    RgCopy.CopyPicture(XlPictureAppearance.xlScreen, XlCopyPictureFormat.xlBitmap)
    excel.ActiveSheet.PasteSpecial(Format:="Bitmap")
    objPict = excel.Selection
    With objPict
    .CopyPicture(1, 1) ':=1
    MyChart = excel.ActiveSheet.ChartObjects.Add(1, 1, .Width + 8, .Height + 8).Chart
    MyChart.SetSourceData(RgCopy)
    End With
    With MyChart
    .Paste()
    .Export(Environ("Temp") & "\proposal.jpg")
    .Parent.Delete()
    End With
    MyChart = Nothing
    wb.Close(False)
    MsgBox("Proposal Exported.")
    Exit Sub
    System.Runtime.InteropServices.Marshal.ReleaseComObject(excel)
    RgCopy = Nothing
    objPict = Nothing
    MyChart = Nothing
    ws = Nothing
    wb = Nothing
    Try
    excel.Quit()
    Catch
    End Try
    excel = Nothing
    Catch
    MsgBox(Err.Description)
    End Try
    GC.Collect()
    GC.WaitForPendingFinalizers()
    GC.Collect()
    GC.WaitForPendingFinalizers()
    End Sub
    Here is the error I get:
    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.
    ************** Exception Text **************
    System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
       at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
       at Microsoft.Office.Interop.Excel.Range.CopyPicture(XlPictureAppearance Appearance, XlCopyPictureFormat Format)
       at EwingDataApplication.Utilities.ExportProposalToJPG(String path)
       at EwingDataApplication.SendEmail.setPath(String path)
       at EwingDataApplication.EditSignWorkOrder.Button8_Click(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.18444 built by: FX451RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
    EwingDataApplication
        Assembly Version: 1.0.0.39
        Win32 Version: 1.0.0.39
        CodeBase: file:///C:/Users/tewing.EWINGGRAPHICS/AppData/Local/Apps/2.0/XCDV80Z3.63R/6NBNX34M.P4H/ewin..tion_9b22d5a3b42c0366_0001.0000_74bc74471f410f1b/EwingDataApplication.exe
    Microsoft.VisualBasic
        Assembly Version: 10.0.0.0
        Win32 Version: 11.0.50938.18408 built by: FX451RTMGREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
    System
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34238 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    System.Core
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
    System.Windows.Forms
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    System.Drawing
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    System.Runtime.Remoting
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34245 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
    System.Configuration
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    System.Xml
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.34234 built by: FX452RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
    Ewing
        Assembly Version: 1.0.0.0
        Win32 Version: 1.0.0.0
        CodeBase: file:///C:/Users/tewing.EWINGGRAPHICS/AppData/Local/Apps/2.0/XCDV80Z3.63R/6NBNX34M.P4H/ewin..tion_9b22d5a3b42c0366_0001.0000_74bc74471f410f1b/Ewing.DLL
    System.Data
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
    Npgsql
        Assembly Version: 2.2.0.0
        Win32 Version: 2.2.0
        CodeBase: file:///C:/Users/tewing.EWINGGRAPHICS/AppData/Local/Apps/2.0/XCDV80Z3.63R/6NBNX34M.P4H/ewin..tion_9b22d5a3b42c0366_0001.0000_74bc74471f410f1b/Npgsql.DLL
    System.Transactions
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
    Mono.Security
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.0.0
        CodeBase: file:///C:/Users/tewing.EWINGGRAPHICS/AppData/Local/Apps/2.0/XCDV80Z3.63R/6NBNX34M.P4H/ewin..tion_9b22d5a3b42c0366_0001.0000_74bc74471f410f1b/Mono.Security.DLL
    System.Numerics
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
    Microsoft.Office.Interop.Excel
        Assembly Version: 15.0.0.0
        Win32 Version: 15.0.4675.1003
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Interop.Excel/15.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Excel.dll
    office
        Assembly Version: 15.0.0.0
        Win32 Version: 15.0.4675.1002
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/office/15.0.0.0__71e9bce111e9429c/office.dll
    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.
    For example:
    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>
    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.
    Is this enough info to get some help?  Am I going in the wrong direction?  Is Interop not the way to go on this?  I want to save an Excel sheet from my database, export it to an image, and attach it to my work order.  This worked before
    we upgraded our server. 
    Thanks!
    Dave Sharpe
    Ewing Graphics

    Without really looking at the all of the error information apparently your non development machines must be different in some fashion from your development machine if you've installed your app onto your development machine and it works without being run
    from Visual Studio.
    Just because some .Dlls are on all the machines does not mean they are all the same .Dll's with regard to version or other properties.
    Are all the machines x86 or x64? Is the development machine running x86 or x64 Office? Which version of Office? Is that same version of office (x86 or x64) installed on the non development machines?
    It's possible that using the references on your development machine to install with your app would resolve issues. To do that see this thread
    Line and Rectangle shapes in VS 2013 that provides instruction on how to make your app provide copies of all referenced assemblies so they can be included with the app when it gets installed on a system.
    Also see
    .Net 4.5 - How the Runtime Locates Assemblies.
    And obviously the non development machines have .Net 4.5 installed on them as that is what your app is compiled to.
    La vida loca

  • Parallels for the mac

    I recently bought Parallels for my macbook to download windows xp.
    I am taking a class at the local college.
    I have microsoft Word, Excel, Powerpoint for the Mac.
    Do I need to buy microsoft programs for the Windows xp side in order
    to work on my files w/ the online class?
    need help

    You will need Windows programs to run under Windows on a PC or in parellels.
    You can open Microsft Word, Exel files from Windows in the same programs on a Mac and vice versa. If the tuition is being done in say Word in Windows and you are using Word on a Mac then there might be some differences in menu item locations.
    With Parelles you can run both OS's at the same time and just toggle from one to another, this is what I do. I have an alias of my user folder and my desktop folder on the WIndows desktop so I can pull things back and forwards between the two OS's... it is really neat. I never thought it would be so easy using the two operating systems together.
    Hopefully this is helpful or solved your problem. Consider rewarding some points!
    Please see the "helpful" and "solved" button's on top off this message.

  • Add a "%" symbol with Excel Interop

    Hello folks!
    How do I programmatically put a "%" symbol to a column in the Excel chart. I am using Excel Interop library.
    Any advice will be appreciated!

    I am working on wpf desktop application in which I am using C# 4.0 and MVVM design pattern. The app generates several Excel reports and I am using Microsoft.Office.Interop.Excel.dll library to export data from wpf app to excel file. I have found that the
    Microsoft.Office.Interop.Excel.dll library is a good choice for dealing with Excel files. Below is the code I am using to generate the chart above. 
    private void CreateChart(string[] xValues, double[] yValues)
    var xlCharts = (Excel.ChartObjects)_sheet.ChartObjects(Type.Missing);
    var myChart = (Excel.ChartObject)xlCharts.Add(48, 241, 750, 400);
    var chartPage = myChart.Chart;
    chartPage.HasLegend = false;
    chartPage.ChartType = Excel.XlChartType.xlColumnClustered;
    chartPage.ChartStyle = 4;
    var seriesCollection = chartPage.SeriesCollection();
    var series1 = seriesCollection.NewSeries();
    series1.Name = MetroNew.Localization.Properties.Resources.ReportFractionTitle;
    series1.XValues = xValues;
    series1.Values = yValues;
    var vertAxis = (Axis)chartPage.Axes(XlAxisType.xlValue, XlAxisGroup.xlPrimary);
    vertAxis.HasMajorGridlines = true;
    vertAxis.MaximumScaleIsAuto = false;
    vertAxis.MaximumScale = 100;
    vertAxis.MinimumScaleIsAuto = false;
    vertAxis.MinimumScale = 0;
    var pointsCount = series1.Points().Count;
    Color color;
    for (int i = 1; i <= pointsCount; i++)
    if (i <= 50)
    color = Color.FromName(i.GetColorByName());
    else
    var rnd = new Random();
    int index = rnd.Next(1, 50);
    color = Color.FromName(i.GetColorByName());
    series1.Points(i).Interior.Color = color;
    var axis = (Axis)chartPage.Axes(
    Excel.XlAxisType.xlValue,
    Excel.XlAxisGroup.xlPrimary);
    axis.HasTitle = true;
    axis.AxisTitle.Text = MetroNew.Localization.Properties.Resources.ReportFractionContentTitle;
    series1.ApplyDataLabels(
    Excel.XlDataLabelsType.xlDataLabelsShowLabel,
    true, true, true, false, false, true, true,
    true, true);

  • C# - Excel Interop - Print Areas - French

    Hi,
    I'm writing a C# application that manipulates an Excel sheet. That Excel sheet has Print Areas that has to remain intact.
    The problem comes from the Office language (French). When I open the Excel Workbook with the Workbooks.Open method, the Print Areas (Zone_d_impression in French Excel) gets renamed to Print_Area. Excel can no longer read the Print Areas once they have been
    renamed.
    This happens as you open the Workbook, even before saving. If Excel is launched with Visbility enabled, the Print Areas are not work and if you close without saving and open the file manually, the Print Areas are still there. However, if you save the Excel
    opened with the interop, the Print Areas are gone even if opened manually afterwards.
    Any tips?

    Hi,
    I'm not exactly sure a screenshot of what exactly could help you. The code? The excel print area names?
    I think it's more of a explanable by text issue then screenshot so if you need more details on the issue or my english made my original post misunderstood, please let me know. I'll try to clarify it.
    -Edit-
    I'll try to explain it a little more in a "Scheme" form:
    Description of the Excel workbook :
    There is 4 sheets, 3 display and 1 hidden that contains data. The 3 display pages has formulas to concatenate data from the 4th hidden sheet to display it in a legal format. All the cells with formulas or layout in the display sheet are locked and only one
    section (range) plus a few cells are filled manually. There can be added rows in the "section" which kills any possibility of setting the print area automatically with a range, which leads me to setting the area in the initial model.
    Steps:
    -Excel form created using French Excel 2007.
    -C# Winform application manages a SQL database (not really important for this issue)
    -User clicks on the "Generate" button when all the data in the winform is filled.
    -Application checks of there Excel sheet already exists and if not, copys the model sheet.
    -Application opens the already in place sheet or the fresh copy. -Print Areas are lost here-
    -Application saves the sheet. -Sheet saved with the lost sheets-
    My observations:
    The Print areas are lost BEFORE SAVING. If the application runs the Excel application with Visibility set to True, and add a break to stop before it set data or save or close the workbook, you already lost them, but if you close the excel without saving
    (or kill the application) and open the workbook manually, the Print Areas are still there. The problem happens when the application opens the workbook and not when it manipulates or saves it.
    Now the Print Areas are not really "Lost" or "Deleted" or "Broken". The problem is that when opening a workbook with the Excel Interop, it seems to be renaming the Print Areas from French "Zone_d_impression" (remember the Excel used is a French 2007 version)
    to "Print_Area". However, the Excel application controlled by the interop is a French version as well, so I have no clue why the interop acts as it needs to adapt the workbook in english if the application it controls is in french. After renaming the Print
    Areas to english, they simply appears as "Named Ranges" in excel and does not affect the printing.

  • Is there a comparable "excel solver" application for Numbers?

    Is there a comparable "excel solver" application for Numbers and where can I find it?
    Thank you.

    After trying the solver I think you get a similar result in Numbers using a slider-- the bonus I think it is easier.
    Here's an example:
    In electrical engineering two resistors in parallel create an equivalent resistance as:
    Re = 1 / [ (1/R1) +(1/R2) ]:
    Here I set up a "solver":
    B4=1/((1/B2)+(1/B3))
    Then I preset R1 and R2 to 10000 (below) and formatted R2 as a slider with a range from 1 to 100000:
    Then you can slide the control left and right to "Sweep" R2 until you get the Req you want.  In my example I was trying to get Req = 8000

  • What algorithm does Excel 2010 use for Pseudo Random Number Generation (MT19937?)

    Does Excel 2010+ use the Mersenne Twister (MT19937) algorithm for Pseudo Random Number Generation (PRNG), implemented by the RAND() function?
    This has been a nagging question for some time now, with "hints" that it indeed does.  However, a relatively thorough search turns up no definitive documentation.  The most direct indication is perhaps given by Guy Melard [Ref 9] where
    he tests Excel 2010's RAND() function using the Crush battery of tests in TestU01 by L'Ecuyer & Simard.  Melard references a "semi-official" indication that Microsoft did indeed implement MT19937 for the RAND() function in
    Excel 2010, but this reference no longer seems to be available. http://office.microsoft.com/enus/excel-help/about-solver-HP005198368.aspx?pid=CH010004571033.
    The other references below [Ref 1-10] document the history of the statistical suitability of the PRNG and probability distributions in various versions of Excel.  This includes the Wichmann-Hill PRNG implementations supposedly (arguably) used in
    Excel 2003 & 2007 for random number generation.  But still, we have no answer as to which PRNG algorithm is used in
    Excel 2010 (and 2013 for that matter).
    Microsoft indicates that RAND() has been improved in Excel 2010; Microsoft states, "...and the RAND function now uses a new random number algorithm." (see https://support.office.com/en-ca/article/Whats-New-Changes-made-to-Excel-functions-355d08c8-8358-4ecb-b6eb-e2e443e98aac). 
    But no details are given on the actual algorithm.  This is critical for Monte Carlo methods and many other applications.
    Any help would be much appreciated. Thanks.
    [Ref 1] B. McCullough, B. Wilson.  On the Accuracy of Statistical Procedures in Microsoft Excel 97. 
    Computational Statistics & Data Analysis. Vol. 31 No. 1, pp 27-37. July 1999.
    http://users.df.uba.ar/cobelli/LaboratoriosBasicos/excel97.pdf
    [Ref 2]L. Knüsel.  On the accuracy of the statistical distributions in Microsoft Excel 97. Computational Statistics & Data Analysis. Vol. 26 No. 3, pp 375-377. January 1998.
    http://www.sciencedirect.com/science/article/pii/S0167947397817562
    [Ref 3]B. McCullough, B. Wilson.  On the Accuracy of Statistical Procedures in Microsoft Excel 2000 and Excel XP. 
    Computational Statistics & Data Analysis. Vol.40 No. 4, pp 713-721. October 2002.
    https://www.researchgate.net/publication/222672996_On_the_accuracy_of_statistical_procedures_in_Microsoft_Excel_2000_and_Excel_XP/links/00b4951c314aac4702000000.pdf
    [Ref 4] B. McCullough, B. Wilson.  On the Accuracy of Statistical Procedures in Microsoft Excel 2003. 
    Computational Statistics & Data Analysis. Vol.49. No. 4, pp 1244-1252. June 2005.
    http://www.pucrs.br/famat/viali/tic_literatura/artigos/planilhas/msexcel.pdf
    [Ref 5] L. Knüsel. On the accuracy of statistical distributions in Microsoft Excel 2003. Computational Statistics & Data Analysis, Vol. 48, No. 3, pp 445-449. March 2005.
    http://www.sciencedirect.com/science/article/pii/S0167947304000337
    [Ref 6]B. McCullough, D.Heiser.  On the Accuracy of Statistical Procedures in Microsoft Excel 2007. 
    Computational Statistics & Data Analysis. Vol.52. No. 10, pp 4570-4578. June 2008.
    http://users.df.uba.ar/mricci/F1ByG2013/excel2007.pdf
    [Ref 7] A. Yalta. The Accuracy of Statistical Distributions in Microsoft<sup>®</sup> Excel 2007. Computational Statistics & Data Anlaysis. Vol. 52 No. 10, pp 4579 – 4586. June 2008.
    http://www.sciencedirect.com/science/article/pii/S0167947308001618
    [Ref 8] B. McCullough.  Microsoft Excel’s ‘Not The Wichmann-Hill’ Random Number Generators. Computational Statistics and Data Analysis. Vol.52. No. 10, pp 4587-4593. June 2008.
    http://www.sciencedirect.com/science/article/pii/S016794730800162X
    [Ref 9] G. Melard.  On the Accuracy of Statistical Procedures in Microsoft Excel 2010. Computational Statistics. Vol.29 No. 5, pp 1095-1128. October 2014.
    http://homepages.ulb.ac.be/~gmelard/rech/gmelard_csda23.pdf
    [Ref 10] L. Knüsel.  On the Accuracy of Statistical Distributions in Microsoft Excel 2010. Department of Statistics - University of Munich, Germany.
    http://www.csdassn.org/software_reports/excel2011.pdf

    I found the same KB article:
    https://support.microsoft.com/en-us/kb/828795
    This was introduced (according to the article) in Excel 2003. Perhaps the references in notes 2 and 3 might help.
    The article describes combining the results of 3 generators, each similar to a Multiply With Carry (MWC) generator, but with zero carry. MWC generators do very well on the Diehard battery of randomness tests (mentioned in your references), and have
    very long periods. But using zero carry makes no sense to me.
    Combining the three generators only helps if the periods of the 3 are relatively prime (despite what the article implies). Then the period of the result will be the product of the 3 periods. But without knowing the theory behind these generators, I have
    no idea what the periods would be. The formulas for MWC generators fail here.
    Richard Mueller - MVP Directory Services

  • How to code a parallel 'for loop' and 'while loop' where the while loop cannot terminate until the for loop has finished?? (queues also present)

    I've attached a sample VI that I just cannot figure out how to get working the way that I want.  I've labeled the some sections with black-on-yellow text boxes for clarity during the description that follows in the next few sentences.  Here's what I want:
    1) overall -- i'm intend for this to be a subVI that will do data acquisition and write the data to a file.  I want it to use a producer/consumer approach.  The producer construct is the 'parallel for loop' that runs an exact number of times depending on user input (which will come from the mainVI that is not included).  For now I've wired a 1-D array w/ 2 elements as a test case.  During the producer loop, the data is acquired and put into a queue to be delt with in the consumer loop (for now, i just add a random number to the queue).
    2) the consumer construct is the 'parallel while loop'.  It will dequeue elements and write them to a file.  I want this to keep running continuously and parallel until two conditions are met.
          i. the for loop has finished execution
          ii. the queue is empty.
       when the conditions are met, the while loop will exit, close the queue, and the subVI will finish. (and return stuff to mainVI that i can deal with on my own)
    Here's the problems.
    1)  in the "parallel for loop" I have a flat sequence structure.. I haven't had time to incorporate some data dependency into these two sequential sections, but basically, I just care that the "inner while loop" condition is met before the data is collected and queued.  I think I can do this on my own, but if you have suggestions, I'm interested.
    2)  I can easily get the outer for and while loops to run sequentially, but I want them to run in parallel.  My reasoning for this is that that I anticipate the two tasks taking very different amounts of time. .. basically, I want the while loop to just keep polling the queue to get everything out of it (or I suppose I could somehow use notifiers - suggestions welcome)...  the thing is, this loop will probably run faster than the for loop, so just checking to see that the queue is empty will not work... I need to meet the additional condition that nothing else will be placed in the queue - and this condition is met when the for loop is complete. basically, I just can't figure out how to do this.
    3) for now, I've placed a simple stop button in the 'parallel while loop', but I must be missing something fundamental here, because the stop button is totally unresponsive.  i.e. - when I press it, it stays depressed, and nothing happens.
    suggestions are totally welcome!
    thanks,
    -Z
    Attachments:
    daq01v1.vi ‏59 KB

    I'd actually like to add a little more, since I thought about it a bit and I'm still not quite certain I understand the sequence of events...
    altenbach wrote:
    zskillz wrote:
    So i read a bit more about the 'dequeue element' function, and as I understand it, since there is no timeout wired to the dequeue element function, it will wait forever, thus the race condition I suggested above can never happen!
    Yes, you got it!
    As I've thought about it a bit more, there's a few things that surprise me... first, the reason the 'dequeue element while loop' errors is not because there's nothing in the queue, it's becaues the queue has been released and it's trying to access that released queue...   However the problem I have is this --- Even though there's no timeout wired to the dequeue element, I still would think that the while loop that contains it would continue to run at whatever pace it wanted -- and as i said before.. most of the time, it would find that there is nothing to dequeue, but once in a while, something is there.  however, it seems that this loop only runs when something has been enqueued.  the reason I say this is illustrated in the next code sample MODv2 that's attached below.  I've added a stop button to the "queue size while loop" so the program runs until that is pressed.  I've also added a simple conditional in the "dequeue while loop"  that generates a random number if it a button is pressed... but this button is totally non-responsive... which means to me that the "dequeue while loop" isn't actually continuously running, but only when an element is added to the queue.  this still seems almost like the 'dequeue while loop" waits for a notifier from the queue telling it to run.  can you explain this to me? because it is different from what I expect to be happening.
    rasputin wrote:
    I tried to open your VIs but it doesn't work. LV
    is launched, the dialog box (new, open, configure...) opens and then...
    nothing. Not even an error message. I guess it isn't a problem of LV
    version or a dialog box would appear saying this. Could you, please,
    send a image of the code?
    Thanks,
    Hi Rasputin, I'm using LV8.  I assume that was your problem, but who knows.  I've attached a pic of of altenbach's solution since it's what I needed.
    thanks
    -Z
    Message Edited by zskillz on 10-20-2006 11:49 AM
    Attachments:
    daq01v1MODv2.vi ‏63 KB
    daq01v1MODpic.JPG ‏116 KB

  • How to run the same procedure in parallel for different parameter value.

    Hi There,
    I am currently working on extracting data in to flat file and I am able to do so for one revenue month (e.g. 200101) using PL/SQL procedure(get_rev_data). it takes almost 1 hour to execute the procedure completely and it generates 400 MB data file. Now I have to run this procedure for last 10 yrs of data (i.e. 120 revenue months) . my prolem here is to figure out a way/logic in such a way that I can run the procedure in parallel for each revenue month and at the same time it will write the data in respective data file for each revenue month. so the final result of this exercise would be 120 flat files, one for each revenue month with file names like
    EXTRACT_00001001 to EXTRACT_00001120.
    where
    first five digits : 00001 will indicate the Extract run number and
    last three digits : 001 will indicate the thread number for each run.
    I am thinking of doing this by creating a table "RevMonth" with two values (revenue_month, thread_num) and calling the procedure in a simple select statement and passing revenue_month as parameter of the procedure like
    SELECT get_rev_data(revenue_month, thread_num)
    FROM REVMONTH;
    But I am not sure if that will do the needful. Any idea on how to achieve this will be of great help. Thank you.

    Hi Smit,
    Thanks for the advise. I am not planning to run for all 120 months at once. actually I am planning to run like 1 year (12 revenue months at a time). I am not sure if that will work well but I was planning to run this through shell script (Unix) and will call the same procedure with different parameter (revenue_month and Thread_number) values and see what happens. I hope that will run in parallel for each revenue month.
    Let me know if you have more knowledge about it. THanks a lot.
    Thanks,
    .

  • Calling a CAF program via web service generates QName cannot be null error, but only for 1/5 of the same call in a parallel for loop.

    I'm calling 5 identical web service calls using a parallel for loop in BPM. Obviously the data in each slightly differs. Why would this call suspend the process and give the following errors:
    handleCommunicationError( ErrorContextData, Throwable, TransitionTicket ): A technical error occurred.
    Interface namespace = myNamespace
    Interface name = myService
    Operation name = myOperation
    Connectivity type = WS
    Application name = myAppName
    Reference name = 8bd95deb-8cf1-453d-94e5-0576bb385149
    Message Id = null
    WS style = DOC
    Start time of WS call = 2014-02-26 17:51:23.297
    Return time of WS call = 2014-02-26 17:51:23.412
    Principal name = SAP_BPM_Service
    Root error message = local part cannot be "null" when creating a QName
    Error message = Could not invoke service reference name 8bd95deb-8cf1-453d-94e5-0576bb385149, component name myComp application name myappname
    com.sap.engine.interfaces.sca.exception.SCADASException: Could not invoke service reference name 8bd95deb-8cf1-453d-94e5-0576bb385149, component name
    myCompname
    at com.sap.engine.services.sca.das.SCADASImpl.invokeReference(SCADASImpl.java:341)
    at com.sap.glx.adapter.app.ucon.SCADASWrapperImpl.invoke(SCADASWrapperImpl.java:101)
    at com.sap.glx.adapter.app.ucon.UnifiedWebServiceCallObject.invokeWebServiceOperation(UnifiedWebServiceCallObject.java:101)
    at com.sap.glx.adapter.app.ucon.UnifiedWebServiceCallClass.invoke(UnifiedWebServiceCallClass.java:178)
    at com.sap.glx.core.dock.impl.DockObjectImpl.invokeMethod(DockObjectImpl.java:657)
    at com.sap.glx.core.kernel.trigger.config.Script$MethodInvocation.execute(Script.java:248)
    at com.sap.glx.core.kernel.trigger.config.Script.execute(Script.java:798)
    at com.sap.glx.core.kernel.execution.transition.ScriptTransition.execute(ScriptTransition.java:78)
    at com.sap.glx.core.kernel.execution.transition.Transition.commence(Transition.java:196)
    at com.sap.glx.core.kernel.execution.LeaderWorkerPool$Follower.run(LeaderWorkerPool.java:163)
    at com.sap.glx.core.resource.impl.common.WorkWrapper.run(WorkWrapper.java:58)
    at com.sap.glx.core.resource.impl.j2ee.J2EEResourceImpl$Sessionizer.run(J2EEResourceImpl.java:261)
    at com.sap.glx.core.resource.impl.j2ee.ServiceUserManager$ServiceUserImpersonator$1.run(ServiceUserManager.java:152)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:337)
    at com.sap.glx.core.resource.impl.j2ee.ServiceUserManager$ServiceUserImpersonator.run(ServiceUserManager.java:149)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:185)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:302)
    Caused by: java.lang.IllegalArgumentException: Could not process message for operation myOperation in web service plugin module.
    at com.sap.engine.services.sca.plugins.ws.WebServiceImplementationInstance.accept(WebServiceImplementationInstance.java:228)
    at com.sap.engine.services.sca.das.SCADASImpl.invokeReference(SCADASImpl.java:314)
    ... 19 more
    Caused by: java.lang.IllegalArgumentException: local part cannot be "null" when creating a QName
    at javax.xml.namespace.QName.<init>(QName.java:246)
    at javax.xml.namespace.QName.<init>(QName.java:190)
    at com.sap.engine.services.webservices.espbase.client.dynamic.impl.DInterfaceImpl.getInterfaceInvoker(DInterfaceImpl.java:126)
    at com.sap.engine.services.webservices.espbase.wsdas.impl.WSDASImpl.<init>(WSDASImpl.java:43)
    at com.sap.engine.services.webservices.espbase.wsdas.impl.WSDASFactoryImpl.createWSDAS(WSDASFactoryImpl.java:39)
    at com.sap.engine.services.sca.plugins.ws.tools.wsdas.WsdasFactoryWrapper.createWsdas(WsdasFactoryWrapper.java:30)
    at com.sap.engine.services.sca.plugins.ws.WebServiceImplementationInstance.initWsdas(WebServiceImplementationInstance.java:256)
    at com.sap.
    Surely if it was the service group unassign then reassign issue then none of the calls would have worked?

    Hi David,
    While a random error is still an error it will be difficult for support to find a problem for an error which is not reproducible. It is always a faster resolution if you can determine how to provoke the error and provide those details. If we can reproduce an error on internal systems then we can fix the problem quickly and without having to access your system.
    regards, Nick

  • I can no longer see my attached mail as word, excel or PowerPoint for it does not prompt me to download

    IPad Air 2
    version 8.3
    i can no longer see my attached mail as word, excel or PowerPoint for it does not prompt me to download

    Is it possible you mistakenly clicked on a [Clear Layout] button?
    But a great hint is- Always click on the [Create a Saved Book] button, early in your new book design.
    Then you have a permanent link to the book in the Collections panel. (In addition to the standard collection of your selected images)
    Note: a Book Collection shows an icon that looks like a book.
    Every time you come back to edit the book, open the Book Module by clicking on the white arrow that appears on the end of your Book Collection title. (The title as saved)
    Re-opening a book without using the "Saved Book" option can have unpredictable results.
    A "Book" Collection is like a "Smart Collection" because anything you do to the book design, change pages, change images, etc,  is automatically updated in the Saved Book collection.

  • Problem with uploading data from excel using BDC for tcode f-02

    Hi All,
    I am uploading data from excel using BDC for tcode f-02. The problem here is, while recording, the values of some fields are recording twice. I dont know why it's happening so. But if I run my abap program, I have to give those fields twice in my excel sheet. Otherwise data does not upload. But it is not the feasible way. We must give those fields once in excel. Please tell me, how I can solve the issue.
    With regards,
    Rosaline.

    Hi,
      in BDC each and every action is recording. If your press enter in same screen that also recorded once aging may be this is your case repeating field values will appear. we can solve the problem for repeat fields like below.
    suppose in your excel having repeated field X1 X2 X3 the X2 contains repeated field X3 means delete the X3 field.
    Now In your itab having X1 and X2 fields. While in the LOOP the ITAB pass the X2 field to repeated the fields.
    LOOP at ITAB to WA.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_CURSOR'.
    bdcdata_wa-fval = 'RM08M-EBELN'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'INVFO-BLDAT'.
    bdcdata_wa-fval = wa-X2." 1st time pass the X2 fields
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'INVFO-BLDAT'.
    bdcdata_wa-fval = wa-X2." pass the same value to repeated field
    APPEND bdcdata_wa TO bdcdata_tab.
    Endloop.
    Hope you can understand.
    Regards,
    Dhina..

  • Should I Use Boot Camp or Parallels for use of a Windows Desktop?

    I am migrating from a PC to a Mac; I want to take advantage of having a Windows desktop to run some apps until i buy Mac equivalent software;
    I have Tiger, but am installing Leopard this weekend;
    Should I Use Boot Camp or Parallels for use of a Windows Desktop?
    I am tempted by not having to reboot, but i don't want my mac to slow down?
    I am a photographer and use Photoshop and other graphics intensive programs.

    Hi,
    to achieve full computing power while in Windows you have to use BootCamp and for Photoshop and other apps of that caliber in Windows its the best.
    For apps less demanding using Parallels (VMWare Fusion) is sufficient enough and the slight downgrade in speed is negligible.
    You should however (if not already done) max out the RAM of your Mac.
    Regards
    Stefan

  • Excel/Word viewer for the Mac?

    Is there a free viewer for excel & word docs for the mac as I can't open my attachments in mail?

    I have a Macbook Pro Mac OS X (10.5.5) bought in July 2008 will open office work?
    Yes. NeoOffice, suggested by another poster, is pretty well the same, but may run more slowly: OpenOffice in its latest version runs directly on Leopard (rather than requiring X11 like its earlier versions). It will allow you to edit and save the documents in a MS-compatible format should you require this. Both programs are free.

  • Unable to put a timed structure in a parallel for loop, error -808

    If I try to place a Timed Structure in a Parallel For Loop, the TS needs a different structure name per instance to prevent collisions. However, setting the Structure Name node  to something unique per instance doesn't work, I get error -808. Have I missed something?
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

    That got me thinking - something to do with the number of compiled parallel instances.
    Indeed, the compiler creates a number of parallel instances of the for loop in the compiled code (in my case 8), and uses the number requested at the Parallel Instances terminal (just under the Iterations terminal), which is set to 2. Therefore the compiler has created 8 instances of the Timed Structure, each in its own for loop instance, but they all have the same defined Structure Name. When launched, there is an immediate conflict because they can't share the same name, and error -808 is launched before the set Structure Name function can change it. Hence the error still shows when requesting only one instance, because the other seven still exist.
    I guess this means you can't have Timed Structures (or Timed Loops for that matter too) in a Parallelised For Loop?
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

Maybe you are looking for

  • How to add a JDBC driver jar to ESB project?

    I am developing an EJB project in JDeveloper 10.1.3.1. I am trying to connect MS SQL Server DB to the ESB. I set up the JDeveloper so it can connect to the MS SQL Server, list the tables&data. I put a DB Adapter using the existing connection to the d

  • Issues with exporting photos to be edited in Photoshop CS6 from Lightroom 5.6 using Yosemite OS.

    Suddenly, I'm unable to edit my photos from Lightroom 5.6 in Photoshop CS6.  I have recently converted from Mavericks to Yosemite OS.  But, I haven't had any issues for the past week or two.   Now, whenever I try to Edit photos from Lightroom 5.6 in

  • QuickTime Pro Export freezes up.  Help!!

    I'm trying to export a couple full resolution .mov's to web compatible versions (half-resolution, H.264 Compression, Fast Start). I just upgraded to Pro yesterday (and have QT 7.1.3), and have had several problems... The movies play back fine when I

  • PDB doesn't take underscore parameters during database start

    Hello All underscore parameters which are set on a PDB level are ignored during database start. An underscore parameter is set on a PDB level in memory and spfile. After restarting database the parameter is still in pfile but not anymore in memory. S

  • Architecture Advice - XMLTYPE, VPD, PL

    Hi, apologies if this is off-topic but wasn't sure which forum to pick for general architecture questions... I've inherited an existing application architecture that we're struggling to scale beyond about 100 concurrent users on small-scale hardware,