Monday, November 28, 2016

Stop Windows 10 from rescheduling restarts

I found these two links to stop windows from scheduling the restarts:

http://superuser.com/questions/957267/how-to-disable-automatic-reboots-in-windows-10

and

https://superuser.com/questions/973009/conclusively-stop-wake-timers-from-waking-windows-10-desktop/973029#973029

I used the post from jakethedog that disabled the task in the task scheduler.

Monday, April 18, 2016

c# mvc autocomplete list

I had this challenge and I had to modify several solutions to get what I wanted. This is what worked for me:

Controller had this function:
[AcceptVerbs(HttpVerbs.Post)]
        public JsonResult Create(string Prefix)
        {
            var agency = (from N in travel_agencies.ToList()
                          where N.travel_agent_name.ToLower().StartsWith(Prefix.ToLower()) || N.travel_agent_id.StartsWith(Prefix)
                          select new { N.travel_agent_name });
            return Json(agency, JsonRequestBehavior.AllowGet);
        }

the view had this:
$(document).ready(function () {
   $('#station_id').autocomplete({
                source: function (request, response) {
                    $.ajax({
                        url: "@Url.Action("Create", "ChargeBacks")",
                        type: "POST",
                        dataType: "json",
                        data: { Prefix: request.term },
                        success: function (data) {
                            response($.map(data, function (item) {
                                return { label: item.travel_agent_name, value: item.travel_agent_id };
                            }))
                        }
                    })
                },
                messages: {
                    noResults: "", results: ""

                }
            });
 });

the html element was:

<input type="text" name="station_id" id="station_id" class="form-control" />

Monday, March 28, 2016

Hire Me!

Hi all,

If you need someone to maintain, edit your website, I am the person. I am a programmer with over 9 years experience in web programming, database design. I work with php, c#, asp.net, mysql, mssql, codeigniter, phpmyadmin, wordpress, drupal, joomla, etc. 

I can allow your contact form to send emails to you and make your static website dynamic (reading information from a database).

Not sure what you want, send me an email so we can start the discussion.


Thursday, February 18, 2016

Dynamic sql returns int instead of resultset

I had to create a stored procedure that was created dynamically. It so happened that when I tested it in SQL server, it ran, producing the results. When I implemented in and called it from a stored procedure, the return value was an int. After googling, i found a solution that worked. I had to create the stored procedure to produce similar results then import in into the application. Then, I went back and edited it to return the results that I wanted it to produce.

I found the trick here: http://www.techdreams.org/microsoft/fixing-linq-to-sql-issue-stored-procedure-definition-returns-int-instead-of-resultset-2/2752-20090614


Unable to cast object of type 'Data' to type 'System.IConvertible'

I came upon this error when developing an application. I was using a foreach loop to dynamically create a select list. It so happened that I was not looping on the result without point to value in it.


So instead of just using @y i had to use @y.name in the select option