Rectangle 27 385

Tested as working:

param([Int32]$step=30) #Must be the first statement in your script

$iTunes = New-Object -ComObject iTunes.Application

if ($iTunes.playerstate -eq 1)
{
  $iTunes.PlayerPosition = $iTunes.PlayerPosition + $step
}

Call it with

powershell.exe -file itunesForward.ps1 -step 15

+1, as I was looking for passing named parameters to .ps1 files.

what if the parameter is a string? What is the syntax? would it be something like -step '15' or -step "15"

@Andrew First of all you have to change the type of the parameter to [string]. If you then want to pass a string as parameter you can use either ' or ". If there is no space (or quotes) inside the string you can even omit the quotes.

param([string]$env,[string]$s3BucketName)

command line - How to pass an argument to a PowerShell script? - Stack...

command-line powershell automation itunes argument-passing
Rectangle 27 366

Tested as working:

param([Int32]$step=30) #Must be the first statement in your script

$iTunes = New-Object -ComObject iTunes.Application

if ($iTunes.playerstate -eq 1)
{
  $iTunes.PlayerPosition = $iTunes.PlayerPosition + $step
}

Call it with

powershell.exe -file itunesForward.ps1 -step 15

+1, as I was looking for passing named parameters to .ps1 files.

what if the parameter is a string? What is the syntax? would it be something like -step '15' or -step "15"

@Andrew First of all you have to change the type of the parameter to [string]. If you then want to pass a string as parameter you can use either ' or ". If there is no space (or quotes) inside the string you can even omit the quotes.

param([string]$env,[string]$s3BucketName)

command line - How to pass an argument to a PowerShell script? - Stack...

command-line powershell automation itunes argument-passing
Rectangle 27 366

Tested as working:

param([Int32]$step=30) #Must be the first statement in your script

$iTunes = New-Object -ComObject iTunes.Application

if ($iTunes.playerstate -eq 1)
{
  $iTunes.PlayerPosition = $iTunes.PlayerPosition + $step
}

Call it with

powershell.exe -file itunesForward.ps1 -step 15

+1, as I was looking for passing named parameters to .ps1 files.

what if the parameter is a string? What is the syntax? would it be something like -step '15' or -step "15"

@Andrew First of all you have to change the type of the parameter to [string]. If you then want to pass a string as parameter you can use either ' or ". If there is no space (or quotes) inside the string you can even omit the quotes.

param([string]$env,[string]$s3BucketName)

command line - How to pass an argument to a PowerShell script? - Stack...

command-line powershell automation itunes argument-passing
Rectangle 27 18

Tested and working!

package com.example.dto;

import javax.xml.bind.annotation.XmlRootElement;

import org.codehaus.jackson.annotate.JsonProperty;

@XmlRootElement
public class Location {

    private String room;
    private String building;
    private String computers;
    @JsonProperty("string")
    private String str;

    public String getRoom() {
        return room;
    }

    public void setRoom(String room) {
        this.room = room;
    }

    public String getBuilding() {
        return building;
    }

    public void setBuilding(String building) {
        this.building = building;
    }

    public String getComputers() {
        return computers;
    }

    public void setComputers(String computers) {
        this.computers = computers;
    }

    public String getStr() {
        return str;
    }

    public void setStr(String str) {
        this.str = str;
    }

}
package com.example.main;

import java.io.IOException;
import java.net.URL;
import java.util.List;

import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;

import com.example.dto.Computer;

public class JSONParse {

    public static void main(String args[]) throws JsonParseException, JsonMappingException, IOException {

        /* JSON provider */
        URL url = new URL("http://api.engin.umich.edu/hostinfo/v1/computers.json?building=PIERPONT&room=B505");

        ObjectMapper mapper = new ObjectMapper();

        /*
         * This allows the ObjectMapper to accept single values for a collection.
         * For example: "location" property in the returned JSON is a collection that 
         * can accept multiple objects but, in deserialization process, this property just 
         * have one object and causes an Exception.
         */
        mapper.configure(Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);

        /* 
         * If some JSON property is not present, avoid exceptions setting
         * FAIL_ON_UNKNOWN_PROPERTIES to false 
         */
        mapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);

