Visual Studio Community 2013–issue with NuGet packages

I have recently stepped into the issue while rebuilding an existing project which I have checked out. NuGet correctly downloads the packages from its repositories on my hard-drive but VS seems not to see them in all projects in the solution.

I have reported this bug on Microsoft Connect page and will investigate this issue further.

What is interesting:

1. Libraries are on the disk.
2. In one of the project (this solution has only 3) referenced library works fine, and VS sees it.
3. When Uninstalled and then Installed (Re-Installed?) – everything is fine.
4. I tried changing “maximum number of parallel builds” to 1 – as it was suggested in a different bug which seemed to be the same issue (dependent projects etc.) – but this does not work neither.

NoSQL–dive into graph DB

I am used to relational databases – I used to work in Oracle DBS, a little bit with MySQL and currently Microsoft SQL Server. The problem with these databases is that it is hard to easily show relationship between objects.

In the relational DB tables are objects and relation between is either a part of this table or (what makes such schemas more complicated!) additional tables with many-to-many relations.

One of the ideas to solve this issue is to use different approach – graph databases. The ones use structures of graphs to represent and store data. There are three main elements used in them – nodes, properties and edges. Nodes, as it used to be – are objects such as people, accounts, cars. And this is easy to understand.

Properties are details about particular node – for example, about a person we can store property such as name, surname, age.

The connection between nodes are called edges and these represent the relationship between two edges. This is the place where most of the important information is really stored. And this is also the main difference from relational databases.

I would like to investigate this topic a little bit more deeper so I planned to play with Neo4j database (I know it’s in Java, but thanks to REST web API we can access it through many programming languages and obviously I will use .NET platform) – which is an open source graph database which supports ACID.

Hashtable and Dictionary

As I have mentioned in the previous post – the .NET runtime is now open source. This means that we can dive into it’s code. What is important – most of the code is written in C++ (as expected obviously!).

As part of the runtime I have go through the mscorlib project. What got me interested were Dictionary and Hashtable implementations. There is quite sophisticated arithmetic there as we might have expected.

They share the code

The main difference between this two is obvious – the idea is the same, using hashes to store values in buckets. But it is more important that Dictionary code is just the copy of the initial Hashtable implementation. This means that if any bug fix is implemented in either of them, it needs to be made in the other one as well.

Hashtable has thread safety for multiple readers and single writer build into some of its methods and properties. As you probably know the hash table (aka hash map) is a data structure that maps keys to values and uses hash function for calculating the key (index) to put values into buckets.

In .NET implementation the hash function uses double hashing which looks like this:

h(key, n) = h1(key) + n*h2(key)

where n is the number of collisions for a bucket. h1 is our implementation of GetHash(key) (or the default if we did not override it). More complicated is the h2 one which uses h1 and calculates the value between 1 and hashsize-1.

The table where values are stored is initialized with 3 elements when we do not specify the size (we should not treat this as the constant value from version to version – this can differ). Even when we specify smaller number – there is a check to the “awfully small sizes” are avoided. Very interesting is the procedure for extending the size of the array.

Resize hash array

When the procedure reaches the maximum number of buckets in the array (load factor reaches the maximum load factor) – it needs to be resized. The number of buckets in the hashtable is “automatically increased by approximately a factor of two”. What does it mean? It means that that the size is increased to the smallest prime number which is larger than the current size of hashtable.

How is this organized in the code? First of all – the first 72 prime numbers are stored as the readonly array – so there is no need to calculate them. The biggest one is 7 199 369 (that’s quite big number). When the hashtable size is even bigger – the next prime number is going to be calculated.

We know that by doubling we are preserving the asymptotic complexity of the hashtable operations such as add. What is more important – by having a prime guarantees that double hashing does not lead to infinite loops or just one bucket with plenty of collisions.

Summary

By releasing .NET Framework as open source Microsoft allowed us, developers, to verify the code they wrote. We can even make changes and build our own version of the .NET Framework. I think it is very interesting to check how some of the objects were implemented by devs at Microsoft.

In this short post I dig a little bit into the Hashtable implementation in mscorlib.

CoreCLR–.NET runtime is now open source

.NET team has just announced that .NET Runtime is open source starting now. You can find the repo on GitHub – here to be precise.

This repo contains an execution engine for .NET apps – this is up-to-date CoreCLR codebase which includes RyuJIT, GC, native interop and plenty of other .NET runtime components. This means that we can fork, clone and build our own version of runtime!

I will keep digging into the details of the repo – until then I highly recommend .NET team blog where you can find more details about the release.

