Cyberiafreak

"Fortunate are those who take the first steps.” ― Paulo Coelho

About DDEInitialize and sometime lockup scenario explained.

I had a chance to work with Excel DDE call lockup Issue,

> The first step in establishing a DDE conversation is that the DDE client will send a WM_DDE_INITIATE message to one or more windows running on the same desktop as the DDE client process. The WM_DDE_INITIATE message is a query to each window receiving the message to determine whether the process that owns the window supports the specified application name and topic. Typically, a DDE client will broadcast the WM_DDE_INITIATE message to all top level windows (both visible and hidden) running on the same desktop, looking for any running process that supports the specified application name and topic.

The implementation of the Excel DDEInitiate function broadcasts the WM_DDE_INITIATE message by calling the SendMessage function, specifying HWND_BROADCAST. The SendMessage call will not return until each top level window has processed the WM_DDE_INITIATE message. The hang that occurs when calling DDEInitiate is the result of one or more threads that own a top level not having an active message pump.

The ListBlockedWindow tool helps to identify each process that contains  threads that do not have an active message pump and own one or more top level windows. The applications identified by the ListBlockedWindow tool should be updated such that each thread that owns a window has an active message pump, even when a given thread owns windows that are not visible. The term “message pump” (or message loop) refers to the calls a thread makes to the GetMessage or PeekMessage functions to retrieve/process any pending window messages for windows owned by the thread. A thread that owns a window receiving a WM_DDE_INITIATE message and does not actively call GetMessage or PeekMessage will cause the thread that is sending the WM_DDE_INITIATE message with SendMessage to block until the message is processed.

Please refer to the following links for additional information about DDE and message processing in Windows.

About Dynamic Data Exchange – http://msdn.microsoft.com/en-us/library/windows/desktop/ms648774(v=vs.85).aspx

Using Messages and Message Queues – http://msdn.microsoft.com/en-us/library/windows/desktop/ms644928(v=vs.85).aspx

SendMessage function – http://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx

Note: this content is not mine, borrowed from my colleague-DaveAnd

October 25, 2014 Posted by | .NET General, Office | Leave a comment

Fix: Open XML SDK hang in multithreaded environments

Just come to know through my colleague about this fix- wanted to share.
We finally have a fix for this long standing issue where applications using Open XML SDK (or System.IO.Packaging) would hang in multithreaded scenarios while working with large files.(10MB limit related bug).

Hotfix rollup 2996566 for the .NET Framework 4.5, 4.5.1, and 4.5.2 on Windows 8.1 and Windows Server 2012 R2
http://support.microsoft.com/kb/2996566
Hotfix rollup 2996567 for the .NET Framework 4.5, 4.5.1, and 4.5.2 on Windows 8 and Windows Server 2012
http://support.microsoft.com/kb/2996567
Hotfix rollup 2996568 for the .NET Framework 4.5, 4.5.1, and 4.5.2 on Vista SP2, Windows Server 2008 SP2, Windows 7 SP1, and Windows Server 2008 R2 SP1
http://support.microsoft.com/kb/2996568

src: Internal email

October 21, 2014 Posted by | Uncategorized | Leave a comment

Connect(); — Join this exciting virtual event for developers!

 

 

 

 

 

 

Connect(); is a cloud-first, mobile-first, code-first virtual event focused on current and future Microsoft technologies for developers. Build on your current skills, unleash your creativity, and expand what’s possible to deliver unprecedented innovations.

Want to ask and interact with Scott Guthrie, S. “Soma” Somasegar, Brian Harry, and Scott Hanselman & watch 40+ondemand vidoes?  http://www.visualstudio.com/connect-event-vs  

October 19, 2014 Posted by | .NET General | | Leave a comment

Convert PPT to SVG – workaround/hack !

One of my colleague wanted to know if there is any support from MS to convert the PPT’s to SVG without going through 3’rd party lib’s. I got an idea and jumped into connect the two different PIA’s to hack around. At the end, I am able to get it what he wanted. Good hacking :) – here is the poc of my sample tested roughly few times. You may have to fine tune or test thoroughly before moving to production.

Objective: PPT => SVG
Proposed idea: PPT (PIA) =>jpg => VISIO (PIA) => SVG.

  1. Create/open a PPT using Office.Interop.PowerPoint
  2. Save the PPT as Jpeg.
  3. Close the PPT
  1. Load a blank VISIO file using Office.Interop.Visio
  2. Import those exported Jpeg –from step2
  3. Export the document as SVG.

======================================
Here is the c# code.

using Office = Microsoft.Office.Core;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Visio = Microsoft.Office.Interop.Visio;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
CreatePowerPointUsingPIA();
CreateSVGfromJpegUsingVisio();

GC.Collect();
GC.WaitForPendingFinalizers();