        /* Get all computers */
        List<Computer> computers = mapper.readValue(url, new TypeReference<List<Computer>>(){});

        /* Print each computer (previously overriding "toString()" method) */
        for(Computer computer : computers) {
            System.out.println(computer.toString());
        }

    }

}
class
=================================
Hostname: pierb505p13.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9608460
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.23
Last_Access: 
Last_Report: 1383202078

=================================
Hostname: pierb505p22.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9609244
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.32
Last_Access: 
Last_Report: 1383201987

=================================
Hostname: pierb505p06.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9606464
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.16
Last_Access: 
Last_Report: 1383201982

=================================
Hostname: pierb505p17.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9606820
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.27
Last_Access: 
Last_Report: 1383202064

=================================
Hostname: pierb505p15.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9609052
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.25
Last_Access: 
Last_Report: 1383202052

=================================
Hostname: pierb505p12.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9607136
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.22
Last_Access: 
Last_Report: 1383202037

=================================
Hostname: pierb505p03.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9603132
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.13
Last_Access: 
Last_Report: 1383201964

=================================
Hostname: pierb505p14.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9599592
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.24
Last_Access: 
Last_Report: 1383201996

=================================
Hostname: pierb505p07.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9608176
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.17
Last_Access: 
Last_Report: 1383202127

=================================
Hostname: pierb505p23.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 1
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9600968
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.33
Last_Access: 
Last_Report: 1383202013

=================================
Hostname: pierb505p11.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 1
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9607224
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.21
Last_Access: 
Last_Report: 1383202098

=================================
Hostname: pierb505p21.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 1
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9595136
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.31
Last_Access: 
Last_Report: 1383202035

=================================
Hostname: pierb505p16.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 1
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9601212
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.26
Last_Access: 
Last_Report: 1383202106

=================================
Hostname: pierb505p04.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 1
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9603220
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.14
Last_Access: 
Last_Report: 1383202135

=================================
Hostname: pierb505p08.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 16024588
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.18
Last_Access: 
Last_Report: 1383202133

=================================
Hostname: pierb505p25.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 10299356
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.35
Last_Access: 
Last_Report: 1383202100

=================================
Hostname: pierb505p26.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 11303888
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.36
Last_Access: 
Last_Report: 1383202027

=================================
Hostname: pierb505p19.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 15914176
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.29
Last_Access: 
Last_Report: 1383202081

=================================
Hostname: pierb505p09.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 29956064
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.19
Last_Access: 
Last_Report: 1383201997

=================================
Hostname: pierb505p10.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 19663960
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.20
Last_Access: 
Last_Report: 1383202003

=================================
Hostname: pierb505p24.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 19197988
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.34
Last_Access: 
Last_Report: 1383202038

=================================
Hostname: pierb505p20.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 9585536
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.30
Last_Access: 
Last_Report: 1383201994

java - Simple Spring code to parse JSON - Stack Overflow

java json spring
Rectangle 27 18

Tested and working!

package com.example.dto;

import javax.xml.bind.annotation.XmlRootElement;

import org.codehaus.jackson.annotate.JsonProperty;

@XmlRootElement
public class Location {

    private String room;
    private String building;
    private String computers;
    @JsonProperty("string")
    private String str;

    public String getRoom() {
        return room;
    }

    public void setRoom(String room) {
        this.room = room;
    }

    public String getBuilding() {
        return building;
    }

    public void setBuilding(String building) {
        this.building = building;
    }

    public String getComputers() {
        return computers;
    }

    public void setComputers(String computers) {
        this.computers = computers;
    }

    public String getStr() {
        return str;
    }

    public void setStr(String str) {
        this.str = str;
    }

}
package com.example.main;

import java.io.IOException;
import java.net.URL;
import java.util.List;

import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;

import com.example.dto.Computer;

public class JSONParse {

    public static void main(String args[]) throws JsonParseException, JsonMappingException, IOException {

        /* JSON provider */
        URL url = new URL("http://api.engin.umich.edu/hostinfo/v1/computers.json?building=PIERPONT&room=B505");

        ObjectMapper mapper = new ObjectMapper();

        /*
         * This allows the ObjectMapper to accept single values for a collection.
         * For example: "location" property in the returned JSON is a collection that 
         * can accept multiple objects but, in deserialization process, this property just 
         * have one object and causes an Exception.
         */
        mapper.configure(Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);

        /* 
         * If some JSON property is not present, avoid exceptions setting
         * FAIL_ON_UNKNOWN_PROPERTIES to false 
         */
        mapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);

        /* Get all computers */
        List<Computer> computers = mapper.readValue(url, new TypeReference<List<Computer>>(){});

        /* Print each computer (previously overriding "toString()" method) */
        for(Computer computer : computers) {
            System.out.println(computer.toString());
        }

    }

}
class
=================================
Hostname: pierb505p13.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9608460
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.23
Last_Access: 
Last_Report: 1383202078

=================================
Hostname: pierb505p22.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9609244
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.32
Last_Access: 
Last_Report: 1383201987

=================================
Hostname: pierb505p06.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9606464
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.16
Last_Access: 
Last_Report: 1383201982

=================================
Hostname: pierb505p17.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9606820
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.27
Last_Access: 
Last_Report: 1383202064

=================================
Hostname: pierb505p15.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9609052
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.25
Last_Access: 
Last_Report: 1383202052

=================================
Hostname: pierb505p12.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9607136
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.22
Last_Access: 
Last_Report: 1383202037

=================================
Hostname: pierb505p03.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9603132
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.13
Last_Access: 
Last_Report: 1383201964

=================================
Hostname: pierb505p14.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9599592
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.24
Last_Access: 
Last_Report: 1383201996

=================================
Hostname: pierb505p07.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 0
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9608176
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.17
Last_Access: 
Last_Report: 1383202127

=================================
Hostname: pierb505p23.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 1
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9600968
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.33
Last_Access: 
Last_Report: 1383202013

=================================
Hostname: pierb505p11.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 1
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9607224
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.21
Last_Access: 
Last_Report: 1383202098

=================================
Hostname: pierb505p21.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 1
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9595136
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.31
Last_Access: 
Last_Report: 1383202035

=================================
Hostname: pierb505p16.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 1
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9601212
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.26
Last_Access: 
Last_Report: 1383202106

=================================
Hostname: pierb505p04.engin.umich.edu
Vendor: Linux
Model: Dell 980
Swap: 8126456
Memory: 7797
Sess_Count: 0
Load: 
  One: 1
  Five: 0
  Fifteen: 0
In_Use: false
Free_In_Tmp: 9603220
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.14
Last_Access: 
Last_Report: 1383202135

=================================
Hostname: pierb505p08.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 16024588
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.18
Last_Access: 
Last_Report: 1383202133

=================================
Hostname: pierb505p25.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 10299356
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.35
Last_Access: 
Last_Report: 1383202100

=================================
Hostname: pierb505p26.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 11303888
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.36
Last_Access: 
Last_Report: 1383202027

=================================
Hostname: pierb505p19.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 15914176
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.29
Last_Access: 
Last_Report: 1383202081

=================================
Hostname: pierb505p09.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 29956064
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.19
Last_Access: 
Last_Report: 1383201997

=================================
Hostname: pierb505p10.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 19663960
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.20
Last_Access: 
Last_Report: 1383202003

=================================
Hostname: pierb505p24.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 19197988
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.34
Last_Access: 
Last_Report: 1383202038

=================================
Hostname: pierb505p20.engin.umich.edu
Vendor: Windows
Model: OptiPlex 980
Swap: 0
Memory: 0
Sess_Count: 0
Load: 
  One: 1
  Five: 5
  Fifteen: 15
In_Use: false
Free_In_Tmp: 9585536
Class: L
Location: 
  Building: PIERPONT
  Computers: 26
  Room: B505
  String: B505 PIERPONT
Ip: 141.213.54.30
Last_Access: 
Last_Report: 1383201994

java - Simple Spring code to parse JSON - Stack Overflow

java json spring
Rectangle 27 10

Tested and working!

$(function() {

    var extraDays = 0;
    var combobox = $('#select1');
    var txtStartDate = $('#startdate');
    var txtEndDate = $('#enddate');
    var inputs = txtStartDate.add(txtEndDate);

    combobox.on('change', function() {

        inputs.val('');

        var val = $(this).val();
        if(val == 1) extraDays = 5;
        if(val == 2) extraDays = 7;

        txtStartDate.datepicker({
            showButtonPanel: true,
            closeText: 'Close',
            dateFormat: 'mm/dd/yy',
            beforeShowDay: function(date) {

                /* Check for the first day */
                if (date.getDate() == 1) { return [true, '']; } 
                else { return [false, '', 'Unavailable']; }
            },
            onSelect: function(selected) {

                /* Add extra days to the date according to 'combobox' selection */
                var endDate = new Date(selected);
                endDate.setDate(endDate.getDate() + extraDays);

                var m = pad(endDate.getMonth() + 1, 2);
                var d = pad(endDate.getDate(), 2);
                var y = endDate.getFullYear();
                var endDateStr = [m, d, y].join('/');

                txtEndDate.val(endDateStr);
            }
        });

    });

});

/* This function just adds a zero to get this format: "01, 02, etc" in a number less than 10 */
function pad(number, length) {
    var str = '' + number;
    while (str.length < length) { str = '0' + str; }
    return str;
};

Jquery datepicker make only 1 day selectable and copy date +x days in ...

jquery jquery-ui datepicker
Rectangle 27 10

Tested and working!

$(function() {

    var extraDays = 0;
    var combobox = $('#select1');
    var txtStartDate = $('#startdate');
    var txtEndDate = $('#enddate');
    var inputs = txtStartDate.add(txtEndDate);

    combobox.on('change', function() {

        inputs.val('');

        var val = $(this).val();
        if(val == 1) extraDays = 5;
        if(val == 2) extraDays = 7;

        txtStartDate.datepicker({
            showButtonPanel: true,
            closeText: 'Close',
            dateFormat: 'mm/dd/yy',
            beforeShowDay: function(date) {

                /* Check for the first day */
                if (date.getDate() == 1) { return [true, '']; } 
                else { return [false, '', 'Unavailable']; }
            },
            onSelect: function(selected) {

                /* Add extra days to the date according to 'combobox' selection */
                var endDate = new Date(selected);
                endDate.setDate(endDate.getDate() + extraDays);

                var m = pad(endDate.getMonth() + 1, 2);
                var d = pad(endDate.getDate(), 2);
                var y = endDate.getFullYear();
                var endDateStr = [m, d, y].join('/');

                txtEndDate.val(endDateStr);
            }
        });

    });

});

/* This function just adds a zero to get this format: "01, 02, etc" in a number less than 10 */
function pad(number, length) {
    var str = '' + number;
    while (str.length < length) { str = '0' + str; }
    return str;
};

Jquery datepicker make only 1 day selectable and copy date +x days in ...

jquery jquery-ui datepicker
Rectangle 27 623

content:url("image.jpg")
<!doctype html>

<style>
.MyClass123{
	content:url("http://imgur.com/SZ8Cm.jpg");
}
</style>

<img class="MyClass123"/>

Tested and working:

  • FireFox 40.0.2 (observing Developer Network Tools, you can see that the URL loads, but the image is not displayed)

Not working in IE10.

not browser compatible at all, I wonder why this satisfies people. (its simplicity I guess, I should ask why people dont care/think about compatibility all of a sudden)

@EricG, different applications have different requirements. If it doesn't suit your requirements, don't use it. If it does, use it.

Worth to add that even in browsers that support assigning content to img, it changes its behavior. The image starts to ignore size attributes, and in Chrome/Safari it loses the context menu options like 'Save image'. This is because assigning a content effectively converts img from empty replaced element to something like <span><img></span>.

html - Is it possible to set the equivalent of a src attribute of an i...

html css image
Rectangle 27 623

content:url("image.jpg")
<!doctype html>

<style>
.MyClass123{
	content:url("http://imgur.com/SZ8Cm.jpg");
}
</style>

<img class="MyClass123"/>

Tested and working:

  • FireFox 40.0.2 (observing Developer Network Tools, you can see that the URL loads, but the image is not displayed)

Not working in IE10.

