Saif Khan
{ I am Saif } "Knowledge is power, information is free, share it!"

Pinterest Search Hack

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.



ASPxGridView at work

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.

 

image1

 

image2

When an invoice row is clicked, the document is displayed in the next DX bad boy.

image3



New DevExpress skin in the works

Over the holiday I’ve decided to redesign the Foggy skin…here is a sample.

 

12-27-2011 12-01-43 PM

Using GMap.NET – Great Maps for Windows Forms & Presentation

 
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.


Overview
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

  • OpenStreetMap
  • Yahoo Maps
  • Bing Maps
  • ArcGIS
  • 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.

 

map_Layers

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

  • GMap.NET.Core.dll
  • GMap.NET.WindowsForms.dll
  • 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 

8-4-2011 2-48-46 AM

 

 


For sake of clarity I am going to name the control myMap.

You first need to Initialize the control

VB.NET

With myMap
      .SetCurrentPositionByKeywords("USA")
      .MapType = MapType.BingMap
      .MinZoom = 3
      .MaxZoom = 17
      .Zoom = 4
      .Manager.Mode = AccessMode.ServerAndCache
End With

 

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)))
Next


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.

myMap.Overlays.Add(overlayOne)

That’s it! My next posts will be on

  • Removing/Hiding overlays
  • Changing the Markers
  • Adding labels
  • Caching
  • Routing

Here is a screenshot of how I am using it in one of my apps (work-in-progress)

8-3-2011 1-20-33 PM

8-2-2011 3-44-12 PM



A simple DataSet XSD Viewer

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

 

6-2-2011 1-54-55 AM

 

I used Open Diagram engine…pretty much straight forward.

6-2-2011 2-25-04 AM

 

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();
ds.ReadXmlSchema("C:\\XSDViewerControl\\DataSet1.xsd");
XsdExplorer1.SetDataSet = ds;
XsdExplorer1.DiaplayDiagram();
 

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.