Unknown model format or submodel type in model file
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
Python内容推荐
Python栈实现计算器_完整知识整理(1).docx
Python栈实现计算器_完整知识整理(1).docx
pr-agent(Python)
「pr-agent(Python)」是开源项目(Python)。项目简介: PR Agent: The Original Open-Source PR Reviewer. This project is not the Qodo free tier.源码完整,下载解压即可查看使用,适合学习参考、课程设计与二次开发。
Delphi7.1 Update
Delphi 7.1 Update Release Notes=======================================================This file contains important supplemental and late-breakinginformation that may not appear in the main productdocumentation, and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized version of Delphi 7, visit the Borland Registered User web site to obtain a localized readme file that may contain important late- breaking information not included in this readme file.IMPORTANT: Delphi must be closed before installing this update. =====================================================CONTENTS * INSTALLING THIS UPDATE * UPDATING LOCALIZED VERSIONS OF DELPHI 7 * KNOWN ISSUES * ISSUES ADDRESSED BY THIS UPDATE - IDE - CORE DATABASE - DATASNAP - DBGO (ADO COMPONENTS) - dbExpress - dbExpress COMPONENTS AND DB VCL - dbExpress CORE DRIVER AND METADATA - dbExpress VENDOR ISSUES - dbExpress CERTIFICATION - WEB SNAP - ACTIVEX - COMPILER - RTL - VCL - THIRD PARTY - BOLD FOR DELPHI * VERIFYING THAT THE UPDATE WAS SUCCESSFUL * FILES INSTALLED BY THIS UPDATE =======================================================INSTALLING THIS UPDATE* This update can not be applied to Delphi 7 Architect Trial version. * This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and launch the d7_ent_upd1.exe file appropriate for your locale.* To install this update from the Web, double-click the self-executing installation file and follow the prompts. * The Delphi 7 documentation PDF files are available on the update CD.========================================================UPDATING LOCALIZED VERSIONS OF DELPHI 7* This update can be applied only to the English version of Delphi 7. There are separate updates for the German, French and Japanese ver
occam一维反演
C----------------------------------------------------------------------- program runocc C----------------------------------------------------------------------- c C OCCAM 2.0: Steven Constable IGPP/SIO La Jolla CA 92093-0225 c Program Revision 2.01, 13 Jan 1993 c c runocc is the calling program for OCCAM v2.0. C C REFERENCES: CONSTABLE, PARKER & CONSTABLE, 1987: GEOPHYSICS 52, 289-300. C DEGROOT-HEDLIN & CONSTABLE, 1990: GEOPHYSICS 55, 1613-1624. C CONSTABLE, 1991: GEOPHYS. J. INT. 106, 387-388. C CONSTABLE, 1992: OCCAM DISTRIBUTION NOTES. C C REVISION HISTORY: C MARCH 1986, (VERSION 1.2) C OCTOBER 1987, (VERSION 1.3) C AUGUST 1988, (VERSION 1.4) C JANUARY 1989 (WITH THANKS TO C.DEGROOT-HEDLIN), (VERSION 1.5) C SEPTEMBER 1989, (VERSION 1.5.2) C APRIL 1992 (MORE THANKS TO CATHERINE AND ALSO WSE) (VERSION 2.0) C C IF YOU OBTAIN THIS CODE FROM A THIRD PERSON, PLEASE SEND YOUR NAME AND ADDRESS C TO S. CONSTABLE. YOU WILL THEN RECEIVE UPDATES, NEWS ON BUGS, ETC. C C VERSION 2.0 IS A RE-WRITE TO MAKE OCCAM INDEPENDENT OF THE DIMENSIONALITY C OF THE FORWARD PROBLEM, AND TO MAKE MAXIMUM USE OF DYNAMIC MEMORY ALLOCATION, C AS THE ARRAY SIZES FOR THE 2D PROBLEM ARE NOW GETTING TOO LARGE FOR COMFORT. C INCLUDE FILES ARE NOW USED TO STREAMLINE CHANGES OF DIMENSION. C IMPLICIT DOUBLE PRECISION HAS BEEN REMOVED, AGAIN FOR STORAGE REASONS. C CALLING PROGRAM IS NOW AN INTEGRAL PART OF THE PACKAGE AS ALL THE MODEL- C DEPENDENT STUFF HAS BEEN SPUN OFF. C C IF YOU OBTAIN THIS CODE FROM A THIRD PERSON, PLEASE SEND YOUR NAME AND ADDRESS C TO S. CONSTABLE. YOU WILL THEN RECEIVE UPDATES, NEWS ON BUGS, ETC. C C SUBROUTINES WHICH MUST BE SUPPLIED BY THE USER: C C FORMOD(NP,ND,PM,DP,DM), COMPUTES THE FORWARD FUNCTION FOR MODEL PM() AT C THE DATA PARAMETERS DP() AN
C#读取JPEG图片的Exif信息
[Serializable] public class EXIF { #region -- Class level members -- // Class level members. private Image _picture; #endregion #region -- Constructors -- // Constructors. /// <summary> /// This is default constructor of the EXIF class. /// </summary> public EXIF() { } /// <summary> /// This is base constructor of the EXIF class. /// </summary> public EXIF(string filePath) { _picture = Image.FromFile(filePath); } #endregion #region -- Public methods -- /// <summary> /// This method returns EXIF property values. /// </summary> /// <param name="exifCode">EXIF property to be returned.</param> public string GetEXIFProperty(Definitions.exifCode exifCode) { // Declare local variables. string returnValue; try { // All of the EXIF properties will return strings to display in the control. // Some of the properties require additional formatting or massaging // of the data once it is returned. Those properties have their own // methods. switch (exifCode) { case Definitions.exifCode.ImageDescription: returnValue = ParsedString(Definitions.exifCode.ImageDescription); break; case Definitions.exifCode.Make: returnValue = ParsedString(Definitions.exifCode.Make); break; case Definitions.exifCode.Model: returnValue = ParsedString(Definitions.exifCode.Model); break; case Definitions.exifCode.Orientation: returnValue = Orientation(); break; case Definitions.exifCode.XResolution: returnValue = ParseResolution(Definitions.exifCode.XResolution); break; case Definitions.exifCode.YResolution: returnValue = ParseResolution(Definitions.exifCode.YResolution); break; case Definitions.exifCode.ResolutionUnit: returnValue = ResolutionUnit(); break; case Definitions.exifCode.Software: returnValue = ParsedString(Definitions.exifCode.Software); break; case Definitions.exifCode.DateTime: returnValue = ParsedDate(Definitions.exifCode.DateTime).ToString(); break; case Definitions.exifCode.WhitePoint: returnValue = WhitePoint(); break; case Definitions.exifCode.PrimaryChromaticities: returnValue = PrimaryChromaticities(); break; case Definitions.exifCode.YCbCrCoefficients: returnValue = YCbCrCoefficients(); break; case Definitions.exifCode.YCbCrPositioning: returnValue = YCbCrPositioning(); break; case Definitions.exifCode.ReferenceBlackWhite: returnValue = ReferenceBlackWhite(); break; case Definitions.exifCode.Copyright: returnValue = ParsedString(Definitions.exifCode.Copyright); break; case Definitions.exifCode.ExposureTime: returnValue = ExposureTime(); break; case Definitions.exifCode.FNumber: returnValue = FNumber(); break; case Definitions.exifCode.ExposureProgram: returnValue = ExposureProgram(); break; case Definitions.exifCode.ISOSpeedRatings: returnValue = UnformattedShort(Definitions.exifCode.ISOSpeedRatings); break; case Definitions.exifCode.ExifVersion: returnValue = ParsedString(Definitions.exifCode.ExifVersion); break; case Definitions.exifCode.DateTimeOriginal: returnValue = ParsedDate(Definitions.exifCode.DateTimeOriginal).ToString(); break; case Definitions.exifCode.DateTimeDigitized: returnValue = ParsedDate(Definitions.exifCode.DateTimeDigitized).ToString(); break; case Definitions.exifCode.ComponentsConfiguration: returnValue = ComponentsConfiguration(); break; case Definitions.exifCode.CompressedBitsPerPixel: returnValue = CompressedBitsPerPixel(); break; case Definitions.exifCode.ShutterSpeedValue: returnValue = ShutterSpeedValue(); break; case Definitions.exifCode.ApertureValue: returnValue = ApertureValue(); break; case Definitions.exifCode.BrightnessValue: returnValue = BrightnessValue(); break; case Definitions.exifCode.ExposureBiasValue: returnValue = ExposureBiasValue(); break; case Definitions.exifCode.MaxApertureValue: returnValue = MaxApertureValue(); break; case Definitions.exifCode.SubjectDistance: returnValue = SubjectDistance(); break; case Definitions.exifCode.MeteringMode: returnValue = MeteringMode(); break; case Definitions.exifCode.LightSource: returnValue = LightSource(); break; case Definitions.exifCode.Flash: returnValue = Flash(); break; case Definitions.exifCode.FocalLength: returnValue = FocalLength(); break; case Definitions.exifCode.MakerNote: returnValue = MakerNote(); break; case Definitions.exifCode.UserComment: returnValue = ParsedString(Definitions.exifCode.UserComment); break; case Definitions.exifCode.SubsecTime: returnValue = ParsedString(Definitions.exifCode.SubsecTime); break; case Definitions.exifCode.SubsecTimeOriginal: returnValue = ParsedString(Definitions.exifCode.SubsecTimeOriginal); break; case Definitions.exifCode.SubsecTimeDigitized: returnValue = ParsedString(Definitions.exifCode.SubsecTimeDigitized); break; case Definitions.exifCode.FlashpixVersion: returnValue = ParsedString(Definitions.exifCode.FlashpixVersion); break; case Definitions.exifCode.ColorSpace: returnValue = ColorSpace(); break; case Definitions.exifCode.RelatedSoundFile: returnValue = ParsedString(Definitions.exifCode.RelatedSoundFile); break; case Definitions.exifCode.FocalPlaneXResolution: returnValue = FocalPlaneXResolution(); break; case Definitions.exifCode.FocalPlaneYResolution: returnValue = FocalPlaneYResolution(); break; case Definitions.exifCode.FocalPlaneResolutionUnit: returnValue = ResolutionUnit(); break; case Definitions.exifCode.ExposureIndex: returnValue = ExposureIndex(); break; case Definitions.exifCode.SensingMethod: returnValue = SensingMethod(); break; case Definitions.exifCode.FileSource: returnValue = FileSource(); break; case Definitions.exifCode.SceneType: returnValue = SceneType(); break; case Definitions.exifCode.CFAPattern: returnValue = ParsedString(Definitions.exifCode.CFAPattern); break; case Definitions.exifCode.InteroperabilityIndex: returnValue = ParsedString(Definitions.exifCode.InteroperabilityIndex); break; case Definitions.exifCode.ImageWidth: returnValue = UnformattedShort(Definitions.exifCode.ImageWidth); break; case Definitions.exifCode.ImageLength: returnValue = UnformattedShort(Definitions.exifCode.ImageLength); ; break; case Definitions.exifCode.BitsPerSample: returnValue = BitsPerSample(); break; case Definitions.exifCode.Compression: returnValue = Compression(); break; case Definitions.exifCode.PhotometricInterpretation: returnValue = PhotometricInterpretation(); break; case Definitions.exifCode.StripOffsets: returnValue = StripOffsets(); break; case Definitions.exifCode.SamplesPerPixel: returnValue = UnformattedShort(Definitions.exifCode.SamplesPerPixel); break; case Definitions.exifCode.RowsPerStrip: returnValue = UnformattedShort(Definitions.exifCode.RowsPerStrip); break; case Definitions.exifCode.StripByteCounts: returnValue = StripByteCounts(); break; case Definitions.exifCode.PlanarConfiguration: returnValue = PlanarConfiguration(); break; case Definitions.exifCode.YCbCrSubSampling: returnValue = YCbCrSubSampling(); break; case Definitions.exifCode.ImageUniqueID: returnValue = ParsedString(Definitions.exifCode.ImageUniqueID); break; case Definitions.exifCode.JPEGInterchangeFormatLength: returnValue = UnformattedShort(Definitions.exifCode.JPEGInterchangeFormatLength); break; case Definitions.exifCode.TransferFunction: returnValue = "Not implemented."; break; case Definitions.exifCode.PixelXDimension: returnValue = UnformattedShort(Definitions.exifCode.PixelXDimension); break; case Definitions.exifCode.PixelYDimension: returnValue = UnformattedShort(Definitions.exifCode.PixelYDimension); break; case Definitions.exifCode.SpectralSensitivity: returnValue = ParsedString(Definitions.exifCode.SpectralSensitivity); break; case Definitions.exifCode.OECF: returnValue = ParsedString(Definitions.exifCode.OECF); break; case Definitions.exifCode.CustomRendered: returnValue = CustomRendered(); break; case Definitions.exifCode.ExposureMode: returnValue = ExposureMode(); break; case Definitions.exifCode.WhiteBalance: returnValue = WhiteBalance(); break; case Definitions.exifCode.DigitalZoomRatio: returnValue = DigitalZoomRatio(); break; case Definitions.exifCode.FocalLengthIn35mmFilm: returnValue = FocalLengthIn35mmFilm(); break; case Definitions.exifCode.SceneCaptureType: returnValue = SceneCaptureType(); break; case Definitions.exifCode.GainControl: returnValue = GainControl(); break; case Definitions.exifCode.Contrast: returnValue = Contrast(); break; case Definitions.exifCode.Saturation: returnValue = Saturation(); break; case Definitions.exifCode.Sharpness: returnValue = Sharpness(); break; case Definitions.exifCode.DeviceSettingDescription: returnValue = ParsedString(Definitions.exifCode.DeviceSettingDescription); break; case Definitions.exifCode.SubjectDistanceRange: returnValue = SubjectDistanceRange(); break; default: returnValue = "EXIF property not found."; break; } return returnValue; } catch { return "N/A"; } } #endregion #region -- EXIF Methods -- /// <summary> /// This method returns the bits per sample EXIF property. /// </summary> private string BitsPerSample() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.BitsPerSample); //Translate the EXIF code into a readable value. if (!data.Equals(null)) { returnValue = data[0].ToString() + " " + data[1].ToString() + " " + data[2].ToString(); } return returnValue; } /// <summary> /// This method returns the compression EXIF property. /// </summary> private string Compression() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.Compression); //Translate the EXIF code into a readable value. if (!data.Equals(null)) { switch (data[0]) { case 1: returnValue = "uncompressed"; break; case 6: returnValue = "JPEG compression (thumbnails only)"; break; default: returnValue = "reserved"; break; } } return returnValue; } /// <summary> /// This method returns the photometric interpretation EXIF property. /// </summary> private string PhotometricInterpretation() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.PhotometricInterpretation); //Translate the EXIF code into a readable value. if (data != null) { switch (data[0]) { case 2: returnValue = "RBG"; break; case 6: returnValue = "YCbCr"; break; default: returnValue = "reserved"; break; } } return returnValue; } /// <summary> /// This method returns the strip offsets EXIF property. /// </summary> private string StripOffsets() { return "Not implemented."; } /// <summary> /// This method returns the strip byte counts EXIF property. /// </summary> private string StripByteCounts() { return "Not implemented."; } /// <summary> /// This method returns the planar configuration EXIF property. /// </summary> private string PlanarConfiguration() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.PlanarConfiguration); //Translate the EXIF code into a readable value. if (data != null) { switch (data[0]) { case 1: returnValue = "chunky format"; break; case 2: returnValue = "planar format"; break; default: returnValue = "reserved"; break; } } return returnValue; } /// <summary> /// This method returns the YCbCr subsampling EXIF property. /// </summary> private string YCbCrSubSampling() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.YCbCrSubSampling); //Translate the EXIF code into a readable value. if (data != null) { switch (data[0]) { case 2: if (data[1] == 1) { returnValue = "YCbCr4:2:2"; } else { returnValue = "YCbCr4:2:0"; } break; default: returnValue = "reserved"; break; } } return returnValue; } /// <summary> /// This method returns the orientation EXIF property. /// </summary> private string Orientation() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.Orientation); //Translate the EXIF code into a readable value. if (data.Length > 0) { switch (data[0]) { case 1: returnValue = "The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side."; break; case 2: returnValue = "The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side."; break; case 3: returnValue = "The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side."; break; case 4: returnValue = "The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side."; break; case 5: returnValue = "The 0th row is at the visual left-hand side of the image, and the 0th column is the visual top."; break; case 6: returnValue = "The 0th row is at the visual right-hand side of the image, and the 0th column is the visual top."; break; case 7: returnValue = "The 0th row is at the visual right-hand side of the image, and the 0th column is the visual bottom."; break; case 8: returnValue = "The 0th row is at the visual left-hand side of the image, and the 0th column is the visual bottom."; break; default: returnValue = "Other"; break; } } return returnValue; } /// <summary> /// This method returns the resolution unit EXIF property. /// </summary> private string ResolutionUnit() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] resUnit = GetPropertyValue(Definitions.exifCode.ResolutionUnit); //Translate the EXIF code into a readable value. if (resUnit != null) { switch (resUnit[0]) { case 2: returnValue = "inches"; break; case 3: returnValue = "centimeters"; break; default: returnValue = "reserved"; break; } } return returnValue; } /// <summary> /// This method returns the white point EXIF property. /// </summary> private string WhitePoint() { string returnValue = "EXIF property not found."; EXIFRational[] data = ParsedRationalArray(Definitions.exifCode.WhitePoint); if (data.Length > 0) { returnValue = data[0].Denominator.ToString() + ", " + data[1].Denominator.ToString(); } return returnValue; } /// <summary> /// This method returns the primary chromaticities EXIF property. /// </summary> private string PrimaryChromaticities() { string returnValue = "EXIF property not found."; EXIFRational[] data = ParsedRationalArray(Definitions.exifCode.PrimaryChromaticities); if (data.Length > 0) { returnValue = data[0].Denominator.ToString() + ", " + data[1].Denominator.ToString() + ", " + data[2].Denominator.ToString() + ", " + data[3].Denominator.ToString() + ", " + data[4].Denominator.ToString() + ", " + data[5].Denominator.ToString(); } return returnValue; } /// <summary> /// This method returns the YCbCr coefficients EXIF property. /// </summary> private string YCbCrCoefficients() { string returnValue = "EXIF property not found."; EXIFRational[] data = ParsedRationalArray(Definitions.exifCode.YCbCrCoefficients); if (data.Length > 0) { returnValue = data[0].Denominator.ToString() + ", " + data[1].Denominator.ToString() + ", " + data[2].Denominator.ToString(); } return returnValue; } /// <summary> /// This method returns the YCbCr positioning EXIF property. /// </summary> private string YCbCrPositioning() { //Declare local variables. string returnValue = ""; byte[] data = GetPropertyValue(Definitions.exifCode.YCbCrPositioning); //Translate the EXIF code into a readable value. if (data.Length > 0) { switch (data[0]) { case 1: returnValue = "centered"; break; case 2: returnValue = "co-sited"; break; default: returnValue = "reserved"; break; } } else { returnValue = "EXIF property not found."; } return returnValue; } /// <summary> /// This method returns the reference black white EXIF property. /// </summary> private string ReferenceBlackWhite() { string returnValue = "EXIF property not found."; EXIFRational[] data = ParsedRationalArray(Definitions.exifCode.ReferenceBlackWhite); if (data.Length > 0) { returnValue = "[" + data[0].Denominator.ToString() + ", " + data[1].Denominator.ToString() + ", " + data[2].Denominator.ToString() + ", " + data[3].Denominator.ToString() + ", " + data[4].Denominator.ToString() + ", " + data[5].Denominator.ToString() + "]"; } return returnValue; } /// <summary> /// This method returns the exposure time EXIF property. /// </summary> private string ExposureTime() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational exposureTime = ParsedRational(Definitions.exifCode.ExposureTime); //Translate the EXIF code into a readable value. if (!exposureTime.Equals(null)) { if (exposureTime.Numerator == 0 && exposureTime.Denominator == 0) { returnValue = "N/A"; } else { returnValue = string.Format("{0}/{1} s", exposureTime.Numerator, exposureTime.Denominator); } } else { returnValue = "N/A"; } return returnValue; } /// <summary> /// This method returns the FNumber EXIF property. /// </summary> private string FNumber() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational fNumber = ParsedRational(Definitions.exifCode.FNumber); //Translate the EXIF code into a readable value. if (!fNumber.Equals(null)) { returnValue = string.Format("f{0}", (float)(fNumber.Numerator / fNumber.Denominator)); } return returnValue; } /// <summary> /// This method returns the exposure program EXIF property. /// </summary> private string ExposureProgram() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.ExposureProgram); //Translate the EXIF code into a readable value. if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Not defined"; break; case 1: returnValue = "Manual"; break; case 2: returnValue = "Normal program"; break; case 3: returnValue = "Aperture priority"; break; case 4: returnValue = "Shutter priority"; break; case 5: returnValue = "Creative program (biased toward depth of field)"; break; case 6: returnValue = "Action program (biased toward fast shutter speed)"; break; case 7: returnValue = "Portrait mode (for closeup photos with the background out of focus)"; break; case 8: returnValue = "Landscape mode (for landscape photos with the background in focus)"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the components configuration EXIF property. /// </summary> private string ComponentsConfiguration() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.ComponentsConfiguration); switch (data[0]) { case 1: returnValue = "YCbCr"; break; case 4: returnValue = "RGB"; break; default: returnValue = "Reserved"; break; } return returnValue; } /// <summary> /// This method returns the compressed bits per pixel EXIF property. /// </summary> // This method needs to fixed to return the correct value. private string CompressedBitsPerPixel() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational cbpp = ParsedRational(Definitions.exifCode.CompressedBitsPerPixel); //Translate the EXIF code into a readable value. if (!cbpp.Equals(null)) { returnValue = string.Format("{0}/{1}", cbpp.Numerator, cbpp.Denominator); } return returnValue; } /// <summary> /// This method returns the aperture value EXIF property. /// </summary> private string ApertureValue() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational fNumber = ParsedRational(Definitions.exifCode.FNumber); //Translate the EXIF code into a readable value. if (!fNumber.Equals(null)) { double av = Math.Round(2 * Math.Log(((fNumber.Numerator / fNumber.Denominator)), 2.00)); returnValue = string.Format("f{0}", (double)av); } return returnValue; } /// <summary> /// This method returns the shutter speed value EXIF property. /// </summary> private string ShutterSpeedValue() { //Declare local variables. string returnValue = "EXIF property not found."; returnValue = ExposureTime(); return returnValue; } /// <summary> /// This method returns the subject distance EXIF property. /// </summary> private string SubjectDistance() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational sd = ParsedRational(Definitions.exifCode.SubjectDistance); //Translate the EXIF code into a readable value. if (!sd.Equals(null)) { returnValue = string.Format("{0}", sd.Numerator); } return returnValue; } /// <summary> /// This method returns the metering mode EXIF property. /// </summary> private string MeteringMode() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.MeteringMode); //Translate the EXIF code into a readable value. if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Unknown"; break; case 1: returnValue = "Average"; break; case 2: returnValue = "CenterWeightedAverage"; break; case 3: returnValue = "Spot"; break; case 4: returnValue = "MultiSpot"; break; case 5: returnValue = "Pattern"; break; case 6: returnValue = "Partial"; break; case 255: returnValue = "Other"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the light source EXIF property. /// </summary> private string LightSource() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.LightSource); //Translate the EXIF code into a readable value. if (data.Length > 0) { switch (data[0]) { case 1: returnValue = "Daylight"; break; case 2: returnValue = "Fluorescent"; break; case 3: returnValue = "Tungsten (incandescent light)"; break; case 4: returnValue = "Flash"; break; case 9: returnValue = "Fine weather"; break; case 10: returnValue = "Cloudy weather"; break; case 11: returnValue = "Shade"; break; case 12: returnValue = "Daylight fluorescent (D 5700 - 7100K)"; break; case 13: returnValue = "Day white fluorescent (N 4600 - 5400K)"; break; case 14: returnValue = "Cool white fluorescent (W 3900 - 4500K)"; break; case 15: returnValue = "White fluorescent (WW 3200 - 3700K)"; break; case 17: returnValue = "Standard light A"; break; case 18: returnValue = "Standard light B"; break; case 19: returnValue = "Standard light C"; break; case 20: returnValue = "D55"; break; case 21: returnValue = "D65"; break; case 22: returnValue = "D75."; break; case 23: returnValue = "D50"; break; case 24: returnValue = "ISO studio tungsten"; break; case 255: returnValue = "other light source"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the flash EXIF property. /// </summary> private string Flash() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.Flash); //Translate the EXIF code into a readable value. if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Flash did not fire."; break; case 1: returnValue = "Flash fired."; break; case 5: returnValue = "Strobe return light not detected."; break; case 7: returnValue = "Strobe return light detected."; break; case 9: returnValue = "Flash fired, compulsory flash mode."; break; case 13: returnValue = "Flash fired, compulsory flash mode, return light not detected."; break; case 15: returnValue = "Flash fired, compulsory flash mode, return light detected."; break; case 16: returnValue = "Flash did not fire, compulsory flash mode."; break; case 24: returnValue = "Flash did not fire, auto mode."; break; case 25: returnValue = "Flash fired, auto mode."; break; case 29: returnValue = "Flash fired, auto mode, return light not detected."; break; case 31: returnValue = "Flash fired, auto mode, return light detected."; break; case 32: returnValue = "No flash function."; break; case 65: returnValue = "Flash fired, red-eye reduction mode."; break; case 69: returnValue = "Flash fired, red-eye reduction mode, return light not detected."; break; case 71: returnValue = "Flash fired, red-eye reduction mode, return light detected."; break; case 73: returnValue = "Flash fired, compulsory flash mode, red-eye reduction mode."; break; case 77: returnValue = "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected."; break; case 79: returnValue = "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected."; break; case 89: returnValue = "Flash fired, auto mode, red-eye reduction mode."; break; case 93: returnValue = "Flash fired, auto mode, return light not detected, red-eye reduction mode."; break; case 95: returnValue = "Flash fired, auto mode, return light detected, red-eye reduction mode."; break; default: returnValue = "Not defined, reserved."; break; } } return returnValue; } /// <summary> /// This method returns the focal length EXIF property. /// </summary> private string FocalLength() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational focalLength = ParsedRational(Definitions.exifCode.FocalLength); //Translate the EXIF code into a readable value. if (!focalLength.Equals(null)) { if (focalLength.Numerator == 0 && focalLength.Denominator == 0) { returnValue = "N/A"; } else { returnValue = string.Format("{0:N0} mm", focalLength.Numerator * 1.0 / focalLength.Denominator); } } return returnValue; } /// <summary> /// This method returns the maker note EXIF property. /// </summary> private string MakerNote() { return "Not implemented."; } /// <summary> /// This method returns the color space EXIF property. /// </summary> private string ColorSpace() { //Declare local variables. string returnValue = "EXIF property not found."; byte[] data = GetPropertyValue(Definitions.exifCode.ColorSpace); //Translate the EXIF code into a readable value. if (data.Length > 0) { switch (data[0]) { case 1: returnValue = "sRGB"; break; case 255: returnValue = "Uncalibrated"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the focal plane x resolution EXIF property. /// </summary> private string FocalPlaneXResolution() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational focalPlaneXRes = ParsedRational(Definitions.exifCode.FocalPlaneXResolution); //Translate the EXIF code into a readable value. if (!focalPlaneXRes.Equals(null)) { returnValue = string.Format("{0:N0} mm", (focalPlaneXRes.Numerator * 1.0 / focalPlaneXRes.Denominator)); } return returnValue; } /// <summary> /// This method returns the focal plane y resolution EXIF property. /// </summary> private string FocalPlaneYResolution() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational focalPlaneYRes = ParsedRational(Definitions.exifCode.FocalPlaneYResolution); //Translate the EXIF code into a readable value. if (!focalPlaneYRes.Equals(null)) { returnValue = string.Format("{0:N0} mm", focalPlaneYRes.Numerator * 1.0 / focalPlaneYRes.Denominator); } return returnValue; } /// <summary> /// This method returns the exposure index EXIF property. /// </summary> private string ExposureIndex() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational expIndex = ParsedRational(Definitions.exifCode.ExposureIndex); //Translate the EXIF code into a readable value. if (!expIndex.Equals(null)) { returnValue = string.Format("{0:N0} mm", expIndex.Numerator * 1.0 / expIndex.Denominator); } return returnValue; } /// <summary> /// This method returns the sensing method EXIF property. /// </summary> private string SensingMethod() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.SensingMethod); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 1: returnValue = "Not defined."; break; case 2: returnValue = "One-chip color area sensor."; break; case 3: returnValue = "Two-chip color area sensor."; break; case 4: returnValue = "Three-chip color area sensor."; break; case 5: returnValue = "Color sequential area sensor."; break; case 7: returnValue = "Trilinear sensor."; break; case 8: returnValue = "Color sequential linear sensor"; break; default: returnValue = "Reserved."; break; } } return returnValue; } /// <summary> /// This method returns the file source EXIF property. /// </summary> private string FileSource() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.FileSource); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 3: returnValue = "DSC"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the scene type EXIF property. /// </summary> private string SceneType() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.FileSource); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 1: returnValue = "A directly photographed image."; break; default: returnValue = "Reserved."; break; } } return returnValue; } /// <summary> /// This method returns the custom rendered EXIF property. /// </summary> private string CustomRendered() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.CustomRendered); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Normal process"; break; case 1: returnValue = "Custom process"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the exposure mode EXIF property. /// </summary> private string ExposureMode() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.ExposureMode); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Auto exposure"; break; case 1: returnValue = "Manual exposure"; break; case 2: returnValue = "Auto bracket"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the white balance EXIF property. /// </summary> private string WhiteBalance() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.WhiteBalance); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Auto white balance"; break; case 1: returnValue = "Manual white balance"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the focal length in 35mm film EXIF property. /// </summary> private string FocalLengthIn35mmFilm() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.FocalLengthIn35mmFilm); string returnValue = "EXIF property not found."; if (data.Length > 0) { if (data[0] == 0) { returnValue = "Unknown"; } else if (data[0].ToString().Trim() == "NaN") { returnValue = "N/A"; } else { returnValue = data[0].ToString() + "mm"; } } return returnValue; } /// <summary> /// This method returns the scene capture type EXIF property. /// </summary> private string SceneCaptureType() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.SceneCaptureType); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Standard"; break; case 1: returnValue = "Landscape"; break; case 2: returnValue = "Portrait"; break; case 3: returnValue = "Night scene"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the gain control EXIF property. /// </summary> private string GainControl() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.GainControl); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "None"; break; case 1: returnValue = "Low gain up"; break; case 2: returnValue = "High gain up"; break; case 3: returnValue = "Low gain down"; break; case 4: returnValue = "High gain down"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the contrast EXIF property. /// </summary> private string Contrast() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.Contrast); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Normal"; break; case 1: returnValue = "Soft"; break; case 2: returnValue = "Hard"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the saturation EXIF property. /// </summary> private string Saturation() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.Saturation); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Normal"; break; case 1: returnValue = "Low saturation"; break; case 2: returnValue = "High saturation"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the sharpness EXIF property. /// </summary> private string Sharpness() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.Sharpness); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Normal"; break; case 1: returnValue = "Soft"; break; case 2: returnValue = "Hard"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the subject distance range EXIF property. /// </summary> private string SubjectDistanceRange() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.SubjectDistanceRange); string returnValue = "EXIF property not found."; if (data.Length > 0) { switch (data[0]) { case 0: returnValue = "Unknown"; break; case 1: returnValue = "Macro"; break; case 2: returnValue = "Close view"; break; case 3: returnValue = "Distant view"; break; default: returnValue = "Reserved"; break; } } return returnValue; } /// <summary> /// This method returns the subject location EXIF property. /// </summary> private string SubjectLocation() { // Declare local variables. // Get the value for this EXIF property. byte[] data = GetPropertyValue(Definitions.exifCode.SubjectLocation); string returnValue = "EXIF property not found."; if (data.Length > 0) { returnValue = "(" + data[0].ToString() + ", " + data[1].ToString() + ")"; } return returnValue; } /// <summary> /// This method returns the digital zoom ratio EXIF property. /// </summary> private string DigitalZoomRatio() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational dzr = ParsedRational(Definitions.exifCode.DigitalZoomRatio); //Translate the EXIF code into a readable value. if (!dzr.Equals(null)) { returnValue = dzr.Numerator.ToString() + ":" + dzr.Denominator.ToString(); } return returnValue; } /// <summary> /// This method returns the brightness value EXIF property. /// </summary> private string BrightnessValue() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational data = ParsedRational(Definitions.exifCode.DigitalZoomRatio); //Translate the EXIF code into a readable value. if (!data.Equals(null)) { if ((long)data.Numerator >= Int32.MaxValue) { returnValue = "Unknown"; } else { returnValue = Math.Log(data.Numerator / data.Denominator, 2.0).ToString(); } } return returnValue; } /// <summary> /// This method returns the max aperture value EXIF property. /// </summary> private string MaxApertureValue() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational data = ParsedRational(Definitions.exifCode.MaxApertureValue); //Translate the EXIF code into a readable value. if (!data.Equals(null)) { returnValue = string.Format("f{0}", (double)(data.Numerator / data.Denominator)); } return returnValue; } /// <summary> /// This method returns the exposure bias value EXIF property. /// </summary> private string ExposureBiasValue() { //Declare local variables. string returnValue = "EXIF property not found."; EXIFRational data = ParsedRational(Definitions.exifCode.ExposureBiasValue); //Translate the EXIF code into a readable value. if (!data.Equals(null)) { returnValue = string.Format("f{0}", (double)(data.Numerator / data.Denominator)); } return returnValue; } #endregion #region -- Private helper functions -- // Private helper functions. /// <summary> /// This method retrieves the data from the propery items collection. /// </summary> private byte[] GetPropertyValue(Definitions.exifCode exifCode) { return _picture.GetPropertyItem((int)exifCode).Value; } /// <summary> /// This method returns string EXIF data. /// </summary> private string ParsedString(Definitions.exifCode exifCode) { // Declare local variables. // Retrieve the data for this EXIF property. byte[] data = GetPropertyValue(exifCode); // Holds the return value. string parsed = ""; // If there's data, go ahead and parse it. if (data.Length > 1) { // Allocate some memory. IntPtr h = Marshal.AllocHGlobal(data.Length); int i = 0; foreach (byte b in data) { Marshal.WriteByte(h, i, b); i++; } parsed = Marshal.PtrToStringAnsi(h); Marshal.FreeHGlobal(h); } return parsed; } /// <summary> /// This method returns rational EXIF data. /// </summary> private EXIFRational ParsedRational(Definitions.exifCode exifCode) { // Declare local variables. // Retrieve the data for this EXIF property. byte[] data = GetPropertyValue(exifCode); // Parse the data. EXIFRational parsed = new EXIFRational(data); return parsed; } /// <summary> /// This method returns an array of rational EXIF data. /// </summary> private EXIFRational[] ParsedRationalArray(Definitions.exifCode exifCode) { // Declare local variables. // Retrieve the data for this EXIF property. byte[] data = GetPropertyValue(exifCode); // Holds the return value. EXIFRational[] parsed = null; int arraySize = (data.Length / 8); if (arraySize > 0) { parsed = new EXIFRational[arraySize]; for (int i = 0; i < arraySize; i++) { parsed[i] = new EXIFRational(data, i * 8); } } return parsed; } /// <summary> /// This method returns date/time EXIF data. /// </summary> private DateTime ParsedDate(Definitions.exifCode exifCode) { // Declare local variables. // Create a new date object. DateTime ret = new DateTime(1900, 1, 1, 0, 0, 0); // Parse the data. string date = ParsedString(exifCode); // Format the data. if (date.Length >= 19) {
jsp探针 ver0.1
jsp探针ceshi.jsp <%@ page contentType="text/html; charset=gb2312" %> <% class LfSpy { boolean supportHibernate = false; boolean supportJNDI = false; boolean supportJavaxSql = false; boolean supportJAF = false; boolean supportMail = false; boolean supportBeanUtils = false; boolean supportCommonLogging = false; boolean supportCommonCodec = false; boolean supportCommonCollection = false; boolean supportCommonDigester = false; boolean supportCommonLang = false; boolean supportJakartaRegExp = false; boolean supportLucene = false; boolean supportDom4j = false; boolean supportLoonframework = false; boolean supportMmMysqlDriver = false; boolean supportComMysqlDriver = false; boolean supportImageProcessing = false; boolean supportStruts = false; boolean supportSpring = false; String serverName; String serverIP="127.0.0.1"; long startTime = System.currentTimeMillis(); long startMemory = Runtime.getRuntime().freeMemory(); java.util.Properties prop = System.getProperties(); String javaVersion=prop.getProperty("java.version"); String FS=prop.getProperty("file.separator"); int CPUTIME = 30; int PERCENT = 100; public LfSpy() { try { Class.forName("org.springframework.context.ApplicationContext"); supportSpring = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.loon.framework.Loon"); supportLoonframework = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.hibernate.Transaction"); supportHibernate = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.apache.struts.action.ActionServlet"); supportStruts = true; } catch (ClassNotFoundException ex) { } try { Class.forName("javax.naming.Name"); supportJNDI = true; } catch (ClassNotFoundException ex) { } try { Class.forName("javax.sql.DataSource"); supportJavaxSql = true; } catch (ClassNotFoundException ex) { } try { Class.forName("javax.activation.DataSource"); supportJAF = true; } catch (ClassNotFoundException ex) { } try { Class.forName("javax.mail.Message"); supportMail = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.apache.commons.beanutils.MethodUtils"); supportBeanUtils = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.apache.commons.logging.LogFactory"); supportCommonLogging = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.apache.commons.codec.Decoder"); supportCommonCodec = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.apache.commons.collections.ArrayStack"); supportCommonCollection = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.apache.commons.digester.Digester"); supportCommonDigester = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.apache.commons.lang.SystemUtils"); supportCommonLang = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.apache.regexp.RE"); supportJakartaRegExp = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.apache.lucene.index.IndexWriter"); supportLucene = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.dom4j.Document"); supportDom4j = true; } catch (ClassNotFoundException ex) { } try { Class.forName("org.gjt.mm.mysql.Driver"); supportMmMysqlDriver = true; } catch (ClassNotFoundException ex) { } try { Class.forName("com.mysql.jdbc.Driver"); supportComMysqlDriver = true; } catch (ClassNotFoundException ex) { } loadAddress(); try { java.awt.image.BufferedImage bufferedImage = new java.awt.image.BufferedImage( 10, 10, java.awt.image.BufferedImage.TYPE_INT_RGB); java.awt.Graphics2D g = bufferedImage.createGraphics(); g.drawLine(0, 0, 10, 10); g.dispose(); supportImageProcessing = true; } catch (Throwable ex) { } } public String getOSarch(){ return prop.getProperty("os.arch"); } public String getTimeZone(){ return prop.getProperty("user.timezone"); } public String getNowUser(){ return prop.getProperty("user.name"); } public String getNowUserDir(){ return prop.getProperty("user.dir"); } public String getOSName(){ return prop.getProperty("os.name"); } public String getSystemModel(){ return prop.getProperty("sun.arch.data.model"); } final private long getDiskForLinuxInfo(final String dirPath) { try { String dir = dirPath.startsWith("/") ? dirPath : "/"+dirPath; long space = -1; Process process; Runtime run = Runtime.getRuntime(); String osName = System.getProperty("os.name").toLowerCase(); String command = ""; if (osName.startsWith("linux")) { command = "df -k " + dir; } process = run.exec(command); java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader( process.getInputStream())); String freeSpace = "", line; while ((line = in.readLine()) != null) { if (line.length() > 0) { freeSpace = line; } } if (freeSpace == null || freeSpace.length() == 0) { return -1; } process.destroy(); freeSpace = freeSpace.trim().replaceAll("\\\\", "\\/"); String[] results = freeSpace.split(" "); for (int i = results.length - 1; i > 0; i--) { try { space = Long.parseLong(results[i]); return space; } catch (NumberFormatException ex) { continue; } } } catch (java.io.IOException e) { return -1; } return -1; } /** * 获得windows下指定地址硬盘空间大小 * * @param dirPath * @return */ final private long getDiskForWindowsInfo(String dirPath) { try { long space = -1; Process process; Runtime run = Runtime.getRuntime(); String osName = System.getProperty("os.name").toLowerCase(); String command = ""; if (osName.startsWith("windows") && osName.indexOf("98") == -1) { command = "cmd.exe /c dir " + dirPath; } else if (osName.startsWith("windows") && osName.indexOf("98") != -1) { command = "command.com /c dir " + dirPath; } process = run.exec(command); java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader( process.getInputStream())); String freeSpace = "", line; while ((line = in.readLine()) != null) { freeSpace = line; } if (freeSpace == null) { return -1; } process.destroy(); freeSpace = freeSpace.trim(); freeSpace = freeSpace.replaceAll("\\\\\\\\\\\\\\\\.", ""); freeSpace = freeSpace.replaceAll(",", ""); String[] results = freeSpace.split(" "); for (int i = 1; i < results.length; i++) { try { space = Long.parseLong(results[i]); return space; } catch (NumberFormatException ex) { continue; } } return space; } catch (java.io.IOException e) { return -1; } } public long getObjectDisk() { String path = prop.getProperty("user.dir"); int index = path.indexOf(FS); path = path.substring(0, index); String osName = System.getProperty("os.name").toLowerCase(); if (osName.startsWith("windows")) { return getDiskForWindowsInfo(path); } else if (osName.startsWith("linux")) { return getDiskForLinuxInfo(path); } else { return -1; } } public final String getMacAddress() { String os = System.getProperty("os.name"); try { if(os.startsWith("Windows")) { return windowsParseMacAddress(windowsRunIpConfigCommand()); } else if(os.startsWith("Linux")) { return linuxParseMacAddress(linuxRunIfConfigCommand()); } else { throw new java.io.IOException("unknown operating system: " + os); } } catch(Exception ex) { return "Nothing"; } } private final String linuxParseMacAddress(String ipConfigResponse) throws java.text.ParseException { String localHost = null; try { localHost = java.net.InetAddress.getLocalHost().getHostAddress(); } catch(java.net.UnknownHostException ex) { ex.printStackTrace(); throw new java.text.ParseException(ex.getMessage(), 0); } java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(ipConfigResponse, "\n"); String lastMacAddress = null; while(tokenizer.hasMoreTokens()) { String line = tokenizer.nextToken().trim(); boolean containsLocalHost = line.indexOf(localHost) >= 0; if(containsLocalHost && lastMacAddress != null) { return lastMacAddress; } int macAddressPosition = line.indexOf("HWaddr"); if(macAddressPosition <= 0) continue; String macAddressCandidate = line.substring(macAddressPosition + 6).trim(); if(linuxIsMacAddress(macAddressCandidate)) { lastMacAddress = macAddressCandidate; continue; } } java.text.ParseException ex = new java.text.ParseException ("cannot read MAC address for " + localHost + " from [" + ipConfigResponse + "]", 0); ex.printStackTrace(); throw ex; } private final boolean linuxIsMacAddress(String macAddressCandidate) { if(macAddressCandidate.length() != 17) return false; return true; } private final String linuxRunIfConfigCommand() throws java.io.IOException { Process p = Runtime.getRuntime().exec("ifconfig"); java.io.InputStream stdoutStream = new java.io.BufferedInputStream(p.getInputStream()); StringBuffer buffer= new StringBuffer(); for (;;) { int c = stdoutStream.read(); if (c == -1) break; buffer.append((char)c); } String outputText = buffer.toString(); stdoutStream.close(); return outputText; } private final String windowsParseMacAddress(String ipConfigResponse) throws java.text.ParseException { String localHost = null; try { localHost = java.net.InetAddress.getLocalHost().getHostAddress(); } catch(java.net.UnknownHostException ex) { ex.printStackTrace(); throw new java.text.ParseException(ex.getMessage(), 0); } java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(ipConfigResponse, "\n"); String lastMacAddress = null; while(tokenizer.hasMoreTokens()) { String line = tokenizer.nextToken().trim(); if(line.endsWith(localHost) && lastMacAddress != null) { return lastMacAddress; } int macAddressPosition = line.indexOf(":"); if(macAddressPosition <= 0) continue; String macAddressCandidate = line.substring(macAddressPosition + 1).trim(); if(windowsIsMacAddress(macAddressCandidate)) { lastMacAddress = macAddressCandidate; continue; } } java.text.ParseException ex = new java.text.ParseException("cannot read MAC address from [" + ipConfigResponse + "]", 0); ex.printStackTrace(); throw ex; } private final boolean windowsIsMacAddress(String macAddressCandidate) { if(macAddressCandidate.length() != 17) return false; return true; } private final String windowsRunIpConfigCommand() throws java.io.IOException { Process p = Runtime.getRuntime().exec("ipconfig /all"); java.io.InputStream in = new java.io.BufferedInputStream(p.getInputStream()); StringBuffer buffer= new StringBuffer(); for (;;) { int c = in.read(); if (c == -1) break; buffer.append((char)c); } String outputText = buffer.toString(); in.close(); return outputText; } public double getCpuRatio(){ double cpuRatio = 0; if (getOSName().toLowerCase().startsWith("windows")) { cpuRatio = getCpuRatioForWindows(); } else if (getOSName().toLowerCase().startsWith("linux")) { cpuRatio = getCpuRatioForLinux(); } return cpuRatio; } private double getCpuRatioForWindows() { try { String procCmd = System.getenv("windir") + "\\system32\\wbem\\wmic.exe process get Caption,CommandLine," + "KernelModeTime,ReadOperationCount,ThreadCount,UserModeTime,WriteOperationCount"; long[] c0 = readCpu(Runtime.getRuntime().exec(procCmd)); Thread.sleep(CPUTIME); long[] c1 = readCpu(Runtime.getRuntime().exec(procCmd)); if (c0 != null && c1 != null) { long idletime = c1[0] - c0[0]; long busytime = c1[1] - c0[1]; return Double.valueOf( PERCENT * (busytime) / (busytime + idletime)) .doubleValue(); } else { return 0.0; } } catch (Exception ex) { ex.printStackTrace(); return 0.0; } } final private double getCpuRatioForLinux() { try { java.io.File file = new java.io.File("/proc/stat"); java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader( new java.io.FileInputStream(file))); java.util.StringTokenizer token = new java.util.StringTokenizer(br.readLine()); token.nextToken(); int user = Integer.parseInt(token.nextToken()); int nice = Integer.parseInt(token.nextToken()); int system = Integer.parseInt(token.nextToken()); int idle = Integer.parseInt(token.nextToken()); Thread.sleep(1000); br = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream( file))); token = new java.util.StringTokenizer(br.readLine()); token.nextToken(); int user2 = Integer.parseInt(token.nextToken()); int nice2 = Integer.parseInt(token.nextToken()); int sys2 = Integer.parseInt(token.nextToken()); int idle2 = Integer.parseInt(token.nextToken()); return (double) ((user2 + sys2 + nice2) - (user + system + nice)) / (float) ((user2 + nice2 + sys2 + idle2) - (user + nice + system + idle)); } catch (Exception ex) { return (double) 0.0; } } final String substring(String src, int startidx, int endidx) { byte[] b = src.getBytes(); StringBuffer sbr = new StringBuffer(); for (int i = startidx; i <= endidx; i++) { sbr.append((char) b[i]); } return sbr.toString(); } final long[] readCpu(final Process proc) { long[] retn = new long[2]; try { proc.getOutputStream().close(); java.io.InputStreamReader ir = new java.io.InputStreamReader(proc.getInputStream()); java.io.LineNumberReader input = new java.io.LineNumberReader(ir); String line = input.readLine(); if (line == null || line.length() < 10) { return null; } int capidx = line.indexOf("Caption"); int cmdidx = line.indexOf("CommandLine"); int rocidx = line.indexOf("ReadOperationCount"); int umtidx = line.indexOf("UserModeTime"); int kmtidx = line.indexOf("KernelModeTime"); int wocidx = line.indexOf("WriteOperationCount"); long idletime = 0; long kneltime = 0; long usertime = 0; while ((line = input.readLine()) != null) { if (line.length() < wocidx) { continue; } String caption = substring(line, capidx, cmdidx - 1).trim(); String cmd = substring(line, cmdidx, kmtidx - 1).trim(); if (cmd.indexOf("wmic.exe") >= 0) { continue; } if (caption.equals("System Idle Process") || caption.equals("System")) { idletime += Long.valueOf( substring(line, kmtidx, rocidx - 1).trim()) .longValue(); idletime += Long.valueOf( substring(line, umtidx, wocidx - 1).trim()) .longValue(); continue; } kneltime += Long.valueOf( substring(line, kmtidx, rocidx - 1).trim()).longValue(); usertime += Long.valueOf( substring(line, umtidx, wocidx - 1).trim()).longValue(); } retn[0] = idletime; retn[1] = kneltime + usertime; return retn; } catch (Exception ex) { ex.printStackTrace(); } finally { try { proc.getInputStream().close(); } catch (Exception e) { e.printStackTrace(); } } return null; } public long getStartTime(){ return startTime; } public long getStartMemory(){ return startMemory; } public boolean isSun() { return System.getProperty("java.vm.vendor").indexOf("Sun") != -1; } public String getJavaVersion() { return javaVersion; } public void loadAddress() { try { java.net.InetAddress address = java.net.InetAddress .getLocalHost(); java.net.InetAddress[] all = java.net.InetAddress.getAllByName(address.getHostName()); for (int i = 0; i < all.length; i++) { String temp = null; temp = all[i].getHostAddress().toString(); if (!temp.startsWith("127.0") && !temp.startsWith("169.254")) { serverIP=temp; } } serverName = address.getHostName(); } catch (java.net.UnknownHostException e) { } } /** * 获得所在服务器名称 */ public String getServerName() { return serverName; } public String getServerIP() { return serverIP; } public boolean isSupportSpring(){ return supportSpring; } public boolean isSupportLoonframework(){ return supportLoonframework; } public boolean isSupportStruts() { return supportStruts; } public boolean isSupportJAF() { return supportJAF; } public boolean isSupportJavaxSql() { return supportJavaxSql; } public boolean isSupportHibernate(){ return supportHibernate; } public boolean isSupportJNDI() { return supportJNDI; } public boolean isSupportMail() { return supportMail; } public boolean isSupportBeanUtils() { return supportBeanUtils; } public boolean isSupportCommonLogging() { return supportCommonLogging; } public boolean isSupportCommonCodec() { return supportCommonCodec; } public boolean isSupportCommonCollection() { return supportCommonCollection; } public boolean isSupportCommonDigester() { return supportCommonDigester; } public boolean isSupportCommonLang() { return supportCommonLang; } public boolean isSupportJakartaRegExp() { return supportJakartaRegExp; } public boolean isSupportLucene() { return supportLucene; } public boolean isSupportDom4j() { return supportDom4j; } public boolean isSupportMmMysqlDriver() { return supportMmMysqlDriver; } public boolean isSupportComMysqlDriver() { return supportComMysqlDriver; } public boolean isSupportImageProcessing() { return supportImageProcessing; } public String getDoubleOperation(){ long begin = System.currentTimeMillis(); int flag = 0; double random = (double)new java.util.Random().nextInt( 1000 ); while( flag < 100000 ){ random = Math.sqrt( random ); flag++; } long end = System.currentTimeMillis(); long result = end - begin; return String.valueOf(result); } public String getNumberOperation() { long begin = startTime; int flag = 0; while (flag < 1000000) { flag++; } long end = System.currentTimeMillis(); long result = end - begin; return String.valueOf(result); } } LfSpy spyLib = new LfSpy(); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>lf-jsp探针 Ver 0.1.0</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <style type="text/css"> <!-- .stylebase {color:red; font-size:14px; font-weight:bold;} .table-header-text { color: #FFFFFF; font-weight: normal; margin: 3px 5px 1px 15px; font-family: Arial, Verdana,Helvetica, Sans-Serif; } td{white-space:normal; word-break:break-all;} A{ COLOR: #000000; TEXT-DECORATION: none} A:hover { COLOR: #f58200} body,td,span { font-size: 9pt} .input { BACKGROUND-COLOR: #E3F1D1;BORDER:#A9D46D 1px solid;FONT-SIZE: 9pt} .tableBorder {BORDER-RIGHT: #84BE3C 1px solid; BORDER-TOP: #84BE3C 1px solid; BORDER-LEFT: #84BE3C 1px solid; BORDER-BOTTOM: #84BE3C 1px solid; BACKGROUND-COLOR: #ffffff; WIDTH: 760;} .backc { BACKGROUND-COLOR: #E3F1D1;BORDER:#A9D46D 1px solid;FONT-SIZE: 9pt;color:#000000;} .PicBar { background-color: #A9D46D; border: 1px solid #ffffff; height: 12px;} .InnerHead { background-color: #E3F1D1; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #FFFFFF; border-right-color: #FFFFFF; border-bottom-color: #FFFFFF; border-left-color: #FFFFFF; text-align: left; padding-left: 10px; padding-top: 3px; } .InnerTable { background-color: #999999; } .InnerMain { background-color: #FFFFFF; padding-left: 10px; padding-top: 3px; } --> </style> </head> <body> <table width="100%" height="45" border="0" cellpadding="0" class="InnerHead"> <tr> <td><div align="center"><span class="stylebase"><a href="http://looframework.sourceforge.net/">LF-Spy Java服务器探针 Ver 0.1.0</a></span></div></td> </tr> </table> <h3>服务器连接速度:</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="29%" height="22" class="InnerHead"><span class="table-header-text">接入设备 </span></td> <td width="45%" height="22" class="InnerHead"><span class="table-header-text">连接速度(理论值) </span></td> <td width="26%" class="InnerHead"><span class="table-header-text">下载速度(理论值) </span></td> </tr> <tr> <td height="20" class="InnerMain">56k Modem</td> <td class="InnerMain"><img align=absmiddle class=PicBar width='1%'> 56 Kbps</td> <td class="InnerMain">7.0 k/s</td> </tr> <tr> <td height="20" class="InnerMain">64k ISDN</td> <td class="InnerMain"><img align=absmiddle class=PicBar width='1%'> 64 Kbps</td> <td class="InnerMain">8.0 k/s</td> </tr> <tr> <td height="20" class="InnerMain">512k ADSL</td> <td class="InnerMain"><img align=absmiddle class=PicBar width='5%'> 512 Kbps</td> <td class="InnerMain">64.0 k/s</td> </tr> <tr> <td height="20" class="InnerMain">1.5M Cable</td> <td class="InnerMain"><img align=absmiddle class=PicBar width='15%'> 1500 Kbps</td> <td class="InnerMain">187.5 k/s</td> </tr> <tr> <td height="20" class="InnerMain">5M FTTP</td> <td class="InnerMain"><img align=absmiddle class=PicBar width='50%'> 5000 Kbps</td> <td class="InnerMain">625.0 k/s</td> </tr> <tr> <td height="20" class="InnerMain">当前连接速度</td> <% if(request.getParameter("action") != null && "speedTest".equals(request.getParameter("action"))){ StringBuffer sbuffer=new StringBuffer(99); sbuffer.append("<script language='JavaScript'>var tSpeedStart=new Date();</script>" ); sbuffer.append("<script language='JavaScript'>var tSpeedEnd=new Date();</script>\n" ); sbuffer.append("<script language='JavaScript'>" ); sbuffer.append("var iSpeedTime = 0; iSpeedTime = ( tSpeedEnd - tSpeedStart ) / 1000;" ); sbuffer.append("if( iSpeedTime > 0 ) iKbps = Math.round( Math.round( 100 * 8 / iSpeedTime * 10.5 ) / 10 ); else iKbps = 10000 ;" ); sbuffer.append("var iShowPer = Math.round( iKbps / 100 );" ); sbuffer.append("if( iShowPer < 1 ) iShowPer = 1; else if( iShowPer > 82 ) iShowPer = 82;" ); sbuffer.append("</script>\n" ); sbuffer.append("<script language='JavaScript'>" ); sbuffer.append("document.write('<td class=InnerMain><img align=absmiddle class=PicBar width=\"' + iShowPer + '%\">' + iKbps + ' Kbps');" ); sbuffer.append("</script>\n" ); sbuffer.append("</td><td class=InnerMain> <a href='?action=speedTest' title=连接速度测试><u>" ); sbuffer.append("<script language='JavaScript'>" ); sbuffer.append("document.write(Math.round(iKbps/8*10)/10+'k/s');"); sbuffer.append("</script>\n") ; sbuffer.append("</u></a></td>"); out.println(sbuffer.toString()); }else{ %> <td class="InnerMain"> </td> <td class="InnerMain"><a href='?action=speedTest' title=测试连接速度><u>开始测试</u></a></td> <%}%> </tr> </table> <h3>服务器相关数据:</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="29%" height="22" class="InnerHead"><span class="table-header-text">服务器相关</span></td> <td width="71%" height="22" class="InnerHead"><span class="table-header-text">数值信息</span></td> </tr> <tr> <td width="29%" class="InnerMain">服务器名</td> <td class="InnerMain"> <%=spyLib.getServerName()%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器软件名</td> <td class="InnerMain"> <%=getServletContext().getServerInfo()%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器IP</td> <td class="InnerMain"> <%=spyLib.getServerIP()%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器操作系统</td> <td class="InnerMain"> <%=spyLib.getOSName()%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器系统模式</td> <td class="InnerMain"> <%=spyLib.getSystemModel()%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器MAC地址</td> <td class="InnerMain"> <%=spyLib.getMacAddress()%> </td> </tr> <tr> <td width="29%" class="InnerMain">操作系统类型</td> <td class="InnerMain"> <%=spyLib.getOSarch()%> </td> </tr> <tr> <td width="29%" class="InnerMain">操作系统CPU占用率</td> <td class="InnerMain"> <%=spyLib.getCpuRatio()+"%"%> </td> </tr> <tr> <td width="29%" class="InnerMain">JRE版本</td> <td class="InnerMain"> <%=spyLib.getJavaVersion()%> </td> </tr> <tr> <td width="29%" class="InnerMain">JVM是否为Sun提供</td> <td class="InnerMain"> <%=spyLib.isSun()%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器当前时间</td> <td class="InnerMain"> <%=new java.util.Date()%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器时区设置</td> <td class="InnerMain"> <%=spyLib.getTimeZone()%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器当前用户</td> <td class="InnerMain"> <%=spyLib.getNowUser()%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器当前用户所在硬盘剩余空间</td> <td class="InnerMain"> <%=spyLib.getObjectDisk()==-1?"未知":spyLib.getObjectDisk()/1024/1024+"MB"%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器当前用户目录</td> <td class="InnerMain"> <%=spyLib.getNowUserDir()%> </td> </tr> <tr> <td width="29%" class="InnerMain">服务器当前页面物理路径</td> <td class="InnerMain"> <%=config.getServletContext().getRealPath(request.getServletPath())%> </td> </tr> <tr> <td width="29%" class="InnerMain">当前服务端口</td> <td class="InnerMain"> <%=request.getServerPort()%> </td> </tr> </table> <h3>截获的浏览器参数一览:</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="29%" height="22" class="InnerHead"><span class="table-header-text">属性 </span></td> <td width="%71%" height="22" class="InnerHead"><span class="table-header-text">数值 </span></td> </tr> <tr> <td width="29%" class="InnerMain"> http-protocol</td> <td class="InnerMain"> <%=request.getProtocol()%> </td> </tr> <tr> <td width="29%" class="InnerMain"> http-method</td> <td class="InnerMain"> <%=request.getMethod()%> </td> </tr> <tr> <td width="29%" class="InnerMain"> remote-host</td> <td class="InnerMain"> <%=request.getRemoteHost()%> </td> </tr> <tr> <td width="29%" class="InnerMain"> remote-ip</td> <td class="InnerMain"> <%=request.getRemoteAddr()%> </td> </tr> <tr> <td width="29%" class="InnerMain"> remote-user</td> <td class="InnerMain"> <%=request.getRemoteUser()%> </td> </tr> <tr> <td width="29%" class="InnerMain"> remote-port</td> <td class="InnerMain"> <%=request.getRemotePort()%> </td> </tr> <tr> <td width="29%" class="InnerMain"> content-type</td> <td class="InnerMain"> <%=request.getContentType()%> </td> </tr> <% java.util.Enumeration enums=request.getHeaderNames(); StringBuffer headBuffer=new StringBuffer(); String name=""; Object value=""; while(enums.hasMoreElements()){ name=(String)enums.nextElement(); value=(String)request.getHeader(name); headBuffer.append("<tr>"); headBuffer.append("<td class=\"InnerMain\"> "+name+"</td>"); headBuffer.append("<td class=\"InnerMain\"> "+value+"</td>"); headBuffer.append("</tr>"); } out.println(headBuffer.toString()); %> </table> <h3>部分CGI(Common Gateway Interface)参数:</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="29%" height="22" class="InnerHead"><span class="table-header-text">属性 </span></td> <td width="%71%" height="22" class="InnerHead"><span class="table-header-text">数值 </span></td> </tr> <tr> <td class="InnerMain"> SERVER_NAME (服务名)</td> <td class="InnerMain"> <%=request.getServerName()%></td> </tr> <tr> <td class="InnerMain"> PATH_TRANSLATED (服务器实际路径信息)</td> <td class="InnerMain"> <%=request.getPathTranslated()%></td> </tr> <tr> <td class="InnerMain"> SERVER_SOFTWARE (服务器软件名)</td> <td class="InnerMain"> <%=getServletContext().getServerInfo()%></td> </tr> <tr> <td class="InnerMain"> PATH_INFO (附加路径信息)</td> <td class="InnerMain"> <%=request.getPathInfo()%></td> </tr> <tr> <td class="InnerMain"> DOCUMENT_ROOT (站点的物理路径)</td> <td class="InnerMain"> <%=getServletContext().getRealPath("/")%></td> </tr> <tr> <td class="InnerMain"> CONTEXT_PATH (站点的根路径)</td> <td class="InnerMain"> <%=request.getContextPath()%></td> </tr> </table> <h3>通过请求(Request)获得的参数:</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="29%" height="22" class="InnerHead"><span class="table-header-text">属性 </span></td> <td width="%71%" height="22" class="InnerHead"><span class="table-header-text">数值 </span></td> </tr> <tr> <td class="InnerMain"> getAuthType</td> <td class="InnerMain"> <%=request.getAuthType()%></td> </tr> <tr> <td class="InnerMain"> getCharacterEncoding</td> <td class="InnerMain"> <%=request.getCharacterEncoding()%></td> </tr> <tr> <td class="InnerMain"> getContentLength</td> <td class="InnerMain"> <%=request.getContentLength()%></td> </tr> <tr> <td class="InnerMain"> getContentType</td> <td class="InnerMain"> <%=request.getContentType()%></td> </tr> <tr> <td class="InnerMain"> getContextPath</td> <td class="InnerMain"> <%=request.getContextPath()%></td> </tr> <tr> <td class="InnerMain"> getLocale</td> <td class="InnerMain"> <%=request.getLocale()%></td> </tr> <tr> <td class="InnerMain"> getLocales</td> <td class="InnerMain"> <%=request.getLocales()%></td> </tr> <tr> <td class="InnerMain"> getMethod</td> <td class="InnerMain"> <%=request.getMethod()%></td> </tr> <tr> <td class="InnerMain"> getPathInfo</td> <td class="InnerMain"> <%=request.getPathInfo()%></td> </tr> <tr> <td class="InnerMain"> getPathTranslated</td> <td class="InnerMain"> <%=request.getPathTranslated()%></td> </tr> <tr> <td class="InnerMain"> getProtocol</td> <td class="InnerMain"> <%=request.getProtocol()%></td> </tr> <tr> <td class="InnerMain"> getReader</td> <td class="InnerMain"> <%=request.getReader()%></td> </tr> <tr> <td class="InnerMain"> getRealPath</td> <td class="InnerMain"> <%=config.getServletContext().getRealPath(".")%></td> </tr> <tr> <td class="InnerMain"> getRemoteAddr</td> <td class="InnerMain"> <%=request.getRemoteAddr()%></td> </tr> <tr> <td class="InnerMain"> getRemoteHost</td> <td class="InnerMain"> <%=request.getRemoteHost()%></td> </tr> <tr> <td class="InnerMain"> getRemoteUser</td> <td class="InnerMain"> <%=request.getRemoteUser()%></td> </tr> <tr> <td class="InnerMain"> getRequestDispatcher</td> <td class="InnerMain"> <%=request.getRequestDispatcher("/")%></td> </tr> <tr> <td class="InnerMain"> getRequestURI</td> <td class="InnerMain"> <%=request.getRequestURI()%></td> </tr> <tr> <td class="InnerMain"> getRequestURL</td> <td class="InnerMain"> <%=request.getRequestURL()%></td> </tr> <tr> <td class="InnerMain"> getServerName</td> <td class="InnerMain"> <%=request.getServerName()%></td> </tr> <tr> <td class="InnerMain"> getServerPort</td> <td class="InnerMain"> <%=request.getServerPort()%></td> </tr> <tr> <td class="InnerMain"> getServletPath</td> <td class="InnerMain"> <%=request.getServletPath()%></td> </tr> <tr> <td class="InnerMain"> getUserPrincipal</td> <td class="InnerMain"> <%=request.getUserPrincipal()%></td> </tr> </table> <h3>通过应答(Response)返回的参数:</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="50%" height="22" class="InnerHead"><span class="table-header-text">属性 </span></td> <td width="50%" height="22" class="InnerHead"><span class="table-header-text">数值 </span></td> </tr> <tr> <td class="InnerMain"> getBufferSize</td> <td class="InnerMain"> <%=response.getBufferSize()%></td> </tr> <tr> <td class="InnerMain"> getCharacterEncoding</td> <td class="InnerMain"> <%=response.getCharacterEncoding()%></td> </tr> <tr> <td class="InnerMain"> getContentType</td> <td class="InnerMain"> <%=response.getContentType()%></td> </tr> <tr> <td class="InnerMain"> getLocale</td> <td class="InnerMain"> <%=response.getLocale()%></td> </tr> </table> <h3>通过会话(Session)获得的参数:</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="50%" height="22" class="InnerHead"><span class="table-header-text">属性 </span></td> <td width="50%" height="22" class="InnerHead"><span class="table-header-text">数值</span></td> </tr> <% enums=session.getAttributeNames(); headBuffer=new StringBuffer(); while(enums.hasMoreElements()){ name=(String)enums.nextElement(); value=session.getAttribute(name); headBuffer.append("<tr>"); headBuffer.append("<td class=\"InnerMain\"> "+name+"</td>"); headBuffer.append("<td class=\"InnerMain\"> "+session.getAttribute(name)+"</td>"); headBuffer.append("</tr>"); } out.println(headBuffer.toString()); %> </table> <h3>通过服务器应用(Application)获得的参数:</h3> <table border=0 width="100%" cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="29%" class="InnerHead"><span class="table-header-text">属性</span></td> <td width="71%" class="InnerHead"><span class="table-header-text">数值</span></td> </tr> <% enums=application.getAttributeNames(); headBuffer=new StringBuffer(); while(enums.hasMoreElements()){ name=(String)enums.nextElement(); value=application.getAttribute(name); if(value instanceof String){ String temp=(String)value; if(temp.indexOf(";")!=-1){ java.util.StringTokenizer token=new java.util.StringTokenizer(temp,";"); StringBuffer buffer=new StringBuffer(token.countTokens()); while(token.hasMoreElements()){ buffer.append(token.nextElement()); buffer.append(";\n<br>"); } value=buffer.toString(); } } headBuffer.append("<tr>"); headBuffer.append("<td class=\"InnerMain\"> "+name+" </td>"); headBuffer.append("<td class=\"InnerMain\"> "+value+" </td>"); headBuffer.append("</tr>"); } out.println(headBuffer.toString()); %> </table> <h3>通过小甜饼(Cookies)获得的参数:</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="50%" height="22" class="InnerHead"><span class="table-header-text">属性 </span></td> <td width="50%" height="22" class="InnerHead"><span class="table-header-text">数值</span></td> </tr> <% Cookie[] cos=request.getCookies(); if(cos!=null){ for(int i=0;i<cos.length;i++) { %> <tr> <td class="InnerMain"> <%=cos[i].getName()%></td> <td class="InnerMain"> <%=cos[i].getValue()%></td> </tr> <% } } %> </table> <h3>服务器效率测试:</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="54%" height="22" class="InnerHead"><span class="table-header-text">让服务器执行100万次整数运算和10万次开方,记录所用的时间。</span></td> <td width="21%" height="22" class="InnerHead"><span class="table-header-text">整数运算</span></td> <td width="25%" height="22" class="InnerHead"><span class="table-header-text">浮点运算</span></td> </tr> <tr> <td class="InnerMain" height="40"> <input name="button" type="button" class=backc onclick="javascript:location.reload()" value="测试当前服务器"/></td> <td class="InnerMain"> <%=spyLib.getNumberOperation()+"(毫秒)"%></td> <td class="InnerMain"> <%=spyLib.getDoubleOperation()+"(毫秒)"%></td> </tr> </table> <h3>服务器所有可用参数一览:</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="29%" height="22" class="InnerHead"><span class="table-header-text">服务器相关 </span></td> <td width="%71%" height="22" class="InnerHead"><span class="table-header-text">数值信息 </span></td> </tr> <% java.util.Properties props=System.getProperties(); java.util.Iterator iter=props.keySet().iterator(); while(iter.hasNext()) { name=(String)iter.next(); value=props.get(name); if(value instanceof String){ String temp=(String)value; boolean isA=temp.indexOf(";")!=-1; boolean isB=temp.indexOf(",")!=-1; if(isA||isB){ java.util.StringTokenizer token=new java.util.StringTokenizer(temp.replace(" ",""),isA?";":","); StringBuffer buffer=new StringBuffer(token.countTokens()); while(token.hasMoreElements()){ buffer.append(" "+token.nextElement()); buffer.append(isA?";"+"\n<br>":","+"\n<br>"); } value=buffer.toString(); } }else{ value=" "+value; } headBuffer.append("<tr>"); headBuffer.append("<td class=\"InnerMain\">"+name+" </td>"); headBuffer.append("<td class=\"InnerMain\">"+value+" </td>"); headBuffer.append("</tr>"); } out.println(headBuffer.toString()); %> </table> <h3>针对部分类库的服务器加载验证</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="50%" height="22" class="InnerHead"><span class="table-header-text">属性 </span></td> <td width="50%" height="22" class="InnerHead"><span class="table-header-text">数值 </span></td> </tr> <tr> <td class="InnerMain"> 是否支持 JNDI</td> <td class="InnerMain"> <%=spyLib.isSupportJNDI()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 Loonframework</td> <td class="InnerMain"> <%=spyLib.isSupportLoonframework()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 JavaxSql</td> <td class="InnerMain"> <%=spyLib.isSupportJavaxSql()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 JAF</td> <td class="InnerMain"> <%=spyLib.isSupportJAF()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 Mail</td> <td class="InnerMain"> <%=spyLib.isSupportMail()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 BeanUtils</td> <td class="InnerMain"> <%=spyLib.isSupportBeanUtils()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 CommonLogging</td> <td class="InnerMain"> <%=spyLib.isSupportCommonLogging()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 CommonCodec</td> <td class="InnerMain"> <%=spyLib.isSupportCommonCodec()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 CommonCollection</td> <td class="InnerMain"> <%=spyLib.isSupportCommonCollection()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 CommonDigester</td> <td class="InnerMain"> <%=spyLib.isSupportCommonDigester()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 CommonLang</td> <td class="InnerMain"> <%=spyLib.isSupportCommonLang()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 JakartaRegExp</td> <td class="InnerMain"> <%=spyLib.isSupportJakartaRegExp()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 Struts</td> <td class="InnerMain"> <%=spyLib.isSupportStruts()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 Lucene</td> <td class="InnerMain"> <%=spyLib.isSupportLucene()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 Dom4j</td> <td class="InnerMain"> <%=spyLib.isSupportDom4j()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 MysqlDriver(Mm)</td> <td class="InnerMain"> <%=spyLib.isSupportMmMysqlDriver()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 MysqlDriver(Com)</td> <td class="InnerMain"> <%=spyLib.isSupportComMysqlDriver()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 ImageProcessing</td> <td class="InnerMain"> <%=spyLib.isSupportImageProcessing()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 Hibernate</td> <td class="InnerMain"> <%=spyLib.isSupportHibernate()%></td> </tr> <tr> <td class="InnerMain"> 是否支持 Spring</td> <td class="InnerMain"> <%=spyLib.isSupportSpring()%></td> </tr> </table> <p> <h3>资源消费一览</h3> <table border=0 width=100% cellspacing=1 cellpadding=0 class="InnerTable"> <tr> <td width="50%" height="22" class="InnerHead"><span class="table-header-text">属性 </span></td> <td width="50%" height="22" class="InnerHead"><span class="table-header-text">数值 </span></td> </tr> <% long endMem = Runtime.getRuntime().freeMemory(); long total= Runtime.getRuntime().maxMemory(); long endTime = System.currentTimeMillis(); java.util.Date date = new java.util.Date(spyLib.getStartTime()); java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String starttime = df.format(date); date = new java.util.Date(endTime); df = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String endtime = df.format(date); %> <tr> <td class="InnerMain"> 最大内存容量</td> <td class="InnerMain"> <%=(total/1024/1024+"MB")%></td> </tr> <tr> <td class="InnerMain"> 应用结束时剩余自由内存</td> <td class="InnerMain"> <%=(endMem/1024/1024+"MB")%></td> </tr> <tr> <td class="InnerMain"> 应用结束时减少自由内存</td> <td class="InnerMain"> <%=((spyLib.getStartMemory() - endMem)/1024/1024+"MB")%></td> </tr> <tr> <td class="InnerMain"> 应用开始时间</td> <td class="InnerMain"> <%=starttime%></td> </tr> <tr> <td class="InnerMain"> 应用结束时间</td> <td class="InnerMain"> <%=endtime%></td> </tr> <tr> <td class="InnerMain"> 应用耗时(毫秒)</td> <td class="InnerMain"> <%=(endTime-spyLib.getStartTime())%></td> </tr> </table> <p><br> </p> <center> <sup>©</sup> </center><br> </body> </html>
政府科技管理者在推进科技成果转化时,如何确保技术成果的精准匹配与高效流通?.docx
政府科技管理者在推进科技成果转化时,如何确保技术成果的精准匹配与高效流通?
TCR型SVC静止无功补偿器仿真模型(Simulink仿真实现)
内容概要:本文详细介绍了一种基于Simulink的TCR型SVC(晶闸管控制电抗器型静止无功补偿器)仿真模型,旨在实现对电力系统中无功功率的动态补偿,从而提升电网稳定性与电能质量。文档系统阐述了该模型的设计原理、体系结构及核心控制策略,重点展示了如何通过调节TCR的触发角实现对感性无功功率的连续、精确调控,并结合固定电容器(FC)构成完整的TCR+FC型SVC系统。文中还拓展介绍了在不平衡电网条件下静止无功发生器(SVG)的补偿应用,以及采用三层控制策略的级联H桥STATCOM的仿真设计方法。文章强调,科研工作不仅需要扎实的理论基础,更需注重理论与工程实践的紧密结合,建议使用者深入研读配套的说明报告和参考文献,以透彻理解模型背后的物理机制、数学建模方法与控制逻辑。; 适合人群:电力系统、电气工程及其自动化等相关专业的高校师生、从事电力系统分析与设计的科研人员,以及专注于无功补偿、电能质量治理和柔性交流输电系统(FACTS)设备研发的工程技术人员。; 使用场景及目标:①深入学习和掌握TCR型SVC的工作原理、系统架构及其在Simulink环境中的精细化建模与仿真方法;②研究在各种复杂工况(如电网电压不平衡、负载突变)下,无功补偿装置的动态响应特性、稳定性能及先进控制策略的有效性;③为本科毕业设计、研究生课题研究或实际工程项目提供一个可靠的仿真验证平台和技术支持;④以此为基础,进一步拓展至更为先进的柔性交流输电系统(FACTS)及其他大功率电力电子装置的研究与开发。; 阅读建议:建议读者严格按照资源目录的顺序系统性地学习,充分利用所提供的Simulink模型文件、MATLAB代码及相关技术文档,亲自动手搭建、调试和优化仿真参数。通过反复的实践操作,深化对无功补偿基本原理、非线性元件(晶闸管)控制、闭环反馈系统设计及现代控制算法的理解。同时,鼓励在现有模型的基础上进行二次开发与创新,探索适用于新能源大规模接入等新型电力系统的先进控制策略。
轻量网络对决脊柱 MRI 分割:MobileUnet 与 EfficientUnet 多类别分割实现
## 轻量网络对决脊柱 MRI 分割:MobileUnet 与 EfficientUnet 多类别分割实现 脊柱 MRI 影像分割是骨科临床辅助诊断的关键环节,椎体、椎间盘等结构的精准分割能够为椎间盘突出、脊柱退变等疾病提供量化参考。传统人工标注不仅耗时耗力,还存在不同医师主观判读带来的差异,基于深度学习的自动分割方案可以有效缓解这一痛点。本项目基于 1000 余张脊柱 MRI 二维切片数据集,对比 MobileUnet、EfficientUnet‑B0 两种轻量 U 型分割网络,完成脊柱多类别语义分割任务。 项目采用自定义 PyTorch 数据集 MyDataset 完成数据流水线构建,标签灰度映射信息独立存储在 grayList.txt 文本文件中,自动读取 mask 中存在的灰度类别,将原始 mask 灰度值映射为连续 0‑N‑1 训练标签,推理阶段再还原回原始灰度标签,适配多类别分割场景。数据集训练、验证集按照 images/masks 文件夹成对组织,支持水平、垂直翻转的数据增强,同时预留 CT 窗宽窗位对比度增强接口,图像统一缩放至 224×224,归一化至 0‑1 区间。 训练流程使用 AdamW 优化器、余弦退火学习率衰减,损失函数选用交叉熵损失,通过混淆矩阵自动计算像素精度、Precision、Recall、F1‑Score、Dice、mIoU 多项医学分割常用指标,完整记录每轮 epoch 日志并绘制 Loss、mIoU、Dice、Precision、Recall 变化曲线,保存最优权重 best.pth 与最后一轮权重 last.pth。预测脚本 predict.py 实现批量推理,对预测 mask 做轮廓绘制、叠加原图可视化,输出预测掩码与混合效果图。
高校技术转移办公室人员在组织成果转化过程中,如何提升科技成果推介效率.docx
高校技术转移办公室人员在组织成果转化过程中,如何提升科技成果推介效率
高校技术转移办公室如何实现技术成果的快速精准匹配?.docx
科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。
【计算机体系结构】基于处理器集成验证与性能优化
内容概要:本文介绍了基于的交互机制,以深入理解高层次建模的精髓。
PCIe Protocol Updates - Part I.pdf
PCIe Protocol Updates - Part I.pdf
国央企创新负责人如何推动内部创新成果与外部市场需求的高效对接?.docx
国央企创新负责人如何推动内部创新成果与外部市场需求的高效对接?
PCS双向储能变流器Buck-Boost闭环控制仿真复现(Simulink仿真实现)
内容概要:本文基于Simulink平台,对PCS双向储能变流器的Buck-Boost闭环控制策略进行了详细的仿真复现研究,旨在深入剖析其在储能系统中的动态响应特性和控制性能。文中系统阐述了Buck-Boost控制模式的设计原理,详细展示了在Simulink环境中构建系统模型的全过程,并重点探讨了电压外环与电流内环双闭环控制器的关键参数整定方法。通过严谨的仿真验证,证实了所设计控制方案在实现稳定充放电、精确功率调节以及应对模式切换等方面的优异表现,展现了良好的鲁棒性与控制精度。该仿真模型为直流微电网、混合储能系统等应用中实现高效的双向功率流动提供了坚实的理论依据和技术支持。; 适合人群:具备电力电子技术、自动控制理论基础知识,从事新能源发电、储能系统集成、微电网运行控制等相关领域的科研人员及工程技术人员。; 使用场景及目标:①深入理解双向储能变流器在充放电转换过程中Buck(降压)与Boost(升压)两种工作模式的切换逻辑与控制机理;②熟练掌握基于Simulink的电力电子变换器闭环控制系统建模、仿真与分析方法;③为实际工程中储能变流器(PCS)的控制器设计、参数优化及功能验证提供可复现的仿真模型与理论指导。; 阅读建议:建议读者结合文中的控制框图与仿真模块截图,亲手搭建并调试模型,重点关注双闭环结构中PI控制器参数对系统稳定性与动态响应速度的影响。在仿真过程中,可通过设置负载突变、指令跳变等不同工况,深入探究系统的瞬态性能与鲁棒性,从而全面深化对储能变流器先进控制策略的理解与应用能力。
利用MATLAB、SimEvents和并行粒子群优化进行动态建筑疏散优化。.zip
1.版本:matlab2014a/2019b/2024b 2.附赠案例数据可直接运行。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
无刷直流电机BLDC双闭环调速系统Matlab仿真与建模
内容概要:本文围绕无刷直流电机(BLDC)的双闭环调速系统展开,详细介绍了基于Matlab/Simulink的系统建模与仿真方法。系统采用转速与电流双闭环控制策略,结合三相桥式全控电路拓扑结构,实现对电机转速的高精度动态调控。文中深入剖析了系统的工作原理、关键控制技术(如反电动势过零检测)、控制器设计过程,并重点对比了传统PID控制与模糊PID控制在系统性能上的差异。提供的完整Simulink仿真模型涵盖了从信号检测、逻辑换相到闭环控制的全过程,通过仿真结果验证了双闭环控制在提升系统动态响应速度、增强抗干扰能力及改善稳态精度方面的有效性。; 适合人群:具备电机控制、电力电子技术和自动控制理论基础的电气工程、自动化、机电一体化等专业的高年级本科生、研究生以及从事电机驱动系统研发的工程技术人员。; 使用场景及目标:① 深入学习无刷直流电机的基本运行原理、数学模型及其换相逻辑;② 掌握转速-电流双闭环控制系统的设计方法、参数整定技巧及工程实现要点;③ 在Matlab/Simulink平台上动手搭建和调试电机控制仿真系统,对比分析传统PID与先进模糊PID等不同控制算法的动态与静态性能;④ 为后续开展电机控制算法的创新研究或实际工程项目开发提供可靠的仿真验证平台和技术储备。; 阅读建议:读者应在充分理解文档中阐述的理论知识基础上,结合Matlab/Simulink软件进行实践操作,严格按照模型搭建步骤复现仿真环境。建议通过调整电机负载、设定不同的目标转速等工况,观察并记录系统的响应曲线,以此深入探究各控制参数对系统性能的影响,从而巩固和深化对现代电机控制理论的理解。
一门国产自研的、追求干净观感的、基于对象克隆、支持中文编程的编程语言:完全从底层开始编写,语言引擎、对象库等均未基于 / 采用任何已有语言进行改造、包装或扩展,保证了代码和权利的干净、清晰与自主可控
zlang是一门完全国产自研的、追求干净观感的、基于对象克隆、支持中文编程的编程语言: 完全从底层开始编写,语言引擎(词法 / 语法分析等)、对象库等均未基于 / 采用任何已有语言进行改造、包装或扩展,保证了代码和权利的干净、清晰与自主可控。定位:简洁、高效、易上手、全栈能力,兼顾开发效率与运行性能。设计理念:解决主流语言痛点(如 C 语言字符串处理繁琐、Java 冗余的 Getter/Setter),融合优势并加入创新设计。对标语言:Python。LOGO:中华狸花猫,象征独立、坚韧、不畏挑战。
无刷直流电机BLDC转速电流双闭环+无位置传感器控制仿真【仿真+详解说明报告+参考文献】
内容概要:本文围绕无刷直流电机(BLDC)的高性能控制策略展开,提供了基于Simulink的转速电流双闭环控制与无位置传感器控制的仿真模型及详细说明。核心内容涵盖转速与电流双闭环PI控制器设计、无位置传感器控制技术(如滑模观测器)、以及模糊PID与传统PID控制策略的对比分析。资源包包含多个完整仿真模型、详尽的技术报告和参考文献,系统阐述了BLDC电机在不同控制算法下的动态响应、鲁棒性及稳定性表现,旨在帮助用户深入理解现代电机控制的核心原理与工程实现方法。; 适合人群:具备电机控制、自动控制理论及Simulink仿真基础,从事电气工程、自动化、电力电子、新能源驱动系统等领域的科研人员、工程师及高校研究生。; 使用场景及目标:① 掌握BLDC电机转速电流双闭环控制系统的设计与建模仿真方法;② 深入研究滑模观测器等无位置传感器控制技术的实现机理与性能优势;③ 对比分析模糊PID与传统PID在抗干扰能力、动态响应速度和稳态精度等方面的差异;④ 为电机控制相关的科研项目、毕业设计、课程设计或工业应用提供可靠的仿真平台与理论支撑。; 阅读建议:建议结合所提供的仿真模型与说明文档,逐步搭建并调试控制系统,重点关注PI参数整定、滑模观测器设计及模糊规则库的构建,通过对比不同控制策略的仿真结果,深入理解其控制性能差异与适用场景。
高校技术转移办公室人员如何高效完成科技成果推介书的智能化生成?.docx
科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。
最新推荐





