Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

value

Conditional and Null-Coalescing Operators (?: and ??)
Wednesday, 14 December 2011 01:03
In code you want to assign one variable to another, but only if the variable is not null. If it is null, you want to populate the target variable with another value. The code normally may look like this using the C# Conditional Operator:

string fileName = tempFileName != null ? tempFileName : "Untitled";


If tempFileName is not null, fileName = tempFileName, else fileName = “Untitled“.
This can now be abbreviated as follows using the Null-Coalescing Operator:

string fileName = tempFileName ?? "Untitled";


The logic is the same. If tempFileName is not null, fileName = tempFileName, else fileName = “Untitled“.
The Null-Coalescing Operator comes up a lot with nullable types, particular when converting from a nullable type to its value type:

int? count = null;
int amount = count ?? default(int);


Since count is null, amount will now be the default value of an integer type ( zero ).

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/GH4PJob4sNg/14169

 
Hibernate mapping of a Map having an Enum key
Thursday, 08 December 2011 09:27


@CollectionOfElements
@JoinTable(
name = "TRACE_PROPERTY",
joinColumns = { @JoinColumn(name = "TRACE_ID") },
uniqueConstraints = { @UniqueConstraint(columnNames = {"TRACE_ID", "NAME", "VALUE" }) })
@org.hibernate.annotations.MapKey(
columns = @Column(name = "NAME", nullable = false, length = 100),
type = @Type(
type = "org.hibernate.type.EnumType",
parameters = {
@Parameter(name = "enumClass", value = "x.y.z.ExternalPropertyName"),
@Parameter(name = "type", value = "12")}))
@Column(name = "VALUE", nullable = false, length = 255)
private Map properties = new HashMap();

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/f0UGHDoYe14/14105

 
Access parent data array from nested jQuery templates
Wednesday, 24 August 2011 18:43






// underscore.js mixin to find list class, not relevant to finding the index in jquery.tmpl, but useful otherwise.
_.mixin({
indexClass: function(index, length) {
var result;
result = index % 2 === 0 ? "even" : "odd";
if (index === 0) {
result += " first";
} else if (index === length - 1) {
result += " last";
}
return result;
}
});

columns = []
columns.push({title: "First Column", position: 0, terms: [{key: "One", value: 1, position: 0}, {key: "Two", value: 2, position: 1}]});
columns.push({title: "Middle Column", position: 1, terms: [{key: "A", value: "a", position: 0}, {key: "B", value: "b", position: 1}]});
columns.push({title: "Last Column", position: 2, terms: [{key: "X", value: "x", position: 0}, {key: "Y", value: "y", position: 1}]});
$("#section-template").tmpl({title: "Managing Lists in jQuery.tmpl" columns:columns}).appendTo("body")

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/wS5ov0HvDe4/13589

 
Various - Maybe useful
Monday, 08 August 2011 03:22
// Various - Maybe useful
Free shipping Xanax. Xanax overseas. Buy Xanax in Milwaukee. Order Lorazepam online by fedex. Herbal Lorazepam. Next day delivery Lorazepam.

function setActiveStyleSheet(title)
{
var i, a, main;

// find an loop through all the elements in the document
for (i = 0; (a = document.getElementsByTagName("link")[i]); i++)
{
// disable all the stylesheet
if (a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("title"))

a.disabled = true;

// if it is the stylesheet requested, then enable it
if (a.getAttribute("title") == title)
a.disabled = false;
}
}


// Jumble addresses
function decryptEmail() {
for(i=0; i<= document.links.length-1; i++) {
var str = new String(document.links[i].href);
document.links[i].href =
str.replace(/^mail:([^\?]+)(\?.+)?$/,"mailto:$ This e-mail address is being protected from spambots. You need JavaScript enabled to view it $2");
}
}


var __PNGReplace = "png.gif";

function changePngForIEWin()
{

imgs = document.getElementsByTagName("img");

for (var i = imgs.length; i-- > 0;)
{
if(imgs[i].src.indexOf(".png") > 0)
{
imgs[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/ + imgs[i].src + ",sizingMethod=scale)";

imgs[i].width = imgs[i].width;
imgs[i].height = imgs[i].height;

imgs[i].src = __PNGReplace;
}

}
}

function setCookie(name, value, expires, path, domain, secure)
{

document.cookie= name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}

/*
Gets the value of the specified cookie.


name Name of the cookie to get the value of.

Returns a string containing value of specified cookie, or null if cookie does not exist.
*/

function getCookie(name)
{

var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);


if (begin == -1)
{
begin = dc.indexOf(prefix);
if (begin != 0) return null;
}
else
{
begin += 2;
}


var end = document.cookie.indexOf(";", begin);


if (end == -1)
{
end = dc.length;
}

return unescape(dc.substring(begin + prefix.length, end));
}

function PreloadImages()
{
//alert("number of images to load: " + PreloadImages.arguments.length);

// var arr = new Array(PreloadImages.arguments.length);
for(var c = PreloadImages.arguments.length; c -- > 0;)
{
_img = new Image();
_img.src = PreloadImages.arguments[c];
}

}