not browser compatible at all, I wonder why this satisfies people. (its simplicity I guess, I should ask why people dont care/think about compatibility all of a sudden)

@EricG, different applications have different requirements. If it doesn't suit your requirements, don't use it. If it does, use it.

Worth to add that even in browsers that support assigning content to img, it changes its behavior. The image starts to ignore size attributes, and in Chrome/Safari it loses the context menu options like 'Save image'. This is because assigning a content effectively converts img from empty replaced element to something like <span><img></span>.

html - Is it possible to set the equivalent of a src attribute of an i...

html css image
Rectangle 27 615

content:url("image.jpg")
<!doctype html>

<style>
.MyClass123{
	content:url("http://imgur.com/SZ8Cm.jpg");
}
</style>

<img class="MyClass123"/>

Tested and working:

  • FireFox 40.0.2 (observing Developer Network Tools, you can see that the URL loads, but the image is not displayed)

Not working in IE10.

not browser compatible at all, I wonder why this satisfies people. (its simplicity I guess, I should ask why people dont care/think about compatibility all of a sudden)

@EricG, different applications have different requirements. If it doesn't suit your requirements, don't use it. If it does, use it.

Worth to add that even in browsers that support assigning content to img, it changes its behavior. The image starts to ignore size attributes, and in Chrome/Safari it loses the context menu options like 'Save image'. This is because assigning a content effectively converts img from empty replaced element to something like <span><img></span>.

html - Is it possible to set the equivalent of a src attribute of an i...

html css image
Rectangle 27 37

Note : This has been tested and working 100% percent

override func viewWillDisappear(animated: Bool){
    super.viewWillDisappear(animated)

    if self.isBeingDismissed()  //presented view controller
    {
        // remove observer here
        NSNotificationCenter.defaultCenter().removeObserver(self)
    }
}

In iOS 6.0 > version , its better to remove observer in viewWillDisappear as viewDidUnload method is deprecated.

[[NSNotificationCenter defaultCenter] removeObserver:observerObjectHere];

There is many times its better to remove observer when the view has been removed from the navigation stack or hierarchy.

- (void)viewWillDisappear:(BOOL)animated{
 if (![[self.navigationController viewControllers] containsObject: self]) //any other hierarchy compare if it contains self or not
    {
        // the view has been removed from the navigation stack or hierarchy, back is probably the cause
        // this will be slow with a large stack however.

        [[NSNotificationCenter defaultCenter] removeObserver:observerObjectHere];
    }
}
- (void)viewWillDisappear:(BOOL)animated{
    if ([self isBeingDismissed] == YES) ///presented view controller
    {
        // remove observer here
        [[NSNotificationCenter defaultCenter] removeObserver:observerObjectHere];
    }
}

Except a controller may still want notifications when its view is not showing (e.g. to reload a tableView).

@wcochran automatically reload/refresh in viewWillAppear:

@Prince can you explain why viewWillDisapper better then dealloc? so we have add observer to self, so when the self will be dropped from memory it will call dealloc and then all observers will be deleted, is this not a good logic.

removeObserver:self
UIViewController

Putting the removeObserver calls in viewWillDisappear as indicated is definitely the right way to go if the controller is being presented via pushViewController. If you put them in dealloc instead then dealloc will never be called -- in my experience at least...

ios - Objective C: Where to remove observer for NSNotification? - Stac...

objective-c ios nsnotifications
Rectangle 27 68

EDIT: Here is an even easier solution, tested and working nicely:

$scope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
    if (toState.resolve) {
        $scope.showSpinner();
    }
});
$scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
    if (toState.resolve) {
        $scope.hideSpinner();
    }
});

This shows the spinner whenever we are about to go to a state that has anything to resolve and hides it, when the state change is complete. You might want to add some check up the state hierarchy (i.e. also show the spinner if a parent state that is being loaded resolves something) but this solution works fine for me.

Here is my old suggestion for reference and as an alternative:

In your application controller, listen to the stateChangeStart event and check if you are about to switch to a state where you want to show a spinner during resolve (see https://github.com/angular-ui/ui-router/wiki/Quick-Reference#wiki-events-1)

$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams){
    if (toState.name == 'state.with.resolve') {
        $scope.showSpinner();  //this is a function you created to show the loading animation
    }
})

