Apple TV 2 XBMC installation dkg was interrupted, you must manually run dpkg –configure –a to correct the problem
In the artice below I described how to install XBMC on Apple TV 2.
Some users reported errors while installing XBMC on Apple TV 2.
In the step 5 where we go to NitoTV > Install Software > XBMC-ATV2
Apple TV 2 downloads XBMC, reboots and XBMC does not appear in the menu or this error appears:
E: dkg was interrupted, you must manually run ‘dpkg –configure –a’
To correct the problem follow these steps:
1. Find out the IP address of the APTV2 in Settings >Network
2. If you are on Windows download Putty http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe (it is ssh client)
3. Launch Putty and in Host Name (or Ip Address) enter the IP address of Apple TV 2 for example 192.168.1.24
4. If you get message about encryption click Yes
5. You will get login screen. As user type in root and as password alpine
6. Launch the following command:
apt-get install wget wget -O- http://apt.awkwardtv.org/awkwardtv.pub | apt-key add - echo "deb http://apt.awkwardtv.org/ stable main" > /etc/apt/sources.list.d/awkwardtv.list echo "deb http://mirrors.xbmc.org/apt/atv2 ./" > /etc/apt/sources.list.d/xbmc.list apt-get update apt-get install org.xbmc.xbmc-atv2
If by any chance you get error exit status 1
1. Run commands:
apt-get remove org.xbmc.xbmc-atv2 apt-get install org.xbmc.xbmc-atv2 --fix-missing
2. XBMC should appear in Apple TV 2 Menu.
If you still get the problem the best idea is to do Restore thorugh iTunes and start the process again.
For some reason restore and installation worked for many.
Good Luck
Cheap Multiroom Media Center System with Apple TV and XBMC
Many people look for cheap multiroom media solutions. There are many options. In this article I would like to share what media center system I have built and how reliable it has been so far.
Firstly, I started with my living room. I’ve already had plasma TV and audio amplifier with 5.1 speaker system. All I needed was some sweet media center and storage for my films, music and pictures. As storage I went for NAS Storage Synology DS110j. Honestly, forget NAS systems from WD, LinkStation and Netgear. I have read a lot of comments about NAS products before buying one and a lot of people always had some problems with these.Synology though has good reputation amongst its users and there is no mistake – this product is great!I bought 2TB hard drive and installed it in the NAS. Created shares and uploaded content to it.
What about media center? Well, I’ve always been big fan media center software and I have tried few. At the begging I had PC with Windows Media Centre 2005 hooked up to the TV. Not a good solution. Big case and fan noise. Also, I didn’t like Windows Media Centre. It didn’t support many file formats, subtitles and I got windows errors while watching films too many times. I moved to XBMC and it became my best friend!. I strongly recommend trying it. It has so much to offer!
What most I like about it is:
- haven’t found video or audio format xbmc doesn’t support
- multiple subtitles in various formats
- allows me to add content from various sources : windows and linux shares , UPnP AV ….
- choice of skin
- allows me to stream content directly from internet (youtube, megavideo)
Some months later I took PC out and put first generation of Xbox with XBMC on it. I didn’t have to wait for PC to boot up and shutdown anymore. Xbox was ready in about 5 seconds and I could just shut it down with 1 button click just as DVD player. It served me well until I got Apple TV 2 and installed XBMC on it.
This is what I came up with:

And what you get is this:
Here are links where you can buy this stuff:
Synology DS110j
http://www.amazon.co.uk/Synology-DS110j-Disk-Station-Enclosure/dp/B002U42XD6/ref=sr_1_1?ie=UTF8&qid=1297860833&sr=1-1
Seagate 2TB hard drive
Apple TV
Here you can learn how to install XBMC on Apple TV 2
Apple TV 2 Untethered Jailbreak on Windows and XBMC media centre installation
Post OUT-OF-DATE. Check this one instead:
http://arturito.net/2012/03/07/how-to-jailbreak-apple-tv-2g-4-4-4-and-install-xbmc-untethered/
Yesterday I got a new Apple TV 2 as a birthday gift and I decided to stick XBMC media centre on it since I already have one on the first generation of Xbox. I thought that would be perfect fanless replacement.

