Up2 Blog

Mariana Georgieva

LeafletJS. Why is it awesome? And how to add markers from outer div, change their color and stylize their popup – simple tutorial

Although Leaflet is a new JavaScript library for maps, it has gained popularity very quickly.

Why? First, it works well for both desktop and mobile devices. Second, it is an open source, which is great. And this is probably the thing I should have started with. It is simple and by simple I mean it is very easy to start using it even if you don’t have any experience with maps. The API documentation is wonderful, the code is clean, readable and OOP-based and there are also tones of tutorials on the net.

With Leaflet I love that you are able to edit the CSS of all the map elements and customize it according to your needs. It is also very small and fast. Despite being about 34 kb, it has all the features most developers have ever needed for online maps. And it is easy to add features or customize existing ones to your needs.

There is so much that can be said but I think I should stop and go to the example.

Read more…

Lyubomir Lyubenov

Optimize your code using Linq-to-SQL ToDictionary()

The advantages of using Linq into a Dictionary for cashing and its power for retrieving a value by using its key are well-known. In short, the Dictionary<TKey, TValue> is a generic class that provides a mapping from a set of keys to a set of values. Each addition to the dictionary consists of a value and its associated key. Retrieving a value by using its key is very fast, close to O(1), because the Dictionary<TKey, TValue> class is implemented as a hash table.

I’ll present my case where ToDictionary() optimize my code. I have to manage two objects: hierarchies and levels. I am using Rest service (Asp.Net MVC – Web API) to send JSON data and jQuery.ajax() request to retrieve it. In this example the objects have the following fields:

Read more…