Thursday, November 16, 2017

Failed to initialize sqlcmd library with error number -2147024809

Add @execute_query_database = 'dbname' to the list of variables or dbname.dbo.tablename to the query instead of tablename

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

Sunday, October 18, 2015

Limited or no WIFI after upgrading to Windows 10

I upgraded my laptop to Windows 10 yesterday and everything worked fine except for the WIFI and I couldn't figure out what the problem was. I found some commands to run which did not solve the problem. I figured it was the antivirus I was using so I stopped it and that still didn't solve the problem. I found several drivers; some installed and some didnt, that still didn't work.

Since the WIFI wasnt working on, I had to be using my phone. After much googling, a thought came to me to uninstall the antivirus. I was using COMODO which also has a internet security module. During the uninstall, the Limited icon left the WIFI signal. I tested it and it was working fine. So, if anyone has this problem, try uninstalling the antivirus that is installed, if it was installed from before the upgrade.

Monday, October 5, 2015

Remove hash # from url in angular js

The $location is a service component in AngularJs. This is what will be used to remove the hash from the urls. In the config function where the routing is done, inject the $location variable and set the html5Mode to true.

var app = angular.module('mainCtrl', ['ngRoute'])
            .config(config)
            .run(run);

config.$inject = ['$routeProvider', '$locationProvider'];
    function config($routeProvider, $locationProvider) {      

        $routeProvider
        .when( '/', {
            templateUrl: 'views/login.view.html'
        })

        .when( '/home', {
            templateUrl: 'views/home.html',
            controller: 'HomeCtrl'
        })

        .otherwise({
            redirectTo: '/'
        });

        $locationProvider.html5Mode(true);
    };

For this to work, you will have to set the base url. This can be done by putting the  in the head of the html file. Remember to include the name of the folder if you have all the files in a folder. Example: 

That will remove the hash from the urls.

Sunday, October 4, 2015

Freelance Developer

It was from this same blog that I got my first freelance project...that was years ago. I had been working with P4A and had posted some code samples from projects that I had worked on and someone who found my blog had asked me for assistance on a project.

This just came to me last night that, since I am at home and I have some amount of free time on my hands that I should probably post some more code samples. So, I'll be doing that as often as I can. I will post code from PHP, JavaScript, MySQL, AngularJS...pretty much anything. I have knowledge of and experience with intel XDK, CodeIgniter, P4A...and I will challenge myself to learn something new. So, I am available for freelance projects.