I read a lot of post how to jailbreak it with Pwnage Tool and Seas0nPass but all these methods have two huge disadvantages.
1. These programs come only for Mac computer for now. (I don’t have one)
2. They are tethered, which means everytime you shutdown Apple TV you will have to connect it to the Mac to boot it in jailbreaked mode.
I found little program that is called GreenPois0n and it comes for Mac, Linux and Windows and very little reference on the internet on how to use it. I thought I will give it a go. Program can be downloaded here: http://greenpois0n.com/
What you need:
1. Micro USB cable – unfortunately it is not supplied with Apple TV 2 so you need to get one or ask your friends. I had one as it came with my Blackberry.
2. iTunes software on your computer. http://www.apple.com/itunes/
3. GreenPois0n program http://greenpois0n.com/ (latest version RC6)
4. Find out which version your Apple TV 2 is running (Settings > General > About) Ideally should be 4.1.1. Mine came with 4.1 and I had updated it via iTunes to 4.1.1
UPDATE: 10.04.2011
If your version is greater than 4.1.1 skip this tutorial and go here:
Ok let’s do the magic:
Important! I do not take responsibility to any damage you do to your Apple TV 2. Remember, you are doing it at your own risk.
*It is highly unlikely to brick it or break it. Never heard of anyone messing up Apple TV 2 yet. You can always restore the firmware to its original state through iTunes.
1. Unplug all cable from Apple TV 2
2. Run the GreenPois0n program and follow instructions



If Jailbreak! button is not active that means you failed to put Apple TV 2 in DFU mode. Try again. When Apple TV 2 goes into DFU mode the LED light on the front panel flashes rapidly. Make sure that your timing is ok. I managed to put it in DFU mode on 3rd attempt.

3. Once GreenPois0n is done. Disconnect it and hook it back to your TV.
*When I did mine for the first time it didn’t boot properly. I have noticed that before jailbreaking my version was 4.1. I connected Apple TV 2 back to my PC and did the Restore process through the iTunes. Restore process updated latest Apple TV 2 firmware to 4.1.1. I run Green Pois0n again and it did work.
* Although I haven’t experienced any problems and all worked well once I had 4.1.1 user Fluxx has recommended to wait 40 seconds after the jailbreak is done.
4. Now you should get this option:

5. Click on Inject Software and than Install . Your Apple TV 2 will automatically restart and you will get this new menu item called NitoTV. Select NitoTV and in the submenu select Install Software. Find XBMC-ATV2 and hit install it.

6. It will automatically download and install XBMC. After install Apple TV 2 will automatically reboot.
IMPORTANT!!!
Install updatebeGone to disable all Apple updates.
http://arturito.net/2011/03/21/how-to-fix-xbmc-that-quits-exits-on-apple-tv-2g-disable-update/
* If you don’t see XBMC in menu option after the installation.
Reboot Apple TV 2 and install again.
It happend to me while jailbreaking aptv2 of one of my friends. If you still get the problems such as:
E: dkg was interrupted, you must manually run ‘dpkg –configure –a’ to correct the problem


Skins I have tried that work well on Apple TV 2:
Alaska Revisited
Night
I will be trying to install these too:
Rapier – I used to use in XBMC on my xbox – very responsive
Aeon – my favorite
* You can also log in via SSH to your Apple TV2 ![]()
1. Find out what IP is assigned to the box: Settings >Network

2. Use program such as Putty http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html to login

Username: root
Password: alpine
*Also since the TV I hooked up Apple TV 2 to doesn’t have HDMI input I used a converter from HD Fury (version 1) to convert HDMI to VGA. It works perefectly without any additional power supply.

