<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Marco Sessa</title>
	<atom:link href="http://marcosessa.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://marcosessa.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sat, 18 Nov 2006 10:12:01 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language></language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='marcosessa.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/8a753b60870e70413e53efd28ed03c10?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Marco Sessa</title>
		<link>http://marcosessa.wordpress.com</link>
	</image>
			<item>
		<title>Using the Yahoo! Maps Flash API</title>
		<link>http://marcosessa.wordpress.com/2006/08/29/using-the-yahoo-maps-flash-api/</link>
		<comments>http://marcosessa.wordpress.com/2006/08/29/using-the-yahoo-maps-flash-api/#comments</comments>
		<pubDate>Tue, 29 Aug 2006 11:30:10 +0000</pubDate>
		<dc:creator>marcosessa</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">https://marcosessa.wordpress.com/2006/08/29/using-the-yahoo-maps-flash-api/</guid>
		<description><![CDATA[With the release of Yahoo! Maps beta, an ActionScript and Flex-based map application, Yahoo! also released the Maps beta API. This API is designed to give you the unique opportunity of integrating much of the enhanced functionality and precise map data into your own Macromedia Flash applications.
The Yahoo! Maps API is distributed as a Flash [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=17&subd=marcosessa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>With the release of Yahoo! Maps beta, an ActionScript and Flex-based map application, Yahoo! also released the Maps beta API. This API is designed to give you the unique opportunity of integrating much of the enhanced functionality and precise map data into your own Macromedia Flash applications.</p>
<p>The Yahoo! Maps API is distributed as a Flash component, packaged to integrate easily into your own code. Because Yahoo! serves up the mapping data, there are no server requirements on your part other than snapping in the simple component. Once I walk you through the quick component installation (same as any MXP packaged V2 component), I&#8217;ll review with you several copy-and-paste code examples. Within minutes, you&#8217;ll be building a map-based application that allows your users to pan, zoom, and even search and display listings from the Yahoo! Local Search.</p>
<p>The best part is that, thanks to the inventory of simple API calls, adding each of these great features requires no more than a simple understanding of a few lines of code. The sky&#8217;s the limit—and you have over a dozen zoom levels to explore it.</p>
<h3>Requirements</h3>
<p>In order to make the most of this article, you need the following software and files:</p>
<h4>Macromedia Flash 8</h4>
<ul class="link-list compact">
<li class="icon download"><a href="http://www.adobe.com/go/devcenter_fl_try">Try</a></li>
<li class="icon buy"><a href="http://www.adobe.com/go/devcenter_fl_buy">Buy</a></li>
</ul>
<p class="note"><strong>Note:</strong> You can also use Macromedia Flash MX 2004.</p>
<ul class="link-list compact">
<li class="icon download"><a href="http://developer.yahoo.com/maps/flash/componentEULA.html" target="_blank">Yahoo! Maps MXP</a> (Macromedia eXtensions Package file)</li>
</ul>
<p>You need an <a href="http://api.search.yahoo.com/webservices/register_application">application ID</a> to use the AS-Flash API  (Yahoo! login required).</p>
<h4>Notes about the sample code in this article:</h4>
<ul>
<li>Throughout this article, I will continue to mention the very comprehensive <a href="http://developer.yahoo.com/maps/flash/V3/flashReference.html" target="_blank">Reference Manual for the Yahoo! Maps Flash APIs</a>. The Yahoo! Developer Network has put together a great launch pad to get you started with the Maps component.</li>
<li>The examples in the article are full copy-and-paste code excerpts. While I encourage you to add your own elements, I wanted to provide you with as much of a head start as possible.</li>
<li>To implement all the code examples, you can simply add them to the first frame of your FLA file. It is good practice to create separate layers for the component and the ActionScript.</li>
<li>If you are using an IDE such as Eclipse, PrimalScript, or SEPY, you can drop the code in your AS script or class files to work with your application.</li>
<li>Start each section with a new FLA file. This is how I wrote each example and it helps to have a clean slate to understand the unique functionality being presented.</li>
</ul>
<h3>The basics: The YahooMap component</h3>
<p>Let&#8217;s start at the beginning.</p>
<h4>Install the component:</h4>
<ol>
<li>Download the <a href="http://developer.yahoo.com/maps/flash/componentEULA.html" target="_blank">Yahoo! Maps MXP</a>.</li>
<li>Double-click the MXP to launch the Macromedia Extension Manager. You may need to <a href="http://www.adobe.com/exchange/em_download/">download the latest extension manager</a>. After accepting the installation terms and clicking OK, the API will be fully installed.</li>
<li>Obtain an <a href="http://api.search.yahoo.com/webservices/register_application" target="_blank">application ID</a> from the Yahoo! Developer Network.</li>
<li>Launch the Flash application (Flash MX 2004 or later) and expand the Components window (Control + F7). You should see the YahooMap component listed in the Components panel.</li>
</ol>
<h4>Set the stage:</h4>
<ol>
<li>Create a new Flash file.</li>
<li>Drag the YahooMap component to your Stage and keep it selected.</li>
<li>In the Properties panel, with the YahooMap component on the Stage selected, name the instance of the YahooMap component <strong>myMap</strong>. (All the code excerpts in this article refer to the map instance as &#8220;myMap&#8221;.)</li>
<li>Resize the component to 500 x 400 pixels, either in the Properties panel or by using the Free Transform Tool (Q).</li>
<li>Back in the Properties panel, select the Parameters tab. Enter the AppID you registered with the Yahoo! Developer Network.</li>
</ol>
<h4>See the world:</h4>
<ol>
<li>Compile the FLA file (Control + Enter).</li>
<li>Continue to read and explore this article and learn how you can change the world that you have created with the Yahoo! Maps API.</li>
</ol>
<h3>Tools and widgets: Controlling the map</h3>
<p>Tools are a set of behaviors you can add to the map to give your users more control over the displayed content. Panning is probably the most frequent user action when it comes to maps interaction. Importing the PanTool class and creating an instance of it once the map initializes lets your users click and drag the map in all directions. The panning class adds click and double-click capabilities, which center the map on a certain point and zoom in on a specific point, respectively:</p>
<p class="preWrapper">
<pre>import com.yahoo.maps.tools.PanTool;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INITIALIZE, onInitMap);
function onInitMap(eventData) {
     var panTool = new PanTool();
     myMap.addTool(panTool, true);
}</pre>
<p class="note">Reminder: Start each section with a new FLA file. This is how I wrote each example in this tutorial. It helps to have a clean slate to understand the unique functionality being presented for each section.</p>
<p>The NavigatorWidget is a very sleek interface, combining the essential zoom bar with the super &#8220;minimap&#8221; navigation tool. The minimap replicates the very large map data and scales it into a much smaller window. The minimap provides precision navigation of the big map, like a voodoo doll.</p>
<p>In the center of the minimap is a draggable box (some call it the &#8220;hockey puck&#8221;). When a user drags the box up, the larger map pans up too, and so on. The box in the center of the minimap also scales to the displayed proportions of the component as a whole. This widget appears in the top right of the map:</p>
<p class="preWrapper">
<pre>import com.yahoo.maps.widgets.NavigatorWidget;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INITIALIZE, onInitMap);
function onInitMap(eventData) {
     var navWidget = new NavigatorWidget("open");
     myMap.addWidget(navWidget);
}</pre>
<p>The NavigatorWidget has two states, open and closed, which you can controll by passing the initial state when creating the instance. When it&#8217;s closed, the Navigator shows only the vertical zoom bar. Even when it&#8217;s open, the user can still close the Navigator by clicking the little white arrow (see Figure 1). The sleek widget, in Flash fashion, animates between states.</p>
<p><img src="http://www.adobe.com/devnet/flash/articles/yahoo_mashup/fig01.gif" alt="NavigatorWidget with the minimap that a user can use to zoom in on a region" class="image-border" border="0" height="296" width="501" /></p>
<p class="caption"><strong>Figure 1.</strong>  NavigatorWidget with the minimap that a user can use to zoom in on a region</p>
<p>While I will go into more detail on changing the map view in the next set of examples, adding the SatelliteControlWidget is a quick way of providing your users with a cool way to toggle the map view. The SatelliteControlWidget consists of three buttons (one for each map view type) and displays in the top-left corner of your map.</p>
<p>This example shows that you can create an instance of a widget without saving it to a variable. This saves a line of code, but will make it harder to call methods on this widget. Unlike the Navigator, the Satellite Control has no open/closed states:</p>
<p class="preWrapper">
<pre>import com.yahoo.maps.widgets.SatelliteControlWidget;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INITIALIZE, onInitMap);
     function onInitMap(eventData) {
     myMap.addWidget(new SatelliteControlWidget());
}</pre>
<h3>Map views: Changing to satellite and hybrid</h3>
<p>The API lets you work with satellite and hybrid tiles, in addition to the default map tiles. I&#8217;m going to show you three simple ways to display and let your users choose the different kinds of map views to display with the component in your application.</p>
<p>You can set the default map view type when the component first loads. On the Stage, select the component and then look in the Parameter tab to select the map view type. The component collects this parameter when it first is created, providing the best experience for the user.</p>
<p>To set the map view type programmatically, use the <code>setMapViewType</code> method. Note that the map loads first with the default type and then redraws upon initializing, with the new map view type:</p>
<p class="preWrapper">
<pre>import com.yahoo.maps.MapViews;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INITIALIZE, onInitMap);
function onInitMap(eventData) {
     myMap.setMapViewType(MapViews.SATELLITE); //for Hybrid use MapViews.HYBRID
}</pre>
<p>The API gives you some options for changing the map view type outside the component. By using getMapViewTypes, you get an array (&#8220;map&#8221;, &#8220;hybrid&#8221;, &#8220;satellite&#8221;).</p>
<p>The following example shows how you can build your own set of map view buttons, a custom alternative to the <code>SatelliteControlWidget</code> that I discussed previously, using <code>getMapViewTypes()</code>. Creating or attaching your own buttons, particularly outside the map, lets you control the map with user interface elements consistent with your application. While the <code>SatelliteControlWidget</code> buttons are rather small and tightly designed, putting buttons alongside the map will open up your map area a bit more.</p>
<p>After the map initializes, <code>getMapViewTypes()</code> can be called, giving you the array of all map view types available. Loop through this array and call the <code>makeButton</code> function, passing the iteration value and map view type value:</p>
<p class="preWrapper">
<pre>myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INITIALIZE, onInitMap);
function onInitMap(eventData) {
    var mapViews:Array = myMap.getMapViewTypes();
    for (var i=0;i&lt; mapViews.length;i++) {
        makeButton(i, mapViews[i]);
    }
}</pre>
<p>This is where you can attach or create buttons. Coding a function like the <code>makeButton</code> function lets you create some simple, lightweight buttons (see Figure 2). By incrementing the <em>y</em> or <em>x</em> values, you can manage the placement of the buttons either vertically or horizontally. Be sure to set the variable for your <em>y</em>/<em>x</em> value outside the function.</p>
<p><img src="http://www.adobe.com/devnet/flash/articles/yahoo_mashup/fig02.gif" alt="Adding buttons to the map" class="image-border" border="0" height="296" width="501" /></p>
<p class="caption"><strong>Figure 2.</strong>  Adding buttons to the map</p>
<p>In this example, I use the <code>_buttonX</code> variable to lay out the buttons across the top of the application. Within the <code>onPress</code> function, you call the <code>setMapViewType</code> with the label value. This changes the map view when the user clicks each button. You can also use a simple conditional to track the state of the buttons. To do this, you will need to use another method, <code>getCurrentMapViewType</code>. The text in the button will be bold when it represents the active map type:</p>
<p class="preWrapper">
<pre>var _buttonX:Number = 0;
var _selButton;
function makeButton(i:Number, mapView:String) {
    var buttonBase:MovieClip = this.createEmptyMovieClip("buttonBase"+I, i);
    buttonBase._x = _buttonX;
    buttonBase.moveTo(0, 0);
    buttonBase.lineStyle(1, 0x000000, 100);
    buttonBase.beginFill(0x999999, 100);
    buttonBase.lineTo(100, 0);
    buttonBase.lineTo(100, 22);
    buttonBase.lineTo(0, 22);
    buttonBase.lineTo(0, 0);
    var buttonLabel:TextField = buttonBase.createTextField("buttonLabel", 1, 0, 0, 100, 22);
    buttonLabel.id = mapView;
    buttonLabel.html = true;
    buttonLabel.selectable = false;

if (mapView == myMap.getCurrentMapViewType()) {
        buttonLabel.htmlText = "&lt;b&gt;" + mapView + "&lt;/b&gt;";
        _selButton = buttonLabel;
    } else {
        buttonLabel.htmlText = mapView;
    }

buttonBase.onPress = function () {
        this._parent.myMap.setMapViewType(buttonLabel.text);
        _selButton.text = _selButton.id;
        buttonLabel.htmlText = "&lt;b&gt;" + buttonLabel.text + "&lt;/b&gt;";
        _selButton = buttonLabel;
    }

_buttonX+=120;
}</pre>
<p>Explore the <a href="http://developer.yahoo.com/maps/flash/V3/flashReference.html" target="_blank">Reference Manual for the Yahoo! Maps Flash APIs</a> to find out how you can use your own buttons to control many other aspects of the map.</p>
<h3>Overlays: The Local search feature</h3>
<p>Think of overlays as potential weather systems on top of the map. Essentially, they are a container for managing multiple markers and movie clips on top of the map, within a single layer. Overlays manage data independent of the core map. Once they&#8217;re initialized, you can turn them on and off programmatically.</p>
<p>Adding the <code>LocalSearchOverlay</code> to your map and application gives your users a gateway in the powerful Yahoo! Local database and services. After the map initializes, create a new instance of the <code>LocalSearchOverlay</code>. I suggest saving the overlay instance to a global variable. This makes the overlay instance available to other functions in subsequent examples. Use <code>addOverlay</code> to add the overlay instance to the map.</p>
<p>When working with markers, it is good to let the user pan, so I suggest adding the PanTool. And because this is local content, set Chicago as the default city, using <code>setCenterByAddress()</code>. Finally, use <code>makeLocalSearch()</code> to build the form elements, allowing users to enter their own local search criteria:</p>
<p class="preWrapper">
<pre>var _localSearch;
import com.yahoo.maps.overlays.LocalSearchOverlay;
import com.yahoo.maps.tools.PanTool;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INITIALIZE, onInitMap);
function onInitMap(eventData) {
    _localSearch = new LocalSearchOverlay();
    myMap.addOverlay(_localSearch);
    var panTool = new PanTool();
    myMap.addTool(panTool, true);
    myMap.setCenterByAddress("Chicago");
    makeLocalSearch();
}</pre>
<p>This simple <code>makeLocalSearch</code> function builds a text input field and button. As I mentioned previously, when you build satellite buttons, you can use your attach components or your own graphic elements:</p>
<p class="preWrapper">
<pre>var _searchInput:TextField;
function makeLocalSearch() {

var inputBase:MovieClip = this.createEmptyMovieClip("inputBase", 1);
    inputBase._x = 0;
    inputBase.width = 100;
    inputBase.height = 22;
    _searchInput = inputBase.createTextField("searchInput", 1, 0, 0, 100, 22);
    _searchInput.border = true;
    _searchInput.background = true;
    _searchInput.selectable = true;
    _searchInput.type = "input";
    _searchInput.text = "Pizza";

var searchButton:MovieClip = this.createEmptyMovieClip("searchButton", 2);
    searchButton._x = 120;
    searchButton.moveTo(0, 0);
    searchButton.lineStyle(1, 0x000000, 100);
    searchButton.beginFill(0x999999, 100);
    searchButton.lineTo(100, 0);
    searchButton.lineTo(100, 22);
    searchButton.lineTo(0, 22);
    searchButton.lineTo(0, 0);
    var searchLabel:TextField = searchButton.createTextField("searchButton", 1, 0, 0, 100, 22);
    searchLabel.selectable = false;
    searchLabel.text = "Search";

searchButton.onPress = function () {
        this._parent.searchLocal();
    }
}</pre>
<p>One more effect I will add is an event that zooms in on the map once the address above it resolves itself. When working with local content, the closer you get, the more relevant your search results will appear:</p>
<p class="preWrapper">
<pre>myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_MAP_GEOCODE_SUCCESS, onMapMove);
function onMapMove(eventData) {
    myMap.setZoomLevel(5);
}</pre>
<p>The <code>LocalSearchOverlay</code> uses the <code>search</code> method to query the local database. Searching the Yahoo! Local database—in this case with hard-coded search criteria—the returned data is represented with attached markers within the overlay.</p>
<p>These markers represent local listings, complete with addresses, ratings data, and a More Info link to Yahoo! Locals, giving your users a splendid resource and adding depth to the area being displayed in your map (see Figure 3). Your application will call <code>searchLocal():</code> when the map finishes zooming and, more importantly, each time your user clicks the Submit button.</p>
<p><img src="http://www.adobe.com/devnet/flash/articles/yahoo_mashup/fig03.gif" alt="Map with Yahoo! Local content, featuring address and rating data within a marker." class="image-border" border="0" height="296" width="501" /></p>
<p class="caption"><strong>Figure 3.</strong>  Map with Yahoo! Local content, featuring address and rating data within a marker.</p>
<p>On first pass, I need to plug in a variable. Because I&#8217;m using Chicago as a location, my default search criteria is none other than &#8220;Pizza&#8221;:</p>
<p class="preWrapper">
<pre>myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_ZOOM_STOP, searchLocal);
function searchLocal(eventData) {
    var searchVar:String = "";
    if (_searchInput.text == undefined) {
        searchVar = "Pizza";
    } else {
        searchVar = _searchInput.text;
    }
    _localSearch.search(searchVar, this._parent.myMap.getCenter(), 1, 10);
}</pre>
<p>Find out more details on <code>LocalSearchOverlay</code> and its methods in the <a href="http://developer.yahoo.com/maps/flash/V3/flashReference.html" target="_blank">Reference Manual for the Yahoo! Maps Flash APIs</a>.</p>
<h3>Geocoding: Converting an address to latitude/longitude</h3>
<p>Geocoding is at the heart of map data. It&#8217;s the &#8220;flux capacitor&#8221; of the maps machine. Whether they are built in Flash or Ajax, all map applications use some form of geocoding to resolve coordinates around the world and offer several key map functionalities, such as locating an address, calculating driving directions, and displaying traffic use geocoding.</p>
<p>In our Flash maps, we take the coordinates (latitude and longitude, or what we call &#8220;latlon&#8221;) and convert them into points (<em>x</em> and <em>y</em>) in the application. When determining where a user has panned or zoomed to in the application, we reverse the process going from points to latlon.</p>
<p>In this final exercise, I show you how to resolve the latlon based on the center point of your map. You might find this technique useful when creating your own mashup. If you are setting out to plot points on your map—adding markers and such—you will likely create your own RSS (called geoRSS for maps points), XML, or database to store those points.</p>
<p>Storing latlon coordinates can be much more efficient and provide better performance than storing and processing address strings. Another benefit is that by passing a latlon instead of an address string to a method, you have more options for controlling the map programmatically.</p>
<p>First, import the <code>LatLon</code> class, which will let you convert the points to a latlon object. To get the initial map center coordinates, use <code>getCenter()</code> when the map first initializes:</p>
<p class="preWrapper">
<pre>import com.yahoo.maps.LatLon;
import com.yahoo.maps.tools.PanTool;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INITIALIZE, onInitMap);
function onInitMap(eventData) {
    var pantool = new PanTool();
    myMap.addTool(pantool, true);
    var points = myMap.getCenter();
    convert(points);
}</pre>
<p>Using your preferred debugging method (such as the <code>trace()</code>, for instance), display the values returned by the <code>getCenter()</code> method. This method returns points, values that are in reverse order of latitude and longitude. In other words, and this can be tricky, x and y represent the horizontal and vertical location of the point, while latitude and longitude represent the opposite: Latitude is the vertical location and longitude is the horizontal location.</p>
<p>As I mentioned earlier, there are several other events fired based on map interaction and movement. Adding the <code>EVENT_MOVE</code> listener to the map will ultimately let you call <code>getCenter()</code> each time the user moves the map.</p>
<p class="preWrapper">
<pre>myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_MOVE, onMapMove);
function onMapMove() {
    var points = myMap.getCenter();
    convert(points);
}</pre>
<p>Finally, taking the object returned by <code>getCenter()</code> and creating a new <code>LatLon</code> object with it will convert those points into latitude and longitude. Remember, you need to switch the values to get the right point. The best way to do this is by getting the latitude and longitude properties, &#8220;lat&#8221; and &#8220;lon&#8221; respectively. Adding the <code>trace()</code> method should display your latitude/longitude in the output window.</p>
<p class="preWrapper">
<pre>var _latlon:Object;
function convert(points:Object) {
	_latlon = new LatLon(points.lat, points.lon);
	trace(_latlon);
}</pre>
<p>You can find more methods you can call with a latlon value in the <a href="http://developer.yahoo.com/maps/flash/V3/flashReference.html" target="_blank">Reference Manual for the Yahoo! Maps Flash APIs</a>.</p>
<h3>Where to go from here</h3>
<p>I hope these code examples give you a great start in developing your own maps mashup. Be sure to visit the Yahoo! Developer Network&#8217;s excellent coverage and examples of the <a href="http://developer.yahoo.com/maps/" target="_blank">Yahoo! Maps APIs</a>.</p>
<h3>Acknowledgements</h3>
<p>Special thanks to <strong>Zach Graves</strong>, who lent his expertise as a technical reviewer for this article.</p>
<p><!-- InstanceEndEditable --></p>
<h3>About the author</h3>
<p class="bio">
<address>Charles (Chuck) Freedman is a senior Flash developer for Yahoo! Maps, where he leads development for both the consumer and API versions of the Flex-based Maps application. With a Communications degree in Film and Television from Boston University, Chuck combines his education in multimedia with expertise in content management, server-side scripting, and database and interactive design. Recently he has produced some of the most highly visible dynamic Flash content, developing modules for the home pages of eBay, eBay China, and Fidelity. Visit his website at <a href="http://www.chuckstar.com/" target="_blank">chuckstar.com</a>. Born in Boston, Chuck relocated with his wife Jamie to sunny Santa Clara, Calif., to join Yahoo! in 2005. Still a season ticket holder, he is planning many trips back east to see his beloved Red Sox win another World Series.</p>
</address>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/marcosessa.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/marcosessa.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marcosessa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marcosessa.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marcosessa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marcosessa.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marcosessa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marcosessa.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marcosessa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marcosessa.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marcosessa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marcosessa.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=17&subd=marcosessa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marcosessa.wordpress.com/2006/08/29/using-the-yahoo-maps-flash-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfc7b43fe04a77105308779c3f23f61a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">marcosessa</media:title>
		</media:content>

		<media:content url="http://www.adobe.com/devnet/flash/articles/yahoo_mashup/fig01.gif" medium="image">
			<media:title type="html">NavigatorWidget with the minimap that a user can use to zoom in on a region</media:title>
		</media:content>

		<media:content url="http://www.adobe.com/devnet/flash/articles/yahoo_mashup/fig02.gif" medium="image">
			<media:title type="html">Adding buttons to the map</media:title>
		</media:content>

		<media:content url="http://www.adobe.com/devnet/flash/articles/yahoo_mashup/fig03.gif" medium="image">
			<media:title type="html">Map with Yahoo! Local content, featuring address and rating data within a marker.</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows XP Explorer menus (only info)</title>
		<link>http://marcosessa.wordpress.com/2006/08/29/windows-xp-explorer-menus-only-info/</link>
		<comments>http://marcosessa.wordpress.com/2006/08/29/windows-xp-explorer-menus-only-info/#comments</comments>
		<pubDate>Tue, 29 Aug 2006 10:43:00 +0000</pubDate>
		<dc:creator>marcosessa</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://marcosessa.wordpress.com/2006/08/29/windows-xp-explorer-menus-only-info/</guid>
		<description><![CDATA[&#160;
&#160;
http://www.dynarch.com/products/navbar/
As you could have figured out already, Dynarch NavBar is very         close to the all-so-known Windows XP Explorer menus.  The         missing part was a CSS file that defines a similar look.        [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=16&subd=marcosessa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://www.dynarch.com/products/navbar/">http://www.dynarch.com/products/navbar/</a></p>
<p>As you could have figured out already, Dynarch NavBar is very         close to the all-so-known Windows XP Explorer menus.  The         missing part was a CSS file that defines a similar look.         Well, there you have it! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>In order to make your NavBar look like WinXP menus, just load         the <tt>/navbar/themes/winxp/skin.css</tt> skin, and set         <tt>_NavBar_icons_url = "/navbar/themes/winxp/"</tt>.  View         the source of this page for more details.</p>
<p>You can read more information about <a href="http://www.dynarch.com/demos/NavBar/doc-skins.html">CSS files</a> and <a href="http://www.dynarch.com/demos/NavBar/doc-icons.html">custom icons</a> in the NavBar         documentation.</p>
<h2>JavaScript actions</h2>
<p>As of version 2.5, NavBar supports custom JavaScript action         handlers for menu items in a very straightforward way.         Instead of passing an URL, just pass a reference to a         JavaScript function which is previously defined.  In order to         pass a custom argument to that function, put it in place of         the “target” attribute.  For example:</p>
<pre><span class="keyword">function</span> <span class="function-name">showDate</span>(param, item, section) {
    <span class="keyword">var</span> <span class="variable-name">menu</span> = section.parent;
    <span class="comment">// "menu" is a reference to the NavBar object
</span>    <span class="comment">// you can use it now i.e. to set preferences:
</span>    <span class="comment">// menu.setPref("auto-hide", true);
</span>
    <span class="comment">// but let's show the date:
</span>    alert(<span class="keyword">new</span> Date() + <span class="string">"\nPassed argument is: "</span> + param);
}
<span class="keyword">var</span> <span class="variable-name">menu</span> = <span class="keyword">new</span> NavBar(...);
<span class="keyword">new</span> NavSection(menu, <span class="string">"Section label"</span>, [
   [ <span class="string">"Show date"</span>, showDate, <span class="string">"tooltip"</span>, <span class="string">"icon.gif"</span>, <span class="string">"custom argument"</span> ]
]);</pre>
<p>The above code creates an item that will call our custom         function “showDate” when clicked.  The function receives 3         arguments.  Beware that the first one may be undefined if you         don&#8217;t pass it.  In the code above though we pass it and its         value is “custom argument”.  The other two arguments are         “item” &#8212; a referenece to the TR element that holds the item         elements, and “section” &#8212; a reference to the NavSection         object that this item belongs to.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/marcosessa.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/marcosessa.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marcosessa.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marcosessa.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marcosessa.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marcosessa.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marcosessa.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marcosessa.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marcosessa.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marcosessa.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marcosessa.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marcosessa.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=16&subd=marcosessa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marcosessa.wordpress.com/2006/08/29/windows-xp-explorer-menus-only-info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfc7b43fe04a77105308779c3f23f61a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">marcosessa</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the AJAX Map Viewer Component</title>
		<link>http://marcosessa.wordpress.com/2006/08/29/using-the-ajax-map-viewer-component/</link>
		<comments>http://marcosessa.wordpress.com/2006/08/29/using-the-ajax-map-viewer-component/#comments</comments>
		<pubDate>Tue, 29 Aug 2006 10:22:54 +0000</pubDate>
		<dc:creator>marcosessa</dc:creator>
				<category><![CDATA[AJAX]]></category>

		<guid isPermaLink="false">https://marcosessa.wordpress.com/2006/08/29/using-the-ajax-map-viewer-component/</guid>
		<description><![CDATA[
        





&#160;









   



This tutorial shows you how to use Sun Java Studio Creator&#8217;s Integrated Development Environment (IDE) to build a JavaServer Faces web application that uses the sample AJAX Map Viewer component. You import the Java BluePrints AJAX components into the IDE, then use Google&#8217;s free [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=14&subd=marcosessa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="pagetitle"><!-- BEGIN WRAPPER TABLE, 2 COLUMN, MAIN/RIGHT --></p>
<p><!-- BEGIN CENTRAL COLUMN COMPONENTS --><!--startindex--><!-- ============ --><!-- MAIN CONTENT --><!-- ============ -->      <a name="skip2content"></a>  <!--  BEGIN VCD4 BYLINE AND TOOLS  --></p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="smaller" valign="top"><em></em><span class="dkcaption1"></span></td>
<td width="10"></td>
<td align="right" valign="bottom">
<p class="sitelinks">&nbsp;</p>
</td>
</tr>
</table>
<p class="contentdivider">
<table class="grey4" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><img src="http://developers.sun.com/im/a.gif" alt=" " border="0" height="4" width="1" /></td>
</tr>
</table>
<p><!--  END VCD4 BYLINE AND TOOLS  -->   <!-- BEGIN VCD1 OVERVIEW COMPONENT  --></p>
<p class="padbottom10">
<table class="grey3" border="0" cellpadding="4" cellspacing="0" width="650">
<tr>
<td>This tutorial shows you how to use Sun Java Studio Creator&#8217;s Integrated Development Environment (IDE) to build a JavaServer Faces web application that uses the sample AJAX Map Viewer component. You import the Java BluePrints AJAX components into the IDE, then use Google&#8217;s free map service API to create a custom map. The map includes marker text and a flag that pinpoints an address entered by the user.</p>
<p>The sample Java BluePrints AJAX components are provided to help you learn about AJAX and to show how AJAX fits with the Java Studio Creator IDE. For an introduction to the AJAX technology, see <a href="http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/ajax_overview.html" target="_blank">AJAX and Sun Java Studio Creator 2.</a></td>
</tr>
</table>
<p><!-- END VCD1 OVERVIEW COMPONENT  --> <span class="sp10"> </span><br />
<!-- BEGIN VCD5 ANCHOR LINKS COMPONENT  --></p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top"><b>Contents</b></p>
<p><span class="sp2"> </span></p>
<table class="vatop" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="hyphen" width="10">-</td>
<td width="357"><a href="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer.html#01">Obtaining a Google Maps API  Key</a></td>
</tr>
<tr>
<td class="hyphen">-</td>
<td><a href="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer.html#02">Creating the AJAX Web Application</a></td>
</tr>
<tr>
<td class="hyphen">-</td>
<td><a href="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer.html#03">Adding a Map Coordinates Input Page</a></td>
</tr>
<tr>
<td class="hyphen">-</td>
<td><a href="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer.html#04">Adding a Map Marker</a></td>
</tr>
<tr>
<td class="hyphen">-</td>
<td><a href="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer.html#05">Adding a Map Marker Flag</a></td>
</tr>
<tr>
<td class="hyphen">-</td>
<td><a href="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer.html#06">Doing More With the AJAX Map Viewer Component</a></td>
</tr>
</table>
</td>
<td width="20"><img src="http://developers.sun.com/im/a.gif" alt="[spacer]" height="1" width="20" /></td>
<td align="right" valign="top"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/im/jsc2stamp.gif" alt="Content on this page applies to Sun Java Studio Creator 2" height="60" width="200" /></td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END VCD5 ANCHOR LINKS COMPONENT  -->  <a name="01"></a></p>
<h3>Obtaining a Google Maps API Key</h3>
<p><span class="sp10"> </span><br />
To use the Google map service APIs, you must first create a Google account if you do not already have one, log in, and obtain a map key. The Google map key is specific to your application and allows up to 50,000 page views each day. Both the Google account and map key are free.</p>
<ol>
<li>In your web browser, go to <a href="http://www.google.com/apis/maps/" target="_blank">http://www.google.com/apis/maps/</a>.
<p>The Google map key sign up page opens in your web browser.</li>
<li>Click  Sign up for a Google Maps API key.
<p>The Google map key license agreement page opens in your web browser.</li>
<li>Review, then accept the agreement and enter the URL for your web site.
<p>To find the URL for your web site, deploy an application and   look at the server name and port number. For example, <code>http://localhost:28080/</code>.</p>
<p>The URL that you specify must exactly match the one that you use to execute the application. You may use this same key for any application using the Google Maps API that you deploy to your local application server. If you reconfigure your server to use a port or you deploy to a different server, then you must obtain another key from Google.</li>
<li>Click Generate API Key.
<p>Google generates your map key.</li>
<li>Copy the map key and save it in a text file or other convenient location. You use the map key as you build the AJAX map viewer application.</li>
</ol>
<p><span class="sp10"> </span><br />
<a name="02"></a></p>
<h3>Creating the AJAX Web Application</h3>
<p><span class="sp10"> </span><br />
Now you create the first page of the application, which contains the Map Viewer component.</p>
<ol>
<li><a href="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaximportcomponents.html">Download and import the AJAX components</a> if you have not already done so.</li>
<li>Create a web application project and name it <code>AjaxMapViewer</code>.
<p>AjaxMapViewer&#8217;s initial page, Page1, opens in the Visual Designer.</li>
<li>In the Palette, expand the BluePrints AJAX Components node if it is not already expanded, then drag the Map Viewer component and drop it onto Page1.
<p>A map image appears on Page1 and the components <code>mapViewer1</code> and <code>mapViewer1_center</code> appear in the Outline window, similar to the following figure.</p>
<p><!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="601">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/mapviewer-graphic.gif" alt="Map Viewer Component" border="0" height="523" width="591" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 1</b>: Map Viewer Component </span></p>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END FIGURE COMPONENT --></li>
<li>In the Properties window, find the Map Viewer&#8217;s <code>key</code> property and enter the Google map key that you saved earlier, as shown in the the following figure.
<p><!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="425">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/mapkey-property.gif" alt="Map Key Property" border="0" height="179" width="415" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 2</b>: Map Key Property</span></p>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END FIGURE COMPONENT --></li>
<li>Build and run the application to see what you have so far. The AjaxMapViewer project opens in your web browser.
<p><!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="530">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/initial-map.gif" alt="Map Viewer Application, Take 1" border="0" height="372" width="520" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 3</b>: Map Viewer Application, Take 1</span></p>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END FIGURE COMPONENT --></li>
</ol>
<p><a name="03"></a></p>
<h3>Adding a Map Coordinates Input Page</h3>
<p><span class="sp10"> </span><br />
The <code>latitude</code> and <code>longitude</code> properties of the <code>mapViewer1_center</code> component determine the map location. In this section, you add a page that takes a text address as input and uses the AJAX Support Bean <code>Geocoding Service Object</code> component to convert the address into latitude and longitude coordinates. You add latitude and longitude properties to the Request Bean and use these properties to set the coordinates on the <code>mapViewer1_center</code> component.</p>
<p><span class="sp20"> </span><br />
<b>Designing the Map Coordinates Input Page</b></p>
<ol>
<li>In the Projects window, right-click AjaxMapViewer &gt; Web Pages  and choose New &gt; Page from the pop-up menu.</li>
<li>In the New Page dialog box, type the file name <code>GetCoordinates</code>, and click Finish.
<p>The IDE opens the GetCoordinates page in the Visual Designer.  The following figure shows the page you will design.<br />
<span class="sp20"> </span><br />
<!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="485">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/getcoordinates-design.gif" alt="GetCoordinates Page Design" border="0" height="257" width="475" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 4</b>: GetCoordinates Page Design</span></p>
</td>
</tr>
</table>
<p><span class="sp20"> </span></li>
<li>From the Basic section of the Palette, drag a Label component and drop it in the upper-left corner of the page. Set the text of the Label to <code>Enter an address:</code></li>
<li>Drag a Text Field component and drop it to the right of the Label component. In the Properties window, set the Text Field&#8217;s <code>required</code> property to True.</li>
<li>Drag a Button component onto the page and drop it below the Text Field component. Set the Button&#8217;s <code>text</code> property to <code>Get Map</code> and the <code>id</code> property to <code>getMap</code>.</li>
<li>Drag a Message Group component onto the page and drop it below the Get Map button.</li>
</ol>
<p><span class="sp10"> </span><br />
<b>Setting Up Page Navigation</b></p>
<ol>
<li>Right-click anywhere in the Visual Designer and choose Page Navigation from the pop-up menu.
<p>The Page Navigator window opens in the IDE.</li>
<li>Click the GetCoordinates.jsp icon and  drag a connector from the <code>getMap</code> button to Page1.jsp.</li>
<li>In the Projects window, right-click the AjaxMapViewer &gt; Web Pages &gt; GetCoordinates node and choose Set As Start Page from the pop-up menu.
<p>A green arrow appears next to the GetCoordinates node, as shown in the following figure.</p>
<p><!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="228">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/startpage-arrow.gif" alt="GetCoordinates Start Page Mark" border="0" height="280" width="218" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 5</b>: GetCoordinates Start Page Mark</span></p>
</td>
</tr>
</table>
<p><span class="sp10"> </span><br />
<!-- END FIGURE COMPONENT --></li>
</ol>
<p><b>Adding the Input Logic</b></p>
<p><span class="sp10"> </span></p>
<ol>
<li>Return to the GetCoordinates page by clicking its tab.</li>
<li>From the BluePrints AJAX Support Beans section of the Palette, drag the Geocoding Service Object component and drop it anywhere the GetCoordinates page.
<p>The geoCoder1 component appears in the Outline window, as shown in the following figure.</p>
<p><!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="266">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/geocoder-outline.gif" alt="geoCoder1 in the Outline Window" border="0" height="267" width="256" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 6</b>: geoCoder1 in the Outline Window</span></p>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END FIGURE COMPONENT --></li>
<li>If you are working behind a firewall, configure the proxy settings on the geoCoder1 component because it does not retrieve the proxy settings from the IDE. If you are not working behind a firewall, skip this step.
<ol>
<li>In the Properties window for the geoCoder1 component, set the <code>proxyHost</code> property to the appropriate proxy for your location.</li>
<li>Set the <code>proxyPort</code> property to the appropriate port for your location.</li>
</ol>
</li>
</ol>
<p><b>Adding Latitude and Longitude Properties to the Request Bean</b></p>
<p><span class="sp10"> </span></p>
<ol>
<li>In the Outline window, right-click RequestBean1 and choose Add &gt; Property from the pop-up menu.
<p>The New Property Pattern dialog box opens.</li>
<li>Enter <code>longitude</code> in the Name field and <code>double</code> (lower-case) in the Type field, and then click OK.</li>
<li>Create a second Request Bean property. Enter <code>latitude</code> for the Name and <code>double</code> (lower-case) for the Type, and then click OK.</li>
<li>Double-click the Get Map button in the Visual Designer.  The IDE opens the GetCoordinates page in the Java editor  at the <code>getMap_action() </code> method.</li>
<li>Add the following code (shown in <b>bold</b>) to  the <code>getMap_action()</code> method.
<p><!-- BEGIN CODE SAMPLE COMPONENT  --></p>
<table class="white" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr class="grey4">
<td><span class="dkcaption1"><b>Code Sample 1: GetMap Button Code</b></span></td>
</tr>
<tr>
<td>
<pre>public String getMap_action() {<span>
        GeoPoint points[] = geoCoder1.geoCode((String)textField1.getText());
        if (points.length &lt; 1) {
            error("Sorry, cannot find that location; please be more specific.");
           return null;
        }
        getRequestBean1().setLatitude(points[0].getLatitude());
        getRequestBean1().setLongitude(points[0].getLongitude());
</span>         return "case1";
}</pre>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END CODE SAMPLE COMPONENT  --></li>
<li>Right-click in the Java Editor, then choose Fix Imports from the pop-up menu to resolve the GeoPoint not found error.</li>
<li>Click the Page1 tab and then click the Java button.</li>
<li>In the Java Editor for Page1, scroll down to the <code>prerender()</code> method and add the following code shown in <b>bold</b>.
<p><!-- BEGIN CODE SAMPLE COMPONENT  --></p>
<table class="white" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr class="grey4">
<td><span class="dkcaption1"><b>Code Sample 2: prerender Method</b></span></td>
</tr>
<tr>
<td>
<pre>public void prerender() {<span>
        mapViewer1_center.setLatitude(getRequestBean1().getLatitude());
        mapViewer1_center.setLongitude(getRequestBean1().getLongitude());
</span>}</pre>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END CODE SAMPLE COMPONENT  --></li>
<li>Build and run the application. AjaxMapViewer opens in your web browser. Enter a physical address, such as <code>15 Network Circle, Menlo Park, CA</code>, and click the Get Map button. A map showing the location you entered opens in your web browser, similar to the following figure.<br />
<span class="sp20"> </span><br />
<!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="612">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/apptake2.gif" alt="Take 2" border="0" height="377" width="602" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 7</b>: Map Viewer Application: Take 2</span></p>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END FIGURE COMPONENT --></li>
</ol>
<p><a name="04"></a></p>
<h3>Adding a Map Marker</h3>
<p><span class="sp10"> </span><br />
The map you created in the previous section shows the area around the location you entered, but does not pinpoint the location itself. In this section, you add a map marker to the application.</p>
<p><span class="sp10"> </span></p>
<ol>
<li>Open the Design View for Page1.</li>
<li>From the BluePrints AJAX Support Beans section of the Palette, drag a Map Marker component and drop it anywhere on Page1.</li>
<li>In the Properties window for mapMarker1, set the <code>markup</code> property to <code>This is the place!</code>.</li>
<li>In the Outline window,  right-click the <code>mapViewer1</code> component and choose Property Bindings from the pop-up menu.</li>
<li>In the Property Bindings dialog box, bind mapViewer1&#8217;s <code>info</code> property to Page1&#8217;s <code>mapMarker1</code> property, as shown in the following figure. Click Apply, then Close.
<p><!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="449">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/mapviewer-propertybinding.gif" alt="Binding the  mapViewer1 info property to mapMarker1" border="0" height="481" width="439" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 8</b>: Binding the  mapViewer1 <code>info</code> Property to mapMarker1</span></p>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END FIGURE COMPONENT --></li>
<li>Double-click anywhere on Page1 to open the Java Editor.</li>
<li>Scroll to the <code>prerender()</code> method and add with the following two lines shown in <b>bold</b>.
<p><!-- BEGIN CODE SAMPLE COMPONENT  --></p>
<table class="white" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr class="grey4">
<td><span class="dkcaption1"><b>Code Sample 3: prerender() Method With Map Marker Support</b></span></td>
</tr>
<tr>
<td>
<pre>public void prerender() {
        mapViewer1_center.setLatitude(getRequestBean1().getLatitude());
        mapViewer1_center.setLongitude(getRequestBean1().getLongitude());
        <span>mapMarker1.setLatitude(mapViewer1_center.getLatitude());
       mapMarker1.setLongitude(mapViewer1_center.getLongitude());
</span>}</pre>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END CODE SAMPLE COMPONENT  --> This code sets the coordinates on the mapMarker1 component so that it points to the location on which the map is centered.</li>
<li>Build and run the application. When the AjaxMapViewer application opens in your web browser, enter an address such as <code>15 Network Circle, Menlo Park, CA</code>, and then click the Get Map button. The map opens in your web browser with a map marker pointing to the location, similar to the following figure.<br />
<span class="sp20"> </span><br />
<!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="608">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/mapmarker-map.gif" alt="Map with Map Marker" border="0" height="371" width="598" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 9</b>: Map Viewer Application: Take 3 </span></p>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END FIGURE COMPONENT --></li>
</ol>
<p><a name="05"></a></p>
<h3>Adding a Map Marker Flag</h3>
<p><span class="sp10"> </span><br />
Finally, you  add a map marker flag to further pinpoint the map location.<span class="sp10"> </span></p>
<ol>
<li>In the Java Editor for Page1, find the <code>public class Page1 extends AbstractPageBean</code> declaration. Add the following code (shown in <strong>bold</strong>) under the Creator-Managed Component Definition code fold.<br />
<table class="white" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr class="grey4">
<td><span class="dkcaption1"><b>Code Sample 4: Adding a MapMarker Array to Page1</b></span></td>
</tr>
<tr>
<td>
<pre>public class Page1 extends AbstractPageBean {
    Creator-managed Component Definition<span>

private MapMarker[] markers;
    public MapMarker[] getMarkers(){
        return markers;
    }</span></pre>
</td>
</tr>
</table>
<p><span class="sp20"> </span></li>
<li>Scroll to the <code>prerender()</code> method and add the following two lines of code shown in <b>bold</b>.<br />
<table class="white" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr class="grey4">
<td><span class="dkcaption1"><b>Code Sample 5: prerender() Method With Map Marker Flag Code</b></span></td>
</tr>
<tr>
<td>
<pre>public void prerender() {
        mapViewer1_center.setLatitude(getRequestBean1().getLatitude());
        mapViewer1_center.setLongitude(getRequestBean1().getLongitude());
        mapMarker1.setLatitude(mapViewer1_center.getLatitude());
        mapMarker1.setLongitude(mapViewer1_center.getLongitude());
        <span>markers = new MapMarker[1];
       markers[0] = mapMarker1;</span>
}</pre>
</td>
</tr>
</table>
<p><span class="sp20"> </span></li>
<li>Click the Design button to return to the Page1 Design View.</li>
<li>In the Outline window, right-click the mapViewer1 component and choose Property Bindings from the pop-up menu.</li>
<li>In the Property Bindings dialog box, bind mapViewer1&#8217;s <code>markers</code> property to Page1&#8217;s <code>markers</code> array, as shown in the following figure. Click Apply, then Close.<br />
<span class="sp20"> </span><br />
<!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="450">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/markers-binding.gif" alt="Binding the Markers Property to the Markers Array" border="0" height="489" width="440" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 10</b>: Binding the Markers Property to the Markers Array</span></p>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END FIGURE COMPONENT --></li>
<li>Build and run the application. Enter an address such as <code>15 Network Circle, Menlo Park, CA</code>, and then click the Get Map button. The map opens in your web browser with a map marker and flag pointing to the location, similar to the following figure.<br />
<span class="sp20"> </span><br />
<!-- BEGIN FIGURE COMPONENT --></p>
<table border="0" cellpadding="2" cellspacing="0" width="610">
<tr>
<td class="grey3" align="center"><img src="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/finalmap.gif" alt="Map with Map Marker" border="0" height="371" width="600" /></p>
<p class="pad3"><span class="dkcaption1"> <b>Figure 11</b>: Map Viewer Application: Take 4 </span></p>
</td>
</tr>
</table>
<p><span class="sp20"> </span><br />
<!-- END FIGURE COMPONENT --></li>
</ol>
<p><a name="06"></a></p>
<h3>Doing More With the Ajax Map Viewer Component</h3>
<p><span class="sp10"> </span><br />
<b>Try It.</b> In the section <a href="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer.html#05">Adding a Map Marker Flag</a>, you added a <code>MapMarker</code> array to contain the map marker and marker flag. Try using the array to place multiple markers on the map.</p>
<p><span class="sp10"> </span><br />
<b>Try It.</b> This tutorial shows how to store the MapMarker array at page scope. Try storing the MapMarker array at session scope and implement an &#8220;add a marker&#8221; page to add markers to the map. Ensure that the extra addresses you provide appear on the map at the scale factor you are using. The default scale factor is 4.</p>
<p><span class="sp10"> </span><br />
<b>Try It.</b> This tutorial shows how to use one Java BluePrints AJAX map component to create one custom map. Try building an application that creates more than one map. Rather than store the Google map service API key as a property on each map component that you use, create a context initialization parameter named <code>com.sun.j2ee.blueprints.ui.mapviewer.KEY</code> in your <code>web.xml</code> file and store the Google map service API key value there.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/marcosessa.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/marcosessa.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marcosessa.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marcosessa.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marcosessa.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marcosessa.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marcosessa.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marcosessa.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marcosessa.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marcosessa.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marcosessa.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marcosessa.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=14&subd=marcosessa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marcosessa.wordpress.com/2006/08/29/using-the-ajax-map-viewer-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfc7b43fe04a77105308779c3f23f61a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">marcosessa</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/im/a.gif" medium="image">
			<media:title type="html"> </media:title>
		</media:content>

		<media:content url="http://developers.sun.com/im/a.gif" medium="image">
			<media:title type="html">[spacer]</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/im/jsc2stamp.gif" medium="image">
			<media:title type="html">Content on this page applies to Sun Java Studio Creator 2</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/mapviewer-graphic.gif" medium="image">
			<media:title type="html">Map Viewer Component</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/mapkey-property.gif" medium="image">
			<media:title type="html">Map Key Property</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/initial-map.gif" medium="image">
			<media:title type="html">Map Viewer Application, Take 1</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/getcoordinates-design.gif" medium="image">
			<media:title type="html">GetCoordinates Page Design</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/startpage-arrow.gif" medium="image">
			<media:title type="html">GetCoordinates Start Page Mark</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/geocoder-outline.gif" medium="image">
			<media:title type="html">geoCoder1 in the Outline Window</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/apptake2.gif" medium="image">
			<media:title type="html">Take 2</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/mapviewer-propertybinding.gif" medium="image">
			<media:title type="html">Binding the  mapViewer1 info property to mapMarker1</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/mapmarker-map.gif" medium="image">
			<media:title type="html">Map with Map Marker</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/markers-binding.gif" medium="image">
			<media:title type="html">Binding the Markers Property to the Markers Array</media:title>
		</media:content>

		<media:content url="http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ajaxmapviewer/finalmap.gif" medium="image">
			<media:title type="html">Map with Map Marker</media:title>
		</media:content>
	</item>
		<item>
		<title>Rounded corners in CSS</title>
		<link>http://marcosessa.wordpress.com/2006/05/24/rounded-corners-in-css/</link>
		<comments>http://marcosessa.wordpress.com/2006/05/24/rounded-corners-in-css/#comments</comments>
		<pubDate>Wed, 24 May 2006 17:12:47 +0000</pubDate>
		<dc:creator>marcosessa</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">https://marcosessa.wordpress.com/2006/05/24/rounded-corners-in-css/</guid>
		<description><![CDATA[There are other ways that I&#8217;ve seen it done, but the other methods always require lots of complex HTML and CSS. I figure that lots of nested divs aren&#8217;t much better than using a table, so my way doesn&#8217;t require much in the way of HTML or CSS. Here&#8217;s how I do it.
Create four images [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=13&subd=marcosessa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>There are other ways that I&rsquo;ve seen it done, but the other methods always require lots of complex HTML and CSS. I figure that lots of nested divs aren&rsquo;t much better than using a table, so my way doesn&rsquo;t require much in the way of HTML or CSS. Here&rsquo;s how I do it.</p>
<p><a title="more" name="more"></a>Create four images for your corners. Most graphics programs have a tool that will create rounded-off squares. I&rsquo;ll be using this square here&hellip;</p>
<p><img src="http://kalsey.com/tools/css/rounded/images/square.gif" align="middle" height="84" width="88" /></p>
<p>&hellip;and I&rsquo;m going to cut off the corners to get my four images: <img src="http://kalsey.com/tools/css/rounded/images/tl.gif" height="15" hspace="4" width="15" /> <img src="http://kalsey.com/tools/css/rounded/images/tr.gif" height="15" hspace="4" width="15" /><img src="http://kalsey.com/tools/css/rounded/images/bl.gif" height="15" hspace="4" width="15" /> <img src="http://kalsey.com/tools/css/rounded/images/br.gif" height="15" hspace="4" width="15" /></p>
<p>In the spot where I want the box to show up, I create a container div to hold the box, a div for the top row and a div for the bottom row. Between the top and bottom rows, I add my content. In the top and bottom row divs, I add the left corner image and set the inline style to read <code>display: none;</code>. This makes the image invisible unless I make it visible through the stylesheet. That way, I can hide the effect from incompatible browsers by not showing them the stylesheet.</p>
<pre>&lt;div class=&quot;roundcont&quot;&gt;
   &lt;div class=&quot;roundtop&quot;&gt;
	 &lt;img src=&quot;tl.gif&quot; alt=&quot;&quot;
	 width=&quot;15&quot; height=&quot;15&quot; class=&quot;corner&quot;
	 style=&quot;display: none&quot; /&gt;
   &lt;/div&gt;

&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing
   elit, sed do eiusmod tempor incididunt ut labore et
   dolore magna aliqua. Ut enim ad minim veniam, quis
   nostrud exercitation ullamco laboris nisi ut aliquip
   ex ea commodo consequat. Duis aute irure dolor in
   reprehenderit in voluptate velit esse cillum dolore eu
   fugiat nulla pariatur. Excepteur sint occaecat cupidatat
   non proident, sunt in culpa qui officia deserunt mollit
   anim id est laborum.&lt;/p&gt;

&lt;div class=&quot;roundbottom&quot;&gt;
	 &lt;img src=&quot;bl.gif&quot; alt=&quot;&quot;
	 width=&quot;15&quot; height=&quot;15&quot; class=&quot;corner&quot;
	 style=&quot;display: none&quot; /&gt;
   &lt;/div&gt;
&lt;/div&gt;</pre>
<p>The CSS sets the width and background color of the container object and the color of the text inside. The margins on interior paragraphs are set so that the text doesn&rsquo;t sit right up against the edge of the box.</p>
<p>Then the top and bottom divs are given a background image that contains the right corner images and the left corner images from the HTML code are enabled.</p>
<pre>.roundcont {
	width: 250px;
	background-color: #f90;
	color: #fff;
}

.roundcont p {
	margin: 0 10px;
}

.roundtop {
	background: url(tr.gif) no-repeat top right;
}

.roundbottom {
	background: url(br.gif) no-repeat top right;
}

img.corner {
   width: 15px;
   height: 15px;
   border: none;
   display: block !important;
}</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/marcosessa.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/marcosessa.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marcosessa.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marcosessa.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marcosessa.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marcosessa.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marcosessa.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marcosessa.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marcosessa.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marcosessa.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marcosessa.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marcosessa.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=13&subd=marcosessa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marcosessa.wordpress.com/2006/05/24/rounded-corners-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfc7b43fe04a77105308779c3f23f61a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">marcosessa</media:title>
		</media:content>

		<media:content url="http://kalsey.com/tools/css/rounded/images/square.gif" medium="image" />

		<media:content url="http://kalsey.com/tools/css/rounded/images/tl.gif" medium="image" />

		<media:content url="http://kalsey.com/tools/css/rounded/images/tr.gif" medium="image" />

		<media:content url="http://kalsey.com/tools/css/rounded/images/bl.gif" medium="image" />

		<media:content url="http://kalsey.com/tools/css/rounded/images/br.gif" medium="image" />
	</item>
		<item>
		<title>Check on Codice Fiscale &#8211; Controllo sul codice fiscale in JAVASCRIPT</title>
		<link>http://marcosessa.wordpress.com/2006/05/12/check-on-codice-fiscale-controllo-sul-codice-fiscale-in-javascript/</link>
		<comments>http://marcosessa.wordpress.com/2006/05/12/check-on-codice-fiscale-controllo-sul-codice-fiscale-in-javascript/#comments</comments>
		<pubDate>Fri, 12 May 2006 10:17:19 +0000</pubDate>
		<dc:creator>marcosessa</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">https://marcosessa.wordpress.com/2006/05/12/check-on-codice-fiscale-controllo-sul-codice-fiscale-in-javascript/</guid>
		<description><![CDATA[//**********************************************************//
//               //
// isCodiceFiscale(field)- return &#34;OK&#34;,&#34;VUOTO&#34; or &#34;ERRATO&#34; //
//               //
// Funzione che controlla che il valore del campo del form //
// HTML &#60;field&#62; sia un codice fiscale valido [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=12&subd=marcosessa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><pre><strong><strong>//**********************************************************//
//               //
// isCodiceFiscale(field)- return &quot;OK&quot;,&quot;VUOTO&quot; or &quot;ERRATO&quot; //
//               //
// Funzione che controlla che il valore del campo del form //
// HTML &lt;field&gt; sia un codice fiscale valido    //
//               //
//**********************************************************//

function isCodiceFiscale(obj)
{
 var nTempNum;
 var nAppoNum;
 var i;
 var szTempCodFisc;
 var szLastChar;
 var szValued;
 var szInValued;

szCodFisc = obj.value;

if (szCodFisc.length&lt;16) return false
 if (szCodFisc == &quot;&quot;) return false;
 else {
  szCodFisc =szCodFisc.toUpperCase();
  szLastChar = szCodFisc.substr(szCodFisc.length - 1,1);
  szTempCodFisc =szCodFisc.substr(0,szCodFisc.length - 1);
  nTempNum = 0;
  i = 0;

while (true) {
   szValued=&quot;B1A0KKPPLLC2QQD3RRE4VVOOSSF5TTG6UUH7MMI8NNJ9WWZZYYXX&quot;;
   // I DISPARI
   szInValued=szTempCodFisc.substr(i,1);
   nAppoNum = szValued.search(szInValued);
   nTempNum = nTempNum + (nAppoNum &amp;  0x7FFE) / 2;
   i = i + 1;
   if (i&gt;15)
    break;
   szValued=&quot;A0B1C2D3E4F5G6H7I8J9KKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ&quot;;
   // I PARI
   szInValued=szTempCodFisc.substr(i,1);
   nAppoNum = szValued.search(szInValued);
   nTempNum =  nTempNum + (nAppoNum &amp;  0x7FFE) / 2;
   i = i + 1;
  }
  nTempNum = nTempNum % 26; //mod
  szValued=&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;;
  szValued= szValued.substr(nTempNum, 1);
  if (szValued==szLastChar) return true;
  else return false;
 }
}
</strong></strong></pre>
<pre>
E questo il controllo specifico del campo:

codice:</pre>
<pre><strong>
 if ((aForm.cod_fisc.value==0) &amp;&amp; !isCodiceFiscale(aForm.cod_fisc))
 {
  alert(&quot;Codice Fiscale non valido&quot;);
  aForm.cod_fisc.focus();
  return false;
 }</strong>&nbsp;</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/marcosessa.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/marcosessa.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marcosessa.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marcosessa.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marcosessa.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marcosessa.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marcosessa.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marcosessa.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marcosessa.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marcosessa.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marcosessa.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marcosessa.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=12&subd=marcosessa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marcosessa.wordpress.com/2006/05/12/check-on-codice-fiscale-controllo-sul-codice-fiscale-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfc7b43fe04a77105308779c3f23f61a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">marcosessa</media:title>
		</media:content>
	</item>
		<item>
		<title>Replacing the radio buttons and checkboxes with custom images</title>
		<link>http://marcosessa.wordpress.com/2006/04/20/replacing-the-radio-buttons-and-checkboxes-with-custom-images/</link>
		<comments>http://marcosessa.wordpress.com/2006/04/20/replacing-the-radio-buttons-and-checkboxes-with-custom-images/#comments</comments>
		<pubDate>Thu, 20 Apr 2006 14:36:50 +0000</pubDate>
		<dc:creator>marcosessa</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://marcosessa.wordpress.com/2006/04/20/replacing-the-radio-buttons-and-checkboxes-with-custom-images/</guid>
		<description><![CDATA[function chgCB(){
&#160; CHKB = document.getElementById(&#39;newCB&#39;).getElementsByTagName(&#39;input&#39;);
&#160; for(i=0; i &#60; CHKB.length; i++){
&#160; &#160; if(CHKB[i].type == &#34;checkbox&#34;){
&#160; &#160; &#160; IMG = document.createElement(&#39;img&#39;);
&#160; &#160; &#160; CHKB[i].parentNode.insertBefore(IMG, CHKB[i]);
&#160; &#160; &#160; IMG.src = &#34;radio0.gif&#34;;
&#160; &#160; &#160; if(CHKB[i].checked&#160; == true) IMG.src = &#34;radion.gif&#34;;
&#160; &#160; &#160; if(CHKB[i].disabled == true) IMG.src = &#34;radio.gif&#34;;
&#160; &#160; &#160; else{ // Changing state&#39;s behaviours are only applied if [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=11&subd=marcosessa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="codeblock"><code>function chgCB(){<br />
&nbsp; CHKB = document.getElementById(&#39;newCB&#39;).getElementsByTagName(&#39;input&#39;);<br />
&nbsp; for(i=0; i &lt; CHKB.length; i++){<br />
&nbsp; &nbsp; if(CHKB[i].type == &quot;checkbox&quot;){<br />
&nbsp; &nbsp; &nbsp; IMG = document.createElement(&#39;img&#39;);<br />
&nbsp; &nbsp; &nbsp; CHKB[i].parentNode.insertBefore(IMG, CHKB[i]);<br />
&nbsp; &nbsp; &nbsp; IMG.src = &quot;radio0.gif&quot;;<br />
&nbsp; &nbsp; &nbsp; if(CHKB[i].checked&nbsp; == true) IMG.src = &quot;radion.gif&quot;;<br />
&nbsp; &nbsp; &nbsp; if(CHKB[i].disabled == true) IMG.src = &quot;radio.gif&quot;;<br />
&nbsp; &nbsp; &nbsp; else{ // Changing state&#39;s behaviours are only applied if the box is clickable<br />
&nbsp; &nbsp; &nbsp; &nbsp; CHKB[i].onchange = function(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IMG = this.parentNode.getElementsByTagName(&#39;img&#39;)[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(this.checked == true) IMG.src = &#39;radion.gif&#39;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else IMG.src = &#39;radio0.gif&#39;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!window.sidebar){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CHKB[i].parentNode.onclick = function(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CHK = this.getElementsByTagName(&#39;input&#39;)[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CHK.checked = (CHK.checked == true) ? false : true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CHK.onchange()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; CHKB[i].style.visibility = &#39;hidden&#39;;<br />
&nbsp; &nbsp; &nbsp; CHKB[i].style.position&nbsp;  = &#39;absolute&#39;;<br />
&nbsp; &nbsp; }<br />
&nbsp; }<br />
} </code>function chgRB(){<br />
&nbsp; CHKB = document.getElementById(&#39;newRB&#39;).getElementsByTagName(&#39;input&#39;);<br />
&nbsp; for(i=0; i &lt; CHKB.length; i++){<br />
&nbsp; &nbsp; if(CHKB[i].type == &quot;radio&quot;){<br />
&nbsp; &nbsp; &nbsp; IMG = document.createElement(&#39;img&#39;);<br />
&nbsp; &nbsp; &nbsp; CHKB[i].parentNode.insertBefore(IMG, CHKB[i]);<br />
&nbsp; &nbsp; &nbsp; IMG.src = &quot;radio0.gif&quot;;</p>
<p>&nbsp; &nbsp; &nbsp; IMG.id = &#39;img&#39;+CHKB[i].id;<br />
&nbsp; &nbsp; &nbsp; IMG.relation = CHKB[i].name;</p>
<p>&nbsp; &nbsp; &nbsp; if(CHKB[i].checked&nbsp; == true) IMG.src = &quot;radion.gif&quot;;<br />
&nbsp; &nbsp; &nbsp; if(CHKB[i].disabled == true) IMG.src = &quot;radio.gif&quot;;<br />
&nbsp; &nbsp; &nbsp; else{ // Changing state&#39;s behaviours are only applied if the box is clickable<br />
&nbsp; &nbsp; &nbsp; &nbsp; CHKB[i].onchange = function(){</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IMG = document.getElementById(&#39;newRB&#39;).getElementsByTagName(&#39;img&#39;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(i=0; i &lt; IMG.length; i++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(IMG[i].relation != this.name) continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(IMG[i].src.indexOf(&#39;radio.gif&#39;) != -1) continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(IMG[i].id == &#39;img&#39;+this.id) IMG[i].src = &#39;radion.gif&#39;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else IMG[i].src = &#39;radio0.gif&#39;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!window.sidebar){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CHKB[i].parentNode.onclick = function(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CHK = this.getElementsByTagName(&#39;input&#39;)[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CHK.checked = (CHK.checked == true) ? false : true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CHK.onchange()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; CHKB[i].style.visibility = &#39;hidden&#39;;<br />
&nbsp; &nbsp; &nbsp; CHKB[i].style.position&nbsp;  = &#39;absolute&#39;;<br />
&nbsp; &nbsp; }<br />
&nbsp; }<br />
}</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/marcosessa.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/marcosessa.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marcosessa.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marcosessa.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marcosessa.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marcosessa.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marcosessa.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marcosessa.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marcosessa.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marcosessa.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marcosessa.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marcosessa.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=11&subd=marcosessa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marcosessa.wordpress.com/2006/04/20/replacing-the-radio-buttons-and-checkboxes-with-custom-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfc7b43fe04a77105308779c3f23f61a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">marcosessa</media:title>
		</media:content>
	</item>
		<item>
		<title>Check &#8216;Codice Fiscale&#8217; &#8211; C#</title>
		<link>http://marcosessa.wordpress.com/2006/04/19/check-codice-fiscale-c/</link>
		<comments>http://marcosessa.wordpress.com/2006/04/19/check-codice-fiscale-c/#comments</comments>
		<pubDate>Wed, 19 Apr 2006 12:16:27 +0000</pubDate>
		<dc:creator>marcosessa</dc:creator>
				<category><![CDATA[C]]></category>

		<guid isPermaLink="false">https://marcosessa.wordpress.com/2006/04/19/check-codice-fiscale-c/</guid>
		<description><![CDATA[C#
 using System;
using System.Text;

namespace&#160;Verifiche
{
&#160;&#160;&#160; /// &#60;summary&#62;
&#160;&#160;&#160; /// Classe codice fiscale
&#160;&#160;&#160; /// &#60;/summary&#62;

&#160;&#160;&#160; public class CodiceFiscale
&#160;&#160; {

&#160;&#160;&#160;&#160;&#160;&#160;&#160; public CodiceFiscale()
&#160;&#160;&#160;&#160;&#160;&#160; {
&#160;&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160; public static bool CheckCodiceFiscale(string CodiceFiscale)
&#160;&#160;&#160;&#160;&#160;&#160; {
&#160;&#160;&#160;
&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; bool result = false;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; const int caratteri = 16;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (CodiceFiscale == null)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return result;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (CodiceFiscale.Length &#60; caratteri)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return PartitaIva.CheckPartitaIva(CodiceFiscale);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // se il codice fiscale non &#232; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=10&subd=marcosessa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><u><font size="5">C#</font></u></p>
<p><b><font color="#008000"> </font></b><b><font color="#008000"><font size="2">using </font></font></b><font size="2">System</font><font size="2"><font color="#006400">;<br />
</font><b><font color="#008000">using </font></b></font><font size="2">System<font color="#006400">.</font>Text</font><font size="2"><font color="#006400">;<br />
</font></font></p>
<p><b><font color="#008000" size="2">namespace&nbsp;<font color="#000000">Verifiche<br />
</font></font></b><font color="#006400" size="2">{<br />
</font><font color="#808080" size="2">&nbsp;&nbsp;&nbsp; /// &lt;<b>summary</b>&gt;<br />
&nbsp;&nbsp;&nbsp; /// </font><font color="#008000" size="2">Classe codice fiscale<br />
</font><font color="#808080" size="2">&nbsp;&nbsp;&nbsp; /// &lt;<b>/summary</b>&gt;<br />
</font><b><font color="#0000ff" size="2"><br />
&nbsp;&nbsp;&nbsp; public </font></b><font color="#ff0000" size="2">class </font><font size="2">CodiceFiscale<br />
</font><font color="#006400" size="2">&nbsp;&nbsp; {<br />
</font><b><font color="#0000ff" size="2"><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public </font><font color="#191970" size="2">CodiceFiscale</font></b><font color="#006400" size="2">()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
</font><b><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public </font></b><font color="#a52a2a" size="2">static </font><b><font color="#ff0000" size="2">bool </font><font color="#191970" size="2">CheckCodiceFiscale</font></b><font color="#006400" size="2">(</font><font color="#ff0000" size="2">string </font><font size="2">CodiceFiscale</font><font color="#006400" size="2">)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
</font><b><font color="#ff0000" size="2">&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool </font></b><font size="2">result </font><font color="#006400" size="2">= </font><b><font color="#008b8b" size="2">false</font></b><font color="#006400" size="2">;<br />
</font><font color="#a52a2a" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const </font><b><font color="#ff0000" size="2">int </font></b><font size="2">caratteri </font><font color="#006400" size="2">= </font><font color="#00008b" size="2">16</font><font color="#006400" size="2">;<br />
</font><b><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if </font></b><font color="#006400" size="2">(</font><font size="2">CodiceFiscale </font><font color="#006400" size="2">== </font><b><font size="2">null</font></b><font color="#006400" size="2">)<br />
</font><font color="#000080" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return </font><font size="2">result</font><font color="#006400" size="2">;</font></p>
<p><b><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if </font></b><font color="#006400" size="2">(</font><font size="2">CodiceFiscale</font><font color="#006400" size="2">.</font><font size="2">Length </font><font color="#006400" size="2">&lt; </font><font size="2">caratteri</font><font color="#006400" size="2">)<br />
</font><font color="#000080" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return </font><font size="2">PartitaIva</font><font color="#006400" size="2">.</font><b><font color="#191970" size="2">CheckPartitaIva</font></b><font color="#006400" size="2">(</font><font size="2">CodiceFiscale</font><font color="#006400" size="2">);</font></p>
<p><font color="#008000" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // se il codice fiscale non &egrave; di 16 caratteri il controllo<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &egrave; gi&agrave; finito prima ancora di cominciare</font></p>
<p><b><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if </font></b><font color="#006400" size="2">(</font><font size="2">CodiceFiscale</font><font color="#006400" size="2">.</font><font size="2">Length </font><font color="#006400" size="2">!= </font><font size="2">caratteri</font><font color="#006400" size="2">)<br />
</font><font color="#000080" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return </font><font size="2">result</font><font color="#006400" size="2">; </font></p>
<p><font color="#008000" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // stringa per controllo e calcolo omocodia<br />
</font><font color="#a52a2a" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const </font><font color="#ff0000" size="2">string </font><font size="2">omocodici </font><font color="#006400" size="2">= </font><font color="#ff00ff" size="2">&quot;LMNPQRSTUV&quot;</font><font color="#006400" size="2">;<br />
</font><font color="#008000" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // per il calcolo del check digit e la conversione in numero<br />
</font><font color="#a52a2a" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const </font><font color="#ff0000" size="2">string </font><font size="2">listaControllo </font><font color="#006400" size="2">= </font><font color="#ff00ff" size="2">&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;</font><font color="#006400" size="2">;</font></p>
<p><b><font color="#ff0000" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int</font></b><font color="#006400" size="2">[] </font><font size="2">listaPari </font><font color="#006400" size="2">= {</font><font color="#00008b" size="2">0</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">1</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">2</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">3</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">4</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">5</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">6</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">7</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">8</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">9</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">10</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">11</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">12</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">13</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">14</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">15</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">16</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">17</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">18</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">19</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">20</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">21</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">22</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">23</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">24</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">25</font><font color="#006400" size="2">};<br />
</font><b><font color="#ff0000" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int</font></b><font color="#006400" size="2">[] </font><font size="2">listaDispari </font><font color="#006400" size="2">= {</font><font color="#00008b" size="2">1</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">0</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">5</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">7</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">9</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">13</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">15</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">17</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">19</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">21</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">2</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">4</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">18</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">20</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">11</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">3</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">6</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">8</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">12</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">14</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">16</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">10</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">22</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">25</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">24</font><font color="#006400" size="2">,</font><font color="#00008b" size="2">23</font><font color="#006400" size="2">};</font></p>
<p><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CodiceFiscale </font><font color="#006400" size="2">= </font><font size="2">CodiceFiscale</font><font color="#006400" size="2">.</font><b><font color="#191970" size="2">ToUpper</font></b><font color="#006400" size="2">();<br />
</font><b><font color="#ff0000" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char</font></b><font color="#006400" size="2">[] </font><font size="2">cCodice </font><font color="#006400" size="2">= </font><font size="2">CodiceFiscale</font><font color="#006400" size="2">.</font><b><font color="#191970" size="2">ToCharArray</font></b><font color="#006400" size="2">();</font></p>
<p><font color="#006400" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // check </font><font color="#008000"><font size="2">della correttezza formale del codice fiscale<br />
</font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // elimino dalla stringa gli eventuali caratteri utilizzati negli<br />
</font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;spazi riservati ai 7&nbsp;che sono diventati&nbsp;</font><font size="2">carattere in caso di omocodia<br />
</font></font><b><font color="#0000ff"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for </font></font></b><font size="2"><font color="#006400">(</font><b><font color="#ff0000">int </font></b></font><font size="2">k <font color="#006400">= </font><font color="#00008b">6</font><font color="#006400">; </font>k <font color="#006400">&lt; </font><font color="#00008b">15</font><font color="#006400">; </font>k</font><font color="#006400"><font size="2">++)<br />
</font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
</font></font><b><font color="#0000ff"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if </font></font></b><font size="2"><font color="#006400">((</font>k <font color="#006400">== </font><font color="#00008b">8</font><font color="#006400">) || (</font>k <font color="#006400">== </font><font color="#00008b">11</font></font><font color="#006400"><font size="2">))<br />
</font></font><font color="#000080" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; continue</font><font color="#006400"><font size="2">;<br />
</font></font><b><font color="#ff0000"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int </font></font></b><font size="2">x <font color="#006400">= (</font>omocodici<font color="#006400">.</font><b><font color="#191970">IndexOf</font></b></font><font size="2"><font color="#006400">(</font>cCodice<font color="#006400">[</font>k</font><font color="#006400"><font size="2">]));<br />
</font></font><b><font color="#0000ff"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if </font></font></b><font size="2"><font color="#006400">(</font>x <font color="#006400">!= -</font><font color="#00008b">1</font></font><font color="#006400"><font size="2">)<br />
</font></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cCodice<font color="#006400">[</font>k<font color="#006400">] = </font>x<font color="#006400">.</font><b><font color="#191970">ToString</font></b></font><font size="2"><font color="#006400">().</font><b><font color="#191970">ToCharArray</font></b></font><font size="2"><font color="#006400">()[</font><font color="#00008b">0</font></font><font color="#006400"><font size="2">];<br />
</font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font></font></p>
<p><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// &nbsp;Regex rgx <font color="#006400">= </font><b><font color="#008b8b">new </font><font color="#191970">Regex</font></b></font><font size="2"><font color="#006400">(</font><font color="#ff00ff">@&quot;^[A-Z]{6}[]{2}[A-Z][]{2}[A-Z][]{3}[A-Z]$&quot;</font></font><font color="#006400"><font size="2">);<br />
</font></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// &nbsp;Match m <font color="#006400">= </font>rgx<font color="#006400">.</font><b><font color="#191970">Match</font></b></font><font size="2"><font color="#006400">(</font><b><font color="#008b8b">new </font></b></font><font size="2"><font color="#ff0000">string</font><font color="#006400">(</font>cCodice</font><font color="#006400"><font size="2">));<br />
</font></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// &nbsp;result <font color="#006400">= </font>m<font color="#006400">.</font>Success</font><font color="#006400"><font size="2">;<br />
</font></font><font color="#006400"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">&nbsp;result </font><font color="#006400">=&nbsp;true;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;da una verifica ho trovato 3&nbsp;risultati errati&nbsp;su pi&ugrave; di 4000&nbsp;</font></font><font color="#008000"><font size="2">&nbsp;codici fiscali&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // ho temporaneamente rimosso&nbsp;il test con le Regular fino a quando non riuscir&ograve; a capire perch&egrave; in alcuni casi sbaglia&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font></p>
<p><font color="#008000"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;// normalizzato il codice fiscale se la regular non ha buon<br />
</font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // fine &egrave; inutile continuare<br />
</font></font><b><font color="#0000ff"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if </font></font></b><font size="2"><font color="#006400">(</font>result</font><font color="#006400"><font size="2">)<br />
</font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
</font></font><b><font color="#ff0000"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int </font></font></b><font size="2">somma <font color="#006400">= </font><font color="#00008b">0</font></font><font color="#006400"><font size="2">;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color="#006400"><font size="2"><font color="#008000" size="2">// ripristino il codice fiscale originario&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // grazie a Lino Barreca che mi ha segnalato l&#39;errore<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#000000" size="2">cCodice </font><font color="#006400" size="2">= </font><font color="#000000" size="2">CodiceFiscale</font><font color="#006400" size="2">.</font><b><font color="#191970" size="2">ToCharArray</font></b><font color="#006400" size="2">();</font><br />
</font></font><b><font color="#0000ff"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for </font></font></b><font size="2"><font color="#006400">(</font><b><font color="#ff0000">int </font></b></font><font size="2">i <font color="#006400">= </font><font color="#00008b">0</font><font color="#006400">; </font>i <font color="#006400">&lt; </font><font color="#00008b">15</font><font color="#006400">; </font>i</font><font color="#006400"><font size="2">++)<br />
</font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
</font></font><b><font color="#ff0000"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char </font></font></b><font size="2">c <font color="#006400">= </font>cCodice<font color="#006400">[</font>i</font><font color="#006400"><font size="2">];<br />
</font></font><b><font color="#ff0000"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int </font></font></b><font size="2">x <font color="#006400">= </font><font color="#ff00ff">&quot;0123456789&quot;</font><font color="#006400">.</font><b><font color="#191970">IndexOf</font></b></font><font size="2"><font color="#006400">(</font>c</font><font color="#006400"><font size="2">);<br />
</font></font><b><font color="#0000ff"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if </font></font></b><font size="2"><font color="#006400">(</font>x <font color="#006400">!= -</font><font color="#00008b">1</font></font><font color="#006400"><font size="2">)<br />
</font></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c <font color="#006400">= </font>listaControllo<font color="#006400">.</font><b><font color="#191970">Substring</font></b></font><font size="2"><font color="#006400">(</font>x<font color="#006400">,</font><font color="#00008b">1</font><font color="#006400">).</font><b><font color="#191970">ToCharArray</font></b></font><font size="2"><font color="#006400">()[</font><font color="#00008b">0</font></font><font color="#006400"><font size="2">];<br />
</font></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x <font color="#006400">= </font>listaControllo<font color="#006400">.</font><b><font color="#191970">IndexOf</font></b></font><font size="2"><font color="#006400">(</font>c</font><font color="#006400"><font size="2">);<br />
</font></font><font color="#008000"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // i modulo 2 = 0 &egrave; dispari perch&egrave; iniziamo da 0<br />
</font></font><b><font color="#0000ff"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if </font></font></b><font size="2"><font color="#006400">((</font>i <font color="#006400">% </font><font color="#00008b">2</font><font color="#006400">) == </font><font color="#00008b">0</font></font><font color="#006400"><font size="2">)<br />
</font></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x <font color="#006400">= </font>listaDispari<font color="#006400">[</font>x</font><font color="#006400"><font size="2">];<br />
</font></font><b><font color="#0000ff"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />
</font></font></b><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x <font color="#006400">= </font>listaPari<font color="#006400">[</font>x</font><font color="#006400"><font size="2">];<br />
</font></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; somma <font color="#006400">+= </font>x</font><font color="#006400"><font size="2">;<br />
</font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></font></p>
<p><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result <font color="#006400">= (</font>listaControllo<font color="#006400">.</font><b><font color="#191970">Substring</font></b></font><font size="2"><font color="#006400">(</font>somma <font color="#006400">% </font><font color="#00008b">26</font><font color="#006400">,</font><font color="#00008b">1</font><font color="#006400">) == </font>CodiceFiscale<font color="#006400">.</font><b><font color="#191970">Substring</font></b></font><font size="2"><font color="#006400">(</font><font color="#00008b">15</font><font color="#006400">,</font><font color="#00008b">1</font></font><font color="#006400"><font size="2">));<br />
</font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
</font></font><font size="2"><font color="#000080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return </font>result</font><font color="#006400"><font size="2">;<br />
</font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></font></p>
<p><font color="#006400"><font size="2">&nbsp;&nbsp;&nbsp; }</font></p>
<p><font size="2">}</font></p>
<p></font></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/marcosessa.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/marcosessa.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marcosessa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marcosessa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marcosessa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marcosessa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marcosessa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marcosessa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marcosessa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marcosessa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marcosessa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marcosessa.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=10&subd=marcosessa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marcosessa.wordpress.com/2006/04/19/check-codice-fiscale-c/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfc7b43fe04a77105308779c3f23f61a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">marcosessa</media:title>
		</media:content>
	</item>
		<item>
		<title>Check &#8216;Codice Fiscale&#8217; &#8211; VB.NET</title>
		<link>http://marcosessa.wordpress.com/2006/04/19/check-codice-fiscale-vbnet/</link>
		<comments>http://marcosessa.wordpress.com/2006/04/19/check-codice-fiscale-vbnet/#comments</comments>
		<pubDate>Wed, 19 Apr 2006 12:15:43 +0000</pubDate>
		<dc:creator>marcosessa</dc:creator>
				<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">https://marcosessa.wordpress.com/2006/04/19/check-codice-fiscale-vbnet/</guid>
		<description><![CDATA[VB.NET 
 Imports System
Imports System.Text
Imports System.Text.RegularExpressions
 Namespace Verifiche
&#160;&#160;&#160;&#160; Public Class CodiceFiscale
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Public Sub New()
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; End Sub
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Public Shared Function CheckCodiceFiscale(ByVal CodiceFiscale As String) As Boolean
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim result As Boolean = False
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Const caratteri As Integer = 16
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; If CodiceFiscale Is Nothing Then
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Return result
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; End If
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; If CodiceFiscale.Length &#60; caratteri Then
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Return PartitaIva.CheckPartitaIva(CodiceFiscale)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; End If
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=9&subd=marcosessa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><font color="#006400"><font color="#000000" size="2"><u>VB.NET </u></font></p>
<p><font size="2"><font color="#0000ff" size="2"> </font><font color="#0000ff" size="2">Imports </font><font size="2"><font color="#000000">System<br />
</font></font><font color="#0000ff" size="2">Imports </font><font size="2"><font color="#000000">System.Text<br />
</font></font><font color="#0000ff" size="2">Imports </font><font size="2"><font color="#000000">System.Text.RegularExpressions</font></font></p>
<p><font color="#0000ff" size="2"> </font><font color="#0000ff" size="2">Namespace </font><font size="2"><font color="#000000">Verifiche</font></font></p>
<p><font size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp; Public Class </font><font size="2">CodiceFiscale<br />
</font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Public Sub New</font><font size="2">()<br />
</font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Sub</font></font></p>
<p><font size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Public Shared Function </font><font color="#000000" size="2">CheckCodiceFiscale(</font><font color="#0000ff" size="2">ByVal </font><font color="#000000" size="2">CodiceFiscale </font><font color="#0000ff" size="2">As String</font><font color="#000000" size="2">) </font><font color="#0000ff" size="2">As Boolean<br />
&nbsp;</font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim </font><font color="#000000" size="2">result </font><font color="#0000ff" size="2">As Boolean </font><font color="#000000" size="2">= </font><font color="#0000ff" size="2">False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Const </font><font color="#000000" size="2">caratteri </font><font color="#0000ff" size="2">As Integer </font><font size="2"><font color="#000000">= 16<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If </font><font size="2"><font color="#000000">CodiceFiscale</font> </font><font color="#0000ff" size="2">Is Nothing Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return </font><font size="2"><font color="#000000">result<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If</font></font></p>
<p><font size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If </font><font color="#000000" size="2">CodiceFiscale.Length &lt; caratteri </font><font color="#0000ff" size="2">Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return </font><font size="2"><font color="#000000">PartitaIva.CheckPartitaIva(CodiceFiscale)<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If</font></font></p>
<p><font size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Not </font><font color="#000000" size="2">(CodiceFiscale.Length = caratteri) </font><font color="#0000ff" size="2">Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return </font><font size="2"><font color="#000000">result<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If</font></font></p>
<p><font size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Const </font><font color="#000000" size="2">omocodici </font><font color="#0000ff" size="2">As String </font><font size="2"><font color="#000000">= &quot;LMNPQRSTUV&quot;<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Const </font><font size="2"><font color="#000000">listaControllo</font> </font><font color="#0000ff" size="2">As String </font><font size="2">= <font color="#000000">&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;</font></font></font></p>
<p><font size="2"><font size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim </font><font size="2"><font color="#000000">listaPari</font> </font><font color="#0000ff" size="2">As Integer</font><font size="2">() = <font color="#000000">{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25}<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim </font><font size="2"><font color="#000000">listaDispari</font> </font><font color="#0000ff" size="2">As Integer</font><font size="2">() = <font color="#000000">{1, 0, 5, 7, 9, 13, 15, 17, 19, 21, 2, 4, 18, 20, 11, 3, 6, 8, 12, 14, 16, 10, 22, 25, 24, 23}</font></font></font></font></p>
<p><font size="2"><font size="2"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#000000">CodiceFiscale = CodiceFiscale.ToUpper<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim </font><font size="2"><font color="#000000">cCodice</font> </font><font color="#0000ff" size="2">As Char</font><font size="2">() <font color="#000000">= CodiceFiscale.ToCharArray</font></font></font></font></p>
<p><font size="2"><font size="2"><font size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim </font><font color="#000000" size="2">k </font><font color="#0000ff" size="2">As Integer<font color="#000000"> </font></font><font size="2"><font color="#000000">= 0</font></font></font></font></font></p>
<p><font size="2"><font size="2"><font size="2"><font size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff" size="2">For </font><font size="2"><font color="#000000">k =&nbsp;6</font> </font><font color="#0000ff" size="2">To </font><font size="2"><font color="#000000">14</font><br />
</font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If </font><font size="2"><font color="#000000">(k = <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> </font>OrElse <font color="#000000">(k = 11)</font> </font><font color="#0000ff" size="2">Then<br />
</font></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim </font><font color="#000000" size="2">x </font><font color="#0000ff" size="2">As Integer </font><font size="2"><font color="#000000">= (omocodici.<font color="#0000ff">IndexOf</font>(cCodice(k)))<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Not </font><font size="2"><font color="#000000">(x = -1)</font> </font><font color="#0000ff" size="2">Then<br />
</font><font size="2"><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cCodice(k) = x.<font color="#0000ff">ToString.ToCharArray</font>(0)<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next</font></font></font></font></font></font></p>
<p><font size="2"><font size="2"><font size="2"><font size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000ff" size="2"> &#39;Dim </font><font color="#000000" size="2">rgx </font><font color="#0000ff" size="2">As </font><font color="#000000" size="2">Regex = </font><font color="#0000ff" size="2">New </font><font size="2"><font color="#000000">Regex(&quot;^[A-Z]{6}[]{2}[A-Z][]{2}[A-Z][]{3}[A-Z]$&quot;)</font></font><font color="#0000ff" size="2"><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;Dim </font><font size="2"><font color="#000000">m</font> </font><font color="#0000ff" size="2">As </font><font size="2"><font color="#0000ff">Match</font> = <font color="#000000">rgx</font>.<font color="#0000ff">Match</font>(</font><font color="#0000ff" size="2">New String</font><font size="2">(<font color="#000000">cCodice</font>))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;<font color="#000000">result = m</font>.Success<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result = True</font><font size="2"><br />
</font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If </font><font size="2"><font color="#000000">result</font> </font><font color="#0000ff" size="2">Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim </font><font color="#000000" size="2">somma </font><font color="#0000ff" size="2">As Integer </font><font size="2"><font color="#000000">= 0<br />
<font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cCodice </font><font color="#006400" size="2">= </font><font size="2">CodiceFiscale</font><font color="#006400" size="2">.</font><b><font color="#191970" size="2">ToCharArray</font></b><br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim </font><font size="2">i </font><font color="#0000ff" size="2">As Integer </font><font size="2"><font color="#000000">= 0<br />
</font></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">For</font> <font color="#000000">i = 0</font> <font color="#0000ff">To</font> <font color="#000000">14<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim </font><font size="2"><font color="#000000">c</font> </font><font color="#0000ff" size="2">As Char </font><font size="2"><font color="#000000">= cCodice(i)<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim </font><font color="#000000" size="2">x </font><font color="#0000ff" size="2">As Integer </font><font size="2"><font color="#000000">= &quot;0123456789&quot;.<font color="#0000ff">IndexOf</font>(c)<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Not </font><font size="2"><font color="#000000">(x = -1)</font> </font><font color="#0000ff" size="2">Then<br />
</font><font size="2"><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c = listaControllo.<font color="#0000ff">Substring</font>(x, 1).<font color="#0000ff">ToCharArray</font>(0)<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
</font><font size="2"><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x = listaControllo.<font color="#0000ff">IndexOf</font>(c)<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If </font><font color="#000000"><font size="2">(i </font><font size="2"><font color="#0000ff">Mod</font> </font></font><font size="2"><font color="#000000">2) = 0</font> </font><font color="#0000ff" size="2">Then<br />
</font><font size="2"><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x = listaDispari(x)<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br />
</font><font size="2"><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x = listaPari(x)<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If</font><font size="2"><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;somma += x<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">Next<br />
</font></font><font color="#000000" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result = (listaControllo.<font color="#0000ff">Substring</font>(somma </font><font color="#0000ff" size="2">Mod </font><font size="2"><font color="#000000">26, 1) = CodiceFiscale.<font color="#0000ff">Substring</font>(15, 1))<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return </font><font size="2"><font color="#000000">result<br />
</font></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Function</font></font></font></font></font></p>
<p><font size="2"><font size="2"><font size="2"><font size="2"><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp; End Class<br />
End Namespace</p>
<p></font></font></font> 	</font></font></font></font></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/marcosessa.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/marcosessa.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marcosessa.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marcosessa.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marcosessa.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marcosessa.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marcosessa.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marcosessa.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marcosessa.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marcosessa.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marcosessa.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marcosessa.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=9&subd=marcosessa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marcosessa.wordpress.com/2006/04/19/check-codice-fiscale-vbnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfc7b43fe04a77105308779c3f23f61a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">marcosessa</media:title>
		</media:content>
	</item>
		<item>
		<title>Disable or Enable Text Fields by clicking a CheckBox &#8211; JAVASCRIPT</title>
		<link>http://marcosessa.wordpress.com/2006/04/19/disable-or-enable-text-fields-by-clicking-a-checkbox-javascript/</link>
		<comments>http://marcosessa.wordpress.com/2006/04/19/disable-or-enable-text-fields-by-clicking-a-checkbox-javascript/#comments</comments>
		<pubDate>Wed, 19 Apr 2006 10:32:17 +0000</pubDate>
		<dc:creator>marcosessa</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">https://marcosessa.wordpress.com/2006/04/19/disable-or-enable-text-fields-by-clicking-a-checkbox-javascript/</guid>
		<description><![CDATA[function UsernamePasswordBox() {
var value = document.getElementById(&#8216;login_as_guest&#8217;).checked;
if (value == true){
document.getElementById(&#8216;login&#8217;).disabled=true;
document.getElementById(&#8216;pass&#8217;).disabled=true;
}
else{
document.getElementById(&#8216;login&#8217;).disabled=false;
document.getElementById(&#8216;pass&#8217;).disabled=false;
}
}
In Body:
Login:
&#60;input class=&#8221;text&#8221; name=&#8221;login&#8221; id=&#8221;login&#8221; value=&#8221;" type=&#8221;text&#8221; title=&#8221;"&#62;
Password:
&#60;input class=&#8221;password&#8221; name=&#8221;pass&#8221; id=&#8221;pass&#8221; value=&#8221;" type=&#8221;password&#8221; title=&#8221;"&#62;
Login as a guest: &#60;input name=&#8221;login_as_guest&#8221; id=&#8221;login_as_guest&#8221; type=&#8221;checkbox&#8221; title=&#8221;"  onclick=&#8221;UsernamePasswordBox()&#8221;&#62; 
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=7&subd=marcosessa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>function UsernamePasswordBox() {<br />
var value = document.getElementById(&#8216;login_as_guest&#8217;).checked;<br />
if (value == true){<br />
document.getElementById(&#8216;login&#8217;).disabled=true;<br />
document.getElementById(&#8216;pass&#8217;).disabled=true;<br />
}<br />
else{<br />
document.getElementById(&#8216;login&#8217;).disabled=false;<br />
document.getElementById(&#8216;pass&#8217;).disabled=false;<br />
}<br />
}</p>
<p>In Body:</p>
<p><strong>Login:</strong></p>
<p>&lt;input class=&#8221;text&#8221; name=&#8221;login&#8221; <strong>id=&#8221;login&#8221;</strong> value=&#8221;" type=&#8221;text&#8221; title=&#8221;"&gt;</p>
<p><strong>Password:</strong></p>
<p>&lt;input class=&#8221;password&#8221; name=&#8221;pass&#8221; <strong>id=&#8221;pass&#8221;</strong> value=&#8221;" type=&#8221;password&#8221; title=&#8221;"&gt;</p>
<p><strong>Login as a guest:</strong> &lt;input name=&#8221;login_as_guest&#8221; id=&#8221;login_as_guest&#8221; type=&#8221;checkbox&#8221; title=&#8221;"  <strong>onclick=&#8221;UsernamePasswordBox()&#8221;&gt; </strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/marcosessa.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/marcosessa.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marcosessa.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marcosessa.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marcosessa.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marcosessa.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marcosessa.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marcosessa.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marcosessa.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marcosessa.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marcosessa.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marcosessa.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=7&subd=marcosessa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marcosessa.wordpress.com/2006/04/19/disable-or-enable-text-fields-by-clicking-a-checkbox-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfc7b43fe04a77105308779c3f23f61a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">marcosessa</media:title>
		</media:content>
	</item>
		<item>
		<title>Enable and Disable Form Elements &#8211; Javascript</title>
		<link>http://marcosessa.wordpress.com/2006/04/07/enable-and-disable-form-elements-javascript/</link>
		<comments>http://marcosessa.wordpress.com/2006/04/07/enable-and-disable-form-elements-javascript/#comments</comments>
		<pubDate>Fri, 07 Apr 2006 10:24:00 +0000</pubDate>
		<dc:creator>marcosessa</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">https://marcosessa.wordpress.com/2006/04/07/enable-and-disable-form-elements-javascript/</guid>
		<description><![CDATA[This is a relatively little known and under-used feature of javascript which can be very useful in guiding a user through a form. Using the disabled tag, you can switch on  and off elements in a form.
Here is a standard text field:
Now here it is again, disabled:
Try typing in the second box, and you&#39;ll [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=6&subd=marcosessa&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is a relatively little known and under-used feature of javascript which can be very useful in guiding a user through a form. Using the disabled tag, you can switch on  and off elements in a form.</p>
<p>Here is a standard text field:</p>
<p>Now here it is again, disabled:</p>
<p>Try typing in the second box, and you&#39;ll see that you can&#39;t &#8211; it&#39;s been disabled.  You can do the same any other elements in a form &#8211; checkboxes, selection boxes and the rest.</p>
<h2>Disabling Form Elements &#8211; Common Uses</h2>
<p>One common use of this is to only enable the element, once the appropriate field has been selected earlier in the form.</p>
<p>Now here&#39;s a practical example. The &#39;explain your choice&#39; field only becomes enabled when I have selected the answer to Question 1. Before selecting a radio button, try typing in the text field &#8211; you can&#39;t!</p>
<form name="form22"> <b>Question 1</b></p>
<table>
<tr>
<td>Answer a:<br />
Answer b:</td>
</tr>
<tr>
<td valign="top"><b>Explain your choice:</b></td>
</tr>
</table>
</form>
<h2>Disabling Form Elements &#8211; How it&#39;s done</h2>
<p>To disable an element, put the phrase <font color="blue">disabled=&quot;true&quot;</font> within the element tag.</p>
<p>Once you&#39;ve set the disabled tag, you can enable it using something like the following code:</p>
<table align="center" bgcolor="black" cellspacing="0" width="100%">
<tr>
<td>
<table bgcolor="white" cellpadding="4" cellspacing="4" width="100%">
<tr>
<td>
<pre>&lt;script language=&quot;javascript&quot;&gt;

function enableField()
{
document.form1.address2.disabled=false;
}

&lt;/script&gt;

&lt;a href=&quot;javascript:enableField()&quot;&gt;Click here to enable the element&lt;a/&gt;</pre>
</td>
<td>&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
<p>With disabled set to false, the form element becomes useable.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/marcosessa.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/marcosessa.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marcosessa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marcosessa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marcosessa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marcosessa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marcosessa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marcosessa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marcosessa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marcosessa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marcosessa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marcosessa.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marcosessa.wordpress.com&blog=166725&post=6&subd=marcosessa&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marcosessa.wordpress.com/2006/04/07/enable-and-disable-form-elements-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfc7b43fe04a77105308779c3f23f61a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">marcosessa</media:title>
		</media:content>
	</item>
	</channel>
</rss>