Salesforce and saving to server

Receiving the following error when Force.com IDE is started? com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.bind.v2.runtime.reflect.Accessor Try switching workspace - to the very same workspace! File -> Switch Workspace -> Other.. Select the same workspace, OK and voilá! Source

MVC 3 json post array workaround

Ajax-posting a JSON object containing arrays using jQuery work fine in PHP, but since ASP.NET expects the array to be posted with indeces a tiny workaround is required. Consider the following example:

var jsonData = { foo: 0, bar: [1, 2] };
$.post("/post-url", postData, function () {});

This will cause the post data to look like

foo=0
bar[]=1
bar[]=2

PHP acceps this, but ASP.NET requires the post data to be

foo=0
bar[0]=1
bar[1]=2

Here’s a workaround. Run it before $.post.

Writing a simple jQuery slideshow plugin

I needed to write a simple slideshow plugin for jQuery which basically showed all content inside of a div one by one. This plugin will list all child elements of the selector and make them clickable.


;
(function(jQuery) {
    jQuery.fn.tinyslideshow = function(settings) {
        var config = {
            path: ''
        };
        if (settings) jQuery.extend(config, settings);
        var imgs;
        var currentIndex = -1;

        function\ _next() {
            if (currentIndex == imgs.length - 1) currentIndex = 0;
            else currentIndex++;\
            _goto(currentIndex);
        }

        function\ _prev() {
            if (currentIndex == 0) currentIndex = imgs.length - 1;
            else currentIndex--;\
            _goto(currentIndex);
        }

        function\ _goto(i) {
            try {
                currentIndex = i;
                imgs.hide();
                jQuery('.ts-nav-link').css('color', '#696969').eq(i).css('color', '#4092ca');
                imgs.eq(currentIndex).fadeIn();
            } catch (e) {}
        }
        this.each(function(e) {
            imgs = jQuery(this).children();
            imgs.click(function(e) {
                e.preventDefault();\
                _next()
            });
            var html = '<div style="text-align:center;">';
            html += '<a href="#"><img style="vertical-align:middle" src="' + config.path + 'prev.png"/></a>';
            for (var i = 0; i < imgs.length; i++) html += '<a href="#" rel="' + i + '" style="color: #696969;font-weight:bold;text-decoration:none"> ' + (i + 1) + ' </a> &nbsp; ';
            html += '<a href="#"><img style="vertical-align:middle" src="' + config.path + 'next.png"/></a>';
            html += '</div>';
            jQuery(html).appendTo(jQuery(this));
            jQuery(this).find('.ts-nav-link').click(function(e) {
                e.preventDefault();\
                _goto(jQuery(this).attr('rel'));
            });
            jQuery(this).find('.ts-nav-next').click(function(e) {
                e.preventDefault();\
                _next();
            });
            jQuery(this).find('.ts-nav-prev').click(function(e) {
                e.preventDefault();\
                _prev();
            });\
            _goto(0);
        });
        return this;
    };
})(jQuery);