Error: listen EADDRNOTAVAIL 192.168.1.75:8080

When trying to serve my project this morning I kept on getting an Error saying that I can listen to the port.

After, I noticed that my host file had suddenly went blank. Weird because I did not edit it but anyways… I solved it by simply adding the localhost back into the host file:

127.0.0.1 localhost

…. and save. Quite simple but not as trivial if this stops working all of sudden like it did with mine.

 

 

Advertisements

Error Code: 1055. Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

I was trying to query a complicated sql query with joins, groups, etc and after upgrading mySQL the group by stopped working.

In order to fix issue I had to open mySQL and on the database I had to run the following query:

SET GLOBAL sql_mode = '';

Solution: The file ‘.asmx’ has not been pre-compiled, and cannot be requested.

I had published/precompiled my site and deployed to IIS however when I try to use the service asmx I get the error “The file ‘.asmx’ has not been pre-compiled, and cannot be requested”.

In order to fix this issue I opened the “PrecompiledApp.config” and changed the updatable attribute as follows:

From:

<precompiledApp version=”2″ updatable=”false”/>

To:

<precompiledApp version=”2″ updatable=”true”/>

Hope this works for you too ūüôā

Issue: Razor TextBoxFor returns null in Controller

Explanation:

I had a couple of textbox’s using razor syntax and some had an html attribute disabled in order to stop the user from editing. On Postback, the disabled textboxes kept on returning null. I made a couple of tests. At first I thought it is because I am setting the value in jQuery which was not the case. The problem is that the form ignors all disabled fields, even if they contain data. So the trick was to simply removed disabled and replace it with readonly.

Example:

Wrong:

@Html.TextBoxFor(model => model.username, new { @disabled= “disabled” })

Correct:

@Html.TextBoxFor(model => model.username, new { @readonly = “readonly” })

Escaping single quote in SQL

Very simple, in order to escape a single quote in SQL, just add another single quote before your actual single quote as the following example:

Error: ¬†UPDATE¬†SampleTable¬†SET (Title = ‘Welcome to Bob’s Burgers’)

Solution: ¬†UPDATE¬†SampleTable¬†SET (Title = ‘Welcome to Bob”s Burgers’)

Could not load file or assembly ‚ÄėChilkatDotNet2‚Ä≤ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Recently, we needed to migrate an old service which used Chilkat components to a new server. Even though all files were identical, the service kept on throwing the same error over and over:

Could not load file or assembly ‚ÄėChilkatDotNet2‚Ä≤ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Imediately, I thought of the .NET version or the dll bit version. I first checked that the application pool was running with the same old .NET version which it was. So next step was to check the dll bit version since considering this was not a new application, the dll’s were using 32-bit. To check/change what bit version the application is running on, I had to follow the following steps:

  • Open the IIS
  • Open Application pool¬†and select the application trying to run
  • Rigth Click – Advanced Settings
  • Set “Enable 32-bit Applications” to true

This solved the issue!

 

 

ERROR: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. The statement has been terminated.

This week I was working on a migration script where I needed to run multiple sql queries. Since I was going to use this only once, I decided to use SqlHelper classes to connect and run sql to MsSql2012. Part of this included inserting and updating a date into the database. On my local computer this was working fine however, when placed on the server, I kept on getting the below error:

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. The statement has been terminated.

A sample of the Sql I was trying to use was:

UPDATE Table SET StartDate = '26-Mar-15 2:53:42 PM' WHERE ID = 15

I googled this error and amongst the top suggestions/solutions I found:

  • sql query is passing the wrong date format so it goes out of range
  • you should not pass DateTime values as sting in your SQL statement. Instead use parameters such as ( ¬† ¬†cmd.Parameters.AddWithValue("@mvendid", mVendid); ¬†)

None of the 2 above worked. I tried all sorts of formats (“dd/mm/yyyy hh:mm:ss”, “mm/dd/yyyy hh:mm:ss”, “yyyy/mm/dd hh:mm:ss”, etc etc). I tried also declaring a new date in the sql and saving it, which still gave same error.¬†I was about to give up when I though what about the computer’s date?

Solution:

We checked my computer’s date format from “Control Panel -> Region and Language -> Formats” and noticed that the short date was completely different. Since I was desperate, we tried changing the server’s local date to match my date. Just like a miracle it worked fine.

Region

 

 

Hope this helped … as I was going mental for a while there!!!