Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Easing any attribute of any MC

// Easing any attribute of any MC
Buy Zolpidem 10 mg in Seattle. Online pharmacy Zolpidem medication. Zolpidem 10mg EM Diazepam uk without a perscription. Generic diazepam online purchase saturday delive
//****************************************************************************//
//   Easing any attribute of any MC                                           //
//   (c) Copyright 2007                   All Rights Reserved                 //
//   Rishi Ishairzay                      me@nukreations.com                  //
//   Created 8/01/2007                    Last Modified 8/01/2007             //
//****************************************************************************//

//t:String   is target attribute to be eased
//v:Float    is target value of attribute
//s:Float    is ease amount ( > 0, < 1)
//r:Boolean  set to true if you want pixel snapping

//calls endEase when easing is complete

MovieClip.prototype.ease = function(t, v, s, r) {
	if (this["_ease_"+t] instanceof MovieClip) {
		this["_ease_"+t].removeMovieClip();
	}
	mc = this.createEmptyMovieClip("_ease_"+t, this.getNextHighestDepth());
	if (s == null) {
		s = .4;
	}
	mc.onEnterFrame = function() {
		if (d == null) {
			d = this._parent[t];
		}
		this._parent[t] += (v-this._parent[t])*s;
		if (r) {
			this._parent[t] = Math.round(this._parent[t]);
		}
		if (Math.abs(this._parent[t]-d)<.05) {
			this._parent[t] = v;
			this._parent.endEase(t);
			delete this.onEnterFrame;
			this.removeMovieClip();
		}
	};
};

Nextday Ativan sublingual. Buy free overnight pharmacy Ativan cost. Ativan 2 mg with Buy Ambien cr no prescription cod. Purchase Ambien COD. Overnight cheap Ambien. Buy

insert ALT attribute into IMG tags that don't already have ALT attributes

// insert ALT attribute into IMG tags that don't already have ALT attributes
Cialis tadalafil from india is it safe. Where can i buy Cialis tadalafil online. Cial Buy Phentermine 37.5 in Minneapolis. Free overnight pharmacy Phentermine p. Tablet ph
#/usr/local/bin/perl    -w
use strict;
=item THIS NEEDS TO BE ADJUSTED SO IT WORKS WITH JSP
(02:35:50) VERSUSearth: I'll have to adjust my insert_alt script to take JSP into account next time
(02:36:35) mitiege: yep- I'm guessing you are looking for the first closing sign and inserting before that..
(02:36:47) mitiege: a simple fix would be to put the alt first in the img tag...
(02:37:06) VERSUSearth: yeah that's probably a good idea
=cut


$^I=".bk";

#undef $/;           # read in whole file, not just one line

my $text = "" ;    #Insert blank alt attribute

while (<>) {

	#m{<title>(.*?)</title>}ix;
	#my $text = $1;    #Use the document title as the ALT text

	unless (m{<img.*?alt=.*?>}ix){
		s{(<img)(.*?)>}{$1$2 alt="$text">}gsix;
	}
	print "$_";

}

Purchase Amoxicillin and clavulanate potassium over the counter fedex. I want a 875 m Who makes Valtrex 1 gram. Valtrex coupon fedex no prescription. Cheap non prescriptio

Access attribute in List inside Map

// Access attribute in List inside Map
Generic Valium online. C.o.d Valium. Valium online no perscription. Valium cod saturday delivery fedex. Free shipping Valium. Order Viagra online. Viagra non prescription. Viagra free usa shipping. No prescription Viagra with fedex. Fedex delivery Via
<c:forEach items="${personlist}" var="mapEntry" varStatus="status">
  ${mapEntry.value[0].person.name}
  ${mapEntry.value[status.index].person.name}
</c:forEach>

No perscription Zolpidem next day. Zolpidem delivery to US Indiana. Getting prescribed Zolpidem. Zolpidem ups. Zolpidem no pr Diazepam shipped cash on delivery. Diazepam on line cash on delivery. Diazepam delivered cod fedex. Price of Diazepam in the

working with XML (find out if element or attribute exists)

// working with XML (find out if element or attribute exists)
Valtrex delivery to US Vermont. Buy cheap fedex Valtrex. Purchase Valtrex cod shippi Buy Flagyl no scams. Online purchase Flagyl. Flagyl delivery to US Nevada.
create table xtest01(col1 xmltype);
insert into xtest01 values ('<car><model>Audi TT</model></car>');
insert into xtest01 values ('<car model="BMW X5"/>');
select x.col1.extract('//car/model/text()').getstringval() from xtest01 x;
select x.col1.extract('//car/@model').getstringval() from xtest01 x; 
select * from xtest01 x where x.col1.existsnode('//car')  = 1;

Carisoprodol for sale online. Canadian prescriptions Carisoprodol. A good website to Ordering Codeine online. Buy Codeine without a prescription. Codeine on line.

Django: access the attributes of a model dynamically

// example: a method on a model that outputs a list of tuples with (attribute_name.verbose, attribute_value)

	def attrs_verbose(self):
		model = self.__class__
		# using this form: Record._meta.get_field('created_by').verbose_name
		items = []
		for k, v in self.__dict__.items():
			try:
				x = model._meta.get_field(k).verbose_name
			except:
				x = k
			items += [(x, v)]
		items.sort()
		return items

<xsl:attribute> bygga upp href, img element osv

<img>
<xsl:attribute name="src">
<xsl:value-of select="@url"/>
</xsl:attribute>
</img>

Outputen blir

<img src="xml-urlen">


Bygga upp länk, href med url data från xmlen:

<a>
<xsl:attribute name="href">
<xsl:call-template name="HREF_BUILD"/>
</xsl:attribute>
<xsl:call-template name="Les flere nyheter"/>


Länkens namn

<img src="{$urlroot}filestore/{ATTRIBUTES/ATTRIBUTE[LABEL = 'eventImage']/VALUE/FILE/FILENAME}"/>

Outputen blir

Länkens namn



xsl:attribute

The xsl:attribute allows you to add an attribute to an element. This element is often used when you need to add a source(src) to an image. Remembering that in HTML an img tag is still an element in XML term. So when we are wanting to add any of these attributes to elements, you need to use this technique.

appendInputTypeClasses() - IE attribute selectors for form inputs

(Stolen from Jeremy Keith and Dustin Diaz: http://domscripting.com/blog/display/38).

Unobtrusive script takes a form inputs type attribute and copies it to that input's class. So, you go from...

<input type="text" />


...to...

<input type="text" class="text" />


Basically allows attribute selectors for form until IE catches up.

/*
	form.js
	AUTH: Austin Govella (austin.govella@gmail.com)
	DATE: 2006-07-01
	DESC: Includes form specific javascripts.
	NOTE: Stolen from Jeremy Keith and Dustin Diaz: http://domscripting.com/blog/display/38
	REVS:  
*/



function appendInputTypeClasses()
{	/* adds input type as the inputs class */
	if ( !document.getElementsByTagName ) return;

	var inputs = document.getElementsByTagName('input');
	var inputLen = inputs.length;
	for ( i=0; i < inputLen; i++ )
	{
		if ( inputs[i].getAttribute('type') )
		{
			inputs[i].className += ' '+inputs[i].getAttribute('type');
		}
	}
}