Performance 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
Maneesh Joshi11/20/14
6552 views
0 replies

Top 5 Mobile APM Myths: Myths 1 & 2

There is a lot of confusion in the market today. So in this blog post, I’d like to dispel some key myths around mobile apps. And how, with the right mAPM tool, you can nail your mobile app experience — both interactivity-wise and performance-wise — and thereby win the market.

John Walter11/20/14
2591 views
0 replies

WatchKit SDK Launches

With the WatchKit SDK launching, here's a preview of all of the features for developing on the Apple Watch.

//[C#]

/* Create a DataTable object (Employee) and add columns to it (Employee_ID, 
  * Employee_Name, Gender).   
  */
DataTable dt = new DataTable("Employee");
dt.Columns.Add("Employee_ID", typeof(Int32));
dt.Columns.Add("Employee_Name", typeof(string));
dt.Columns.Add("Gender", typeof(string));
//Add 2 rows into the DataTable object programmatically
DataRow dr = dt.NewRow();
dr[0] = 1;
dr[1] = "John Smith";
dr[2] = "Male";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = 2;
dr[1] = "Mary Miller";
dr[2] = "Female";
dt.Rows.Add(dr);
// Create Document instance
Document doc = new Document();
doc.Pages.Add();
// Initializes a new instance of the Table
Aspose.Pdf.Table table = new Aspose.Pdf.Table();
//Set column widths of the table
table.ColumnWidths = "40 100 100 100";
// Set the table border color as LightGray
table.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray));
// set the border for table cells
table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray));
table.ImportDataTable(dt, true, 0, 1, 3, 3);

// Add table object to first page of input document
doc.Pages[1].Paragraphs.Add(table);
// Save updated document containing table object
doc.Save("c:/pdftest/DataIntegrated.pdf");

//[VB.NET]

'**************************************************************************
'* Create a DataTable object (Employee) and add columns to it (Employee_ID, 
'* Employee_Name, Gender).   
'**************************************************************************
Dim dt As DataTable = New DataTable("Employee")
dt.Columns.Add("Employee_ID", System.Type.GetType("System.Int32"))
dt.Columns.Add("Employee_Name", System.Type.GetType("System.String"))
dt.Columns.Add("Gender", System.Type.GetType("System.String"))
'Add 2 rows into the DataTable object programmatically
Dim dr As DataRow = dt.NewRow()
dr(0) = 1
dr(1) = "John Smith"
dr(2) = "Male"
dt.Rows.Add(dr)

dr = dt.NewRow()
dr(0) = 2
dr(1) = "Mary Miller"
dr(2) = "Female"
dt.Rows.Add(dr)

' Create Document instance
Dim doc As Document = New Document()
doc.Pages.Add()
' Initializes a new instance of the Table
Dim table As Aspose.Pdf.Table = New Aspose.Pdf.Table()
'Set column widths of the table
table.ColumnWidths = "40 100 100 100"
' Set the table border color as LightGray
table.Border = New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.5F, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray))
' set the border for table cells
table.DefaultCellBorder = New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.5F, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray))
table.ImportDataTable(dt, True, 0, 1, 3, 3)

' Add table object to first page of input document
doc.Pages(1).Paragraphs.Add(table)
' Save updated document containing table object
doc.Save("c:/pdftest/DataIntegrated.pdf")

// MainWindow.xaml

