Developer

Articles prominent to software and web development.

When github git clone fails with early EOF and index-pack failed

0

For the past year, I have been majorly working on Native Mobile apps for iOS & Android using Xamarin. Its fantastic!! I can share code, and create beautiful apps for both iOS & Android, using my favourite programming language C#. Yeah you read it right, C SHARP!! And best of all I get to use Visual Studio too with Resharper!!

In one of my recent projects, we wanted to use System.Runtime.Caching.MemoryCache to track our objects and keep it in-memory cache. This has been added to Mono in version 2.8. The problem arose when I realised that MonoTouch & MonoDroid as based on Mono 2.1 and thus the mentioned class is unavailable for use.

So, I decided to extract the code from the latest Mono and create a library for our use. So I fired up the below Git query:

git clone https://github.com/mono/mono.git

No matter how many times I tried, it always ended with the error:

Cloning into 'mono'...

fatal: early EOF
fatal: index-pack failed

So I searched around and found that this happens if the repo is very big, like “mono” in my instance. The solution is simple, modify the git query:

git clone -depth 1 https://github.com/mono/mono.git

That’s it. This prompts git to only query the latest git changes and thus your repo size reduces and can easily be cloned.

The only problem with this is, you will not be able to push any changes. If you want to push any changes, then change the depth to 1000000 and you are done.

Goodluck

Resetting the Live Tile in Windows Phone 7

0

The ability to update the Live Tile in Mango is a really great feature. I have an application where I’m generating dynamic images and setting the live tile to an isostore:/Shared/ShellContent url. But, I have a setting that the user can use to turn on/off live tile updates. When turning it off, I initially couldn’t figure out how to reset the tile.

The trick is to use an appdata: url to refer to your original image. For example, if your standard tile image is called “background.png”, then you can use the following to reset it:

        public static void ResetTile()
        {
            StandardTileData newTileData = new StandardTileData();
            newTileData.BackgroundImage = new Uri("appdata:background.png");
            ShellTile appTile = ShellTile.ActiveTiles.First();
            appTile.Update(newTileData);
        }

Note: If you have changed any other properties like the BackContent, you will want to reset them by setting them to “”. Passing in null will leave the values unchanged.

Remove unused references to assemblies in Visual Studio

0

One of the most important aspect of programming is reuseability. We, as developers, tend to reuse code a lot. Sometimes ours and sometimes code off the internet. This sometimes requires us to download and install assemblies available on internet. But most of are not careful about code optimization until at the end of the project and before deployment where our goal is to ensure a least error-prone product.

This requires us to remove references to plethora of code we may have included in our project during development. Most of us at this point of stage remembers which code was part of which assembly or where they copied it from. If the code was part of Copy-Paste or Inclusion of code files then its simple to just use “Find All References” option of Visual Studio and check whether a particular code is being used of not.

A more simpler and effective way is a ingenious tool called “ReSharper“. Jet Brains defines it as “The most intelligent extension for Visual Studio” and I concur. Period.

ReSharper is a renowned productivity tool that makes Microsoft Visual Studio a muchbetter IDE. Thousands of .NET developers worldwide wonder how they’ve ever lived without ReSharper’s code inspections, automated refactorings, blazing fast navigation, and coding assistance.

In respect to this blog post, ReSharper can help you identify them, but you have to remove them yourself.

To do this, open up the References in the Solution Browser, right mouse click on each referenced assembly, and pick “Find Dependent Code”. See:

http://www.jetbrains.com/resharper/features/navigation%5Fsearch.html#Find%5FReferencedDependent%5FCode

You will either get:

  1. A list of the dependencies on that Reference in a browser window, or
  2. A dialog telling you “Code dependent on module XXXXXXX was not found.”.

If you get the the second result, you can then right mouse click the Reference, select Remove, and remove it from your project.

While you have to to this “manually”, i.e. one reference at a time, it will get the job done. If anyone has automated this in some manner I am interested in hearing how it was done.

You can pretty much ignore the ones in the .Net Framework as they don’t normally get copied to your build output (typically – although not necessarily true for Silverlight apps).

If you want to know: “How do I remove using clauses (C#) from a source code file that are not needed to resolve any references within that file”.

You could simply right click in the Editor window of Visual Studio and select Organize Usings > Remove unused usings

In this case, ReSharper also does help in a couple ways:

  1. Identifies unused using clauses for you during on the fly error detection. They appear as Code Inspection Warnings – the code will appear greyed out (be default) in the file and ReSharper will provide a Hint to remove it:http://www.jetbrains.com/resharper/features/code%5Fanalysis.html#On-the-fly%5FError%5FDetection
  2. Allows you to automatically remove them as part of the Code Cleanup Process:http://www.jetbrains.com/resharper/features/code%5Fformatting.html#Optimizing%5FNamespace%5FImport%5FDirectives

Finally, realize that ReSharper does static code analysis on your solution. So, if you have a dynamic reference to the assembly – say through reflection or an assembly that is dynamically loaded at runtime and accessed through an interface – it won’t pick it up. There is no substitute for understanding your code base and the project dependencies as you work on your project. I do find the ReSharper features very useful.

Error 1316 while uninstalling VS2010 RC via control panel

0

Visual Studio 2010 just came out last week and its touted as on of the best and speedy version of Visual Studio. Anybody who has have Beta or RC version of Visual Studio would agree with the above statement.

Microsoft products and services are on roll, with each product they are improving the quality of the products. Finally they are listening to what the community requires and giving them what they want. Its the best strategy to follow and Microsoft seems to have learnt it. 🙂

On the topic, I had installed Visual Studio 2010 RC and now since the Final version got released, I downloaded it. The install notes clearly mention to install all the previous versions of Visual Studio 2010 before installing the final version, so I fired up the Control Panel and selected Visual Studio 2010 and hit the uninstall button. Everything went well until it reached the un-installation of Visual Studio 2010 RC. About half way it threw up this error…

The error message is "Error 1316.A network error occurred while attempting to read from the file: C:\WINDOWS\Installer\vs_setup.msi". Later, another message appears: "Fatal error during installation."

No, I hadn’t acted smart and deleted the file to trim my Installer cache, but still the error was there. I tried again and it cropped up again. Searching on the net didn’t give a clear answer either.

Then I stumbled upon this bug post and tried the workaround and voila it worked!! So how to not get this error is to start the un-installation from the Install disc. Luckily I had it handy and thus my problem was resolved. If you do get stuck with this error, then I advice you to do the same 🙂

Good luck.

iPad: so easy to use, even cats can do it!

0

Go to Top