Tuesday, October 16, 2012

My First KnockoutJS Excercise

I am currently practicing KnockoutJS

Take a look at it: http://jsfiddle.net/jboyflaga/uhSmM/4/

I've updated my first knockout exercise to make use of control of flow binding: http://jsfiddle.net/jboyflaga/uhSmM/7/


Saturday, September 1, 2012

After Evolution, What's Next


Today, if you do not believe in evolution you are considered unscientific by many intellectuals.

But some intellectuals today are starting to realize that what they observe today does no agree with evolution.

Because humans have the tendency to invent things just to convince themselves that God does not exists - What's next, then, to (macro)evolution?

I think what's next will be this: Intelligent Design where the intelligent designer are extraterrestrials (or aliens from outer space).

The next generation is being brainwashed into this kind of thinking. People are trying to create STORIES (no real evidence) that are very convincing to make themselves and others believe that aliens from other planets exist.



(Dr. Greg Bahnsen presented a very compelling evidence on the existence of the God of the Bible on

The Great Debate: Does God Exist?)




Monday, May 21, 2012

ASP.NET MVC 3 (w/ C#): Student Information System


This is a simple Student Information System I created using ASP.NET MVC 3 and C#.

You can download the zip file here.


Because I'm new to ASP.NET MVC, I will list some interesting things for beginners that I used in this project:
  1. Adding attributes to entity classes generated by Entity Framework
  2. Creating AJAX search form
  3. Using Html.DropDownListFor() helper
  4. Using jQuery UI Datepicker

Saturday, May 19, 2012

Simple Student Information System Using .NET WinForms & DataSet



This is a simple Student Information System I created using the .NET Framework
 - Windows Forms for the GUI and DataSet for data access.
 - .NET language used: VB.NET

You can download this on Google Docs

You don't need to install the database used in this project because the Visual Studio Solution is configured to copy the database in the "Debug" folder and the application is configured to look for the database in the directory where the executable is located.

Username: admin
Password: admin

Happy coding!!!

Tuesday, May 15, 2012

ASP.NET MVC ERROR: Store update, insert, or delete statement affected an unexpected number of rows (0).

Server Error in '/' Application. 

Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.


Possible Problem:
You placed a ReadOnlyAttribute in you entity key's metadata, which causes its value to become zero

     [DisplayName("Student ID")]
     [ReadOnly(true)]
     public int StudentID { get; set; }


Solution:
Remove the ReadOnlyAttribute

     [DisplayName("Student ID")]
     public int StudentID { get; set; }


For other possible causes for this problem and possible solutions, please refer to this link http://stackoverflow.com/questions/1836173/entity-framework-store-update-insert-or-delete-statement-affected-an-unexpec



  
Free Lessons for Chruch Pianists:
Free lessons, tips and downloads for church pianists

DVD Courses (Reharmonization, Play by Ear!, Arranging, Accompanying, Theory for Church Pianists, etc.):
Over 30 hours of DVD instruction for church pianists
 


Visit Vitabase for Quality Health Supplements

Thursday, April 26, 2012

Solution to Chapter 8 Exercises of Learning jQuery 3rd Edition


My solutions to Learning jQuery 3rd Edition Chapter 7 exercises:




Exercises:


Some of the exercises are requires modifications of codes from the book. You can easily locate my modifications by looking for //--------------Added sections




1. Create new plugin methods called .slideFadeIn() and .slideFadeOut(), combining the opacity animations of .fadeIn() and .fadeOut() with the height animations of .slideDown() and .slideUp().

(function ($) {
    $.fn.slideFadeIn = function() {
        return this.each(function () {
            //$(this).slideDown('slow').fadeIn('slow');
            $(this).slideDown('slow').fadeTo('slow', 1.0);
        });
    };
  
    $.fn.slideFadeOut = function() {
        return this.each(function () {
            //$(this).slideUp('slow').fadeOut('slow');
            $(this).fadeTo('slow', 0.5).slideUp('slow');
        });
    };
})(jQuery);

//------Sample code for testing excercise 1
jQuery(document).ready(function ($) {

    //Test for .slideFadeIn & .slideFadeOut
    //Click the <h1>Inventory</h1> to see the effect of these new methods
    $('#container h1').toggle(function() {
        $('#inventory').slideFadeOut();
    }, function () {
        $('#inventory').slideFadeIn();
    });
});



2. Extend the customizability of the .shadow() method so that the z-index of the cloned copies can be specified by the plugin user. Add a new sub-method called isOpen to the tooltip widget. This sub-method should return true if the tooltip is currently displayed and false otherwise.


/******************************************************************************
.shadow()
Create a shadow effect on any element by brute-force copying.
******************************************************************************/
(function ($) {
    $.fn.shadow = function (opts) {
        var options = $.extend({}, $.fn.shadow.defaults, opts);

        return this.each(function () {
            var $originalElement = $(this);
            for (var i = 0; i < options.copies; i++) {
                var offset = options.copyOffset(i);
                $originalElement
          .clone()
          .css({
              position: 'absolute',
              left: $originalElement.offset().left + offset.x,
              top: $originalElement.offset().top + offset.y,
              margin: 0,
              //------------------------------------------------------Added
              zIndex: options.zIndex,
              //-------------------------------------------------------------
              opacity: options.opacity
          })
          .appendTo('body');
            }
        });
    };

    $.fn.shadow.defaults = {
        copies: 5,
        opacity: 0.1,
        copyOffset: function (index) {
            return { x: index, y: index };
        },
        //------------------------------------------------------Added
        zIndex: -1
        //-----------------------------------------------------------
    };
})(jQuery);


/******************************************************************************
.tooltip()
A simple jQuery UI tooltip widget.
******************************************************************************/
(function ($) {
    $.widget('ljq.tooltip', {
        options: {
            offsetX: 10,
            offsetY: 10,
            content: function () {
                return $(this).data('tooltip-text');
            }
        },

        _create: function () {
            //------------------------------------------------------Added
            this.isTooltipOpen = false;
            //-----------------------------------------------------------

            this._tooltipDiv = $('<div></div>')
                .addClass('ljq-tooltip-text ui-widget ui-state-highlight ui-corner-all')
                .hide().appendTo('body');
                    this.element
                .addClass('ljq-tooltip-trigger')
                .bind('mouseenter.ljq-tooltip', $.proxy(this._open, this))
                .bind('mouseleave.ljq-tooltip', $.proxy(this._close, this));
        },

        destroy: function () {
            this._tooltipDiv.remove();
            this.element.removeClass('ljq-tooltip-trigger')
                        .unbind('.ljq-tooltip');
            $.Widget.prototype.destroy.apply(this, arguments);
        },

        open: function () {
            this._open();
        },

        close: function () {
            this._close();
        },

        _open: function () {

            //------------------------------------------------------Added
            this.isTooltipOpen = true;
            //-----------------------------------------------------------
            if (!this.options.disabled) {
                var elementOffset = this.element.offset();
                this._tooltipDiv.css({
                    left: elementOffset.left + this.options.offsetX,
                    top: elementOffset.top + this.element.height() + this.options.offsetY
                }).text(this.options.content.call(this.element[0]));
                this._tooltipDiv.show();
                this._trigger('open');
            }
        },

        _close: function () {
           
            //------------------------------------------------------Added
            this.isTooltipOpen = false;
            //-----------------------------------------------------------

            this._tooltipDiv.hide();
            this._trigger('close');
        },

        //------------------------------------------------------Added
        isOpen: function() {
            return this.isTooltipOpen;
        }
        //-----------------------------------------------------------
    });
})(jQuery);


//------Sample code for testing excercise 2
jQuery(document).ready(function ($) {

    $.fn.shadow.defaults.copies = 10;
    //$.fn.shadow.defaults.zIndex = 2; //if you uncomment this, Clicking <h1>Inventory</h1> will have no effect
    $('h1').shadow({
        copyOffset: function (index) {
            return { x: -index, y: index };
        }
    });   

    //$('a').tooltip();
    $('a').tooltip().hover(function () {
        //alert($(this).tooltip('isOpen').toString());       
        console.log('Is tooltip open? -> ' + $(this).tooltip('isOpen').toString());
    });
});



3. Add code that listens for the tooltipopen event that our widget fires, and logs a message to the console.


jQuery(document).ready(function ($) {
    $('a').bind('tooltipopen', function () {
        console.log('tooltip open event fires');
    });
});



4. Challenge: Provide an alternative content option for the tooltip widget that fetches the content of the page and anchor's href points to via Ajax, and displays that content as the tooltip text.


jQuery(document).ready(function ($) {
    $('a').tooltip({ content: function () {
        var url = $(this).attr('href');
        var result = null;
        $.ajax({
            url: url,
            type: 'get',
            dataType: 'html',
            async: false,
            success: function (data) {
                result = data;
            }
        });

        return result;
    }});
});



5. Challenge: Provide a new effect option for the tooltip widget that, if specified, applies the named jQuery UI effect (such as explode) to the showing and hiding of the tooltip.



/******************************************************************************
.tooltip()
A simple jQuery UI tooltip widget.
******************************************************************************/
(function ($) {
    $.widget('ljq.tooltip', {
        options: {
            offsetX: 10,
            offsetY: 10,
            content: function () {
                return $(this).data('tooltip-text');
            }
        },

        _create: function () {
            //------------------------------------------------------Added
            this.isTooltipOpen = false;
            //-----------------------------------------------------------

            this._tooltipDiv = $('<div></div>')
                .addClass('ljq-tooltip-text ui-widget ui-state-highlight ui-corner-all')
                .hide().appendTo('body');
            this.element
                .addClass('ljq-tooltip-trigger')
                .bind('mouseenter.ljq-tooltip', $.proxy(this._open, this))
                .bind('mouseleave.ljq-tooltip', $.proxy(this._close, this));
        },

        destroy: function () {
            this._tooltipDiv.remove();
            this.element.removeClass('ljq-tooltip-trigger')
                        .unbind('.ljq-tooltip');
            $.Widget.prototype.destroy.apply(this, arguments);
        },

        open: function () {
            this._open();
        },

        close: function () {
            this._close();
        },

        _open: function () {

            //------------------------------------------------------Added
            this.isTooltipOpen = true;
            //-----------------------------------------------------------

            if (!this.options.disabled) {
                var elementOffset = this.element.offset();
                this._tooltipDiv.css({
                    left: elementOffset.left + this.options.offsetX,
                    top: elementOffset.top + this.element.height() + this.options.offsetY
                }).text(this.options.content.call(this.element[0]));
                this._tooltipDiv.show();
                this._trigger('open');

                //------------------------------------------------------Added
                if(this.options.effect) {
                    this._tooltipDiv.effect(this.options.effect, {distance: 10, duration: 80});
                }
                //-----------------------------------------------------------
            }
        },

        _close: function () {

            //------------------------------------------------------Added
            this.isTooltipOpen = false;
            //-----------------------------------------------------------

            this._tooltipDiv.hide();
            this._trigger('close');
        },

        //------------------------------------------------------Added
        isOpen: function () {
            return this.isTooltipOpen;
        }
        //-----------------------------------------------------------
    });
})(jQuery);

//------Sample code for testing excercise 5
jQuery(document).ready(function ($) {
    $('a').tooltip({effect: 'shake'});
});




 


  
Free Lessons for Chruch Pianists:
Free lessons, tips and downloads for church pianists

DVD Courses (Reharmonization, Play by Ear!, Arranging, Accompanying, Theory for Church Pianists, etc.):
Over 30 hours of DVD instruction for church pianists
 


Visit Vitabase for Quality Health Supplements

Wednesday, April 25, 2012

Playing Mood Music Video By Greg Howlett


In this video, Greg Howlett teaches how to play soft piano music when playing reflective songs.



You can download the example used in the video here.

Here's an outline on what you'll learn in this video:

Outline - Playing Mood Music with Greg Howlett

I. General Principles
A. Focus on harmony. You have to know what notes belong to what chord.
B. Spread out the notes you play. Use open voicing
C. Less is More! Play less
1. Simplify the patterns you play.
2. Avoid doubling/octaves.
"Train your ear. It's your best tool."


II. Beginning Techniques (Applications)
A. Open arpeggios (left hand)
B. Play open intervals in both hands (rather than octaves). Play 6ths, 5ths, 7ths, 9ths, 10ths but avoid octaves.
C. Broken chords. Play parts of a chord in different segments of time.
1. It makes you have more control over the sound.
2. It creates movement; it fills up space.
D. Take your time (Rubato, "out of time"). This helps remove tension from the music.

III. Advanced (Harmony) Techniques
A. Add 7ths to your triads. (Major 7ths or minor 7ths).
B. Chord substitutions (reharmonization). [see also Some Reharmonization Ideas from Greg Howlett]
C. Color notes. Notes added to chords in addition to 1, 3, 5, and 7



  
Free Lessons for Chruch Pianists:
Free lessons, tips and downloads for church pianists

DVD Courses (Reharmonization, Play by Ear!, Arranging, Accompanying, Theory for Church Pianists, etc.):
Over 30 hours of DVD instruction for church pianists


Visit Vitabase for Quality Health Supplements