Git / Bitbucket – The remote end hung up unexpectedly – Early EOF – index-pack failed at exactly 1GB

 

Suddenly my repository failed to clone:

git clone https://myuser@myurl.nl/scm/myproject/myrepo.git

Cloning into ‘myrepo’…

remote: Counting objects: 332184, done.

remote: Compressing objects: 100% (59662/59662), done.

fatal: The remote end hung up unexpectedly020.57 MiB | 9.89 MiB/s

fatal: early EOF

fatal: index-pack failed

 

It failed at exactly 1GB.

I found the fix at: https://community.atlassian.com/t5/Bitbucket-questions/My-git-clone-stops-at-1GB/qaq-p/70773

 

It was caused by a limit in nginx reverse proxy, after increasing the limit to 2GB I could clone again.

See: https://www.scalescale.com/tips/nginx/optimizing-nginx-for-serving-files-bigger-than-1gb/

 

 

 

 

Uncaught SyntaxError: Unexpected token in JSON at position 30 with escaped unicode character

 

When you execute the JavaScript code:

JSON.parse(“\”This is a unicode character: \u0007\””)

in a browser you will get the error:

Uncaught SyntaxError: Unexpected token in JSON at position 30
     at JSON.parse (<anonymous>)
     at <anonymous>:1:6

I fixed this by altering the C# code that returned the JSON.


public
static
class
MvcHelper

{


public
static
ActionResult ConvertToJsonActionResult(object data)

{


var content = ConvertToCamelCaseJsonString(data);

content = RemoveEscapedUnicodeCharactersFromString(content);


return ConvertStringToJsonContentResult(content);

}

 


private
static
string ConvertToCamelCaseJsonString(object data)

{


var serializationSettings =


new
JsonSerializerSettings

{

ContractResolver = new
CamelCasePropertyNamesContractResolver()

};


return
JsonConvert.SerializeObject(data, serializationSettings);

}

 


private
static
ContentResult ConvertStringToJsonContentResult(string content)

{


return


new
ContentResult()

{

Content = content,

ContentType = “application/json”,

ContentEncoding = System.Text.Encoding.UTF8

};

}

 


private
static
string RemoveEscapedUnicodeCharactersFromString(string content)

{


var regex = new System.Text.RegularExpressions.Regex(@”\\+[uU]([0-9A-Fa-f]{4})”);


return regex.Replace(content, string.Empty);

}

}

 

Then you can convert your C# ViewModel to a Json ActionResult:

[HttpPost]


public
ActionResult WizardData(int taakId)

{


var model = new
MyViewModelViewModel();

 


return
MvcHelper.ConvertToJsonActionResult(model);

}

 

 

 

 

 

 

 

 

Microsoft Word 2016: Word cannot register your account. The provider where you are trying to publish is unavailable. Contact your provider for assistance.

 

I was getting the error: “Word cannot register your account. The provider where you are trying to publish is unavailable. Contact your provider for assistance.”

This was caused by me forgetting to add ” /xmlrpc.php” to the end of the url.

So if you want to register a blog “https://my.blog.com” in Word 2016, then you should use the url “https://my.blog.com/xmlrpc.php ”

 

 

 

 

Nice article on: JavaScript variable scope hoisting

https://www.sitepoint.com/demystifying-javascript-variable-scope-hoisting

Things to Remember

  • All declarations, both functions and variables, are hoisted to the top of the containing scope, before any part of your code is executed.
  • Functions are hoisted first, and then variables.
  • Function declarations have priority over variable declarations, but not over variable assignments.

Fix: error CS0234: The type or namespace name ‘Helpers’ does not exist in the namespace ‘System.Web’, when using multiple virtual IIS web applications

I have a ASP .NET 4.5.2 MVC web application running on an IIS website and I wanted to run a separate ASP .NET 4.5.2. web api application under the MVC web site.

Both projects worked just fine, when hosting them as separate IIS websites, but when the web api was “mounted” as virtual web application under the MVC website I was getting the errors below, when hitting the web api application:

error CS0234: The type or namespace name 'Helpers' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

Line 150:    <pages controlRenderingCompatibilityVersion="4.0">
Line 151:      <namespaces>
Line 152:        <add namespace="System.Web.Helpers" />
Line 153:        <add namespace="System.Web.Mvc" />
Line 154:        <add namespace="System.Web.Mvc.Ajax" />

So I was hitting the web api, but got an error on the parent MVC web application???

Turns out, I had to remove these namespaces in the web api web.config, because those dll’s are not in the web api project.

Adding the following lines to the web.config of the web api project, solved the errors.

<configuration>

<system.web>

<pages controlRenderingCompatibilityVersion="4.0">

      <namespaces>

         <clear/>

      </namespaces>

    </pages>