Int[][][][][][][][] problem

All through vector can solve such problem.but this time, I will use array because there are some null value. and using vectors will lost the positions.
I can do int[][][][][][] a=new int[][][][][]. create it, initial it and print it.
but how can create a none certain int array. say it may be int[], or int[][], or int[][][].
Are there any command say:
int{7}=int[9][9][9][9][9][9][9];
or if it's not possible. but that's just syntax problem. how can create a int[][][][][][] in this way:
int[]a=new int[];
int[]b=new int[];
int[]a[0]=b;
but i can not do that.
any help?

Please avoid cross-posting the same question into different forums in the future. I have answered your question at:
http://forum.java.sun.com/thread.jsp?forum=54&thread=189313

Similar Messages

  • Characters(char,int,int) problem ???

    Hello, I'm using SAX to parse an XML file, but i run into a problem with the characters() method (well that's what I think). I use it to get the contents of text nodes, but sometimes (actually, only once) it will return only half of the text. But, you will tell me, this should be normal since the parser is allowed to call it twice in a row.
    But I create a StringBuffer myStringBuffer, then in characters(char[] buffer,int offset,int length) i do myStringBuffer.append(buffer,offset,length) and in endElement i try to process myStringBuffer, but still it contains only half of the text. This is all the more strange to me that my XML file is full of text nodes much longer than the troublesome one and i have no problem with those...and when i extract this s***** node and put it into another XML file, it works fine.
    So I'm somehow confused.
    Thanks in advance.

    Your logic certainly looks like it should work, but obviously it doesn't. Here's what I do:
    1. In the startElement() method, create an empty StringBuffer.
    2. In the characters() method, append the characters to it. Incidentally you don't need to create a String like you do, there's an "append(char[] str, int offset, int len)" method in StringBuffer which is very convenient in this case.
    3. In the endElement() method, use the contents of the StringBuffer.
    As for why parsers split text nodes, don't try to second-guess that. It's not your business as a user of the SAX parser. Some parsers will read the XML in blocks, and if a block happens to end in the middle of a text node, it splits the text node there. Others will see the escape "&" in a text node and split the node into three parts, the part before the escape, a single "&" character, and the part after it. Saves on string manipulation, you see. There could be other reasons, too.

  • Unsigned int - problem translating c++ function to java

    OK so here's the deal:
    I'm writing a client for a internet comunicator in java (J2ME to be precise). Unfortunately i have specs for this comunicator's protocol for c++ programing. The first problem I ran to is: I have to calculate a hash for a password so it doesn't go plain text on the network. The function in c++ that does this is:
    int getPasswordHash(char *password, int seed){
        unsigned int x=0, y=0, z=0;
        char *pwd = password;
        y = seed;
        for (x = 0; *password; password++) {
         x = (x & 0xffffff00) | *password;
         y ^= x;
         y += x;
         x <<= 8;
         y ^= x;
         x <<= 8;
         y -= x;
         x <<= 8;
         y ^= x;
         z = y & 0x1f;
         y = (y << z) | (y >> (32 - z));
        cout << "Hash for \"" << pwd << "\" with seed \"" << seed << "\": " << y << "\n";
        return y;
    }My translation to java goes:
    public int getPasswordHash(String password, int seed){
        long x = 0, y = 0, z = 0;
        int tmp = 0;
        String pwd = password;
        y = seed;
        for (x = 0; x < password.length(); x++){
            tmp = (int)x;
            x = x | password.charAt(tmp);
            y ^= x;
            y = uintadd(y, x);
            x <<= 8;
            y ^= x;
            x <<= 8;
            y = uintsubst(y, x);
            x <<= 8;
            y ^= x;
            z = y & 0x1f;
            y = (y << z) | (y >> (32 - z));
            x = tmp;
        System.out.println("Hash for \""+ pwd + "\" with seed \"" + seed + "\": " + y);
        return (int)y;
    public long uintadd (long x, long y){
        long xL = x & 0xffffffffL;
        long yL = y & 0xffffffffL;
        long sumL = xL + yL;
        long sum = (sumL & 0xffffffffL);
        return sum;
    public long uintsubst (long x, long y){
        long xL = x & 0xffffffffL;
        long yL = y & 0xffffffffL;
        long sumL = xL - yL;
        long sum = (sumL & 0xffffffffL);
        return sum;
    }So I use the uintadd and uintsubst to add and substract values that should be unsigned int. Every operation works exactly like in c++ (I've checked) until this point:y = (y << z) | (y >> (32 - z));and to be exact (y << z) This doesn't turn out like in c++ so the whole function doesn't return the right vaule. I know it's because doing a bit operation on a unsigned int in c++ is different in than in java because unsigned variables have totally different bit values than signed ones. The question is: how to work this out. I managed to do aritmetic operations working but I have no idea how to deal with this. Any help would be great.

    I'm by no means the expert with this, but I'm going
    to guess that this would work...
    y = ((y << z) & 0xffffffffL) | (y >> (32 - z));
    thus... to zero out the right shifted 1's before the
    orWOW WOW WOW it totaly works thanks alot bsampieri !!

  • Int problem still?

    I am trying to convert an Integer to int and I figured out the .intValue()........thanks to some of you, but my problem isn't totally solved?????
    I am getting an error saying " missing term" now!
    The following is exactly what I am trying to do, I take in a date as 3/12/2002, and I am using string tokenizer to divide this up into day month and year! I then want to be able to assign these int values to the function calA:
    Calendar calA = Calendar.getInstance();
    int std = 0;
    int stm = 0;
    int sty = 0;
    StringTokenizer st = new StringTokenizer(StartDate, "/");
    Integer stday = new Integer((String)st.nextElement());
    Integer stmonth= new Integer((String)st.nextElement());
    Integer styear = new Integer((String)st.nextElement());
    std = stday.intValue();
    stm = stmonth.intValue()-1;
    sty = styear.intValue();
    calA.set(stm,std,sty);
    Can you PLEASE HELP :) I am desperate!

    To parse a date, you'd better use java.text.SimpleDateFormat instead of trying to do it yourself with a StringTokenizer.
    String startDate = "3/12/2002";
    // I guess you have a date with format month/day/year
    DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
    // Parse into a Date object
    Date date = df.parse(startDate);
    // Set the calendar
    Calendar calA = Calendar.getInstance();
    calA.setTime(date);Jesper

  • Reading int problem

    Hi there, I am writing a client server program in which I get two integers in client and then I have to send them to the server. I have sent the integers in client as follows:
    outToServer.writeInt(x); // where outToServer is the DataOutputStream object reference
    outToServer.writeInt(y);
    But when I try read at server as follows:
    int clientx = inFromClient.read();
    and when I do :
    System.out.println("clientx = "+ clientx);
    I get clientx = 0; instead of a specific number.
    Am I doing the right thing by using read() or is there any other way I can read an integer from the BufferedReader?

    DataInput/OutputStream must be used symmetrically. That means that if you write with writeInt, you must read with readInt, not Reader.read(). If you actually read the documentation for Reader.read(), you'll see it "reads one character from the input stream". That's obviously not what you want!
    Lesson, use it symmetrically! If you're writing with a DataOutputStream, read with a DataInputStream.

  • 2960S management int problem

    I have a stack of 2 2960S switches that are dedicated for the storage net, only between SAN and blade system.
    I have configured fastethernet0 (management interface) for static ip 192.168.163.25 which is then connected to my core data switch, so i can manage the storage switch.
    So here is the issue: if there is nothing connected to that stack at all, except the management int the switch pings and i can telnet to it.
    However, if i boot the stack with all storage network uplinks and downlinks connected the management int does not ping and i have no access to the switch. As soon as i unplug the last cable, the management interface starts to ping and i can telnet in. Then i can plug all the cables and everything works fine, until i reboot the switch again.
    Anybody have any ideas whats going on?
    I can paste the config if needed.

    I understand that, and do not want to use it as a data carrying port.
    All i want to do it to use it for telnet, mgmt, but i can't because it doesn't ping after the switch boots up if i have the rest of the data cables plugged it.
    Below is the config:
    ! Last configuration change at 09:51:19 Central Tue Jun 1 2010
    ! NVRAM config last updated at 10:22:06 Central Tue Jun 1 2010
    version 12.2
    no service pad
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    hostname BEP-2960-SAN1
    boot-start-marker
    boot-end-marker
    enable secret
    enable password
    no aaa new-model
    clock timezone CST -6
    clock summer-time Central recurring
    switch 1 provision ws-c2960s-24td-l
    switch 2 provision ws-c2960s-24td-l
    authentication mac-move permit
    ip subnet-zero
    no ip source-route
    no ip gratuitous-arps
    ip domain-list
    ip domain-list
    ip domain-name
    vtp mode transparent
    spanning-tree mode pvst
    spanning-tree etherchannel guard misconfig
    spanning-tree extend system-id
    vlan internal allocation policy ascending
    vlan 10
    name Storage
    vlan 11
    name VMotion
    interface Port-channel1
    description Etherchannel to ESXi PROD1
    switchport trunk allowed vlan 10,11
    switchport mode trunk
    switchport nonegotiate
    flowcontrol receive desired
    interface Port-channel2
    description Etherchannel to ESXi PROD2
    switchport trunk allowed vlan 10,11
    switchport mode trunk
    switchport nonegotiate
    flowcontrol receive desired
    interface FastEthernet0
    description Management
    ip address 192.168.163.25 255.255.255.0
    interface GigabitEthernet1/0/1
    description Connection to ESXi PROD1
    switchport trunk allowed vlan 10,11
    switchport mode trunk
    switchport nonegotiate
    speed 1000
    duplex full
    flowcontrol receive desired
    spanning-tree portfast trunk
    channel-group 1 mode on
    interface GigabitEthernet1/0/2
    description Connection to ESXi PROD2
    switchport trunk allowed vlan 10,11
    switchport mode trunk
    switchport nonegotiate
    speed 1000
    duplex full
    flowcontrol receive desired
    spanning-tree portfast trunk
    channel-group 2 mode on
    interface GigabitEthernet1/0/3
    interface GigabitEthernet1/0/24
    description Connection to BEP-FAS-02 1G
    switchport access vlan 10
    switchport mode access
    flowcontrol receive desired
    spanning-tree portfast
    interface GigabitEthernet1/0/25
    shutdown
    interface GigabitEthernet1/0/26
    shutdown
    interface TenGigabitEthernet1/0/1
    description Connection to BEP-FAS-01 10G
    switchport access vlan 10
    switchport mode access
    flowcontrol receive desired
    spanning-tree portfast
    interface TenGigabitEthernet1/0/2
    interface GigabitEthernet2/0/1
    description Connection to ESXi PROD1
    switchport trunk allowed vlan 10,11
    switchport mode trunk
    switchport nonegotiate
    speed 1000
    duplex full
    flowcontrol receive desired
    spanning-tree portfast trunk
    channel-group 1 mode on
    interface GigabitEthernet2/0/2
    description Connection to ESXi PROD2
    switchport trunk allowed vlan 10,11
    switchport mode trunk
    switchport nonegotiate
    speed 1000
    duplex full
    flowcontrol receive desired
    spanning-tree portfast trunk
    channel-group 2 mode on
    interface GigabitEthernet2/0/3
    interface GigabitEthernet2/0/24
    description Connection to BEP-FAS-01 1G
    switchport access vlan 10
    switchport mode access
    flowcontrol receive desired
    spanning-tree portfast
    interface GigabitEthernet2/0/25
    interface GigabitEthernet2/0/26
    interface TenGigabitEthernet2/0/1
    description Connection to BEP-FAS-02 10G
    switchport access vlan 10
    switchport mode access
    flowcontrol receive desired
    spanning-tree portfast
    interface TenGigabitEthernet2/0/2
    interface Vlan1
    no ip address
    shutdown
    interface Vlan10
    description Storage
    ip address 192.168.10.1 255.255.255.0
    interface Vlan11
    description VMotion
    ip address 192.168.11.1 255.255.255.0
    ip http server
    ip http secure-server
    ip sla enable reaction-alerts
    snmp-server community read RO
    snmp-server community write RW
    ntp clock-period 22518825
    ntp server 192.168.168.2 key 0 prefer
    end

  • MSI 651M Combo-L Video Int problems

    I have install at MSI 651M Combo-L Windows XP prof+SP1 (Windows 2000 prof+SP3/SP4). After install Video drivers for intergration video, my system is abend with error 0x7F. With using Windows 98 - video is installation and work - good. My BIOS - 1.3, Video Drivers - Driver version: Win2K/XP: 6.14.10.2170.
    Please help.

    a marginal psu may be?
    http://www.memtest86.com on ram

  • Logical measure column

    I created new flag in informatica to identify a service request which fall for certain conditions.
    If the service request fall under conditions and then i will mark as 1. If not then 0.
    I defined this as INT in physical layer.
    and my new logical column is like the following:
    count distinct(Case when service_request_flag = 1 then row_wid else null end)
    When i run the reports, it is pulling the service request which got value zero.
    I am not sure why it is pulling zero service request.
    can any tell me what is the issue. is the data type INT problem?
    Thanks

    HI,
    You said, you changed datatype of that column to int .
    What is the default datatype when you imported from warehouse...??
    And what is the reason that you changed to INT ???
    If you think that this is the problem then,
    you better check by right clicking that column in physical layer and select View Data...
    Is there any error coming while retrieving or did you get the expected results...??
    And as you are putting row_wid.. what you want exactly from this column??
    Please these information ...
    Thanks & Regards
    Kishore Guggilla

  • Popup window in  servlets

    hi all,
    i have a problem.i have a servlet which generates a loginpage on which i have the username textbox and the password textbox and two buttons , "login" and "New User".when the user clicks on the "NewUser" a registration form will be opened where u have userid and password along with all the other general details . here in case the user enters a userid that is alredy existing in my user table then , on the same screen itself i want to give a alert message box , or a popup window saying "userid already existing , please try a new one". so how do i do it ? the servlet which generates the registration page is given below:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.io.*;
    public class Register extends HttpServlet
         JdbcConnection connect=new JdbcConnection();
         OsbBean osbbean=new OsbBean();
         public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException , IOException
              PrintWriter out=res.getWriter();
              res.setContentType("text/html");
              Connection con=connect.getConnection();
              Statement stmt=connect.getStatement();
              ResultSet rs=null;
              String fromloginpg=req.getParameter("myregister");
              if(null!=fromloginpg && fromloginpg.equals("calling from loginpg"))
                   String registerdone=req.getParameter("btn_registerdone");
                   out.println("<html>");
                   out.println("<head>");
                   out.println("<title>Welcome To Online Stock Market</title>");
                   out.println("</head>");
                   out.println("<body>");
                   out.println("<font size='+1' color='#800000'><b>Please Enter Your Details</b></font>");
                   out.println("<br><br><br>");
                   out.println("<form method=post action=''>");
                   out.println("<table align='center' border='0' cellspacing='0' cellpadding='0' width='70%'>");
                   out.println("<tr>");
                   out.println("<td>Full Name</td>");
                   out.println("<td><input type='text' name='text_username' size='20'></td>");
                   out.println("</tr>");
                   out.println("<tr>");
                   out.println("<td>Password</td>");
                   out.println("<td><input type='password' name='text_password' size='20'></td>");
                   out.println("</tr>");
                   out.println("<tr>");
                   out.println("<td>Job</td>");
                   out.println("<td><input type='text' name='text_job' size='20'></td>");
                   out.println("</tr>");
                   out.println("<tr>");
                   out.println("<td>City/State</td>");
                   out.println("<td><input type='text' name='text_citystate' size='20'></td>");
                   out.println("</tr>");
                   out.println("<tr>");
                   out.println("<td>Zip Code</td>");
                   out.println(" <td><input type='text' name='text_zipcode' size='20'></td>");
                   out.println("</tr>");
                   out.println("<tr>");
                   out.println("<td>Creditcard Number</td>");
                   out.println("<td><input type='text' name='text_creditcard' size='20'></td>");
                   out.println("</tr>");
                   out.println("<tr>");
                   out.println("<td>Email-Id</td>");
                   out.println("<td><input type='text' name='text_email' size='20'></td>");
                   out.println("</tr>");
                   out.println("</table>");
                   out.println("<p align='center'><input align='center' name='btn_registerdone' type='submit' value='Done' ></p>");
                   out.println("</body>");
                   out.println("</html>");
              if(null!=registerdone && registerdone.equals("Done"))
                   int zip1=0;
                   long creditcard1=0;
                   int userid=0;
                   String username=req.getParameter("text_username");
                   String userpwd=req.getParameter("text_password");
                   String job=req.getParameter("text_job");
                   String citystate=req.getParameter("text_citystate");
                   String zip=req.getParameter("text_zipcode");
                   try{
                        zip1=Integer.parseInt(zip);
                   catch(NumberFormatException e) {
                        out.println(" numberformatexception in registeruser");
                        e.printStackTrace();
                        System.out.println("register user , zip problem");}
                   String creditcard=req.getParameter("text_creditcard");
                   try{
                        creditcard1=Long.parseLong(creditcard);
                   catch(NumberFormatException e) {
                        out.println(" numberformatexception in registeruser");
                        e.printStackTrace();
                        System.out.println("register user , int problem");}
                   String emailid=req.getParameter("text_email");
                   userid=osbbean.getNextUserId();
                   osbbean.registerUser(username, userid, userpwd, job, citystate, zip1, emailid, creditcard1);
                   res.sendRedirect("http://localhost/Login1.html");
         public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException
              doPost(req, res);
    please help me out
    thanks in advance
    kng29

    First, break the actual registration out into a seperate method (something like):
    private boolean registerUser( HttpServletRequest req )
        Connection con=connect.getConnection();
        int zip1=0;
        long creditcard1=0;
        int userid=0;
        String username=req.getParameter("text_username");
        String userpwd=req.getParameter("text_password");
        String job=req.getParameter("text_job");
        String citystate=req.getParameter("text_citystate");
        String zip=req.getParameter("text_zipcode");
        try
            zip1=Integer.parseInt(zip);
        catch(NumberFormatException e)
            out.println(" numberformatexception in registeruser");
            e.printStackTrace();
            System.out.println("register user , zip problem");
        String creditcard=req.getParameter("text_creditcard");
        try
            creditcard1=Long.parseLong(creditcard);
        catch(NumberFormatException e)
            out.println(" numberformatexception in registeruser");
            e.printStackTrace();
            System.out.println("register user , int problem");
        String emailid=req.getParameter("text_email");
        // See if username exists prior to insert.
        PreparedStatement ps = con.prepareStatement(
            "SELECT COUNT(*) FROM ... WHERE username = ?"
        ps.setString( 1, username );
        ResultSet rs = ps.executeQuery();
        // if the result of the query is a count greater than 0
        //    then the username already exists
        rs.next();
        if (rs.getInt(1) > 0)
            return false;
        // otherwise, username doesn't exist
        userid=osbbean.getNextUserId();
        osbbean.registerUser(username, userid, userpwd, job, citystate, zip1, emailid, creditcard1);
        return true;
    }Then in the page generation, do the following (modifying doPost):
    public void doPost (HttpServletRequest req, HttpServletResponse res)
    throws ServletException , IOException
        PrintWriter out = res.getWriter();
        String errMsg = "";
        res.setContentType("text/html");
        String fromloginpg = req.getParameter("myregister");
        if ("calling from loginpg".equals(fromloginpg))
            String registerdone = req.getParameter("btn_registerdone");
            if ("Done".equals(registerdone))
                if (!registerUser(req))
                    errMsg = "userid already existing , please try a new one";
        out.println....
        out.println("<table align='center' border='0' cellspacing='0' cellpadding='0' width='70%'>");
        if (!errMsg.equals(""))
            out.println( "<tr><td colspan=2>" + errMsg + "<td><tr>" );
        out.println....
    }If you really want a "popup box", then remove the conditional print of the error msg into the HTML table, and right after the open BODY tag add a dynamically generated JavaScript alert statement:if (!errMsg.equals(""))
        out.println( "<SCRIPT LANGUAGE=JavaScript>" );
        out.println( "alert( ' " + errMsg + " ' )" );
        out.println( "</SCRIPT>" );
    }

  • Web test result for a URL which needs a client certificate to authenticate

    Hi,
    we want to check URL response of a .asmx URL which needs a client certificate for authenticating.
    I got the cert object and then passed it to invoke-webrequest cmdlet, but no matter what i try I always get this error
    “The underlying connection was closed”.
    code1
    $WebClient = New-Object System.Net.WebClient
    [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
    $WebClient.DownloadString(“https://server1/mywebservices/myser.asmx”)
    code2
    $url=”https://server1/mywebservices/myser.asmx”
    $cert=(Get-ChildItem cert: -Recurse | where {$_.Thumbprint -eq “abcdefgh3333…..something”}| Select -First 1)
    [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
    #load my client certificate defined by thumbprint
    $HTTP_Request = [System.Net.WebRequest]::Create($url)
    $HTTP_Request.ClientCertificates.Add($cert )
    # We then get a response from the site.
    $HTTP_Response = $HTTP_Request.GetResponse()
    Can someone please help me.
    Thanks
    Manish

    Hi Anna
    Thanks for the reply.
    I used the function referred earlier in my script, as below.
    It is still throwing error. However it does work in powershell v2.
    Is there any specific change required in the script to make it work with V3. I tried invoke-webrequest and it failed too.
    function Ignore-SSLCertificates
        $Provider = New-Object Microsoft.CSharp.CSharpCodeProvider
        $Compiler = $Provider.CreateCompiler()
        $Params = New-Object System.CodeDom.Compiler.CompilerParameters
        $Params.GenerateExecutable = $false
        $Params.GenerateInMemory = $true
        $Params.IncludeDebugInformation = $false
        $Params.ReferencedAssemblies.Add("System.DLL") > $null
        $TASource=@'
            namespace Local.ToolkitExtensions.Net.CertificatePolicy
                public class TrustAll : System.Net.ICertificatePolicy
                    public bool CheckValidationResult(System.Net.ServicePoint sp,System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Net.WebRequest req, int problem)
                        return true;
        $TAResults=$Provider.CompileAssemblyFromSource($Params,$TASource)
        $TAAssembly=$TAResults.CompiledAssembly
        ## We create an instance of TrustAll and attach it to the ServicePointManager
        $TrustAll = $TAAssembly.CreateInstance("Local.ToolkitExtensions.Net.CertificatePolicy.TrustAll")
        [System.Net.ServicePointManager]::CertificatePolicy = $TrustAll
    $url="https://server1/mywebservices/myser.asmx"
    $certs = Get-ChildItem Cert:\CurrentUser\My | where {
    $_.Thumbprint -eq “abcdefgh3333…..something”} 
    $HTTP_Request = [System.Net.WebRequest]::Create($url)
    Ignore-SSLCertificates
    try
        $HTTP_Request.ClientCertificates.Add($certs )
        # We then get a response from the site.
        $HTTP_Response = $HTTP_Request.GetResponse()
    catch [System.exception]
        Write-Error $error[0].Exception
    $HTTP_Status = [int]$HTTP_Response.StatusCode
    Manish

  • Create RSS feed for Narrow casting

    We are using narrow casting and we can stream content to it using an RSS-feed.
    We want to do the following: - Create an rss feed of an exchange (mailbox or calendar) using a script. I think it is just like this link. Or as shown below: 
    ###Code from http://poshcode.org/?show=669
    # Creates an RSS feed
    # Parameter input is for "site": Path, Title, Url, Description
    # Pipeline input is for feed items: hashtable with Title, Link, Author, Description, and pubDate keys
    Function New-RssFeed
    param (
    $Path = "$( throw 'Path is a mandatory parameter.' )",
    $Title = "Site Title",
    $Url = "http://$( $env:computername )",
    $Description = "Description of site"
    Begin {
    # feed metadata
    $encoding = [System.Text.Encoding]::UTF8
    $writer = New-Object System.Xml.XmlTextWriter( $Path, $encoding )
    $writer.WriteStartDocument()
    $writer.WriteStartElement( "rss" )
    $writer.WriteAttributeString( "version", "2.0" )
    $writer.WriteStartElement( "channel" )
    $writer.WriteElementString( "title", $Title )
    $writer.WriteElementString( "link", $Url )
    $writer.WriteElementString( "description", $Description )
    Process {
    # Construct feed items
    $writer.WriteStartElement( "item" )
    $writer.WriteElementString( "title", $_.title )
    $writer.WriteElementString( "link", $_.link )
    $writer.WriteElementString( "author", $_.author )
    $writer.WriteStartElement( "description" )
    $writer.WriteRaw( "<![CDATA[" ) # desc can contain HTML, so its escaped using SGML escape code
    $writer.WriteRaw( $_.description )
    $writer.WriteRaw( "]]>" )
    $writer.WriteEndElement()
    $writer.WriteElementString( "pubDate", $_.pubDate.toString( 'r' ) )
    $writer.WriteElementString( "guid", $homePageUrl + "/" + [guid]::NewGuid() )
    $writer.WriteEndElement()
    End {
    $writer.WriteEndElement()
    $writer.WriteEndElement()
    $writer.WriteEndDocument()
    $writer.Close()
    ### end code from http://poshcode.org/?show=669
    ## Get the Mailbox to Access from the 1st commandline argument
    $MailboxName = $args[0]
    ## Load Managed API dll
    Add-Type -Path "C:\Program Files\Microsoft\Exchange\Web Services\1.2\Microsoft.Exchange.WebServices.dll"
    ## Set Exchange Version
    $ExchangeVersion = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP1
    ## Create Exchange Service Object
    $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService($ExchangeVersion)
    ## Set Credentials to use two options are availible Option1 to use explict credentials or Option 2 use the Default (logged On) credentials
    #Credentials Option 1 using UPN for the windows Account
    $psCred = Get-Credential
    $creds = New-Object System.Net.NetworkCredential($psCred.UserName.ToString(),$psCred.GetNetworkCredential().password.ToString())
    $service.Credentials = $creds
    #Credentials Option 2
    #service.UseDefaultCredentials = $true
    ## Choose to ignore any SSL Warning issues caused by Self Signed Certificates
    ## Code From http://poshcode.org/624
    ## Create a compilation environment
    $Provider=New-Object Microsoft.CSharp.CSharpCodeProvider
    $Compiler=$Provider.CreateCompiler()
    $Params=New-Object System.CodeDom.Compiler.CompilerParameters
    $Params.GenerateExecutable=$False
    $Params.GenerateInMemory=$True
    $Params.IncludeDebugInformation=$False
    $Params.ReferencedAssemblies.Add("System.DLL") | Out-Null
    $TASource=@'
    namespace Local.ToolkitExtensions.Net.CertificatePolicy{
    public class TrustAll : System.Net.ICertificatePolicy {
    public TrustAll() {
    public bool CheckValidationResult(System.Net.ServicePoint sp,
    System.Security.Cryptography.X509Certificates.X509Certificate cert,
    System.Net.WebRequest req, int problem) {
    return true;
    $TAResults=$Provider.CompileAssemblyFromSource($Params,$TASource)
    $TAAssembly=$TAResults.CompiledAssembly
    ## We now create an instance of the TrustAll and attach it to the ServicePointManager
    $TrustAll=$TAAssembly.CreateInstance("Local.ToolkitExtensions.Net.CertificatePolicy.TrustAll")
    [System.Net.ServicePointManager]::CertificatePolicy=$TrustAll
    ## end code from http://poshcode.org/624
    ## Set the URL of the CAS (Client Access Server) to use two options are availbe to use Autodiscover to find the CAS URL or Hardcode the CAS to use
    #CAS URL Option 1 Autodiscover
    $service.AutodiscoverUrl($MailboxName,{$true})
    "Using CAS Server : " + $Service.url
    #CAS URL Option 2 Hardcoded
    #$uri=[system.URI] "https://casservername/ews/exchange.asmx"
    #$service.Url = $uri
    ## Optional section for Exchange Impersonation
    #$service.ImpersonatedUserId = new-object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress, $MailboxName)
    # Bind to the Contacts Folder
    $folderid= new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$MailboxName)
    $Inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid)
    $psPropset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
    #Define ItemView to retrive just 50 Items
    $ivItemView = New-Object Microsoft.Exchange.WebServices.Data.ItemView(50)
    $fiItems = $service.FindItems($Inbox.Id,$ivItemView)
    [Void]$service.LoadPropertiesForItems($fiItems,$psPropset)
    $feedItems = @()
    foreach($Item in $fiItems.Items){
    "processing Item " + $Item.Subject
    $PostItem = @{}
    $PostItem.Add("Title",$Item.Subject)
    $PostItem.Add("Author",$Item.Sender.Address)
    $PostItem.Add("pubDate",$Item.DateTimeReceived)
    $PostItem.Add("link",("https://" + $service.Url.Host + "/owa/" + $Item.WebClientReadFormQueryString))
    $PostItem.Add("description",$Item.Body.Text)
    $feedItems += $PostItem
    $feedItems | New-RssFeed -path "c:\temp\Inboxfeed.xml" -title ($MailboxName + " Inbox")
    But it is a Exchange Management Shell script an we would like to execute it like a .php file.
    Can anyone help me with this please?
    I would like to thank you in advance.
    Kind regards,
    Jordi Martin Lago

    That's not a Exchange Management Shell script its just a normal powershell script that uses the EWS Managed API
    http://msdn.microsoft.com/en-us/library/dd633710(v=exchg.80).aspx . So you can run it from any workstation or server where you have powershell and the Managed API library installed.
    You will need to update the line
    Add-Type -Path
    "C:\Program Files\Microsoft\Exchange\Web Services\1.2\Microsoft.Exchange.WebServices.dll"    
    To
    Add-Type -Path
    "C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll"    
        To cater for the latest version of the Managed API.
      You can scheduled powershell scripts to run using the Task Scheduler eg
    http://community.spiceworks.com/how_to/show/17736-run-powershell-scripts-from-task-scheduler
    Cheers
    Glen

  • Powershell: Empty Folder Cleanup of Multiple Accounts

    My apologies if this is not the correct subforum.   I work in a heavily automated environment that uses Exchange in its document processing tasks.  Emails get sent to folders, then read from them and further processed, then archived. 
    This results in hundreds of empty archive folders, which I would like to clean up on a schedule.  I have found a functional script that uses EWS and works well for a single mailbox/account:
    ##Version 2 added url encoding
    ## Get the Mailbox to Access from the 1st command line argument. Enter the SMTP address of the mailbox
    $MailboxName = "SMTPAddress"
    ## Load Managed API dll
    Add-Type -Path "C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll"
    Add-Type -AssemblyName System.Web
    ## Set Exchange Version. Use one of the following:
    ## Exchange2007_SP1, Exchange2010, Exchange2010_SP1, Exchange2010_SP2, Exchange2013, Exchange2013_SP1
    $ExchangeVersion = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2007_SP1
    ## Create Exchange Service Object
    $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService($ExchangeVersion)
    ## Set Credentials to use two options are available Option1 to use explicit credentials or Option 2 use the Default (logged On) credentials
    ## Credentials Option 1 using UPN for the Windows Account
    $psCred = Get-Credential
    $creds = New-Object System.Net.NetworkCredential($psCred.UserName.ToString(),$psCred.GetNetworkCredential().password.ToString())
    $service.Credentials = $creds
    ## Credentials Option 2
    #service.UseDefaultCredentials = $true
    ## Choose to ignore any SSL Warning issues caused by Self Signed Certificates
    ## Code From http://poshcode.org/624
    ## Create a compilation environment
    $Provider=New-Object Microsoft.CSharp.CSharpCodeProvider
    $Compiler=$Provider.CreateCompiler()
    $Params=New-Object System.CodeDom.Compiler.CompilerParameters
    $Params.GenerateExecutable=$False
    $Params.GenerateInMemory=$True
    $Params.IncludeDebugInformation=$False
    $Params.ReferencedAssemblies.Add("System.DLL") | Out-Null
    $TASource=@'
    namespace Local.ToolkitExtensions.Net.CertificatePolicy{
    public class TrustAll : System.Net.ICertificatePolicy {
    public TrustAll() {
    public bool CheckValidationResult(System.Net.ServicePoint sp,
    System.Security.Cryptography.X509Certificates.X509Certificate cert,
    System.Net.WebRequest req, int problem) {
    return true;
    $TAResults=$Provider.CompileAssemblyFromSource($Params,$TASource)
    $TAAssembly=$TAResults.CompiledAssembly
    ## We now create an instance of the TrustAll and attach it to the ServicePointManager
    $TrustAll=$TAAssembly.CreateInstance("Local.ToolkitExtensions.Net.CertificatePolicy.TrustAll")
    [System.Net.ServicePointManager]::CertificatePolicy=$TrustAll
    ## End code from http://poshcode.org/624
    ## Set the URL of the CAS (Client Access Server) to use two options are available to use Autodiscover to find the CAS URL or Hardcode the CAS to use
    ## CAS URL Option 1 Autodiscover
    $service.AutodiscoverUrl($MailboxName,{$true})
    "Using CAS Server : " + $Service.url
    ## CAS URL Option 2 Hardcoded
    #$uri=[system.URI] "https://casservername/ews/exchange.asmx"
    #$service.Url = $uri
    ## Optional section for Exchange Impersonation
    #$service.ImpersonatedUserId = new-object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress, $MailboxName)
    ## Show Trace. Can be used for troubleshooting errors
    #$service.traceenabled = $true
    function ConvertId{
    param (
    $OwaId = "$( throw 'OWAId is a mandatory Parameter' )"
    process{
    $aiItem = New-Object Microsoft.Exchange.WebServices.Data.AlternateId
    $aiItem.Mailbox = $MailboxName
    $aiItem.UniqueId = $OwaId
    $aiItem.Format = [Microsoft.Exchange.WebServices.Data.IdFormat]::OwaId
    $convertedId = $service.ConvertId($aiItem, [Microsoft.Exchange.WebServices.Data.IdFormat]::EwsId)
    return $convertedId.UniqueId
    ## Get Empty Folders from EMS
    get-mailboxfolderstatistics -identity cnrecon | Where-Object{$_.FolderType -eq "User Created" -band $_.ItemsInFolderAndSubFolders -eq 0} | ForEach-Object{
    # Bind to the Inbox Folder
    "Deleting Folder " + $_.FolderPath
    try{
    $urlEncodedId = [System.Web.HttpUtility]::UrlEncode($_.FolderId.ToString())
    $folderid= new-object Microsoft.Exchange.WebServices.Data.FolderId((Convertid $urlEncodedId))
    #$folderid= new-object Microsoft.Exchange.WebServices.Data.FolderId((Convertid $_.FolderId))
    $ewsFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid)
    if($ewsFolder.TotalCount -eq 0){
    $ewsFolder.Delete([Microsoft.Exchange.WebServices.Data.DeleteMode]::SoftDelete)
    "Folder Deleted"
    catch{
    $_.Exception.Message
    With a little tweaking this works great for each mailbox I run it against by defining the $MailboxName as the SMTP address of the desired box I want to clean.  It's worth noting that for some reason the $MailboxName alias isn't working in the part where
    it looks up in Autodiscover...I have to manually put the address in there as well.
    My question is, can this be modified to work against multiple email boxes?  I have several score boxes with hundreds of empty archived folders each.  Running an individual script for each box seems inefficient.  I tried supplanting a text
    file with addresses for $MailboxName, but that doesn't work in the Autodiscover part further down.
    Thank you for any help you can offer, I'm not very experienced with Powershell or scripting in general, so this feels like I'm diving in a little deep.

    You need to rewrite the script to do that eg maybe use Get-Mailbox to feed
    get-mailboxfolderstatistics, you'll still need to process each and every mailbox individually.
    >> Thank you for any help you can offer, I'm not very experienced with Powershell or scripting in general, so this feels like I'm diving in a little deep.
    with a script like this that deletes data you do want to be very careful if your going to run it against 100's of mailboxes, my suggestion is you rewrite it first as a reporting script where you just output the result to a text file then when you have that
    running well and your confident it's not going to delete anything that it shouldn't you can than change it to a script that deletes things.
    Cheers
    Glen

  • Cisco WLC 5508 HA AP-SSO not possible

    Hi!
    A custommer of mine tried to configure HA AP-SSO with two 5508 controllers. After rebooting the primary controller changed into Maintanence Mode.
    Version 7.3.101.0
    (Cisco Controller) >show redundancy summary
    Redundancy Mode = SSO ENABLED
    Local State = MAINTENANCE
    Peer State = UNKNOWN - Communication Down
    Unit = Primary
    Unit ID = 25:94:0F:AE:C9:00
    Redundancy State = Non Redundant
    Mobility MAC = 25:94:0F:AE:C9:00
    Maintenance Mode = Enabled
    Maintenance cause= Incompatible Software license
    Redundancy Management IP Address................. 10.90.249.8
    Peer Redundancy Management IP Address............ 10.90.248.8
    Redundancy Port IP Address....................... 169.254.249.10
    Peer Redundancy Port IP Address.................. 169.254.248.10
    License Store: Primary License Storage
    StoreIndex: 0 Feature: base Version: 1.0
    License Type: Permanent
    License State: Active, Not in Use
    License Count: Non-Counted
    License Priority: Medium
    License Store: Primary License Storage
    StoreIndex: 1 Feature: base-ap-count Version: 1.0
    License Type: Permanent
    License State: Active, In Use
    License Count: 50 /50 (Active/In-use)
    License Priority: Medium
    License Store: Evaluation License Storage
    StoreIndex: 0 Feature: base-ap-count Version: 1.0
    License Type: Evaluation
    License State: Inactive
    Evaluation total period: 8 weeks 4 days
    Evaluation period left: 8 weeks 4 days
    License Count: 500 / 0 (Active/In-use)
    License Priority: None
    Der sekundäre Controller war aktiv, hatte aber nicht die aktuelle Konfig vom Master übernommen. The secondary controller did not take the masters config.
    What did he do wrong? Licence problem?
    He told me that both controllers have a 50 AP license.
    Thanks in advance for any help. I have no experince so far with 7.3

    Hi Scott or others listening.
    I have come inte problems efter what I presume the "wrong" controller was defined as primary.
    After configuration of redundancy IP's on both units I enabled HA SSO on the primary first and not enabling it on the secondary. After the HA SSO was enabled the unit didn't become manageble.
    Since I could connect to its Redundancy management IP I could SSH into the unit:
    I checked the redundancy status
    (Cisco Controller) >show redundancy summary
    Redundancy Mode = SSO ENABLED
         Local State = MAINTENANCE
          Peer State = UNKNOWN - Communication Down
                Unit = Primary
             Unit ID = 6C:20:56:BD:60:60
    Redundancy State = Non Redundant
        Mobility MAC = 6C:20:56:BD:60:60
    Maintenance Mode = Enabled
    Maintenance cause= Incompatible Software license
    Redundancy Management IP Address................. 10.128.112.202
    Peer Redundancy Management IP Address............ 10.128.112.203
    Redundancy Port IP Address....................... 169.254.112.202
    Peer Redundancy Port IP Address.................. 169.254.112.203
    (Cisco Controller) >show license summary
    License Store: Primary License Storage
    StoreIndex:  0Feature: base                              Version: 1.0
    License Type: Permanent
    License State: Active, Not in Use
    License Count: Non-Counted
    License Priority: Medium
    License Store: Evaluation License Storage
    StoreIndex:  0Feature: base-ap-count                     Version: 1.0
    License Type: Evaluation
    License State: Active, Not in Use, EULA not accepted
        Evaluation total period:  8 weeks  4 days
        Evaluation period left:  8 weeks  4 days
    License Count: 500 / 0 (Active/In-use)
    License Priority: None
    (Cisco Controller) >show sysinfo
    Manufacturer's Name.............................. Cisco Systems Inc.
    Product Name..................................... Cisco Controller
    Product Version.................................. 7.3.112.0
    Bootloader Version............................... 1.0.16
    Field Recovery Image Version..................... 7.0.112.21
    Firmware Version................................. FPGA 1.7, Env 1.8, USB console 2.2
    Build Type....................................... DATA + WPS
    System Name...................................... XXXX
    System Location.................................. XXXX
    System Contact...................................
    System ObjectID.................................. 1.3.6.1.4.1.9.1.1069
    Redundancy Mode.................................. SSO
    IP Address....................................... 10.128.112.200
    Last Reset....................................... Software reset
    System Up Time................................... 0 days 0 hrs 13 mins 56 secs
    System Timezone Location.........................
    Configured Country............................... SE  - Sweden
    Operating Environment............................ Commercial (0 to 40 C)
    Internal Temp Alarm Limits....................... 0 to 65 C
    Internal Temperature............................. +37 C
    External Temperature............................. +18 C
    Fan Status....................................... OK
    State of 802.11b Network......................... Disabled
    State of 802.11a Network......................... Disabled
    Number of WLANs.................................. 2
    Number of Active Clients......................... 0
    Burned-in MAC Address............................ 6C:20:56:BD:60:60
    Power Supply 1................................... Present, OK
    Power Supply 2................................... Absent
    Maximum number of APs supported.................. 0
    I then did disable redundancy but unfortunately the unit went unreachable
    (Cisco Controller) >config redundancy mode none 
    All unsaved configuration will be saved.
    And the system will be reset. Are you sure? (y/n)y
    - No connectivity on either management or redundancy management IP
    How can I recover this unit, and why did this happen? How can I veryfy the HA-SSO licence?
    - Above license info doesn't make sense

  • How to get a constructor with parameters

    I got a problem and can not find anywhere my answer, I have a class Sudoku with a 2 dimension arrays(2D) as a parameter.
    public Sudoku(int[][] problem)
    I have another class named SudokuSolver as you can see below.
    public class SudokuSolver
    /** Main method to solve the sudoku problem. */
    public static void main(String[] args)
    Sudoku Sudoku1 = new Sudoku();
    How could I call/initialize the Sudoku constructor in the SudokuSolver class main method?
    If it was without parameters would be like above Sudoku Sudoku1 = new Sudoku();, but when I put the value like Sudoku Sudoku1 = new Sudoku( {{1,2}}); it does not work.
    I would be very happy if anyone could help me out with this noob question.
    7runks.net

    You have to actually declare that it's an array

  • 845G Max-L(MS-6580) & G4Ti4200-TD(MS-8870)

    Hi,
    I'm having trouble with booting up using 845G Max-L(MS-6580) and G4Ti4200-TD(MS-8870).
    When the system normally boots up, it first displays the Video card information on the screen then MSI full screen image is displayed, after that Windows starts loading.
    However, when I boot the system, it very often does not even show videocard information but the screen just simlpy becomes white (sometimes very light blue or vertical stripes with several colors), then single beep and screen size adjustment seems to happen but it just doesn't go any farther.
    So in order to get the system up and running, I just simply repeat rebooting the system. Quite often I have to repeat rebooting around 10 times.
    Does anyone have any idea what is going on and how to fix it?
    System:
    - 845G Max-L (MS-6580)
    - G4Ti4200-TD (MS8870) 128MB
    - Intel Celron 2.0GHz
    - DDR 128MB PC2100
    - Windows XP Home Edition

    Okay, I think I finally got it work.    It was because of the PCI card that I had on Slot 6. I used Slot 3 instead, then it seems to work fine (shared INT problem?). Even using 250W power supply it works well. (Would it still be better to use 480W?)
    Even though the problem seems gone, I'm not still clear about the problem, 'cause using ASUS V6800(old) with PCI card on Slot 6 did not cause the problem.
    Do you have clear explanation? I guess I have a lot more stuff to learn.

Maybe you are looking for

  • Material costed, production order with no target cost

    I've a case of production order and I don't where to find information to solve it. I've a product A costed from March. Standard cost is correct. I'm creating a production order now. The cost estimate is calculated during the delivery. I've confirmed

  • Using old software on macbook

    Can I use my old final cut software without upgrading to the universal bi on my mackbook including photshop etc. Again I just want install my old software.... is this possible. thank you for your help. 1.5ghz Powerbook G4, 1ghz Yikes, 3.4ghz Vaio, Sh

  • I cant create a book in iPhoto 5.0.4

    Hi all I cant create a book in iPhoto 5.0.4 - both the add new book button and the new book command in the menu are greyed out! I have rebooted, checked permissions, etc, etc...all the usual. Any thoughts? Thanks Rob

  • OpenOffice .odt file downloaded as .txt

    Hello, when I try to download a .odt file from the web (right-click/download link), the file is saved as anyfile.odt.txt ... I have then to change the file type and answer "yes" to the message "do you really want to change the file type". OpenOffice.

  • Does any have their MacBook Pro retina 2012 freezes up then desktop blue screen for 15-20 seconds?

    I have been having issues for months now.  My MBP 15" is freezing up after I stop typing in any application.  I cannot do anything.  Then after 20-30 seconds my desktop goes to a blue screen then comes back after 20-30 seconds.  Just did it now when