When you controller finally gets called, you can hide the spinner

.controller('StateWithResolveCtrl', function($scope) {
    $scope.hideSpinner();
})

You also might want to check for any errors that may have occurred during resolve by listening to the $stateChangeError event and hiding the animation while you handle the error.

This is not totally clean as you distribute the logic for the spinner between controllers, but it's a way. Hope it helps.

what does the toState.resolve condition checks?

if (toState.resolve) checks if the state config has a resolve dictionary. In my case, this is a good enough estimate that the state does async service calls. I assume that if there is a resolve block, it's service calls that get resolved. The code shows and hides the spinner only if service calls were made. As I described above, this code might need to be refined to also check parent states, depending on your use case.

in the 'old suggestion' you reference $scope inside a call on $rootScope. where does the $scope come from here?

@pdeva, the event handler was defined inside some controller; that's where also the showSpinner function was defined.

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

javascript - (Angular-ui-router) Show loading animation during resolve...

javascript angularjs angular-ui-router
Rectangle 27 2

Tested and working:

<div data-role="page" id="index">
    <div data-role="header">
        <h1>Index page</h1>
    </div>

    <div data-role="content">
        <a data-role="button" href="#second">To second page</a>
    </div>
</div>
<div data-role="page" id="second">
    <div data-role="header">
        <h1>Second page</h1>
    </div>

    <div data-role="content">

    </div>
</div>   
<div data-role="page" id="third">
    <div data-role="header">
        <h1>Third page</h1>
    </div>

    <div data-role="content">

    </div>
</div>
$(document).on('pagebeforechange', function(e, data){  
    var to = data.toPage;
    var from = data.options.fromPage;

    if (typeof to  === 'string') {
        var u = $.mobile.path.parseUrl(to);
        to = u.hash || '#' + u.pathname.substring(1);
        if (from) from = '#' + from.attr('id');

        if (from === '#index' && to === '#second') {
            e.preventDefault();
            e.stopPropagation();            
            $.mobile.changePage( "#third");
        }
    }
});

javascript - Stop showing page - Stack Overflow

javascript jquery jquery-mobile
Rectangle 27 2

Tested and working:

<div data-role="page" id="index">
    <div data-role="header">
        <h1>Index page</h1>
    </div>

    <div data-role="content">
        <a data-role="button" href="#second">To second page</a>
    </div>
</div>
<div data-role="page" id="second">
    <div data-role="header">
        <h1>Second page</h1>
    </div>

    <div data-role="content">

    </div>
</div>   
<div data-role="page" id="third">
    <div data-role="header">
        <h1>Third page</h1>
    </div>

    <div data-role="content">

    </div>
</div>
$(document).on('pagebeforechange', function(e, data){  
    var to = data.toPage;
    var from = data.options.fromPage;

    if (typeof to  === 'string') {
        var u = $.mobile.path.parseUrl(to);
        to = u.hash || '#' + u.pathname.substring(1);
        if (from) from = '#' + from.attr('id');

        if (from === '#index' && to === '#second') {
            e.preventDefault();
            e.stopPropagation();            
            $.mobile.changePage( "#third");
        }
    }
});

javascript - Stop showing page - Stack Overflow

javascript jquery jquery-mobile
Rectangle 27 7

Tested and working in cxf 3.0.4.

<jaxrs:server address="/" basePackages="a.b.c"/>

Dont forget to mention the cxf-servlet in web.xml

How do I do this with spring boot? I found a newer class/code but I am having some other issues: JAXRSServerFactoryBeanDefinitionParser.SpringJAXRSServerFactoryBean bean = new JAXRSServerFactoryBeanDefinitionParser.SpringJAXRSServerFactoryBean(); bean.setBasePackages(Collections.singletonList(SimulationController.class.getPackage().getName())); return bean.create();

@ChristianBongiorno Here is the link to cxf docs. There is good description to Spring Boot setup. cxf.apache.org/docs/

@AlexAmorales I was already there. These examples don't work. That configuration bean does nothing but import the xml. I want it to add each Path bean into the service.

java - Autodiscover JAX-RS resources with CXF in a Spring application ...

