Setting up Visual SVN source control with Visual Studio and Tortoise Client

October 3, 2013 Leave a comment

My team faced many issues without a proper source control management.

Some issues are Team project, backup updated sources with different dates in folder, lacking update comments, etc

I got a cool svn server for managing different versions of source files. Visual SVN and its plugins for Visual Studio.

You can see here

http://www.visualsvn.com/

Download and Install Visual SVN Server to setup svn server.

Download and Install Visual SVN as the plugin for your all versions of Visual Studio.

One more thing remaining. Download Tortoise svn client

http://www.visualsvn.com/visualsvn/download/tortoisesvn/

Please install appropriate version, if your system is 64 bit, install 64 bit version.

Notes :

  • Install the svn server in a dedicated system with a particular port number (use https)
  • Make a repository to store your sources in the svn server, also make users (developers) to access the server.
  • Add solution to the svn server repository from developer’s visual studio.

Image

  • Connect to server svn, its like

https://srishti-pc:4499/svn/sandbox/TestProject/trunk

sandbox is the name of your repository. You can create many repositories in server.

Image

  • After finish you can commit your solution, so it would be your first version of source code.
  • Many developers can work on that and make different versions of source with update comments.
  • Main things are Update and Commit

Update : Get updated source from the repository

Commit : Update (with comments)ย  repository with your new version of source code

Happy coding with svn ๐Ÿ™‚

Advertisements

Restore Database to SQL Azure

August 21, 2013 Leave a comment

Hmm.. i spent some hours to get a nice tool that exports our local database to Windows Azure SQL Cloud ๐Ÿ™‚

Here it is

http://sdrv.ms/174x8uc

Some screens to export the db

Image

Image

Image

Image

Put your sql azure credentials here

Image

Connect – Wait the process to complete – Done

๐Ÿ™‚

Categories: Azure Tags:

Ajax call before form submit asp.net c#

July 28, 2013 4 comments

Let me share an issue i faced.

I have a textbox with google auto complete plugin.

Image

I need to store the place i typed in, its latitude, longitude in to the database.

So google have the javascript api to get the latitude and longitude, but it should be called before the form button click to store that in Hidden fields(my way), so i can get the values in server side(c#).

I tried the OnClientClick, but the hidden fields are not set with lat and long. The form is always submitting before the result is came from the ajax call :(.

I found a solution.

var geocoder;
function SetLatLng() {
geocoder = new google.maps.Geocoder();
           var address1 = document.getElementById("location1").value;
geocoder.geocode({ 'address': address1 }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
$('#HFLat').val(results[0].geometry.location.lat());
$('#HFLng').val(results[0].geometry.location.lng());
$('#SecondButton').click();
}
});
return false;
}
<asp:Button ID="FirstButton"ย OnClientClick="SetLatLng(); return false;" runat="server" Text="Click" />
<asp:Button ID="SecondButton" OnClick="buttonSubmit_Click" runat="server" Text="Click" style="display:none" />
<asp:HiddenField ID="HFLat" runat="server" Value="" />
<asp:HiddenField ID="HFLng" runat="server" Value="" />

Make 2 buttons, one for running the javascript, if the value is returned from the ajax call, click the second button programmatically ๐Ÿ˜›

Happy coding ๐Ÿ™‚

How to set up virtual port windows 7 c#

July 25, 2013 Leave a comment

Its really cool to have an emulator to set up virtual port in windows 7/XP

A null modem emulator, get it from here

http://sourceforge.net/projects/com0com/

You need to make paired ports to test the data send/receive

Follow the steps below to set up and test the virtual port.

1. Install the null modem emulator (com0com) as Administrator

2. Run the Windows 7 command prompt as administrator

3. Type the following command and hit enter

bcdedit.exe -set TESTSIGNING ON

4. Reboot the computer

5. Open the program com0com setup to configure virtual ports

com0com

6. Create paired ports, So we can test the data transfer. If any data we push to COMA, we can get it at COMB

