Solving tech problems

Firefox and Chrome redirects to HTTPS from HTTP error

Programming

This Friday, 16th March 2018 it was all working well and today on Monday 19th March 2018 it stopped working and Firefox and Chrome are redirecting my development websites to HTTPS. After searching what could be thee cause I found out that if your development website ends with .dev domain extension then both browsers demand that you have commercial SSL and not self-signed. The solution of this problem was to change all my projects and settings from .dev to .test and now it is working again. I hate these kind…read more

Entity Framework in .NET and MySQL tinymce(1) problem

Programming

You know at tinymce(1) field in MySQL database will be converted to boolean type in C#. Sometimes you don’t want this because you just want to read the integer value from MySQL in this field (it can be any from 0-255 if unsigned or -127-127 if signed) – one byte. In order to do so you need to do two things: Add TreatTinyAsBoolean=false to your connection string Edit the database edmx file and in SSDL content section change bool to tinyint, and in CSDL content section change Boolean into SByte….read more

Microsoft .NET to run on Linux and Mac OS X

Learning, Products and Services, Programming, Technologies

Microsoft .NET will finally run fully on Linux and Mac OS X platform and this is a great news. Visual Studio is maybe the best tool for developers and Microsoft decided to open sourcing the full server-side .NET Core stack, from ASP.NET 5 down to Core Runtime and Framework. Microsoft is also giving for free Visual Studio Community 2013 full featured edition of Visual Studio, available today. You can watch more about this here. Open source links ASP.NET – https://github.com/aspnet/home .NET Compiler – https://roslyn.codeplex.com/ .NET Core – https://github.com/dotnet/corefx .NET –…read more

How to delete duplicated records in MS SQL Server?

Databases, Programming

First, create one demo table Let’s create one demo table first. It will be called Person and will hold some fictive person data. Now, fill the data Insert some fictive person data and do some duplicated records that have the same values for fieldsĀ  firstname, lastname and email. Now the magic Use this subquery trick to extract duplicate records and then delete them. Notice the use of PARTITTION and WITH Transact-SQL keywords. All records that have RowNumber > 1 are deleted.

How to submit form in jQueryMobile?

Programming

jQuery Mobile is excellent framework and I was trying to figure out why postback of my web form is not working properly and I finally found out that jQuery Mobile use ajax in passing forms so you need to add parameter data-ajax=”false”. It is better to read documentation sometimes.

Using SQL Server PIVOT feature to transform rows into columns

Databases, Programming

PIVOT queries in SQL Server are useful when we need to transform data from row-level to column-level. Example: Imagine having the table named Invoice (payments per month) – for simplicity let’s say that we have PaidDate and Amount. What we wanted now is to get total money collected from the beginning of the year 2014, and in order to do this we can use this PIVOT query: And we finally get

How to get TimeZone by RemoteIP or for specific city

Programming

The goal: to find out the TimeZone of a visitor. There are few free services that can give you this information. First step is to get the City name by RemoteIP address – there are free services/databases that helps you to achieve this, one of them is MaxMind. When you have a city name you can get its latitude/longitude from the database of the same service or you can use Google API like this: For Berlin, Germany: https://maps.googleapis.com/maps/api/geocode/json?address=Berlin&sensor=false You will get JSON result like this: After getting latitude and longitude…read more