Posts

How to create a chart using Open XML SDK in Word 2010

Creating a Chart in Open involves two steps, as the data is stored at two locations.  Chart Cache Embedded Package - This is nothing but an Excel Sheet Thus, populating the data in Cache is not enough. We should also create corresponding Excel Sheet. Below is the sample code. The code is verbose as I was using Open XML productivity tool to arrive at this. Full source code can be found at  https://github.com/pradeepkumargali/GenerateWord-OpenXML   Main Class: ChartPart chartPart2 = mainDocumentPart1.AddNewPart<ChartPart>("rId7"); GenerateChartPart2Content(chartPart2); //Used to generate a dummy excel sheet out of a predefined blob - Look at "private string embeddedPackagePart2Data" EmbeddedPackagePart embeddedPackagePart2 = chartPart2.AddNewPart<EmbeddedPackagePart>("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "rId1"); GenerateEmbeddedPackagePart2Content(embe...

Chatter Unfollow Test Class Failures

Recently, we noticed all test failures in one of our test classes. The test class was written in 19.0. The problem being SOQL's were not returning records and all the assertions were failing.  Assertion Failed: Expected: 2, Actual: 0 The fix turned out to be very simple. We fixed the error by updating the APEX class version to 29.0

Android SalesforceSDK - Make Mobile Layout More Responsive By Using Load Spinner

Image
I noticed that layout-xlarge in Android Salesforce SDK has a nice loading spinner and header bar. So I have changed the layout appropriately. As part of this effort, I have modified or copied drawables,colors etc. from xlarge  resources. There are no code changes required. I am attaching the resources folder for the same. Replace the res @  ....forcedroid\native\SalesforceSDK  with the contents of the following zip https://docs.google.com/file/d/0BwilPq-bDpVPM1pyMGFiMy1WSUk/edit?usp=sharing  

Chrome Extension - Interactive Scraper

Image
This is my attempt to write an Interactive Scraper. See the Robot Icon In Browser Action Icons How to use? 1. From browser, you can choose the DOM element to scraper time to time.  Click On Capture detail 2. Data is persisted in Indexed DB of Background Page.  3. Data can be viewed or deleted by clicking "View" link from Add-In. This is implemented using Data Tables (table plug-in for jQuery ) 4. Once configured, you can run the scraper by clicking on "Roll" button. It will take you through all the URL's and collect text from DOM path and capture a screen shot for your future reference.  Development Challenges:   I have faced a few development challenges while developing this.  1. Chrome Synchronous Message Passing: I faced this problem when trying to load the URL's in a tab one after another. After the URL is loaded, the scraper should collect the text from the DOM and update it in database. There are ...

Native Vs Hybrid

There are three ways to deliver an application on Mobiles – 1. Native – Built on Native Mobile Platform 2. HTML 5 – Works in browser 3. Hybrid – Built with HTML5, Can access native features It is clear that user spend 80% of their time using Apps on mobile. That is four times more than the time they spend in browsing. Hence, browser based HTML 5 application is not the preferred way to deliver your mobile application. We have two options left before us. One, build a native application using the mobile OS platform (ex: Android or iOS). Second, use your HTML5 skills to quickly build an application and make it work as a native app on all platform using build frameworks such as PhoneGap. Many have tried to compare and contrast Native and Hybrid. In this article I will summarize the analysis I have done over this subject matter.  After going through lot of articles and presentations, a presentation from propelics appealed to me. It is unbiased and to the point. Below are the...

Sample: Posting a Comment with a File Attachment

In SFDC Apex Code Developer, a sample to post a comment with file attachment using Chatter Apex (ConnectAPI) is given. But, the code is not copy paste-able. You may see the following error for  messageInput.messageSegments.add(textSegment); System.NullPointerException: Attempt to de-reference a null object The correct code looks as below.  String communityId = null; String feedItemId = '0D5x0000000azYd'; ConnectApi.CommentInput input = new ConnectApi.CommentInput(); ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput(); //Added messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>(); ConnectApi.TextSegmentInput textSegment; textSegment = new ConnectApi.TextSegmentInput(); textSegment.text = 'Comment Text Body'; messageInput.messageSegments.add(textSegment); input.body = messageInput; ConnectApi.NewFileAttachmentInput attachmentInput = new ConnectApi.NewFileAttachmentInput(); attachmentInput.description ...

Why my custom prerequisite is saying it is corrupt?

Error: Verifying file hash Error: Setup has detected that the file '.....XXXXX.msi' has either changed since it was initially published or may be corrupt. Solution: Option 1: Uninstall .NET 4.5 and work with .NET 4.0 only Option 2:   Sign your package files with a code-signing certificate to avoid a defect introduced in .NET 4.5 References: http://stackoverflow.com/questions/13073915/clickonce-prerequisite-error-published-installer-may-be-corrupt http://msdn.microsoft.com/en-us/library/ms165429.aspx