Monday, November 3, 2014

Android Studio in Mobile Debugging (USB Connection)

Android Studio with Mobile Debugging

1) Click Tools  > Android > SDK Manager


2)  Under the Extras, tick Google USB Driver

3)  Install the Packages, then Accept the agreement,...Next so on, once Finish download and install.

4) Please go SDK folder, My case i put (C:\Program Files (x86)\Android SDK)

5) Under Android SDK folder go to extras > google > usb_driver

6) Find android_winusb.inf right click > Install



Android Phone Setup (Your Mobile Phone)

1) Go to Setting, click about.

2) Click Software Information

3) Click 7 times on BUILD Number

4) After 7 times you click, you can find DEVELOPER OPTION in setting page.

5)  Go to DEVELOPER OPTION, tick USB Debugging.

That all,


Now, you successfully debugging in Your Mobile


// FYI, Make sure you install SDK API 11 above if your application need use google service (eg, google Map, Wallet)   


Monday, October 20, 2014

Jquery Examples - Basic Level

jQuery append()
Insert content at the end of the selected HTML elements.
Demo:
http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_html_append

jQuery prepend()
Insert content at the beginning of the selected HTML elements.
Demo:
http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_html_prepend

jQuery empty()
Remove all child elements of the selected element(s).
Demo:
http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_dom_empty

jQuery hide()
Another hide demonstration. How to hide parts of text.
Demo:
http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_hide_explanations

jQuery focus() and blur()
The focusin event is sent to an element when it, or any element inside of it, gains focus. This is distinct from the focus event in that it supports detecting the focus event on parent elements (in other words, it supports event bubbling).
Demo:
http://jsfiddle.net/pAp4E/

Populate value from other controller using GET Method--Cascading Dropdown

 Cascading Dropdown using Ajax in MVC


// Controller for Get first drop down
public JsonResult GetAll()
        {
            var list = new List<SelectListItem>();
            var news = _context.BusStopTypes.ToList();
            foreach (var item in news)
            {
                list.Add(new SelectListItem() { Value = item.Id, Text = item.Name });
            }

            return Json(list, JsonRequestBehavior.AllowGet);
        }

-- Ajax Method for 1st Drop Down
function PopulateBusStopTypsId() {
            $.ajax({
                url: '/BusStopType/GetAll/',
                type: 'GET',
                contentType: 'application/json',
                success: function (result) {

                    $('#BusStopTypeId').find('option').remove();
                    $('#BusStopTypeId').append('<option value=""></option>');

                    $.each(result, function (i, v) {
                        $('#BusStopTypeId').append('<option value="' + v.Value + '">' + v.Text + "</option>");
                    });
                },
                complete: function () {
                    $('#BusStopTypeId').select2();
                    PopulateBusStop();
                }

            });
        }



// Get Second drop down based on first drop down Controller
   public JsonResult GetByBusStopType(string id)
        {
            var list = new List<SelectListItem>();
            var busstops = _context.BusStops.Where(x => x.BusStopTypeId == id).ToList();
            foreach (var item in busstops)
            {
                list.Add(new SelectListItem() { Value = item.Id, Text = item.Name });
            }

            return Json(list, JsonRequestBehavior.AllowGet);
        }

-- Ajax Method for 2nd Drop Down
   function PopulateBusStop() {

            var busStopTypeId = $('#BusStopTypeId').val();

            $.ajax({
                url: '/BusStop/GetByBusStopType/' + busStopTypeId,
                type: 'GET',
                contentType: 'application/json',
                success: function (result) {

                    $('#BusStopId').find('option').remove();
                    $('#BusStopId').append('<option value=""></option>');

                    $.each(result, function (i, v) {
                        $('#BusStopId').append('<option value="' + v.Value + '">' + v.Text + "</option>");
                    });
                },
                complete: function () {
                    Dropdwnvalue();
                    $('#BusStopId').select2();
                }

            });
        }

Wednesday, October 15, 2014

ExecuteScalar()

Problem face

In my case,I created the Cascading dropdown, the third dropdown want to change to textbox.

Definition:

Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

The sample of coding ExecuteScalar();

 var result = cmd.ExecuteScalar();
            if (result != null)
            {
                TimeDrop.Text = result.ToString();
            }





Upload setting for Windows Azure Database from local

Right Click on database, under Tasks click Generate Scripts.
The Next, you can choose specific table or leave it click next.
Click Advanced Button.


> Make sure Change to Sql Azure Database and Choose Scheme and data (Scheme and data for include all data)
> Change Script DROP and CREATE : Change to Script DROP and CREATE

then Next , finish..