keskiviikko 28. joulukuuta 2016

Visual Studio 2015 warning: Could not find schema information for the attribute...

Otsikon mukaisesta virheilmoituksesta pääsee eroon näin:
Quickest, easiest laziest way to solve the problem:
  1. Right-click on the project icon in Solution Explorer and choose "Properties".
  2. Go to the "Application" tab and choose an earlier .NET target framework.
  3. Save changes.
  4. Go to the "Application" tab and choose the initial .NET target framework.
  5. Save changes => problem solved!

tiistai 27. joulukuuta 2016

ASP.NET MVC5 - Linq kyselyn Inner join syntaksi

Välillä tarvitsen SQL-kyselyjä, joissa yhdistetään eri taulujen tietoja. Tässä INNER JOIN kyselyn syntaksi Linq-koodilla:


var results = from c in db.Companies
              join cn in db.Countries on c.CountryID equals cn.ID
              join ct in db.Cities on c.CityID equals ct.ID
              join sect in db.Sectors on c.SectorID equals sect.ID
              where (c.CountryID == cn.ID) && (c.CityID == ct.ID) && (c.SectorID == company.SectorID) && (company.SectorID == sect.ID)
              select new { country = cn.Name, city = ct.Name, c.ID, c.Name, c.Address1, c.Address2, c.Address3, c.CountryID, c.CityID, c.Region, c.PostCode, c.Telephone, c.Website, c.SectorID, Status = (ContactStatus)c.StatusID, sector = sect.Name };


return results.ToList();

ASP.NET MVC5 - ViewBag arvon lukeminen Javascriptissä

MVC5 view:llä halutaan usein näyttää jokin ViewBag- arvo.
Javascriptissä ViewBag on luettava näin:

<script>
  var someStringValue = '@(ViewBag.someStringValue)';
  var someNumericValue = @(ViewBag.someNumericValue);
</script>

tiistai 20. joulukuuta 2016

Joulutervehdys

Dataseppä toivottaa kaikille Hyvää Joulua ja Menestyksekästä Uutta Vuotta !!

Enkelten laulu, kellojen kaiku,
joulusta ilmoittavat.

Rauhoittuu mielet, päättyvät kiireet,
joulu on tullut taas.



sunnuntai 11. joulukuuta 2016

XAMPP - Apachen porttien muuttaminen

Asensin XAMPP- kehitysympäristöä koneelleni. Aiemmin asennetut ohjelmat olivat ottaneet jo käyttöönsä portteja, jotka Apache oletuksena olisi halunnut käyttää. Tämä luonnollisesti esti Apachen käynnistämisen.

Jos sinulle tapahtuu tämä sama XAMPP-asennuksen jälkeen: 
"You need to uninstall/disable/reconfigure the blocking application or reconfigure Apache and the Control Panel to listen on a different port.."

https://www.youtube.com/watch?v=_cu7KM0NsUA



keskiviikko 2. marraskuuta 2016

Google Maps API error - MissingKeyMapError

http://stackoverflow.com/questions/37991340/error-google-maps-api-error-missingkeymaperror

Tämä ongelma voi tulla eteen, jos html-sivulle on upotettu Google:n kartta. Javascipt antaa otsikon mukaisen virheen.

Syy on tässä:


As per Google recent announcement, usage of the Google Maps APIs now requires a key. If you are using the Google Maps API on localhost or your domain was not active prior to June 22nd, 2016, it will require a key going forward. Please see the Google Maps APIs documentation to get a key and add it to your application.


Korjaus tässä:

Vika korjaantuu helposti hankkimalla ilmaisen Key:n Google Maps API:a varten ja kertomalla siitä koodissa.

Eli muuta tämä:
<script src="https://maps.googleapis.com/maps/api/js"></script>

Tällaiseksi:
<script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=your_api_key_here"></script>