Work on C# 7 has already started

When version 6 of the C# language is on its way to the release, the design process for ver. 7 has started. The notes from the design meeting was released couple of days ago. According to Mads Torgersten’s notes – this was the first design meeting.

We can find there couple very interesting parts about future of the language itself but the consequences of making the .NET open source as well.

Design team is still in charge

This is quite important information from these notes – the design process for C# language is not a democratic process. This means that all that community will suggest will be verified by the team but in the end the governance model for C# is benevolent dictatorship. I personally think that having people responsible for the language is a good choice – with community involvement, the language can gain more than it used to be.

The dictatorship does not mean that team will not listen to the community – as the write in notes, they are open for other ideas and suggestions. We must also remember that the day is limited to 24 hours so not all ideas will be verified at the same level.

New version parts (aka themes)

Team has prepared areas on which they want to focus during next version design process. But this is also important that they are willing to add a feature whether it fits in a theme or not.

Working with data

The volume of data in our applications is growing. We can see that more and more interest is focused on functional programming. We have LINQ which is functional-kind-of in the C# language. The design team will investigate further the possibilities to add more features to make working with data much more plesant and easy. They mentioned couple of areas they will investigate – such as pattern matching, immutability, tuples and many other.

Performance and reliability

C# and .NET have areas where the performance and reliability are not the best. There are research projects inside Microsoft which focus on that topic, especially the connection with unmanaged code – the team will investigate this and decide how C# 7 and .NET Framework will be supplemented.

Componentization

This area would probably not influence language itself but they want  to be sure that change how .NET programs are factored and combined could be done.

Distribution

We got async-await in C# 5 for single values – but the area for sequences should be explored. They are also into serialization topic for C#7 – which is quite interesting, as they write “we may no longer be into directly providing built-in serialization“.

Metaprogramming

They are aware that for some reasons in enterprise applications developers are forced to generate code based on some constraints or values from other files. There are areas and ideas to reduce the need to generate code (i.e. virtual extension methods, static ctor constraints, default interface implementations). We may see some of these features in next C# version.

Null

In we will (we got? 🙂 ) get null-conditional operator (x?.Sth) but there are some some more places where such features could be added (i.e. null in foreach statement).

They are also considering non-nullable reference types – which they see as very hard to fully support.

Other

There are number of other not so big feature which are also considered to be implemented/added to version 7.

New version features

Mads makes great effort to fully describe features considered for new version of C# – I think there is no better way as if just read this section from his post. In a nutshell they are interested in:

1. Pattern matching – especially making is operator more powerful, and making case in switch statement more pattern-like than just simple values matching.

2. Array Slices – there is ArraySegment<T> as mentioned in comments but these would be a little bit more language support. This basically mean that the arrays would be better divided into “windows” which could provide us better performance.

3. ref locals and ref returns – this got me thinking that using this is going be not so easy. They are aware that assignment to the getter-only property with ref value – this would create nightmare. They are considering this feature with lots of conditions and explanation how and when use it.

4. Method contracts – we have CodeContracts but there is no language support. What is more important, the runtime has pre- and postconditions for methods – they are considering adding this into the language.

Summary

This is fast! We are waiting for C# 6 release – and we hear about version 7. I expect more information from them as they progress with the design and they will start making decisions. What is more important – they expect us, developers to take part and post ideas on GitHub. The voting system will be used so other developers will have possibility to show which features are more important for real-life applications.

DreamWeek #4

This time a little bit later than usual due to much travelling.

Technical

One Less Password
Great article how we can avoid having password for login purposes.

NuGet: Broken By Design
We all use NuGet. We all love NuGet. But after couple of years NuGet is getting old and many says “it is broken”. Here is great story from guys who stand behind this.

Non-technical

King of click: the story of the greatest keyboard ever made
The best keyboard ever made? Do you have your favorite? It’s the story of IBM Model M keyboard which by many is recognized as the best keyboard ever.

I had a couple drinks and woke up with 1,000 nerds
Great story how geeks like to gather and create stuff. This is the story of Tilde.Club

Windows 10 is the official name for Microsoft’s next version of Windows
You all probably know – this is the hottest news from previous week.

Windows 10–why not Windows 9?

This question was bothering me since I heard that the next release of Microsoft’s OS will be named Windows 10. Where is 9 everyone asked – even me.

Then my friend sent me this one:
By4SyycCUAA4p6d

This got me thinking – maybe this is not only a rumor but actually the truth?

Another hint is here – https://searchcode.com/?q=if%28version%2Cstartswith%28%22windows+9%22%29 
search_code

