spawn(fun() -> crash:crash() end)
{error,<0.90.0>,
{emulator,"~s~n",
["Error in process <0.104.0> on node 'nonode@nohost'
with exit value: {undef,[{crash,crash,[],[]}]}\n"]}}
Error in process <0.104.0> on node 'nonode@nohost' with exit value: {undef,[{crash,crash,[],[]}]}
handle_call(crash, _From, State) ->
erlang:error(smth),
{error_report,<0.287.0>, {<0.3382.0>,crash_report,
[[{initial_call,{my_server,init,['Argument__1']}},
{pid,<0.3382.0>}, {registered_name,my_server},
{error_info, {exit, {smth, %Stacktrace%}, %Stacktrace2%}},
{ancestors,[crash_sampler_sup,<0.288.0>]},
{messages,[]}, {links,[<0.289.0>]},
{dictionary,[]}, {trap_exit,false},
{status,running}, {heap_size,987},
{stack_size,27}, {reductions,214}],
[]]}}
CRASH REPORT Process my_server with 0 neighbours exited with reason: smth in my_server:handle_call/3 line 31 in gen_server:terminate/7 line 826
handle_call(crash, _From, State) ->
erlang:error(smth),
{error,<0.112.0>, {<0.115.0>,
"** Generic server ~p terminating \n ** Last message in was ~p~n
** When Server state == ~p~n ** Reason for termination == ~n** ~p~n",
[my_server,crash, {state}, {smth,
[{my_server,handle_call,3, [{file,
"/projects/crash_sampler/_build/default/lib/crash_sampler/src/my_server.erl"},
{line,30}]},
...
gen_server my_server terminated with reason: smth in my_server:handle_call/3 line 30
handle_call(crash, _From, State) ->
{stop, reason, ok, State};
gen_server my_server2 terminated with reason: reason
CRASH REPORT Process my_server2 with 0 neighbours exited with reason: reason in gen_server:handle_msg/5 line 677
gen_server my_server2 terminated with reason: kill in my_server2:handle_call/3 line 34
CRASH REPORT Process my_server2 with 0 neighbours exited with reason: kill in gen_server:terminate/7 line 826
gen_server my_server2 terminated with reason: smth2 in my_server2:terminate/2 line 48
CRASH REPORT Process my_server2 with 0 neighbours exited with reason: smth2 in gen_server:terminate/7 line 814
-module(my_server).
handle_call(crash, _From, State) ->
my_server2:crash(),
...
-module(my_server2).
handle_call(crash, _From, State) ->
exit(smth2),
...
gen_server my_server terminated with reason: {smth2,{gen_server,call,[my_server2,crash]}} in gen_server:call/2 line 204
CRASH REPORT Process my_server with 0 neighbours exited with reason: {smth2,{gen_server,call,[my_server2,crash]}} in gen_server:terminate/7 line 826
handle_call(crash, _From, State) ->
crash:crash(smth),
{error_report,<0.90.0>, {<0.92.0>,supervisor_report,
[{supervisor,{<0.92.0>,bernhard_sup}},
{errorContext,child_terminated},
{reason,{undef,[{crash,crash,[],[]}]}},
{offender,[{pid,<0.94.0>},
{name,my_server}, {mfargs,{my_server,start_link,[]}},
{restart_type,permanent}, {shutdown,5000},
{child_type,worker}]}]}}
Supervisor {<0.92.0>,bernhard_sup} had child my_server started with my_server:
start_link() at <0.94.0> exit with reason call to undefined function crash:crash()
in context child_terminated
gen_server my_server terminated with reason: reason
CRASH REPORT Process my_server with 0 neighbours exited with reason: reason in gen_server:terminate/7 line 826
-module('crash_sampler_sup').
...
#{id => my_sup, start => {my_sup, start_link, []}}
exit(whereis(crash_sampler_sup), kill).
gen_server my_sup terminated with reason: killed
SupFlags = #{strategy => one_for_all, intensity => 1, period => 1},
ChildSpecs = [
#{id => my_server, start => {my_server, start_link, []}},
#{id => my_server2, start => {my_server2, start_link, []}},
exit(whereis(my_server), kill).
Будет ли сообщение о падении my_server2?


Author: Lee Newson
Level: Beginner
Technologies: JAX-WS
Summary: The helloworld-ws
quickstart demonstrates a simple Hello World application, bundled and deployed as a WAR, that uses JAX-WS to say Hello.
Target Product: JBoss EAP
Source: https://github.com/jbossas/eap-quickstarts/
The helloworld-ws
quickstart demonstrates the use of JAX-WS in Red Hat JBoss Enterprise Application Platform as a simple Hello World application.
The application this project produces is designed to be run on Red Hat JBoss Enterprise Application Platform 7.1 or later.
All you need to build this project is Java 8.0 (Java SDK 1.8) or later and Maven 3.3.1 or later. See Configure Maven for JBoss EAP 7.1 to make sure you are configured correctly for testing the quickstarts.
In the following instructions, replace EAP7_HOME
with the actual path to your JBoss EAP installation. The installation path is described in detail here: Use of EAP7_HOME and JBOSS_HOME Variables.
For Linux: EAP7_HOME/bin/standalone.sh
For Windows: EAP7_HOME\bin\standalone.bat
mvn clean install wildfly:deploy
This will deploy target/helloworld-ws.war
to the running instance of the server.
JBWS024061: Adding service endpoint metadata: id=org.jboss.as.quickstarts.wshelloworld.HelloWorldServiceImpl
address=http://localhost:8080/helloworld-ws/HelloWorldService
implementor=org.jboss.as.quickstarts.wshelloworld.HelloWorldServiceImpl
serviceName={http://www.jboss.org/eap/quickstarts/wshelloworld/HelloWorld}HelloWorldService
portName={http://www.jboss.org/eap/quickstarts/wshelloworld/HelloWorld}HelloWorld
annotationWsdlLocation=null
wsdlLocationOverride=null
mtomEnabled=false
You can verify that the Web Service is running and deployed correctly by accessing the following URL: http://localhost:8080/helloworld-ws/HelloWorldService?wsdl. This URL will display the deployed WSDL endpoint for the Web Service.
mvn wildfly:undeploy
This quickstart provides Arquillian tests. By default, these tests are configured to be skipped as Arquillian tests require the use of a container.
mvn clean verify -Parq-remote
You can also let Arquillian manage the JBoss EAP server by using the arq-managed
profile. For more information about how to run the Arquillian tests, see Run the Arquillian Tests.
The following expected output should appear. The output shows what was said to the Web Service by the client and the responses it received.
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.jboss.as.quickstarts.wshelloworld.ClientArqTest
[Client] Requesting the WebService to say Hello.
[WebService] Hello World!
[Client] Requesting the WebService to say Hello to John.
[WebService] Hello John!
[Client] Requesting the WebService to say Hello to John, Mary and Mark.
[WebService] Hello John, Mary & Mark!
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.988 sec
You can also start the server and deploy the quickstarts or run the Arquillian tests from Eclipse using JBoss tools. For general information about how to import a quickstart, add a JBoss EAP server, and build and deploy a quickstart, see Use JBoss Developer Studio or Eclipse to Run the Quickstarts.
When you deploy this quickstart, you are presented with a window that explains there is no user interface for this quickstart and directs you to click on a link to view the WSDL definition. However, the Eclipse browser does not support the display of WSDL definitions. Instead, open an external browser and access the following URL: http://localhost:8080/helloworld-ws/HelloWorldService?wsdl. This URL will display the deployed WSDL endpoint for the Web Service.
If you want to debug the source code of any library in the project, run the following command to pull the source into your local repository. The IDE should then detect it.
mvn dependency:sources


Nawaz Sharif looks totally fine in UK: Imran Khan
He said that he looked at the medical report of Nawaz Sharif which stated he has around 15 different diseases.
by Shafqat AliIslamabad: Pakistan Prime Minister Imran Khan on Friday said he was informed that Pakistan Muslim League supremo Nawaz Sharif could die any minute if he does not go abroad, but he looked totally fine with just a glance of the air ambulance.
He said that he looked at the medical report of Nawaz Sharif which stated he has around 15 different diseases like heart problem, kidney, diabetes including platelets issues and other diseases.“I was stunned when I saw him boarding the air ambulance, thinking that maybe the plane did a wonder and recovered his health,” he said, adding maybe it is the air of London or the planes which has done which even the doctors could not do in Pakistan.


TIFF CHANGE INFORMATION
This document describes the changes made to the software between the
previous and current versions (see above).
If you don't find something listed here, then it was not done in this
timeframe, or it was not considered important enough to be mentioned.
The following information is located here:
MAJOR CHANGES:
- Significant changes in software configuration: we are switched
to GNU autotools now.
- tiffset: tiffset now can set any libtiff supported tags. Tags
can be supplied by the mnemonic name or number.
CHANGES IN THE SOFTWARE CONFIGURATION:
- Get rid of the old configuration system and switch to
GNU autotools.
CHANGES IN LIBTIFF:
- libtiff/tif_ojpeg.c: Fixed problem with duplicated SOI and SOF
markers as per bug
.
- libtiff/{tif_open.c, tiffio.h}: New function added:
TIFFIsBigEndian(). Function returns nonzero if given was file written
in big-endian order.
- libtiff/tif_print.c: added (untested) support for printing
SSHORT, SLONG and SRATIONAL fields.
- libtiff/tif_fax3.c: Avoid reading CCITT compression options
if compression type mismatches. See
http://bugzilla.remotesensing.org/show_bug.cgi?id=565.
- libtiff/tif_strip.c: Never return 0 from the TIFFNumberOfStrips().
- libtiff/tif_dirread.c: Workaround for broken TIFF writers which
store single SampleFormat value for multisampled images. See
http://bugzilla.remotesensing.org/show_bug.cgi?id=562.
- libtiff/tif_write.c: Allow in-place updating of the compressed
images (don't work properly with all codecs). For details see GDAL bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=534.
- libtiff/tif_jpeg.c: Workaround for wrong sampling factors used
in the Intergarph JPEG compressed TIFF images as per bug:
http://bugzilla.remotesensing.org/show_bug.cgi?id=532.
- libtiff/tif_open.c: Use dummy mmap/munmap functions in
TIFFClientOpen() when the appropriate client functions was not
supplied by user.
- libtiff/tif_dirread.c: Fixed problem with handling TIFF_UNDEFINED
tag type in TIFFFetchNormalTag() as per bug
.
- libtiff/tif_codec.c: Fixed typo in TIFFInitPackBits name as per:
http://bugzilla.remotesensing.org/show_bug.cgi?id=494.
- libtiff/tif_fax3.c: Fixed problem, introdiced in 3.6.1 release,
with the CCITT encoding modes as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=483.
We need more work on fax codec to support update mode.
- libtiff/tiff.h: Fixed tag definitions for TIFFTAG_YCLIPPATHUNITS
and TIFFTAG_INDEXED as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=475.
- libtiff/{tif_win32.c, tif_unix.c}: Check whether the pointer is
NULL before proceeding further as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=474.
Check results, returned by the TIFFFdOpen() before returning and close
file if TIFFFdOpen() failed as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=468.
- libtiff/{libtiff.def, tif_close.c, tiffio.h, tif_open.c}:
Separate TIFFCleanup() from the TIFFClose() in order to fix the bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=468.
- libtiff/tif_dirwrite.c: Fixed handling of writable ASCII tags
that are field_passcount=TRUE properly. Arguably anonymous custom
tags should be declared as passcount=FALSE, but I don't want to change
that without a careful review.
- libtiff/tif_write.c: Fixed reporting size of the buffer in case
of stripped image in TIFFWriteBufferSetup(). As per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=460.
- libtiff/tif_dir.c: Incomplete cleanup in TIFFFreeDirectory(),
patch from Gerben Koopmans.
- libtiff/tif_dirread.c: Check field_passcount value before setting
the value of undefined type, patch from Gerben Koopmans.
- libtiff/{tiff.h, tif_fax3.c}:Fixes for AMD 64 platform as
suggested by Jeremy C. Reed.
- libtiff/tif_win32.c: Fixed problem with _TIFFrealloc() when
the NULL pointer passed. Patch supplied by Larry Grill.
CHANGES IN THE TOOLS:
CHANGES IN THE CONTRIB AREA:
- Outdated stuff removed.
- Almost all programs are sinchronized with the current libtiff
and should compile without problems.
CHANGES IN THE LZW COMPRESSION
KIT:
TIFF home page.
Last updated $Date: 2016-09-25 20:05:45 $.


Browser known limitations
Depending on your browser settings, new windows open in tab or separate window
Depending on your graphic card performances: Scrolling display from menu, sections and box as stock movement history could be slow
2.3.0 (01/09/2022)
Global : View application contents is a new right.
There is no read only access with a sucessful authentication.
Java Library : Evolution Log4j 2.17.1 -> 2.18.0
Bug : Rights were not applied when user default context was different from the one from role or application default
2.2.0 (13/03/2022)
Java Library : Evolution Apache Commons IO 2.6 -> 2.11
Java Library : Evolution Apache Commons Lang 3.9 -> 3.12
Java Library : Evolution Apache Commons Configuration 2.5 -> 2.7
Java Library : Evolution Apache Commons Collections 4.4.3 -> 4.4.4
Java Library : Evolution Apache Commons BeanUtils 1.9.3 -> 1.9.4
Java Library : Evolution Apache Commons Text 1.7 -> 1.9
Java Library : Evolution Apache Commons Compress 1.18 -> 1.21
Java Library : Evolution Apache Mina 2.0.21 -> 2.0.22
Java Library : Evolution Apache CXF 3.3.2 -> 3.5.0
Java Library : Evolution Apache POI 4.1.0 -> 5.2.0
Java Library : Evolution Apache XmlBeans 3.1.0 -> 5.0.3
Java Library : Evolution Gson 2.8.5 -> 2.9.0
Java Library : Evolution Log4j 1.2.17 -> 2.17.1
Java Library : Evolution SLF4J 1.7.26 -> 1.7.36
Bug : Photo Album, no dates display without photo admin right
Bug : API, wrong value of template right
Bug : IP, fix search functions
Bug : NAS, quick sorts only work on firt page loaded
API : Add Template as new API rights
2.1.0 (21/08/2019)
Bug : Fix Mime type for excel files
Data : Add Excel export
IP : Add mac vendor search on MAC address. Enable/disable in user preferences
NAS : Infinite Scroll and full table search in Clients/Sites/Devices/Plannings
Stock : Infinite Scroll and full table search in Categories/Types/Stocks
New feature : Templates Management
Templates : Standardized Site (Enumeration of vlans and subnets. Subnets contained in a global surnet)
Templates : Non-standardized Site (Enumeration of vlans. Subnets to be found in surnets list. No global surnet)
Admin : Add role Template
Admin : Modify site page to use templates
API Admin : Modify to use templates
API Template : New endpoints to view template components
2.0.2 (19/07/2019)
Bug : MAC Adress field was not considered as text during search
bug : Display of mask in tooltip was in database format
Bug : When deleting a line and array becomes empty, javascript error
Bug : When no mail to sent in jobs MailTemp and MailMig, null pointer error
Bug : Authentication with an account without mail defined, if suffix empty, java error
Bug : Unable to change logo with big sized picture
Bug : Select IP in Admin/Redundancy, no action if search field empty
Global : Clean Excel files producing in IP, Stock, NAS
Java Library : Evolution Apache Commons FileUpload 1.3.3 -> 1.4
Java Library : Evolution Apache Commons Lang 3.7 -> 3.9
Java Library : Evolution Apache Commons Configuration 2.2 -> 2.5
Java Library : Evolution Apache Directory LDAP API 1.0.0 -> 1.0.3
Java Library : Evolution Apache CXF 3.2.4 -> 3.3.2
Java Library : Evolution Apache Mina 2.0.16 -> 2.0.21
Java Library : Evolution Jasypt 1.9.2 -> 1.9.3
Java Library : Evolution Gson 2.8.3 -> 2.8.5
Java Library : Evolution Quartz 2.2.3 -> 2.3.0
Java Library : Evolution Log4j 1.2.16 -> 1.2.17
Java Library : Evolution Slf4j 1.7.25 -> 1.7.26
Java Library : Evolution Java Mail 1.6.1 -> 1.6.2
Java Library : Add Apache Commons Text 1.7
Java Library : Add Apache POI 4.1.0
2.0.1 (06/03/2019)
Global/Log: Use log4j for database.log file, delete photo.log
Admin/CSV: Raise CSV imports limits
Datas/Subnets: Add surnet informations
Bug-Network/Subnets: When changing ip/mask, wrong number of parameters
Bug-Global: Bad position computing during scrolling
2.0.0 (04/03/2019)
Global : Move site management in Network rather than Admin
Data : Infinite Scroll and full table search in Sites/Subnets/Vlans/Redundancy/Subnets Fill Rate
Data : Add database ID in various tables. Might be useful in CSV Import/Export
Help : Add Data category
Admin : Infinite Scroll and full table search in DHCP
Admin/Schedulers : Add Java jobs name
Network : Infinite Scroll and full table search in Sites/Subnets/Vlans/Redundancy/Tools
Photos : Infinite Scroll and full table search in Rooms/Sets/Racks
Norm : Subnet Calculator available for read-only users
Bug-Admin/CSV : Subnet import take into account vlan changes
1.9.9 (06/01/2019)
Admin/DHCP : New button to test DHCP server connection
Admin/Schedulers : Reformat page style
Admin/Schedulers : Most of jobs can be triggered manually
Install/PGSQL : Verify language plpgsql is declared before creating triggers
Bug-Admin/Directory : In PGSQL can't modify a directory once created
Bug-Admin/Schedulers : PurgeUsers doesn't work, add log line when no deletions
Bug-IP/Available : When subnet full and search available IP, index problem resulting in error
1.9.8 (22/07/2018)
Network/Subnet : Can't add an identical subnet with same site/ip/mask
Admin/DHCP : A DHCP server can be deactivated
Admin/DHCP : Default port added on server types
API : Rights review on API endpoints
Database : Remove context from tables vlan and supply
Bug : Available IP merge of multiple ips on one entry, wrong analysis on subnet last address
1.9.7 (16/06/2018)
Admin/Global : Allow testing of the Cacti MySQL connection
Admin/DHCP : DHCP Servers and their scopes exclusions management page
Scheduled tasks : Gathering DHCP informations from declared servers
Bug : Cacti statistics gathering, if a device is not present in adrezo database, issue a warning and not a blocking error
1.9.6 (06/05/2018)
API StockAdmin : Sites List of given context with information on main site
API StockAdmin : Type Informations. Type Creation/Deletion/Modification. Type List of given site
API StockAdmin : Category Informations. Category Creation/Deletion/Modification. Category List
API Stock : Supply Informations. Supply List of given site. Supply Modification
API Stock : Supply Movements history
API Photo : Room Informations. Room Creation/Deletion/Modification. Room List of given site
API Photo : Set Informations. Set Creation/Deletion/Modification. Set List of given room
API Photo : Rack Informations. Rack Creation/Deletion/Modification. Rack List of given set
API Photo : Pictures List of given room. Pictures List of given rack
Java Library : Evolution Apache CXF 3.2.1 -> 3.2.4
Java Library : Evolution Gson 2.8.2 -> 2.8.3
Java Library : Evolution Java Mail 1.6.0 -> 1.6.1
Java Library : Evolution Slf4j 1.7.7 -> 1.7.25
1.9.5 (29/04/2018)
Update : Admin credentials to proceed
Install : Minor changes to install page
NAS : Transform perl scripts to java jobs for Cacti NAS
NAS : Gather hourly,daily or monthly availability from Cacti with aggregation through monthly stats
NAS : Planning to define maintenance time
1.9.4 (05/04/2018)
DB : PostgreSQL 10.3 support
Photos Upload : Temporary record in database before file processing
1.9.3 (28/03/2018)
Evolution : Javax Naming -> Apache Directory 1.0.0
LDAP : Connections Pool
LDAP : SSL Enabled Connections
LDAP : Search groups with attributes member,memberOf with/without nested groups
Login : Search mail in user account when exploitation account used to login
Bug - Admin/Context : Last remaining context must not be deleted
API v2 : With Authentication/Authorization filters
API Network : Subnets Creation/Deletion. Subnets List of given site
API Network : Vlan Informations. Vlans Creation/Deletion. Vlans List of given site
API Admin : Context Informations. Context Modification. Contexts List. Sites List of given context
API Admin : Site Informations. Site Creation/Deletion/Modification
1.9.2 (25/01/2018)
Global : Translations improvements
Evolution : Javax Json 1.0.4 -> Gson 2.8.2
Evolution : Oracle JDBC Driver 11 -> 12
Code : Checking database connection clean close
Bug : Jobs IP Temp/Mig, empty or non existing mail field was not managed
1.9.1 (14/01/2018)
Evolution : Jersey 1.19.1 -> Apache CXF 3.2.1
Admin : More parameters to send email
Photos : Add basic slideshow
Stock : Moves between stocks
IP : Available IP can be sent to migrating field if active
IP : Informations on migrating IP in add zone
Job : Automatic insertion of new subnets in norm
UerPrefs : Modification of slideshow timeout
1.9.0 (05/01/2018)
Evolution : Java 6 -> Java 8
Evolution : Weblogic 11 -> Tomcat 8.5
Evolution : Apache Commons Lang 3.5 -> 3.7
Evolution : JMail 1.5.1 -> Apache Commons Email 1.5
Evolution : JAI 1.1.3 -> ImgScalr 4.2
Evolution : JCIFS 1.3.17 -> 1.3.19
Evolution : Apache Commons FileUpload 1.3 -> 1.3.3
Java : Using Apache Commons Configurations 2.2
Global : Reformating logs
Bug : Check IP broadcast and gateway are in specified subnet in Network/Subnets
Bug : Check ID is a number in Network/Redundancy
Bug : More length to login and password fields in login page
Bug : Correct some translations in photo upload
Bug : IP modifying address, error reading migration date in some cases
1.8 (30/11/2016)
New module : Scheduled Tasks
Scheduled Tasks : cleanup users table
Scheduled Tasks : cleanup supply moves history
Scheduled Tasks : photo physical files cleanup
Scheduled Tasks : mail sent to users when date of migrating or temporary IP are exceeded
Global : update logs management
Bug : in photos racks, all choices were displayed even if already occupied
1.7 (20/11/2016)
Mail : Mail content Internationalization
SDR : Admin, Statistics table cleanup
1.6 (19/11/2016)
API : ipname, Change to give the first available index
API : mysubnet, authorized subnets list
API : subnet, attributes of given subnet
API: subnetip, IP list of given subnet
Photo : Add photo upload date in database when created or replaced
Photo : Display photo upload date and compute oldest and newest date for the entire page
Bug : Close Button absent when replacing a photo
1.5 (06/11/2016)
General : Change in homepage to insert logo
Admin Directory : With LDAP, paging process of ldap answers
New module : API for IP adresses management with associated admin page
Bug Calendar : August was missing in an array. Shift in display occurs
Bug Infos : Subnets Fill doesn't take into account IP with null description
Bug Directory : Default values were not applied when field was empty
1.4 (01/05/2016)
Norme : Subnet Calculator which may be disabled on a surnet basis
Norme : Subnet verification (warn only)
Network : Subnet verification, broadcast automatic computing
1.3 (10/03/2016)
General : Packaging Java
Admin : Management of homepage logo
Admin : Rewrite page Sites
Network : Rewrite pages Subnets, Vlans
Photos : Rewrite pages Rooms, Sets, Racks
User : Setting to disable urls display on IP address
IP : Available IP search display a message when no result instead of an empty table
1.2 (21/02/2016)
General: IE7, IE8, IE9 support removal
Login : No authentication using unsupported browser
Admin : Database update page
Admin : Database initialization page
NAS : Devices without statistics are not displayed
Bug : Management of quotes in sites and subnets names when requested with JSON
1.1 (08/02/2016)
General: Application Internationalization (Java/JSP/Javascript)
General: Change os sort for sites from site code to name
Langue: Add English language
Utilisateur : Add user preferences interface
IP: For used by search, generate lists in JSON
IP: Choice within urls list build on IP address when you click on it
Admin : Role AdminLocal and admin account cannot be modified
Admin : Modification of pages Subnet and Vlan to load site list only when needed
Admin : Rewrite servlet photos wipe to produce xml result instead of html
Admin : Add application settings interface
CSV : Add a maximum of lines that could be treated depending of objects
Bug : In Norm, Subnets management, crash when selecting first entry in context list
1.0 (17/01/2016)
Site: Enlarge fields site code and site name to deal with stores CCU
Stock: Stock per site with context main stock
IP: Help to build CSV import of IP addresses
Admin: CSV Import/Export CSV of application main tables
Admin: Mails Management
Norme: In subnets list management within surnet, unaffected subnets are displayed as soon as context is choosed
Bug: URL Encoding missing on search chain within excel export resulting in empty file
Bug: Trim missing on differents elements in case of IP addresses add
Bug: No compliance check in dates when adding IP addresses
Bug: When a new context is created, crash of session if user choosed this new context
0.9.9 (19/11/2014)
General: Internal authentication
General: External authentication LDAP/AD
General: Storage of encrypted passwords
General: Split between Admin and Network rights
General: New rights management per context
Login: Add Enter key management for login and password fields
IP: Removal of talkman page
0.9.8 (08/11/2014)
Migration to :
Oracle Database 10gR2 -> 11gR2
Oracle Weblogic 10.0.2 -> <IP_ADDRESS> (11gR1)
JDK 1.5 -> JDK 1.6
Java libraries upgrade :
JSP 2.0 -> JSP 2.1
Java Servlet 2.4 -> Java Servlet 2.5
CommonFileUpload 1.0 -> CommonFileUpload 1.3
JCIFS 1.3.12 -> JCIFS 1.3.17
JMail 1.4.2 -> JMail 1.5.1
General: Check correct rights on all pages
General: Encoding on jsp and javascript pages, servlets, ajax flow in Unicode UTF-8
General: JAvascript common functions code optimisation
Vlan : Removal unique constraint on vlan id in a site
Norme : Add wait bar when elements are unfold
NAS: Add Excel Export
Admin: Add tool : List of subnets without vlan
Admin: Add tool : Liste of subnets not in the norm
Bug: Photo or rack name modification : problem with quotes
Bug: When you change vid on a vlan, if a subnet is associated you lost the association
Bug: Error in norm when all subnets in a subnet are removed
0.9.7 (18/05/2014)
Add NAS module
0.9.6 (05/10/2013)
General : Add network Norm
Admin : Rewrite vlan management page
Admin : Add redundancy management (VRRP, HSRP, etc...)
IP : Add few tooltips and replace action buttons with icons
Photos : Rewrite room, set and racks admin pages
Photos : Rewrite album page with fixing display glitches
Photos : The album page no more reloads after a modification
Infos : Display all contexts data with search and navigation
Infos : Add redundancy protocols informations
Stock : Excel exports are back within stock page
Bug : When deleting a vlan with subnet associated, the subnet doesn't take back default vlan
Bug : When modifying vlan on a site, if subnets associated, those doesn't take back default vlan
Bug : When modifying subnet on a site, IP addresses stay in site
Bug : When changing context in another tab and validate IP addresses addition, they were recorded in the wrong context
0.9.5 (07/11/2012)
Global : Fix compatibility with IE9, Chrome, Safari
Global : Timeout from 30mn to 6h
Global : Remove ping function in IP available search
Global : Rewrite main menu
Global : Create section Infos
Global : Move into Infos subnet fill rate page
Global : Action with icon+tooltip instead of text buttons (all except Photo/Album, IP)
Global : Modify data directly in each line (all except IP)
Global : Rewrite some common ajax functions
IP : Add tooltip on column site to display site code
IP : Bakc of excel export function according to many criterias (Global, Context, Search)
Stock : Stock sorted by Index when page loads
Stock : Stock index from 4 to 8 characters
Stock : When reception of ongoing order, track it in movement history
Stock : Each context has its own stock
Admin : Add vlans per context and full rewrite of vlan/subnet/site scheme
Bug - IP : When IP add fails, IP stay in database format
Bug - IP : Rewrite of IP available search engine to slice subnet in /24 maximum
Bug - Stock : Special characters taken into account in type description
0.9.4 (04/01/2010)
General : Compatibility tests with IE7, IE8, Opera 10.10, Firefox 3.5.6
General : Add pages About, Changelog
General : Rewriting photos and stock pages to apply W3C XHTML 1.0 norm
General : Navigation menu present on all pages
General : Complete restructuration of help pages
Oracle : Triggers rewrited
Login : Login page rewrited
Stock : Code rewrited
Stock : Remove movements page, write box with ajax call
Stock : Add field, number of movements to display
Stock : In/Out fields merge in only one : Variation
Stock : Validate icon on each line
Photo : Code rewrited
Photo : Clean split between Room/Set/Rack pages
Photo : Removal Photos notes
Photo : Removal Videos
Photo : Rack poisitoning in drag and drop
0.9.3 (24/12/2009)
Oracle : Structure change in tables adresses,sites,subnets
General : Navigation change with menu on all pages except photo and stock
General : Add contexts
General : Tooltip and alert window modification
General : Rewriting pages to apply W3C XHTML 1.0 norm except photo and stock
General : Rewriting ajax calls
General : Down from CommonFileUpload 1.2.1 to 1.0 to resolve libraries conflict
IP : Migrate/modify/add could be on multiple objects
IP : Available IP search in Add/modify section
0.9.2 (26/08/2009)
Oracle : Structure change in photos tables
Photos : Temporary directory management for photos storage
Photos : PHotos storage in application directory or via CIFS
Photos : Modifiy rack display for bug fix when top front view is deleted
0.9.1 (16/08/2009)
General : Migration Taglib 1.2 -> 2.1
General : All database errors catched and logged
General : Direct sort on columns for IP and Stock
General : Encoding ISO-8859-1 on all pages
Oracle : Add database trigger to modify ip address records when subnet description is modified
Oracle : Unique description in addresses
Admin : User bean removal when login problems
Admin : Subnet Management : description could be modified without unique constraint error
Ip : Code Optimisation
Stock : Add category field
Stock : Add ongoing order field with reception function
Stock : Threshold alert take ongoing order into account
Stock : Movement : Full history instead of just index one
Stock : Movement : Full Excel Export
0.9.0 (03/08/2009)
General : Migration JSP 1.2->2.1
General : Migration JSTL 1.0->1.2
General : Migration Servlet 2.3->2.5
General : Migration CommonFileUpload 1.0->1.2.1
General : Migration JAI 1.1.2->1.1.3
General : Migration JDK 1.4 -> Jrockit MC 3.1.0 (JEE5)
General : Removal modules referencement ports, workflow travaux, secu, ddc and associated java classes
General : Application settings in web.xml env-entry
General : admin/root merge
General : File renaming
Oracle : Removal fields manager,useragent in users
Admin : Add tool Network fill rate
Admin : Rights Management rewriting
Ip : Removal IPX field
Ip : Add sort and search on type field
Ip : Rewrite available IP page and code PingServlet in JEE5 to insert result in page
0.8.2 (20/07/2008)
No informations
0.8.1 (20/06/2006)
No informations
0.8.0 (01/09/2005)
No informations
0.7.3 (28/07/2005)
No informations
0.7.2 (23/04/2005)
No informations
0.7.1 (12/01/2005)
No informations
0.7.0 (29/10/2004)
First release into production
0.1 (07/01/2004)
First development version


Ruleset Design Rules
Language -
Description
The Design Ruleset contains a collection of rules that find questionable designs.
Rule UseSingleton::
TOC
Description
If you have a class that has nothing but static methods, consider making it a Singleton.
Note that this doesn't apply to abstract classes, since their subclasses may
well include non-static methods. Also, if you want this class to be a Singleton,
remember to add a private constructor to prevent instantiation.
- Message
- All methods are static. Consider using Singleton instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
- Class
- net.sourceforge.pmd.rules.design.UseSingleton
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#UseSingleton
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class MaybeASingleton {
public static void foo() {}
public static void bar() {}
}
TOC
Rule SimplifyBooleanReturns::
TOC
Description
Avoid unnecessary if..then..else statements when returning a boolean.
- Message
- Avoid unnecessary if..then..else statements when returning a boolean
- Class
- net.sourceforge.pmd.rules.SimplifyBooleanReturns
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#SimplifyBooleanReturns
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
private int bar =2;
public boolean isBarEqualsTo(int x) {
// this bit of code
if (bar == x) {
return true;
} else {
return false;
}
// can be replaced with a simple
// return bar == x;
}
}
TOC
Rule SimplifyBooleanExpressions::
TOC
Description
Avoid unnecessary comparisons in boolean expressions - this complicates simple code.
- Message
- Avoid unnecessary comparisons in boolean expressions
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#SimplifyBooleanExpressions
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Bar {
// can be simplified to
// bar = isFoo();
private boolean bar = (isFoo() == true);
public isFoo() { return false;}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//EqualityExpression/PrimaryExpression
/PrimaryPrefix/Literal/BooleanLiteral
TOC
Rule SwitchStmtsShouldHaveDefault::
TOC
Description
Switch statements should have a default label.
- Message
- Switch statements should have a default label
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#SwitchStmtsShouldHaveDefault
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
public void bar() {
int x = 2;
switch (x) {
case 2: int j = 8;
}
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//SwitchStatement[not(SwitchLabel[@Default='true'])]
TOC
Rule AvoidDeeplyNestedIfStmts::
TOC
Description
Deeply nested if..then statements are hard to read.
- Message
- Deeply nested if..then statements are hard to read
- Class
- net.sourceforge.pmd.rules.AvoidDeeplyNestedIfStmtsRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#AvoidDeeplyNestedIfStmts
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
public void bar(int x, int y, int z) {
if (x>y) {
if (y>z) {
if (z==x) {
// whew, too deep
}
}
}
}
}
Properties
Following properties are defined:
- Name
- problemDepth
- Description
- The if statement depth reporting threshold
- Value
-
3
TOC
Rule AvoidReassigningParameters::
TOC
Description
Reassigning values to parameters is a questionable practice. Use a temporary local variable instead.
- Message
- Avoid reassigning parameters such as ''{0}''
- Class
- net.sourceforge.pmd.rules.AvoidReassigningParameters
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#AvoidReassigningParameters
- TypeResolution
- -
- Priority
- 2
Example
Example code snippet of this rule.
public class Foo {
private void foo(String bar) {
bar = "something else";
}
}
TOC
Rule SwitchDensity::
TOC
Description
A high ratio of statements to labels in a switch statement implies that the switch
statement is doing too much work. Consider moving the statements into new
methods, or creating subclasses based on the switch variable.
- Message
- A high ratio of statements to labels in a switch statement. Consider refactoring.
- Class
- net.sourceforge.pmd.rules.design.SwitchDensityRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#SwitchDensity
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
public void bar(int x) {
switch (x) {
case 1: {
// lots of statements
break;
} case 2: {
// lots of statements
break;
}
}
}
}
Properties
Following properties are defined:
- Name
- minimum
- Description
- The switch statement ratio reporting threshold
- Value
-
10
TOC
Rule ConstructorCallsOverridableMethod::
TOC
Description
Calling overridable methods during construction poses a risk of invoking methods on an
incompletely constructed object and can be difficult to discern.
It may leave the sub-class unable to construct its superclass or forced to
replicate the construction process completely within itself, losing the ability to call
super(). If the default constructor contains a call to an overridable method,
the subclass may be completely uninstantiable. Note that this includes method calls
throughout the control flow graph - i.e., if a constructor Foo() calls a private method
bar() that calls a public method buz(), this denotes a problem.
- Message
- Overridable {0} called during object construction
- Class
- net.sourceforge.pmd.rules.ConstructorCallsOverridableMethod
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#ConstructorCallsOverridableMethod
- TypeResolution
- -
- Priority
- 1
Example
Example code snippet of this rule.
public class SeniorClass {
public SeniorClass(){
toString(); //may throw NullPointerException if overridden
}
public String toString(){
return "IAmSeniorClass";
}
}
public class JuniorClass extends SeniorClass {
private String name;
public JuniorClass(){
super(); //Automatic call leads to NullPointerException
name = "JuniorClass";
}
public String toString(){
return name.toUpperCase();
}
}
TOC
Rule AccessorClassGeneration::
TOC
Description
Instantiation by way of private constructors from outside of the constructor's class often causes the generation of an accessor.
A factory method, or non-privitization of the constructor can eliminate this situation.
The generated class file is actually an interface. It gives the accessing class the ability to invoke a new hidden package
scope constructor that takes the interface as a supplementary parameter. This turns a private constructor effectively into
one with package scope, and is challenging to discern.
- Message
- Avoid instantiation through private constructors from outside of the constructor's class.
- Class
- net.sourceforge.pmd.rules.AccessorClassGeneration
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#AccessorClassGeneration
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Outer {
void method(){
Inner ic = new Inner();//Causes generation of accessor class
}
public class Inner {
private Inner(){}
}
}
TOC
Rule FinalFieldCouldBeStatic::
TOC
Description
If a final field is assigned to a compile-time constant, it could be
made static, thus saving overhead in each object at runtime.
- Message
- This final field could be made static
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#FinalFieldCouldBeStatic
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
public final int BAR = 42; // this could be static and save some space
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//FieldDeclaration
[@Final='true' and @Static='false']
[not (../../../../ClassOrInterfaceDeclaration[@Interface='true'])]
/VariableDeclarator/VariableInitializer/Expression
/PrimaryExpression/PrimaryPrefix/Literal
TOC
Rule CloseResource::
TOC
Description
Ensure that resources (like Connection, Statement, and ResultSet objects) are always closed after use.
- Message
- Ensure that resources like this {0} object are closed after use
- Class
- net.sourceforge.pmd.rules.CloseResource
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#CloseResource
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Bar {
public void foo() {
Connection c = pool.getConnection();
try {
// do stuff
} catch (SQLException ex) {
// handle exception
} finally {
// oops, should close the connection using 'close'!
// c.close();
}
}
}
Properties
Following properties are defined:
- Name
- types
- Description
- -
- Value
-
Connection,Statement,ResultSet
TOC
Rule NonStaticInitializer::
TOC
Description
A nonstatic initializer block will be called any time a constructor
is invoked (just prior to invoking the constructor). While this
is a valid language construct, it is rarely used and is confusing.
- Message
- Non-static initializers are confusing
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#NonStaticInitializer
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class MyClass {
// this block gets run before any call to a constructor
{
System.out.println("I am about to construct myself");
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//Initializer[@Static='false']
TOC
Rule DefaultLabelNotLastInSwitchStmt::
TOC
Description
By convention, the default label should be the last label in a switch statement.
- Message
- The default label should be the last label in a switch statement
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#DefaultLabelNotLastInSwitchStmt
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
void bar(int a) {
switch (a) {
case 1: // do something
break;
default: // the default case should be last, by convention
break;
case 2:
break;
}
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//SwitchStatement
[not(SwitchLabel[position() = last()][@Default='true'])]
[SwitchLabel[@Default='true']]
TOC
Rule NonCaseLabelInSwitchStatement::
TOC
Description
A non-case label (e.g. a named break/continue label) was present in a switch statement.
This legal, but confusing. It is easy to mix up the case labels and the non-case labels.
- Message
- A non-case label was present in a switch statement
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#NonCaseLabelInSwitchStatement
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
void bar(int a) {
switch (a) {
case 1:
// do something
break;
mylabel: // this is legal, but confusing!
break;
default:
break;
}
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//SwitchStatement//BlockStatement/Statement/LabeledStatement
TOC
Rule OptimizableToArrayCall::
TOC
Description
A call to Collection.toArray can use the Collection's size vs an empty Array of the desired type.
- Message
- This call to Collection.toArray() may be optimizable
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#OptimizableToArrayCall
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
class Foo {
void bar(Collection x) {
// A bit inefficient
x.toArray(new Foo[0]);
// Much better; this one sizes the destination array, avoiding
// a reflection call in some Collection implementations
x.toArray(new Foo[x.size()]);
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//PrimaryExpression
[PrimaryPrefix/Name[ends-with(@Image, 'toArray')]]
[
PrimarySuffix/Arguments/ArgumentList/Expression
/PrimaryExpression/PrimaryPrefix/AllocationExpression
/ArrayDimsAndInits/Expression/PrimaryExpression/PrimaryPrefix/Literal[@Image='0']
]
TOC
Rule BadComparison::
TOC
Description
Avoid equality comparisons with Double.NaN - these are likely to be logic errors.
- Message
- Avoid equality comparisons with Double.NaN
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#BadComparison
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Bar {
boolean x = (y == Double.NaN);
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//EqualityExpression[@Image='==']
/PrimaryExpression/PrimaryPrefix
<EMAIL_ADDRESS>or @Image='Float.NaN']
TOC
Rule EqualsNull::
TOC
Description
Inexperienced programmers sometimes confuse comparison concepts
and use equals() to compare to null.
- Message
- Avoid using equals() to compare against null
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#EqualsNull
- TypeResolution
- -
- Priority
- 1
Example
Example code snippet of this rule.
class Bar {
void foo() {
String x = "foo";
if (x.equals(null)) { // bad!
doSomething();
}
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//PrimaryExpression
[
PrimaryPrefix/Name[ends-with(@Image, 'equals')]
or
PrimarySuffix[ends-with(@Image, 'equals')]
]
[PrimarySuffix/Arguments/ArgumentList[count(Expression)=1]
/Expression/PrimaryExpression/PrimaryPrefix
/Literal/NullLiteral]
TOC
Rule ConfusingTernary::
TOC
Description
In an "if" expression with an "else" clause, avoid negation in
the test. For example, rephrase:
if (x != y) diff(); else same();
as:
if (x == y) same(); else diff();
Most "if (x != y)" cases without an "else" are often return
cases, so consistent use of this rule makes the code easier
to read. Also, this resolves trivial ordering problems, such
as "does the error case go first?" or "does the common case
go first?".
- Message
- Avoid if (x != y) ..; else ..;
- Class
- net.sourceforge.pmd.rules.design.ConfusingTernary
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#ConfusingTernary
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
boolean bar(int x, int y) {
return (x != y) ? diff : same;
}
}
TOC
Rule InstantiationToGetClass::
TOC
Description
Avoid instantiating an object just to call getClass() on it; use the .class public member instead.
- Message
- Avoid instantiating an object just to call getClass() on it; use the .class public member instead
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#InstantiationToGetClass
- TypeResolution
- -
- Priority
- 4
Example
Example code snippet of this rule.
public class Foo {
// Replace this
Class c = new String().getClass();
// with this:
Class c = String.class;
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//PrimarySuffix
[@Image='getClass']
[parent::PrimaryExpression
[PrimaryPrefix/AllocationExpression]
[count(PrimarySuffix) = 2]
]
TOC
Rule IdempotentOperations::
TOC
Description
Avoid idempotent operations - they are have no effect.
- Message
- Avoid idempotent operations (like assigning a variable to itself).
- Class
- net.sourceforge.pmd.rules.IdempotentOperations
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#IdempotentOperations
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
public void bar() {
int x = 2;
x = x;
}
}
TOC
Rule SimpleDateFormatNeedsLocale::
TOC
Description
Be sure to specify a Locale when creating a new instance of SimpleDateFormat.
- Message
- When instantiating a SimpleDateFormat object, specify a Locale
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#SimpleDateFormatNeedsLocale
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
// Should specify Locale.US (or whatever)
private SimpleDateFormat sdf = new SimpleDateFormat("pattern");
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//AllocationExpression
[ClassOrInterfaceType[@Image='SimpleDateFormat']]
[Arguments[@ArgumentCount=1]]
TOC
Rule ImmutableField::
TOC
Description
Identifies private fields whose values never change once they are initialized either in the declaration of the field or by
a constructor. This aids in converting existing classes to immutable classes.
- Message
- Private field ''{0}'' could be made final; it is only initialized in the declaration or constructor.
- Class
- net.sourceforge.pmd.rules.design.ImmutableField
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#ImmutableField
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
private int x; // could be final
public Foo() {
x = 7;
}
public void foo() {
int a = x + 2;
}
}
TOC
Rule UseLocaleWithCaseConversions::
TOC
Description
When doing a String.toLowerCase()/toUpperCase() call, use a Locale. This avoids
problems with certain locales, i.e. Turkish.
- Message
- When doing a String.toLowerCase()/toUpperCase() call, use a Locale
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#UseLocaleWithCaseConversions
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
class Foo {
// BAD
if (x.toLowerCase().equals("list"))...
/*
This will not match "LIST" when in Turkish locale
The above could be
if (x.toLowerCase(Locale.US).equals("list")) ...
or simply
if (x.equalsIgnoreCase("list")) ...
*/
// GOOD
String z = a.toLowerCase(Locale.EN);
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//PrimaryExpression
[PrimaryPrefix/Name
[ends-with(@Image, 'toLowerCase') or ends-with(@Image,
'toUpperCase')]
]
[PrimarySuffix/Arguments[@ArgumentCount=0]]
TOC
Rule AvoidProtectedFieldInFinalClass::
TOC
Description
Do not use protected fields in final classes since they cannot be subclassed.
Clarify your intent by using private or package access modifiers instead.
- Message
- Avoid protected fields in a final class. Change to private or package access.
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#AvoidProtectedFieldInFinalClass
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public final class Bar {
private int x;
protected int y; // <-- Bar cannot be subclassed, so is y really private or package visible???
Bar() {}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//ClassOrInterfaceDeclaration[@Final='true']
/ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration
/FieldDeclaration[@Protected='true']
TOC
Rule AssignmentToNonFinalStatic::
TOC
Description
Identifies a possible unsafe usage of a static field.
- Message
- Possible unsafe assignment to a non-final static field in a constructor.
- Class
- net.sourceforge.pmd.rules.design.AssignmentToNonFinalStatic
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#AssignmentToNonFinalStatic
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class StaticField {
static int x;
public FinalFields(int y) {
x = y; // unsafe
}
}
TOC
Rule MissingStaticMethodInNonInstantiatableClass::
TOC
Description
A class that has private constructors and does not have any static methods or fields cannot be used.
- Message
- Class cannot be instantiated and does not provide any static methods or fields
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#MissingStaticMethodInNonInstantiatableClass
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
/* This class is unusable, since it cannot be
instantiated (private constructor),
and no static method can be called.
*/
public class Foo {
private Foo() {}
void foo() {}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//ClassOrInterfaceDeclaration[@Nested='false'][
( count(./ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/ConstructorDeclaration)>0
and count(./ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/ConstructorDeclaration) = count(./ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/ConstructorDeclaration[@Private='true']) )
and
count(.//MethodDeclaration[@Static='true'])=0
and
count(.//FieldDeclaration[@Private='false'][@Static='true'])=0
]
TOC
Rule AvoidSynchronizedAtMethodLevel::
TOC
Description
Method level synchronization can backfire when new code is added to the method. Block-level
synchronization helps to ensure that only the code that needs synchronization gets it.
- Message
- Use block level rather than method level synchronization
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#AvoidSynchronizedAtMethodLevel
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
// Try to avoid this
synchronized void foo() {
}
// Prefer this:
void bar() {
synchronized(this) {
}
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//MethodDeclaration[@Synchronized='true']
TOC
Rule MissingBreakInSwitch::
TOC
Description
A switch statement without an enclosed break statement may be a bug.
- Message
- A switch statement does not contain a break
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#MissingBreakInSwitch
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
public void bar(int status) {
switch(status) {
case CANCELLED:
doCancelled();
// break; hm, should this be commented out?
case NEW:
doNew();
case REMOVED:
doRemoved();
}
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//SwitchStatement
[count(.//BreakStatement)=0]
[count(SwitchLabel) > 0]
[count(BlockStatement/Statement/ReturnStatement)
+ count(BlockStatement/Statement/ThrowStatement)
< count (SwitchLabel)]
TOC
Rule UseNotifyAllInsteadOfNotify::
TOC
Description
Thread.notify() awakens a thread monitoring the object. If more than one thread is monitoring, then only
one is chosen. The thread chosen is arbitrary; thus it's usually safer to call notifyAll() instead.
- Message
- Call Thread.notifyAll() rather than Thread.notify()
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#UseNotifyAllInsteadOfNotify
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
void bar() {
x.notify();
// If many threads are monitoring x, only one (and you won't know which) will be notified.
// use instead:
x.notifyAll();
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//StatementExpression/PrimaryExpression
[count(PrimarySuffix/Arguments/ArgumentList) = 0]
[
PrimaryPrefix[./Name[@Image='notify' or ends-with(@Image,'.notify')]
or @Image='notify'
or (./AllocationExpression and ../PrimarySuffix[@Image='notify'])
]
]
TOC
Rule AvoidInstanceofChecksInCatchClause::
TOC
Description
Each caught exception type should be handled in its own catch clause.
- Message
- An instanceof check is being performed on the caught exception. Create a separate catch clause for this exception type.
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#AvoidInstanceofChecksInCatchClause
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
try { // Avoid this
// do something
} catch (Exception ee) {
if (ee instanceof IOException) {
cleanup();
}
}
try { // Prefer this:
// do something
} catch (IOException ee) {
cleanup();
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//CatchStatement/FormalParameter
/following-sibling::Block//InstanceOfExpression/PrimaryExpression/PrimaryPrefix
/Name[
@Image = ./ancestor::Block/preceding-sibling::FormalParameter
/VariableDeclaratorId/@Image
]
TOC
Rule AbstractClassWithoutAbstractMethod::
TOC
Description
The abstract class does not contain any abstract methods. An abstract class suggests
an incomplete implementation, which is to be completed by subclasses implementing the
abstract methods. If the class is intended to be used as a base class only (not to be instantiated
direcly) a protected constructor can be provided prevent direct instantiation.
- Message
- This abstract class does not have any abstract methods
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#AbstractClassWithoutAbstractMethod
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public abstract class Foo {
void int method1() { ... }
void int method2() { ... }
// consider using abstract methods or removing
// the abstract modifier and adding protected constructors
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//ClassOrInterfaceDeclaration
[@Abstract='true'
and count( .//MethodDeclaration[@Abstract='true'] )=0 ]
[count(ImplementsList)=0]
TOC
Rule SimplifyConditional::
TOC
Description
No need to check for null before an instanceof; the instanceof keyword returns false when given a null argument.
- Message
- No need to check for null before an instanceof
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#SimplifyConditional
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
class Foo {
void bar(Object x) {
if (x != null && x instanceof Bar) {
// just drop the "x != null" check
}
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//Expression
[ConditionalOrExpression
[EqualityExpression[@Image='==']
//NullLiteral
and
UnaryExpressionNotPlusMinus
[@Image='!']//InstanceOfExpression[PrimaryExpression
//Name/@Image = ancestor::ConditionalOrExpression/EqualityExpression
/PrimaryExpression/PrimaryPrefix/Name/@Image]]
or
ConditionalAndExpression
[EqualityExpression[@Image='!=']//NullLiteral
and
InstanceOfExpression
[PrimaryExpression[count(PrimarySuffix[@ArrayDereference='true'])=0]
//Name/@Image = ancestor::ConditionalAndExpression
/EqualityExpression/PrimaryExpression/PrimaryPrefix/Name/@Image]]]
TOC
Rule CompareObjectsWithEquals::
TOC
Description
Use equals() to compare object references; avoid comparing them with ==.
- Message
- Use equals() to compare object references.
- Class
- net.sourceforge.pmd.rules.design.CompareObjectsWithEquals
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#CompareObjectsWithEquals
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
class Foo {
boolean bar(String a, String b) {
return a == b;
}
}
TOC
Rule PositionLiteralsFirstInComparisons::
TOC
Description
Position literals first in String comparisons - that way if the String is null you won't get a NullPointerException, it'll just return false.
- Message
- Position literals first in String comparisons
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#PositionLiteralsFirstInComparisons
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
class Foo {
boolean bar(String x) {
return x.equals("2"); // should be "2".equals(x)
}
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//PrimaryExpression[PrimaryPrefix[Name[ends-with(@Image, '.equals')]][..//Literal]]
[not(ancestor::Expression/ConditionalAndExpression//EqualityExpression[@Image='!=']//NullLiteral)]
[not(ancestor::Expression/ConditionalOrExpression//EqualityExpression[@Image='==']//NullLiteral)]
TOC
Rule UnnecessaryLocalBeforeReturn::
TOC
Description
Avoid unnecessarily creating local variables
- Message
- Consider simply returning the value vs storing it in local variable ''{0}''
- Class
- net.sourceforge.pmd.rules.design.UnnecessaryLocalBeforeReturn
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#UnnecessaryLocalBeforeReturn
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
public int foo() {
int x = doSomething();
return x; // instead, just 'return doSomething();'
}
}
TOC
Rule NonThreadSafeSingleton::
TOC
Description
Non-thread safe singletons can result in bad state changes. Eliminate
static singletons if possible by instantiating the object directly. Static
singletons are usually not needed as only a single instance exists anyway.
Other possible fixes are to synchronize the entire method or to use an
initialize-on-demand holder class (do not use the double-check idiom).
See Effective Java, item 48.
- Message
- Singleton is not thread safe
- Class
- net.sourceforge.pmd.rules.design.NonThreadSafeSingleton
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#NonThreadSafeSingleton
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
private static Foo foo = null;
//multiple simultaneous callers may see partially initialized objects
public static Foo getFoo() {
if (foo==null)
foo = new Foo();
return foo;
}
Properties
Following properties are defined:
- Name
- checkNonStaticMethods
- Description
- -
- Value
-
true
- Name
- checkNonStaticFields
- Description
- -
- Value
-
false
TOC
Rule UncommentedEmptyMethod::
TOC
Description
Uncommented Empty Method finds instances where a method does not contain
statements, but there is no comment. By explicitly commenting empty methods
it is easier to distinguish between intentional (commented) and unintentional
empty methods.
- Message
- Document empty method
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#UncommentedEmptyMethod
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public void doSomething() {
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//MethodDeclaration/Block[count(BlockStatement) = 0 and @containsComment = 'false']
TOC
Rule UncommentedEmptyConstructor::
TOC
Description
Uncommented Empty Constructor finds instances where a constructor does not
contain statements, but there is no comment. By explicitly commenting empty
constructors it is easier to distinguish between intentional (commented)
and unintentional empty constructors.
- Message
- Document empty constructor
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#UncommentedEmptyConstructor
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public Foo() {
super();
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//ConstructorDeclaration[@Private='false'][count(BlockStatement) = 0 and ($ignoreExplicitConstructorInvocation = 'true' or not(ExplicitConstructorInvocation)) and @containsComment = 'false']
- Name
- ignoreExplicitConstructorInvocation
- Description
- Ignore explicit constructor invocation when deciding whether constructor is empty or not
- Value
-
false
TOC
Rule AvoidConstantsInterface::
TOC
Description
An interface should be used only to model a behaviour of a
class: using an interface as a container of constants is a poor usage pattern.
- Message
- An Interface should be used only to model a behaviour; consider converting this to a class.
- Class
- net.sourceforge.pmd.rules.XPathRule
- Reference
- -
- ExternalInfoUrl
- -
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public interface ConstantsInterface {
public static final int CONSTANT1=0;
public static final String CONSTANT2="1";
}
Properties
Following properties are defined:
- Name
- xpath
- Description
- -
- Value
-
//ClassOrInterfaceDeclaration[@Interface="true"]
[
count(//MethodDeclaration)=0
and
count(//FieldDeclaration)>0
]
TOC
Rule UnsynchronizedStaticDateFormatter::
TOC
Description
SimpleDateFormat is not synchronized. Sun recomends separate format instances
for each thread. If multiple threads must access a static formatter, the
formatter must be synchronized either on method or block level.
- Message
- Static DateFormatter objects should be accessed in a synchronized manner
- Class
- net.sourceforge.pmd.rules.design.UnsynchronizedStaticDateFormatter
- Reference
- -
- ExternalInfoUrl
- -
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
private static final SimpleDateFormat sdf = new SimpleDateFormat();
void bar() {
sdf.format(); // bad
}
synchronized void foo() {
sdf.format(); // good
}
}
Properties
Following properties are defined:
TOC
Rule PreserveStackTrace::
TOC
Description
Throwing a new exception from a catch block without passing the original exception into the
new Exception will cause the true stack trace to be lost, and can make it difficult to
debug effectively.
- Message
- Caught exception is rethrown, original stack trace may be lost
- Class
- net.sourceforge.pmd.rules.design.PreserveStackTrace
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#PreserveStackTrace
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
void good() {
try{
Integer.parseInt("a");
} catch(Exception e){
throw new Exception(e);
}
}
void bad() {
try{
Integer.parseInt("a");
} catch(Exception e){
throw new Exception(e.getMessage());
}
}
}
Properties
Following properties are defined:
TOC
Rule UseCollectionIsEmpty::
TOC
Description
The isEmpty() method on java.util.Collection is provided to see if a collection has any elements.
Comparing the value of size() to 0 merely duplicates existing behavior.
- Message
- Substitute calls to size() == 0 (or size() != 0) with calls to isEmpty()
- Class
- net.sourceforge.pmd.rules.design.UseCollectionIsEmpty
- Reference
- -
- ExternalInfoUrl
- http://pmd.sourceforge.net/rules/design.html#UseCollectionIsEmpty
- TypeResolution
- -
- Priority
- 3
Example
Example code snippet of this rule.
public class Foo {
void good() {
List foo = getList();
if (foo.isEmpty()) {
// blah
}
}
void bad() {
List foo = getList();
if (foo.size() == 0) {
// blah
}
}
}
Properties
Following properties are defined:
TOC


Introduction to Mergesort and Insertion Sort
Insertion Sort
Insertion sort is a intuitive, primitive sorting method. Given a Given an unordered set of objects, the algorithm repeatedly removes an entry from the set and insert it into a new ordered list.
void InsertionSort(ALIST slot[ ], int n)
{ // input slot is an array of n records;
// assume n > 1;
for (int i=1; i < n; i++) {
for (int j=i; j > 0; j--) {
if (slot[j].key < slot[j-1].key)
swap(slot[j], slot[j-1]);
else break;
}
}
}
The time complexity of insertion sort is in the order of $n^2$. Since sorting is performed directly on original array without any working storage, swapping and shifting which are time consuming are essential. So insertion sort is slow when a large size of array is going to be sorted. While for small-size arrays, insertion sort is still a simple and reliable algorithm.
Mergesort
Mergesort is a useful sorting algorithm based on the idea of divide-and-conquer. For each iteration, the unsorted array is divided into two sub-arrays, and they are separately sorted. Then the two sorted sub-arrays merge together.
void mergesort(int n, int m)
{
int mid = (n+m)/2;
if (m-n <= 0)
return;
else if (m-n > 1) {
mergesort(n, mid);
mergesort(mid+1, m);
}
merge(n, m);
}
The key point of mergesort is how merge() merges two sub-arrays of elements between index n and mid, and between mid+1 and m.
void merge(int n, int m)
{
if (m-n <= 0) return;
divide the list into 2 halves; // both halves are sorted
while (both halves are not empty) {
compare the 1 st elements of the 2 halves; // 1 comparison
if (1 st element of 1st half is smaller)
1 st element of 1st half joins the end of the merged list;
else if (1 st element of 2nd half is smaller)
move the 1 st element of 2nd half to the end of the
merged list;
else { // the 1 st elements of the 2 halves are equal
if (they are the last elements) break;
1 st element of 1st half joins end of the merged list;
move the 1 st element of 2nd half to the end of the
merged list;
}
} // end of while loop;
} // end of merge
The time complexity of mergesort is in the order of $nlog(n)$. But when the size of the array to be sorted is small, the the overhead of many recursive calls will make the algorithm inefficient.
Integration of Mergesort and Insertion Sort
Modified Mergesort
In oder to overcome the disadvantages of both mergesort and insertion sort, we can develop modified mergesort on the basis of integration of mergesort and insertion sort. This new algorithm can be achieved by choosing a small value of fac as a threshold for the size of sub-arrays. When the size of a sub-array in a recursive call is less than or equal to the value of fac, the algorithm will switch to insertion sort, which is efficient for small input. A pseudocode of the modified mergesort is given below:
void mergeSort(Element E[], int first, int last, int fac)
{
if (last – first > S) {
int mid = (first + last)/2;
mergeSort(E, first, mid, S);
mergeSort(E, mid + 1, last, S);
merge(E, first, mid, last);
} else {
insertionSort(E, first, last);
}
}
Implement of Modified Mergesort
Array.java
A class which consists of constructors, and methods such as InsertionSort( ), Merge( ), MergeSort( ), Sort( ) (which uses InsertionSort( ) to sort the sub-arrays with size < factor).
The number of comparisons are returned using the GetCounter( ) method, and the randomly generated data of array are returned using GetArray( ) method.
public class Array{ //Array Class
private int n; //Class member size of Array
private int [] S; //Class member data of Array
private long counter; //Class member count comparisons
private int factor;
public Array(){ //Default constructor
n = 0;
S = new int [n];
counter = 0;
factor = 0;
}
public Array(int size){ //Constructor with Initialization
n = size;
if(n <= 0)
System.err.println("The input Array size is incorrect.");
else{
S = new int [n];
Random ran = new Random();
for(int i = 0; i < n; i++){
S[i] = Math.abs(ran.nextInt()); //Set random data to Array
}
}
counter = 0;
factor = 10;
}
public Array(int size, int fac){ //Constructor with Initialization
n = size;
if(n <= 0)
System.err.println("The input Array size is incorrect.");
else{
S = new int [n];
Random ran = new Random();
for(int i = 0; i < n; i++){
S[i] = Math.abs(ran.nextInt()); //Set random data to Array
}
}
counter = 0;
factor = fac;
}
public Array(Array aArray){ //Copy constructor
this.n = aArray.n;
this.counter = aArray.counter;
this.factor = aArray.factor;
S = new int[aArray.n];
for(int i = 0; i < aArray.n; i++){
this.S[i] = aArray.S[i];
}
}
public void InsertionSort(int start, int last){ //Class methods
for (int i = start; i <= last; i++){
for (int j = i; j > start; j--) {
if (S[j] < S[j-1]){
counter++;
int tmp = S[j];
S[j] = S[j-1];
S[j-1] = tmp;
}
else break;
}
}
}
private void Merge(int start, int end){ //Class methods, used in MergeSort
int mid = (start + end) / 2;
int a = start, b = mid + 1, index = 0;
int[] tmpArray = new int[end - start + 1];
while(a <= mid && b <= end){
if(S[a] <= S[b]){
tmpArray[index++] = S[a];
a++;
}
else{
tmpArray[index++] = S[b];
b++;
}
counter++;
}
while(a <= mid){
tmpArray[index++] = S[a++];
}
while(b <= end){
tmpArray[index++] = S[b++];
}
for(int i = start; i <= end; i++){
S[i] = tmpArray[i - start];
}
}
public void MergeSort(int start, int end){ //Class methods MergeSort
if(end - start <= 0)
return;
else if(end - start > 1){
int mid=(start+end)/2;
MergeSort(start,mid);
MergeSort(mid+1,end);
}
Merge(start,end);
}
public void Sort(int first, int last){ //Class methods Sort
if(last - first > factor){
int mid = (first + last)/ 2;
Sort(first, mid);
Sort(mid + 1, last);
Merge(first, last);
}
else{
InsertionSort(first, last);
}
}
public long GetCounter(){ //Class methods, get number of comparisons
return(counter);
}
public int[] GetArray(){ //Class methods, get data of Array
int[] tmp = new int[n];
for(int i = 0; i < n; i++){
tmp[i] = S[i];
}
return(tmp);
}
}
Experiment on Modified Mergesort
I did series of experiments to explore how modified mergesort improves on the basis of mergesort by generating input data sets of various sizes, randomly ranging from 1,000 to 1,000,000 integers to see the number of key comparisons and CPU times taken by modified mergesort compared with origin mergesort. And I also studied how how the different values of S would affect the performance of the modified algorithm.
1. Compare the number of key comparisons taken by modified mergesort and origin mergesort
From Figure 1, we can obtain the relationship between the number of key comparisons and array size in modified mergesort. By curve fitting tool of Matlab, we find that the relationship function is mostly like $nlog(n)$.
From Figure 2, we can obtain the relationship between the number of key comparisons and array size in mergesort. By curve fitting tool of Matlab, we find that the relationship function is mostly like $nlog(n)$.
Through analysis, the relationship between key comparisons and array size in modified mergesort is $nlog(n)$. Although it is the same in Merge Sort, when compare the exact number of key comparisons with same array size in Advanced Merge Sort and Merge Sort, Advanced Merge Sort conducts fewer comparisons. By curve fitting, we obtain the mathematical relationship function between key comparisons and array size is $f(n) = 1.333nlog(n)$.
1. Compare the CPU time taken by modified mergesort and origin mergesort
From Figure 3, we can obtain the relationship between CPU time and array size in modified mergesort. By curve fitting tool of Matlab, we find that the relationship function is mostly like $n$.
From Figure 4, we can obtain the relationship between CPU time and array size in mergesort. By curve fitting tool of Matlab, we find that the relationship function is mostly like $n$.
Through analysis, the relationship between key comparisons and array size in modified mergesort is $n^2$ . Although it is the same as mergesort, when comparing the exact number of key comparisons with same array size in modified mergesort and mergesort, modified mergesort conducts fewer comparisons. By curve fitting, we obtain the mathematical relationship function between CPU time and array size is $f(t) = 0.0001928*t + -5.342$.
2. Number of key comparisons and CPU time taken by Advanced Merge Sort on the data sets with different factors
From Figure 5, we can obtain the relationship between key comparisons and factor in modified mergesort. With factor increasing, we find it is difficult to gain the exact relationship function and the relationship is mostly like random distribution. For this result, two points can be taken into consideration. One is that we initialize the same-size array with random integers for each time conducting modified mergesort, so if the factor does not effect the number of comparisons, the number of comparisons would range in a small section. The other is that the performance of CPU is usually unstable. The speed of CPU is sometimes fast but at other times slow, so if the factor does not effect the number of comparisons, the number of comparisons would also range in a small section.
From Figure 6, we can obtain the relationship between CPU time and factor in modified mergesort. With factor increasing, the CPU time dramatically deceases, but when factor increasing to 10, the CPU time stay in a small range.
It is remarkable to find there is a huge difference between the relationship of key comparison number and factor and the relationship of CPU time and factor. We consider that although with different factors the number of comparisons is almost the same, the operation time may not be the same when the time of other operations such as swap and assignment is taken into consideration, due to the different procedure of mergesort and insertion Sort.
Conclusions
1. The improvement of Modified MergeSort
As for key comparisons, the improvement of the modified mergesort is
$$ {1.35-1.333 \over 1.35} = 0.0126 $$
, which is not very significant.
But as for CPU time, the improvement of the modified mergesort is
$$ {0.000245-0.0001928 \over 0.000245} = 0.213 $$
, which is very impressive.
2. The effect of different values of factor
From the results, the factor have little effect on the number of key comparison conducted in modified mergesort, but it does reduce the CPU time especially when the factor is over 10.


6X California State Champs, 2009 - 2012, 2015-2016 and 10X NorCal High School Mountain Bike League Champs (2004, 2006, 2009, 2010, 2011, 2012, 2013, 2014, 2015 & 2016)
It was a spring day in 2002, when a Drake High sophomore and Drake teacher found themselves competing against each other unexpectedly at a race infamously known as Billy Cross. It was a classic match-up of student versus master every bit as great as Vader vs. Kenobi. They fought, struggled, and even trash-talked to gain cycling supremacy at Drake High, the only high school in the country to produce not one but two national collegiate cycling champions. The stakes were high. What happened on that day is the stuff of legend. Some will say that the kid showed up the master by beating him to the line. Others deny, saying the kid only had to do two laps, and the old timer, three. Not a fair comparison.
VIEW MORE...Click here for more info on the legue
Latest info on the Team
Latest info on the Team
Our Sponsors Thank You!


USBizi
USBizi was the first single chip .NET Micro Framework (NETMF) on the market. It was available in 100pin and 144pin LQFP packages.
We are no longer making the chip available but we are making all bootloader binaries available for free, including for commercial use.
Resources
Using NETMF software
We discourage the use of NETMF software on our products in favor of TinyCLR OS, but the choice is up to you. To find out more about NETMF, got to our NETMF Introduction Page
Using TinyCLR OS
The following instructions describe how to set up USBizi to work with TinyCLR OS. To learn more about TinyCLR check out the TinyCLR Introduction page.
Loading Bootloader v2
Tip
The instructions apply to all USBizi-based boards but we are using the FEZ Panda II as reference.
We first need to erase the old bootloader v1:
- Connect UART0 TX/RX to your PC. The easiest way would be to use a USB-Serial TTL cable. Those are D0 and D1 on FEZ Panda II. Do not forget to connect the ground.
- Put the device in serial mode by connecting MOD pin to ground.
- Open a terminal software and set the baudrate to 115200.
- Press the enter key and you should see
BL
coming back. - Enter this exact line
Unlock This device!
(case sensitive). Ignore theBL
keeps coming back with every key press. If you entered it correctly, you will seeAre you sure?
- Enter
Yes
(case sensitive). - You now have a blank LPC chip! You can now close the terminal software, release MOD pin, and reset your board.
The new bootloader v2 can now be loaded.
- Download and install Flash Magic.
- Open Flash Magic and select LPC2378.
- Check "Erase all Flash".
- Set the correct COM port number of your serial connection.
- Click the
Start
button. - When done, reset the board and the PC will detect a virtual USB device.
Loading the Firmware
Tip
First make sure you have bootloader v2 loaded. This needs to be done only once.
To activate bootloader v2, set LDR pin low. On FEZ Panda II it is a button marked LDR. Simply press it. Once the LDR pin is set low, keep it low while resetting the board.
Download the USBizi firmware and follow Loading the Firmware steps.
USBizi DevSys
The original development board for USBizi.


This error most often occurs when an application in one of your dashboards is removed from your bookmarks.
Check if this application is still bookmarked.
To check your bookmarks, go to the Main Menu in the Global Toolbar and select "Bookmarks"
If it is not:
Go to Center and re-bookmark it.
If it is:
Contact the application's Technical Point of Contact (PoC) for help.
To find the Technical PoC, go to your bookmarks and locate the application. Then, open the listing's menu and select "Get help" to view the resources that are available.


Fare Price
Leaving Time
Arrival Time
New Delhi
TUE, 26 FEB
Jaipur
Mahalaxmi Travels (RJ)
AC Seater-Sleeper (2 + 2)
14:30
11:30
21h 00m
2000
Mahalaxmi Travels (RJ)
AC Seater-Sleeper (2 + 2)
14:30
11:30
21h 00m
2000
Mahalaxmi Travels (RJ)
AC Seater-Sleeper (2 + 2)
14:30
11:30
21h 00m
2000
Mahalaxmi Travels (RJ)
AC Seater-Sleeper (2 + 2)
14:30
11:30
21h 00m
2000
Mahalaxmi Travels (RJ)
AC Seater-Sleeper (2 + 2)
14:30
11:30
21h 00m
2000


now:multicolor mode, grayscale devided into four, Red,Green,Blue,and Alpha (transculiant)
Data will show
Hex will show


Preparation time
30 mins to 1 hour
Cooking time
over 2 hours
Serves
Makes 12
Dietary
Warm the milk in a saucepan very gently until tepid.
Sift the flours into a large bowl and stir in the yeast, salt and sugar until well-combined.
Make a well in the centre of the mixture and stir in the warm milk. Beat well with a wooden spoon for 3-4 minutes, or until the batter is thick and elastic.
Cover the bowl with cling film and set aside in a warm place for an hour, or until the batter has doubled in size.
When the batter has risen, mix the bicarbonate of soda with the warm water, and beat the mixture into the batter for a couple of minutes. Set aside to rest in a warm place for a further 30 minutes. By this time the mixture should have risen and be covered with tiny bubbles.
Heat a flat griddle pan or large heavy-based non-stick frying pan over a medium-high heat.
Generously butter the insides of four crumpet rings or 9cm/3½in chefs' rings and place them onto the griddle or into the frying pan. Warm the rings for a minute or two.
Using a dessertspoon, drop three large spoonfuls of the crumpet batter into each ring. It should come around 1.5cm/½in up the sides of each ring, but no more. Cook for 9-12 minutes, or until lots of tiny bubbles have risen to the surface and burst and the tops look dry and set.
Carefully lift off the rings - it shouldn't be too difficult as the crumpets will ease back from the sides when they are ready. (Use an oven glove and take care as the crumpet rings will be hot.)
Flip the crumpets over with a spatula and cook on the other side for a further two minutes, or until golden-brown. You can keep these crumpets warm while the remaining batter is prepared, or serve immediately spread with lots of butter.
Cook the remaining crumpets in exactly the same way as the first, washing and buttering the rings well before re-using. The crumpets can also be cooled and then toasted.


In preparation for the first set of analyses I'm planning for this blog, I spent some time over the last week preparing a package to create data sets from reddit. The package will collect comments and posts from specified subreddits within a custom date range and save it to a sqlite3 database for later analysis.
To do this, I've used PRAW, a python wrapper for the Reddit API. PRAW allows you to easily retrieve comments and posts from specific subreddits and users and gracefully handles Reddit's API usage limits. However, finding posts within a specific time range is much trickier.
PRAW/Reddit API Basics
This isn't intended as a tutorial for PRAW. If you want that, I recommend visiting their docs. This section will only go through the fundamentals of PRAW necessary to create a data set from reddit.
First, let's import praw and the redditDataset module
import praw import redditDataset
Next, let's initialize a connection with PRAW as follows:
redditObject = praw.Reddit(user_agent='get_reddit_dataset')
We can grab subreddits using getSubreddits
. Here, we'll grab /r/funny and /r/gaming
subreddits = redditDataset.getSubreddits(redditObject, ['funny', 'gaming'])
PRAW also has a variety of functions to grab subreddits. One of the most useful is the method get_popular_subreddits
.
popularSubreddits = redditObject.get_popular_subreddits(limit=200)
This will return a generator containing the 200 most popular subreddits. PRAW has many other methods to grab specific submissions, comments, users, etc., but these are the only ones you'll need to know to use the module.
Now that we have a reddit object and the subreddits to query, let's make a data set.
Grabbing a data set from a set of subreddits
Once you have a generator or list of subreddit objects and your praw object, call createDataset
to start downloading comments and posts into a sqlite3 database. The database will be saved in ~\Databases\<dbName>db
.
Let's grab all the posts from the funny subreddit from March 1, 2015:
funnySubreddit = redditDataset.getSubreddits(redditObject, ['funny']) redditDataset.createDataset(redditObject, funnySubreddit, startDate='150301000000' endDate='150301235959', dbName='March_01_2015_funny_posts' fineScale=4)
Basically, you give createDataset
the reddit object, the subreddits (in list or generator form), a start and end date, a base name for the database, and a fine scale (which I'll get to in a moment).
For the start and end date, provide a string in the format 'yymmddHHMMSS'. So, in the above example, we're pulling posts between March 1, 2015 at 12:00:00 AM and March 1, 2015 at 11:59:59 PM.
Unfortunately, the reddit API will only provide a list of 1000 posts for any query. What does this mean for us? Well, say we want to get all the posts from 2014. If we request all those posts, we'll only get the 1000 with whatever sort is specified (createDataset
uses a 'top' sort). To get around this, createDataset
will make many requests in increments of 'fineScale' hours. So, in the example, above, we'll actually make six separate queries for a theoretical maximum of 6,000 posts. Because of the overhead associated with getting posts, we want to set this parameter to be as large as possible while still getting all the data we want. I've found that 8 works well for all but the most frequented subreddits.
And that's it! It'll work to retrieve all the posts within the desired range and the top comments from each post (by default, this is set to 100). One thing to note: because of the reddit API limits, this process is slow. We can only make 30 requests per minute. Currently, we only get the data for one post per request. I think this can be improved (potentially up to 25 posts per request), but I haven't gotten around to it yet.
Database structure
The sql database is pretty simple. It has two tables: submissions
and comments
.
Each row in submissions
represents a single post. The columns contain the postID
, postTitle
, postBody
(text if a self-post, url if a link), postScore
(as of when it was downloaded), subredditName
, and subredditID
.
Each row in comments
represents a single comment in a post. The columns contain the commentDate
, user
, body
, comScore
(as of when it was downloaded), and the postID
.
How to grab posts within a specified time range
If you're just interested in using the package, you can skip this part. Figuring out how to grab posts within a time range was a bit of a pain as there's no native support for it in the reddit API or in PRAW. Reddit offers native support for filtering based on a set date range relative to now. So, for example, it's easy to grab posts from the last hour, day, week, month, or year, but challenging to grab posts from the month before last, or even the last month except for today. I spent a long time searching for an alternative with little success.
I eventually figured out that the reddit search engine accepts timestamp queries with the date provided in the unix time format. So, the search query timestamp:1425186000..1425229199
will return the 1000 posts sorted however you'd like (new, top, hot, relevance) from March 1, 2015. Importantly, this will not work using the default reddit search engine. You need to add syntax=cloudsearch
to the end of the url to enable the native features of Amazon CloudSearch, one of which is timestamps.
Summary
You can check out the code for this project here. I've also collected a data set of almost all the posts along with their top 100 comments from the top 200 subreddits from March 2-8, 2015. You can get this database here.
Now that I have the data, it's time to start asking questions!


My experiences in scientific fields and social services have taught me how to cooperate and collaborate. I’ve also learned the value of working with people who may think differently from me.
My natural inclination toward organization has served me well over the course of my academic studies and professional career. I always examine and thoroughly plan out solutions before I apply them, an approach which I have found to be useful regardless of the issue at hand.
Thanks to my background in chemistry and computer science, I have developed strong analytical and investigative skills. My education and work in the STEM arena has prepared me to successfully solve any problem I come across.
I began in Day Cohort 14 at Nashville Software School in May 2016. Returning to software development was a priority for me, and NSS proved to be a great place to do this. I learned much more than just CSS, HTML, and Javascript; the tools and techniques I’ve acquired throughout my study at NSS have helped me become a stronger developer and a better teammate. The most rewarding part of the program was organizing and assisting my classmates during group projects.
Once my VISTA contract ended, I joined Park Center in Nashville, Tennessee as a Peer Specialist. I primarily worked with members who lived in the agency’s subsidized housing for people with mental illness. While at Park Center, I gained a greater appreciation for teamwork and social services, and I would like to continue making contributions to the mental health field with my technical skills.
I took a break from my STEM studies to do a year of service with the Americorps VISTA program in 2014. My project was designed to refine Nashville’s system for providing existing services to people experiencing homelessness, and I worked on a multi-agency collaboration that spanned both city government and nonprofit organizations to streamline this process.
In August 2012 I started a Master’s program in computer science at Middle Tennessee State University. While studying there, I gained a strong theoretical background in software development and learned C/C++. Assembly language was one of my favorite classes, because it taught me to analyze every minute detail of even the simplest problems.
I graduated from Rhodes College in Memphis, Tennessee with a Bachelor of Science in 2012. Although I majored in chemistry, I’m also very passionate about film and feminism, so I fit as many gender studies and film studies classes into my schedule as I could.


Monkeys can climb
Crickets can leap
Horses can race
Owls can seek
Cheetahs can run
Eagles can fly
People can try
But that's about it.
Hover over certain words


{{subject.name}}
Tutorials for data stucture, algorithm, node.js, angular, react, etc.
This page is still under construction, and will be coming soon!
--- layout: default key: tutorial ---
Tutorials for data stucture, algorithm, node.js, angular, react, etc.
This page is still under construction, and will be coming soon!


| Class and Description |
|---|
| Area
A simple class representing an area with start and end point.
|
| Chart
This is the base class this library is for.
|
| Drawable
This class represents an abstract drawable, weather it's a graph or a rectangle or
something else entirely.
|
| Font
The fonts that can be used with the
GraphicContext . |
| GraphicContext
Something you can draw on.
|
| PaintInstructions |
| RefreshListener
A listener that is used whenever an objects needs refreshing and wants to comunicate
this fact.
|
| RefreshListener.Event
Event for the
RefreshListener . |
| TextAlignment
General text alignment that can be used to draw text using an
GraphicContext . |
| Class and Description |
|---|
| Chart
This is the base class this library is for.
|
| ChartPart
This class represents a part of the
Chart that is not used for the actual
graph. |
| Drawable
This class represents an abstract drawable, weather it's a graph or a rectangle or
something else entirely.
|
| GraphicContext
Something you can draw on.
|
| PaintInstructions |
| RefreshListener
A listener that is used whenever an objects needs refreshing and wants to comunicate
this fact.
|
| Class and Description |
|---|
| Area
A simple class representing an area with start and end point.
|
| ChartPart
This class represents a part of the
Chart that is not used for the actual
graph. |
| Drawable
This class represents an abstract drawable, weather it's a graph or a rectangle or
something else entirely.
|
| Font
The fonts that can be used with the
GraphicContext . |
| GraphicContext
Something you can draw on.
|
| PaintInstructions |
| RefreshListener
A listener that is used whenever an objects needs refreshing and wants to comunicate
this fact.
|
| TextAlignment
General text alignment that can be used to draw text using an
GraphicContext . |
| Class and Description |
|---|
| Area
A simple class representing an area with start and end point.
|
| Font
The fonts that can be used with the
GraphicContext . |
| GraphicContext
Something you can draw on.
|
| RefreshListener
A listener that is used whenever an objects needs refreshing and wants to comunicate
this fact.
|
| RefreshListener.Event
Event for the
RefreshListener . |
| Class and Description |
|---|
| Area
A simple class representing an area with start and end point.
|
| Chart
This is the base class this library is for.
|
| ChartPart
This class represents a part of the
Chart that is not used for the actual
graph. |
| Drawable
This class represents an abstract drawable, weather it's a graph or a rectangle or
something else entirely.
|
| GraphicContext
Something you can draw on.
|
| PaintInstructions |
| RefreshListener
A listener that is used whenever an objects needs refreshing and wants to comunicate
this fact.
|
| Class and Description |
|---|
| Chart
This is the base class this library is for.
|
| RefreshListener
A listener that is used whenever an objects needs refreshing and wants to comunicate
this fact.
|
| Class and Description |
|---|
| Area
A simple class representing an area with start and end point.
|
| Chart
This is the base class this library is for.
|
| Font
The fonts that can be used with the
GraphicContext . |
| GraphicContext
Something you can draw on.
|
| Class and Description |
|---|
| Area
A simple class representing an area with start and end point.
|
| Chart
This is the base class this library is for.
|
| Font
The fonts that can be used with the
GraphicContext . |
| GraphicContext
Something you can draw on.
|
| Class and Description |
|---|
| Chart
This is the base class this library is for.
|
Copyright © 2020. All rights reserved.