You could use jQuery to dynamically update the mapping

function drawMap() {
 // remove image overlays used during transition
 $('.nivo-slice, .nivo-box').remove();
 var current_title = $('.nivoSlider').data('nivo:vars').currentImage.attr('title'); 
// set usemap attribute for current image
 $('.nivo-main-image').attr("useMap", current_title + "_map"); }

 

Then just call that function after load and after each transition

$('.nivoSlider').nivoSlider({
 // slider config
 afterLoad: drawMap,
 afterChange: drawMap
));
Advertisements

2013 in review

Posted: January 1, 2014 in Asp.net

The WordPress.com stats helper monkeys prepared a 2013 annual report for this blog.

Here’s an excerpt:

A San Francisco cable car holds 60 people. This blog was viewed about 900 times in 2013. If it were a cable car, it would take about 15 trips to carry that many people.

Click here to see the complete report.


To select one radio button at a time in datalist, please follow below steps

Step 1: Write this Past below JavaScript in the aspx source code 

<script type=”text/javascript” language=”javascript”>
function CheckOnes(spanChk)
{
var oItem = spanChk.children;
var theBox= (spanChk.type==”radio”) ? spanChk : spanChk.children.item[0];

xState=theBox.unchecked;
elm=theBox.form.elements;

for(i=0;i<elm.length;i++)
if(elm[i].type==”radio” && elm[i].id!=theBox.id)
{
elm[i].checked=xState;
}
}
</script>

Step 2: Now data list as

<asp:DataList ID=”dlExample” runat=”server” RepeatDirection=”Vertical” RepeatColumns=”4″ OnItemDataBound=”dlExample_ItemDataBound” >
<ItemTemplate>
<table> <tr> <td> <asp:RadioButton ID=”rdb” runat=”server” /> </td> </tr> </table>
</ItemTemplate>
</asp:DataList>

Step 3: In code behind

protected void dlExample_ItemDataBound(object sender, DataListItemEventArgs e)
{
RadioButton rdb;
rdb = (RadioButton)e.Item.FindControl(“rdb”);
if(rdb != null)
rdb.Attributes.Add(“onclick”, “CheckOnes(this);”);
}


Passing few query string parameters can land the user on the Google Maps Page with Driving Directions.

Examples:

1) https://maps.google.com/maps?f=d&saddr=New%20Ringgold,%20PA,%20USA&daddr=Allentown,%20PA,%20USA

2) https://maps.google.com/maps?f=d&saddr=17960&daddr=17980

f: stands for “form” and controls the style of query form to be displayed.

f=d: Displays the “directions” form (two input boxes: from, to).

saddr: “saddr” source address. Use this when asking for driving directions.

daddr: “daddr” Destination address(es). Use this when asking for driving directions.

More detailed article on the Google Maps Query Strings:

http://asnsblues.blogspot.in/2011/11/google-maps-query-string-parameters.html

Class vs Object vs Instance

Posted: September 6, 2013 in c#
Tags: , ,

In OO Programming, we often hear of terms like “Class”, “Object” and “Instance”;

but what actually is a Class / Object / Instance?

In short,

An object is a software bundle of related state and behavior.

A class is a blueprint or prototype from which objects are created.

An instance is a single and unique unit of a class.

Example, we have a blueprint (class) represents student (object) with fields like name, age, course (class member). And we have

2 students here, Foo and Bob. So, Foo and Bob is 2 different instances of the class

(Student class) that represent object (Student people).

Let me go into details…

Object

Real world objects shares 2 main characteristics, state

and behavior. Human have state (name, age) and behavior (running, sleeping).

Car have state (current speed, current gear) and state (applying brake, changing

gear). Software objects are conceptually similar to real-world objects: they too

consist of state and related behavior. An object stores its state in fields

and exposes its behavior through methods.

Class

Class is a “template” / “blueprint” that is used to create objects. Basically,

a class will consists of field, static field, method, static method and constructor.

Field is used to hold the state of the class (eg: name of Student object). Method

is used to represent the behavior of the class (eg: how a Student object going to

stand-up). Constructor is used to create a new Instance of the Class.

Instance

An instance is a unique copy of a Class that representing an Object. When a new

instance of a class is created, the JVM will allocate a room of memory for that

class instance.


I came across this problem over the holiday period. The full error was:

Warning    4    Custom tool warning: Cannot import wsdl:portType

Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='Ixxxxx']    C:\projects\Tyrannt RPG\Tyrannt\Tyrannt.Client.Web\Service References\CodexUpdateServiceReference\Reference.svcmap    1    1    Tyrannt.Client.Web

After doing a bit of searching I found the way to fix it was to remove the Newtonsoft.Json.Linq.JToken from the “Resue Types”:

Right click the service reference…

Service Reference

Select the Reuse Types in Selected References option and tick all the boxes except the Newtonsoft.Json package.

This was the blogpost that helped me solve it “Type ‘Newtonsoft.Json.Linq.JToken’ is a recursive collection data contract” While Adding Service Reference in VS2012


This content is password protected. To view it please enter your password below: