NoSQL 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
Alec Noller07/24/14
6797 views
0 replies

The Best of DZone: July 17 - 23

If you missed anything on DZone this week, now's your chance to catch up! This week's best include a Spring MVC 3 view controller example, a look at the new mobile database, Realm, the Java origins of AngularJS, 5 quick points about threads in Java EE, and more.

Adi Gaskell07/24/14
2640 views
0 replies

The impact of interruptions at work

Interruptions seem a central part of modern working life. Whether it’s open plan offices or the influx of digital tools into the workplace, a distraction never seems far away

Rob J Hyndman07/24/14
2416 views
0 replies

Plotting the characteristic roots for ARIMA models

When modelling data with ARIMA models, it is sometimes useful to plot the inverse characteristic roots. The following functions will compute and plot the inverse roots for any fitted ARIMA model (including seasonal models).

Mike Bushong07/24/14
3330 views
0 replies

Scaling Big Data fabrics

Certainly, Big Data applications are distributed largely because the size of the data on which computations are executed warrants more than a typical application can handle. But scaling the network that provides connectivity between Big Data nodes is not just about creating massive interconnects.

Steve Hanov07/24/14
1837 views
0 replies

You can cheat so your web site seems faster than it is

Previously, I was precalculating the completion which maximized the probability of the word, using some basterdized half-remembered version of bayes law. But I think there is a better approach, by running simulations on existing data.

Alec Noller07/23/14
8309 views
0 replies

Dev of the Week: Pierre-Hugues Charbonneau

Every week here and in our newsletter, we feature a new developer/blogger from the DZone community. This week we're talking to Pierre-Hugues Charbonneau, Senior IT Consultant and System Architect at CGI Inc., and author of DZone's 200th Refcard: Java Performance Optimization.

//[C# Code Sample]

Dictionary<string, Symbology> collection = new Dictionary<string, Symbology>();
collection.Add("ONE123", Symbology.Code39Standard);
collection.Add("Process Collection", Symbology.DataMatrix);
collection.Add("Dictionary Collection", Symbology.QR);
collection.Add("X06712AT", Symbology.Code128);
collection.Add("979026000043", Symbology.EAN13);
collection.Add("Aztec BarCode", Symbology.Aztec);

List<Bitmap> images = new List<Bitmap>();

foreach (KeyValuePair<string, Symbology> pair in collection)
using (BarCodeBuilder builder = new BarCodeBuilder())
{
    builder.CodeText = pair.Key;
    builder.SymbologyType = pair.Value;
    images.Add(builder.GenerateBarCodeImage());
}

int maxWidth = int.MinValue;
int sumHeight = 0;
foreach (Bitmap bmp in images)
{
    sumHeight += bmp.Height;
    if (maxWidth < bmp.Width)
        maxWidth = bmp.Width;
}

const int offset = 10;
Bitmap resultBitmap = new Bitmap(maxWidth + offset * 2, sumHeight + offset * images.Count);
using (Graphics g = Graphics.FromImage(resultBitmap))
{
    g.Clear(Color.White);

    int yPosition = offset;
    for (int i = 0; i < images.Count; ++i)
    {
        Bitmap currentBitmap = images[i];
        g.DrawImage(currentBitmap, offset, yPosition);
        yPosition += currentBitmap.Height + offset;
    }
}

resultBitmap.Save("barcode.png", ImageFormat.Png);

//[VB.NET Code Sample]

Dim collection As New Dictionary(Of String, Symbology)()
collection.Add("ONE123", Symbology.Code39Standard)
collection.Add("Process Collection", Symbology.DataMatrix)
collection.Add("Dictionary Collection", Symbology.QR)
collection.Add("X06712AT", Symbology.Code128)
collection.Add("979026000043", Symbology.EAN13)
collection.Add("Aztec BarCode", Symbology.Aztec)

Dim images As New List(Of Bitmap)()

For Each pair As KeyValuePair(Of String, Symbology) In collection
    Using builder As New BarCodeBuilder()
	builder.CodeText = pair.Key
	builder.SymbologyType = pair.Value
	images.Add(builder.GenerateBarCodeImage())
    End Using
Next

Dim maxWidth As Integer = Integer.MinValue
Dim sumHeight As Integer = 0
For Each bmp As Bitmap In images
    sumHeight += bmp.Height
    If maxWidth < bmp.Width Then
	maxWidth = bmp.Width
    End If
Next

