I uploaded to my github (link in reference) a script which allow you to check average ambient temperature for all Bays stored in HP BladeSystem using it's Onboard Administrator from which I put below sample output.
VM-CPX-CPD-1> show server temp all
Device Bay #1 Temperature Information
Locale Status Temp Caution Critical
----------------------------------- ------ -------- ------- --------
Ambient Zone (Inlet Ambient ) OK 18C/ 64F 42C 46C
System Zone (System Board ) OK 23C/ 73F 85C 90C
CPU Zone (CPU 1 ) OK 7C/ 44F 75C 80C
CPU Zone (CPU 2 ) OK 19C/ 66F 75C 80C
CPU Zone (CPU 3 ) OK N/A
CPU Zone (CPU 4 ) OK N/A
Memory Zone (DIMMs 1 ) OK 30C/ 86F 87C 92C
Memory Zone (DIMMs 2 ) OK 29C/ 84F 87C 92C
Memory Zone (DIMMs 3 ) OK N/A
Memory Zone (DIMMs 4 ) OK N/A
Memory Zone (Mem 1 1-4 Zone ) OK 34C/ 93F 85C 90C
Memory Zone (Mem 1 5-8 Zone ) OK 35C/ 95F 85C 90C
Memory Zone (Mem 2 1-4 Zone ) OK 30C/ 86F 85C 90C
Memory Zone (Mem 2 5-8 Zone ) OK 34C/ 93F 85C 90C
Memory Zone (Mem 3 1-4 Zone ) OK 23C/ 73F 85C 90C
Memory Zone (Mem 3 5-8 Zone ) OK 23C/ 73F 85C 90C
Memory Zone (Mem 4 1-4 Zone ) OK 22C/ 71F 85C 90C
Memory Zone (Mem 4 5-8 Zone ) OK 24C/ 75F 85C 90C
I/O Board Zone (IOH 1 ) OK 64C/147F 100C 105C
I/O Board Zone (IOH 2 ) OK 62C/143F 100C 105C
I/O Board Zone (NIC Zone ) OK 67C/152F 90C 95C
I/O Board Zone (Mezz Zone ) OK 60C/140F 90C 95C
System Zone (Chassis Exit ) OK 64C/147F 100C 105C
Storage Zone (HDD Max ) OK 35C/ 95F 60C 65C
Virtual Fan: 28%
Device Bay #2 Temperature Information
Locale Status Temp Caution Critical
----------------------------------- ------ -------- ------- --------
Ambient Zone (Inlet Ambient ) OK 17C/ 62F 42C 46C
System Zone (System Board ) OK 23C/ 73F 85C 90C
CPU Zone (CPU 1 ) OK 6C/ 42F 75C 80C
CPU Zone (CPU 2 ) OK 5C/ 41F 75C 80C
CPU Zone (CPU 3 ) OK N/A
CPU Zone (CPU 4 ) OK N/A
Memory Zone (DIMMs 1 ) OK 30C/ 86F 87C 92C
Memory Zone (DIMMs 2 ) OK 27C/ 80F 87C 92C
Memory Zone (DIMMs 3 ) OK N/A
Memory Zone (DIMMs 4 ) OK N/A
Memory Zone (Mem 1 1-4 Zone ) OK 33C/ 91F 85C 90C
Memory Zone (Mem 1 5-8 Zone ) OK 35C/ 95F 85C 90C
Memory Zone (Mem 2 1-4 Zone ) OK 28C/ 82F 85C 90C
Memory Zone (Mem 2 5-8 Zone ) OK 32C/ 89F 85C 90C
Memory Zone (Mem 3 1-4 Zone ) OK 23C/ 73F 85C 90C
Memory Zone (Mem 3 5-8 Zone ) OK 23C/ 73F 85C 90C
Memory Zone (Mem 4 1-4 Zone ) OK 22C/ 71F 85C 90C
Memory Zone (Mem 4 5-8 Zone ) OK 22C/ 71F 85C 90C
I/O Board Zone (IOH 1 ) OK 58C/136F 100C 105C
I/O Board Zone (IOH 2 ) OK 44C/111F 100C 105C
I/O Board Zone (NIC Zone ) OK 62C/143F 90C 95C
I/O Board Zone (Mezz Zone ) OK 57C/134F 90C 95C
System Zone (Chassis Exit ) OK 63C/145F 100C 105C
Storage Zone (HDD Max ) OK 35C/ 95F 60C 65C
Virtual Fan: 27%
print help message
-w WARNING
-U USERNAME
-P PASSWORD
-m TEMPERATURE
-x TEMPERATURE
I just wanted to announce that I created my own github, where I am going to store my projects. So, stay tuned ;)
I would like to share with you an quick and I suppose painless piece of code to make your own table. Quite nice table i must add.
\begin{table}[ht]
\captionof{table}{Parametry zapytania dla Location SOAP API}
\begin{center}
\rowcolors{1}{lightgray}{}
%\begin{tabular}{|p{2cm}|p{12.8cm}|}
\begin{tabular}{| >{\centering\arraybackslash}m{2cm} | >{\centering\arraybackslash}m{12.8cm} |}
\hline
\multicolumn{1}{|c|}{\textbf{Parametr}} & \multicolumn{1}{c|}{\textbf{Opis wartości}} \\ \hline
address&Numer telefonu przeznaczony do zlokalizowania w formacie międzynarodowym (np. +48504500600)
lub krajowym (np. 504500600)\\ \hline
\end{tabular}
\end{center}
\end{table}
Result :
![]() |
| LaTeX table |
Reference :
[1] Source Pastebin.com
\usepackage[font=normalsize,format=plain,labelfont={bf,normalsize},textfont={it,normalsize}]{caption}
\definecolor{lightgray}{gray}{0.9}
\usepackage{listings}
\usepackage{courier}
\definecolor{gray}{rgb}{0.4,0.4,0.4}
\definecolor{darkblue}{rgb}{0.0,0.0,0.6}
\definecolor{cyan}{rgb}{0.0,0.6,0.6}
\lstset{
basicstyle=\footnotesize\ttfamily, % Standardschrift
%numbers=left, % Ort der Zeilennummern
numberstyle=\tiny, % Stil der Zeilennummern
%stepnumber=2, % Abstand zwischen den Zeilennummern
numbersep=5pt, % Abstand der Nummern zum Text
tabsize=2, % Groesse von Tabs
extendedchars=true, %
breaklines=true, % Zeilen werden Umgebrochen
keywordstyle=\color{red},
frame=b,
% keywordstyle=[1]\textbf, % Stil der Keywords
% keywordstyle=[2]\textbf, %
% keywordstyle=[3]\textbf, %
% keywordstyle=[4]\textbf, \sqrt{\sqrt{}} %
stringstyle=\color{white}\ttfamily, % Farbe der String
showspaces=false, % Leerzeichen anzeigen ?
showtabs=false, % Tabs anzeigen ?
xleftmargin=17pt,
framexleftmargin=17pt,
framexrightmargin=5pt,
framexbottommargin=4pt,
%backgroundcolor=\color{lightgray},
showstringspaces=false % Leerzeichen in Strings anzeigen ?
}
\lstdefinelanguage{XML}
{
morestring=[b]",
morestring=[s]{>}{<},
morecomment=[s]{},
stringstyle=\color{black},
identifierstyle=\color{darkblue},
keywordstyle=\color{cyan},
morekeywords={xmlns,version,type}% list your attributes here
}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}
Using in LaTeX code :
\lstinputlisting[label=soaplocationresponse,language=XML,caption=Odpowiedź Location SOAP API]{locationsoapresponse.xml}
Result :
![]() |
| LaTeX XML listing |
Reference :
[1] Listing XML GarciaPL Pastebin.com
[2] Using XML listing Pastebin.com
Very fast guide how to use REST Template in Spring with SSL. It is just a few lines of code, but in some time it was very useful for me. This example is using Telco interfaces which allow to get subscriber location. Unfortunately this one is not available to the public.
public class LocationTelcoAPI {
private RestTemplate restTemplate = new RestTemplate();
private String telco_location = "https://api.orange.pl/terminallocation/?msisdn={phone}";
private void enableSSL() {
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
}
};
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (Exception e) {
}
}
public LocationResponse getLocation(String telephone_number) {
enableSSL();
String auth = TelcoAuth.USERNAME + ":" + TelcoAuth.PASSWORD;
byte[] encodedAuth = Base64.encodeBase64(auth.getBytes());
String authHeader = "Basic " + new String(encodedAuth);
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", "application/json");
headers.set("Authorization", authHeader);
Map variables = new HashMap(1);
variables.put("phone", telephone_number);
ResponseEntity exchange = restTemplate.exchange(telco_location, HttpMethod.GET, new HttpEntity(headers), LocationResponse.class, variables);
System.out.println(exchange.getStatusCode());
System.out.println(exchange.getBody().getResult());
System.out.println(exchange.getBody().getLongitude());
System.out.println(exchange.getBody().getLatitude());
System.out.println(exchange.getBody().getAccuracy());
System.out.println(exchange.getBody().getAltitude());
System.out.println(exchange.getBody().getTimestamp());
return exchange.getBody();
}
}
And class which help to deserialization XML :
@XmlRootElement(name = "response")
public class LocationResponse {
@XmlElement
private String result;
@XmlElement
private String latitude;
@XmlElement
private String longitude;
@XmlElement
private String altitude;
@XmlElement
private String accuracy;
@XmlElement
private String timestamp;
public LocationResponse() {
}
public LocationResponse(String result, String latitude, String longitude, String altitude, String accuracy, String timestamp) {
this.result = result;
this.latitude = latitude;
this.longitude = longitude;
this.altitude = altitude;
this.accuracy = accuracy;
this.timestamp = timestamp;
}
public String getResult() {
return result;
}
public String getLatitude() {
return latitude;
}
public String getLongitude() {
return longitude;
}
public String getAltitude() {
return altitude;
}
public String getAccuracy() {
return accuracy;
}
public String getTimestamp() {
return timestamp;
}
@Override
public String toString() {
return "LocationResponse{" + "result=" + result + ", latitude=" + latitude + ", longitude=" + longitude + ", altitude=" + altitude + ", accuracy=" + accuracy + ", timestamp=" + timestamp + '}';
}
}
UPDATE According to Abhijit comment, we can use ClientHttpRequestFactory used as a parameter in RestTemplate constructor. Just implement a ClientHttpRequestFactory and override the prepareConnection method to achieve the same effect as above, but with limiting customers of your system instead of sharing it globally with everyone [3].
Reference :
[1] Source Pastebin Main Class
[2] Source Pastebin XML Deserialization
[3] ClientHttpRequestFactory Example
I would like to show you how easily calculate if an object i mean some point is inside in some king of polygon. Below algorithm is very useful for determining points in some area for example in Google Maps. All what you need to possess is set of coordinates of this area and point.
public boolean sprawdzObiektwObszarze(ArrayListobszar, Coordinate abonent) { final GeometryFactory gf = new GeometryFactory(); LinearRing linearring = new LinearRing(new CoordinateArraySequence(obszar.toArray(newCoordinate[obszar.size()])), gf); final Polygon polygon = gf.createPolygon(linearring, null); final Point point = gf.createPoint(abonent); return point.within(polygon); }
Function return true if point is in polygon or false if it is not.
PS. You must remember that first and last point of ArrayList<Coordinate> should be the same point to close the area.
Reference :
[1] JTS Topology Suite SourceForge.net
[2] Source Pastebin.com