function setLinkedStyleSheet(title)
{
var linkNodes = document.getElementsByTagName("link");
for ( i = 0; i < linkNodes.length; i++ )
{
linkNode = linkNodes[i];
relAttr = linkNode.getAttribute('rel');
if ( relAttr && ( relAttr.indexOf("style") != -1 ) && linkNode.getAttribute("title") )
{
linkNode.disabled = true;

if ( linkNode.getAttribute("title") == title )
linkNode.disabled = false;
}
}
}

// function for changing stylesheets using document.styleSheets
function setStyleSheet(theme)
{
for ( i = 0; i < document.styleSheets.length; i++ )
{
if ( document.styleSheets[i].title )
{
document.styleSheets[i].disabled = true;

if ( document.styleSheets[i].title == theme )

document.styleSheets[i].disabled = false;
}
}
}

Adipex online without prescription. Buy Adipex in Milwaukee. Adipex buy in UK. Purchase of Klonopin online without a prescription. How to get prescribed Klonopin o

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/G324wbrVEog/13493

 
VB.net List of US States
Thursday, 24 March 2011 19:26
// Here is a quick and dirty class to create a bindable list of states and abbreviations for vb.net which can also be used in Silverlight


Public Class clsStates

Sub New(sName As String, sAbbrev As String)
_StateName = sName
_Abbreviation = sAbbrev
End Sub

Private _StateName As String
Public Property StateName() As String
Get
Return _StateName
End Get
Set(ByVal value As String)
_StateName = value
End Set
End Property

Private _Abbreviation As String
Public Property Abbreviation() As String
Get
Return _Abbreviation
End Get
Set(ByVal value As String)
_Abbreviation = value
End Set
End Property

End Class

Public Class Globals

Private _States As List(Of clsStates)
Public Property States() As List(Of clsStates)
Get
If _States Is Nothing Then
_States = New List(Of clsStates)
End If

If _States.Count = 0 Then
FillStates()
End If

Return _States
End Get
Set(ByVal value As List(Of clsStates))
_States = value
End Set
End Property

Private Sub FillStates()
_States.Add(New clsStates("Alabama", "AL"))
_States.Add(New clsStates("Alaska", "AK"))
_States.Add(New clsStates("Arizona", "AZ"))
_States.Add(New clsStates("Arkansas", "AR"))
_States.Add(New clsStates("California", "CA"))
_States.Add(New clsStates("Colorado", "CO"))
_States.Add(New clsStates("Connecticut", "CT"))
_States.Add(New clsStates("Delaware", "DE"))
_States.Add(New clsStates("District Of Columbia", "DC"))
_States.Add(New clsStates("Florida", "FL"))
_States.Add(New clsStates("Georgia", "GA"))
_States.Add(New clsStates("Hawaii", "HI"))
_States.Add(New clsStates("Idaho", "ID"))
_States.Add(New clsStates("Illinois", "IL"))
_States.Add(New clsStates("Indiana", "IN"))
_States.Add(New clsStates("Iowa", "IA"))
_States.Add(New clsStates("Kansas", "KS"))
_States.Add(New clsStates("Kentucky", "KY"))
_States.Add(New clsStates("Louisiana", "LA"))
_States.Add(New clsStates("Maine", "ME"))
_States.Add(New clsStates("Maryland", "MD"))
_States.Add(New clsStates("Massachusetts", "MA"))
_States.Add(New clsStates("Michigan", "MI"))
_States.Add(New clsStates("Minnesota", "MN"))
_States.Add(New clsStates("Mississippi", "MS"))
_States.Add(New clsStates("Missouri", "MO"))
_States.Add(New clsStates("Montana", "MT"))
_States.Add(New clsStates("Nebraska", "NE"))
_States.Add(New clsStates("Nevada", "NV"))
_States.Add(New clsStates("New Hampshire", "NH"))
_States.Add(New clsStates("New Jersey", "NJ"))
_States.Add(New clsStates("New Mexico", "NM"))
_States.Add(New clsStates("New York", "NY"))
_States.Add(New clsStates("North Carolina", "NC"))
_States.Add(New clsStates("North Dakota", "ND"))
_States.Add(New clsStates("Ohio", "OH"))
_States.Add(New clsStates("Oklahoma", "OK"))
_States.Add(New clsStates("Oregon", "OR"))
_States.Add(New clsStates("Pennsylvania", "PA"))
_States.Add(New clsStates("Rhode Island", "RI"))
_States.Add(New clsStates("South Carolina", "SC"))
_States.Add(New clsStates("South Dakota", "SD"))
_States.Add(New clsStates("Tennessee", "TN"))
_States.Add(New clsStates("Texas", "TX"))
_States.Add(New clsStates("Utah", "UT"))
_States.Add(New clsStates("Vermont", "VT"))
_States.Add(New clsStates("Virginia", "VA"))
_States.Add(New clsStates("Washington", "WA"))
_States.Add(New clsStates("West Virginia", "WV"))
_States.Add(New clsStates("Wisconsin", "WI"))
_States.Add(New clsStates("Wyoming", "WY"))
End Sub
End Class

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/PcNo7lYU7hQ/13051

 


Taxonomy by Zaragoza Online