Monday, May 2, 2011

Quick Tools

If you had problems with how MsPaint scews up an image's transparent background, you can try Paint.Net
getpaint.net

If you need to do presentations and need to record it to a video, use Cyberlink YouCam.
http://www.cyberlink.com/products/youcam/overview_en_US.html
supported format AVI/WMV

Free Video Recording
http://camstudio.org/

Monday, April 11, 2011

SalesForce Tools


SF tools:

Force.com explorer (see all sf objects like how SQL management studio works for MS-SQL)

Adobe flash builder - To develop flex/flash and access SF data via queryResult

Force.com dataloader - upload from csv

Force.com IDE - should just download eclipse and use the sf plug-in instead

For sample data, use random name generator to excel to generate dummy excel files for uploading to SF

To create word templates, Docx is actually a zip file.  You can extract it and update the document.xml

To toggle between the field codes and word documents, use alt f9 in MS-Word

Sunday, April 10, 2011

Google calender

If you like the google calender, you must check out the following jquery calender control. 

http://arshaw.com/fullcalendar/

SalesForce Admin ADM 201

Test Concepts in Admin ADM 201

-Different types of relationships for custom objects
-If you want to disable viewing all objects in an application, where do you set this?
-If the system wide default is read/write, how can you restrict what records the user can view?
-what will happen to the existing exchange rates will you turn on advance currency management
-mass transfer of user's records (one of the following will not be mass transferred: open case, close case, open activity, closed activity)


Wednesday, March 2, 2011

Retring WCF calls, using Func

Sometimes because the internet connection is not great, you might want to implement code to retry WCF calls.  However, instead of writing for loops on each clientproxy.MethodCall, you can write an extension method that retries it for you.  Since WCF calls has a single parameter - TWcfRequest and a single response - TWcfResponse, we can use the delegate Func<TWcfRequest, TWcfResponse> and pass the desired WCF method down this extension method.


public static class WcfClientBaseExtension
    {
        /// <summary>
        /// Retry WCF call multiple times
        /// </summary>
        /// <typeparam name="TChannel"></typeparam>
        /// <typeparam name="TWcfRequest"></typeparam>
        /// <typeparam name="TWcfResponse"></typeparam>
        /// <param name="client"></param>
        /// <param name="tryExecute"></param>
        /// <param name="wcfRequest"></param>
        /// <returns></returns>
        public static TWcfResponse ExecuteRepeatedly<TChannel, TWcfRequest, TWcfResponse>(this ClientBase<TChannel> client,
                    Func<TWcfRequest, TWcfResponse> tryExecute, TWcfRequest wcfRequest)
            where TChannel : class
            where TWcfRequest : class
            where TWcfResponse : class
        {
            int maxRetryCount = FrameworkConfigHelper.MaxWcfRetryCount;

            for (int currentRetryCount = 0; currentRetryCount < maxRetryCount; currentRetryCount++)
            {
                try
                {
                    return tryExecute(wcfRequest);
                }
                //SOAP Faults - business requirement
                catch (FaultException)
                {
                    //need to allow business exceptions to go to top level
                    throw;
                }
                //Connection timeout
                catch (EndpointNotFoundException)
                {
                    //endpoint don't respond in timely manner
                    //swallow technical exceptions unless it's the last retry
                    if (currentRetryCount == maxRetryCount - 1)
                        throw;
                }
                catch (Exception)
                {
                    //rethrow all other errors for now
                    throw;
                }
            }
            return null;
        }

       
    }


For usage:
var searchResponse = client.ExecuteRepeatedly<ICollateralRegistrationSearch, SearchByRegistrationNumberRequestType, SearchByRegistrationNumberResponseType>
                                            (client.SearchByRegistrationNumber, searchByRegistrationNumberRequestType);

Monday, January 24, 2011

SSRS tools

In addition to the Report Builder 3.0 tool from microsoft, there are also different ways to create RDL and RDLC reports:
http://msdn.microsoft.com/en-us/library/ms155792.aspx

Report builder provides a very quick report designer to play with your existing data.  It generates RDL and can be uploaded to the reporting server immediately.

Saturday, January 1, 2011

Passing Data from ViewModel to Javascript on the View

Option 1: construct the javascript into a string put it directly into the ViewData
ViewData["clientScript"] = "<script type='text/javascript'>initialize();addOverLay(-34.397, 150.644)</script>";

<%=ViewData["clientScript"]%>

This is of course prone to javascipt attacks

Option 2: Convert to Json(InfoList is of type string)

var js = new JavaScriptSerializer();
var listOfInfos = new List<string> {"abc", "cde"};

var viewModel = new InfoModel
               
{
                   
InfoList = js.Serialize(listOfInfos);
               
};
return View(viewModel);

In the View
   <script type="text/javascript">
      var result = <%= Model.InfoList%>
   </script>