I was having trouble figuring out why my pinterest pins were not being found through their search. After much testing, here is the reason why: I put a dash in the description and everthing before the dash could not be searched, but everything after was easily findable. Some SQL ingestion prevention from Pinterest. Remove the "-" or any other similar correctors, wait a bit until the caches reset, and the entire description is searchable.
This is an application I created back in 2010. I finally decided to release 3 shots from my dev machine…came across it while cleaning up. The application is basically a portal for customers. When a customer logs in, he/she can see everything on their account, print invoices, statements etc. The fun part was using ASPxGridViews…they added awesome filter, search and sorting capabilities.
I had to remove and blur some data…sorry…company policy.
When an invoice row is clicked, the document is displayed in the next DX bad boy.
Recently I was working on a project where I needed to implement mapping functionality - I am not new to mapping technology, as a matter fact, a few years back I created my own Winform mapping control which interfaced with yahoo and ArcGIS maps which works great in some of my apps, however, I was looking for something more and didn’t want to re-invent the wheel – so to speak. I stumbled upon GMap.NET and as one user put it, “Absolutely fantastic piece of work”. The only thing lacking is proper documentation.
GMap.NET is a FREE .NET control which enables mapping functionality to your application. It can be used in your Winform, WPF and Mobile application and supports several maps including
- Yahoo Maps
- Bing Maps
- Google – sort of, support has been discontinued. Long story short, Google complained that the developer was in violation of their licenses blah blah.
Here are a few things you need to understand when using the the control
1. What is the map control (GMapControl)? This is the control which renders the map.
2. What is an Overlay (GMapOverlay)? This is a layer on top of the map control. You can have several layers on top of a map, each layer representing, say, a route with stops, a list of stores etc.
3. What are Markers (GMapMarker)? These are the points on a layer, each representing a specific geo location (Lat,Lon) e.g. each drop point on a route.
4. What is a route (GMapRoute)? This is the path or direction between two or more points.
5. WTF are tiles? – well here is something to read…Bing Maps Tile System.
The good stuff
When you download the binary from codeplex (this post is on WinForms) you will find several files in the folder. You only need the following
- x86 and x64 folders for the version at the time of writing this post. These folders include the System.Data.SQLite.DLL which is used for local caching of the data to reduce the request for map tiles.
Now, add the GMap.NET.WindowsForms.dll to your Visual Studio IDE toolbox. Create a new project VB.NET or C#, whatever your fancy and drag the GMapControl onto the form.
This is how my toolbox look
For sake of clarity I am going to name the control myMap.
You first need to Initialize the control
.MapType = MapType.BingMap
.MinZoom = 3
.MaxZoom = 17
.Zoom = 4
.Manager.Mode = AccessMode.ServerAndCache
Note: You can set the default position of the map with (to list a few)
- SetCurrentPositionByKeywords(“country”) - USA
- SetCurrentPositionByKeywords(“state, country”) – Berlin, Germany
- SetCurrentPositionByKeywords(“province, country”) – Alberta, Canada
- Position = New PointLatLng(latitude,longitude) - New PointLatLng(54.6961334816182, 25.2985095977783)
Next you need to add overlays with markers to the map
Dim overlayOne As New GMapOverlay(myMap, "OverlayOne")
Note: The GmapOverlay takes the map control and an id as parameters.
Next you need to add markers to the overlay.
overlayOne.Markers.Add(New GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(New PointLatLng(LatitudeValue, LongitudeValue)))
basically you are creating a marker (GMapMarkerGoogleGreen) which takes an latitude and longitude as parameters. Then I am adding that marker to the overlay (overlayOne).
In most cases you’ll need to add multiple markers to the overlay. You can do that with a loop e.g.
For Each customer In Customers
overlayOne.Markers.Add(New GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(New PointLatLng(customer.Lat, customer.Long)))
in the above code, I am iterating a list of customers, creating a new marker and adding it to the overlay.
Note: It is recommended that you have your points (address) geocoded first to get better performance. it makes no sense having several hundred addresses geocoded on the fly each time you load your map if you are dealing with a large list. Some service like google, have rate limits as to how many geocode query you can send to their servers in a given day.
Finally, add the overlay to the map.
That’s it! My next posts will be on
- Removing/Hiding overlays
- Changing the Markers
- Adding labels
Here is a screenshot of how I am using it in one of my apps (work-in-progress)
Earlier this week I had a requirement for displaying an XSD DataSet schema in my application to the end-user. I couldn’t find a free or relatively cheap component. All the items I came across were either too bulky (loads of functionality) or pricey. I was also looking for something along the lines of a user-control which I could drop on a form and wire-up. I decided to roll my own…after an hour I came up with this
I used Open Diagram engine…pretty much straight forward.
To keep things simple I didn’t mess with the XSD schema via XML. I just loaded the schema into a dataset object and pass it to the control I created
DataSet ds = new DataSet();
XsdExplorer1.SetDataSet = ds;
When I have some time I’ll add a property grid and probably use docking windows…and “Foreign-Key” references on the diagram. This was just a quick solution.