How to write a simple DB2 client?

hello,
I'm going to write a simple DB2 client in my new project,which can issue some simple db2 commands and get the result,for example,the "list tables" command. Can JDBC finish this job?
any help appreciated.

JDBC can do that and more.
http://java.sun.com/docs/books/tutorial/jdbc/index.html
%

Similar Messages

  • How to write a simple query.

    I have a table where I have data shown below. Now, I want to write a simple query which lists me the project and the count of the distinct effective dates for which data is existant there.
    Sample data:
    Project Task Effective Date (xx_proj_task_data)
    101 T1 01-Jan-2008
    101 T1 01-Feb-2008
    101 T1 01-Mar-2008
    101 T2 01-Jan-2008
    101 T2 01-Apr-2008
    101 T3 01-Apr-2008
    102 T1 01-Jan-2008
    102 T1 01-Feb-2008
    102 T2 01-Apr-2008
    103 T1 01-Jan-2008
    103 T1 01-Feb-2008
    103 T1 01-Mar-2008
    103 T1 01-Apr-2008
    103 T2 01-May-2008
    103 T3 01-Jun-2008
    103 T1 01-Jan-2008
    103 T1 01-Aug-2008
    103 T2 01-Apr-2008
    Output Reqd:
    Project Count(Distinct Effective Dates)
    101 4
    102 3
    103 7
    I can write a query that says:
    select project_id, count(1)
    from (select distinct project_id, effective_date
    from xx_proj_task_data) x
    group by project_id;
    But, is there a way I can achieve the same by avoiding the inner Query (x) and just by a simple query ?
    Thanks!

    Try below query:
    select project_id
    , count(distinct effective_date)
    from xx_proj_task_data
    group by project_id;
    --venkata                                                                                                                                                                                                                                                                                       

  • Please tell me how to use the Simple bluetooth client server example.

    Hi i used the simple bluetooth client server example in labview 7.1. Iam getting an error saying your system does not support the network operation.  I have following doubts also.
    1. Should i pair the device before running the labview.
    2. Should i enable the file transfer wizard in the software given with the bluetooth adapter.
    Please help
    Thank you
    R.Prem kumar 
    09940446193

    Hi R.Prem,
    Could you please let me know what error code is associated with this error message? Also could you please provide a description of the setup you are currently using? Thanks!
    Best regards,
    Steven

  • How to write a simple bash command

    I have a mac mini that has some software that is supposed to start at bootup, but does not always do so.  In order to get the software running I need to open a terminal window and type some commands.  Is it possible to just write a text file and turn it into a .command file that will not require me to write it out every time.
    Here is exactly what I have to write in Terminal to get the program running again.
    sudo su
    filler14
    ignition stop
    ignition start
    exit
    exit
    Typing sudo su asks for the password which is filler14.  After entering it I type ignition stop and it takes a second and it responds that it stopped.  I type ignition start and it takes about 3 seconds and responds that it is running.  I type exit to get out of sudo su and then exit again and it says operation complete, and then I close terminal.
    Is there a way to automate this?
    Thanks,
    Michael

    You need to create a launchd plist for it and put it in the /Library/LaunchDaemons folder. It will run as root on startup.
    There are several tutorials all over the web, or you can use Lingon X ($10 probably is too steep for what you want--and likely isn't needed). The App Store version is cheaper, but cannot save directly to the /Library/LaunchDaemons folder due to App Store limitations. However, Peter Borg (developer) notes that you can just create one for your user, then move it to the Library/LaunchDaemons folder yourself.

  • How to write WebService Client

    How to Write to a java Client to access a existing webservice?. Can anybody give a simple examples...

    You should check out the jaxrpc tutorial in the
    webservices pack form Sun. that should be a good
    start.
    Amlan

  • How to write heading in bold on a simple list?

    On a simple list, I want to write a heading in bold. How to write one in bold?
    Thanks.

    Hello,
    Format intensified on.
    Write: / l_header_text.
    Format intensified off.
    Message was edited by: Cyrill Smirnov

  • How can I make the LabVIEW CGI write to the same client window twice?

    I'm building a CGI VI using LabVIEW 6i and the Internet Dev. Toolkit. I would like this VI to write to the same client browser window twice. The first reply will just be a confirmation that the form has been submitted, and the second reply will be the results from a measurement. Is there any way this can be done? I have tried to use the "CGI Write Reply.vi" twice in the same CGI VI, but only the first reply is received in the client window.

    Very nice interface! It sounds like you might want two separate steps and two separate CGIs (or one CGI with a "step" flag). Here's one idea:
    1. Pass the configuration info from the form, initiate the measurement, and return a confirmation page to the user. Embed something in the result page (a hiddden variable on a second form, perhaps?) that will identify the measurement that was requested upon a subsequent CGI call.
    2. Either have the second form/CGI automatically submit itself after time T, or else allow the user to submit it. Use the hidden variable to identify which results set is being requested. If the measurement is finished, return the results; otherwise, return another confirmation page with a new time estimate.
    Best of luck,
    Jo
    hn

  • How to list IP address from client on the Server (TCP/IP CLIENT SERVER COMMUNICATION)

    Excuse me,
    In this project I want to ask how to add list IP from client that connect to server.
    I have edited slightly the project.
    'SERVER
    Imports System.Net
    Imports System.Net.Sockets
    Imports System.Threading
    Imports System.Threading.Tasks
    Imports System.Reflection
    Public Class ServerForm
    Private _Listener As TcpListener
    Private _Connections As New List(Of ConnectionInfo)
    Private _ConnectionMonitor As Task
    Private Sub Button_Checked(sender As System.Object, e As System.EventArgs) Handles StartStopButton.CheckedChanged
    If StartStopButton.Checked Then
    StartStopButton.Text = "Stop"
    StartStopButton.Image = My.Resources.StopServer
    _Listener = New TcpListener(IPAddress.Any, CInt(PortTextBox.Text))
    _Listener.Start()
    Dim monitor As New MonitorInfo(_Listener, _Connections)
    ListenForClient(monitor)
    _ConnectionMonitor = Task.Factory.StartNew(AddressOf DoMonitorConnections, monitor, TaskContinuationOptions.LongRunning)
    Else
    StartStopButton.Text = "Start:"
    StartStopButton.Image = My.Resources.StartServer
    CType(_ConnectionMonitor.AsyncState, MonitorInfo).Cancel = True
    _Listener.Stop()
    _Listener = Nothing
    End If
    End Sub
    Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
    Dim deltaPort As Integer
    If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
    MessageBox.Show("Port number between 1 and 65535", "Invalid Port Number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    PortTextBox.SelectAll()
    e.Cancel = True
    End If
    End Sub
    Private Sub ListenForClient(monitor As MonitorInfo)
    Dim info As New ConnectionInfo(monitor)
    _Listener.BeginAcceptTcpClient(AddressOf DoAcceptClient, info)
    End Sub
    Private Sub DoAcceptClient(result As IAsyncResult)
    Dim monitorinfo As MonitorInfo = CType(_ConnectionMonitor.AsyncState, MonitorInfo)
    If monitorinfo.Listener IsNot Nothing AndAlso Not monitorinfo.Cancel Then
    Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
    monitorinfo.Connections.Add(info)
    info.AcceptClient(result)
    ListenForClient(monitorinfo)
    info.AwaitData()
    Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
    Invoke(doUpdateConnectionCountLabel)
    End If
    End Sub
    Private Sub DoMonitorConnections()
    Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
    Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
    Dim monitorInfo As MonitorInfo = CType(_ConnectionMonitor.AsyncState, MonitorInfo)
    Me.Invoke(doAppendOutput, "Server Started")
    Do
    Dim lostCount As Integer = 0
    For index As Integer = monitorInfo.Connections.Count - 1 To 0 Step -1
    Dim info As ConnectionInfo = monitorInfo.Connections(index)
    If info.Client.Connected Then
    If info.DataQueue.Count > 0 Then
    Dim messageBytes As New List(Of Byte)
    While info.DataQueue.Count > 0
    Dim value As Byte
    If info.DataQueue.TryDequeue(value) Then
    messageBytes.Add(value)
    End If
    End While
    Me.Invoke(doAppendOutput, "Message from IP: " + System.Text.Encoding.ASCII.GetString(messageBytes.ToArray))
    End If
    Else
    monitorInfo.Connections.Remove(info)
    lostCount += 1
    End If
    Next
    If lostCount > 0 Then
    Invoke(doUpdateConnectionCountLabel)
    End If
    _ConnectionMonitor.Wait(1)
    Loop While Not monitorInfo.Cancel
    For Each info As ConnectionInfo In monitorInfo.Connections
    info.Client.Close()
    Next
    monitorInfo.Connections.Clear()
    Invoke(doUpdateConnectionCountLabel)
    Me.Invoke(doAppendOutput, "Server Stoped")
    End Sub
    Private Sub UpdateConnectionCountLabel()
    ConnectionCountLabel.Text = String.Format("{0} Connections", _Connections.Count)
    End Sub
    Private Sub AppendOutput(message As String)
    If RichTextBox1.TextLength > 0 Then
    RichTextBox1.AppendText(ControlChars.NewLine)
    End If
    RichTextBox1.AppendText(message)
    RichTextBox1.ScrollToCaret()
    End Sub
    Private Sub ClearButton_Checked(sender As Object, e As EventArgs) Handles ClearButton.CheckedChanged
    If ClearButton.Checked Then
    RichTextBox1.Clear()
    End If
    End Sub
    End Class
    Public Class MonitorInfo
    Private _listener As TcpListener
    Public ReadOnly Property Listener As TcpListener
    Get
    Return _listener
    End Get
    End Property
    Private _connections As List(Of ConnectionInfo)
    Public ReadOnly Property Connections As List(Of ConnectionInfo)
    Get
    Return _connections
    End Get
    End Property
    Public Property Cancel As Boolean
    Public Sub New(tcpListener As TcpListener, connectionInfoList As List(Of ConnectionInfo))
    _listener = tcpListener
    _connections = connectionInfoList
    End Sub
    End Class
    Public Class ConnectionInfo
    Private _monitor As MonitorInfo
    Public ReadOnly Property Monitor As MonitorInfo
    Get
    Return _monitor
    End Get
    End Property
    Private _Client As TcpClient
    Public ReadOnly Property Client As TcpClient
    Get
    Return _Client
    End Get
    End Property
    Private _DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
    Public ReadOnly Property DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
    Get
    Return _DataQueue
    End Get
    End Property
    Private _Stream As NetworkStream
    Public ReadOnly Property Stream As NetworkStream
    Get
    Return _Stream
    End Get
    End Property
    Public Sub New(monitor As MonitorInfo)
    _monitor = monitor
    _DataQueue = New System.Collections.Concurrent.ConcurrentQueue(Of Byte)
    End Sub
    Private _LastReadLength As Integer
    Public ReadOnly Property LastReadLength As Integer
    Get
    Return _LastReadLength
    End Get
    End Property
    Private _Buffer(63) As Byte
    Public Sub AcceptClient(result As IAsyncResult)
    _Client = _monitor.Listener.EndAcceptTcpClient(result)
    If _Client IsNot Nothing AndAlso _Client.Connected Then
    _Stream = _Client.GetStream
    End If
    End Sub
    Public Sub AwaitData()
    _Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoReadData, Me)
    End Sub
    Private Sub DoReadData(result As IAsyncResult)
    Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
    Try
    If info.Stream IsNot Nothing AndAlso info.Stream.CanRead Then
    info._LastReadLength = info.Stream.EndRead(result)
    For Index As Integer = 0 To _LastReadLength - 1
    info._DataQueue.Enqueue(info._Buffer(Index))
    Next
    'info.SendMessage("Data Diterima " & info._LastReadLength & " Bytes")
    info.SendMessage("reply form server: " & info._LastReadLength & " Bytes")
    For Each otherInfo As ConnectionInfo In info.Monitor.Connections
    If Not otherInfo Is info Then
    otherInfo.SendMessage(System.Text.Encoding.ASCII.GetString(info._Buffer))
    End If
    Next
    info.AwaitData()
    Else
    info.Client.Close()
    End If
    Catch ex As Exception
    info._LastReadLength = -1
    End Try
    End Sub
    Private Sub SendMessage(message As String)
    If _Stream IsNot Nothing Then
    Dim messageData() As Byte = System.Text.Encoding.ASCII.GetBytes(message)
    Stream.Write(messageData, 0, messageData.Length)
    End If
    End Sub
    End Class
    'CLIENT
    Imports System.Net
    Imports System.Net.Sockets
    Public Class ClientForm
    Private _Connection As ConnectionInfo
    Private _ServerAddress As IPAddress
    Private Sub ClientForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    ValidateChildren()
    End Sub
    Private Sub ConnectButton_Checked(sender As Object, e As System.EventArgs) Handles ConnectButton.CheckedChanged
    If ConnectButton.Checked Then
    If _ServerAddress IsNot Nothing Then
    ConnectButton.Text = "Disconnect"
    ConnectButton.Image = My.Resources.StopServer
    Try
    _Connection = New ConnectionInfo(_ServerAddress, CInt(PortTextBox.Text), AddressOf InvokeAppendOutput)
    _Connection.AwaitData()
    Catch ex As Exception
    MessageBox.Show(ex.Message, "Error Connecting to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    ConnectButton.Checked = False
    End Try
    Else
    MessageBox.Show("Invlid IP Server", "Cannt Connect to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    ConnectButton.Checked = False
    End If
    Else
    ConnectButton.Text = "Connect"
    ConnectButton.Image = My.Resources.StartServer
    If _Connection IsNot Nothing Then _Connection.Close()
    _Connection = Nothing
    End If
    End Sub
    Private Sub SendButton_Click(sender As System.Object, e As System.EventArgs) Handles SendButton.Click
    If _Connection IsNot Nothing AndAlso _Connection.Client.Connected AndAlso _Connection.Stream IsNot Nothing Then
    Dim buffer() As Byte = System.Text.Encoding.ASCII.GetBytes(InputTextBox.Text)
    _Connection.Stream.Write(buffer, 0, buffer.Length)
    End If
    End Sub
    Private Sub ServerTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles IPTextBox.Validating
    _ServerAddress = Nothing
    Dim remoteHost As IPHostEntry = Dns.GetHostEntry(IPTextBox.Text)
    If remoteHost IsNot Nothing AndAlso remoteHost.AddressList.Length > 0 Then
    For Each deltaAddress As IPAddress In remoteHost.AddressList
    If deltaAddress.AddressFamily = AddressFamily.InterNetwork Then
    _ServerAddress = deltaAddress
    Exit For
    End If
    Next
    End If
    If _ServerAddress Is Nothing Then
    MessageBox.Show("Cannot resolve Server Address", "invalid Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    IPTextBox.SelectAll()
    e.Cancel = True
    End If
    End Sub
    Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
    Dim deltaPort As Integer
    If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
    MessageBox.Show("Port number between 1 and 65535", "invalid Port number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    PortTextBox.SelectAll()
    e.Cancel = True
    End If
    End Sub
    Private Sub InvokeAppendOutput(message As String)
    Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
    Me.Invoke(doAppendOutput, message)
    End Sub
    Private Sub AppendOutput(message As String)
    If RichTextBox1.TextLength > 0 Then
    RichTextBox1.AppendText(ControlChars.NewLine)
    End If
    RichTextBox1.AppendText(message)
    RichTextBox1.ScrollToCaret()
    End Sub
    Private Sub ButtonClear_Click(sender As Object, e As EventArgs) Handles ButtonClear.Click
    RichTextBox1.Clear()
    InputTextBox.Clear()
    End Sub
    End Class
    Public Class ConnectionInfo
    Private _AppendMethod As Action(Of String)
    Public ReadOnly Property AppendMethod As Action(Of String)
    Get
    Return _AppendMethod
    End Get
    End Property
    Private _Client As TcpClient
    Public ReadOnly Property Client As TcpClient
    Get
    Return _Client
    End Get
    End Property
    Private _Stream As NetworkStream
    Public ReadOnly Property Stream As NetworkStream
    Get
    Return _Stream
    End Get
    End Property
    Private _LastReadLength As Integer
    Public ReadOnly Property LastReadLength As Integer
    Get
    Return _LastReadLength
    End Get
    End Property
    Private _Buffer(63) As Byte
    Public Sub New(address As IPAddress, port As Integer, append As Action(Of String))
    _AppendMethod = append
    _Client = New TcpClient
    _Client.Connect(address, port)
    _Stream = _Client.GetStream
    End Sub
    Public Sub AwaitData()
    _Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoreadData, Me)
    End Sub
    Public Sub Close()
    If _Client IsNot Nothing Then _Client.Close()
    _Client = Nothing
    _Stream = Nothing
    End Sub
    Private Sub DoreadData(result As IAsyncResult)
    Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
    Try
    If info._Stream IsNot Nothing AndAlso info._Stream.CanRead Then
    info._LastReadLength = info._Stream.EndRead(result)
    If info._LastReadLength > 0 Then
    Dim message As String = System.Text.Encoding.ASCII.GetString(info._Buffer)
    info._AppendMethod(message)
    End If
    info.AwaitData()
    End If
    Catch ex As Exception
    info._LastReadLength = -1
    info._AppendMethod(ex.Message)
    End Try
    End Sub
    End Class
    //ScreenShot server
    http://prntscr[dot]com/5t1ol3
    //Screenshot client
    http://prntscr[dot]com/5t1odj
    source: code[dot]msdn[dot]microsoft[dot]com/windowsdesktop/Simple-Multi-User-TCPIP-43cc3b44

    I have a similar chat application. When the user attempts to connect, instead of sending a simple string, the client sends a serialized object(xml string) with all relevant login and session information, this includes the user's IP address. Once the server
    receives said information, depending on the type of TCP broadcast (a custom enumerated type) information from one user may be passed to a single user, or distributed to many users.
    If it helps, here is the TCPBroadcast object I use. But in order for your server to understand it, you kind of have to build your server and client somewhat around it.
    Option Strict On
    Option Explicit On
    Option Infer Off
    Namespace TCPChat
    Public Class TCPBroadcast
    Public Property Message As String
    Public Property BroadCastTime As DateTime
    Public Property DestUser As String
    Public Property OriginUser As String
    Public Property PasswordHash As String
    Public Property BroadcastSourceIP As String
    Public Property BroadCastType As TCPBroadcastType
    Public Property LoginUserName As String
    Public Property FailureReason As String
    Public Function XmlEncoding() As String
    Dim serializer As New Xml.Serialization.XmlSerializer(GetType(TCPBroadcast))
    Dim XML As String = String.Empty
    Using memStream As New IO.MemoryStream
    Using xmlWriter As New Xml.XmlTextWriter(memStream, System.Text.Encoding.UTF8) With _
    {.Indentation = 4, .Formatting = System.Xml.Formatting.Indented}
    serializer.Serialize(xmlWriter, Me)
    End Using
    XML = System.Text.Encoding.UTF8.GetString(memStream.ToArray)
    End Using
    Return XML
    End Function
    Public Function ToBinary() As Byte()
    Return System.Text.Encoding.UTF8.GetBytes(Me.XmlEncoding)
    End Function
    Public Shared Function FromBinary(binary As Byte()) As DeserializationResult
    Dim xml As String = System.Text.Encoding.UTF8.GetString(binary)
    Return FromXML(xml)
    End Function
    Public Shared Function FromXML(xml As String) As DeserializationResult
    Dim DeserializationResult As New DeserializationResult
    DeserializationResult.Error = False
    Try
    Dim deserializer As New Xml.Serialization.XmlSerializer(GetType(TCPBroadcast))
    Dim buffer As Byte() = System.Text.Encoding.UTF8.GetBytes(xml)
    Using memStream As New IO.MemoryStream(buffer)
    DeserializationResult.tcpBroadCast = CType(deserializer.Deserialize(memStream), TCPBroadcast)
    End Using
    Catch ex As Exception
    DeserializationResult.Error = True
    DeserializationResult.ErrorMessage = ex.ToString
    DeserializationResult.AttemptedXML = xml
    End Try
    Return DeserializationResult
    End Function
    Public Class DeserializationResult
    Public [Error] As Boolean
    Public ErrorMessage As String
    Public tcpBroadCast As TCPBroadcast
    Public AttemptedXML As String
    Sub New()
    End Sub
    End Class
    Public Enum TCPBroadcastType
    AdministrativeMessage
    AuthenticationFailure
    AuthenticationSuccess
    ChatBroadcast
    CredentialsRequest
    Credentials
    DisconnectedByServer
    KeepAlive
    PrivateMessage
    ServerMessage
    SystemMessage
    UnableToProcessRequest
    End Enum
    End Class
    End Namespace
    “If you want something you've never had, you need to do something you've never done.”
    Don't forget to mark
    helpful posts and answers
    ! Answer an interesting question? Write a
    new article
    about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

  • How to write a program that runs on a port like a deamon or service?

    hi,
    how to write a program in java that runs on a port like a deamon or service, accepts requests from client, process the request and gives responce.
    for ex. tomcat runs on 8080 port as deamon or service.
    is it socket programming? if yes please give me a simple program which runs on a specific port.
    ex. a program running on a port talking two integers and return the total.
    thanks and regards,
    moses.

    I suggest you read
    [http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html]
    For more
    [http://www.google.co.uk/search?q=serversocket+tutorial]

  • How to write JSP code in Java Script Code

    Hello friends
    I have code like
    <script language="JavaScript">
    function f()
    (some code is here)
    </script>
    Now i wants to put some JSP code in f()
    So can i do this ? IF yes then how ?
    (one solution may be make JSP function and call that JSP function from the f().So in that case how can i call JSP function from JavaScript??
    If other method is there then please mail me

    If it's a simple matter of mixing client-side code with server side code, it can be done so long as you're using the server-side to write the client-side.
    For example:
    <h1>Good Morning Mr. Phelps</h1>
    <input name=anybodyFunction type=text>
    <% if (userIsAdmin) { %>
    <input name=adminOnlyFunction type=text>
    etc.
    <% } %>
    <h1>This browser will self-destruct in ...</h1>
    That's JSP (inside the <% %>) mixed with HTML.
    Javascript goes 100% on the client-side. If you're writing JSP with inter-mixed HTML, you might have to inter-mix the java-script.
    For example: Suppose you need to validate the form. "adminOnlyFunction", among others, is a mandatory field, and you want the Javascript to only submit the form if all mandatory fields are set. Well, if the user is NOT an administrator, then that field WILL be left blank.
    One way to handle that is with mixing JSP/HTML/Javascript on the SERVER side.
    <h1>Good Morning Mr. Phelps</h1>
    <input name=mandatory1 type=text>
    <input name=optional1 type=text>
    <% if (userIsAdmin) { %>
    <input name=adminOnlyFunction type=text>
    <% } %>
    <input name=submit type=button value=Submit onClick="checkit()">
    etc. etc.
    <script language=Javascript>
    function checkit() {
    var f = document.form;
    if (
    � � f.mandatory1.value == ""
    � � || f.mandatory1.value == ""
    � � || f.mandatory2.value == ""
    <% if (userIsAdmin) { %>
    � � || f.adminOnlyFunction.value == ""
    <% } %>
    � � � � ) {alert ("Hey! You left out a required field!!");}
    etc. etc. etc.
    I imagine THIS might be what is meant by "mixing JSP with Javascript", and in this particular fashion, it can be done. What you're doing is making decisions on the server side over what to write out to the client. That client code can make further decisions based on user input.
    However, once it's on the client side, you can not have anymore JSP code. The client NEVER runs JSP code.

  • Async tcp client and server. How can I determine that the client or the server is no longer available?

    Hello. I would like to write async tcp client and server. I wrote this code but a have a problem, when I call the disconnect method on client or stop method on server. I can't identify that the client or the server is no longer connected.
    I thought I will get an exception if the client or the server is not available but this is not happening.
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    How can I determine that the client or the server is no longer available?
    Server
    public class Server
    private readonly Dictionary<IPEndPoint, TcpClient> clients = new Dictionary<IPEndPoint, TcpClient>();
    private readonly List<CancellationTokenSource> cancellationTokens = new List<CancellationTokenSource>();
    private TcpListener tcpListener;
    private bool isStarted;
    public event Action<string> NewMessage;
    public async Task Start(int port)
    this.tcpListener = TcpListener.Create(port);
    this.tcpListener.Start();
    this.isStarted = true;
    while (this.isStarted)
    var tcpClient = await this.tcpListener.AcceptTcpClientAsync();
    var cts = new CancellationTokenSource();
    this.cancellationTokens.Add(cts);
    await Task.Factory.StartNew(() => this.Process(cts.Token, tcpClient), cts.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
    public void Stop()
    this.isStarted = false;
    foreach (var cancellationTokenSource in this.cancellationTokens)
    cancellationTokenSource.Cancel();
    foreach (var tcpClient in this.clients.Values)
    tcpClient.GetStream().Close();
    tcpClient.Close();
    this.clients.Clear();
    public async Task SendMessage(string message, IPEndPoint endPoint)
    try
    var tcpClient = this.clients[endPoint];
    await this.Send(tcpClient.GetStream(), Encoding.ASCII.GetBytes(message));
    catch (Exception exception)
    private async Task Process(CancellationToken cancellationToken, TcpClient tcpClient)
    try
    var stream = tcpClient.GetStream();
    this.clients.Add((IPEndPoint)tcpClient.Client.RemoteEndPoint, tcpClient);
    while (!cancellationToken.IsCancellationRequested)
    var data = await this.Receive(stream);
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    private async Task Send(NetworkStream stream, byte[] buf)
    await stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
    await stream.WriteAsync(buf, 0, buf.Length);
    private async Task<byte[]> Receive(NetworkStream stream)
    var lengthBytes = new byte[4];
    await stream.ReadAsync(lengthBytes, 0, 4);
    var length = BitConverter.ToInt32(lengthBytes, 0);
    var buf = new byte[length];
    await stream.ReadAsync(buf, 0, buf.Length);
    return buf;
    Client
    public class Client
    private TcpClient tcpClient;
    private NetworkStream stream;
    public event Action<string> NewMessage;
    public async void Connect(string host, int port)
    try
    this.tcpClient = new TcpClient();
    await this.tcpClient.ConnectAsync(host, port);
    this.stream = this.tcpClient.GetStream();
    this.Process();
    catch (Exception exception)
    public void Disconnect()
    try
    this.stream.Close();
    this.tcpClient.Close();
    catch (Exception exception)
    public async void SendMessage(string message)
    try
    await this.Send(Encoding.ASCII.GetBytes(message));
    catch (Exception exception)
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    private async Task Send(byte[] buf)
    await this.stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
    await this.stream.WriteAsync(buf, 0, buf.Length);
    private async Task<byte[]> Receive()
    var lengthBytes = new byte[4];
    await this.stream.ReadAsync(lengthBytes, 0, 4);
    var length = BitConverter.ToInt32(lengthBytes, 0);
    var buf = new byte[length];
    await this.stream.ReadAsync(buf, 0, buf.Length);
    return buf;

    Hi,
    Have you debug these two applications? Does it go into the catch exception block when you close the client or the server?
    According to my test, it will throw an exception when the client or the server is closed, just log the exception message in the catch block and then you'll get it:
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.Invoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    Console.WriteLine(exception.Message);
    Unable to read data from the transport connection: An existing   connection was forcibly closed by the remote host.
    By the way, I don't know what the SafeInvoke method is, it may be an extension method, right? I used Invoke instead to test it.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to write a sql query to calculate weights using CTE

    Hi guys,
    want some help using a CTE to generate data using recursive SQL - input data in table A to be transformed into table B shown below
    Table A
    Instru_id_index     instru_id_name    instru_id_constit  con_name   weight
            56                       INDEX A                     
    23                  A                 25
            56                       INDEX A                     
    24                 B                  25
            56                       INDEX A                     
    25                  C                 25
            56                       INDEX A                     
    57              
    INDEX  B       25
            57                      
    INDEX B                     31                 
    D                 33
            57                      
    INDEX B                     32                 
    E                  33
            57                      
    INDEX B                     33                 
    F                  33
    (Logic should be recursive in order to be able to handle multi-level, not just level 2.)
    Table B
    Instru_id_index     instru_id_name    instru_id_constit  constit_name   weight
            56                       INDEX A                        
    23                A                   25
            56                       INDEX A                        
    24                B                   25
            56                       INDEX A                        
    25                C                   25
            56                       INDEX A                        
    31                D                   8.3
            56                       INDEX A                        
    32                E                    8.3
            56                       INDEX A                        
    33                F                    8.3
            57                       
    INDEX B                       31                
    D                   33
            57                       
    INDEX B                       32                E                   
    33
            57                       
    INDEX B                       33               
    F                     33
    how can I write a simple CTE construct to  display the data in table B -  How can i calculate the values of weights as 8.3 respectively - calculate these without changing the structure of the tables.
    Can I do this in a CTE

    Full join?
    Anyway, thanks for Rsignh to produces a script with CREATE TABLE and INSERT statements. I've extended the data to one more level of recursion.
    create table weight_tab(
     instrument_id_index int,
     instrument_id_name varchar(10),
     instrument_id_constituent int,
     constituent_name varchar(10),
     [weight] decimal(10,2))
     insert into weight_tab values
     (56,'INDEX A',23,'A',25),(56,'INDEX A', 24,'B',25),
    (56,'INDEX A',25,'C',25),(56,'INDEX A', 57,'INDEX  B',25),
    (57,'INDEX B',31,'D',33), (57,'INDEX B', 32,'INDEX E',33),
    (57,'INDEX B',33,'INDEX C',33),
    (33,'INDEX C',42,'Alfa',60),
    (33,'INDEX C',43,'Beta',40),
    (32,'INDEX C',142,'Gamma',90),
    (32,'INDEX C',143,'Delta',10)
    go
    SELECT * FROM weight_tab
    go
    ; WITH rekurs AS (
        SELECT instrument_id_index, instrument_id_name, instrument_id_constituent,
               cast(weight as float) AS weight, cnt = 1
        FROM   weight_tab a
        WHERE  NOT EXISTS (SELECT *
                           FROM   weight_tab b
                           WHERE  b.instrument_id_constituent = a.instrument_id_index)
        UNION ALL
        SELECT r.instrument_id_index, r.instrument_id_name, w.instrument_id_constituent,
               r.weight * w.weight / 100, r.cnt  + 1
        FROM   rekurs r
        JOIN   weight_tab w ON r.instrument_id_constituent = w.instrument_id_index
        WHERE r.cnt < 4
    SELECT instrument_id_index, instrument_id_name, instrument_id_constituent,
           cast(weight AS decimal(10,2))
    FROM   rekurs
    go
    DROP TABLE weight_tab
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to write the expression when create the calculated column?

    Dear,
           I want to create some calculated column in my attribute view, but I don't know how to write the code in the expression, is there any introduction about this part, how to use those function and how about the grammar in this expression code ?  or is there any example about this calculated column?
       Thanks for your sincerely answer.

    Hi Zongjie,
    you can find some information about the creation of calculated columns in the HANA Modeling Guide (http://help.sap.com/hana/SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en.pdf).
    Within chapter 6.2.1 (Create Analytic Views) you can see under point 7 some basics and also a simple example. The same is also valid for Calculation Views.
    Chapter 8.9 (Using Functions in Expressions) describes the different available functions.
    You also can use the integrated search in the HANA Studio by clicking the "?" button in the button left corner. Then you get some links in the side panel with related information.
    In general you can write your expression manually or you can just drag and drop the functions, elements, operators into the editor window. For example if you drag and drop the "if" function into the editor window you get "if(intarg,arg2,arg3)" inserted. The arguments can be replaced manually or also by drag and drop.
    It is also worse to use the "Validate Syntax" button on top of the editor window. It gives you directly a feedback if your expression syntax is correct. If not you get some helpful information about the problem (ok, sometimes it is a little bit confusing because of the cryptic error message format ).
    Best Regards,
    Florian

  • Can anyone share with me how you  write Javadoc?

    Can anyone share with me how their companies write Javadoc?
    Are your developers solely responsible for it? Do your technical writers own it or review it? How do you make sure it's good?
    Right now, my software developers are mostly responsible for writing all the API info and it's of poor quality and really lacking details. I don't mean spelling/grammar-type problems. My developers just don't seem to "get" what information to include, no matter how many guidelines or checklists I give them.
    A very simple example is:
    * Gets the status
    public java.lang.Integer getStatus() {...}With no indication of what status values may be returned and what the values might mean.
    How do you ensure that what you write is actually useful? Please help!
    I'm aware of the method Sun recommends, but I want to know what others do.
    Thank you

    Hi,
    Well, concerning the question what a good API documentation should be. Just imagine, you are a programmer and you want to use that API. You need to know how it works. There can be only three ways to find it:
    (1) The API documentation
    (2) Probing experiments. Even a good documentation may not describe everything. Sometimes, the only way to understand certain things you particularly need may be guessing something, writing a code basing on it and see how it works. Then, guessing something again, more precisely now, and so on. Even a very good documented API (for instance, javax.swing) may require that sort of approach to be able to use it eventually.
    (3) At last, when source codes are available, one may look at them and try to understand precisely, what a particular method actually does.
    I think the better the API documentation the less one may need to endeavor those two last steps. There is actually a limit about it. Without any proper explanation at all, one may never be able to use a particular API, neither after probing it nor after looking at source codes (that is not to say the sources may be simple unavailable at all).
    Concerning how to write the API documentation, that's mostly the question of managing your team. I think, basically, the original source of the ultimate information about everything implemented in the projects are those very programmers (developers) and, probably, some software architects. But those guys normally are not especially eager to write any documentation (especially developers). That your example just demonstrates it. It seems, your programmers just wrote that "Gets the status" for you to make them leave in rest after that. In addition, the programmers normally have such a sort of work and activity that does not match particularly well with the writing literature and doing their main job simultaneously. You should not enforce them to do that!
    To write a good documentation, you will need to engage a technical writer. That's normally a guy with some programming background. However, writing some literature is actually what he does the best. (Sometimes, such people do something else about written word beyond the technical writing.) The job of that guy would be to write the documentation. This will take from him (or her) two basic things:
    (1) The ability to understand the whole software system (that's where his programming background will be needed!);
    (2) To communicate with the programmers who have developed the stuff and to obtain from them all the necessary information they know. That may require some personal (verbal) communication with them, because asking them to write everything again will only result in the same "Gets the status" explanations. However, to be successful in this, the technical writer needs to have some explicit management approval behind him. Otherwise, some of the guys will avoid speaking to him at all (saying they lack the time). So, the management should assign them the necessary priority for such communications.
    Particularly big projects may even need to have the whole team of technical writers.
    Anyway, writing docs is a hard work. But it is extremely important! The good documentation may both increase your sales and eliminate lots of expense on further support of your customers.
    Regards,
    Leonid Rudy
    http://www.docflex.com

  • How to create a simple idoc in practice? can you provide an example?

    how to create a simple idoc in practice? can you provide an example with full source code?

    Try with the follwoing steps
    Sending System(Outbound ALE Process)
    Tcode SALE „³ for
    a) Define Logical System
    b) Assign Client to Logical System
    Tcode SM59-RFC Destination
    Tcode BD64 ¡V Create Model View
    Tcode BD82 ¡V Generate partner Profiles & Create Ports
    Tcode BD64 ¡V Distribute the Model view
    This is Receiving system Settings
    Receiving System(Inbound ALE )
    Tcode SALE „³ for
    a) Define Logical System
    b) Assign Client to Logical System
    Tcode SM59-RFC Destination
    Tcode BD64 ¡V Check for Model view whether it has distributed or not
    Tcode BD82 -- Generate partner Profiles & Create Ports
    Tcode BD11 Getting Material Data
    Tcode WE05 ¡V Idoc List for inbound status codes
    Message Type MATMAS
    Tcode BD10 ¡V Send Material Data
    Tcode WE05 ¡V Idoc List for watching any Errors
    1)a Goto Tcode SALE
    Click on Sending & Receiving Systems-->Select Logical Systems
    Here Define Logical Systems---> Click on Execute Button
    go for new entries
    1) System Name : ERP000
    Description : Sending System
    2) System Name : ERP800
    Description : Receiving System
    press Enter & Save
    it will ask Request
    if you want new request create new Request orpress continue for transfering the objects
    B) goto Tcode SALE
    Select Assign Client to Logical Systems-->Execute
    000--> Double click on this
    Give the following Information
    Client : ERP 000
    City :
    Logical System
    Currency
    Client role
    Save this Data
    Step 2) For RFC Creation
    Goto Tcode SM59-->Select R/3 Connects
    Click on Create Button
    RFC Destination Name should be same as partner's logical system name and case sensitive to create the ports automatically while generating the partner profiles
    give the information for required fields
    RFC Destination : ERP800
    Connection type: 3
    Description
    Target Host : ERP000
    System No:000
    lan : EN
    Client : 800
    User : Login User Name
    Password:
    save this & Test it & RemortLogin
    3)
    Goto Tcode BD64 -- click on Change mode button
    click on create moduleview
    short text : xxxxxxxxxxxxxx
    Technical Neme : MODEL_ALV
    save this & Press ok
    select your just created modelview Name :'MODEL_ALV'.
    goto add message type
    Model Name : MODEL_ALV
    sender : ERP000
    Receiver : ERP800
    Message type :MATMAS
    save & Press Enter
    4) Goto Tcode BD82
    Give Model View : MODEL_ALV
    Partner system : ERP800
    execute this by press F8 Button
    it will gives you sending system port No :A000000015(Like)
    5) Goto Tcode BD64
    seelct the modelview
    goto >edit>modelview-->distribute
    press ok & Press enter
    6)goto Tcode : BD10 for Material sending
    Material : mat_001
    Message Type : MATMAS
    Logical System : ERP800
    and Execute
    7)goto Tcode : BD11 for Material Receiving
    Material : mat_001
    Message Type : MATMAS
    and Execute --> 1 request idoc created for message type Matmas
    press enter
    Thanks & regards
    Sreenivas
    Here Master Idoc set for Messge type MATMAS-->press Enter
    1 Communication Idoc generated for Message Type
    this is your IDOC
    Take a look at this guide.
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    http://www.allsaplinks.com/idoc_sample.html
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapgenie.com/ale/configuration.htm
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapdevelopment.co.uk/training
    http://www.sappro.com/downloads/OneClientDistribution.pdf
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    Create The Extension Segment
    Transaction: WE31
    The first step in extending an IDoc is to create the new segments that will go into that IDoc. There are some rules that you need to follow when creating the segments:
    - The name of each segment type must start with ‘Z1’
    - For each field in the segment you need to define a field name and a
    data element.
    - The data element for the segment structure must be of data type ‘CHAR’.
    How to create new segments:
    Run the segment maintenance transaction WE31.
    Type your new segment name, and click on Create.
    Define the fields of your segment:
    Field name
    Data Element for the field (from the ABAP dictionary).
    Do not change the Export length!
    Save the segment
    Run Segment -->Check to check the segment for consistency.
    Release the segment for transport. Select Edit -->Set Release. Note that the “Release’ column now has a check mark.
    Create the Extension IDoc Type
    Transaction: WE30
    After you create the segments to be added to the extension type, you can create the extension type itself. Execute transaction WE30, enter the extension name, select Extension type, and click Create. You now have three options:
    Create new type: Does not refer to other extension types
    Create copy: Copies info from an extension type that already exists
    Create successor: Extends an extension type from a previous release
    of R/3. You can only have one version of an extension type for
    each release.
    Enter the Basic IDoc type that this extension type will extend.
    The screen now shows the structure of the IDoc type you used as
    a reference.
    Position the cursor on one of the segments and click Create. This will insert an extension segment as a child of the selected segment.
    NOTE: A segment cannot appear more than once in an IDoc type! You must control the use of duplicate segments with the segment attributes (the next screen).
    The segment attribute screen appears. Enter the information and save.
    Extension segments should not be mandatory (for future upgrades), and will need to have minimum and maximum number of instances defined. This answers the question, “for each instance of the parent segment, how many instances of the child segment may we have?”
    You can press the Segment Editor pushbutton to view or change the segment definition.
    Create the new Message Type
    You can only use an extension IDoc type by assigning it to a message type. You can create a new message type for this.
    First the message type itself needs to be created.
    Transaction: WE81
    Create a new entry and save. Use SAP established customer naming conventions (good form is to start with a Z and retain the rest of the related SAP message type, so, for example, MATMAS becomes ZMATMAS).
    After creating the message type, associate it with the corresponding Basic IDoc Type and Extension Type. This relationship is used when IDocs are sent to or received from a partner to determine what segments are valid and what the hierarchy for those segments is.
    Transaction: WE82
    Create a new entry and enter the Message type, Basic IDoc type, Extension type, and Release, and save your data. Note: the release assignment is not valid for prior SAP releases.
    One message type can be associated with many basic IDoc types; however, you need a one-to-one relationship for distribution via ALE.
    regards,
    srinivas
    *reward for useful answers*</b>