GC.Collect();
GC.WaitForPendingFinalizers();

Console.Write(“Done.. Press any key to close”);
Console.ReadLine();
}
private static void CreatePowerPointUsingPIA()
{
try
{
PowerPoint.Application oPowerPoint = new PowerPoint.Application();

// By default PowerPoint is invisible, till you make it visible:
//oPowerPoint.Visible = Office.MsoTriState.msoFalse;

PowerPoint.Presentation oPre = oPowerPoint.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoTrue);

PowerPoint.Slide oSlide = oPre.Slides.Add(1,PowerPoint.PpSlideLayout.ppLayoutText);
oSlide.Shapes[1].TextFrame.TextRange.Text = “WELCOME : Win an Xbox One with Machine Learning!”;

oSlide = oPre.Slides.Add(2, PowerPoint.PpSlideLayout.ppLayoutText);
oSlide.Shapes[1].TextFrame.TextRange.Text = @”Conclusion: Thank you”;

string fileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + “\\SourcePPoint.pptx”;
oPre.SaveAs(fileName,PowerPoint.PpSaveAsFileType.ppSaveAsJPG,
Office.MsoTriState.msoTriStateMixed);

oPre.Close();
oPowerPoint.Quit();
}
catch (Exception ex)
{
Console.WriteLine(“PowerPoint throws the error: {0}”, ex.Message);
}
}
private static void CreateSVGfromJpegUsingVisio()
{
Visio.Application app = null;
Visio.Documents oDocs = null;
Visio.Document oDoc = null;

try
{
app = new Visio.Application();
app.Visible = false;

// Create an existing blank saved vsdx – dummy
string dummyInput = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + “\\Drawing1.vsdx”;

oDoc = app.Documents.Open(dummyInput);

//int DiagramServices = 0;
//DiagramServices = app.ActiveDocument.DiagramServicesEnabled;

string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

string[] filePaths = Directory.GetFiles(path + @”\SourcePPoint”, “*.jpg”);

int sliceCount = 1;

foreach (string str in filePaths)
{
app.ActiveWindow.Page.Import(str);
app.Settings.SVGExportFormat = Visio.VisSVGExportFormat.visSVGExcludeVisioElements;
app.ActiveWindow.Selection.DeselectAll();
app.ActiveWindow.SelectAll();
app.ActiveWindow.Selection.Export(path + sliceCount + “.svg”);
sliceCount++;
}
oDoc.Saved = true;
oDoc.Close();
app.Quit();
}
catch (Exception ex)
{
Console.WriteLine(“CreateSVGfromJpegUsingVisio throws the error: {0}”, ex.Message);
}
}
}
}
Let me know if this helps you or any correction required.

October 14, 2014 Posted by | Uncategorized | Leave a comment

About ExcelMashup.com

If you would like to create spreadsheet-based mashups, then this is the site for you to start -http://www.excelmashup.com/ 

To create an Excel mashup, you use Excel Web App to create an embedded workbook that is stored on SkyDrive, and then displayed in a host web page. Once you’ve embedded the workbook, you use the JavaScript API to programmatically interact with it.

  • Shows you how to embed a workbook on a web page.
  • Provides JavaScript code snippets.
  • Walks you through creating a web control.
  • Provides a demo that pulls it all together.

http://www.excelmashup.com/ 

October 4, 2014 Posted by | Uncategorized | Leave a comment

Did you try Bing Developer Assistant Beta ?

Bing Developer Assistant puts millions of code snippets and code sample projects at your fingertips while you are coding in Visual Studio.
http://visualstudiogallery.msdn.microsoft.com/4934b087-e6cc-44dd-b992-a71f00a2a6df

I love this and really useful when I am looking for a sample beyond Visual studio auto intelisense. Current it is supported in VS 2012 & 2013. – Must try!!

September 26, 2014 Posted by | Uncategorized | Leave a comment

Clickonce installation error and resolution.

Problem:
System.Runtime.InteropServices.COMException (0x800736B3): The referenced assembly is not installed on your system. (Exception from HRESULT: 0x800736B3)

365

Resolution:(Windows 8.1)
1. Navigate to the C:\Documents and Settings\<Profile Name>\Local Settings\Apps
2. Rename the Apps folder to AppsOld
3. Reinstall the ClickOnce application

September 25, 2014 Posted by | Uncategorized | Leave a comment

Cloud Design Patterns – Book Download

This guide contains twenty-four design patterns and ten related guidance topics that articulate the benefits of applying patterns by showing how each piece can fit into the big picture of cloud application architectures. It includes code samples and general advice on using each pattern.

http://www.microsoft.com/en-us/download/details.aspx?id=42026

September 22, 2014 Posted by | Uncategorized | Leave a comment

How to call C#.NET Class Library from Office VBA