<Window x:Class="Basic_CameraViewer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="550" Width="550" 
        ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
    <Grid>
        <GroupBox Header="Connect to USB camera" Height="100" Width="150"
                  HorizontalAlignment="Left" VerticalAlignment="Top">
            <Grid>
                <Button Content="Connect" Width="75" Margin="32,19,0,0" 
                        HorizontalAlignment="Left" VerticalAlignment="Top"
                        Click="ConnectUSBCamera_Click"/>
                <Button Content="Disconnect" Width="75" Margin="32,46,0,0"
                        HorizontalAlignment="Left" VerticalAlignment="Top"
                        Click="DisconnectUSBCamera_Click"/>
            </Grid>
        </GroupBox>

        <Grid Name="CameraBox" Margin="10,105,10,166"/>

        <GroupBox Header="Function" Height="160" Width="542" Margin="0,360,0,0"
                  HorizontalAlignment="Left" VerticalAlignment="Top" >
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <ListBox Grid.Column="1" Name="ConnectedClientList"/>
                <GroupBox Grid.Column="0" Header="Set Listen Address">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid Grid.Row="0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="3*"/>
                            </Grid.ColumnDefinitions>
                            <Label Grid.Column="0" Content="Address"/>
                            <TextBox Grid.Column="1" Height="25" Name="IpAddressText"/>
                        </Grid>
                        <Grid Grid.Row="1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="3*"/>
                            </Grid.ColumnDefinitions>
                            <Label Grid.Column="0" Content="Port"/>
                            <TextBox Grid.Column="1" Height="25" Name="PortText"/>
                        </Grid>
                        <Grid Grid.Row="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Button Grid.Column="0" Content="Start" 
                                    HorizontalAlignment="Center" VerticalAlignment="Center" 
                                    Width="75" Click="StartServer_Click"/>
                            <Button Grid.Column="1" Content="Stop" 
                                    HorizontalAlignment="Center" VerticalAlignment="Center" 
                                    Width="75" Click="StopServer_Click" />
                        </Grid>
                    </Grid>
                </GroupBox>
            </Grid>
        </GroupBox>
    </Grid>
</Window>

// MainWindow.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Ozeki.Media.IPCamera;
using Ozeki.Media.MediaHandlers;
using Ozeki.Media.MediaHandlers.Video;
using Ozeki.Media.MJPEGStreaming;
using Ozeki.Media.Video.Controls;

namespace Basic_CameraViewer
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private VideoViewerWPF _videoViewerWpf;

        private BitmapSourceProvider _provider;

        private IIPCamera _ipCamera;

        private WebCamera _webCamera;

        private MediaConnector _connector;

        private MyServer _server;

        private IVideoSender _videoSender;

        public MainWindow()
        {
            InitializeComponent();

            _connector = new MediaConnector();

            _provider = new BitmapSourceProvider();

            _server = new MyServer();

            SetVideoViewer();
        }

        private void SetVideoViewer()
        {
            _videoViewerWpf = new VideoViewerWPF
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch,
                Background = Brushes.Black
            };
            CameraBox.Children.Add(_videoViewerWpf);

            _videoViewerWpf.SetImageProvider(_provider);
        }

        #region USB Camera Connect/Disconnect

        private void ConnectUSBCamera_Click(object sender, RoutedEventArgs e)
        {
            _webCamera = WebCamera.GetDefaultDevice();
            if (_webCamera == null) return;
            _connector.Connect(_webCamera, _provider);
            _videoSender = _webCamera;

            _webCamera.Start();
            _videoViewerWpf.Start();
        }

        private void DisconnectUSBCamera_Click(object sender, RoutedEventArgs e)
        {
            if (_webCamera == null) return;
            _videoViewerWpf.Stop();

            _webCamera.Stop();
            _webCamera.Dispose();

            _connector.Disconnect(_webCamera, _provider);
        }
        #endregion

        private void GuiThread(Action action)
        {
            Dispatcher.BeginInvoke(action);
        }

        private void StartServer_Click(object sender, RoutedEventArgs e)
        {
            var ipadress = IpAddressText.Text;
            var port = int.Parse(PortText.Text);
            _server.VideoSender = _videoSender;

            _server.OnClientCountChanged += server_OnClientCountChanged;

            _server.Start();
            _server.SetListenAddress(ipadress, port);
        }

        void server_OnClientCountChanged(object sender, EventArgs e)
        {
            GuiThread(() =>
            {
                ConnectedClientList.Items.Clear();

                foreach (var client in _server.ConnectedClients)
                    ConnectedClientList.Items.Add("End point: " +
                        client.TransportInfo.RemoteEndPoint);
            });
        }

        private void StopServer_Click(object sender, RoutedEventArgs e)
        {
            _server.OnClientCountChanged -= server_OnClientCountChanged;
            _server.Stop();
        }
    }
}
Benjamin Ball11/19/14
10420 views
3 replies

hack.summit() On Pace To Be Largest Developer Conference Ever

I just wanted to let everyone know about this great virtual developer conferencing coming up called hack.summit(), which takes place Dec 2-4; there's already more than 13,000 developers signed up for the conference.

Chris Odell11/19/14
5896 views
0 replies

The Single Point Of Failure