Maybe you are looking for

  • 10g RAC ASM AIX 5.3 error message repeating in crsd.log

    The crsd .log file is filling up repeatedly with the following message 2007-06-06 22:02:03.545: [  CRSEVT][629]32CAAMonitorHandler :: 0:Action Script for resource 'ora.lavl001.LISTENER_LAVL001.lsnr' stdout redirection failed for `/u02/home/oracle/pro

  • Map Builder JavaScript API

    Hello everybody, I'm a student who is currently working with Oracle for the first time. I developed an Web mapping application by using Oracle XE Database (10g), Oracle Map Viewer and corresponding Map Builder (the latest version). I choose the JavaS

  • Plant Connectivity - RFC Destination

    Hi, I configured Plant Connectivity 2.0 (V2.0.0.33) according to the following document: SAP Plant Connectivity 2.0 - Configuration Guide for EWM On the EWM side one have to create a TCP/IP connection. There is a brief instruction in the EWM help: Se

  • Install disk 1 + wireless mighty mouse

    when i re-boot using install disk 1 the process comes to a stop when it comes to the graphic showing how to put the batteries in and switch on the mighty mouse,there is just the spinning disk at the bottom of the screen.after alot of trial and error

  • Snapshot Query

    Is there any way to speed up the process of getting Snap Shot Query information to match what is in the KD after a crawler has run? It takes about 15 minutest to see a change otherwise. I cannot find any job intrinsically for SnapShot Queries. Thanks