UPDATE: 21.03.2010
Solutions to some common problems:
1. Changing time zone / setting up date and time:
http://arturito.net/2011/03/21/how-to-change-configure-time-zone-on-apple-tv-2g-xbmc-time/
2. XBMC exiting/crashing is due to the Apple TV 2 updates
This fixes it and gets a rid off the annoying update prompt.
http://arturito.net/2011/03/21/how-to-fix-xbmc-that-quits-exits-on-apple-tv-2g-disable-update/
Good Luck!!!
ASP.NET MVC2 jQuery Form Post with JSON Tutorial
In one of the previous post I covered how to post form with ASP.NET MVC2 using jQuery.
Today I will explain how to return data in JSON format. Why return data in JSON format. Well there are several reasons for it:
1. You can easily update several parts of the page without reloading entire page
Imagine that you have ajax login and after successful login the name of the user is updated in the header of the page and content of the saved cart in the right column.
2. It reduces the amount of data sent from the server to the browser.
In a lot of cases developers send data wrapped in html such as:
return Content(“
You submitted: “ “
or they send PartialView. But the idea of JSON is to send data only without html tags, which also reduces the traffic.
3. It separates application logic from design
Sending only data using JSON means data doesn’t have to be wrapped in html tags in your controller, you only send pure data. This way one developer can concentrate on developing logic and doesn’t have to think how it will be displayed, leaving web designer to handle presentation part.
Let’s start modifying previous project:
1. Open MVC2JQuery project that can be downloaded here MVC2JQuery at MediaFire
2. Open RegisterViewModel and modified it as below:
public class RegisterViewModel
{
public string FirstName { get set }
public string LastName { get set }
public int NumberOfPosts { get set }
public string LastPost { get set }
}
3. Open HomeController and make changes as shown below:
[HttpPost]
public ActionResult Index(RegisterViewModel data)
{
// here you can save data to database
// and return some feedback to the user
data.NumberOfPosts = 5;
data.LastPost = “This is my last post”
if(Request.IsAjaxRequest())
return Json(data); // here data object is being converted to JSON format
else
return Content(“Please enable JavaScript”);
}
4. Also modify Views/Index accordingly
In the
part:<script type=”text/javascript” src=”<%=Url.Content("~/Scripts/jquery-1.4.4.min.js")%>“>script>
<script type=”text/javascript” src=”<%=Url.Content("~/Scripts/jquery.form.js")%>“>script>
<script type=”text/javascript”>
$(document).ready(function() {
var options = {
beforeSubmit: showRequest, // call this function before sending data to the server
success: showResponse, // call this function once we have a response form the server
type: ‘post’,
dataType: ‘json’, // important! expecting data type is JSON
resetForm: true
};
$(‘#form-user’).ajaxForm(options);
});
function showRequest(formData, jqForm, options) {
$(“#result-user”).empty().html(‘Loading….’); // display loading
$(“#form-user :input”).attr(“disabled”, true); // disable inputs
}
function showResponse(data, statusText, xhr, $form) {
$(“#result-user”).empty();
$(“#form-user :input”).attr(“disabled”, false);
// here ‘data’ is an object. See below how it is used:
$(“#welcome”).html(“Hello, “ + data.FirstName + ” “ + data.LastName);
$(“#number”).html(“Number of posts: “ + data.NumberOfPosts);
$(“#lastpost”).html(data.LastPost);
}
script>
In the
part:
<body>
<% using (Html.BeginForm(“Index”,“Home”,FormMethod.Post, new { id=“form-user”, name=“form-user”})) {%>
<div style=”float:left” id=”welcome”>div>
<div style=”float:right” id=”number”>div>
<div style=”clear:both“>div>
<fieldset>
<legend>Fieldslegend>
<div class=”editor-label”>
<%= Html.LabelFor(model => model.FirstName) %>
div>
<div class=”editor-field”>
<%= Html.TextBoxFor(model => model.FirstName) %>
<%= Html.ValidationMessageFor(model => model.FirstName) %>
div>
<div class=”editor-label”>
<%= Html.LabelFor(model => model.LastName) %>
div>
<div class=”editor-field”>
<%= Html.TextBoxFor(model => model.LastName) %>
<%= Html.ValidationMessageFor(model => model.LastName) %>
div>
<p>
<input type=”submit” value=”Save” />
p>
fieldset>
<% } %>
<div id=”result-user”>div>
<div style=”border:solid 1px #cccmargin:10px“ id=”lastpost” >div>
body>
5. And we are done! Hit F5 and see result:


Here you can download complete source code: http://www.mediafire.com/?ul8wl6o2fe47qk4
Good Luck!
Funny SQL jokes
Just a bunch of sql jokes that I found on the net and I thought they are funny.CREATE PROCEDURE MyMarriage BrideGroom Male (25) , Bride Female(20) AS BEGIN SELECT Bride FROM india_ Brides WHERE FatherInLaw = 'Millionaire' AND Count(Car) > 20 AND HouseStatus ='ThreeStoreyed' AND BrideEduStatus IN (B.TECH ,BE ,Degree ,MCA ,MiBA) AND Having Brothers= Null AND Sisters =Null SELECT Gold ,Cash,Car,BankBalanceFROM FatherInLaw UPDATE MyBankAccout SETMyBal = MyBal + FatherInLawBal UPDATE MyLockerSET MyLockerContents = MyLockerContents + FatherInLawGold INSERT INTO MyCarShed VALUES('BMW') END GOThen the wife writes the below query:
DROP HUSBAND; Commit;A SQL query goes into a bar, walks up to a table and asks 'May I join you?
SELECT * FROM politicians WHERE clue > 0; SELECT finger FROM hand WHERE id=3; SELECT * FROM girls WHERE freesex = True;
Publishing ASP.NET MVC2 Application on Windows Server 2008 IIS 7 with Visual Studio 2008 on platform .NET 3.5 SP1
Prepare you server:
1. Go to Server Manager and select Add Roles, and install Web Server



2. Mark ASP.NET and install



3. Confirm the CLR of ASP.NET has been installed

4. Install .NET Framework 3.5 and .NET Framework 3.5 SP1

5. Let’s create a directory where we stick our MVC2 application. In my case it is C:\www\windows.amk
6. Once you are done go to the Security properties of that directory and add read and write permissions for group IIS_IUSRS

7. Go back to IIS Manager and Add Site


8. In Application Pool double click pool of your site and make sure that Managed pipeline mode is Integrated


Now the server is prepared to run MVC2 web application!
Prepare your project to be published
1. Go to your project properties and mark Release

2. Go to References and and change Property Copy Local to true for
System.ComponentModel.DataAnnotations.dll
System.Web.Mvc.dll


If you are running .NET Framework 3.5 NOT .NET Framework 3.5 SP1 change properties for all these.
System.ComponentModel.DataAnnotations.dll
System.Web.Abstractions.dll
System.Web.Mvc.dll
System.Web.Routing.dll
6. In Web.config change lines
<compilation debug="true">
to
<compilation debug="false">
And uncomment this bit:
<customerrors mode="RemoteOnly" defaultredirect="GenericErrorPage.htm">
<error statuscode="403" redirect="NoAccess.htm" />
<error statuscode="404" redirect="FileNotFound.htm" />
</customerrors>
7. Generate and upload files to directory on the server in my case c:\www\windows.amk
* What we need:
- Configuration and settings files (e.g., Web.config and any *.settings files)
- Uncompiled view templates (*.aspx, *.ascx, and *.Master)
- Global.asax (this tells ASP.NET which compiled class represents your global HttpApplication)
- Any static files (e.g., images, CSS files, and JavaScript files)
- Optionally, the *.pdb files in your \bin folder, which enable extra debugging information (these are rarely deployed to production servers)
* We don’t need:
- C# code files (*.cs, including Global.asax.cs or any other ‘code behind’ files)
- Project and solution files (*.sln, *.suo, *.csproj, or *.csproj.user)
- The \obj folder
- Anything specific to your source control system (e.g., .svn folders if you use Subversion, or the .hg or .git folders if you use Mercurial or Git)

Good Luck!
ImageMagick PHP Image Resizing Imagick with Canvas
<?php
try{
$width = 60;
$height = 60;
$image = 'ct.jpg';
$im = new Imagick($image);
$im->thumbnailImage($width, null );
$canvas = new Imagick();
$canvas->newImage($width, $height, 'white', 'jpg' );
$geometry = $im->getImageGeometry();
/* The overlay x and y coordinates */
$x = ( $width - $geometry['width'] ) / 2;
$y = ( $height - $geometry['height'] ) / 2;
/* Composite on the canvas */
$canvas->compositeImage( $im, imagick::COMPOSITE_OVER, $x, $y );
/* Save image */
$canvas->writeImage( 'ct_th.jpg');
/* Output the image*/
header( "Content-Type: image/jpg" );
echo $canvas;
}
catch(Exception $e)
{
echo $e->getMessage();
}
?>
Remote Desktop Data Encryption Error When Connecting to Windows 2003
Today I have tried to connect to my Windows Server 2003 on the LAN and I got welcomed by a message decorated with Christmas colours (red dominating). Data Encryption Error! Huh??
Googled here and there and found a solution:
- Start Registry Editor.
- Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\TermService\Parameters
- Under this registry subkey, delete the following values:
- Certificate
- X509 Certificate
- X509 Certificate ID
- Quit Registry Editor, and then restart the server.
Full description: http://support.microsoft.com/?kbid=323497
Using Google Maps API to mark multiple addresses fetched from database PHP and Geocoder
This tutorial will cover marking multiple addresses stored in database on Google Maps.
The idea is to get something like this:

1. Create a table in database with our addresses
CREATE TABLE `markers` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `name` VARCHAR( 60 ) NOT NULL , `address` VARCHAR( 80 ) NOT NULL ) ENGINE = MYISAM ;
INSERT INTO `markers` (`name`, `address`) VALUES ('Pan Africa Market', '1521 1st Ave, Seattle, WA');
INSERT INTO `markers` (`name`, `address`) VALUES ('Buddha Thai & Bar', '2222 2nd Ave, Seattle, WA');
INSERT INTO `markers` (`name`, `address`) VALUES ('The Melting Pot', '14 Mercer St, Seattle, WA');
INSERT INTO `markers` (`name`, `address`) VALUES ('Ipanema Grill', '1225 1st Ave, Seattle, WA');
INSERT INTO `markers` (`name`, `address`) VALUES ('Sake House', '2230 1st Ave, Seattle, WA',);
INSERT INTO `markers` (`name`, `address`) VALUES ('Crab Pot', '1301 Alaskan Way, Seattle, WA');
INSERT INTO `markers` (`name`, `address`) VALUES ('Mama\'s Mexican Kitchen', '2234 2nd Ave, Seattle, WA');
INSERT INTO `markers` (`name`, `address`) VALUES ('Wingdome', '1416 E Olive Way, Seattle, WA');
INSERT INTO `markers` (`name`, `address`) VALUES ('Piroshky Piroshky', '1908 Pike pl, Seattle, WA');
2. Create xml.php
<?php
mysql_connect("localhost", "arturito", "arturito") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
$query = "SELECT * FROM markers";
$result = mysql_query($query) or die(mysql_error());
$doc = new DomDocument('1.0');
$node = $doc->createElement("markers");
$parnode = $doc->appendChild($node);
header("Content-type: text/xml");
while($row = mysql_fetch_array($result))
{
$node = $doc->createElement("marker");
$newnode = $parnode->appendChild($node);
$newnode->setAttribute("name", $row['name']);
$newnode->setAttribute("address", $row['address']);
}
print $doc->saveXML();
?>
3. Create index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Index</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=here_we_enter_google_api_key" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map = null;
var geocoder = null;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
geocoder = new GClientGeocoder();
// Here enter your url of ashx file
GDownloadUrl("http://localhost/xml.php", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
showAddress(address,name);
}
});
}
}
function showAddress(address, name) {
if (geocoder) {
geocoder.getLatLng(
name+","+address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = createMarker(point, name, address);
map.addOverlay(marker);
}
});
}
}
function createMarker(point, name, address) {
var marker = new GMarker(point);
var html = "<b>" + name + "</b> <br/>" + address;
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div>
<div id="map" style="width: 1000px; height: 600px"></div>
</div>
</body>
</html>
And that’s it! Good Luck!
http://arturito.net/phpmaps/
Download sample:
http://arturito.net/downloads/phpmaps.zip
Using Google Maps API to mark multiple addresses fetched from database ASP.NET MVC2 and Geocoder
This tutorial will cover marking multiple addresses stored in database on Google Maps. For example this can be useful for marking chain of shops or restaurants or others.
The idea is to get something like this:

Before starting it we have to obtain a key for using their API.
You can do it here:
http://code.google.com/apis/maps/signup.html
Generate your key and save it
1. Create new Empty MVC2 project
2. Insert new .ashx file call it Maps.ashx.
I placed mine the folder Services which I created before.

3. Insert this code
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Maps : IHttpHandler {
public void ProcessRequest(HttpContext context) {
context.Response.ContentType = "text/xml";
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
string sXml = createMarkers();
context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(600));
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.Write(sXml);
}
public bool IsReusable {
get { return true; }
}
private string createMarkers() {
// Create the xml document container
XmlDocument doc = new XmlDocument();//
Create the XML Declaration, and append it to XML document
XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", null, null);
doc.AppendChild(dec);// Create the root element
XmlElement root = doc.CreateElement("markers");
doc.AppendChild(root);
// Here you can create a loop and fetching data from database like
/* while(rdr.Read()) {
XmlElement marker = doc.CreateElement("marker");
marker.SetAttribute("name", rdr["name"].ToString());
marker.SetAttribute("address", rdr["address"].ToString());
root.AppendChild(marker);
}
*/
// To retrieve data using a C# go here:
// http://www.akadia.com/services/dotnet_data_reader.html
// We will enter it manually
XmlElement marker = doc.CreateElement("marker");
marker.SetAttribute("name", "L'arruzz");
marker.SetAttribute("address", "C/ PORTUGAL, 35, 03003 ALICANTE");
root.AppendChild(marker);
XmlElement marker2 = doc.CreateElement("marker");
marker2.SetAttribute("name", "CERVECERIA VICTOR");
marker2.SetAttribute("address", "C/ SAN AGATÁNGELO, 37, 03007 ALICANTE");
root.AppendChild(marker2);
return doc.OuterXml;
}
}
4. Next step is to create HomeController and create Index View.
public ActionResult Index()
{ return View();
}
5. Now run your project and check if xml is being genrated by go to url of ashx file:
http://localhost:your_port_number/Services/Maps.ashx
For example in my case:http://localhost:1951/Services/Maps.ashx

6. Go back your HomeController and right click and create Index View. Your code should be the same as below:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Index</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=here_we_enter_google_api_key" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map = null;
var geocoder = null;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
geocoder = new GClientGeocoder();
// Here enter your url of ashx file
GDownloadUrl("http://localhost:1951/Services/Maps.ashx", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
showAddress(address,name);
}
});
}
}
function showAddress(address, name) {
if (geocoder) {
geocoder.getLatLng(
name+","+address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = createMarker(point, name, address);
map.addOverlay(marker);
}
});
}
}
function createMarker(point, name, address) {
var marker = new GMarker(point);
var html = "<b>" + name + "</b> <br/>" + address;
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div>
<div id="map" style="width: 1000px; height: 600px"></div>
</div>
</body>
</html>
Run it and there we go!

You can also do it without ashx and return xml as an ActionResult
public ActionResult PrintMarkers() {
XmlDocument doc = new XmlDocument();//
Create the XML Declaration, and append it to XML document
XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", null, null);
doc.AppendChild(dec);// Create the root element
XmlElement root = doc.CreateElement("markers");
doc.AppendChild(root);
XmlElement marker = doc.CreateElement("marker");
marker.SetAttribute("name", "L'arruzz");
marker.SetAttribute("address", "C/ PORTUGAL, 35, 03003 ALICANTE");
root.AppendChild(marker);
XmlElement marker2 = doc.CreateElement("marker");
marker2.SetAttribute("name", "CERVECERIA VICTOR");
marker2.SetAttribute("address", "C/ SAN AGATÁNGELO, 37, 03007 ALICANTE");
root.AppendChild(marker2);
return doc.OuterXml;
}
And simply call it from script of JavaScript:
GDownloadUrl("http://localhost:1951/Home/PrintMarkers/", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
showAddress(address,name);
}
});
Will do the same.
Good luck!