Agile Zone is brought to you in partnership with:
DZone 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
  • submit to reddit
Curtis Lassam08/23/14
813 views
0 replies

Cube Drone #2: Nyan

From software developer Curtis Lassam (who writes about comics and code) comes a comic series called Cube Drone. This is Cube Drone #2: Nyan.

Kin Lane08/22/14
6216 views
1 replies

Sorry Google, Your Programming Test Is Not A Valid Measurement Of My Skills

I understand that you have to qualify large number of folks, at your very algorithmic-centric company, but when it comes to measuring what I do, a programming test isn’t a thing.

Giuseppe Vettigli08/22/14
2337 views
0 replies

Quick HDF5 with Pandas

HDF5 is a format designed to store large numerical arrays of homogenous type. It cames particularly handy when you need to organize your data models in a hierarchical fashion and you also need a fast way to retrieve the data. Pandas implements a quick and intuitive interface for this format and in this post will shortly introduce how it works.

Abby Fichtner08/22/14
3464 views
0 replies

Why We Need to Teach Kids to Code

Coding (computer programming) is the art of creating anything from computer games and iPhone apps to computational models that help us improve health care. As our kids grow up, this ability to code will become as fundamental as reading and writing to their success, regardless of what occupation they ultimately choose.

Nikita Salnikov...08/22/14
1753 views
0 replies

Classloading and locking

This post is inspired by Pierre-Hugues Charbonneau’s article on how loading non-existing classes can severely hurt your performance. This brought back memories from a debugging session where the same problem surfaced a bit differently.

Chen Harel08/22/14
1769 views
0 replies

Route 53 Benchmark: The New AWS Geolocation's Surprising Results

How to choose between Geolocation and Latency routing? We tested DNS configurations across multiple EC2 regions using AWS Route 53 to find out

Chandra Munagavalasa08/22/14
1633 views
0 replies

Maximize your Customer Value – Think Lean, Go Lean and Stay Lean

Lean is more than just minimizing waste. A popular misconception of Lean is that it is suited only for manufacturing. In this article I will be discussing non-value added process and implementing Lean in software development.

Derwyn Harris08/21/14
6935 views
0 replies

The Need To Review The Agile Manifesto

Since the Agile Manifesto was published in 2001 much has changed. It's time to rethink yesterday’s manifesto in a new light and deconstruct which concepts were home runs and which still need to evolve.

Eric Minick08/21/14
3429 views
0 replies

The argument for testing performance in production

Performance testing still has its place. It’s awesome for existing applications when looking for changes that degrade performance, and for major application launches where the scalability absolutely has to be right the first time.

Michael Crump08/21/14
3095 views
0 replies

My Angular App is Broken after Upgrading to the Latest Beta

I have been experimenting with AngularJS for a couple of months. After upgrading to 1.3.0-beta.18, I noticed the following code didn't work. I was previously using the latest stable build which is 1.2.22 as shown below:

Robert Diana08/21/14
3445 views
0 replies

Geek Reading August 20, 2014

These items are a combination of tech business news, development news and programming tools and techniques.

Ayende Rahien08/21/14
3696 views
5 replies

Question 6 is a trap, a very useful one

In my interview questions, I give candidates a list of 6 questions. They can either solve 3 questions from 1 to 5, or they can solve question 6. Question 6 requires that you create an index for a 15 TB CSV file, and allow efficient searching on it. While questions 1 – 5 are basically gate keeper questions.

//Code sample shows how to create content control of type rich text box.

//[C# code sample]

Document doc = new Document();
StructuredDocumentTag sdtRichText = new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Block);

Paragraph para = new Paragraph(doc);
Run run = new Run(doc);
run.Text = "Hello World";
run.Font.Color = Color.Green;
para.Runs.Add(run);
sdtRichText.ChildNodes.Add(para);
doc.FirstSection.Body.AppendChild(sdtRichText);

doc.Save(MyDir + "Out.docx");

//[VB Code Sample]

Dim doc As New Document()
Dim sdtRichText As New StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Block)

Dim para As New Paragraph(doc)
Dim run As New Run(doc)
run.Text = "Hello World"
run.Font.Color = Color.Green
para.Runs.Add(run)
sdtRichText.ChildNodes.Add(para)
doc.FirstSection.Body.AppendChild(sdtRichText)

doc.Save(MyDir & "Out.docx")
 
//Code samples for how to create content control of type combo box.

//[C# code sample]

Document doc = new Document();
StructuredDocumentTag sdt = new StructuredDocumentTag(doc, SdtType.ComboBox, MarkupLevel.Block);

sdt.ListItems.Add(new SdtListItem("Choose an item", "-1"));
sdt.ListItems.Add(new SdtListItem("Item 1", "1"));
sdt.ListItems.Add(new SdtListItem("Item 2", "2"));
doc.FirstSection.Body.AppendChild(sdt);

doc.Save(MyDir + "Out.docx");
 
//[VB Code Sample]

Dim doc As New Document()
Dim sdt As New StructuredDocumentTag(doc, SdtType.ComboBox, MarkupLevel.Block)

sdt.ListItems.Add(New SdtListItem("Choose an item", "-1"))
sdt.ListItems.Add(New SdtListItem("Item 1", "1"))
sdt.ListItems.Add(New SdtListItem("Item 2", "2"))
doc.FirstSection.Body.AppendChild(sdt)

doc.Save(MyDir & "Out.docx")
 
//Code for how to modify content controls of type plain text box, drop down list and picture.

//[C# code sample]

Document doc = new Document(MyDir + "in.docx");

foreach (StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))
{
    if (sdt.SdtType == SdtType.PlainText)
    {
        sdt.RemoveAllChildren();
        Paragraph para = sdt.AppendChild(new Paragraph(doc)) as Paragraph;
        Run run = new Run(doc, "new text goes here");
        para.AppendChild(run);
    }
    else if (sdt.SdtType == SdtType.DropDownList)
    {
        SdtListItem secondItem = sdt.ListItems[2];
        sdt.ListItems.SelectedValue = secondItem;
    }
    else if (sdt.SdtType == SdtType.Picture)
    {
        DrawingML dml = (DrawingML)sdt.GetChild(NodeType.DrawingML, 0, true);
        if (dml.HasImage)
        {
            dml.ImageData.SetImage(MyDir + "image.png");
        }
    }
}

doc.Save(MyDir + "Out.docx");
 
//[VB Code Sample]

Dim doc As New Document(MyDir & "in.docx")

For Each sdt As StructuredDocumentTag In doc.GetChildNodes(NodeType.StructuredDocumentTag, True)
    If sdt.SdtType = SdtType.PlainText Then
        sdt.RemoveAllChildren()
        Dim para As Paragraph = TryCast(sdt.AppendChild(New Paragraph(doc)), Paragraph)
        Dim run As New Run(doc, "new text goes here")
        para.AppendChild(run)
    ElseIf sdt.SdtType = SdtType.DropDownList Then
        Dim secondItem As SdtListItem = sdt.ListItems(2)
        sdt.ListItems.SelectedValue = secondItem
    ElseIf sdt.SdtType = SdtType.Picture Then
        Dim dml As DrawingML = DirectCast(sdt.GetChild(NodeType.DrawingML, 0, True), DrawingML)
        If dml.HasImage Then
            dml.ImageData.SetImage(MyDir & "image.png")
        End If
    End If
Next

doc.Save(MyDir & "Out.docx")
Alec Noller08/20/14
2703 views
0 replies

The Best of DZone: August 12 - 19

If you missed anything on DZone this week, now's your chance to catch up! This week's best include avoding Hibernate anemia, MongoDB at MachineShop, the release of Android Studio 0.8.6, part 3 of a series on MongoDB schema design, and the second set of AngularJS interview questions.

Gil Allouche08/20/14
7165 views
0 replies

Hadoop 101: An Explanation of the Hadoop Ecosystem

Hadoop is not a single piece of technology. It's composed of an entire ecosystem of tools companies can choose from to create their big data solution

Robert Diana08/20/14
3117 views
0 replies

Geek Reading August 19, 2014

These items are a combination of tech business news, development news and programming tools and techniques.

Mike Bushong08/20/14
1265 views
0 replies

On foxholes and corporate silos

The existence of silos in large companies is fairly common. But simply knowing that silos exist doesn’t help too much. The operable question for everyone operating in these environments is: What can I do to remove unnecessary silos?

Cal Evans08/20/14
1578 views
0 replies

Learn from NO

Most companies have some variation of the same process for interviewing developers. There are a myriad of reasons for the candidate to say No. The important thing is for you to learn from their NO.

Doug Turnbull08/19/14
1921 views
0 replies

Introducing Splainer: The Open Source Search Sandbox That Tells You Why

This is the entire art and science of search relevancy. It's not magic gnomes inside a box that understand all about baby bottles. No, it's heavily tuned heuristics that Solr and Elasticsearch use out of the box.

JQuery::
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script>
		jQuery.fn.alternateColorCellBoard=function(p1,p2,parr,col1,col2,ht,wd){
			return this.append(
				    function(){
				        var content='<table border="1" id="acbGridTable">';
				        var idv=0;
				        var colr=0;
				        for (var i=0; i<p1; i++  ){			        	 
				        	content=content+'<tr id="acbRId_'+i+'">';
				        	for (var j=0; j<p2; j++  ){
				        		if(i%2<1){
				        			if(j%2<1)
				        				colr=col1;
				        			else 
				        				colr=col2;				        			
				        		}else{ 
				        			if(j%2<1)
				        				colr=col2;			        				
				        			else 
				        				colr=col1;				        			
				        		}
				        		content=content+'<td height="'+ht+'"px" width="'+wd+'"px" bgcolor="'+colr+'" class="acbCId_'+idv+'" id="acbCId_'+idv+'">'+parr[idv]+'</td>';
				            	idv++;
				        	}			        	
				        	content=content+'</tr>';
				        }
				        content= content+'</table>';
				        return content;
				    });
		}
</script>




The HTML ::

<body>
<div>
	<div id="chequeredBoard"></div>
</div>
</body>

<script>
var myArr = [];
for (var i=0; i<100; i++  ){
	myArr[i]=i+1;
}

$(document).ready(function() {	   
		$('#chequeredBoard').alternateColorCellBoard(10,10,myArr,"red","skyblue",50,50);			
	});
</script>