As a SOHO (Solo Home Office) Developer one of the many challenges is the fact that there is no one else to discuss code changes with. Without someone to discuss changes with your blind spots will not be covered by a colleague looking at your code, potentially more bugs could creep into your code base and there are less opportunities to learn from other peoples experiences. So what can you do? Well here are some suggestions.

John Cook11/19/14
2711 views
0 replies

People want Swiss Army Knives

I basically agree with the Unix philosophy that tools should do one thing well, but even Unix doesn’t follow this principle strictly in practice. One reason is that “thing” and “well” depend on context. The “thing” that a toolmaker has in mind may not exactly be the “thing” the user has in mind, and the user may have a different idea of when a tool has served well enough.

Ricky Ho11/19/14
2925 views
0 replies

The Common Data Science Project Flow

While working across multiple data science projects, I observed a similar pattern across a group of strategic data science projects where a common methodology can be used. In this post, I want to sketch this methodology at a high level.

Raymond Camden11/18/14
2100 views
0 replies

Syncing Brackets extensions across multiple machines

This really isn't a new tip, but as someone just asked on Twitter for a quick explanation, I thought I'd write it up. If you want to sync Brackets extensions across multiple machines, the easiest way to do it is with Dropbox, or a Dropbox-like service.

Sameer Bhatia11/18/14
6584 views
0 replies

How the Internet of Things Will Change How You Live

Social media, mobile connectivity, Candy Crush—these things are old news. There is a bigger, badder technological revolution occurring: the Internet of Things, aka the IoT, in which everything from appliances to cows to us is online.

Quinto Urban11/18/14
3814 views
0 replies

Collective Responsibility – Ask the Team!

Collective responsibility is one of the artefacts of agile software development realized those days in many companies and teams (also called Scrum). When I talked with stakeholders about details of software project management strategies they are pushing forward – want to do, often I heard answer as “ask the team”.

    /** Receives info about opened and closed TopComponents from window system.
     */
    private static class WindowRegistryL implements PropertyChangeListener {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (TopComponent.Registry.PROP_TC_OPENED.equals(name)) {
                addFile((TopComponent) evt.getNewValue());
            }
        }
    }
Burke Holland11/17/14
2746 views
0 replies

Video: AngularJS Directives For The Rest Of Us

Burke Holland explains the concept of AngularJS Directives in familiar jQuery terms

Mike Bushong11/17/14
1615 views
0 replies

The power of Clustering Illusion when managing image

It’s fairly self-evident that you need to have positive data points, but you need to understand that people will tend to view things in clusters. Once you know that, swaying perception (either positively or negatively) is an exercise in creating clusters.

Ross Mason11/17/14
3766 views
0 replies

Performance Impact of an IO-Intensive Application

If you’ve ever worked on performance issues with an IO- intensive app, there is a good chance you already know that the application performance degrades when the disks are stressed out. This fact is usually well known, but the reasons behind it aren’t always clear. I’d like to try and clarify what’s going on behind the scenes.

Mike Cottmeyer11/17/14
7622 views
0 replies

Some Thoughts on Agile Transformation in Big Companies

I am under no illusions that this post will be the definitive explanation, but I spend a TON of time talking to people and level setting before I can have any kind of intelligent conversation on agile, so I want to explore some of the points that I think resonate.

What will happen when we mention this in the jsp page?
<form name="form1" method="post">
<input type='hidden' name='action_submit' id='action_submit' size ='10' value='hrms_employee_search_submit'/>
</form>
where can we collect this hidden types value?
    Tags:
Michael Sahota11/16/14
5353 views
0 replies

Scrum and Kanban: Getting the Most from Each

Scrum is the most popular Agile methodology with Kanban a growing second choice. Learn about the core parts of each one as well as how they differ so that you can find the best fit for your team or organizational context.

Kane Mar11/16/14
1900 views
0 replies

The Agile Reader - Weekend Edition: 11/14/2014

The Weekend Edition is a list of some interesting links found on the web to catch up with over the weekend. It is generated automatically, so I can’t vouch for any particular link but I’ve found the results are generally interesting and useful.

Robert Diana11/16/14
4244 views
0 replies

Geek Reading November 14, 2014

These items are the fruits of those ideas, the items I deemed worthy from my daily reading. These items are a combination of tech business news, development news and programming tools and techniques.