There are “About 4,342 results” (and this is only one, sample site!), so maybe this is not only a “mistake” but actually this saved us another millennium bomb after changing operating system.

BTW – I wonder what they did discover when used Windows 9 for the first time without changing it to 10.

DreamWeek #3

Technical

Everything you need to know about the Shellshock Bash bug
Yes, last week was all about the shellshock bug – here you can find all the info you need to know about this bug. Apparently this one is much bigger than Heartbleed.

Total Moving Face Reconstruction
Library that takes a single video of a person’s face and creates a high detail 3D shape for each video frame. You can find there not only the explanation but a great yt-movie with samples.

Microsoft OCR Library for Windows Runtime
Another great package can be found in NuGet gallery. This one empowers you to easily add text recognition capabilities in your application.

Microsoft legend Ray Ozzie wants to kill the conference call
Ray Ozzie creates new type of application – as it is advertised this app “even your boss will approve of”. Find out more.

Non-technical

Liberia signs ‘transformational’ deal to stem deforestation
Liberia will be the first nation in Africa to completely stop cutting down trees in return for development aid from Norwegian country.

The ultimate photo shoot: on location in Iceland with the iPhone 6 and iPhone 6 Plus
Incredible photo shots made with iPhone with some explanation there. Definitely worth reading and seeing.

DreamWeek #2

Another set of links from the last week.

Technical

KaTeX
Interesting library for programmers familiar with LaTeX who would like to insert math equations on their web pages.

Cloud Face
Have you ever stared at the clouds and seen faces, animals, dragons etc.? Apparently this is not only seen by humans but als face recognition algorithms can be fouled by clouds. On this page you will find plenty of great examples.

I crashed the web servers of a $100M+ multi-national corporation …
Another example that everyone makes mistakes! What you can learn from this post is that making mistake doesn’t mean you will be fired. A mistake gives you chance to face with deadlines, stress, angry users and yelling boss – and during that time you will learn new things about yourself.

Stack Overflow – performance lessons (part 2)
This is second part of the performance lessons learned on Stack Overflow – in the second part Matt is looking on the examples of coding performance lessons.

Non-technical

Microsoft confirms it will buy ‘Minecraft’ for $2.5 billion
OK, I had to put it here. This was probably the most important purchase during last week.

All-electric racing: Formula E’s thrilling debut
I am fan of Formula 1 and when I heard about the idea to start Formula E I wasn’t really convinced it is a good idea. But apparently you can find some new experiences in that sport – I think we can see the grow in the interest of that new motorsport!

The Song of the Introvert – Rands in Repose
Are you a programmer? Probably yes – and you are probably also an introvert. This article is for you.

The Marshmallow Test for Grownups – Harvard Business Review
We are distracted every day by a rising number of devices and services. This is the study by psychologists about how our ability to be creative and focused decreases because of all the distractions.

The Feynman Lectures on Physics, The Most Popular Physics Book Ever Written, Now Completely Online
Recently I read (and described here as well) the autobiography of Richard Feynman. I also found that you can read his whole book online for free.

Surely You’re Joking, Mr. Feynman!

“You have no responsibility to live up to what other people think you ought to accomplish. I have no responsibility to be like they expect me to be. It’s their mistake, not my failing.”

okladka

I really like biographies of famous people mostly because you often don’t think about people in newspapers or tv as normal person. But they have a normal life, they drink, they smoke (as Mr. Feynman for example marihuana). By reading such books you can find them in different context and you will find out that they are normal as you or me.

And that’s what this book is about – it is a set of anecdotes told by Richard Feynman.The book is a transcription from conversations that Feynman had with his close friend and drumming partner Ralph Leighton. You will see a Nobel-winner who did not like this prize because it changed his life so much.

This is not a standard biography book where you read about person’s childhood then school, college, work etc. You won’t find there any dates any particular events from the start of the book to its end. This is something different. But it doesn’t make this book boring – contrary this is very funny and entertaining. You can open this book on any page and dive into the text – no matter where, you will find plenty of situations from Feynman’s life. You will read about his fascination with safe-cracking, ventures into art (drawing especially) and samba music, drums. There are also more serious ones – such as description of times when he worked on Manhattan Project.

There are plenty of famous quotations from these book. One of my favorite I put on the beginning of the post. And truly Richard Feynman lived with that in mind – that brought him a meeting with Bohr who wanted someone who will tell truly what he thinks about his ideas (not only agree!)… For more you need to go to the library! Smile

c# programming life geek

Create your own website, free on WordPress.com.Create your own website.
Start free