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
Tinu Awopetu07/27/09
34968 views
6 replies

NetBeans IDE 6.7.1 with JavaFX Now Available for Download!

The NetBeans Team is pleased to announce the release of NetBeans IDE 6.7.1, which supports the latest JavaFX SDK. Download NetBeans 6.7.1 (A JavaFX-only download bundle is also available.) NetBeans IDE 6.7.1 is an update to NetBeans IDE 6.7 and includes the...

Rick Ross02/14/08
14102 views
16 replies

Welcome to DZone's new IndicZone community for Indian IT Pros

Let me welcome all of you to the new DZone community for one of the most important and fastest growing groups in the worldwide IT scene: Indian developers and IT professionals. No matter where you look, if something interesting is happening on the IT and...

package com.pk.com;

public class Example {
	public static void main(String[] args) {
		String s = "abc";
		String s2 = "abc";
		String s3 = new String("abc");
		if (s == s2)
			System.out.println("true");
		else
			System.out.println("false");
		if (s.equals(s2))
			System.out.println("true");
		else
			System.out.println("false");
		if (s == s3)
			System.out.println("true");
		else
			System.out.println("false");
		if (s.equals(s3))
			System.out.println("true");
		else
			System.out.println("false");
	}

}
Mike Bushong11/20/14
198 views
0 replies

The Philosophy of Network-as-a-Service

In the world of Anything-as-a-Service (I will leave the acronym to your imagination), Network-as-a-Service is not a new term. In fact, it even has its own wikipedia page which will tell you it has been used for many years now, well before the current set of service related terms in IT have become popular.

Rob J Hyndman11/20/14
555 views
0 replies

Seasonal Periods

The “fre­quency” is the num­ber of obser­va­tions per sea­son. This is the oppo­site of the def­i­n­i­tion of fre­quency in physics, or in Fourier analy­sis, where “period” is the length of the cycle, and “fre­quency” is the inverse of period. When using the ts() func­tion in R, the fol­low­ing choices should be used.

Vladimir Djurovic11/20/14
4 views
0 replies

DEMUX Framework 0.10.0 released

  DEMUX Framework version 0.10.0 is released. This version is a major code refactoring in order to streamline development and offer more robust features. Some of the changes include:

Adi Gaskell11/20/14
139 views
0 replies

3 things to understand about yourself if feedback is to stick

Feedback is something that we desperately need if we’re to continuously improve our skills and knowledge. Whilst the receipt of positive feedback is something we crave, many of us are much less adept when it comes to receiving negative feedback.

Oscar Berg11/20/14
80 views
0 replies

The Collaboration Pyramid revisited

There has been a lot of buzz on Twitter recently about The Collaboration Pyramid model that I developed a few years ago. It started when Helen Bevan shared a redrawn version by Jim Farrell.

Adi Gaskell11/20/14
87 views
0 replies

Research explores how you can cultivate influence on Twitter

As Twitter has grown in size and importance, there have been a number of attempts to understand what contributes to success (or not). For instance there have been various studies into what encourages people to retweet your updates.

Robert Reeves11/20/14
318 views
0 replies

Enforcing Corporate Standards in a DevOps World

With Datical DB Rules Engine, enterprise DBAs can make certain Dev never uses DROP. Period. You can also lock down GRANTs. Heck, you can even make sure no one slips “TRUNCATE” into their Stored Procedures, too. If you can imagine it, Datical DB Rules Engine can enforce it.

Max Walker11/19/14
19 views
0 replies

Interactive Panel: Android Development at Scale with Cyanogenmod, Twitter, Amazon, Square, Eventbrite and NewCircle - Streaming Live from AnDevCon

Thursday, Nov. 20 - 7:30PM - 9:30PM Come to AnDevCon to enjoy a bit of networking, drinks and appetizers before we kick off an awesome event on Android development at scale!

Kumaravel 11/19/14
3 views
0 replies

JarNavigator 1.0 Released

I'm pleased to announce the release of JarNavigator 1.0. JarNavigator tool helps you to view, navigate and search Java class files, meta data and other resources(text, images, etc.) stored in a jar file

// 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();
        }
    }
}
Rick Delgado11/19/14
1022 views
0 replies

Desktop-as-a-Service and BYOD: Two Growing Complementary Trends

BYOD and DaaS are both growing trends that are making bigger impacts in the business world with each passing year. One of the reasons both are growing at such a steady pace is how they work together so effectively.

Anthony Ferrier11/19/14
432 views
0 replies

Twitter Chat: The Value of Internal Networks for Open Innovation

This Twitter Chat examines the growing trend of companies building strong employee-focused networks in order to support their innovation efforts, with a special focus on the value driven to open innovation.

Adi Gaskell11/19/14
181 views
0 replies

New services aim to prove trust in the sharing economy

Whilst it’s probably a stretch too far to suggest we’re living in the free agent nation immortalized by Dan Pink, it’s no doubt true that more people are trading online in a variety of ways, whether as part of the sharing economy or via platforms such as oDesk and GitHub.

Mark Morrell11/19/14
275 views
0 replies

Are you moving to the Cloud?

I recently posted about the challenges organisations face as they move from having online content and tools hosted firmly on their estate to renting space in the cloud.

Handri Royan11/18/14
3 views
1 replies

The Best Web Developer in Bali

Max Solution is one of the best IT Solution in Bali, Indonesia. We develop website, mobile apps, software, game, digital networking, etc. We do not recommend you to build website(s) for the sole purpose of owning a website. Websites have to be able to help...

Sameer Bhatia11/18/14
5562 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.