java spring cxf jax-rs
Rectangle 27 22

The following is tested and working in IE 6 and Firefox 3.0.11:

If some other JavaScript library you are loading is also attaching itself to window.onerror you can do this:

<script type="text/javascript">
function addHandler(obj, evnt, handler) {
    if (obj.addEventListener) {
        obj.addEventListener(evnt.replace(/^on/, ''), handler, false);
    // Note: attachEvent fires handlers in the reverse order they
    // were attached. This is the opposite of what addEventListener
    // and manual attachment do.
    //} else if (obj.attachEvent) {
    //    obj.attachEvent(evnt, handler);
    } else {
        if (obj[evnt]) {
            var origHandler = obj[evnt];
            obj[evnt] = function(evt) {
                origHandler(evt);
                handler(evt);
            }
        } else {
            obj[evnt] = function(evt) {
                handler(evt);
            }
        }
    }
}
addHandler(window, 'onerror', function (msg, url, num) {
    alert(msg + ';' + url + ';' + num);
    return true;
});
addHandler(window, 'onerror', function (msg, url, num) {
    alert('and again ' + msg + ';' + url + ';' + num);
    return true;
});
</script>

The above lets you attach as many onerror handlers as you want. If there is already an existing custom onerror handler it will invoke that one, then yours.

Note that addHandler() can be used to bind multiple handlers to any event:

addHandler(window, 'onload', function () { alert('one'); });
addHandler(window, 'onload', function () { alert('two'); });
addHandler(window, 'onload', function () { alert('three'); });

This code is new and somewhat experimental. I'm not 100% sure addEventListener does precisely what the manual attachment does, and as commented, attachEvent fires the handlers in the reverse order they were attached in (so you would see 'three, two, one' in the example above). While not necessarily "wrong" or "incorrect", it is the opposite of what the other code in addHandler does and as a result, could result in inconsistent behaviour from browser to browser, which is why I removed it.

<html>
<head>
<title>Title</title>
</head>
<body>
<script type="text/javascript">
function addHandler(obj, evnt, handler) {
    if (obj.addEventListener) {
        obj.addEventListener(evnt.replace(/^on/, ''), handler, false);
    } else {
        if (obj[evnt]) {
            var origHandler = obj[evnt];
            obj[evnt] = function(evt) {
                origHandler(evt);
                handler(evt);
            }
        } else {
            obj[evnt] = function(evt) {
                handler(evt);
            }
        }
    }
}
addHandler(window, 'onerror', function (msg, url, num) {
    alert(msg + ';' + url + ';' + num);
    return true;
});
</script>
<div>
...content...
</div>
<script type="text/javascript">
blah;
</script>
</body>
</html>

When the above code is put in test.htm and loaded into Firefox 3.0.11 (and the latest 3.5 as of this edit - Gecko/20090616) from the local disk, you should see a dialog box that says [object Event];undefined;undefined. If that is not happening then your copy of Firefox is not configured correctly or otherwise broken. All I can suggest is that you remove Firefox, remove your local profile(s) (information about how to find your profile is available here) and reinstall the latest version and test again.

The if statement is what's fired on the events that I want handled by my error logger in Firefox. What is the relevance of the addEventListener that's created in that if statement?

The only thing that happens with this is that any time I open Firefox, whatever I put in the "if" statement fires. It's not a reaction to my error though.

addHandler() is a generic way to add multiple handler functions to an event. The if (obj.addEventListener) tests to see if the browser supports the addEventListener() method on the object, if it does, it adds a the handler using the built-in browser supported method. If the browser does not support the addEventListener() method, it chains your new handler behind the last added handler.

addHandler() by itself does not actually do anything other than wire your handler to the event. To make it do something, you need to write copy addHandler(), then use: addHandler(window, 'onerror', function (msg, url, num) { alert(msg + ';' + url + ';' + num); return true; }); - If you do not get an alert from a JavaScript error after using addHandler(), then you've most likely got an add-on in Firefox that is somehow overriding the default Firefox onerror behaviour.

The only add-ons I have are IE Tab and Microsoft .NET Framework Assistant. Is there any other reason that Firefox would be overriding it?