Const  offset As Integer = 10
Dim resultBitmap As New Bitmap(maxWidth + offset * 2, sumHeight + offset * images.Count)
Using g As Graphics = Graphics.FromImage(resultBitmap)
    g.Clear(Color.White)

    Dim yPosition As Integer = offset
    For i As Integer = 0 To images.Count - 1
  	Dim currentBitmap As Bitmap = images(i)
	g.DrawImage(currentBitmap, offset, yPosition)
	yPosition += currentBitmap.Height + offset
    Next
End Using

resultBitmap.Save("barcode.png", ImageFormat.Png)

Borislav Iordanov07/23/14
6184 views
0 replies

Why is the Fundamental Theorem of Software Engineering Fundamental?

So you can see where I'm heading with the question posed at the title of this post. It is the reference resolution that is fundamental an indirection is simply what we do to (re)define what that resolution process ultimately looks like.

Ayende Rahien07/23/14
4291 views
0 replies

Avoid where in a reduce clause

We got a customer question about a map/reduce index that produced the wrong results. The problem was a problem between the conceptual model and the actual model of how Map/Reduce actually works.

Hamid Shojaee07/23/14
3113 views
1 replies

Scrum and Quantum Physics

Since Scrum is an iterative process, you can have great success by focusing on things that you can say with a fair degree of confidence, while still allowing for some uncertainty in all planning and estimates.

Mike Bushong07/23/14
2215 views
0 replies

Scenario planning for first-line managers

Almost every New Product Introduction process includes some placeholder slots to talk about risk. Everyone knows enough to put mitigation plans in these slots. But those mitigation plans are drafted and then ignored by the vast majority of managers.

Kin Lane07/23/14
1731 views
0 replies

GitHub Commit Storytelling: Now or Later

When you are making GitHub commits you have to provide a story that explains the changes you are committing to a repository. Many of us just post 'blah blah’, ‘what I said last time", or any other garbage that just gets us through the moment. You know you’ve all done it at some point.

-- Relative time with interval
DATE_SUB(NOW(), INTERVAL 25 HOUR)
 
-- Select all users that were updated in the last 24 hours.
SELECT * FROM users
WHERE users.updated > DATE_SUB(NOW(), INTERVAL 24 HOUR);
 
-- Select all users that were updated in the last 7 days.
SELECT * FROM users
WHERE users.updated > DATE_SUB(NOW(), INTERVAL 7 DAY);
Mike Bushong07/22/14
2720 views
0 replies

Network abstractions need equivalent of packet walkthrough

Whenever a new networking platform is evaluated, one of the early sales calls includes a packet walkthrough. But why?

Rob J Hyndman07/22/14
3225 views
0 replies

I am not an econometrician

Econo­met­rics is often “the­ory dri­ven” while sta­tis­tics tends to be “data dri­ven”. I dis­cov­ered this in the inter­view for my cur­rent job when some­one crit­i­cized my research for being “data dri­ven” and asked me to respond.

Mike Cottmeyer07/22/14
1355 views
0 replies

What is the ROI of Your Event?

So, where did our new event fall on a scale compared to the others? Did I feel like attendees received value and did I feel like we got a good return on our investment? Let me give a little comparison.

Alec Noller07/21/14
8832 views
0 replies

DZone's 200th Refcard Released: Java Performance Optimization

Today, DZone released Refcard #200: Java Performance Optimization. To mark the significance of this milestone, this Refcard boasts a complete redesign - all the information you expect from a Refcard in a shiny new package!

David Winterbottom07/21/14
4717 views
0 replies

Linking to Github

It's dangerous to link to lines or blocks of code on Github without explicitly specifying the commit hash in the URL. This emits the Github URL to the HEAD commit on the current branch, specifying the commit hash in the URL

Ayende Rahien07/21/14
3272 views
0 replies

Introducing inefficiencies into RavenDB, on purpose

The administrators on the server noted the high I/O and that a single thread was constantly busy and decided that this is likely a hung thread. The long term fix was to actually make sure that we abort the operation after a while, report to the remote server that we scanned up to a point, and had nothing to show for it, and go back to the replication loop.

Mark Needham07/21/14
2481 views
0 replies

R: ggplot: Problem automatically picking scale for difftime object

I thought it’d be interesting to create some visualisations around the times that people RSVP ‘yes’ to the various Neo4j events that we run in London. I tried to use ggplot to create a bar chart of the data. Unfortunately that resulted in this error: