一个 error C231: ‘_Seg_Disp‘: redefinition 的错误

void name()

{

……

}

写成了

unsigned name()

{

……

}

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Version 1.7 ----------- - ADD: Delphi/CBuilder 10.2 Tokyo now supported. - ADD: Delphi/CBuilder 10.1 Berlin now supported. - ADD: Delphi/CBuilder 10 Seattle now supported. - ADD: Delphi/CBuilder XE8 now supported. - ADD: Delphi/CBuilder XE7 now supported. - ADD: Delphi/CBuilder XE6 now supported. - ADD: Delphi/CBuilder XE5 now supported. - ADD: Delphi/CBuilder XE4 now supported. - ADD: Delphi/CBuilder XE3 now supported. - ADD: Delphi/CBuilder XE2 now supported. - ADD: Delphi/CBuilder XE now supported. - ADD: Delphi/CBuilder 2010 now supported. - ADD: Delphi/CBuilder 2009 now supported. - ADD: New demo project FlexCADImport. - FIX: The height of the TFlexRegularPolygon object incorrectly changes with its rotation. - FIX: Added division by zero protect in method TFlexControl.MovePathSegment. - FIX: The background beyond docuemnt wasn't filled when TFlexPanel.DocClipping=True. - FIX: In "Windows ClearType" font rendering mode (OS Windows mode) the "garbage" pixels can appear from the right and from the bottom sides of the painted rectangle of the TFlexText object. - FIX: The result rectangle incorrectly calculated in the TFlexText.GetRefreshRect method. - FIX: Added FPaintCache.rcPaint cleanup in the TFlexPanel.WMPaint method. Now it is possible to define is the drawing take place via WMPaint or via the PaintTo direct call (if rcPaint contain non-empty rectangle then WMPaint in progress). - FIX: The TFlexPanel.FPaintCache field moved in the protected class section. Added rcPaint field in FPaintCache that represents drawing rectangle. - ADD: In the text prcise mode (TFlexText.Precise=True) takes into account the rotation angle (TFlexText.Angle). - FIX: Removed FG_NEWTEXTROTATE directive (the TFlexText Precise mode should be used instead). - FIX: The TFlexRegularPolygon object clones incorrectly drawed in case when TFlexRegularPolygon have alternative brush (gradient, texture). - ADD: Add TFlexPanel.InvalidateControl virtual method which calls from TFle
EurekaLog 7.5 (18-August-2016) 1)..Important: Installation layout was changed. All packages now have version suffix (e.g. EurekaLogCore240.bpl). No files are copied to \bin folder of IDE. Run-time package (EurekaLogCore) is copied to Windows\System32 folder. Refer to help for more info. 2)....Added: RAD Studio 10.1 Berlin support 3)....Added: IDE F1 help integration (on CHM-based IDEs only, i.e. XE8+) 4)....Added "--el_injectjcl", "--el_createjcl", and "--el_createdbg" command-line options for ecc32/emake to inject JEDI/JCL debug info, create .jdbg file, and create .dbg file (Microsoft debug format). Later is supported when map2dbg.exe tool is placed in \Bin folder of EurekaLog installation (separate download is required) 5)....Added: Exception2HRESULT in EAppDLL to simplify developing DLLs with "DLL" profile 6)....Added: Use ShellExecute option for mailto send method 7)....Added: "Mandatory e-mail only when sending" option 8)....Added: Exception line highlighting in disassember view in EurekaLog exception dialog and Viewer 9)....Added: Detection/logging Delphi objects in disassembly view 10)..Added: Support for multi-monitor info 11)..Added: Support for detection of Windows 10 updates 12)..Added: OS edition detection 13)..Added: "User" and "Session" columns to processes list, processes list is also sorted by session first 14)..Added: Support for showing current user processes only 15)..Added: Expanding environment variables for "Support URL" 16)..Fixed: Range-check error on systems with MBCS ACP 17)..Fixed: 64-bit shared memory manager may not work 18)..Fixed: Possible "Unit XYZ was compiled with a different version of ABC" when using packages 19)..Fixed: FastMM shared MM compatibility 20)..Fixed: Minor bugs in stack tracing (which usually affected stacks for leaks) 21)..Fixed: Rare deadlocks in multi-threaded applications 22)..Fixed: Taking screenshot of minimized window 23)..Fixed: NT service may not log all exceptions 24)..Fixed: SSL port number for Bugzilla 25)..Fixed: Disabling "Activate Exception Filters" option was ignored 26)..Fixed: Missing FTP proxy settings 27)..Fixed: IntraWeb support is updated up to 14.0.64 28)..Fixed: Retrieving some process paths in processes list 29)..Fixed: CPU view rendering in EurekaLog exception dialog and Viewer 30)..Fixed: Some issues in naming threads 31)..Fixed: Removed exported helper _462EE689226340EAA982C5E8307B3F9E function (replaced with mapped file) 32)..Changed: Descriptions of EurekaLog project options now list corresponding property names of TEurekaModuleOptions class. 33)..Changed: Default template of HTML/web dialog now includes call stack by default 34)..Changed: EurekaLog 7 now can be installed over EurekaLog 6 automatically, with no additional actions/tools EurekaLog 7.4 (7.4.0.0), 26-January-2016 1)....Fixed: Performance issue in DLL exports debug information provider 2)....Fixed: Range-check error in Send dialog 3)....Fixed: Possible FPU control word unexpected change 4)....Fixed: JIRA sending to project with no version info 5)....Fixed: Viewer sorting affected by local region settings 6)....Fixed: Exception filters ignore settings for restart/terminate EurekaLog 7.3 Hotfix 2 (7.3.2.0), 20-October-2015 1)....Fixed: Added workaround for codegen bug in Delphi 7 (possibly - other), bug manifests itself as wrong date-time in reports or integer overflows 2)....Fixed: Some MAPI DLLs may not be loaded correctly 3)....Fixed: Handling SEC_I_INCOMPLETE_CREDENTIALS in SSPI code (added searching client certificate) 4)....Fixed: Range-check error when closing WinAPI dialog EurekaLog 7.3 Hotfix 1 (7.3.1.0), 2-October-2015 1)....Fixed: Long startup time on terminal services servers EurekaLog 7.3 (7.3.0.0), 24-September-2015 1)....Added: RAD Studio 10 Seattle support 2)....Added: Performance counters for run-time (internal logging with --el_debug) 3)....Fixed: spawned by ecc32/emake processes now start with the same priority 4)....Fixed: ThreadID = 0 in StandardEurekaNotify 5)....Fixed: Dialog auto-close timer may reset without user input 6)....Fixed: Possible hang when quickly loading/unloading EurekaLog-enabled DLL 7)....Fixed: Possible hang in COM DLLs 8)....Fixed: Removed some unnecessary file system access on startup 9)....Fixed: Possible wrong font size in EurekaLog tools 10)..Fixed: Ignore timeouts from Shell_NotifyIcon 11)..Fixed: Possible failure to handle/process stack overflow exceptions 12)..Changed: VCL/CLX/FMX now will assign Application.OnException handler when low-level hooks are disabled EurekaLog 7.2 Hotfix 6 (7.2.6.0), 14-July-2015 1)....Added: csoCaptureDelphiExceptions option 2)....Fixed: Handling of SECBUFFER_EXTRA in SSPI code 3)....Fixed: Several crashes in sending code for very old Delphi versions 4)....Fixed: Regression (from hotfix 5) crash in some IDEs EurekaLog 7.2 Hotfix 5 (7.2.5.0), 1-July-2015 1)....Added: HKCU\Software\EurekaLab\Viewer\4.0\UI\Statuses registry key to allow status customizations in Viewer 2)....Added: "Disable hang detection under debugger" option 3)....Fixed: Wrong button caption in standalone "Steps to reproduce" dialog 4)....Fixed: Wrong passing of Boolean parameters in JSON (affects JIRA) 5)....Fixed: Wrong sorting of BugID, Count and DateTime columns in Viewer 6)....Fixed: Empty "Count" field/column is now displayed as "1" in Viewer 7)....Fixed: Generic names with "," could not be decoded in Viewer 8)....Fixed: Updated Windows 10 detection for latest builds of Windows 10 9)....Fixed: Sleep and hybernation no longer trigger false-positive "application freeze" 10)..Fixed: Wrong function codes for hooking (affects ISAPI application type) 11)..Fixed: Wrong button caption in "Steps to Reproduce" dialog 12)..Fixed: Crash when taking snapshot of some proccesses by Threads Snapshot tool 13)..Fixed: Minor improvements in leak detection EurekaLog 7.2 Hotfix 4 (7.2.4.0), 10-June-2015 1)....Added "ECC32TradeSpeedForMemory" option - defaults to 0/False, could be changed to 1 via Custom/Manual tab. This option will switch from fast-methods to slower methods, but which take less memory. Use 0 (default) for small projects, use 1 for large projects (if ecc32 runs out of memory). 2)....Added: --el_DisableDebuggerPresent command-line option for compatibility with 3rd party debuggers (AQTime, etc.) 3)....Added: AQTime auto-detect 4)....Fixed: Performance optimizations 5)....Fixed: Windows 8+ App Menu shortcuts 6)....Fixed: Unmangling on x64 EurekaLog 7.2 Hotfix 3 (7.2.3.0), 20-May-2015 1)....Added: Support for token auth in Bugzilla (latest 4.x builds) 2)....Added: Support for API key auth in Bugzilla (5.x) 3)....Added: Support for /EL_DisableMemoryFilter command-line option 4)....Added: Asking e-mail when user switches to "details" from MS Classic without entering e-mail 5)....Fixed: Compatibility issues with older Bugzilla versions (3.x) 6)....Fixed: Passing settings between dialogs 7)....Fixed: "Ask for steps to reproduce" dialog is now DPI-aware 8)....Fixed: Silently ignore and fix invalid values in project options EurekaLog 7.2 Hotfix 2 (7.2.2.0), 30-April-2015 1)....Fixed: Confusing message in Manage tool when using with Trial/Pro 2)....Fixed: Range check error in processes information for x64 machines (affects startup of any EurekaLog-enabled module) 3)....Fixed: Auto-detect personality by project extension if --el_mode switch is missing 4)....Fixed: More details for diagnostic sending 5)....Fixed: Wrong settings for MAP files in C++ Builder 6)....Fixed: Wrong code page was used to decode ANSI bug reports 7)....Fixed: Attaching .PAS files instead of .OBJ in C++ Builder 2006+ Pro/Trial EurekaLog 7.2 Hotfix 1 (7.2.1.0), 3-April-2015 1)....Fixed: Wrong float-str convertion when ThousandSeparator is '.' EurekaLog 7.2 (7.2.0.0), 1-April-2015 1)....Important: TEurekaLogV7 component was renamed to TEurekaLogEvents. Please, update your projects by renaming or recreating the component 2)....Important: File layout was changed for BDS 2006+. Delphi and C++ Builder files are now located in StudioNum folders instead of old DelphiNum and CBuilderNum folders. Update your search paths if needed 3)....Added: Major improvements in DumpAllocationsToFile function (EMemLeaks unit) 4)....Added: MemLeaksSetParentBlock, MemLeaksOwn, EurekaTryGetMem functions (EMemLeaks unit) 5)....Added: Improvements for call stack of dynarrays/strings allocations (leaks) 6)....Added: "Elem size" when reporting leaks in dynarrays 7)....Added: Streaming unpacked debug info into temporal files instead of memory - this greatly reduces run-time application memory usage at cost of slightly slower exception processing. This also reduces memory footprint for ecc32/emake 8)....Added: Showing call stacks for 2 new types of fatal memory errors 9)....Added: EMemLeaks._ReserveOutOfMemory to control reserve size of out of memory errors (default is 50 Mb) 10)..Added: "MinLeaksLimitObjs" option (EMemLeaks unit) 11)..Added: Fatal memory problem now pauses all threads in application 12)..Added: Fatal memory problem now change thread name (to simplify debugging) 13)..Added: boPauseELThreads and boDoNotPauseELServiceThread options (currently not visible in UI) 14)..Added: Support for texts collections out of default path 15)..Added: Support for relative file paths to text collections and external settings 16)..Added: Support for environment variables in project option's paths 17)..Added: Support for relative file paths and environment variables for events and various module paths 18)..Added: Logging in Manage tool 19)..Added: Windows 10 version detection 20)..Added: Stack overflow tracing 21)..Added: Major improvements in removal of recursive areas from call stack 22)..Added: Statistics collection 23)..Added: Support for uploading multiple files in JIRA 24)..Added: EResLeaks improvements (new funcs: ResourceAdd, ResourceDelete, ResourceName; support for realloc-like functions) 25)..Fixed: Added workaround for bug in JIRA 5.x 26)..Fixed: Rare EurekaLog internal error 27)..Fixed: Ignored unhandled thread exceptions (when EurekaLog is disabled) now triggers default OS processing (WER) 28)..Fixed: Irnored exceptions (via per-exception/events) now bring up default RTL handler 29)..Fixed: Format error in Viewer 30)..Fixed: Leak of EurekaLog exception information object 31)..Fixed: Wrong chaining exceptions inside GetMem/FreeMem 32)..Fixed: Memory leak after low-level unhook of function 33)..Fixed: Re-parenting after ReallocMem 34)..Fixed: Editing SMTP server options 35)..Fixed: SMTP server not using real user e-mail in FROM field 36)..Fixed: Some multi-threading crashes 37)..Fixed: Fixed crashes in Manage tool 38)..Fixed: Range-check error in Viewer 39)..Fixed: EurekaLog error dialog appearing under other windows 40)..Fixed: AV when parsing TDS (emake/C++ Builder specific) 41)..Fixed: Unable to build call stacks for other threads due to insufficient rights 42)..Fixed: Version checks for BugZilla and JIRA 43)..Fixed: Not catching out-of-module AVs when "Capture exceptions only from current module" option is checked 44)..Fixed: Checking for remaining exceptions at shutdown (C++ Builder specific, AcquireExceptionObject returns wrong info) 45)..Fixed: "get call stack of ... threads" / "suspend ... threads" options (avoid rare multithreading race conditions) 46)..Fixed: Crash when naming thread without EurekaLog thread info 47)..Fixed: Detection of immediate caller for memory funcs 48)..Fixed: Non-working Assign for options 49)..Fixed: Handling of explicitly chained exceptions 50)..Fixed: Various exception/threading fixes for MS debug provider 51)..Fixed: Processing hardware unhandled exceptions (QC #55007) 52)..Fixed: Unchecking dialog options when export/import 53)..Fixed: BSTR leak 54)..Fixed: JIRA decimal separator bug 55)..Changed: Now unhandled exceptions will be handled by EurekaLog even if EurekaLog is disabled in the thread - only global EurekaLog-enabled status is respected 56)..Changed: Viewer version now matches version of EurekaLog 57)..Changed: DeleteServiceFilesOption now always False by default 58)..Changed: Speed improvements for known memory leaks (reserved leaks) 59)..Changed: Improved logging for sending 60)..Changed: Switching to detailed mode without entering (mandatory) e-mail: now EL will not block this 61)..Changed: .ToString for exception info now uses compact stack formatter 62)..Removed: Custom field editor (replaced it with link to "Custom" page) 63)..Removed: EurekaLog 7 no longer could be installed over EurekaLog 6. Manage tool from EurekaLog 7 will no longer work with EurekaLog 6. EurekaLog 7.1 update 1 (7.1.1.0), 19-October-2014 1)....Added: "Send in separated thread" option 2)....Added: Hang detection will now use Wait Chain Traversal (WCT) on Vista+ systems to detect deadlocks in any EurekaLog-enabled threads 3)....Added: OS install language and UI language fields in bug report 4)....Fixed: Viewer is not able to decrypt reports with generics 5)....Fixed: EVariantTypeCastError in Viewer when changing status of some bug reports 6)....Fixed: EcxInvalidDataControllerOperation in Viewer 7)....Fixed: Stack overflow at run-time for certain combination of project options 8)....Fixed: BMP re-draw bug in UI dialogs 9)....Fixed: Rogue "corrupted" error message for valid ZIPs of certain structure 10)..Fixed: Various range check errors in Viewer 11)..Fixed: Possible encoding errors for non-ASCII reports in Viewer on certain environments 12)..Fixed: Wrong count in Viewer when importing reports without proper "count" field 13)..Fixed: Duplicate reports may appear in bug report file when "Do not save duplicate errors" option is checked 14)..Fixed: False-positive detection of some virtual machines 15)..Fixed: Processing of exceptions from message handlers during message pumping cycle inside exception dialogs 16)..Fixed: Access Violation if exception dialog was terminated by exception 17)..Fixed: Hardware exceptions from unit's initialization/finalization may be unprocessed 18)..Changed: "VIEW" action for Viewer now will open ALL bug reports inside bug report file; reports will not be merged by BugID. "IMPORT" action remains the same: duplicate reports are merged, "count" is increased 19)..Changed: Charset field in bug report now shows both charset and code page EurekaLog 7.1 (7.1.0.00), 23-September-2014 1)....Added: XE7 support 2)....Added: XE6 support 3)....Added: New DLL demo 4)....Added: Custom profiles are now shown in "Application type" combo-box 5)....Added: Non-empty "steps to reproduce" will be added to existing bug tracker issues with empty "steps to reproduce" 6)....Added: Support for custom fields in FogBugz (API version 8 and above) 7)....Added: Support for unsequenced line numbers in PDB/DBG files (--el_source switch) 8)....Fixed: XML bug report were generated wrong 9)....Fixed: Strip relocations code for Win64 10)..Fixed: EurekaLog conditional symbols removed improperly when deactivating EurekaLog 11)..Fixed: Sending reports to non-default port numbers (affects web-based methods) 12)..Fixed: SSL validation check may reject valid SSL certificate (SMTP Client/Server) 13)..Fixed: SSL errors may be not reported 14)..Fixed: Viewer did not consider empty bug reports as corrupted 15)..Fixed: "DLL" profile now can be used with packages properly 16)..Fixed: Few rare memory leaks 17)..Fixed: Possible deadlock when using MS debug info provider 18)..Fixed: C++ Builder project files was saved incorrectly (RAD Studio 2007+) 19)..Fixed: "Show restart checkbox after N errors" counts handled exceptions 20)..Fixed: IDE expert's DPR parser (added support for multi-part idents) 21)..Fixed: Rare access violation in hook code 22)..Fixed: Thread handle leaks (added _NotifyThreadGone/_CleanupFinishedThreads functions to be called manually - only when low-level hooks are not installed) 23)..Fixed: EurekaLog's installer hang 24)..Fixed: Bug in object/class validation 25)..Fixed: Bug when using TThreadEx without EurekaLog 26)..Fixed: Leaks detection may not work with certain combination of options 27)..Fixed: Deadlock in some cases when using EurekaLog threading option set to "enabled in RTL threads, disabled in Windows threads". 28)..Changed: TEurekaExceptionInfo.CallStack will be nil until exception is actually raised 29)..Changed: FogBugz and BugZilla: changed bugs identification within project (to allow two bugs exists with same BugID in different projects) 30)..Changed: Blocked manual creation/destruction of ExceptionManager class and EurekaExceptionInfo 31)..Changed: ECC32/EMAKE runs from IDE without changing priority, added ECC32PriorityClass option 32)..Improved: Minor help and text improvements EurekaLog 7.0.07 Hotfix 2 (7.0.7.2), 11-December-2013 1)....Fixed: Delphi compiler code generation bug (Delphi 2007 and below) 2)....Fixed: Code hooks may rarely be set incorrectly (code stub relocation fails) 3)....Fixed: Win64 call stacks functions now work more similar to 32 bit call stacks EurekaLog 7.0.07 Hotfix 1 (7.0.7.1), 2-December-2013 1)....Added: Alternative caption for e-mail input control when e-mail is mandatory 2)....Fixed: Rare range check error in WinAPI visual dialogs 3)....Fixed: Wrong error detection for OnExceptionError event 4)....Fixed: Wrong TResponce processing 5)....Fixed: Problems with encrypted call stack decoding 6)....Fixed: OnPasswordRequest event may have no effect EurekaLog 7.0.07 (7.0.7.0), 25-November-2013 1)....Added: Ability to use Assign between call stack and TStrings 2)....Added: 64-bit disassembler 3)....Added: Support for variables and relative file paths in "Additional Files" send option 4)....Added: --el_source switch for ecc32/emake compilers 5)....Added: support for post-processing non-Embarcadero executables 6)....Added: EOTL.pas unit for better OmniThreadLibrary integration 7)....Added: RAD Studio XE5 support 8)....Added: New "Capture call stacks of EurekaLog-enabled threads" option 9)....Added: "Deferred call stacks" option for 64-bit 10)..Added: Copy report to clipboard now copies both report text and report file 11)..Added: "AttachBothXMLAndELReports" option to include both .elx and .el files into bug report 12)..Added: EMemLeaks.MemLeaksErrorsToIgnore option to exclude certain memory errors from being considered as fatal 13)..Added: Call stack with any encrypted entry will be fully encrypted now 14)..Added: Option to exclude certain memory errors from being considered as fatal (EMemLeaks.MemLeaksErrorsToIgnore) 15)..Added: New "HTTP Error Code" option for all web-based dialogs (CGI, ISAPI, etc.) 16)..Added: Support for Unicode in Simple MAPI send method (requires Windows 8 or latest Microsoft Office) 17)..Added: New value for call stack detalization option (show any addresses, including those not belonging to any executable module) 18)..Fixed: Wrong JSON escaping for strings (affects JIRA send method) 19)..Fixed: Range-check error in Viewer when viewing bug reports with high addresses 20)..Fixed: Selecting Win32 service application type is no longer resets to custom/unsupported 21)..Fixed: Possible hang when testing dialogs from EurekaLog project options dialog 22)..Fixed: Rare resetting of some options when saving .eof file 23)..Fixed: Exception pointer could be removed from call stack due to debug details filtering 24)..Fixed: Rare case when LastThreadException returned nil while there was active thread exception 25)..Fixed: Rare case when ShowLastThreadException do nothing 26)..Fixed: Improved compatibility for OmniThreadLibrary and AsyncCalls 27)..Fixed: Included fix for QC #72147 28)..Fixed: 64-bit MS Debug Info Provider (please, re-setup cache options using configuration dialog) 29)..Fixed: "Deferred call stacks" option failed to capture call stack when exception is re-raised between threads 30)..Fixed: "Deferred call stacks" option may produce cutted call stack in rare cases 31)..Fixed: Several minor call stacks improvements and optimizations 32)..Fixed: Several 64-bit Pointer Integer convertion issues 33)..Fixed: Multi-threading deadlock issue 34)..Fixed: Black screenshots in 64 bit applications 35)..Fixed: Copying to clipboard hot-key was registered globally 36)..Fixed: Shell (mailto) send method may fail (64 bit) 37)..Fixed: Possible wrong file paths for attaches in (S)MAPI send methods 38)..Fixed: Environment variables were not expanded in MAPI send method 39)..Fixed: (non-Unicode IDE) EurekaLog is not activated when application started from folder with Unicode characters 40)..Fixed: Encrypted call stacks may be encrypted partially by EurekaLog Viewer in rare cases 41)..Fixed: Crash when sending leak report with visual progress dialog (only some IDEs are affected) 42)..Fixed: ecc32/emake could not see external configuration file with the same name as project (e.g. Project1.eof for Project1.dpr) 43)..Fixed: Added missed RTL implementation for ExternalProps in Delphi 6 (affects Mantis sending) 44)..Fixed: IDE crash when switching to threads window 45)..Changed: Removed temporal solution which was used before option to defer call stack creation was introduced 46)..Changed: "Default EurekaLog state in new threads" option is changed from Boolean flag into enum. You need to re-setup this option 47)..Changed: Disable EurekaLog for thread when creating call stack or handle exception - this increases stability and performance 48)..Changed: LastException property is remove from exception manager as not thread safe. Use LastThreadException property instead 49)..Changed: Lock/Unlock from thread manager and exception manager are removed to avoid deadlocks 50)..Changed: ThreadsSnapshot tool now tries to capture call stack without injecting DLL 51)..Changed: Build events now runs with CREATE_NO_WINDOW flag (console window is hidden) 52)..Improved: More articles in help EurekaLog 7.0.06 (7.0.6.0), 1-June-2013 1)....Added: Experimental 64 bit C++ Builder support 2)....Added: New tab in EurekaLog project options: "External tools" 3)....Added: Option to catch all IDE errors (to debug your own IDE packages) 4)....Added: Option to catch only exceptions from current module 5)....Added: Option to defer building call stack 6)....Added: RAD Studio XE4 support 7)....Added: Support for AppWave 8)....Fixed: Fixed event handlers declarations for the EurekaLog component 9)....Fixed: Infinite recursive calls when using ToString from EndReport event handler 10)..Fixed: UPX compatibility issue 11)..Fixed: Range check errors for system error codes 12)..Fixed: Rare IDE stack overflow 13)..Fixed: JIRA unit was not added automatically 14)..Fixed: EurekaLog no longer tries to check for leaks when memory manager filter is disabled 15)..Fixed: Possible deadlock on shutdown with freeze checks active 16)..Fixed: Issues with settings dialog and Win32 Service application type 17)..Fixed: ThreadSnapshot tool was not able to take snapshots of Win64 processes 18)..Fixed: WCT is disabled for leaks 19)..Fixed: TContext declarations for Win64 20)..Fixed: Check for updates now correctly sets time of last check 21)..Fixed: (Win64) Several Pointer Integer convertion errors 22)..Fixed: Internal error when exception info object was deleted while it was still used by SysUtils exception object 23)..Fixed: Semeral problems with "EurekaLog look & feel" style for EurekaLog error dialog 24)..Fixed: Using text collection resets exception filters 25)..Fixed: Rare access violation if registering event handlers is placed too early 26)..Fixed: SMTP RFC date formatting 27)..Fixed: Rare empty call stack bug 28)..Fixed: Hang detection was not working if EurekaLog was disabled in threads 29)..Fixed: AV for double-free TEncoding 30)..Changed: ecc32/emake no longer alters arguments for dcc32/make unless new options --el_add_default_options is specified 31)..Changed: Save/load options methods was moved to TEurekaModuleOptions class 32)..Changed: Saving options to EOF file now adds hidden options and removes obsolete options (only when compatibility mode is off) 33)..Changed: Compiling installed packages now silently ignores EurekaLog instead of showing "File is in use" error message 34)..Improved: More readable disk/memory sizes in bug reports 35)..Improved: More descriptive settings dialog when using external configuration 36)..Improved: ThreadSnapshot tool now aquired DEBUG priviledge for taking snapshot. This allows it to bypass security access checks when opening target process. 37)..Improved: Changed BugID default generation to include error code for OS errors and error message for DB errors 38)..Improved: Mantis API (WSDL) was updated to the latest version (1.2.14) 39)..Improved: IntraWeb compatibility (old and new versions) 40)..Improved: COM applications compatibility 41)..Improved: Build events now accept shell commands 42)..Improved: More articles in help EurekaLog 7.0.05 (7.0.5.0), 7-February-2013 1)....Added: JIRA support 2)....Added: Virtual machine detection (new field in bug reports) 3)....Fixed: "Use Main Module options" option was loading empty options for some cases 4)....Fixed: Wrong record declarations for Simple MAPI on Win64 5)....Fixed: Performance issues with batch module options updating 6)....Fixed: Wrong leaks report with both MemLeaks/ResLeaks options active 7)....Fixed: Wrong info for nested exceptions in some cases 8)....Fixed: AV under debugger for Win64 (added support for _TExitDllException) 9)....Fixed: Wrong record declarations for process/thread info on Win64 10)..Fixed: Support for FinalBuilder on XE2/XE3 with spaces in file paths 11)..Fixed: Rare double-free of module information (ModuleInfoList) 12)..Fixed: Rare External Exception C000071C on shutdown (only under debuggger) 13)..Fixed: Added large addresses support in Viewer 14)..Fixed: Counter options in memory leaks category is now working properly 15)..Fixed: Rare range-check error in TEurekaModulesList.AddModuleFromFileName 16)..Fixed: FTP force directories dead lock 17)..Fixed: Fixed wrong index being used when clearing compatibility mode (EurekaLog project options dialog) 18)..Fixed: Default thread state do not affect main thread now 19)..Fixed: Sometimes wrong thread may be used when altering EurekaLog active state for external thread 20)..Fixed: Wrong DNS lookup on ANSI 21)..Fixed: Problems with IDE expert and projects on network paths 22)..Fixed: Added support for arguments in URLs (HTTP sending) 23)..Fixed: Possible deadlock in multithreaded applications 24)..Fixed: Problems with unicode characters in project files on non-Unicode IDEs 25)..Fixed: Infinite recursive calls when using ToString from EndReport event handler 26)..Fixed: Win64 GetCaller now returns pointer to call instruction, not return address 27)..Improved: Standalone Editor do not force save/load folder by default 28)..Improved: DLL profile now can use additional application type hooks automatically 29)..Improved: EurekaLog now able to work with read-only projects (see help for more info) EurekaLog 7.0.04 (7.0.4.0), 2-December-2012 1)....Added: Support for nested exceptions in DLLs 2)....Fixed: Options bug in EurekaLogSendEmail function 3)....Fixed: Weird behaviour for steps to reproduce and custom fields 4)....Fixed: Installation for single personality (BDS) 5)....Fixed: Range check error in EModules 6)....Fixed: Bug in exception destroy hook 7)....Fixed: OnExceptionNotify event is no longer called for handled exceptions without option checked 8)....Fixed: DEP checks on startup no longer cause exception 9)....Fixed: Invalid declaration for MS Debug API 10)..Fixed: OLE mode change error for "Test" send button 11)..Fixed: Fixes for multiply loading of the same DLL 12)..Fixed: Removed PNG compression from icons (tools) 13)..Fixed: Range-check error in dialogs with EurekaLog style enabled 14)..Fixed: Send progress dialog may keep busy forever processing window messages (message flood from rapid application GUI updates) 15)..Fixed: Thread pausing options now work correctly 16)..Improved: New features in exception filters - marking exceptions as "expected", filtering by properties (RTTI) 17)..Improved: Recovery from memory errors without debugging memory manager 18)..Improved: Viewer's password edit now hides password with asterisks 19)..Updated: Changed names of .inc files to avoid name conflicts with other libraries 20)..Updated: Help EurekaLog 7.0.03 (7.0.3.0), 6-October-2012 1)....Fixed: Removed some consts keywords for event handlers, so now C++ Builder can alter arguments (this change may require you to adjust your custom code) 2)....Fixed: Fallback code for false-positive results on memory probing 3)....Fixed: Range check errors in SSL/TLS implementation 4)....Fixed: "EurekaLog is not active" error message during send testing 5)....Fixed: Incorrect memory probing when DEP is off (old systems) 6)....Fixed: Installation of 64-bit BPLs 7)....Fixed: Dialog preview 8)....Fixed: Win64 fixes for XE3 9)....Fixed: Support for project groups (mixed project types) 10)..Fixed: Windows 2000 hooks compatibility 11)..Fixed: mailto double quotes escaping 12)..Fixed: Simple MAPI WOW compatibility 13)..Fixed: Simple MAPI modal issues 14)..Fixed: Various range check errors 15)..Changed: Removed minor version number from program group name 16)..Updated: Help EurekaLog 7.0.02 hot-fix 1 (7.0.2.1), 12-September-2012 1)....Fixed: Range check error in Viewer 2)....Fixed: Bug in hooking code EurekaLog 7.0.02 (7.0.2.0), 11-September-2012 1)....Added: Improved memory problems detection 2)....Added: Minor IDE Expert usability improvements 3)....Added: Auto-size feature for detailed error dialog 4)....Added: Workaround for QC #106935 5)....Added: Workaround for bug in InvokeRegistry (SOAP/Mantis) 6)....Fixed: Nested OS exceptions 7)....Fixed: Multiply Win64 fixes 8)....Fixed: Compatibility mode fixes 9)....Fixed: Altered behaviour of "Add BugID/Date/ComputerName" options 10)..Fixed: Blank screenshots 11)..Fixed: Check file for corruptions 12)..Fixed: Viewer is unable to decrypt certain bug reports 13)..Fixed: Internal DoNoTouch option now works for post-processing and condtionals 14)..Fixed: Possible out of memory error for "Do not store class/procedure names" option 15)..Fixed: EurekaLog did not properly install itself when there is only Delphi installed, but no C++ Builder of the same version (or visa versa) 16)..Fixed: Wrong argument for OnRaise event 17)..Fixed: Handling memory errors in initialization/finalization sections 18)..Fixed: Updating steps to reproduce and user e-mail in bug report 19)..Fixed: Proper Success/Failure for some errors during SMTP send 20)..Added: Workaround for wrong GUI fonts 21)..Added: Delphi XE3 support 22)..Added: Individual options for each exception EurekaLog 7.0.01 (7.0.1.0), 28-June-2012 1)....Added: New "Modal window" option (MS Classic and EurekaLog dialogs) 2)....Added: New "Owned window" option (MS Classic and EurekaLog dialogs) 3)....Added: New "Catch EurekaLog IDE Expert errors" option 4)....Added: Backup memory manager to recover from critical errors 5)....Added: Alternative methods to provide additional features when memory filter is not set 6)....Fixed: Contains fixes from hotfixes 1-3 7)....Fixed: Performance improvements 8)....Fixed: Improved IDE Expert's speed, stability and compatibility with other 3rd party extensions 9)....Fixed: MS Classic dialog size adjustments for large "click here" translations 10)..Fixed: Fixed resetting few EurekaLog project options to defaults 11)..Fixed: Multiplying exception filters when options are assigned (for example: when switching to/from "Custom" page in project options) 12)..Fixed: (Compatibility mode) Fixed send options merging 13)..Fixed: Updated help EurekaLog 7.0 hot-fix 3 (7.0.0.273), 20-June-2012 --------------------------- 1)....Fixed: ERangeError in EResLeaks (THandle Integer) 2)....Fixed: C++ Builder breakpoints for large projects 3)....Fixed: Help (updates policy changed) 4)....Fixed: Text collections applying 5)....Fixed: Build events are now called for unlocked file 6)....Fixed: Proper handling of C++ Builder project options files from Delphi code (settings editor and IDE expert) 7)....Fixed: Terminate/Checked sub-option for MS Classic dialog 8)....Fixed: Confusing message for already post-processed executables 9)....Fixed: Access violation for some EurekaLog IDE menu items when no project was loaded 10)..Fixed: Invoking help for "Variables" window 11)..Fixed: EurekaLog Viewer version info 12)..Fixed: Events in components 13)..Added: Retry option for "Sorry, you must close all running IDE instances before installation" 14)..Added: Italian translation 15)..Added: Actual change log is now included into installer 16)..Added: Even more setup logging 17)..Added: New help articles (recompilation and manual installation) EurekaLog 7.0 hot-fix 2 (7.0.0.261), 10-June-2012 --------------------------- 1)....Fixed: Wrong version info reporting to IDE 2)....Added: Workaround for Delphi 2005 TListView bug 3)....Added: Workaround for possible invalid FPU state in exception handlers 4)....Added: Missed declarations for ExceptionLog (compatibility mode) 5)....Fixed: Work for unsaved projects 6)....Added: Escaping for '--' in options (confuses IDE's XML parsing) 7)....Added: Storing thread's class/name in call stack for terminated threads 8)....Added: More setup logging 9)....Fixed: Help (broken links) 10)..Added: "Upgrade to EurekaLog 7" help topic 11)..Fixed: Clean up installed files EurekaLog 7.0 hot-fix 1 (7.0.0.256), 6-June-2012 --------------------------- 1)....Fixed: Invalid Format() arguments in ELogBuilder. EurekaLog 7.0, 1-June-2012 --------------------------- 1)....Improved: Main change - EurekaLog's core was rewritten (refactored) to allow more easy modification and remove hacks. 2)....Improved: New plugin-like architecture now allows you to exclude unused code. 3)....Improved: New plugin-like architecture now allows you to easily extends EurekaLog. 4)....Improved: Greatly extended documentation. 5)....Improved: Installer is now localized. 6)....Improved: Greatly speed ups creation of minimal bug report (with most information disabled). 7)....Changed: EurekaLog's root IDE menu was relocated to under Tools and extended with new items. 8)....Added: New examples. 9)....Added: New tools (address lookup, error lookup, threads snapshot, standalone settings editor). 10)..Added: Support for DBG/PDB formats of debug information (including symbol server support and auto-downloading). 11)..Added: Support for madExcept debug information (experimental). 12)..Added: WER (Windows Error Reporting) support. 13)..Added: Full unicode support. 14)..Added: Professional and Trial editions: added source code (interface sections only) 15)..Improved: Dialogs - new options and new customization possibilities: 16)..Added: All GUI dialogs: ability to test dialog directly from configuration dialog by displaying a sample window with currently specified settings. 17)..Improved: All GUI dialogs: dialogs are DPI-awared now (auto-scale for different DPI). 18)..Added: MessageBox dialog: added detailed mode (shows a compact call stack). 19)..Added: MessageBox dialog: added ability for asking a send consent. 20)..Added: MessageBox dialog: added support to switch to "native" message box for application. 21)..Added: MS Classic dialog: added control over "user e-mail" edit's visibility. 22)..Added: MS Classic dialog: added ability to personalize dialog view with application's name and icon. 23)..Added: MS Classic dialog: added ability to show terminate/restart checkbox initially checked. 24)..Added: EurekaLog dialog: added ability to personalize dialog view with application's name and icon. 25)..Added: EurekaLog dialog: added ability to show terminate/restart checkbox initially checked. 26)..Added: EurekaLog dialog: added ability to switch back to non-detailed view. 27)..Added: WEB dialog: added new tags to customize bug report page. 28)..Improved: WEB dialog: improved support for unicode and charset. 29)..Added: New dialog type: RTL dialog. 30)..Added: New dialog type: console output. 31)..Added: New dialog type: system logging. 32)..Added: New dialog type: Windows Error Reporting. 33)..Improved: Sending - new options and new customization possibilities: 34)..Added: All send methods: added ability to setup multiply send methods. 35)..Added: All send methods: added ability to change send method order. 36)..Added: All send methods: added separate settings for each send method. 37)..Added: All send methods: ability to test send method directly from configuration dialog by sending a demo bug report. 38)..Added: SMTP client send method: added SSL support. 39)..Added: SMTP client send method: added TLS support. 40)..Added: SMTP client send method: added option for using real e-mail address. 41)..Added: SMTP server send method: added option for using real e-mail address. 42)..Added: HTTP upload send method: added support for custom backward feedback messages. 43)..Added: FTP upload send method: added creating folders on FTP (like remote ForceDirectories). 44)..Added: Mantis send method: added API support (MantisConnect, out-of-the-box since Mantis 1.1.0, available as add-on for previous versions). 45)..Added: Mantis send method: added support for custom "Count" field. 46)..Added: Mantis send method: added options for controlling duplicates. 47)..Added: Mantis send method: added support for SSL/TLS. 48)..Added: FogBugz send method: added API support (out-of-the-box since ForBugz 7, available as add-on for FogBugz 6). 49)..Added: FogBugz send method: EurekaLog will update "Occurrences" field (count of bugs). 50)..Added: FogBugz send method: EurekaLog will respect "Stop reporting" option (BugzScout's setting). 51)..Added: FogBugz send method: EurekaLog will respect "Scout message" option (BugzScout's setting). 52)..Added: FogBugz send method: EurekaLog will store client's e-mail as issue's correspondent. 53)..Added: FogBugz send method: added options for controlling duplicates. 54)..Added: FogBugz send method: added support for "Area" field. 55)..Added: FogBugz send method: added support for SSL/TLS. 56)..Added: BugZilla send method: added API support. 57)..Added: BugZilla send method: added support for custom "Count" field. 58)..Added: BugZilla send method: added options for controlling duplicates. 59)..Added: BugZilla send method: added support for SSL/TLS. 60)..Added: New send method: Shell (mailto protocol). 61)..Added: New send method: extended MAPI. 62)..Added: Support for separate code and debug info injection. 63)..Added: Ability to use custom units before EurekaLog's units. 64)..Added: Support for external configuration file in IDE expert. 65)..Added: Now EurekaLog stores only those project options which are different from defaults (to save disk space and reduce noise in project file). 66)..Added: Now EurekaLog stores project options sorted (alphabet order). 67)..Added: Separate settings for saving modules and processes lists to bug report. 68)..Added: Support for taking screenshots of multiply monitors. 69)..Added: More screenshot customization options. 70)..Added: More control over bug report's file names. 71)..Added: New environment variables. 72)..Added: Deleting .map file after compilation. 73)..Added: Support for different .dpr and .dproj file names. 74)..Improved: memory leaks detection feature - new options and new customization possibilities: 75)..Added: Ability to track memory problems without activation of leaks checking. 76)..Added: Support for sharing memory manager. 77)..Added: Support for tracking leaks in applications built with run-time packages. 78)..Added: Option to zero-fill freed memory. 79)..Added: Option to enable leaks detection only when running under debugger. 80)..Added: Option for manual activation control for leaks detection (via command-line switches). 81)..Added: Option to select stack tracing method for memory problems. 82)..Added: Option to trigger memory leak reporting only for large leaked memory's size. 83)..Added: Option to control limit of number of reported leak. 84)..Added: CheckHeap function to force check of heap's consistency. 85)..Added: DumpAllocationsToFile function to save information about allocated memory to log file. 86)..Added: Registered leaks feature. 87)..Added: Run-time control over memory leak registering. 88)..Added: New recognized leak type: String (both ANSI and Unicode are supported). 89)..Added: Memory features support for C++ Builder. 90)..Added: Resource leaks detection feature. 91)..Improved: Compilation speed increased. 92)..Added: Support for generics in debug information. 93)..Added: Chained/nested exceptions support. 94)..Added: Wait Chain Traversal support. 95)..Added: Support for named threads. 96)..Added: Additional information for threads in call stack. 97)..Improved: EurekaLog Viewer Tool: 98)..Added: Now Viewer has its own help file 99)..Added: Viewer now supports a FireBird based database on local file or remote server. 100).Added: You can have more that one user account for FireBird based database. 101).Added: Viewer now can be launched in View mode (Viewer can be configured to any DB or View mode). 102).Added: Viewer's database now supports storing files, associated with the report (you can also add and remove files manually). 103).Added: Viewer supports "Import" and "View" commands for report files. 104).Improved: Extended support for more log formats (XML, packed ELF, etc). 105).Added: Columns in report's list now can be configured (you can hide and show them). 106).Added: There are a plenty of new columns added to report's list. 107).Added: Ability of auto-download reports from e-mail account. 108).Improved: printing - now you can print the entire report (including screenshots). Old behaviour of printing just one tab (call stack only, for example) also remains. 109).Added: Viewer can now have more that one run-time instance . 110).Added: File import status dialog is now configurable (you can disable it, if you want to). 111).Added: There is a preview area for screenshots, available in reports. 112).Improved: Now Viewer is more Vista-friendly (i.e. file associations are managed in HKCU, rather that in HKLM, storing configuration in user's Application Data, etc, etc). 113).Added: Report's list now supports multi-select, so operations can be performed on many reports at time. 114).Added: There are plenty of new command line abilities, like specifying several files and new switches. 115).Improved: Bunch of minor changes and improvements. WARNING: -------- There are many changes in this release. See the "Changed from the old 6.x version" help topic for further information! EurekaLog 7 also have "EurekaLog 6 backward compatibility mode". Please, refer to help file for more information. We also have the detailed "Upgrade guide" in our help system.
Error Correction Coding - Mathematical Methods and Algorithms (Source Files Contained).pdf Error Correction Coding Mathematical Methods and Algorithms Todd K. Moon Utah State University @ E ! C I E N C E A JOHN WILEY & SONS, INC., PUBLICATION Preface vii List of Program Files xxxi List of Laboratory Exercises XXXii List of Algorithms d V List of Figures XI List of Tables xlii List of Boxes Xliii Part I Introduction and Foundations 1 A Context for Error Correction Coding 2 1.1 F’urpose of This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Introduction: Where Are Codes? . . . . . . . . . . . . . . . . . . . . . . . 2 1.3 The Communications System . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 Basic Digital Communications . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4.1 Binary Phase-Shift Keying . . . . . . . . . . . . . . . . . . . . . . 10 1.4.2 More General Digital Modulation . . . . . . . . . . . . . . . . . . 11 1.5 Signal Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.5.1 The Gaussian Channel . . . . . . . . . . . . . . . . . . . . . . . . 14 1 S.2 MAP and ML Detection . . . . . . . . . . . . . . . . . . . . . . . 16 1.5.3 Special Case: Binary Detection . . . . . . . . . . . . . . . . . . . 18 1.5.4 Probability of Error for Binary Detection . . . . . . . . . . . . . . 19 1 S.5 Bounds on Performance: The Union Bound . . . . . . . . . . . . . 22 1.5.6 The Binary Symmetric Channel . . . . . . . . . . . . . . . . . . . 23 1 S.7 The BSC and the Gaussian Channel Model . . . . . . . . . . . . . 25 1.6 Memoryless Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 1.7 Simulation and Energy Considerations for Coded Signals . . . . . . . . . . 26 1.8 Some Important Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 27 1.8.1 Detection of Repetition Codes Over a BSC . . . . . . . . . . . . . 28 Soft-Decision Decoding of Repetition Codes Over the AWGN 1.8.3 Simulation of Results . . . . . . . . . . . . . . . . . . . . . . . . . 33 1.8.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 1.9 HammingCodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 1.9.1 Hard-Input Decoding Hamming Codes . . . . . . . . . . . . . . . 35 1.9.2 Other Representations of the Hamming Code . . . . . . . . . . . . 36 An Algebraic Representation . . . . . . . . . . . . . . . . . . . . . 37 A Polynomial Representation . . . . . . . . . . . . . . . . . . . . 37 1 A Trellis Representation . . . . . . . . . . . . . . . . . . . . . . . 38 The Tanner Graph Representation . . . . . . . . . . . . . . . . . . 38 1.10 The Basic Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 1.12 A Bit of Information Theory . . . . . . . . . . . . . . . . . . . . . . . . . 40 1.12.1 Definitions for Discrete Random Variables . . . . . . . . . . . . . . 40 Entropy and Conditional Entropy . . . . . . . . . . . . . . . . . . 40 Relative Entropy. Mutual Information. and Channel Capacity . . . . 41 1.12.2 Definitions for Continuous Random Variables . . . . . . . . . . . . 43 1.12.3 The Channel Coding Theorem . . . . . . . . . . . . . . . . . . . . 45 1.12.4 “Proof“ of the Channel Coding Theorem . . . . . . . . . . . . . . . 45 1.12.5 Capacity for the Continuous-Time AWGN Channel . . . . . . . . . 49 1.12.6 Transmission at Capacity with Errors . . . . . . . . . . . . . . . . 51 1.12.7 The Implication of the Channel Coding Theorem . . . . . . . . . . 52 1.11 Historical Milestones of Coding Theory . . . . . . . . . . . . . . . . . . . 40 Lab 1 Simulating a Communications Channel . . . . . . . . . . . . . . . 53 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Use of Coding in Conjunction with the BSC . . . . . . . . . . . . . . . . . 53 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Resources and Implementation Suggestions . . . . . . . . . . . . . . . . . 54 1.13 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 1.14 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Part I1 Block Codes 61 2 Groups and Vector Spaces 62 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 2.2 Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 2.2.1 Subgroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 2.2.2 Cyclic Groups and the Order of an Element . . . . . . . . . . . . . 66 2.2.3 Cosets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 2.2.4 Lagrange’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . 68 2.2.5 Induced Operations; Isomorphism . . . . . . . . . . . . . . . . . . 69 2.2.6 Homomorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 2.3 Fields: A Prelude . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 2.4 Review of Linear Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 2.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 2.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 3 Linear Block Codes 83 3.1 Basic Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 3.2 The Generator Matrix Description of Linear Block Codes . . . . . . . . . . 84 3.2.1 Rudimentary Implementation . . . . . . . . . . . . . . . . . . . . . 86 3.3 The Parity Check Matrix and Dual Codes . . . . . . . . . . . . . . . . . . 86 3.3.1 Some Simple Bounds on Block Codes . . . . . . . . . . . . . . . . 88 3.4 Error Detection and Correction over Hard-Input Channels . . . . . . . . . . 90 3.4.1 Error Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 3.4.2 Error Correction: The Standard Array . . . . . . . . . . . . . . . . 90 3.6 Hamming Codes and Their Duals . . . . . . . . . . . . . . . . . . . . . . . 97 3.7 Performance of Linear Codes . . . . . . . . . . . . . . . . . . . . . . . . . 98 3.7.1 Error detection performance . . . . . . . . . . . . . . . . . . . . . 99 3.7.2 Error Correction Performance . . . . . . . . . . . . . . . . . . . . 100 3.7.3 Performance for Soft-Decision Decoding . . . . . . . . . . . . . . 103 3.8 Erasure Decoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 3.8.1 Binary Erasure Decoding . . . . . . . . . . . . . . . . . . . . . . . 105 3.9 Modifications to Linear Codes . . . . . . . . . . . . . . . . . . . . . . . . 105 3.10 Best Known Linear Block Codes . . . . . . . . . . . . . . . . . . . . . . . 107 3.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 3.12 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 113 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 4.2 Basic Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 4.3 Rings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 4.3.1 Rings of Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . 115 4.4 QuotientRings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 4.5 IdealsinRings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 4.6 Algebraic Description of Cyclic Codes . . . . . . . . . . . . . . . . . . . . 120 4.7 Nonsystematic Encoding and Parity Check . . . . . . . . . . . . . . . . . . 122 4.8 Systematic Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 4.9 Some Hardware Background . . . . . . . . . . . . . . . . . . . . . . . . . 126 4.9.1 Computational Building Blocks . . . . . . . . . . . . . . . . . . . 126 4.9.2 Sequences and Power series . . . . . . . . . . . . . . . . . . . . . 127 4.9.3 Polynomial Multiplication . . . . . . . . . . . . . . . . . . . . . . 128 Last-Element-First Processing . . . . . . . . . . . . . . . . . . . . 128 First-Element-First Processing . . . . . . . . . . . . . . . . . . . . 128 4.9.4 Polynomial division . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Last-Element-First Processing . . . . . . . . . . . . . . . . . . . . 129 4.9.5 Simultaneous Polynomial Division and Multiplication . . . . . . . 132 First-Element-First Processing . . . . . . . . . . . . . . . . . . . . 132 4.10 Cyclic Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 4.1 1 Syndrome Decoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 4.12 Shortened Cyclic Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . Method 1: Simulating the Extra Clock Shifts . . . . . . . . . . . . 144 Method 2: Changing the Error Pattern Detection Circuit . . . . . . 147 4.13 Binary CRC Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 4.13.1 Byte-Oriented Encoding and Decoding Algorithms . . . . . . . . . 150 4.13.2 CRC Protecting Data Files or Data Packets . . . . . . . . . . . . . 153 Appendix 4.A Linear Feedback Shift Registers . . . . . . . . . . . . . . . . . . . 154 Appendix 4.A. 1 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . 154 Appendix 4.A.2 Connection With Polynomial Division Appendix 4.A.3 Some Algebraic Properties of Shift Sequences . . . . . . . 3.5 Weight Distributions of Codes and Their Duals . . . . . . . . . . . . . . . 95 4 Cyclic Codes, Rings, and Polynomials 143 . . . . . . . . . . . 157 160 Lab 2 Polynomial Division and Linear Feedback Shift Registers . . . 161 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Preliminary Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Programming Part: BinLFSR . . . . . . . . . . . . . . . . . . . . . . . . 161 Resources and Implementation Suggestions . . . . . . . . . . . . . . . . . 161 Programming Part: BinPolyDiv . . . . . . . . . . . . . . . . . . . . . . 162 Follow-On Ideas and Problems . . . . . . . . . . . . . . . . . . . . . . . . 162 Lab 3 CRC Encoding and Decoding . . . . . . . . . . . . . . . . . . . . . 162 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 Preliminary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 Resources and Implementation Suggestions . . . . . . . . . . . . . . . . . 163 4.14 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 4.15 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 5 Rudiments of Number Theory and Algebra 171 5.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 5.2 Number Theoretic Preliminaries . . . . . . . . . . . . . . . . . . . . . . . 175 5.2.1 Divisibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 5.2.3 The Sugiyama Algorithm . . . . . . . . . . . . . . . . . . . . . . . 182 5.2.4 Congruence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 5.2.5 The q!~ Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 5.2.6 Some Cryptographic Payoff . . . . . . . . . . . . . . . . . . . . . 186 Fermat's Little Theorem . . . . . . . . . . . . . . . . . . . . . . . 186 RSA Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 5.3 The Chinese Remainder Theorem . . . . . . . . . . . . . . . . . . . . . . . 188 5.3.1 The CRT and Interpolation . . . . . . . . . . . . . . . . . . . . . . 190 The Evaluation Homomorphism . . . . . . . . . . . . . . . . . . . 190 The Interpolation Problem . . . . . . . . . . . . . . . . . . . . . . 191 5.4 Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 5.4.1 An Examination of IR and C . . . . . . . . . . . . . . . . . . . . . 194 5.4.2 Galois Field Construction: An Example . . . . . . . . . . . . . . . 196 5.4.3 Connection with Linear Feedback Shift Registers . . . . . . . . . . 199 5.5 Galois Fields: Mathematical Facts . . . . . . . . . . . . . . . . . . . . . . 200 5.6 Implementing Galois Field Arithmetic . . . . . . . . . . . . . . . . . . . . 204 5.6.1 Zech Logarithms . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 5.6.2 Hardware Implementations . . . . . . . . . . . . . . . . . . . . . . 205 5.7 Subfields of Galois Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 5.8 Irreducible and Primitive polynomials . . . . . . . . . . . . . . . . . . . . 207 5.9 Conjugate Elements and Minimal Polynomials . . . . . . . . . . . . . . . . 209 5.9.1 Minimal Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . 212 5.10 Factoring x" - 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 5.1 1 Cyclotomic Cosets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 Programming the Euclidean Algorithm . . . . . . . . . . . . . . . 223 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Preliminary Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Preliminary Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 5.12 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 5.13 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Lab 5 Programming Galois Field Arithmetic . . . . . . . . . . . . . . . . 224 6 BCH and Reed-Solomon Codes: Designer Cyclic Codes 235 6.1 BCHCodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 6.1.1 Designing BCH Codes . . . . . . . . . . . . . . . . . . . . . . . . 235 6.1.2 TheBCHBound . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 6.1.3 Weight Distributions for Some Binary BCH Codes . . . . . . . . . 239 6.1.4 Asymptotic Results for BCH Codes . . . . . . . . . . . . . . . . . 240 6.2 Reed-Solomon Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 6.2.1 Reed-Solomon Construction 1 . . . . . . . . . . . . . . . . . . . . 242 6.2.2 Reed-Solomon Construction 2 . . . . . . . . . . . . . . . . . . . . 243 6.2.3 Encoding Reed-Solomon Codes . . . . . . . . . . . . . . . . . . . 244 6.2.4 MDS Codes and Weight Distributions for RS Codes . . . . . . . . . 245 Decoding BCH and RS Codes: The General Outline . . . . . . . . . . . . . 247 6.3.1 Computation of the Syndrome . . . . . . . . . . . . . . . . . . . . 247 6.3.2 The Error Locator Polynomial . . . . . . . . . . . . . . . . . . . . 248 6.3.3 ChienSearch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 6.4 Finding the Error Locator Polynomial . . . . . . . . . . . . . . . . . . . . 250 6.4.2 Berlekamp-Massey Algorithm . . . . . . . . . . . . . . . . . . . . 253 Simplifications for Binary Codes . . . . . . . . . . . . . . . . . . . 259 6.5 Non-Binary BCH and RS Decoding . . . . . . . . . . . . . . . . . . . . . 261 6.5.1 Forney’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . 262 6.6 Euclidean Algorithm for the Error Locator Polynomial . . . . . . . . . . . 266 Erasure Decoding for Nonbinary BCH or RS codes . . . . . . . . . . . . . 267 6.8 Galois Field Fourier Transform Methods . . . . . . . . . . . . . . . . . . . 269 6.8.1 Equivalence of the Two Reed-Solomon Code Constructions . . . . 274 6.8.2 Frequency-Domain Decoding . . . . . . . . . . . . . . . . . . . . 275 6.9 Variations and Extensions of Reed-Solomon Codes . . . . . . . . . . . . . 276 6.9.1 Simple Modifications . . . . . . . . . . . . . . . . . . . . . . . . . 276 6.9.3 GoppaCodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Decoding Alternant Codes . . . . . . . . . . . . . . . . . . . . . . 280 The McEliece Public Key Cryptosystem . . . . . . . . . . . . . . . 280 Lab 6 Programming the Berlekamp-Massey Algorithm . . . . . . . . . 281 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 Preliminary Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 Resources and Implementation Suggestions Lab 7 programming the BCH Decoder . . . . . . . . . . . . . . . . . . . 283 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Preliminary Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Resources and Implementation Suggestions . . . . . . . . . . . . . . . . . 283 Follow-On Ideas and Problems . . . . . . . . . . . . . . . . . . . . . . . . 284 Lab 8 Reed-Solomon Encoding and Decoding . . . . . . . . . . . . . . 284 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Appendix 6.A Proof of Newton’s Identities . . . . . . . . . . . . . . . . . . . . . 285 6.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 6.1 1 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 293 7.1 Introduction: Workload for Reed-Solomon Decoding . . . . . . . . . . . . 293 7.2 Derivations of Welch-Berlekamp Key Equation . . . . . . . . . . . . . . . 293 7.3 Finding the Error Values . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 7.4 Methods of Solving the WB Key Equation . . . . . . . . . . . . . . . . . . 302 7.4.1 Background: Modules . . . . . . . . . . . . . . . . . . . . . . . . 302 7.4.2 The Welch-Berlekamp Algorithm . . . . . . . . . . . . . . . . . . 303 7.4.3 Modular Solution of the WB Key Equation . . . . . . . . . . . . . 310 7.6.1 Bounded Distance, ML, and List Decoding . . . . . . . . . . . . . 322 Error Correction by Interpolation . . . . . . . . . . . . . . . . . . . 323 7.6.3 Polynomials in ?Lvo Variables . . . . . . . . . . . . . . . . . . . . 324 Degree and Monomial Order . . . . . . . . . . . . . . . . . . . . . 325 Zeros and Multiple Zeros . . . . . . . . . . . . . . . . . . . . . . . 328 7.6.4 The GS Decoder: The Main Theorems . . . . . . . . . . . . . . . . 330 The Interpolation Theorem . . . . . . . . . . . . . . . . . . . . . . 331 The Factorization Theorem . . . . . . . . . . . . . . . . . . . . . . 331 The Correction Distance . . . . . . . . . . . . . . . . . . . . . . . 333 The Number of Polynomials in the Decoding List . . . . . . . . . . 335 Algorithms for Computing the Interpolation Step . . . . . . . . . . 337 Finding Linearly Dependent Columns: The Feng-Tzeng Algorithm 338 Finding the Intersection of Kernels: The Katter Algorithm . . . . . 342 7.6.6 A Special Case: m = 1 and L = 1 . . . . . . . . . . . . . . . . . . 348 7.6.7 The Roth-Ruckenstein Algorithm . . . . . . . . . . . . . . . . . . 350 What to Do with Lists of Factors? . . . . . . . . . . . . . . . . . . 354 7.6.8 Soft-Decision Decoding of Reed-Solomon Codes . . . . . . . . . . 358 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 A Factorization Theorem . . . . . . . . . . . . . . . . . . . . . . . 360 Mapping from Reliability to Multiplicity . . . . . . . . . . . . . . 361 The Geometry of the Decoding Regions . . . . . . . . . . . . . . . 363 Computing the Reliability Matrix . . . . . . . . . . . . . . . . . . 364 7.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 7.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 8 Other Important Block Codes 369 8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 8.2 Hadamard Matrices. Codes. and Transforms . . . . . . . . . . . . . . . . . 369 8.2.1 Introduction to Hadamard Matrices . . . . . . . . . . . . . . . . . 369 8.2.2 The Paley Construction of Hadamard Matrices . . . . . . . . . . . 371 8.2.3 Hadamard Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 8.3 Reed-Muller Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 8.3.1 Boolean Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 375 8.3.2 Definition of the Reed-Muller Codes . . . . . . . . . . . . . . . . . 376 8.3.3 Encoding and Decoding Algorithms for First-Order RM Codes . . . 379 Encoding RM (1. m) Codes . . . . . . . . . . . . . . . . . . . . . 379 Decoding RM(1, m) Codes . . . . . . . . . . . . . . . . . . . . . 379 Expediting Decoding Using the Fast Hadamard Transform . . . . . 382 The Reed Decoding Algorithm for RM(r. m) Codes, I 2 1 . . . . . 384 Details for an RM(2. 4) Code . . . . . . . . . . . . . . . . . . . . 384 8.3.5 Other Constructions of Reed-Muller Codes . . . . . . . . . . . . . 391 Building Long Codes from Short Codes: The Squaring Construction . . . . 392 8.3.4 A Geometric Viewpoint . . . . . . . . . . . . . . . . . . . . . . . 387 8.4 8.5 Quadratic Residue Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 8.6 Golaycodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 8.6.1 Decoding the Golay Code . . . . . . . . . . . . . . . . . . . . . . 400 Algebraic Decoding of the $23 Golay Code . . . . . . . . . . . . . 400 Arithmetic Decoding of the 524 Code . . . . . . . . . . . . . . . . 401 8.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 8.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 9 Bounds on Codes 406 9.1 The Gilbert-Varshamov Bound . . . . . . . . . . . . . . . . . . . . . . . . 409 9.2 The Plotkin Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 9.3 The Griesmer Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 9.4 The Linear Programming and Related Bounds . . . . . . . . . . . . . . . . 413 9.4.1 Krawtchouk Polynomials . . . . . . . . . . . . . . . . . . . . . . . 415 9.4.2 Character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 9.4.3 Krawtchouk Polynomials and Characters . . . . . . . . . . . . . . 416 9.5 The McEliece-Rodemich-Rumsey-WelcBh ound . . . . . . . . . . . . . . . 418 9.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 9.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 10 Bursty Channels. Interleavers. and Concatenation 425 10.1 Introduction to Bursty Channels . . . . . . . . . . . . . . . . . . . . . . . 425 10.2 Interleavers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 10.3 An Application of Interleaved RS Codes: Compact Discs . . . . . . . . . . 427 10.4 Productcodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430 10.5 Reed-Solomon Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 10.6 Concatenated Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 10.7 Fire Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 10.7.1 Fire Code Definition . . . . . . . . . . . . . . . . . . . . . . . . . 433 10.7.2 Decoding Fire Codes: Error Trapping Decoding . . . . . . . . . . . 435 10.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 10.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 11 Soft-Decision Decoding Algorithms 439 1 1.2 Generalized Minimum Distance Decoding . . . . . . . . . . . . . . . . . . 441 11.1 Introduction and General Notation . . . . . . . . . . . . . . . . . . . . . . 439 1 1.2.1 Distance Measures and Properties . . . . . . . . . . . . . . . . . . 442 1 1.3 The Chase Decoding Algorithms . . . . . . . . . . . . . . . . . . . . . . . 445 11.4 Halting the Search: An Optimality Condition . . . . . . . . . . . . . . . . 445 1 1.5 Ordered Statistic Decoding . . . . . . . . . . . . . . . . . . . . . . . . . . 447 1 1.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 1 1.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 Part I11 Codes on Graphs 12 Convolutional Codes 452 12.1 Introduction and Basic Notation . . . . . . . . . . . . . . . . . . . . . . . 452 12.1.1 TheState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 12.2 Definition of Codes and Equivalent Codes . . . . . . . . . . . . . . . . . . 458 12.2.1 Catastrophic Encoders . . . . . . . . . . . . . . . . . . . . . . . . 461 12.2.2 Polynomial and Rational Encoders . . . . . . . . . . . . . . . . . . 464 12.2.3 Constraint Length and Minimal Encoders . . . . . . . . . . . . . . 465 12.2.4 Systematic Encoders . . . . . . . . . . . . . . . . . . . . . . . . . 468 12.3 Decoding Convolutional Codes . . . . . . . . . . . . . . . . . . . . . . . . 469 12.3.1 Introduction and Notation . . . . . . . . . . . . . . . . . . . . . . 469 12.3.2 The Viterbi Algorithm . . . . . . . . . . . . . . . . . . . . . . . . 471 12.3.3 Some Implementation Issues . . . . . . . . . . . . . . . . . . . . . 481 The Basic Operation: Add-Compare-Select . . . . . . . . . . . . . 481 Decoding Streams of Data: Windows on the Trellis . . . . . . . . . 481 Output Decisions . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 Hard and Soft Decoding; Quantization . . . . . . . . . . . . . . . . 484 Synchronization Issues . . . . . . . . . . . . . . . . . . . . . . . . 486 12.4 Some Performance Results . . . . . . . . . . . . . . . . . . . . . . . . . . 487 12.5 Error Analysis for Convolutional Codes . . . . . . . . . . . . . . . . . . . 491 12.5.1 Enumerating Paths Through the Trellis . . . . . . . . . . . . . . . . 493 Enumerating on More Complicated Graphs: Mason’s Rule . . . . . 496 12.5.2 Characterizing the Node Error Probability P, and the Bit Error Rate Pb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 12.5.3 A Bound on Pd for Discrete Channels . . . . . . . . . . . . . . . . 501 Performance Bound on the BSC . . . . . . . . . . . . . . . . . . . 503 12.5.4 A Bound on Pd for BPSK Signaling Over the AWGN Channel . . . 503 12.5.5 Asymptotic Coding Gain . . . . . . . . . . . . . . . . . . . . . . . 504 12.6 Tables of Good Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505 12.7 Puncturing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507 Puncturing to Achieve Variable Rate . . . . . . . . . . . . . . . . . 509 12.8 SuboptimalDecodingAlgorithmsforConvolutionalCodes . . . . . . . . . 510 12.8.1 Tree Representations . . . . . . . . . . . . . . . . . . . . . . . . . 511 12.8.2 The Fano Metric . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 12.8.3 The Stack Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 515 12.8.4 The Fano Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 517 12.8.5 Other Issues for Sequential Decoding . . . . . . . . . . . . . . . . 520 12.9 Convolutional Codes as Block Codes . . . . . . . . . . . . . . . . . . . . . 522 12.10 Trellis Representations of Block and Cyclic Codes . . . . . . . . . . . . . . 523 12.10.1 Block Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 12.10.2 Cyclic Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 12.10.3 Trellis Decoding of Block Codes . . . . . . . . . . . . . . . . . . . 525 Programming Convolutional Encoders . . . . . . . . . . . . . . . 526 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 12.1 1 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 12.12 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 13 'Ikellis Coded Modulation 535 13.1 Adding Redundancy by Adding Signals . . . . . . . . . . . . . . . . . . . 535 13.2 Background on Signal Constellations . . . . . . . . . . . . . . . . . . . . . 535 13.3 TCM Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 The General Ungerboeck Coding Framework . . . . . . . . . . . . 544 13.3.2 The Set Partitioning Idea . . . . . . . . . . . . . . . . . . . . . . . 545 13.4 Some Error Analysis for TCM Codes . . . . . . . . . . . . . . . . . . . . . 546 13.4.1 General Considerations . . . . . . . . . . . . . . . . . . . . . . . . 546 A Description of the Error Events . . . . . . . . . . . . . . . . . . 548 13.4.3 Known Good TCM Codes . . . . . . . . . . . . . . . . . . . . . . 552 13.5 Decodmg TCM Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 13.6 Rotational Invariance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 Differential Encoding . . . . . . . . . . . . . . . . . . . . . . . . . 558 Constellation Labels and Partitions . . . . . . . . . . . . . . . . . . 559 13.7 Multidimensional TCM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561 13.7.1 Some Advantages of Multidimensional TCM . . . . . . . . . . . . 562 13.7.2 Lattices and Sublattices . . . . . . . . . . . . . . . . . . . . . . . . 563 Basic Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 563 Common Lattices . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 Sublattices and Cosets . . . . . . . . . . . . . . . . . . . . . . . . 566 The Lattice Code Idea . . . . . . . . . . . . . . . . . . . . . . . . 567 Sources of Coding Gain in Lattice Codes . . . . . . . . . . . . . . 567 Some Good Lattice Codes . . . . . . . . . . . . . . . . . . . . . . 571 13.8 The V.34 Modem Standard . . . . . . . . . . . . . . . . . . . . . . . . . . 571 Lab 11 Trellis-Coded Modulation Encoding and Decoding . . . . . . . . 578 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578 13.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578 13.10 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 Part IV Iteratively Decoded Codes 581 14 lbrbo Codes 582 14.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 14.2 Encoding Parallel Concatenated Codes . . . . . . . . . . . . . . . . . . . . 584 14.3 Turbo Decoding Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . 586 14.3.1 The MAP Decoding Algorithm . . . . . . . . . . . . . . . . . . . . 588 14.3.2 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 14.3.3 Posterior Probability . . . . . . . . . . . . . . . . . . . . . . . . . 590 14.3.4 Computing at and pt . . . . . . . . . . . . . . . . . . . . . . . . . 592 14.3.6 Normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594 14.3.7 Summary of the BCJR Algorithm . . . . . . . . . . . . . . . . . . 596 14.3.8 A MatrixNector Formulation . . . . . . . . . . . . . . . . . . . . . 597 14.3.9 Comparison of the Viterbi and BCJR Algorithms . . . . . . . . . . 598 14.3.10 The BCJR Algorithm for Systematic Codes . . . . . . . . . . . . . 598 14.3.11 Turbo Decoding Using the BCJR Algorithm . . . . . . . . . . . . . 600 The Terminal State of the Encoders . . . . . . . . . . . . . . . . . 602 14.3.12 Likelihood Ratio Decoding . . . . . . . . . . . . . . . . . . . . . . 602 Log Prior Ratio Ap. . . . . . . . . . . . . . . . . . . . . . . . . . 603 Log Posterior A,. . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 14.3.13 Statement of the Turbo Decoding Algorithm . . . . . . . . . . . . . 605 14.3.14 Turbo Decoding Stopping Criteria . . . . . . . . . . . . . . . . . . 605 The Cross Entropy Stopping Criterion . . . . . . . . . . . . . . . . 606 The Sign Change Ratio (SCR) Criterion . . . . . . . . . . . . . . . 607 The Hard Decision Aided (HDA) Criterion . . . . . . . . . . . . . 608 14.3.15 Modifications of the MAP Algorithm . . . . . . . . . . . . . . . . 608 The Max-Log-MAP Algorithm . . . . . . . . . . . . . . . . . . . . 608 14.3.16 Corrections to the Max-Log-MAP Algorithm . . . . . . . . . . . . 609 14.3.17 The Soft Output Viterbi Algorithm . . . . . . . . . . . . . . . . . . 610 14.4 On the Error Floor and Weight Distributions . . . . . . . . . . . . . . . . . 612 14.4.1 The Error Floor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612 14.4.2 Spectral Thinning and Random Interleavers . . . . . . . . . . . . . 614 14.4.3 On Interleavers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618 14.5 EXIT Chart Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619 14.5.1 TheEXITChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622 Block Turbo Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623 14.7 Turbo Equalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626 14.7.1 Introduction to Turbo Equalization . . . . . . . . . . . . . . . . . . 626 14.7.2 The Framework for Turbo Equalization . . . . . . . . . . . . . . . 627 Lab 12 Turbo Code Decoding . . . . . . . . . . . . . . . . . . . . . . . . . 629 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629 Programming Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629 14.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629 14.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632 15 Low-Density Parity-Check Codes 634 15.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634 15.2 LDPC Codes: Construction and Notation . . . . . . . . . . . . . . . . . . . 635 15.3 Tanner Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638 15.4 Transmission Through a Gaussian Channel . . . . . . . . . . . . . . . . . . 638 15.5 Decoding LDPC Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640 15.5.1 The Vertical Step: Updating qmn(x) . . . . . . . . . . . . . . . . . 641 15.5.2 Horizontal Step: Updating rmn (x) . . . . . . . . . . . . . . . . . . 644 15.5.3 Terminating andInitializing the Decoding Algorithm . . . . . . . . 647 15.5.4 Summary of the Algorithm . . . . . . . . . . . . . . . . . . . . . . 648 15.5.5 Message Passing Viewpoint . . . . . . . . . . . . . . . . . . . . . 649 15.5.6 Likelihood Ratio Decoder Formulation . . . . . . . . . . . . . . . 649 15.6 Why Low-Density Parity-Check Codes? . . . . . . . . . . . . . . . . . . . 653 15.7 The Iterative Decoder on General Block Codes . . . . . . . . . . . . . . . . 654 15.8 Density Evolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655 15.9 EXIT Charts for LDPC Codes . . . . . . . . . . . . . . . . . . . . . . . . 659 15.10 Irregular LDPC Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 660 15.10.1 Degree Distribution Pairs . . . . . . . . . . . . . . . . . . . . . . . 662 15.10.2 Some Good Codes . . . . . . . . . . . . . . . . . . . . . . . . . . 664 15.10.3 Density Evolution for Irregular Codes . . . . . . . . . . . . . . . . 664 15.10.4 Computation and Optimization of Density Evolution . . . . . . . . 667 15.10.5 Using Irregular Codes . . . . . . . . . . . . . . . . . . . . . . . . 668 15.1 1 More on LDPC Code Construction 668 15.1 1.1 A Construction Based on Finite Geometries . . . . . . . . . . . . . 668 15.1 1.2 Constructions Based on Other Combinatoric Objects . . . . . . . . 669 15.12 Encoding LDPC Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 15.13 A Variation: Low-Density Generator Matrix Codes . . . . . . . . . . . . . 671 15.14 Serial Concatenated Codes; Repeat-Accumulate Codes . . . . . . . . . . . 671 15.14.1 Irregular RA Codes . . . . . . . . . . . . . . . . . . . . . . . . . . 673 Lab 13 Programming an LDPC Decoder . . . . . . . . . . . . . . . . . . . 674 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675 Numerical Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . 675 15.15 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 15.16 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679 16.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 16.2 Operations in Semirings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 16.3 Functions on Local Domains . . . . . . . . . . . . . . . . . . . . . . . . . 681 16.4 Factor Graphs and Marginalization . . . . . . . . . . . . . . . . . . . . . . 686 Marginalizing on a Single Variable . . . . . . . . . . . . . . . . . . 687 16.4.2 Marginalizing on All Individual Variables . . . . . . . . . . . . . . 691 16.5 Applications to Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 16.5.1 Blockcodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 16.5.2 ModificationstoMessagePassingfor Binary Variables . . . . . . . 695 16.5.3 Trellis Processing and the FonvardBackward Algorithm . . . . . . 696 16.5.4 Turbo Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 Summary of Decoding Algorithms on Graphs . . . . . . . . . . . . . . . . 699 16.7 Transformations of Factor Graphs . . . . . . . . . . . . . . . . . . . . . . . 700 16.7.1 Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700 16.7.2 Stretching Variable Nodes . . . . . . . . . . . . . . . . . . . . . . 701 16.7.3 Exact Computation of Graphs with Cycles . . . . . . . . . . . . . . 702 16.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 16.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708 16 Decoding Algorithms on Graphs 680 16.4.1 16.6 Part V Space-Time Coding 709 17 Fading Channels and Space-Time Codes 710 17.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710 17.2 Fading Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710 17.2.1 Rayleigh Fading . . . . . . . . . . . . . . . . . . . . . . . . . . . 712 . . . . . . . . 714 17.3.1 The Narrowband MIMO Channel . . . . . . . . . . . . . . . . . . 716 17.3.2 Diversity Performance with Maximal-Ratio Combining . . . . . . . 717 17.4 Space-Time Block Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 719 17.4.1 The Alamouti Code . . . . . . . . . . . . . . . . . . . . . . . . . . 719 17.4.2 A More General Formulation . . . . . . . . . . . . . . . . . . . . . 721 17.4.3 Performance Calculation . . . . . . . . . . . . . . . . . . . . . . . 721 Real Orthogonal Designs . . . . . . . . . . . . . . . . . . . . . . . 723 EncodingandDecodingBasedonOrthogonalDesigns . . . . . . . 724 Generalized Real Orthogonal Designs . . . . . . . . . . . . . . . . 726 17.4.4 Complex Orthogonal Designs . . . . . . . . . . . . . . . . . . . . 727 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 Space-Time Trellis Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 17.5.1 Concatenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 17.6 How Many Antennas? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 17.7 Estimating Channel Information . . . . . . . . . . . . . . . . . . . . . . . 733 17.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 17.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 A Log Likelihood Algebra 735 A.l Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 References Index 739 750
package com.hexiang.utils; import java.sql.*; import java.util.*; /** * * Title: 数据库工具类 * * * Description: 将大部分的数据库操作放入这个类中, 包括数据库连接的建立, 自动释放等. * * * @author beansoft 日期: 2004年04月 * @version 2.0 */ public class DatabaseUtil { /** 数据库连接 */ private java.sql.Connection connection; /** * All database resources created by this class, should be free after all * operations, holds: ResultSet, Statement, PreparedStatement, etc. */ private ArrayList resourcesList = new ArrayList(5); public DatabaseUtil() { } /** 关闭数据库连接并释放所有数据库资源 */ public void close() { closeAllResources(); close(getConnection()); } /** * Close given connection. * * @param connection * Connection */ public static void close(Connection connection) { try { connection.close(); } catch (Exception ex) { System.err.println("Exception when close a connection: " + ex.getMessage()); } } /** * Close all resources created by this class. */ public void closeAllResources() { for (int i = 0; i < this.getResourcesList().size(); i++) { closeJDBCResource(getResourcesList().get(i)); } } /** * Close a jdbc resource, such as ResultSet, Statement, Connection.... All * these objects must have a method signature is void close(). * * @param resource - * jdbc resouce to close */ public void closeJDBCResource(Object resource) { try { Class clazz = resource.getClass(); java.lang.reflect.Method method = clazz.getMethod("close", null); method.invoke(resource, null); } catch (Exception e) { // e.printStackTrace(); } } /** * 执行 SELECT 等 SQL 语句并返回结果集. * * @param sql * 需要发送到数据库 SQL 语句 * @return a ResultSet object that contains the data produced * by the given query; never null */ public ResultSet executeQuery(String sql) { try { Statement statement = getStatement(); ResultSet rs = statement.executeQuery(sql); this.getResourcesList().add(rs); this.getResourcesList().add(statement);// BUG fix at 2006-04-29 by BeanSoft, added this to res list // MySql 数据库要求必需关闭 statement 对象, 否则释放不掉资源 // - 此观点错误, 因为关闭此对象后有时数据无法读出 //statement.close(); return rs; } catch (Exception ex) { System.out.println("Error in executeQuery(\"" + sql + "\"):" + ex); // ex.printStackTrace(); return null; } } /** * Executes the given SQL statement, which may be an INSERT, * UPDATE, or DELETE statement or an SQL * statement that returns nothing, such as an SQL DDL statement. 执行给定的 SQL * 语句, 这些语句可能是 INSERT, UPDATE 或者 DELETE 语句, 或者是一个不返回任何东西的 SQL 语句, 例如一个 SQL * DDL 语句. * * @param sql * an SQL INSERT,UPDATE or * DELETE statement or an SQL statement that * returns nothing * @return either the row count for INSERT, * UPDATE or DELETE statements, or * 0 for SQL statements that return nothing */ public int executeUpdate(String sql) { try { Statement statement = getStatement(); return statement.executeUpdate(sql); // MySql 数据库要求必需关闭 statement 对象, 否则释放不掉资源 // - 此观点错误, 因为关闭此对象后有时数据无法读出 //statement.close(); } catch (Exception ex) { System.out.println("Error in executeUpdate(): " + sql + " " + ex); //System.out.println("executeUpdate:" + sql); ex.printStackTrace(); } return -1; } /** * 返回记录总数, 使用方法: getAllCount("SELECT count(ID) from tableName") 2004-06-09 * 可滚动的 Statement 不能执行 SELECT MAX(ID) 之类的查询语句(SQLServer 2000) * * @param sql * 需要执行的 SQL * @return 记录总数 */ public int getAllCount(String sql) { try { Statement statement = getConnection().createStatement(); this.getResourcesList().add(statement); ResultSet rs = statement.executeQuery(sql); rs.next(); int cnt = rs.getInt(1); rs.close(); try { statement.close(); this.getResourcesList().remove(statement); } catch (Exception ex) { ex.printStackTrace(); } return cnt; } catch (Exception ex) { System.out.println("Exception in DatabaseUtil.getAllCount(" + sql + "):" + ex); ex.printStackTrace(); return 0; } } /** * 返回当前数据库连接. */ public java.sql.Connection getConnection() { return connection; } /** * 连接新的数据库对象到这个工具类, 首先尝试关闭老连接. */ public void setConnection(java.sql.Connection connection) { if (this.connection != null) { try { getConnection().close(); } catch (Exception ex) { } } this.connection = connection; } /** * Create a common statement from the database connection and return it. * * @return Statement */ public Statement getStatement() { // 首先尝试获取可滚动的 Statement, 然后才是普通 Statement Statement updatableStmt = getUpdatableStatement(); if (updatableStmt != null) return updatableStmt; try { Statement statement = getConnection().createStatement(); this.getResourcesList().add(statement); return statement; } catch (Exception ex) { System.out.println("Error in getStatement(): " + ex); } return null; } /** * Create a updatable and scrollable statement from the database connection * and return it. * * @return Statement */ public Statement getUpdatableStatement() { try { Statement statement = getConnection() .createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); this.getResourcesList().add(statement); return statement; } catch (Exception ex) { System.out.println("Error in getUpdatableStatement(): " + ex); } return null; } /** * Create a prepared statement and return it. * * @param sql * String SQL to prepare * @throws SQLException * any database exception * @return PreparedStatement the prepared statement */ public PreparedStatement getPreparedStatement(String sql) throws SQLException { try { PreparedStatement preparedStatement = getConnection() .prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); this.getResourcesList().add(preparedStatement); return preparedStatement; } catch (Exception ex) { ex.printStackTrace(); } return null; } /** * Return the resources list of this class. * * @return ArrayList the resources list */ public ArrayList getResourcesList() { return resourcesList; } /** * Fetch a string from the result set, and avoid return a null string. * * @param rs * the ResultSet * @param columnName * the column name * @return the fetched string */ public static String getString(ResultSet rs, String columnName) { try { String result = rs.getString(columnName); if (result == null) { result = ""; } return result; } catch (Exception ex) { } return ""; } /** * Get all the column labels * * @param resultSet * ResultSet * @return String[] */ public static String[] getColumns(ResultSet resultSet) { if (resultSet == null) { return null; } try { ResultSetMetaData metaData = resultSet.getMetaData(); int numberOfColumns = metaData.getColumnCount(); if (numberOfColumns <= 0) { return null; } String[] columns = new String[numberOfColumns]; //System.err.println("numberOfColumns=" + numberOfColumns); // Get the column names for (int column = 0; column < numberOfColumns; column++) { // System.out.print(metaData.getColumnLabel(column + 1) + "\t"); columns[column] = metaData.getColumnName(column + 1); } return columns; } catch (Exception ex) { ex.printStackTrace(); } return null; } /** * Get the row count of the result set. * * @param resultset * ResultSet * @throws SQLException * if a database access error occurs or the result set type is * TYPE_FORWARD_ONLY * @return int the row count * @since 1.2 */ public static int getRowCount(ResultSet resultset) throws SQLException { int row = 0; try { int currentRow = resultset.getRow(); // Remember old row position resultset.last(); row = resultset.getRow(); if (currentRow > 0) { resultset.absolute(row); } } catch (Exception ex) { ex.printStackTrace(); } return row; } /** * Get the column count of the result set. * * @param resultSet * ResultSet * @return int the column count */ public static int getColumnCount(ResultSet resultSet) { if (resultSet == null) { return 0; } try { ResultSetMetaData metaData = resultSet.getMetaData(); int numberOfColumns = metaData.getColumnCount(); return numberOfColumns; } catch (Exception ex) { ex.printStackTrace(); } return 0; } /** * Read one row's data from result set automatically and put the result it a * hashtable. Stored as "columnName" = "value", where value is converted to * String. * * @param resultSet * ResultSet * @return Hashtable */ public static final Hashtable readResultToHashtable(ResultSet resultSet) { if (resultSet == null) { return null; } Hashtable resultHash = new Hashtable(); try { String[] columns = getColumns(resultSet); if (columns != null) { // Read data column by column for (int i = 0; i < columns.length; i++) { resultHash.put(columns[i], getString(resultSet, columns[i])); } } } catch (Exception ex) { ex.printStackTrace(); } return resultHash; } /** * Read data from result set automatically and put the result it a * hashtable. Stored as "columnName" = "value", where value is converted to * String. * * Note: assume the default database string encoding is ISO8859-1. * * @param resultSet * ResultSet * @return Hashtable */ @SuppressWarnings("unchecked") public static final Hashtable readResultToHashtableISO(ResultSet resultSet) { if (resultSet == null) { return null; } Hashtable resultHash = new Hashtable(); try { String[] columns = getColumns(resultSet); if (columns != null) { // Read data column by column for (int i = 0; i < columns.length; i++) { String isoString = getString(resultSet, columns[i]); try { resultHash.put(columns[i], new String(isoString .getBytes("ISO8859-1"), "GBK")); } catch (Exception ex) { resultHash.put(columns[i], isoString); } } } } catch (Exception ex) { ex.printStackTrace(); } return resultHash; } /** Test this class. */ public static void main(String[] args) throws Exception { DatabaseUtil util = new DatabaseUtil(); // TODO: 从连接池工厂获取连接 // util.setConnection(ConnectionFactory.getConnection()); ResultSet rs = util.executeQuery("SELECT * FROM e_hyx_trans_info"); while (rs.next()) { Hashtable hash = readResultToHashtableISO(rs); Enumeration keys = hash.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); System.out.println(key + "=" + hash.get(key)); } } rs.close(); util.close(); } }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值