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
/ / MuSQL
$Database = new PDO ("mysql: host = $ host; dbname = $Databasename", $username, $password); 
/ / PostgreSQL
$Database = new PDO ("pgsql: host = $ host; dbname = $Databasename", $username, $password);
/ / MS SQL
$Database = new PDO ("mssql: host = $ host; dbname = $Databasename", $username, $password); 
/ / SQLite
$Database = new PDO ("sqlite: my / database / path / database.db");
This is a small introduction to PDO extension for beginners Read the full article.
int fibonaci(int n){
    
    int i;float tmp;
    
    //x^2 - x - 1 =0
    float x1 = ( 1 + sqrt(5) ) / 2;
    float x2 = (1 - sqrt(5) ) / 2;  
    
    for(i=0;i<n;i++){
               
        tmp = (pow(x1,i) - pow(x2,i)) / sqrt(5);
        printf("%d ",(int)floor(tmp)); //pembulatan kebawah         
    }
    
    printf("\n");
}
Mike Cottmeyer06/13/14
5720 views
3 replies

We Should Be Held Accountable

When I speak to people (including Agile coaches) from other companies, I tend to see and hear a lot of interesting perspectives. Many buy into the idea of Agile being this cultural shift with everyone sitting around a campfire singing Kumbaya and feeling all happy.

Lorna Mitchell06/13/14
3121 views
0 replies

What Got You Involved in Open Source?

I did a very unscientific twtpoll recently regarding what brought each of us into open source. Plenty of people took the time to vote or retweet, so I thought I'd loop back around and let you know how it looked overall when the poll closed.

Whitney Baker06/13/14
4715 views
0 replies

Agile Is The New Black

"It seems that agile ideas such as pair programming, lack of code ownership are neither new nor revolutionary. Had we only forgotten about them? At what point did we decide to isolate developers in cubicles or tie their salary to the lines of code produced?"

Mike Bushong06/13/14
3220 views
0 replies

The Five Dysfunctions of a Network

“The Five Dysfunctions of a Team” by Patrick Lencioni outlines 5 critical failures of teams, key areas for any leader to address. While a network is not a team, it may have just as many dysfunctions that impact its ability to provide the service it is created for.

Venkatt Guhesan06/13/14
5062 views
0 replies

Getting started with vertx, an alternative to node.js

The VertX solution is built upon (and requires) a JDK/JRE under the skin. But then because Java supports other languages under its skin, you can leverage the benefits of languages such as JavaScript, CoffeeScript, Ruby, Python, Groovy or Java.

Phil Whelan06/13/14
889 views
0 replies

The Status Quo is Killing Innovation

I listened to the recording of Michael Coté's keynote on the second day of DevOpsDays Austin and I felt like a few of my questions have been answered with respect to DevOps and PaaS. Bottom line: while change is happening, it seems to be moving at slower pace than expected.

Raymond Camden06/13/14
4732 views
0 replies

Browser slowdown? SVN failing? Read this.

For a few months now, I've experienced an odd issue with Chrome. I'd go to a URL and get nothing but a white screen while something tried to load.

We were developing SOAP web services using AXIS2, now want to move to CXF as now we will be developing REST webservices.

Does anyone have steps of changing the AXIS 2 with CXF, tasks to be done to accomplish this.

Thanks in advance
    Tags:
Paul Reed06/12/14
3994 views
0 replies

The Ship Show: Extinguishing Burnout

As tech companies implement all sorts of ways to increase their output, the often-undiscussed tradeoff is how it impacts employees.

Whitney Baker06/12/14
3646 views
0 replies

The Misperception of Scrum

Developers are used to thinking in an extremely abstract way. They take a complicated problem and simplify it to a point where it is simple enough to describe in a list of instructions sent to a computer processor.

Mike Bushong06/12/14
6251 views
0 replies

The Third Epoch: Re-verticalization of IT

If you believe that buying patterns will shift more towards a re-verticalization of IT, then individual constituents in the current IT stack will ultimately align to a relatively small number of overarching IT providers.

Chris Odell06/12/14
5661 views
0 replies

Embrace Difference, Embrace Innovation

In my opinion, when we see things from another persons point of view our minds go down a different path, and who knows where that new path will lead and what innovation it might inspire.

// Create an instance of BarCodeReader class and specify the image and symbology
BarCodeReader reader;
reader = new BarCodeReader("c:\\Code39Extended.png", BarCodeReadType.getCode39Extended());
int counter = 0;

// Read all the barcodes from the images
while (reader.read())
{     
     // Display the symbology type
     System.out.println("BarCode Type: " + reader.getReadType());
     // Display the codetext
     System.out.println("BarCode CodeText: " + reader.getCodeText());
     // Get the barcode region
     com.aspose.barcoderecognition.BarCodeRegion region = reader.getRegion();
     if (region != null)
     {         
         // Initialize an object of type BufferedImage to get the Graphics object
         BufferedImage bufferedImage = ImageIO.read(new File("c:\\Code30Extended.png"));
         // Initialize graphics object from the image
         Graphics g = bufferedImage.getGraphics();
         // Initialize paint object
         Paint p = new GradientPaint(0, 0, Color.red, 100, 100, Color.pink, true);
	 // Initialize stroke object	 
         Stroke stroke = new BasicStroke(4.0f);
         region.drawBarCodeEdges((Graphics2D)g, stroke, p);
         // Save the image
         ImageIO.write(bufferedImage, "png",new File("C:\\ab\\Image001.png"));
     }
}
reader.close();
Alec Noller06/11/14
7414 views
1 replies

Dev of the Week: Antonio Goncalves

Every week here and in our newsletter, we feature a new developer/blogger from the DZone community to catch up and find out what he or she is working on now and what's coming next. This week we're talking to Antonio Goncalves, Java EE Consultant, co-creator of the Paris Java User Group, and author.

Kris Buytaert06/11/14
4865 views
3 replies

Why Does DevOps Matter?

People often ask, why does DevOps matter? The honest answer to that question is because having the development and operations team work together is the only way IT is successful. In the end it comes down to the most important part, which is that devops creates more happiness.

1. Simple Logic

int fibonaci(int n){

    int i,next,a=0,b=1;
    for(i=0;i<n;++i){
    
        if(i<=1){
            next = i;
        }else{
            
            next = a + b;
            a = b;
            b= next;
        }
        
        printf("%d ",next);
    }
}

2. Mathematical Formula

int fibonaci(int n){
    
    int i;float tmp;
    
    //x^2 - x - 1 =0
    float x1 = ( 1 + sqrt(5) ) / 2;
    float x2 = (1 - sqrt(5) ) / 2;  
    
    for(i=0;i<n;i++){
               
        tmp = (pow(x1,i) - pow(x2,i)) / sqrt(5);
        printf("%d ",(int)floor(tmp)); //rounding down         
    }
    
    printf("\n");
}
Whitney Baker06/11/14
2484 views
0 replies

The Challenge of Agile with Offshore Development

The most important facet of agile development in a fast-moving workplace is communication – without it, processes can fall apart and deadlines can fail to be met. In a blog post, agile coach Lorraine Pauls Longhurst works through some issues she's faced as an expert.

Madhuka Udantha06/11/14
4844 views
0 replies

Introduction to Event Processing

Generic software platforms are now being used in many areas. To take just two examples, organizations typically use database management systems to manage their data and process queries, and they use message-oriented middleware to connect enterprise applications.