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
Derwyn Harris08/21/14
12009 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
6488 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
5007 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
4830 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
5601 views
6 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
7642 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
18840 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
3819 views
0 replies

Geek Reading August 19, 2014

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

Cal Evans08/20/14
2209 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
2644 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>
Dave Rooney08/19/14
4655 views
0 replies

An Appetite for Change

So, regardless of whether a change is imposed by the management of an organization, is requested by and driven by those most affected by the change, or any combination of both, the fundamental mathematics remain the same.

Mark Needham08/19/14
3755 views
0 replies

Where does R Studio install packages/libraries?

As a newbie to R I wanted to look at the source code of some of the libraries/packages that I’d installed via R Studio which I initially struggled to do as I wasn’t sure where the packages had been installed.

Robert Diana08/19/14
5899 views
0 replies

Geek Reading August 18, 2014

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

Chris Odell08/19/14
3332 views
0 replies

Agile Decompiled: In Conclusion

Hopefully these articles have helped the reader decide if a) agile will work for them and b) if they are already working in an agile way.

Ariya Hidayat08/19/14
3815 views
0 replies

PhantomJS 2 and JavaScript Goodies

As I mentioned in my earlier blog post, we are now working torward stabilizing the development version of PhantomJS. One thing I would like to elaborate here with respect to the features of this forthcoming PhantomJS 2 is its improved JavaScript support.

Alec Noller08/18/14
8565 views
0 replies

Refcard Expansion Pack: Getting Started with Play Framework

This week, DZone released its latest Refcard: Getting Started with Play Framework. If you're interested in learning more about the Play Framework or sharpening your skills, we decided to dig into the DZone archives and find some of the most popular posts we've had on the topic.

Johanna Rothman08/18/14
9215 views
8 replies

People Are Not Resources

People aren’t resources! People finish work. If you don’t want us to finish projects, let’s decide which projects not to do. Then we can re-allocate people, if we want. But we don’t start with people. That’s crazy.

Ajitesh Kumar08/18/14
5993 views
0 replies

Hello World with ReactJS: Code Example

This article represents code examples and high level concepts on React.js, a javascript library for building user interfaces, being developed by Facebook Engineers.