javascript - window.onerror not firing in Firefox - Stack Overflow

javascript jquery firefox onerror
Rectangle 27 43

All tested and working 100% below is a complete example Solution: android:autoLink="web" Sample Xml

<TextView
        android:id="@+id/txtLostpassword"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:autoLink="email"
        android:gravity="center"
        android:padding="20px"
        android:text="@string/lostpassword"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/txtLostpassword"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:autoLink="web"
        android:gravity="center"
        android:padding="20px"
        android:text="@string/defaultpassword"
        android:textAppearance="?android:attr/textAppearanceSmall" />

String in string.xml

<string name="lostpassword">If you lost your password please contact <a href="mailto:support@cleverfinger.com.au?Subject=Lost%20Password" target="_top">support@cleverfinger.com.au</a></string>

<string name="defaultpassword">User Guide <a href="http://www.cleverfinger.com.au/user-guide/">http://www.cleverfinger.com.au/user-guide/</a></string>

android - I want text view as a clickable link - Stack Overflow

android hyperlink android-textview clickable
Rectangle 27 43

All tested and working 100% below is a complete example Solution: android:autoLink="web" Sample Xml

<TextView
        android:id="@+id/txtLostpassword"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:autoLink="email"
        android:gravity="center"
        android:padding="20px"
        android:text="@string/lostpassword"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/txtLostpassword"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:autoLink="web"
        android:gravity="center"
        android:padding="20px"
        android:text="@string/defaultpassword"
        android:textAppearance="?android:attr/textAppearanceSmall" />

String in string.xml

<string name="lostpassword">If you lost your password please contact <a href="mailto:support@cleverfinger.com.au?Subject=Lost%20Password" target="_top">support@cleverfinger.com.au</a></string>

<string name="defaultpassword">User Guide <a href="http://www.cleverfinger.com.au/user-guide/">http://www.cleverfinger.com.au/user-guide/</a></string>

android - I want text view as a clickable link - Stack Overflow

android hyperlink android-textview clickable
Rectangle 27 1008

Below is the best all-around solution I could build to vertically & horizontally center a fixed-width, flexible height content box. Tested and working for recent versions of FF, Opera, Chrome, & Safari.

<div class="outer">
  <div class="middle">
    <div class="inner">

      <h1>The Content</h1>

      <p>Once upon a midnight dreary...</p>

    </div>
  </div>
</div>
.outer {
    display: table;
    position: absolute;
    height: 100%;
    width: 100%;
}

.middle {
    display: table-cell;
    vertical-align: middle;
}

.inner {
    margin-left: auto;
    margin-right: auto; 
    width: 400px; /*whatever width you want*/
}

I built in some dynamic content to test the flexibility. Would love to know if anyone sees any problems with it. Should work well for centered overlays also -- lightbox, pop-up, etc.

Worked perfectly when the inner div was a flexible height. I tested it in Chrome and IE7 without the outer div positioned absolutely and that worked as well.

display: inline-block
natural inline elements only
width: /*whatever width you want*/;

css - How to vertically center a div for all browsers? - Stack Overflo...

css cross-browser vertical-alignment
Rectangle 27 974

Below is the best all-around solution I could build to vertically & horizontally center a fixed-width, flexible height content box. Tested and working for recent versions of FF, Opera, Chrome, & Safari.

<div class="outer">
  <div class="middle">
    <div class="inner">

      <h1>The Content</h1>

      <p>Once upon a midnight dreary...</p>

    </div>
  </div>
</div>
.outer {
    display: table;
    position: absolute;
    height: 100%;
    width: 100%;
}

.middle {
    display: table-cell;
    vertical-align: middle;
}

.inner {
    margin-left: auto;
    margin-right: auto; 
    width: /*whatever width you want*/;
}

I built in some dynamic content to test the flexibility. Would love to know if anyone sees any problems with it. Should work well for centered overlays also -- lightbox, pop-up, etc.

Worked perfectly when the inner div was a flexible height. I tested it in Chrome and IE7 without the outer div positioned absolutely and that worked as well.

display: inline-block
natural inline elements only

css - How to vertically center a div for all browsers? - Stack Overflo...

css cross-browser vertical-alignment