7. Useful program to test the data transfer between ports is hyperterminal. Unfortunately its not in the Windows 7, its in XP i guess.

You can get the hyperterminal here http://sdrv.ms/15NJAMo

8. You can test the data from the hyperterminal as below

hyper

If you type something in COM A, you can see the text in COM B and vice versa.

Also you can manage the virtual ports from your c# code with SerialPort tool as well.

Happy coding…:):)

Awesome plugin for multiple file upload ajax asp.net

July 2, 2013 Leave a comment

Got a simple and nice plugin for uploading multiple files.

Image

Here is my source code http://sdrv.ms/121hk6G

You can see detailed options here : http://www.albanx.com/ajaxuploader/examples.php?e=2

Happy coding ๐Ÿ™‚

Markers on map javascript asp.net c#

June 27, 2013 Leave a comment

Sometimes we gets trouble to mix Javascript and C#.
Here is my asp.net source to display dynamic markers on google map.

http://sdrv.ms/11LvXye

See live here

http://sicsglobal.co.in/mytestproject/themarker/

I called an aspx page to get some places as C# List, and convert the list to Javascript array from the ajax result.
So we can show markers on map using the normal google api functions.

๐Ÿ™‚

Deserialize google places json api using JSON.NET C#

June 23, 2013 1 comment

https://maps.googleapis.com/maps/api/place/search/json?location=8.487495,76.948623&radius=50000&sensor=false&key=Your_key&types=bank

The above link will list all banks near trivandrum in json format (around 50km).

The format is

{
“debug_info” : [],
“html_attributions” : [
“Listings by \u003ca href=\”http://www.indiacom.com/\”\u003eIndiacom Yellow Pages\u003c/a\u003e”
],
“next_page_token” : “ClRNAAAAiET0Jb-GWSPRrClKlXoDqUzA70eEBaa2oKXpN0uBnZ0rVeGkmia0x8IT78UKkXnJZ9IKDhXRsydMw-20Qu1vFf0U5WHKd_Vyt6OwA6etDC8SENOghFC6xxe63lx7VL7i5O4aFGrN8gtl_GaPmBQlqcQGYUdnZoao”,
“results” : [
{
“geometry” : {
“location” : {
“lat” : 8.5280190,
“lng” : 76.9387870
}
},
“icon” : “http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png&#8221;,
“id” : “03d8927f980ecbe599326209ee5018ebbf1d54e6”,
“name” : “Syndicate Bank”,
“reference” : “CnRtAAAA_LbcYBdQ5KDQqNoHxaT2YLBfU5H6cnoi5MgcaFLHcGQQH6EAMKeNzi8KPtNjoTE1d1nBftN0a100yFJ5V103RWO6zZgfsJCb1D33A8DIyr6DyBm4CXOhjECWv5RPf3oriP2WbmQ5U5o8JzloTFApaBIQRZlVXmu5Npmx9SvoQ4a7kBoUzlHi7IgB3JtUAXo8WWCPhi_VQRI”,
“types” : [ “bank”, “finance”, “establishment” ],
“vicinity” : “Kesavadasapuram, Thiruvananthapuram”
}

],
“status” : “OK”
}

You can deserialize in to objects using JSON.NET

The class format should be

public class GooglePlacesResponse
{
public string status { get; set; }
public results[] results { get; set; }
}

public class results
{
public geometry geometry { get; set; }
public string name { get; set; }
public string reference { get; set; }
public string vicinity { get; set; }
}

public class geometry
{
public location location { get; set; }
}

public class location
{
public string lat { get; set; }
public string lng { get; set; }
}

Download json string and Deserialize using JsonConvert class in JSON.NET

WebClient wc = new WebClient();
string jsonStr = wc.DownloadString("https://maps.googleapis.com/maps/api/place/search/json?location=" + currentLoc + "&radius=50000&sensor=false&key=Your_Key&types=" + value);
GooglePlacesResponse gpr = (GooglePlacesResponse)JsonConvert.DeserializeObject<GooglePlacesResponse>(jsonStr);

Image
Happy deserializing:)