1 2 3 4 5 6 7

August 23, 2014 Posted by | .NET General, Office, VBA | Leave a comment

ML : How to develop a mode, algo use and one liner explanation

Supervised Learning – Classification, Regression

Unsupervised Learning – Clustering, Recommendation

————————————————————————————————-

(1)Classification (Y/N/not sure, Maligant tumour or not)
==================
Which customer are more likely to buy, stay, leave(churn analysis)
Which customer is going to get loans
Which transactions are fradulent
Which quotes are more likely to get executed

   What are the algorithms are there for Classification..
1.BCD (Boosted decision tree)
2.DF (Decision Forest)
3.DJ (Decision Jungle)
4.LR (Logistic Regression)
5.SVM,ANN

(2) Regression (Predictive analysis)
==============================
1. Stock price prediction
2. Market forecast
3. Weather forecast
4. Calculate insurance premiums based on different factors(feature)
5. Manpower prediction
6. Workload prediction
What are the algorithms are there for Regression..
1. Bayesian Linear
2. Linear Regression
3. Ordinal Regression
4. (BCD) ANN, Boosted Decision Tree
5. DF (Decision Forest)

(3) Cluster (Segmentation)
==============================
Divide a customer base into groups of individuals, age, market segmentation,
Data compression, color reduction, pattern recognition
             Which Algorithm to use..
1. K-means

(4) Recommendations (Product recommendation)

=======================================================
1. Amazon Recommender system
Algorithm: Matchbox

August 11, 2014 Posted by | Azure ML, MarketLearning | Leave a comment

Feature Exploration, Visualization and Predictive Modeling with R and AzureML

Iris Data Set  https://archive.ics.uci.edu/ml/datasets/Iris
https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data
Needless to say, here is the master piece

Hats off to Raja Iqbal for this wonderful meetup session.

 

August 7, 2014 Posted by | Azure ML, Machine learnign | | Leave a comment

Partners Say New Azure Machine Learning Service Could Be Microsoft’s Secret Weapon In The Cloud

Microsoft earlier this month launched a preview of a new cloud service called Azure Machine Learning, and some partners are already using it to build the sort of apps that used to require a team of expensive data scientists to pull off.

August 4, 2014 Posted by | Azure ML, Machine learnign | , | Leave a comment

Office Click-to-run add-in supportability.

Even though the Office product runs in a self-contained environment, the Office product can interact with the other applications that are installed on the computer. Macros, in-document automation, and cross-Office product interoperability will work. Click-to-Run is also designed to allow locally-installed add-ins and dependent applications to work with it. However, there is the possibility that some add-ins or other integration points with Office might behave differently or might not work when you are using Click-to-Run.

 In-process, out-of-process, and hybrid add-ins

A key differentiator from a technical standpoint is whether the add-in is loaded in-process by an Office application or whether an out-of-process application is making a call into Office. 

Out-of-process add-ins/applications are stand-alone programs, scripts, or applications that use Office object model APIs to start functionality in the application and integrate with Office. In this case, the out-of-process application drives Office. Out-of-process applications are not supported in Click-to-Run.

In-process add-ins are loaded in-process by an Office application, and detected and opened by the application. Because of this, the Office application can use existing mechanisms, such as looking at specific registry keys or locations in the file system to discover all in-process add-ins. There is no such mechanism for out-of-process add-ins. Generally, in-process add-ins work with Click-to-Run. 

July 31, 2014 Posted by | Uncategorized | Leave a comment

How to create Automation COM Add in (in slideshow steps)

July 30, 2014 Posted by | .NET General | Leave a comment

Weekend Interesting read -DataScience & ML – Part1

66 job interview questions for data scientists

http://www.datasciencecentral.com/profiles/blogs/66-job-interview-questions-for-data-scientists

Azure ML: A Brief Introduction

https://projectbotticelli.com/knowledge/brief-introduction-to-microsoft-azure-ml

ml ml1

July 27, 2014 Posted by | Azure ML, Machine learnign, Uncategorized | , | Leave a comment

FREE Microsoft eBooks

Largest collection of FREE Microsoft eBooks ever, including: Windows 8.1, Windows 8, Windows 7, Office 2013, Office 365, Office 2010, SharePoint 2013, Dynamics CRM, PowerShell, Exchange Server, Lync 2013, System Center, Azure, Cloud, SQL Server, and much m

Microsoft Senior Sales Excellence Manager – Eric Ligman

July 10, 2014 Posted by | Uncategorized | Leave a comment

Win API (HWND) integration in Outlook is not a supported platform technology.

How to add a window that is adjacent to the preview pane in Outlook  – http://support.microsoft.com/kb/982758

June 18, 2014 Posted by | Uncategorized | Leave a comment

Follow

Get every new post delivered to your Inbox.